[netcdf] 01/01: Imported Upstream version 4.4.1~rc1
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sat Apr 16 16:49:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to annotated tag upstream/4.4.1_rc1
in repository netcdf.
commit 02e49cecff4d1d29ed20cd4904c12bae35cf944c
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Apr 16 17:52:24 2016 +0200
Imported Upstream version 4.4.1~rc1
---
.github/ISSUE_TEMPLATE.md | 26 +
.gitignore | 13 +-
.travis.yml | 18 +-
.travis.yml.old | 52 -
CMakeLists.txt | 123 +-
CONTRIBUTING.html | 248 -
CONTRIBUTING.md | 77 +
Makefile.in | 1 +
RELEASE_NOTES.md | 18 +-
cf | 2 +-
config.h.cmake.in | 10 +-
config.h.in | 6 +
configure | 99 +-
configure.ac | 33 +-
docs/CMakeLists.txt | 1 +
docs/Doxyfile.developer | 4 +-
docs/Doxyfile.in | 29 +-
docs/FAQ.md | 10 +-
docs/Makefile.am | 4 +-
docs/Makefile.in | 5 +-
docs/OPeNDAP.dox | 3 +-
docs/credits.md | 4 +-
docs/esg.html | 222 -
docs/esg.md | 223 +
docs/guide.dox | 7 +-
docs/images/Makefile.in | 1 +
docs/mainpage.dox | 13 +-
docs/obsolete/fan_utils.html | 1437 +++
docs/release.css | 4 +-
docs/release_header.html | 2 +-
docs/software.md | 18 +-
docs/types.dox | 8 +-
docs/windows-binaries.md | 28 +-
examples/C/Makefile.in | 1 +
examples/CDL/Makefile.in | 1 +
examples/Makefile.in | 1 +
h5_test/CMakeLists.txt | 2 +-
h5_test/Makefile.in | 1 +
include/CMakeLists.txt | 23 +
include/Makefile.am | 2 +-
include/Makefile.in | 5 +-
include/nc.h | 1 -
include/nc3internal.h | 9 +-
include/nc4internal.h | 34 +-
include/nc_hashmap.h | 39 +
include/nc_tests.h | 3 +
include/ncdispatch.h | 34 +-
include/netcdf.h | 2 +-
include/netcdf_mem.h | 53 +-
include/netcdf_meta.h.in | 2 +-
include/netcdf_par.h | 11 +-
libdap2/Makefile.in | 1 +
libdap2/dapcvt.c | 33 +-
libdap2/dapdebug.h | 4 +-
libdap2/env | 14 +-
libdap2/getvara.c | 2 +-
libdap2/nccommon.h | 4 +
libdap2/ncd2dispatch.c | 817 +-
libdap2/ncd2dispatch.h | 210 +
libdispatch/CMakeLists.txt | 4 +-
libdispatch/Makefile.am | 3 +-
libdispatch/Makefile.in | 39 +-
libdispatch/datt.c | 2 +
libdispatch/dattget.c | 16 +-
libdispatch/ddim.c | 11 +-
libdispatch/ddispatch.c | 10 +-
libdispatch/dfile.c | 107 +-
libdispatch/dinternal.c | 48 +
libdispatch/dparallel.c | 40 +-
libdispatch/dsubstrate.c | 941 --
libdispatch/dvar.c | 2 +
libdispatch/dvarget.c | 5 +-
libdispatch/dvarinq.c | 39 +
libdispatch/dvarput.c | 113 +-
libdispatch/ncuri.c | 22 +-
liblib/CMakeLists.txt | 10 +-
liblib/Makefile.am | 2 +-
liblib/Makefile.in | 3 +-
liblib/nc_initialize.c | 4 -
libsrc/CMakeLists.txt | 2 +-
libsrc/Makefile.am | 6 +-
libsrc/Makefile.in | 30 +-
libsrc/attr.c | 685 ++
libsrc/dim.c | 45 +-
libsrc/ffio.c | 66 +-
libsrc/nc3internal.c | 11 +-
libsrc/nc_hashmap.c | 392 +
libsrc/ncx.c | 16754 +++++++++++++++++++++++++++++++--
libsrc/ncx.h | 17 +-
libsrc/ncx.m4 | 150 +-
libsrc/ncx_cray.c | 520 +-
libsrc/netcdf.3 | 1405 +++
libsrc/posixio.c | 174 +-
libsrc/putget.c | 8673 ++++++++++++++++-
libsrc/t_ncio.c | 12 +-
libsrc/v1hpg.c | 231 +-
libsrc/var.c | 46 +-
libsrc/winceio.c | 74 +-
libsrc4/Makefile.in | 1 +
libsrc4/nc4dim.c | 16 +-
libsrc4/nc4file.c | 50 +-
libsrc4/nc4hdf.c | 327 +-
libsrc4/nc4internal.c | 34 +-
libsrc4/nc4var.c | 25 +-
libsrcp/Makefile.in | 1 +
nc-config.cmake.in | 34 +-
nc-config.in | 38 +-
nc_test/CMakeLists.txt | 2 +-
nc_test/Makefile.am | 4 +-
nc_test/Makefile.in | 42 +-
nc_test/error.c | 4 +-
nc_test/test_get.c | 9331 ------------------
nc_test/test_put.c | 11942 -----------------------
nc_test/tst_inq_type.c | 164 +
nc_test4/CMakeLists.txt | 17 +-
nc_test4/Make0 | 31 +
nc_test4/Makefile.am | 14 +-
nc_test4/Makefile.in | 125 +-
nc_test4/bm_file.c | 10 +-
nc_test4/bm_radar.c | 4 +-
nc_test4/ref_hdf5_compat1.nc | Bin 0 -> 859591 bytes
nc_test4/ref_hdf5_compat2.nc | Bin 0 -> 6240 bytes
nc_test4/ref_hdf5_compat3.nc | Bin 0 -> 6256 bytes
nc_test4/run_empty_vlen_test.sh | 34 +
nc_test4/run_par_test.sh | 4 +
nc_test4/tst_compounds.c | 138 +-
nc_test4/tst_compounds3.c | 2 +-
nc_test4/tst_empty_vlen_unlim.c | 224 +
nc_test4/tst_files3.c | 4 +-
nc_test4/tst_hdf5_file_compat.c | 63 +
nc_test4/tst_mode.c | 41 +
ncdap_test/Makefile.in | 1 +
ncdap_test/expected3/Makefile.in | 1 +
ncdap_test/expected4/Makefile.in | 1 +
ncdap_test/expectremote3/Makefile.in | 1 +
ncdap_test/expectremote4/Makefile.in | 1 +
ncdap_test/test_partvar.c | 2 +-
ncdap_test/testdata3/Makefile.in | 1 +
ncdap_test/tst_remote.sh | 4 +-
ncdump/Makefile.in | 1 +
ncdump/cdl/Makefile.in | 1 +
ncdump/ctest.c | 1456 +++
ncdump/ctest64.c | 1456 +++
ncdump/expected/Makefile.in | 1 +
ncdump/ncdump.c | 14 +-
ncdump/ref1.ncml | 1 +
ncdump/tst_ncml.cdl | 1 +
ncgen/Makefile.in | 1 +
ncgen/ncgen.1 | 2 +-
ncgen3/Makefile.in | 1 +
nctest/Makefile.in | 1 +
oc2/Makefile.in | 1 +
oc2/ocdump.c | 39 +-
update_hdf5_compat_files.sh | 7 +
154 files changed, 35207 insertions(+), 25286 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..eb37ed9
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,26 @@
+> Please provide as much of the following information as you can, as applicable to the issue being reported. Naturally, not all information is relevant to every issue, but the more information we have to start, the better!
+
+### Environment Information
+
+> Feel free to skip this if the issue is related to documentation, a feature request, or general discussion.
+
+* What platform are you using? (please provide specific distribution/version in summary)
+ * [ ] Linux
+ * [ ] Windows
+ * [ ] OSX
+ * [ ] Other
+ * [ ] NA
+* 32 and/or 64 bit?
+ * [ ] 32-bit
+ * [ ] 64-bit
+* What build system are you using?
+ * [ ] autotools (`configure`)
+ * [ ] cmake
+* Can you provide a sample netCDF file or `C` code to recreate the issue?
+ * [ ] Yes (please attach to this issue, thank you!)
+ * [ ] No
+ * [ ] Not at this time
+
+### Summary of Issue
+
+### Steps to reproduce the behavior
diff --git a/.gitignore b/.gitignore
index 791625a..d00050a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,15 @@
+#####
+# The following generated files are
+# ignored in development branch,
+# but should be included in releases.
+#####
+
+#####
+# End ignored generated files.
+#####
+
### 'Normal' gitignore files.
autom4te.cache
-ctest.c
-ctest64.c
debug.txt
CTestConfig.cmake
Vagrantfile
@@ -19,7 +27,6 @@ scan-build
.deps
.libs
*.zip
-*.gz
Makefile
.DS_Store
build-par
diff --git a/.travis.yml b/.travis.yml
index 32f13ab..57dee76 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,19 +5,19 @@ services:
env:
matrix:
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned
before_install:
- docker pull $DOCKIMG > /dev/null
script:
- - docker run --rm -it -h "$CURHOST" -e USEDASH=FALSE -e RUNF=OFF -e RUNCXX=OFF -e RUNP=OFF -e RUNNCO=OFF -e USECMAKE=$USECMAKE -e USEAC=$USEAC -e COPTS=$COPTS -e CTEST_OUTPUT_ON_FAILURE=1 -v $(pwd):/netcdf-c $DOCKIMG
+ - docker run --rm -it -h "$CURHOST" -e USEDASH=FALSE -e RUNF=OFF -e RUNCXX=OFF -e RUNP=OFF -e RUNNCO=OFF -e USECMAKE=$USECMAKE -e USEAC=$USEAC -e DISTCHECK=$DISTCHECK -e COPTS=$COPTS -e CTEST_OUTPUT_ON_FAILURE=1 -v $(pwd):/netcdf-c $DOCKIMG
diff --git a/.travis.yml.old b/.travis.yml.old
deleted file mode 100644
index 5c0001b..0000000
--- a/.travis.yml.old
+++ /dev/null
@@ -1,52 +0,0 @@
-sudo: false
-language: c
-compiler:
- - gcc
- - clang
-
-addons:
- apt:
- packages:
- - libcurl4-openssl-dev
- - m4
- - wget
- - autoconf
- - libtool
- - gfortran
- - git
- - doxygen
- - graphviz
-
-before_install:
-
-before_script:
-
- ###
- # Install dependencies from a pre-built binary.
- ###
- - cd $HOME
- - wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/travisdeps.tar.bz2
-
- - tar -jxf travisdeps.tar.bz2
- - export LD_LIBRARY_PATH=$HOME/usr/lib
- - export PATH=$HOME/usr/bin:$PATH
- - cd -
-
- - mkdir build-all
- - mkdir build-min
-
- - cd build-min
- - cmake .. -DENABLE_NETCDF_4=OFF -DENABLE_DAP=OFF -DCMAKE_PREFIX_PATH=$HOME/usr-min
- - cd ..
-
- - cd build-all
- - cmake .. -DENABLE_MMAP=ON -DENABLE_DOXYGEN=ON -DENABLE_EXTRA_TESTS=ON -DENABLE_HDF4=ON -DCMAKE_PREFIX_PATH=$HOME/usr
- - cd ..
-
-script:
- - cd build-min
- - make -j 4
- - make test
- - cd ../build-all
- - make -j 4
- - make test
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eaa50e3..1878861 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,13 +26,13 @@ set(PACKAGE "netCDF" CACHE STRING "")
SET(NC_VERSION_MAJOR 4)
SET(NC_VERSION_MINOR 4)
-SET(NC_VERSION_PATCH 0)
-SET(NC_VERSION_NOTE "")
+SET(NC_VERSION_PATCH 1)
+SET(NC_VERSION_NOTE "-rc1")
SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
SET(VERSION ${netCDF_VERSION})
SET(NC_VERSION ${netCDF_VERSION})
-SET(netCDF_LIB_VERSION 11.0.0)
-SET(netCDF_SO_VERSION 11)
+SET(netCDF_LIB_VERSION 12.0.0)
+SET(netCDF_SO_VERSION 12)
SET(PACKAGE_VERSION ${VERSION})
# Get system configuration, Use it to determine osname, os release, cpu. These
@@ -169,7 +169,7 @@ INCLUDE(GenerateExportHeader)
################################
-# Compiler Configuration
+# Compiler and Linker Configuration
################################
##
@@ -182,7 +182,15 @@ IF(BUILD_SHARED_LIBS)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
-OPTION(NC_FIND_SHARED_LIBS "Find dynamicly-built versions of dependent libraries" ${BUILD_SHARED_LIBS})
+OPTION(NC_FIND_SHARED_LIBS "Find dynamically-built versions of dependent libraries" ${BUILD_SHARED_LIBS})
+
+##
+# We've had a request to allow for non-versioned shared libraries.
+# This seems reasonable enough to accomodate. See
+# https://github.com/Unidata/netcdf-c/issues/228 for more info.
+##
+OPTION(ENABLE_SHARED_LIBRARY_VERSION "Encode the library SO version in the file name of the generated library file." ON)
+
# Set some default linux gcc & apple compiler options for
# debug builds.
@@ -493,6 +501,9 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
##
IF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
SET(HDF5_LIBRARIES ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY})
+ SET(HDF5_C_LIBRARIES ${HDF5_C_LIBRARY})
+ SET(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARY})
+ INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
MESSAGE(STATUS "Using HDF5 C Library: ${HDF5_C_LIBRARY}")
MESSAGE(STATUS "Using HDF5 HL LIbrary: ${HDF5_HL_LIBRARY}")
ELSE(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR) # We are seeking out HDF5 with Find Package.
@@ -620,7 +631,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
ENDIF(NOT MSVC)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5free_memory "" HDF5_HAS_H5FREE)
-
+ CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS)
IF(HDF5_PARALLEL)
SET(HDF5_CC h5pcc)
@@ -681,17 +692,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
SET(USE_ZLIB ON)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
- ##
- # Check to see if libhdf5 contains
- # 'H5free_memory'.
- ##
- # CHECK_C_SOURCE_COMPILES("
- # #include <hdf5.h>
- # int main() {H5free_memory(NULL);}" HDF5_HAS_H5FREE)
- # CHECK_SYMBOL_EXISTS(H5free_memory "H5public.h" HDF5_HAS_H5FREE)
- # CHECK_LIBRARY_EXISTS(hdf5 H5free_memory "-L${HDF5_hdf5_LIBRARY}" HDF5_HAS_H5FREE)
- # MESSAGE(STATUS "HDF5_HAS_H5FREE: ${HDF5_HAS_H5FREE}")
-
ENDIF(USE_HDF5 OR ENABLE_NETCDF_4)
@@ -945,44 +945,35 @@ IF(ENABLE_PNETCDF)
FIND_LIBRARY(PNETCDF NAMES pnetcdf)
FIND_PATH(PNETCDF_INCLUDE_DIR pnetcdf.h)
IF(NOT PNETCDF)
- MESSAGE(STATUS "Cannot find pNetCDF library. Disabling pNetCDF support.")
+ MESSAGE(STATUS "Cannot find PNetCDF library. Disabling PNetCDF support.")
SET(USE_PNETCDF OFF CACHE BOOL "")
ELSE(NOT PNETCDF)
SET(USE_PARALLEL ON CACHE BOOL "")
+
+ # Check PNetCDF version. Must be >= 1.6.0
+ set(pnetcdf_h "${PNETCDF_INCLUDE_DIR}/pnetcdf.h" )
+ message(STATUS "PNetCDF include file ${pnetcdf_h} will be searched for version")
+ file(STRINGS "${pnetcdf_h}" pnetcdf_major_string REGEX "^#define PNETCDF_VERSION_MAJOR")
+ string(REGEX REPLACE "[^0-9]" "" pnetcdf_major "${pnetcdf_major_string}")
+ file(STRINGS "${pnetcdf_h}" pnetcdf_minor_string REGEX "^#define PNETCDF_VERSION_MINOR")
+ string(REGEX REPLACE "[^0-9]" "" pnetcdf_minor "${pnetcdf_minor_string}")
+ file(STRINGS "${pnetcdf_h}" pnetcdf_sub_string REGEX "^#define PNETCDF_VERSION_SUB")
+ string(REGEX REPLACE "[^0-9]" "" pnetcdf_sub "${pnetcdf_sub_string}")
+ set(pnetcdf_version "${pnetcdf_major}.${pnetcdf_minor}.${pnetcdf_sub}")
+ message(STATUS "Found PNetCDF version ${pnetcdf_version}")
+
+ if(${pnetcdf_version} VERSION_GREATER "1.6.0")
+ SET(STATUS_PNETCDF "ON")
+ INCLUDE_DIRECTORIES(${PNETCDF_INCLUDE_DIR})
+ SET(HAVE_LIBPNETCDF ON)
+ # pnetcdf => parallel
+ SET(STATUS_PARALLEL ON)
+ SET(USE_PARALLEL ON)
+ MESSAGE(STATUS "Using PNetCDF Library: ${PNETCDF}")
+ ELSE()
+ MESSAGE(WARNING "ENABLE_PNETCDF requires version 1.6.1 or later; found version ${pnetcdf_version}. PNetCDF is disabled")
+ ENDIF()
ENDIF(NOT PNETCDF)
-# ELSE()
-## SET(TMP_INC ${CMAKE_REQUIRED_INCLUDES})
-# SET(TMP_LB ${CMAKE_REQUIRED_LIBRARIES})
-# SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${PNETCDF})
-# SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PNETCDF_INCLUDE_DIR})
- # Check to see if version > 1.6.0
- # CHECK_C_SOURCE_RUNS("
- #include <stdio.h>
- #include <pnetcdf.h>
- # int main() {
- # int major = PNETCDF_VERSION_MAJOR;
- # int minor = PNETCDF_VERSION_MINOR;
- # int version = major*1000 + minor;
- # int ok = (version >= (1*1000 + 6));
- # return ok?0:1;}"
- # HAVE_PNETCDF_16)
-
-# SET(CMAKE_REQUIRED_INCLUDES ${TMP_INC})
-# SET(CMAKE_REQUIRED_LIBRARIES ${TMP_LB})
-
- #IF(HAVE_PNETCDF_16)
- # SET(ENABLE_PNETCDF "OFF")
- # MESSAGE(WARNING "ENABLE_PNETCDF requires version 1.6.0 or later; disabled")
- # ELSE()
-
- # SET(STATUS_PNETCDF "ON")
- # INCLUDE_DIRECTORIES(${PNETCDF_INCLUDE_DIR})
- # SET(HAVE_LIBPNETCDF ON)
- # pnetcdf => parallel
- # SET(STATUS_PARALLEL "ON")
- # SET(USE_PARALLEL ON)
- #ENDIF()
- #ENDIF()
ENDIF()
# Enable Parallel Tests.
@@ -1072,6 +1063,7 @@ ENDIF()
MARK_AS_ADVANCED(ENABLE_INTERNAL_DOCS VALGRIND_TESTS ENABLE_COVERAGE_TESTS )
MARK_AS_ADVANCED(ENABLE_DAP_REMOTE_TESTS ENABLE_DAP_LONG_TESTS USE_REMOTE_CDASH)
MARK_AS_ADVANCED(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS DOXYGEN_ENABLE_TASKS ENABLE_DOXYGEN_SERVER_SIDE_SEARCH)
+MARK_AS_ADVANCED(ENABLE_SHARED_LIBRARY_VERSION)
################################
# Option checks
################################
@@ -1185,6 +1177,7 @@ CHECK_FUNCTION_EXISTS(strtoull HAVE_STROULL)
CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
CHECK_FUNCTION_EXISTS(rand HAVE_RAND)
+CHECK_FUNCTION_EXISTS(random HAVE_RANDOM)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
CHECK_FUNCTION_EXISTS(MPI_Comm_f2C HAVE_MPI_COMM_F2C)
@@ -1218,8 +1211,13 @@ IF(NC_M4)
ENDIF()
MACRO(GEN_m4 filename)
-# IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
+
IF(HAVE_M4)
+ # If m4 is available, remove generated file if it exists.
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
+ FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
+ ENDIF()
+
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c
COMMAND ${NC_M4}
@@ -1248,6 +1246,8 @@ MACRO(add_bin_env_temp_large_test prefix F)
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
+ SET_TARGET_PROPERTIES(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
+ ${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
ENDMACRO()
@@ -1551,23 +1551,6 @@ ENDIF()
#####
ADD_SUBDIRECTORY(docs)
-#####
-# Moving on to CPack, install packages.
-#####
-INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- COMPONENT headers)
-
-INSTALL(FILES ${netCDF_BINARY_DIR}/include/netcdf_meta.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- COMPONENT headers)
-
-IF(ENABLE_PNETCDF OR ENABLE_PARALLEL)
- INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf_par.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- COMPONENT headers)
-ENDIF()
-
##
# Brute force, grab all of the dlls from the depency directory,
# install them in the binary dir. Grab all of the .libs, put them
diff --git a/CONTRIBUTING.html b/CONTRIBUTING.html
deleted file mode 100644
index 3447562..0000000
--- a/CONTRIBUTING.html
+++ /dev/null
@@ -1,248 +0,0 @@
-<html>
-<body>
-
-<img src="http://www.unidata.ucar.edu/images/logos/thredds_tds-150x150.png"/>
-
-<h1>Welcome contributors!</h1>
-
-First off, thank you for your interest in contributing to the THREDDS project!
-This repository contains the code for both netCDF-Java and the THREDDS Data Server (TDS) projects.
-The other projects held under the THREDDS umbrella are <a href="https://github.com/unidata/rosetta>Rosetta</a> and the latest addition, <a href="https://github.com/unidata/siphon>Siphon</a> (a python interface to the TDS).
-
-<h2>Process Overview</h2>
-
-<ul>
- <li> <a href="#gh-setup">GitHub Setup</a>
- <ul>
- <li> <a href="#gh-join">Join Github!</a>
- <li> <a href="#gh-fork">Fork the Unidata THREDDS project</a>
- <li> <a href="#gh-pull-ud-thredds">Pull down local copy of the Unidata THREDDS project</a>
- <li> <a href="#gh-pull-personal-thredds">Add and pull down a local copy of your THREDDS project fork</a>
- </ul>
- <li> <a href="#gh-contrib-workflow">Contribution workflow</a>
- <ul>
- <li> <a href="#gh-sync-ud">Make sure you have the latest changes from Unidata THREDDS repository</a>
- <li> <a href="#gh-branch">Make a new branch for your work and start hacking</a>
- <li> <a href="#gh-history-cleanup">Clean up your git commit history</a>
- <li> <a href="#gh-final-commit-for-pr">Push changes to your fork to use for the pull request</a>
- <li> <a href="#gh-pr">Make the pull request</a>
- </ul>
- <li> <a href="#gh-now-what">Now what?</a>
- </ul>
-</ul>
-
-<h2><a name="gh-setup">GitHub Setup</a></h2>
-
-<h3><a name="gh-join">Join Github!</a></h3>
-To get started contributing to the THREDDS project, the first thing you should do is <a href="https://github.com/join">signup for a free account on GitHub</a>.
-
-<h3><a name="gh-fork">Fork the Unidata THREDDS project</a></h3>
-Once you have an account, go ahead and <a href="https://github.com/unidata/thredds#fork-destination-box">fork</a> the THREDDS project.
-By forking the project, you will have a complete copy of the THREDDS project, history and all, under your personal account.
-This will allow you to make pull requests against the Unidata THREDDS repository, which is the primairy mechanism used to add new code to the project (even Unidata developers do this!).
-
-<h3><a name="gh-pull-ud-thredds">Pull down local copy of the Unidata THREDDS project</a></h3>
-After cloning the Unidata repository, you can pull down the source code to your local machine by using git:
-<pre>git clone --origin unidata git at github.com:Unidata/thredds.git (for ssh)</pre>
-or
-<pre>git clone --origin unidata https://github.com/Unidata/thredds.git (for http)</pre>
-
-Note that these commands reference the Unidata repository.
-<p>
-Normally in git, the remote repository you clone from is automatically named 'origin'.
-To help with any confusion when making pull requests, this commands above rename the remote repository to 'unidata'.
-
-<h3><a name="gh-pull-personal-thredds">Add and pull down a local copy of your THREDDS project fork</a></h3>
-
-Next, move into the source directory git has created, and add your personal fork of the THREDDS code as a remote"
-<pre>git clone --origin me git at github.com:<my-github-user-name>/thredds.git (for ssh)</pre>
-or
-<pre>git clone --origin me https://github.com/,my-github-user-name>/thredds.git (for http)</pre>
-
-Now you are all set!
-
-<h2><a name="gh-contrib-workflow">Contribution workflow</a></h2>
-
-<h3><a name="gh-sync-ud">Make sure you have the latest changes from Unidata THREDDS repository</a></h3>
-First, make sure you have the most recent changes to the THREDDS code by using git pull:
-<pre>git pull unidata master</pre>
-
-<h3><a name="gh-branch">Make a new branch for your work and start hacking</a></h3>
-Next, make a new branch where you will actually do the hacking:
-<pre>git checkout -b mywork</pre>
-As of this point, the branch 'mywork' is local.
-To make this branch part of your personal GitHub Remote repository, use the following command:
-<pre>git push -u me mywork</pre>
-
-Now git (on your local machine) is setup to a point where you can start hacking on the code and commit changes to your personal GitHub repository.
-
-At any point, you may add commits to your local copy of the repository by using:
-
-<pre>git commit</pre>
-
-If you would like these changes to be stored on your personal remote repository, simply use:
-<pre>git push me mywork</pre>
-Once you are satisified with your work, there is one last step to complete before submitting the pull request - clean up the history.
-
-<h3><a name="gh-history-cleanup">Clean up your git commit history</a></h3>
-
-Commit history can often be full of temporiariy commit messages, of commits with code changes that ultimately didn't make the final cut.
-<p>
-To clean up your history, use the <pre>git rebase -i</pre> command, which will open an editor:
-<pre>
-sarms at flip: [mywork] git rebase -i
-pick 083508e first commit of my really cool feature or bug fix!
-pick 9bcba01 Oops missed this one thing. This commit fixes that.
-
-# Rebase 083508e..9bcba01 onto 083508e (2 command(s))
-#
-# Commands:
-# p, pick = use commit
-# r, reword = use commit, but edit the commit message
-# e, edit = use commit, but stop for amending
-# s, squash = use commit, but meld into previous commit
-# f, fixup = like "squash", but discard this commit</pre>message
-# x, exec = run command (the rest of the line) using shell
-# d, drop = remove commit
-#
-# These lines can be re-ordered; they are executed from top to bottom.
-#
-# If you remove a line here THAT COMMIT WILL BE LOST.
-#
-# However, if you remove everything, the rebase will be aborted.
-#
-# Note that empty commits are commented out
-<pre>
-
-Based on my commit messages, you can see that commit </pre>1' fixed a mistake from my first commit.
-
-It would be nice to 'squash' those changes into the first commit, so that the official history does not show my mistake..uhhh...this extra commit.
-
-To do so, edit the text to change the second commits 'pick' to 'squash':
-
-<pre>h
-pick 083508e first commit of my really cool feature or bug fix!
-squash 9bcba01 Oops missed this one thing. This commit fixes that.
-
-# Rebase 083508e..9bcba01 onto 083508e (2 command(s))
-#
-# Commands:
-# p, pick = use commit
-# r, reword = use commit, but edit the commit message
-# e, edit = use commit, but stop for amending
-# s, squash = use commit, but meld into previous commit
-# f, fixup = like "squash", but discard this commit</pre>message
-# x, exec = run command (the rest of the line) using shell
-# d, drop = remove commit
-#
-# These lines can be re-ordered; they are executed from top to bottom.
-#
-# If you remove a line here THAT COMMIT WILL BE LOST.
-#
-# However, if you remove everything, the rebase will be aborted.
-#
-# Note that empty commits are commented out
-<pre>
-
-Once you have marked the commits to be squashed and exited the edit, you will prompted to change the commit message for the new, squashed, mega commit:
-
-</pre>
-# This is a combination of 2 commits.
-# The first commit's message is:
-
-first commit of my really cool feature or bug fix!
-
-# This is the 2nd commit message:
-
-Oops missed this one thing. This commit fixes that.
-
-#Please enter the commit message for your changes. Lines starting
-# with '#' will be ignored, and an empty message aborts the commit.
-#
-# Date: Thu Oct 15 09:59:23 2015 -0600
-#
-# interactive rebase in progress; onto 083508e
-# Last commands done (2 commands done):
-# pick 09134d5 first commit of my really cool feature or bug fix!
-# squash 9bcba01 Oops missed this one thing. This commit fixes that.
-# No commands remaining.
-# You are currently editing a commit while rebasing branch 'mywork' on '0835 08e'.
-#
-# Changes to be committed:
-...
-<pre>
-
-Edit the two commit messages into a single message that describes the overall change:
-
-</pre>
-
-Once you have and exit, you will have a change to change the commit message for the new, squashed, mega commit:
-
-<pre>h
-
-Really cool feature or bug fix. Addresses the github issue Unidata/thredds#1
-
-#Please enter the commit message for your changes. Lines starting
-# with </pre>l be ignored, and an empty message aborts the commit.
-#
-# Date: Thu Oct 15 09:59:23 2015 -0600
-#
-# interactive rebase in progress; onto 083508e
-# Last commands done (2 commands done):
-# pick 09134d5 first commit of my really cool feature or bug fix!
-# squash 9bcba01 Oops missed this one thing. This commit fixes that.
-# No commands remaining.
-# You are currently editing a commit while rebasing branch 'mywork' on '0835 08e'.
-#
-# Changes to be committed:
-...
-<pre>
-
-Now, when you look at your git commit logs, you will see:
-
-</pre>
-commit 805b4723c4a2cbbed240354332cd7af57559a1b9
-Author: Sean Arms <sarms at ucar.edu>
-Date: Thu Oct 15 09:59:23 2015 -0600
-
- Really cool feature or bug fix. Addresses the github issue Unidata/thredds#1
-
-<pre>
-
-Note that the commit conains the text </pre>a/thredds#1'.
-This is a cool github trick that will allow you to reference GitHub issues within your commit messages.
-When viewed on github.com, this will be turned into a hyperlink to the issue.
-While not every contribution will address an issue, please use this feature if your contribution does!
-
-
-<h3><a name="gh-final-commit-for-pr">Push changes to your fork to use for the pull request</a></h3>
-Now that you have cleaned up the history, you will need to make a final push to your personal GitHub repository.
-However, the rebase has changed the history of your local branch, which means you will need to use the '--force' flag in your push:
-
-<pre>ush --force me mywork</pre>
-
-
-<h3><a name="gh-pr">Make the pull request</a></h3>
-Finally, go to your personal remote repository on github.com and switch to your 'mywork' branch.
-Once you are on your work branch, you will see a button that says "Pull request", which will allow you to make a pull request.
-
-The github pull request page will allow you to select which repository and branch you would like to submit the pull request to (the 'base fork', which should be 'Unidata/thredds', and 'base', which should be 'master'), as well as the 'head fork' and 'compare' (which should be '<github-user-name/thredds>' and 'mywork', respectivly).
-Once this is setup, you can make the pull request.
-
-
-<h2><a name="gh-now-what">Now what?</a></h2>
-
-The Unidata THREDDS project is setup such that automated testing for all pull requests is done via TravisCI.
-The status of the tests can be seen on the pull request page.
-For example, see <a href="https://github.com/Unidata/thredds/pull/231">Unidata/thredds#231</a> by selecting the 'View Details' button.
-This pull request was tested on <a href="https://travis-ci.org/Unidata/thredds/builds/84433104">TravisCI</a> and passed on all versions of Java supported by the current master branch.
-We have setup the THREDDS repository such that changes that do not pass these tests cannot be merged.
-
-One of the Unidata THREDDS team members will work with you to make sure your work is ready for merging once the tests have passed on TravisCI.
-Note that as changes to your pull request may be required, you can simply push thos changes to your personal GitHub repository and the pull request will automatically be updated and new TravisCI tests will be initiated.
-
-If your pull request addresses a bug, we kindly ask that you include a test in your pull request.
-If you do not know how to write tests in Java, we will be more than happy to work with you!
-
-</body>
-</html>
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..004f76d
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,77 @@
+# How to contribute
+
+Thanks for your interest in contributing to the netCDF project. There are many different platforms and configurations which we don't have access to directly, and your contributions help ensure that things continue to run smoothly for **all** of our users. We'll strive to keep the process simple for you, the contributor, by establishing a handful of guidelines up front.
+
+> We will assume that you are familiar with `git` and `GitHub`. If not, you may go through the GitHub tutorial found at [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/). This tutorial should only take around 10 minutes.
+
+## Table of Contents
+
+* [Workflow](#workflow)
+* [Characteristics of an accepted pull request](#chars)
+ * [Small bug-and-typo fixes](#smallissues)
+* [Testing your contribution](#testing)
+ * [Spot-checks](#spotcheck)
+ * [Continuous Integration testing](#contint)
+ * [Regression testing with Docker](#regression)
+* [Final Remarks](#conclusion)
+
+# Workflow <A NAME="workflow"></A>
+
+The process for contributing a patch to netCDF roughly follows the following workflow:
+
+* (Optional) Open an issue [on GitHub](http://github.com/Unidata/netcdf-c/issues).
+
+> This step is ***strongly*** encouraged. The larger the scope of the proposed change, the more likely it is that we will need to have a discussion about the ramifications before accepting the pull request. We don't want anybody to waste their time developing a patch only to have it rejected because we disagree with the premise or goal! By opening an issue you can start a public dialog with us about the proposed changes, ensuring that everybody is on the same page and that no time/eff [...]
+
+* Fork the [Unidata/netcdf-c](http://github.com/Unidata/netcdf-c) repository.
+* Make the desired changes to the netcdf-c project.
+* Compile your code and test your changes. See the section on testing your changes below for more information; we provide a lot of options!
+* Push your changes to GitHub.
+* Issue a pull request.
+
+Once a pull request has been received, it will be reviewed and evaluated by the netCDF developers at Unidata. If there are any questions or comments, they will be appended to the discussion area of the pull request.
+
+# The characteristics of an accepted pull request <A NAME="chars"></A>
+
+Not every pull request is created equally; while we appreciate every contribution we receive, we do not accept them all. Those that we *do* accept generally have the following in common:
+
+* **They possess a clear purpose** - What is the point of the pull request? How does it benefit the netCDF community at large? If it is not beneficial in an apparent fashion, we will likely reject the pull request.
+* **The code is documented** - The netCDF developers must understand not only *what* a change is doing, but *how* it is doing it. Documenting your code makes it easier for us to understand the workflow of your patch. If we can't figure out how a patch works, we will ask for clarification before accepting it.
+* **They pass QA** - If new functionality has been added, corresponding unit tests have been created and wired in to the build systems. We do not expect you to perform comprehensive testing across a multitude of platforms, but at the very least your code should **compile** and no existing tests should be broken. A pull request that doesn't compile will be rejected on principle, and a pull request which breaks tests will have to be corrected before it is accepted. See "Testing your cha [...]
+* **They do not compromise the principles behind netCDF** - NetCDF has a 100% iron-clad commitment to backwards compatibility. Any file ever created with netCDF must be readable by any future version of netCDF. The netCDF data models and file formats are **well** defined. If your purpose is to modify the data model or file format, **please** discuss this with us first. ***If*** we are in agreement regarding the changes, we will need to discuss how to add them as a **new** data-model/ [...]
+
+## What about Typo/Bug Fixes/Incremental Fixes? <A NAME="smallissues"></A>
+
+Many of the pull requests we receive do little other than to fix a typo or correct a bug in our code. This is great, and we encourage as many of these as we can get! "Fixing mistakes" falls within the principles guiding netCDF, and these changes are 1) Typically self-describing rarely result in any issues with QA
+
+# Testing your changes <A NAME="testing"></A>
+
+There are several ways to test your changes to ensure that your pull request passes QA. There are manual *spot-checks* which test the code "on-the-spot", and there are automated *continuous integration* tests which will run and evaluate any contributes to ensure nothing breaks. **Advanced** users may also use Unidata-maintained *Docker* images for running *regression* tests.
+
+## Spot-check tests <A NAME="spotcheck"></A>
+
+* `make check` if you are using configure/autotools.
+* `make test` if you are using cmake.
+
+## Continuous Integration testing with Travis CI <A NAME="contint"></A>
+
+Travis CI is a system for providing **automated** continuous integration testing, without requiring any effort on the part of the contributor. Any time a change is pushed out to GitHub, a series of tests will run automatically and will ultimately report a success or a failure. You may view the Unidata Travis dashboard [here](https://travis-ci.org/Unidata/). Each project listed may be "drilled down" into, where specific information may be found.
+
+## Regression testing with Docker <A NAME="regression"></A>
+
+If you are not familiar with Docker, feel free to skip this section *or* read up on Docker [at their website](http://www.docker.io). If you are familiar with Docker, please read on.
+
+We provide several Docker images for performing regression tests against netCDF-C. These tests build and test `libnetcdf`, and then use it as the basis for testing the following packages:
+
+* NetCDF-C++
+* NetCDF-Fortran
+* NetCDF-Python
+* NetCDF Operators (NCO)
+
+By performing these comprehensive tests, we're able to see if any change in the core library results in unexpected behavior with the common interfaces. For full documentation, please see [this page](https://github.com/Unidata/docker-nctests/tree/master/tests-regression).
+
+These tests will be run against any pull request submitted; you are encouraged to make use of them if you so like.
+
+# We are here to help <A NAME="conclusion"></A>
+
+We want as many contributions as we can get, and are here to help ensure that your efforts are not wasted! We will work with you to ensure that your code works on more esoteric platforms (`ARM`, `Windows`) and that the pull request possesses the characteristics described above. Feel free to reach out to us if you have any questions!
diff --git a/Makefile.in b/Makefile.in
index 2d38537..a86a4fc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -306,6 +306,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index e365fb2..4c07b7b 100755
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -5,6 +5,22 @@ Release Notes {#RELEASE_NOTES}
This file contains a high-level description of this package's evolution. Releases are in reverse chronological order (most recent first). Note that, as of netcdf 4.2, the `netcdf-c++` and `netcdf-fortran` libraries have been separated into their own libraries.
+## 4.4.1 - TBD
+
+### 4.4.1-RC1 - April 15, 2016
+
+* [Bug Fix][Enhancement] Fixed an issue with netCDF4 files generated using version `1.10.0` of the HDF5 library. The 1.10 release potentially changed the underlying file format, introducing a backwards compatibility issue with the files generated. HDF5 provided an API for retaining the 1.8.x file format, which is now on by default. See [GitHub Issue #250](https://github.com/Unidata/netcdf-c/issues/250) for more information.
+* [Bug Fix] Corrected an issue with autotools-based builds performed out-of-source-tree. See [GitHub Issue #242](https://github.com/Unidata/netcdf-c/issues/242) for more information.
+* [Enhancement] Modified `nc_inq_type()` so that it would work more broadly without requiring a valid ncid. See [GitHub Issue #240](https://github.com/Unidata/netcdf-c/issues/240) for more information.
+* [Enhancement] Accepted a patch code which added a hashmap lookup for rapid var and dim retrieval in nc3 files, contributed by Greg Sjaardema. See [GitHub Pull Request #238](https://github.com/Unidata/netcdf-c/pull/238) for more information.
+* [Bug Fix] Accepted a contributed pull request which corrected an issue with how the cmake-generated `nc-config` file determined the location of installed files. See [GitHub Pull Request #235](https://github.com/Unidata/netcdf-c/pull/235) for more information.
+* [Enhancement] Added an advanced option for CMake-based builds, `ENABLE_SHARED_LIBRARY_VERSION`. This option is `ON` by default, but if turned off, only `libnetcdf.dylib` will be generated, instead of files containing the SOVERSION in the file name. This is a requested feature most people might not care about. See [GitHub #228](https://github.com/Unidata/netcdf-c/issues/228) for more information.
+* [Bug Fix] Corrected an issue with duplicated error codes defined in multiple header files. See [GitHub #213](https://github.com/Unidata/netcdf-c/issues/213) for more information.
+* [Bug Fix] Addressed an issue specific to Visual Studio 2015 on Windows. On very large files, some calls to the `fstat` class of functions would fail for no apparent reason. This behavior was **not** observed under Visual Studio 2013. This has now been mitigated. See [GitHub #188](https://github.com/Unidata/netcdf-c/issues/188) for more information.
+* [Enhancement] Updated `nc-config` to report whether `logging` is enabled in netcdf. Additionally, if `f03` is available in an installed netcdf-fortran library, it will now be reported as well.
+* [Bug Fix] Addressed an issue where `netcdf_mem.h` was not being installed by cmake. See [GitHub #227](https://github.com/Unidata/netcdf-c/issues/227) for more information.
+* [Bug Fix] Addressed an issue where `ncdump` would crash when trying to read a netcdf file containing an empty ragged `VLEN` variable in an unlimited dimension. See [GitHub #221](https://github.com/Unidata/netcdf-c/issues/221) for more information.
+
## 4.4.0 Released - January 13, 2016
* Bumped SO version to 11.0.0.
@@ -74,7 +90,7 @@ NC\_FORMAT\_UNDEFINED | NC\_FORMATX\_UNDEFINED
* Reduced minimum cmake version to `2.8.11` from `2.8.12`. This will allow for cmake use on a broader set of popular linux platforms without having to do a custom cmake install. See https://github.com/Unidata/netcdf-c/issues/135 for more information.
-* The documentation section `The Default Chunking Scheme` has been updated with more information. This lives in the `guide.dox` file in the `docs/` directory, or can be found online in the appropriate location (typically http://www.unidata.ucar.edu/netcdf/docs), once this release has been published.
+* The documentation section `The Default Chunking Scheme` has been updated with more information. This lives in the `guide.dox` file in the `docs/` directory, or can be found online in the appropriate location (typically http://www.unidata.ucar.edu/netcdf/docs/), once this release has been published.
### 4.4.0-RC3 2015-10-08
diff --git a/cf b/cf
index a2ca1a0..c200883 100644
--- a/cf
+++ b/cf
@@ -4,7 +4,7 @@ DB=1
#X=-x
#FAST=1
-#HDF5=1
+HDF5=1
DAP=1
#PNETCDF=1
#PAR4=1
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 5f747d4..b07b6a5 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -34,12 +34,12 @@ are set when opening a binary file on Windows. */
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
-
- #ifndef snprintf
- #if _MSC_VER<1900
+
+ #ifndef snprintf
+ #if _MSC_VER<1900
#define snprintf _snprintf
#endif
- #endif
+ #endif
#endif
@@ -96,6 +96,7 @@ are set when opening a binary file on Windows. */
#cmakedefine USE_PARALLEL_POSIX 1
#cmakedefine USE_PARALLEL_MPIO 1
#cmakedefine HDF5_HAS_H5FREE 1
+#cmakedefine HDF5_HAS_LIBVER_BOUNDS 1
#cmakedefine HDF5_PARALLEL 1
#cmakedefine USE_PARALLEL 1
#cmakedefine USE_PARALLEL4 1
@@ -271,6 +272,7 @@ are set when opening a binary file on Windows. */
#cmakedefine HAVE_STRSTR
#cmakedefine HAVE_MKSTEMP
#cmakedefine HAVE_RAND
+#cmakedefine HAVE_RANDOM
#cmakedefine HAVE_GETTIMEOFDAY
#cmakedefine HAVE_MPI_COMM_F2C
#cmakedefine HAVE_MEMMOVE
diff --git a/config.h.in b/config.h.in
index c3eb51b..5b88c28 100644
--- a/config.h.in
+++ b/config.h.in
@@ -209,6 +209,9 @@
/* Define to 1 if you have the `rand' function. */
#undef HAVE_RAND
+/* Define to 1 if you have the `random' function. */
+#undef HAVE_RANDOM
+
/* Define to 1 if the system has the type `size_t'. */
#undef HAVE_SIZE_T
@@ -339,6 +342,9 @@
nc4file. */
#undef HDF5_HAS_H5FREE
+/* if true, netcdf4 file properties will be set using H5Pset_libver_bounds */
+#undef HDF5_HAS_LIBVER_BOUNDS
+
/* if true, hdf5 has parallelism enabled */
#undef HDF5_PARALLEL
diff --git a/configure b/configure
index 3705213..69640c2 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.
+# Generated by GNU Autoconf 2.69 for netCDF 4.4.1-rc1.
#
# 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'
-PACKAGE_STRING='netCDF 4.4.0'
+PACKAGE_VERSION='4.4.1-rc1'
+PACKAGE_STRING='netCDF 4.4.1-rc1'
PACKAGE_BUGREPORT='support-netcdf at unidata.ucar.edu'
PACKAGE_URL=''
@@ -663,6 +663,7 @@ HAS_DISKLESS
HAS_PARALLEL4
HAS_PARALLEL
HAS_SZLIB
+HAS_LOGGING
HAS_HDF5
HAS_PNETCDF
HAS_HDF4
@@ -1495,7 +1496,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 to adapt to many kinds of systems.
+\`configure' configures netCDF 4.4.1-rc1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1566,7 +1567,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of netCDF 4.4.0:";;
+ short | recursive ) echo "Configuration of netCDF 4.4.1-rc1:";;
esac
cat <<\_ACEOF
@@ -1783,7 +1784,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-netCDF configure 4.4.0
+netCDF configure 4.4.1-rc1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2492,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, which was
+It was created by netCDF $as_me 4.4.1-rc1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2846,8 +2847,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
NC_VERSION_MAJOR=4
NC_VERSION_MINOR=4
- NC_VERSION_PATCH=0
- NC_VERSION_NOTE=""
+ NC_VERSION_PATCH=1
+ NC_VERSION_NOTE="-rc1"
#####
# Set some variables used to generate a libnetcdf.settings file,
@@ -2856,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>VERSION
+echo 4.4.1-rc1>VERSION
-{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.0" >&5
-$as_echo "$as_me: netCDF 4.4.0" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.1-rc1" >&5
+$as_echo "$as_me: netCDF 4.4.1-rc1" >&6;}
# Keep libtool macros in an m4 directory.
@@ -3014,6 +3015,21 @@ test -n "$target_alias" &&
ac_config_headers="$ac_config_headers config.h"
+##
+# Some files need to exist in build directories
+# that do not correspond to their source directory, or
+# the test program makes an assumption about where files
+# live. AC_CONFIG_LINKS provides a mechanism to link/copy files
+# if an out-of-source build is happening.
+##
+
+ac_config_links="$ac_config_links nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc"
+
+ac_config_links="$ac_config_links nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc"
+
+ac_config_links="$ac_config_links nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc"
+
+
# This call is required by automake.
am__api_version='1.15'
@@ -3501,7 +3517,7 @@ fi
# Define the identity of the package.
PACKAGE='netcdf'
- VERSION='4.4.0'
+ VERSION='4.4.1-rc1'
cat >>confdefs.h <<_ACEOF
@@ -15902,7 +15918,7 @@ fi
# Check for these functions...
for ac_func in strlcat strerror snprintf strchr strrchr strcat strcpy \
strdup strcasecmp strtod strtoll strtoull strstr \
- mkstemp rand memcmp \
+ mkstemp rand random memcmp \
getrlimit gettimeofday fsync MPI_Comm_f2c
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -17979,6 +17995,12 @@ $as_echo "#define HDF5_HAS_H5FREE 1" >>confdefs.h
fi
+ if test "x$ac_cv_func_H5Pset_libver_bounds" = xyes; then
+
+$as_echo "#define HDF5_HAS_LIBVER_BOUNDS 1" >>confdefs.h
+
+ fi
+
# If the user wants hdf4 built in, check it out.
if test "x$enable_hdf4" = xyes; then
for ac_header in mfhdf.h
@@ -18853,7 +18875,9 @@ HAS_PNETCDF=$enable_pnetcdf
HAS_HDF5=$enable_netcdf_4
-HAS_SZLIB=$nc_has_szlib
+HAS_LOGGING=$enable_logging
+
+HAS_SZLIB=$ac_cv_func_H4Z_SZIP
HAS_PARALLEL=$enable_parallel
@@ -19694,7 +19718,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, which was
+This file was extended by netCDF $as_me 4.4.1-rc1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19721,6 +19745,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
+config_links="$ac_config_links"
config_commands="$ac_config_commands"
_ACEOF
@@ -19751,6 +19776,9 @@ $config_files
Configuration headers:
$config_headers
+Configuration links:
+$config_links
+
Configuration commands:
$config_commands
@@ -19760,7 +19788,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
+netCDF config.status 4.4.1-rc1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -20175,6 +20203,9 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "nc_test4/ref_hdf5_compat1.nc") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc" ;;
+ "nc_test4/ref_hdf5_compat2.nc") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc" ;;
+ "nc_test4/ref_hdf5_compat3.nc") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"docs/Doxyfile") CONFIG_FILES="$CONFIG_FILES docs/Doxyfile" ;;
@@ -20225,6 +20256,7 @@ done
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
@@ -20522,7 +20554,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_HEADERS"
-eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS"
shift
for ac_tag
do
@@ -20799,7 +20831,38 @@ $as_echo X"$_am_arg" |
}
s/.*/./; q'`/stamp-h$_am_stamp_count
;;
+ :L)
+ #
+ # CONFIG_LINK
+ #
+
+ if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then
+ :
+ else
+ # Prefer the file from the source tree if names are identical.
+ if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then
+ ac_source=$srcdir/$ac_source
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5
+$as_echo "$as_me: linking $ac_source to $ac_file" >&6;}
+
+ if test ! -r "$ac_source"; then
+ as_fn_error $? "$ac_source: file not found" "$LINENO" 5
+ fi
+ rm -f "$ac_file"
+
+ # Try a relative symlink, then a hard link, then a copy.
+ case $ac_source in
+ [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;;
+ *) ac_rel_source=$ac_top_build_prefix$ac_source ;;
+ esac
+ ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
+ ln "$ac_source" "$ac_file" 2>/dev/null ||
+ cp -p "$ac_source" "$ac_file" ||
+ as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5
+ fi
+ ;;
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
diff --git a/configure.ac b/configure.ac
index 96b6dbe..9218a5a 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], [support-netcdf at unidata.ucar.edu])
+AC_INIT([netCDF], [4.4.1-rc1], [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=""
+AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=1
+AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc1"
#####
# Set some variables used to generate a libnetcdf.settings file,
@@ -48,6 +48,18 @@ AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([config.h])
+##
+# Some files need to exist in build directories
+# that do not correspond to their source directory, or
+# the test program makes an assumption about where files
+# live. AC_CONFIG_LINKS provides a mechanism to link/copy files
+# if an out-of-source build is happening.
+##
+
+AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc])
+AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc])
+AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc])
+
# This call is required by automake.
AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects])
AM_MAINTAINER_MODE()
@@ -751,7 +763,7 @@ AC_HEADER_STDBOOL
# Check for these functions...
AC_CHECK_FUNCS([strlcat strerror snprintf strchr strrchr strcat strcpy \
strdup strcasecmp strtod strtoll strtoull strstr \
- mkstemp rand memcmp \
+ mkstemp rand random memcmp \
getrlimit gettimeofday fsync MPI_Comm_f2c])
# Does the user want to use NC_DISKLESS?
@@ -940,6 +952,10 @@ if test "x$enable_netcdf_4" = xyes; then
AC_DEFINE([HDF5_HAS_H5FREE], [1], [if true, H5free_memory() will be used to free hdf5-allocated memory in nc4file.])
fi
+ if test "x$ac_cv_func_H5Pset_libver_bounds" = xyes; then
+ AC_DEFINE([HDF5_HAS_LIBVER_BOUNDS], [1], [if true, netcdf4 file properties will be set using H5Pset_libver_bounds])
+ fi
+
# If the user wants hdf4 built in, check it out.
if test "x$enable_hdf4" = xyes; then
AC_CHECK_HEADERS([mfhdf.h], [], [nc_mfhdf_h_missing=yes])
@@ -1209,7 +1225,8 @@ AC_SUBST(HAS_NC4,[$enable_netcdf_4])
AC_SUBST(HAS_HDF4,[$enable_hdf4])
AC_SUBST(HAS_PNETCDF,[$enable_pnetcdf])
AC_SUBST(HAS_HDF5,[$enable_netcdf_4])
-AC_SUBST(HAS_SZLIB,[$nc_has_szlib])
+AC_SUBST(HAS_LOGGING, [$enable_logging])
+AC_SUBST(HAS_SZLIB,[$ac_cv_func_H4Z_SZIP])
AC_SUBST(HAS_PARALLEL,[$enable_parallel])
AC_SUBST(HAS_PARALLEL4,[$enable_parallel4])
AC_SUBST(HAS_DISKLESS,[$enable_diskless])
@@ -1288,9 +1305,9 @@ AC_MSG_NOTICE([generating header files and makefiles])
AC_CONFIG_FILES([Makefile
nc-config
netcdf.pc
- libnetcdf.settings
- postinstall.sh
- include/netcdf_meta.h
+ libnetcdf.settings
+ postinstall.sh
+ include/netcdf_meta.h
include/Makefile
h5_test/Makefile
docs/Makefile
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index c1b59d3..f4c5092 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -20,6 +20,7 @@ IF(ENABLE_DOXYGEN)
ADD_CUSTOM_TARGET(doc_all ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/auth.html ${CMAKE_CURRENT_BINARY_DIR}/html
+ COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/obsolete/fan_utils.html ${CMAKE_CURRENT_BINARY_DIR}/html
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API Documentation" VERBATIM)
diff --git a/docs/Doxyfile.developer b/docs/Doxyfile.developer
index 520205b..ae92838 100755
--- a/docs/Doxyfile.developer
+++ b/docs/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
+PROJECT_NUMBER = 4.4.1-rc1
# 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
@@ -1110,7 +1110,7 @@ HTML_STYLESHEET =
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET = docs/extra.css
+HTML_EXTRA_STYLESHEET =
# 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
diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in
index ac90eb8..c7bf5ee 100644
--- a/docs/Doxyfile.in
+++ b/docs/Doxyfile.in
@@ -117,7 +117,7 @@ ABBREVIATE_BRIEF =
# description.
# The default value is: NO.
-ALWAYS_DETAILED_SEC = NO
+ALWAYS_DETAILED_SEC = YES
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
@@ -125,7 +125,7 @@ ALWAYS_DETAILED_SEC = NO
# operators of the base classes will not be shown.
# The default value is: NO.
-INLINE_INHERITED_MEMB = NO
+INLINE_INHERITED_MEMB = YES
# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
# before files name in the file list and in the header files. If set to NO the
@@ -189,7 +189,7 @@ QT_AUTOBRIEF = YES
# not recognized any more.
# The default value is: NO.
-MULTILINE_CPP_IS_BRIEF = NO
+MULTILINE_CPP_IS_BRIEF = YES
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
@@ -350,7 +350,7 @@ SUBGROUPING = YES
# SEPARATE_MEMBER_PAGES.
# The default value is: NO.
-INLINE_GROUPED_CLASSES = NO
+INLINE_GROUPED_CLASSES = YES
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
# with only public data fields or simple typedef fields will be shown inline in
@@ -360,7 +360,7 @@ INLINE_GROUPED_CLASSES = NO
# Man pages) or section (for LaTeX and RTF).
# The default value is: NO.
-INLINE_SIMPLE_STRUCTS = NO
+INLINE_SIMPLE_STRUCTS = YES
# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
# enum is documented as struct, union, or enum with the name of the typedef. So
@@ -424,7 +424,7 @@ EXTRACT_STATIC = YES
# for Java sources.
# The default value is: YES.
-EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_CLASSES = NO
# This flag is only useful for Objective-C code. When set to YES local methods,
# which are defined in the implementation section but not in the interface are
@@ -441,7 +441,7 @@ EXTRACT_LOCAL_METHODS = NO
# are hidden.
# The default value is: NO.
-EXTRACT_ANON_NSPACES = NO
+EXTRACT_ANON_NSPACES = YES
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
@@ -513,7 +513,7 @@ SHOW_GROUPED_MEMB_INC = NO
# files with double quotes in the documentation rather than with sharp brackets.
# The default value is: NO.
-FORCE_LOCAL_INCLUDES = NO
+FORCE_LOCAL_INCLUDES = YES
# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
# documentation for inline members.
@@ -534,7 +534,7 @@ SORT_MEMBER_DOCS = YES
# this will also influence the order of the classes in the class list.
# The default value is: NO.
-SORT_BRIEF_DOCS = NO
+SORT_BRIEF_DOCS = YES
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
# (brief and detailed) documentation of class members so that constructors and
@@ -546,7 +546,7 @@ SORT_BRIEF_DOCS = NO
# detailed member documentation.
# The default value is: NO.
-SORT_MEMBERS_CTORS_1ST = NO
+SORT_MEMBERS_CTORS_1ST = YES
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
@@ -758,6 +758,7 @@ INPUT = \
@abs_top_srcdir@/docs/file_format_specifications.md \
@abs_top_srcdir@/docs/tutorial.dox \
@abs_top_srcdir@/docs/notes.md \
+ @abs_top_srcdir@/docs/esg.md \
@abs_top_srcdir@/docs/all-error-codes.md \
@abs_top_srcdir@/docs/FAQ.md \
@abs_top_srcdir@/docs/software.md \
@@ -765,8 +766,8 @@ INPUT = \
@abs_top_srcdir@/docs/COPYRIGHT.dox \
@abs_top_srcdir@/docs/credits.md \
@abs_top_srcdir@/include/netcdf.h \
- @abs_top_srcdir@/include/netcdf_meta.h \
@abs_top_srcdir@/include/netcdf_mem.h \
+ @abs_top_srcdir@/include/netcdf_par.h \
@abs_top_srcdir@/libdispatch/dfile.c \
@abs_top_srcdir@/libdispatch/ddim.c \
@abs_top_srcdir@/libdispatch/dvar.c \
@@ -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 = @DOXYGEN_CSS_FILE@
+HTML_STYLESHEET =
# 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
@@ -1153,7 +1154,7 @@ HTML_STYLESHEET = @DOXYGEN_CSS_FILE@
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = @DOXYGEN_CSS_FILE@
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
@@ -2237,7 +2238,7 @@ INCLUDED_BY_GRAPH = YES
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
-CALL_GRAPH = YES
+CALL_GRAPH = NO
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
# dependency graph for every global function or class method.
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 6e7681a..6951579 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -1,4 +1,4 @@
-FAQ {#ncFAQ}
+FAQ {#faq}
=======================
[TOC]
@@ -11,7 +11,7 @@ What Is netCDF? {#What-Is-netCDF}
NetCDF (network Common Data Form) is a set of interfaces for
-array-oriented data access and a [freely](http://www.unidata.ucar.edu/software/netcdf/docs/COPYRIGHT) distributed
+array-oriented data access and a [freely](http://www.unidata.ucar.edu/software/netcdf/docs/copyright.html) distributed
collection of data access libraries for C, Fortran, C++, Java, and other
languages. The netCDF libraries support a machine-independent format for
representing scientific data. Together, the interfaces, libraries, and
@@ -67,7 +67,7 @@ that is part of the netCDF software distribution. It is a command line
tool that provides a text representation of a netCDF file's data, just its
metadata, or just the data for specified
variables, depending on what arguments you use. For more information,
-see the [ncdump documentation](http://www.unidata.ucar.edu/software/netcdf/docs/ncdump-man-1.html).
+see the \ref ncdump_guide documentation.
Another good tool for conversion of netCDF data to text is the ["ncks" program](http://nco.sourceforge.net/nco.html#ncks-netCDF-Kitchen-Sink) that's one of the utility programs in the [NCO (NetCDF Operators)](software.html#NCO) package. Similar capabilities are available using programs from the [CDO (Climate Data Operators)](software.html#CDO) software, commands from [NCL (NCAR Command Language)](software.html#NCL), or various other packages such as [ANAX](http://science.arm.gov/~cflynn/ [...]
@@ -284,11 +284,11 @@ The registered Digital Object Identifier for all versions of netCDF software is
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)
+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)
+Unidata, (2015): Network Common Data Form (netCDF) version 4.3.3.1 [software]. Boulder, CO: UCAR/Unidata. (http://doi.org/10.5065/D6H70CW6)
----------
diff --git a/docs/Makefile.am b/docs/Makefile.am
index ee9ae41..c1dfc62 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -11,7 +11,7 @@ EXTRA_DIST = netcdf.m4 DoxygenLayout.xml Doxyfile.in footer.html \
building-with-cmake.md CMakeLists.txt \
groups.dox install.md notes.md install-fortran.md \
all-error-codes.md cmake_faq.md credits.md software.md \
- auth.html
+ auth.html obsolete/fan_utils.html
# Turn off parallel builds in this directory.
.NOTPARALLEL:
@@ -51,7 +51,7 @@ endif
doxyfile.stamp:
$(DOXYGEN) Doxyfile \
- cp auth.html html
+ cp auth.html obsolete/fan_utils.html html
CLEANFILES = doxyfile.stamp html latex man
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 9ab4745..6a4ca4e 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -231,6 +231,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -366,7 +367,7 @@ EXTRA_DIST = netcdf.m4 DoxygenLayout.xml Doxyfile.in footer.html \
building-with-cmake.md CMakeLists.txt \
groups.dox install.md notes.md install-fortran.md \
all-error-codes.md cmake_faq.md credits.md software.md \
- auth.html
+ auth.html obsolete/fan_utils.html
# To build documentation you must have M4 in their path.
@@ -721,7 +722,7 @@ uninstall-am:
doxyfile.stamp:
$(DOXYGEN) Doxyfile \
- cp auth.html html
+ cp auth.html obsolete/fan_utils.html html
# This builds the docs from source, if necessary, and tars up
# everything needed for the website. Run this and copy the resulting
diff --git a/docs/OPeNDAP.dox b/docs/OPeNDAP.dox
index 9ac2629..813aab9 100644
--- a/docs/OPeNDAP.dox
+++ b/docs/OPeNDAP.dox
@@ -30,6 +30,7 @@ See the following pages for more information.
- \subpage dap_accessing_data
- <a href="auth.html">netCDF Authorization Support</a>
+- \subpage esg
- \subpage dap_to_netcdf
- \subpage var_dim_trans
- \subpage var_name_trans
@@ -47,7 +48,7 @@ format. The URL is composed of three parts.
- Constraints - these are suffixed to the URL and take the form
“?\<projections>&\<selections>”. The meaning of the terms projection
and selection is somewhat complicated; and the OPeNDAP web site,
- http://www.opendap.org, should be consulted. The interaction of DAP
+ http://www.opendap.org , should be consulted. The interaction of DAP
constraints with netCDF is complex and at the moment requires an
understanding of how DAP is translated to netCDF.
diff --git a/docs/credits.md b/docs/credits.md
index beb77f2..478bffd 100644
--- a/docs/credits.md
+++ b/docs/credits.md
@@ -1,9 +1,9 @@
-NetCDF Credits {#netcdf-credits-page}
+NetCDF Credits {#credits}
==============
[Unidata](http://www.unidata.ucar.edu/) is sponsored by the [National
Science Foundation](http://www.nsf.gov/) and managed by the [University
-Corporation for Atmospheric Research](http://www.ucar.edu/).
+Corporation for Atmospheric Research](http://www2.ucar.edu/).
The NASA CDF data model, to which netCDF owes much, was developed by
Michael Gough and Lloyd Treinish. Joe Fahle designed a C version for a
diff --git a/docs/esg.html b/docs/esg.html
deleted file mode 100644
index fe094dc..0000000
--- a/docs/esg.html
+++ /dev/null
@@ -1,222 +0,0 @@
-<!-- obsolete -->
-<html><!-- InstanceBegin template="/Templates/MyUnidata.dwt" codeOutsideHTMLIsLocked="true" -->
-<!-- This document is kept in netcdf-c/docs;
- it is not normally included in the distribution.
--->
-<head>
-<!-- InstanceBeginEditable name="Title" -->
-<TITLE>Accessing ESG Datasets</TITLE>
-<META NAME="UIINDEX" CONTENT="0">
-<META NAME="BOOKMARK" CONTENT="ESG Access">
-<META NAME="AUTHOR" CONTENT="Heimbigner">
-<META NAME="KEYWORDS" CONTENT="netcdf, authorization, ESG, truststore keystore">
-<META NAME="DESCRIPTION" CONTENT="Describe in detail how to establish access to ESG servers">
-<!-- InstanceEndEditable -->
-</head>
-<body>
-<h1>Accessing ESG Data Through netCDF</h1>
-
-<h2><a name="Introduction"><u>Introduction</u></a></h2>
-It is possible to access Earth Systems Grid (ESG) datasets
-from ESG servers through the netCDF API.
-This requires building the netCDF library with DAP2 protocol support
-using the "--enable-dap" flag to the configure program.
-<p>
-In order to access ESG datasets, however, it is necessary to
-register as a user with ESG and to setup your environment
-so that proper authentication is established between a netCDF
-client program and the ESG data server. Specifically, it
-is necessary to use what is called "client-side keys" to
-enable this authentication. Normally, when a client accesses
-a server in a secure fashion (using "https"), the server
-provides an authentication certificate to the client.
-With client-side keys, the client must also provide a
-certificate to the server so that the server can know with
-whom it is communicating.
-<p>
-It is possible to set up the netCDF library to use
-client-side keys, although the process is
-somewhat complicated. The DAP2 support in netCDF
-uses the <i>curl</i> library and it is that underlying library
-that must be properly configured.
-
-<h2><a name="terms"><u>Terminology</u></a></h2>
-The key elements for client-side keys requires the constructions of
-two "stores" on the client side.
-<ul>
-<li> Keystore - a repository to hold the client side key.
-<li> Truststore - a repository to hold a chain of certificates
- that can be used to validate the certificate
- sent by the server to the client.
-</ul>
-The server actually has a similar set of stores, but the client
-need not be concerned with those.
-
-<h2><a name="steps1"><u>Initial Steps</u></a></h2>
-
-The first step is to obtain authorization from ESG.
-Note that this information may evolve over time, and
-may be out of date.
-This discussion is in terms of BADC ESG. You will need
-to substitute the ESG site for BADC in the following.
-<ol>
-<li> Register at http://badc.nerc.ac.uk/register
- to obtain access to badc and to obtain an openid,
- which will looks something like:
- <pre>https://ceda.ac.uk/openid/Firstname.Lastname</pre>
-<li> Ask BADC for access to whatever datasets are of interest.
-<p>
-<li> Obtain short term credentials at
- http://grid.ncsa.illinois.edu/myproxy/MyProxyLogon/
- You will need to download and run the MyProxyLogon
- program.
- This will create a keyfile in, typically, the directory globus.
- The keyfile will have a name similar to this: x509up_u13615
- The other elements in ~/.globus are certificates to use in
- validating the certificate your client gets from the server.
-<p>
-<li> Obtain the program source ImportKey.java
- from this location: http://www.agentbob.info/agentbob/79-AB.html
- (read the whole page, it will help you understand the remaining steps).
-</ol>
-
-<h2><a name="steps2"><u>Building the KeyStore</u></a></h2>
-You will have to modify the keyfile in the previous step
-and then create a keystore and install the key and a certificate.
-The commands are these:
-<pre>
- openssl pkcs8 -topk8 -nocrypt -in x509up_u13615 -inform PEM -out key.der -outform DER
-
- openssl x509 -in x509up_u13615 -inform PEM -out cert.der -outform DER
-
- java -classpath <path to ImportKey.class> -Dkeypassword="<password>" -Dkeystore=./<keystorefilename> key.der cert.der
-</pre>
-Note, the file names "key.der" and "cert.der" can be whatever you choose.
-It is probably best to leave the .der extension, though.
-
-<h2><a name="steps2"><u>Building the TrustStore</u></a></h2>
-Building the truststore is a bit tricky because as provided, the
-certificates in "globus" need some massaging. See the script below
-for the details. The primary command is this, which is executed for every
-certificate, c, in globus. It sticks the certificate into the file
-named "truststore"
-<pre>
- keytool -trustcacerts -storepass "password" -v -keystore "truststore" -importcert -file "${c}"
-</pre>
-
-<h2><a name="steps2"><u>Running the C Client</u></a></h2>
-
-The file ".dodsrc" is used to configure curl. This file must
-reside either in the current directory or in your home directory.
-It has lines of the form
-<ul>
-<li>KEY=VALUE, or
-<li>[http//x.y/]KEY=VALUE
-</ul>
-The first form provides a configuration parameter that applies
-to all DAP2 accesses. The second form only applies
-to accesses to the server at "x.y".
-<p>
-The following keys must be set in ".dodsrc" to support
-ESG access.
-<ul>
-<li> HTTP.SSL.VALIDATE=1
-<li> HTTP.COOKIEJAR=.dods_cookies
-<li> HTTP.SSL.CERTIFICATE=esgkeystore
-<li> HTTP.SSL.KEY=esgkeystore
-<li> HTTP.SSL.CAPATH=.globus
-</ul>
-For ESG, the HTTP.SSL.CERTIFICATE and HTTP.SSL.KEY
-entries should have same value, which is the file path for the
-certificate produced by MyProxyLogon. The HTTP.SSL.CAPATH entry
-should be the path to the "certificates" directory produced by
-MyProxyLogon.
-
-<h2><a name="steps2"><u>Running the Java Client</u></a></h2>
-If you are using the Java netCDF client, then you need to add
-some parameters to the "java" command. Specifically, add the following
-flags.
-<pre>
- -Dkeystore="path to keystore file" -Dkeystorepassword="keystore password"
-</pre>
-
-<h2><a name="script"><u>Script for creating Stores</u></a></h2>
-The following script shows in detail how to actually construct the key
-and trust stores. It is specific to the format of the globus file
-as it was when ESG support was first added. It may have changed
-since then, in which case, you will need to seek some help
-in fixing this script. It would help if you communicated
-what you changed to the author so this document can be updated.
-<pre>
-#!/bin/sh -x
-KEYSTORE="esgkeystore"
-TRUSTSTORE="esgtruststore"
-GLOBUS="globus"
-TRUSTROOT="certificates"
-CERT="x509up_u13615"
-TRUSTROOTPATH="$GLOBUS/$TRUSTROOT"
-CERTFILE="$GLOBUS/$CERT"
-PWD="password"
-
-D="-Dglobus=$GLOBUS"
-CCP="bcprov-jdk16-145.jar"
-CP="./build:${CCP}"
-JAR="myproxy.jar"
-
-# Initialize needed directories
-rm -fr build
-mkdir build
-rm -fr $GLOBUS
-mkdir $GLOBUS
-rm -f $KEYSTORE
-rm -f $TRUSTSTORE
-
-# Compile MyProxyCmd and ImportKey
-javac -d ./build -classpath "$CCP" *.java
-javac -d ./build ImportKey.java
-
-# Execute MyProxyCmd
-java -cp "$CP myproxy.MyProxyCmd
-
-# Build the keystore
-openssl pkcs8 -topk8 -nocrypt -in $CERTFILE -inform PEM -out key.der -outform DER
-openssl x509 -in $CERTFILE -inform PEM -out cert.der -outform DER
-java -Dkeypassword=$PWD -Dkeystore=./${KEYSTORE} -cp ./build ImportKey key.der cert.der
-
-# Clean up the certificates in the globus directory
-for c in ${TRUSTROOTPATH}/*.0 ; do
- alias=`basename $c .0`
- sed -e '0,/---/d' <$c >/tmp/${alias}
- echo "-----BEGIN CERTIFICATE-----" >$c
- cat /tmp/${alias} >>$c
-done
-
-# Build the truststore
-for c in ${TRUSTROOTPATH}/*.0 ; do
- alias=`basename $c .0`
- echo "adding: $TRUSTROOTPATH/${c}"
- echo "alias: $alias"
- yes | keytool -trustcacerts -storepass "$PWD" -v -keystore ./$TRUSTSTORE -alias $alias -importcert -file "${c}"
-done
-exit
-</pre>
-
-<h2><a name="changelog"><u>Change Log</u></a></h2>
-<b>Version 1.0:</b>
-<ul>
-<li>10/17/2013 – Initial Release
-</ul>
-
-<h2><a name="docinfo"><u>Document Information</u></a></h2>
-<table>
-<tr><td>Created:<td>10/17/2013
-<tr><td>Last Revised:<td>10/17/2013<br>
-<tr><td>Version:<td>1.0
-<tr><td>Author:<td>Dennis Heimbigner
-<tr><td>Affiliation:<td>Unidata/UCAR
-<tr><td>email:<td>dmh@unida.ucar.edu
-</table>
-
-</body>
-
-
diff --git a/docs/esg.md b/docs/esg.md
new file mode 100644
index 0000000..6d81704
--- /dev/null
+++ b/docs/esg.md
@@ -0,0 +1,223 @@
+ Accessing ESG Data Through netCDF {#esg}
+=================================
+
+[TOC]
+
+Introduction {#esg_intro}
+==================
+
+It is possible to access Earth Systems Grid (ESG) datasets from ESG
+servers through the netCDF API. This requires building the netCDF
+library with DAP2 protocol support using the "--enable-dap" flag to the
+configure program.
+
+In order to access ESG datasets, however, it is necessary to register as
+a user with ESG and to setup your environment so that proper
+authentication is established between a netCDF client program and the
+ESG data server. Specifically, it is necessary to use what is called
+"client-side keys" to enable this authentication. Normally, when a
+client accesses a server in a secure fashion (using "https"), the server
+provides an authentication certificate to the client. With client-side
+keys, the client must also provide a certificate to the server so that
+the server can know with whom it is communicating.
+
+It is possible to set up the netCDF library to use client-side keys,
+although the process is somewhat complicated. The DAP2 support in netCDF
+uses the *curl* library and it is that underlying library that must be
+properly configured.
+
+Terminology {#esg_term}
+==================
+
+The key elements for client-side keys requires the constructions of two
+"stores" on the client side.
+
+- Keystore - a repository to hold the client side key.
+- Truststore - a repository to hold a chain of certificates that can
+ be used to validate the certificate sent by the server to
+ the client.
+
+The server actually has a similar set of stores, but the client need not
+be concerned with those.
+
+Initial Steps {#esg_initial_steps}
+==================
+
+The first step is to obtain authorization from ESG. Note that this
+information may evolve over time, and may be out of date. This
+discussion is in terms of BADC ESG. You will need to substitute the ESG
+site for BADC in the following.
+
+1. Register at http://badc.nerc.ac.uk/register to obtain access to badc
+ and to obtain an openid, which will looks something like:
+
+ https://ceda.ac.uk/openid/Firstname.Lastname
+
+2. Ask BADC for access to whatever datasets are of interest.
+3. Obtain short term credentials at
+ http://grid.ncsa.illinois.edu/myproxy/MyProxyLogon/ You will need to
+ download and run the MyProxyLogon program. This will create a
+ keyfile in, typically, the directory globus. The keyfile will have a
+ name similar to this: x509up\_u13615 The other elements in
+ \~/.globus are certificates to use in validating the certificate
+ your client gets from the server.
+4. Obtain the program source ImportKey.java from this location:
+ http://www.agentbob.info/agentbob/79-AB.html (read the whole page,
+ it will help you understand the remaining steps).
+
+Building the KeyStore {#esg_keystore}
+==================
+
+You will have to modify the keyfile in the previous step and then create
+a keystore and install the key and a certificate. The commands are
+these:
+
+ openssl pkcs8 -topk8 -nocrypt -in x509up_u13615 -inform PEM -out key.der -outform DER
+
+ openssl x509 -in x509up_u13615 -inform PEM -out cert.der -outform DER
+
+ java -classpath -Dkeypassword="" -Dkeystore=./ key.der cert.der
+
+Note, the file names "key.der" and "cert.der" can be whatever you
+choose. It is probably best to leave the .der extension, though.
+
+Building the TrustStore {#esg_truststore}
+==================
+
+Building the truststore is a bit tricky because as provided, the
+certificates in "globus" need some massaging. See the script below for
+the details. The primary command is this, which is executed for every
+certificate, c, in globus. It sticks the certificate into the file named
+"truststore"
+
+ keytool -trustcacerts -storepass "password" -v -keystore "truststore" -importcert -file "${c}"
+
+Running the C Client {#esg_c_client}
+==================
+
+The file ".dodsrc" is used to configure curl. This file must reside
+either in the current directory or in your home directory. It has lines
+of the form
+
+- KEY=VALUE, or
+- \[http//x.y/\]KEY=VALUE
+
+The first form provides a configuration parameter that applies to all
+DAP2 accesses. The second form only applies to accesses to the server at
+"x.y".
+
+The following keys must be set in ".dodsrc" to support ESG access.
+
+- HTTP.SSL.VALIDATE=1
+- HTTP.COOKIEJAR=.dods\_cookies
+- HTTP.SSL.CERTIFICATE=esgkeystore
+- HTTP.SSL.KEY=esgkeystore
+- HTTP.SSL.CAPATH=.globus
+
+For ESG, the HTTP.SSL.CERTIFICATE and HTTP.SSL.KEY entries should have
+same value, which is the file path for the certificate produced by
+MyProxyLogon. The HTTP.SSL.CAPATH entry should be the path to the
+"certificates" directory produced by MyProxyLogon.
+
+Running the Java Client {#esg_java_client}
+==================
+
+If you are using the Java netCDF client, then you need to add some
+parameters to the "java" command. Specifically, add the following flags.
+
+ -Dkeystore="path to keystore file" -Dkeystorepassword="keystore password"
+
+Script for creating Stores {#esg_script}
+==================
+
+The following script shows in detail how to actually construct the key
+and trust stores. It is specific to the format of the globus file as it
+was when ESG support was first added. It may have changed since then, in
+which case, you will need to seek some help in fixing this script. It
+would help if you communicated what you changed to the author so this
+document can be updated.
+
+
+ #!/bin/sh -x
+ KEYSTORE="esgkeystore"
+ TRUSTSTORE="esgtruststore"
+ GLOBUS="globus"
+ TRUSTROOT="certificates"
+ CERT="x509up_u13615"
+ TRUSTROOTPATH="$GLOBUS/$TRUSTROOT"
+ CERTFILE="$GLOBUS/$CERT"
+ PWD="password"
+
+ D="-Dglobus=$GLOBUS"
+ CCP="bcprov-jdk16-145.jar"
+ CP="./build:${CCP}"
+ JAR="myproxy.jar"
+
+ # Initialize needed directories
+ rm -fr build
+ mkdir build
+ rm -fr $GLOBUS
+ mkdir $GLOBUS
+ rm -f $KEYSTORE
+ rm -f $TRUSTSTORE
+
+ # Compile MyProxyCmd and ImportKey
+ javac -d ./build -classpath "$CCP" *.java
+ javac -d ./build ImportKey.java
+
+ # Execute MyProxyCmd
+ java -cp "$CP myproxy.MyProxyCmd
+
+ # Build the keystore
+ openssl pkcs8 -topk8 -nocrypt -in $CERTFILE -inform PEM -out key.der -outform DER
+ openssl x509 -in $CERTFILE -inform PEM -out cert.der -outform DER
+ java -Dkeypassword=$PWD -Dkeystore=./${KEYSTORE} -cp ./build ImportKey key.der cert.der
+
+ # Clean up the certificates in the globus directory
+ for c in ${TRUSTROOTPATH}/*.0 ; do
+ alias=`basename $c .0`
+ sed -e '0,/---/d' <$c >/tmp/${alias}
+ echo "-----BEGIN CERTIFICATE-----" >$c
+ cat /tmp/${alias} >>$c
+ done
+
+ # Build the truststore
+ for c in ${TRUSTROOTPATH}/*.0 ; do
+ alias=`basename $c .0`
+ echo "adding: $TRUSTROOTPATH/${c}"
+ echo "alias: $alias"
+ yes | keytool -trustcacerts -storepass "$PWD" -v -keystore ./$TRUSTSTORE -alias $alias -importcert -file "${c}"
+ done
+ exit
+
+
+
+Change Log {#esg_change_log}
+==================
+
+**Version 1.0:**
+
+- 10/17/2013 – Initial Release
+
+Document Information {#esg_doc_info}
+==================
+
+ ------------------------------------------------------------------------
+ Created:
+ 10/17/2013
+
+ Last Revised:
+ 10/17/2013\
+
+ Version:
+ 1.0
+
+ Author:
+ Dennis Heimbigner
+
+ Affiliation:
+ Unidata/UCAR
+
+ email:
+ dmh at unida.ucar.edu
+ ------------------------------------------------------------------------
diff --git a/docs/guide.dox b/docs/guide.dox
index 581ffd2..abbcec7 100644
--- a/docs/guide.dox
+++ b/docs/guide.dox
@@ -44,13 +44,10 @@ web site (http://www.unidata.ucar.edu/netcdf), and with the netCDF
distribution.
The latest version of this document, and the language specific guides,
-can be found at the netCDF web site,
-http://www.unidata.ucar.edu/netcdf/docs, along with extensive
-additional information about netCDF, including pointers to other
-software that works with netCDF data.
+can be found at the netCDF web site (http://www.unidata.ucar.edu/netcdf/docs) along with extensive additional information about netCDF, including pointers to other software that works with netCDF data.
Separate documentation of the Java netCDF library can be found at
-http://www.unidata.ucar.edu/software/netcdf-java.
+http://www.unidata.ucar.edu/software/netcdf-java/.
\page netcdf_introduction An Introduction to NetCDF
diff --git a/docs/images/Makefile.in b/docs/images/Makefile.in
index a084288..66a519a 100644
--- a/docs/images/Makefile.in
+++ b/docs/images/Makefile.in
@@ -168,6 +168,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/docs/mainpage.dox b/docs/mainpage.dox
index 5048fa1..33e4df2 100644
--- a/docs/mainpage.dox
+++ b/docs/mainpage.dox
@@ -1,14 +1,13 @@
/**
-\mainpage Overview
-
+\mainpage Introduction and Overview
\tableofcontents
\section what_is_netcdf What is NetCDF?
-NetCDF is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. NetCDF was developed and is maintained at <a href="http://www.unidata.ucar.edu">Unidata</a>. Unidata provides data and software tools for use in geoscience education and research. Unidata is part of the University Corporation for Atmospheric Research (<a href="http://www.ucar.edu">UCAR</a>) Community Programs (<a hr [...]
+NetCDF is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. NetCDF was developed and is maintained at <a href="http://www.unidata.ucar.edu">Unidata</a>. Unidata provides data and software tools for use in geoscience education and research. Unidata is part of the University Corporation for Atmospheric Research (<a href="http://www2.ucar.edu">UCAR</a>) Community Programs (<a h [...]
-The NetCDF homepage may be found at <a href="http://www.unidata.ucar.edu/netcdf">http://www.unidata.ucar.edu/netcdf</a>. The NetCDF source-code is hosted at <a href="http://github.com">GitHub</a>, and may be found directly at <a href="http://github.com/Unidata/netcdf-c">http://github.com/Unidata/netcdf-c</a>.
+The NetCDF homepage may be found at <a href="http://www.unidata.ucar.edu/software/netcdf/">http://www.unidata.ucar.edu/software/netcdf/</a>. The NetCDF source-code is hosted at <a href="http://github.com">GitHub</a>, and may be found directly at <a href="http://github.com/Unidata/netcdf-c">http://github.com/Unidata/netcdf-c</a>.
\section this_release Learn more about the current NetCDF-C Release
@@ -32,7 +31,7 @@ The NetCDF homepage may be found at <a href="http://www.unidata.ucar.edu/netcdf"
- \ref sec_tut
- \ref user_guide
- \ref netcdf_working_with_netcdf_files
-- <a class="el" href="http://www.unidata.ucar.edu/software/netcdf/docs/index-413.html">Older Documentation, plus details regarding netcdf-fortran and netcdf-cxx.</a>
+- <a class="el" href="http://www.unidata.ucar.edu/software/netcdf/documentation/historic/">Older Documentation, plus details regarding netcdf-fortran and netcdf-cxx.</a>
\section netcdf-cmake-windows NetCDF CMake and Windows support:
- \ref netCDF-CMake
@@ -45,11 +44,11 @@ Hartnett, Dennis Heimbigner and Ward Fisher
<p>NetCDF was developed and is maintained
at <a href="http://www.unidata.ucar.edu">Unidata</a>, part of the
-<a href="http://www.ucar.edu">University Corporation for Atmospheric Research</a> (UCAR) <a href="http://www.ucp.ucar.edu">Community
+<a href="http://www2.ucar.edu">University Corporation for Atmospheric Research</a> (UCAR) <a href="http://www.ucp.ucar.edu">Community
Programs</a> (UCP). Unidata is funded primarily by the National Science
Foundation.
-A complete list of credits and contributors to NetCDF may be found at the \subpage netcdf-credits-page page.
+A complete list of credits and contributors to NetCDF may be found at the \subpage credits page.
<a href="http://www.unidata.ucar.edu">Unidata</a> provides data and
software tools for use in geoscience education and research.
diff --git a/docs/obsolete/fan_utils.html b/docs/obsolete/fan_utils.html
new file mode 100644
index 0000000..bbfd1ac
--- /dev/null
+++ b/docs/obsolete/fan_utils.html
@@ -0,0 +1,1437 @@
+<html><!-- InstanceBegin template="/Templates/MyUnidata.dwt" codeOutsideHTMLIsLocked="true" -->
+
+<head>
+<!-- InstanceBeginEditable name="Title" -->
+<TITLE>Introduction to FAN Language and Utilities </TITLE> <link rel="shortcut icon" href="http://www.unidata.ucar.edu/favicon.ico" type="image/x-icon" />
+
+</head>
+
+<body>
+<!-- InstanceBeginEditable name="Content Goes Here" -->
+<h1 align="center">Introduction to FAN Language and Utilities <br />
+ FAN Version 2.0 <br />
+</h1>
+<h3 align="center">Harvey Davies <br />
+ CSIRO Division of Atmospheric Research, <br />
+ Private Bag No. 1, Mordialloc 3195, Australia <br />
+ email: hld at dar.csiro.au <br />
+ <br />
+ Scientific Visitor from January to August 1996 at <br />
+ UCAR/Unidata Program Center, <br />
+ P.O. Box 3000, Boulder, Colorado 80307-3000, USA <br />
+ email: hld at ucar.edu <br />
+</h3>
+<hr />
+<h1>Introduction</h1>
+<p><em>FAN (File Array Notation)</em> is an array-oriented language for identifying
+ data items in files for the purpose of extraction or modification. FAN specifications
+ consist of</p>
+<ul>
+ <li>one or more filenames</li>
+ <li>one or more variable (array) names or ID numbers</li>
+ <li>attribute names or ID numbers (optional)</li>
+ <li>dimension names or ID numbers (optional)</li>
+ <li>subscripts in various possible forms (optional)</li>
+</ul>
+<p>NetCDF is the only format currently supported. However FAN is intended to be
+ generic and it is hoped that there will eventually also be FAN interfaces to
+ various other formats.</p>
+<p>This document describes the FAN language and four utilities based on FAN. The
+ use of these utilities can greatly decrease the need for programming in Fortran
+ or C. They can be called from the Unix command line and shell scripts.</p>
+<p>The first is <tt><b>nc2text</b></tt> which prints selected data from netCDF
+ variables. The standard utility <tt><b>ncdump</b></tt> can also print data from
+ netCDF variables, but only entire variables and only together with metadata
+ in CDL form.</p>
+<p>The second is <tt><b>ncmeta</b></tt> which prints selected metadata from one
+ or more netCDF files. This metadata can include rank, shape, file names, variable
+ names, dimension names and attribute names.</p>
+<p>The third is <tt><b>ncrob</b></tt> which reads data from one or more netCDF
+ variables, performs some process on it and then either prints the result or
+ writes it to a netCDF array. The letters `<tt><b>rob</b></tt>' in `<tt><b>ncrob</b></tt>'
+ stand for <em>Reduce Or Broadcast</em>. <em>Reduce</em> means to produce an
+ array (e.g. sum, mean, maximum) with less dimensions than the original. <em>Broadcast</em>
+ means to copy one array to another, recycling values if necessary. An example
+ is copying the same vector to each row of a matrix. It is possible to process
+ large volumes of data (e.g. 100 MB) using <tt><b>ncrob</b></tt>.</p>
+<p>The fourth is <tt><b>text2nc</b></tt> which can be used to read small volumes
+ (say up to a few thousand lines) of ASCII data and copy it into netCDF variables.
+ It is also possible to use <tt><b>text2nc</b></tt> to create, modify and delete
+ attributes.</p>
+<p>This document does not cover other ways of using FAN. These include some local
+ (CSIRO DAR) utilities (e.g. contouring program <tt><b>con_cif</b></tt>), the
+ array-oriented languages IDL and J (for which there are FAN interfaces) and
+ direct use of the C API (application programmer interface).</p>
+<h2>Simple Examples</h2>
+<p>Let us start with a simple netCDF file <tt><b>vec.nc</b></tt> which is printed
+ (in CDL) as follows:</p>
+<pre>
+<strong>$ ncdump vec.nc
+netcdf vec {
+dimensions:
+ n = UNLIMITED ; // (5 currently)
+variables:
+ float v(n) ;
+data:
+ v = 10 , 20.3 , 30.2 , 40.9 , 50 ;
+}
+</strong>
+</pre>
+<p>Here `<tt><b>$</b></tt>' is the UNIX command-line prompt. The following
+ uses <tt><b>nc2text</b></tt> to print the whole array <tt><b>v</b></tt>:</p>
+<pre>
+<strong>$ nc2text vec.nc v
+10 20.3 30.2 40.9 50
+</strong>
+</pre>
+<p>Individual elements can be selected using subscripts. For example:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[0]'
+10
+$ nc2text vec.nc 'v[3]'
+40.9
+</strong>
+</pre>
+<p>Several can be selected using a subscript consisting of a list of indices such
+ as:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[0 3 1 3]'
+10 40.9 20.3 40.9
+</strong>
+</pre>
+<p>We can write to a netCDF file using <tt><b>text2nc</b></tt>. The following
+ changes the third element from 30.2 to 30.7 and then prints <tt><b>v</b></tt>:</p>
+<pre>
+<strong>$ echo 30.7 | text2nc vec.nc 'v[2]'
+$ nc2text vec.nc v
+10 20.3 30.7 40.9 50
+</strong>
+</pre>
+<p>Here <tt><b>text2nc</b></tt> reads ASCII text data from standard input, which
+ in this case is a pipe connected to the standard output of <tt><b>echo</b></tt>.
+ Since the dimension has <tt><b>UNLIMITED</b></tt> size, we can append values
+ as follows:</p>
+<pre>
+<strong>$ echo 60.5 70.2 | text2nc vec.nc 'v[5 6]'
+$ nc2text vec.nc v
+10 20.3 30.7 40.9 50 60.5 70.2
+</strong>
+</pre>
+<p>Next we use <tt><b>ncrob</b></tt> to calculate and print the arithmetic mean
+ of <tt><b>v</b></tt>.</p>
+<pre>
+<strong>$ ncrob -r am vec.nc v /
+40.3714
+</strong>
+</pre>
+<p>The option <tt><b>-r am</b></tt> specifies that an <em>arithmetic mean</em>
+ is to be calculated. The following example stores the mean in the same file,
+ naming the variable <tt><b>v_mean</b></tt>:</p>
+<pre>
+<strong>$ ncrob -r am vec.nc v / v_mean
+$ nc2text vec.nc v_mean
+40.3714
+</strong>
+</pre>
+<p>The `<tt><b>/</b></tt>' separates the input from the output. If no output
+ is specified then results are printed. In fact <tt><b>ncrob</b></tt> can be
+ used in place of <tt><b>nc2text</b></tt> to print data from a netCDF file. E.g.</p>
+<pre>
+<strong>$ ncrob vec.nc v /
+10 20.3 30.7 40.9 50 60.5 70.2
+$ ncrob vec.nc v_mean /
+40.3714
+</strong>
+</pre>
+<p>Finally we use <tt><b>ncmeta</b></tt> to print metadata. The shape is printed
+ by:</p>
+<pre>
+<strong>$ ncmeta v vec.nc
+5
+</strong>
+</pre>
+<p>and the following prints the variable name, dimension name and shape:</p>
+<pre>
+<strong>$ ncmeta -w vds v vec.nc
+v n 5
+</strong>
+</pre>
+<h2>What is New in Version 2?</h2>
+<p>The utility <tt><b>ncmeta</b></tt> is new.</p>
+<p>There are significant enhancements to the utility <tt><b>ncrob</b></tt>. It
+ can now print results as well as write them to netCDF files. (This means that
+ <tt><b>nc2text</b></tt> is no longer really needed.) In version 1 the output
+ FAN specification could only be a single (final) argument. There can now be
+ zero (implying printed output) or more output arguments following a `<tt><b>/</b></tt>'
+ which separates input arguments from output arguments. (The old convention is
+ deprecated but still supported.) It is now possible to create new variables
+ without specifying the <tt><b>-c</b></tt> option or an output filename. There
+ is a facility for merging dimensions. There are several new options related
+ to printing and similar to those of <tt><b>nc2text</b></tt>. A number of bugs
+ in <tt><b>ncrob</b></tt> have been fixed, including one with a serious effect
+ on speed.</p>
+<h1>FAN Language</h1>
+<p><a id="High_level_Syntax" name="High_level_Syntax"></a></p>
+<h2>High-level Syntax</h2>
+<p>A FAN specification can be either a single command-line argument or span several
+ arguments. Use of multiple arguments decreases the need for quoting and allows
+ use of UNIX <em>wildcarding</em> (a.k.a. <em>globbing</em>) facilities. A FAN
+ specification can have any of the following forms:</p>
+<center>
+ <table border="1" summary="syntax meaning">
+ <tr>
+ <td><b>Syntax</b> </td>
+ <td><b>Meaning</b></td>
+ </tr>
+ <tr>
+ <td><em>fanio</em> <tt><b>/</b></tt> <em>fanio</em> </td>
+ <td>netCDF input and netCDF output</td>
+ </tr>
+ <tr>
+ <td><em>fanio</em> <tt><b>/</b></tt> </td>
+ <td>netCDF input and output to <tt><b>stdout</b></tt> (i.e. printed)</td>
+ </tr>
+ <tr>
+ <td><em>fanio</em> </td>
+ <td>Either netCDF input or netCDF output (but not both)</td>
+ </tr>
+ </table>
+</center>
+<p>where <em>fanio</em> is a FAN input/output specification, which has the form:
+ <br />
+ <em>pair</em> <tt><b>;</b></tt> <em>pair</em> <tt><b>;</b></tt> <em>pair</em>
+ <tt><b>;</b></tt> ... <br />
+ A semicolon (`<tt><b>;</b></tt>') has the same effect as commencing a new
+ argument. Any sequence of one or more whitespace characters (space, tab, newline)
+ is equivalent to a single space.</p>
+<p>A <em>pair</em> can take any of the following forms: <br />
+ <em>filename vas</em> <br />
+ <em>vas filename</em> <br />
+ <em>filename</em> <br />
+ <em>vas</em> <br />
+</p>
+<p>A <em>filename</em> must contain at least one period (`<tt><b>.</b></tt>')
+ to distinguish it from a variable name. This will be the case if netCDF filenames
+ have a conventional suffix such as the recommended <tt><b>.nc</b></tt>. (In
+ any case it is always possible to prefix a redundant `<tt><b>./</b></tt>'
+ directory as in `<tt><b>./unconventional</b></tt>' or `<tt><b>/usr/./IdidItMyWay</b></tt>'!)</p>
+<p>A <em>vas</em> is a <em>variable or attribute specification</em> which can
+ have any of the following forms: <br />
+ <em>var</em> <br />
+ <em>var</em><tt><b>[</b></tt><em>subscript</em><tt><b>,</b></tt> <em>subscript</em><tt><b>,</b></tt>
+ <em>subscript</em><tt><b>,</b></tt> ...<tt><b>]</b></tt> <br />
+ <em>var</em><tt><b>[</b></tt><em>subscript</em><tt><b>,</b></tt> <em>subscript</em><tt><b>,</b></tt>
+ <em>subscript</em><tt><b>,</b></tt> ...<tt><b>)</b></tt> <br />
+ <em>var</em><tt><b>(</b></tt><em>subscript</em><tt><b>,</b></tt> <em>subscript</em><tt><b>,</b></tt>
+ <em>subscript</em><tt><b>,</b></tt> ...<tt><b>]</b></tt> <br />
+ <em>var</em><tt><b>(</b></tt><em>subscript</em><tt><b>,</b></tt> <em>subscript</em><tt><b>,</b></tt>
+ <em>subscript</em><tt><b>,</b></tt> ...<tt><b>)</b></tt> <br />
+ <em>var</em><tt><b>:</b></tt><em>att</em> <br />
+ <tt><b>:</b></tt><em>att</em> <br />
+ where <em>var</em> is a variable name or ID number and <em>att</em> is an attribute
+ name or ID number. It is usually more convenient to identify variables, attributes
+ and dimensions by name rather than ID number. The use of ID numbers is discussed
+ in Section <a
+href="#Using_ID_Numbers"><em>Using ID Numbers</em></a>. Attributes are discussed
+ in Section <a
+href="#Attributes"><em>Attributes</em></a>.</p>
+<p>A pair without a <em>filename</em> or <em>vas</em> uses that of the previous
+ pair. The first pair has no effect by itself unless it contains both a <em>filename</em>
+ and a <em>vas</em>. Thus the following all access the same values:</p>
+<pre>
+<strong>$ nc2text 'vec.nc v[0 4]'
+10 50
+$ nc2text 'v[0 4] vec.nc'
+10 50
+$ nc2text vec.nc 'v[0 4]'
+10 50
+$ nc2text 'v[0 4]' vec.nc
+10 50
+$ nc2text ' v [ 0 4 ] vec.nc '
+10 50
+</strong>
+</pre>
+<p>The following are equivalent ways of concatenating variables <tt><b>v</b></tt>
+ and <tt><b>v_mean</b></tt>:</p>
+<pre>
+<strong>$ nc2text 'vec.nc v' 'vec.nc v_mean'
+10 20.3 30.7 40.9 50 60.5 70.2
+40.3714
+$ nc2text 'vec.nc v' 'v_mean'
+10 20.3 30.7 40.9 50 60.5 70.2
+40.3714
+$ nc2text 'vec.nc v; v_mean'
+10 20.3 30.7 40.9 50 60.5 70.2
+40.3714
+$ nc2text vec.nc v v_mean
+10 20.3 30.7 40.9 50 60.5 70.2
+40.3714
+</strong>
+</pre>
+<p>Now let us copy file <tt><b>vec.nc</b></tt> to <tt><b>vec_new.nc</b></tt> and
+ then demonstrate concatenation of data from different files:</p>
+<pre>
+<strong>$ cp vec.nc vec_new.nc
+$ nc2text v vec.nc vec_new.nc
+10 20.3 30.7 40.9 50 60.5 70.2
+10 20.3 30.7 40.9 50 60.5 70.2
+$ nc2text v vec*.nc
+10 20.3 30.7 40.9 50 60.5 70.2
+10 20.3 30.7 40.9 50 60.5 70.2
+</strong>
+</pre>
+<p>Note the use of UNIX <em>wildcarding</em> facilities in the latter example
+ using the <em>metacharacter</em> `<tt><b>*</b></tt>' in <tt><b>vec*.nc</b></tt>
+ which matches both <tt><b>vec.nc</b></tt> and <tt><b>vec_new.nc</b></tt>.</p>
+<h2>Subscripts</h2>
+<p>As mentioned in Section <a href="#High_level_Syntax"><em>High level Syntax</em></a>,
+ subscripts are enclosed by either `<tt><b>[</b></tt>' or `<tt><b>(</b></tt>'
+ on the left and either `<tt><b>]</b></tt>' or `<tt><b>)</b></tt>' on
+ the right.</p>
+<p>A left bracket `<tt><b>[</b></tt>' implies the C convention of starting
+ subscripts at 0; while a left parenthesis `<tt><b>(</b></tt>' implies the
+ Fortran convention of starting at 1. This starting value of 0 or 1 is called
+ the <em>index origin</em>. A mnemonic to associate <em>left</em> with <em>index
+ origin</em> is an <em>x-axis with the origin on the left</em>.</p>
+<p>The right hand delimiter controls the relative significance of multiple dimensions.
+ A `<tt><b>]</b></tt>' implies conventional <em>row-major</em> (or <em>lexicographic</em>)
+ order in which the rightmost subscript varies fastest; while a `<tt><b>)</b></tt>'
+ implies the Fortran convention of <em>column-major</em> order in which the leftmost
+ subscript varies fastest.</p>
+<p>So far our examples have involved only a single dimension. Now consider a netCDF
+ file <tt><b>mat.nc</b></tt> containing a 2-dimensional array (i.e. a matrix).
+ We print it as follows:</p>
+<pre>
+<strong>$ ncdump mat.nc
+netcdf mat {
+dimensions:
+ row = 2 ;
+ col = 3 ;
+variables:
+ short M(row, col) ;
+data:
+ M =
+ 11, 12, 13,
+ 21, 22, 23 ;
+}
+</strong>
+</pre>
+<p>The following are equivalent ways of printing the final element:</p>
+<pre>
+<strong>$ nc2text 'mat.nc M[1,2]'
+23
+$ nc2text 'mat.nc M(2,3]'
+23
+$ nc2text 'mat.nc M(3,2)'
+23
+$ nc2text 'mat.nc M[2,1)'
+23
+</strong>
+</pre>
+<p>Subscript values can be less than the index origin and are then relative to
+ the end. So the final element could also be accessed by:</p>
+<pre>
+<strong>$ nc2text 'mat.nc M[-1,-1]'
+23
+$ nc2text 'mat.nc M(0,0)'
+23
+</strong>
+</pre>
+<p>As we have seen before, a subscript can contain a list of indices. Thus one
+ could use any of the following to select all rows, but exclude the middle column:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M[0 1,0 2]'
+11 13
+21 23
+$ nc2text mat.nc 'M(1 2,1 3]'
+11 13
+21 23
+$ nc2text mat.nc 'M(1 3,1 2)'
+11 13
+21 23
+</strong>
+</pre>
+<h3>Triplet Notation</h3>
+<p>A sequence of indices forming an <em>arithmetic progression</em> as in</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[0 2 4 6]'
+10 30.7 50 70.2
+</strong>
+</pre>
+<p>can be specified using a generalization of Fortran 90 <em>triplet notation</em>,
+ in this case:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[0:6:2]'
+10 30.7 50 70.2
+</strong>
+</pre>
+<p>The triplet <tt><b>0:6:2</b></tt> means <em>0 to 6 in steps of 2</em>. A <em>triplet</em>
+ can take two forms: <br />
+ <em>start</em><tt><b>:</b></tt><em>finish</em><tt><b>:</b></tt><em>stride</em>
+ <br />
+ <em>start</em><tt><b>:</b></tt><em>finish</em> <br />
+ The second form implies a stride of 1. It is possible to omit <em>start</em>
+ and/or <em>finish</em>. Let <var>I</var> be the index-origin (0
+ or 1). If the stride is positive then <em>start</em> defaults to <var>I</var>
+ (i.e. first element) and <em>finish</em> to <var>I</var>-1 (i.e.
+ final element). These are reversed for a negative stride; <em>start</em> defaults
+ to <var>I</var>-1 and <em>finish</em> to <var>I</var>. E.g.</p>
+<pre>
+<strong>$ nc2text vec.nc v
+10 20.3 30.7 40.9 50 60.5 70.2
+$ nc2text vec.nc 'v[:6:2]'
+10 30.7 50 70.2
+$ nc2text vec.nc 'v[0::2]'
+10 30.7 50 70.2
+$ nc2text vec.nc 'v[::2]'
+10 30.7 50 70.2
+$ nc2text vec.nc 'v[0:2]'
+10 20.3 30.7
+$ nc2text vec.nc 'v[:2]'
+10 20.3 30.7
+$ nc2text vec.nc 'v[2:]'
+30.7 40.9 50 60.5 70.2
+$ nc2text vec.nc 'v[::-1]'
+70.2 60.5 50 40.9 30.7 20.3 10
+</strong>
+</pre>
+<p>Note how the latter example reverses the order. A triplet can wrap-around the
+ start or end. This is useful with cyclic dimensions such as longitude. Wrap-around
+ is shown by:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[3:1]'
+40.9 50 60.5 70.2 10 20.3
+$ nc2text vec.nc 'v[1:3:-1]'
+20.3 10 70.2 60.5 50 40.9
+</strong>
+</pre>
+<p>But the following does not imply wrap-around:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[0:-1:1]'
+10 20.3 30.7 40.9 50 60.5 70.2
+</strong>
+</pre>
+<p>since <tt><b>-1</b></tt> means <em>final</em> (i.e. same as <tt><b>6</b></tt>).
+ Each subscript can contain any number of triplets and individual values. The
+ colon (<tt><b>:</b></tt>) operator has higher precedence than concatenation.
+ This is shown by the following:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[2 :4]'
+30.2 40.9 50
+</strong>
+</pre>
+<p>which is equivalent to:</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[2:4]'
+30.2 40.9 50
+</strong>
+</pre>
+<p>However parentheses can be used to override this precedence rule. E.g.</p>
+<pre>
+<strong>$ nc2text vec.nc 'v[2 (:4)]'
+30.2 10 20.3 30.2 40.9 50
+</strong>
+</pre>
+<h3>Omitting Subscripts</h3>
+<p>An omitted subscript implies the whole dimension. Thus we can print the first
+ row of <tt><b>mat</b></tt> as follows:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M[0]'
+11 12 13
+</strong>
+</pre>
+<p>and exclude the middle column by:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M[,0 -1]'
+11 13
+21 23
+</strong>
+</pre>
+<h3>Dimension Names</h3>
+<p>Dimension names play an important role in FAN. Instead of:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M(2 1,1 3]'
+21 23
+11 13
+</strong>
+</pre>
+<p>one can use:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M(row=2 1,col=1 3]'
+21 23
+11 13
+</strong>
+</pre>
+<p>This is clearer for human readers. But specifying dimension names also provides
+ the important facility of transposing dimensions. For example this allows <tt><b>ncrob</b></tt>
+ to produce statistics (e.g. means) for rows as well as the normal columns. To
+ transpose the above matrix, one could specify:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M(col=1 3,row=2 1]'
+21 11
+23 13
+</strong>
+</pre>
+<p>since the order in which dimensions are specified controls their order in the
+ output. To transpose a whole matrix one need only specify the dimension names
+ as in the following:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M[col,row]'
+11 21
+12 22
+13 23
+</strong>
+</pre>
+<p>or using column-major order:</p>
+<pre>
+<strong>$ nc2text mat.nc 'M(row,col)'
+11 21
+12 22
+13 23
+</strong>
+</pre>
+<p>In fact only one dimension name is needed, since any not mentioned are appended
+ in their input order. E.g.</p>
+<pre>
+<strong>$ nc2text mat.nc 'M[col]'
+11 21
+12 22
+13 23
+</strong>
+</pre>
+<h3>Indirect Indexing</h3>
+<p>So far we have located elements using direct index values. FAN also allows
+ an indirect method using <em>coordinate variables</em> (i.e. variables with
+ the same names as dimensions). Consider the following geographic netCDF file
+ <tt><b>geog.nc</b></tt>:</p>
+<pre>
+<strong>$ ncdump geog.nc
+netcdf geog {
+dimensions:
+ lat = 3 ;
+ lon = 4 ;
+variables:
+ float lat(lat) ;
+ lat:units = "degrees_north" ;
+ float lon(lon) ;
+ lon:units = "degrees_east" ;
+ double tsur(lat, lon) ;
+data:
+ lat = -45 , 0 , 45 ;
+ lon = -180 , -90 , 0 , 90 ;
+ tsur =
+ 11, 12, 13, 14,
+ 21, 22, 23, 24,
+ 31, 32, 33, 34 ;
+}
+</strong>
+</pre>
+<p>FAN provides several <em>indirect indexing operators</em>. Perhaps the most
+ useful of these is `<tt><b>~</b></tt>', which gives the index of the coordinate
+ value <em>closest to</em> its argument. Thus:</p>
+<pre>
+<strong>$ nc2text geog.nc 'lat[~-40]'
+-45
+</strong>
+</pre>
+<p>prints the latitude closest to 40�S and</p>
+<pre>
+<strong>$ nc2text geog.nc 'tsur[~-40,~10]'
+13
+</strong>
+</pre>
+<p>prints the element of <tt><b>tsur</b></tt> closest to the point 40�S, 10�E.
+ Note that FAN knows nothing about circular wrap-around and does not consider
+ 360� to be equal to 0�. The following shows how indirect indexing can be used
+ within triplets:</p>
+<pre>
+<strong>$ nc2text geog.nc 'tsur[ lat = ~90:~-90:-2 , lon = ~10: ]'
+33 34
+13 14
+</strong>
+</pre>
+<p>This gives every second latitude from that closest the north pole to that closest
+ the south pole, and all longitudes from that closest to 10�E to the final one.
+ The other indirect indexing operators are as follows:</p>
+<table border="1" summary="other @ max and min operators">
+ <tr>
+ <td><tt><b>@ max <</b></tt> </td>
+ <td>index value corresponding to maximum coordinate value less than argument</td>
+ </tr>
+ <tr>
+ <td><tt><b>@ max <=</b></tt> </td>
+ <td>index value corresponding to maximum coordinate value less than or equal
+ to argument</td>
+ </tr>
+ <tr>
+ <td><tt><b>@ min ></b></tt> </td>
+ <td>index value corresponding to minimum coordinate value greater than argument</td>
+ </tr>
+ <tr>
+ <td><tt><b>@ min >=</b></tt> </td>
+ <td>index value corresponding to minimum coordinate value greater than or
+ equal to argument</td>
+ </tr>
+</table>
+<p>Thus the following prints the minimum longitude greater than 10�E:</p>
+<pre>
+<strong>$ nc2text geog.nc 'lon[@ min > 10]'
+90
+</strong>
+</pre>
+<p>and the following retrieves the rows from the <em>maximum latitude less than
+ or equal to 30�N</em> to the <em>closest latitude to 90�N</em>, and the columns
+ from the second (i.e 1 with respect to index origin of 0) to <em>minimum longitude
+ greater than 0</em>.</p>
+<pre>
+<strong>$ nc2text geog.nc 'tsur[lat= @max<=30 : ~90, lon= 1 : @min > 0]'
+22 23 24
+32 33 34
+</strong>
+</pre>
+<h3>Offsets</h3>
+<p>It is possible to specify <em>offsets</em> using an expression of the form
+ <br />
+ <em>index</em> <tt><b>+</b></tt> <em>offset</em> <br />
+ where <em>offset</em> is an integer constant (which can be negative). The offset
+ must be the right hand argument of `<tt><b>+</b></tt>'. Note that this `<tt><b>+</b></tt>'
+ operator has even higher precedence than `<tt><b>:</b></tt>'. Here are some
+ examples of the use of offsets:</p>
+<pre>
+<strong>$ nc2text geog.nc 'lon[ ~-100 + -1 : ~-360 + 2 ]'
+-180 -90 0
+</strong>
+</pre>
+<p>prints the longitudes from that <em>one before the closest to 100�W</em> to
+ that <em>two beyond the closest to 360�W</em>. Note how the negative offset
+ is specified as `<tt><b>+ -1</b></tt>', which is <em>not</em> equivalent
+ to `<tt><b>-1</b></tt>' as in:</p>
+<pre>
+<strong>$ nc2text geog.nc 'lon[ ~-100-1 : ~-360 + 2 ]'
+-90 90 -180 -90 0
+</strong>
+</pre>
+<p>which is equivalent to both the following (Note the wrap-around.):</p>
+<pre>
+<strong>$ nc2text geog.nc 'lon[ (~-100) (-1:~-360 + 2) ]'
+-90 90 -180 -90 0
+$ nc2text geog.nc 'lon[ 1 3:2 ]'
+-90 90 -180 -90 0
+</strong>
+</pre>
+<p>One use for offsets is to append along the <tt><b>UNLIMITED</b></tt> dimension
+ without needing to know its current size. The expression `<tt><b>-1+1</b></tt>'
+ represents the index value for appending immediately after the current final
+ record. Thus we could append a value to variable <tt><b>v</b></tt> in file <tt><b>vec_new.nc</b></tt>
+ (whose <tt><b>UNLIMITED</b></tt> dimension <tt><b>n</b></tt> has the current
+ size 7) by:</p>
+<pre>
+<strong>$ echo 80 | text2nc 'vec_new.nc v[-1 + 1]'
+$ nc2text 'vec_new.nc v'
+10 20.3 30.7 40.9 50 60.5 70.2 80
+</strong>
+</pre>
+<p>Then we could append two more values by:</p>
+<pre>
+<strong>$ echo 90 100.1 | text2nc 'vec_new.nc v[ -1 + 1 : -1 + 2 ]'
+$ nc2text 'vec_new.nc v'
+10 20.3 30.7 40.9 50 60.5 70.2 80 90 100.1
+</strong>
+</pre>
+<p>giving a new size of 10 for the <tt><b>UNLIMITED</b></tt> dimension.</p>
+<h3>Coordinate Variable Unit Conversion</h3>
+<p>In file <tt><b>geog.nc</b></tt> the <tt><b>units</b></tt> attribute is <tt><b>degrees_north</b></tt>
+ for <tt><b>lat</b></tt> and <tt><b>degrees_east</b></tt> for <tt><b>lon</b></tt>.
+ One may want to specify coordinate values in some other units. The following
+ shows how this can be done by appending the unit (enclosed in braces i.e. `<tt><b>{}</b></tt>')
+ to the value:</p>
+<pre>
+<strong>$ nc2text geog.nc 'tsur[ lat=~0.8{radian}, lon = ~ -1.5 { radian } ]'
+32
+</strong>
+</pre>
+<p>giving the value at the point closest to latitude 0.8 radians north and longitude
+ 1.5 radians west. This unit conversion (like that during FAN input and output)
+ is done using the Unidata units library discussed in Appendix C of <a
+href="/software/netcdf/guide_toc.html"> NetCDF
+ User's Guide</a>.</p>
+<p><a id="Attributes" name="Attributes"></a></p>
+<h2>Attributes</h2>
+<p>As noted in Section <a href="#High_level_Syntax"><em>High level Syntax</em></a>
+ an attribute <em>vas</em> can take two forms: <br />
+ <em>var</em><tt><b>:</b></tt><em>att</em> <br />
+ <tt><b>:</b></tt><em>att</em> <br />
+ As in CDL, the latter denotes a <em>global attribute</em>. The following writes
+ the global attribute <tt><b>title</b></tt> and then reads and prints it:</p>
+<pre>
+<strong>$ echo 'Sample geographic file' | text2nc -h 'geog.nc :title'
+$ nc2text 'geog.nc :title'
+Sample geographic file
+</strong>
+</pre>
+<p>(The <tt><b>-h</b></tt> flag means `<em>Do not append a line to the global
+ attribute</em> <tt><b>history</b></tt>'.)</p>
+<p>Attributes cannot have subscripts, so there is no way of accessing only part
+ of an attribute. Attributes are automatically created if they do not exist and
+ their type and size can be changed. The following gives variable <tt><b>lat</b></tt>
+ the new attribute <tt><b>valid_range</b></tt> (with type <tt><b>float</b></tt>)
+ and then prints it:</p>
+<pre>
+<strong>$ echo -90 90 | text2nc -h -t float 'geog.nc lat:valid_range'
+$ nc2text 'geog.nc lat:valid_range'
+-90 90
+</strong>
+</pre>
+<p>The following gives variable <tt><b>lat</b></tt> another new attribute <tt><b>foo</b></tt>
+ (by copying variable <tt><b>v</b></tt> from file <tt><b>vec.nc</b></tt>), then
+ modifies it, then deletes it.</p>
+<pre>
+<strong>$ nc2text 'vec.nc v[:4]' | text2nc -h -t double 'geog.nc lat:foo'
+$ nc2text 'geog.nc lat:foo'
+10 20.3 30.2 40.9 50
+$ echo 'Hello' | text2nc -h 'geog.nc lat:foo' # Modify attribute 'lat:foo'
+$ nc2text 'geog.nc lat:foo'
+Hello
+$ text2nc -h 'geog.nc lat:foo' < /dev/null # Delete attribute 'lat:foo'
+</strong>
+</pre>
+<p>Note how one can delete attributes by changing their size to 0. The file <tt><b>/dev/null</b></tt>
+ is a standard UNIX pseudo-file that is empty for input.</p>
+<p><a id="Using_ID_Numbers" name="Using_ID_Numbers"></a></p>
+<h2>Using ID Numbers for Variables, Dimensions and Attributes</h2>
+<p>It is possible to use ID numbers in place of names for variables, dimensions
+ and attributes. However dimension ID numbers must be followed by <tt><b>=</b></tt>
+ so they can be distinguished from index values. ID numbers begin at 0 regardless
+ of the index origin. Negative values are relative to the end, which is represented
+ by <tt><b>-1</b></tt>.</p>
+<p>There are some situations where ID numbers are more convenient than names.
+ For example, one might adopt the convention that coordinate variables should
+ be defined first, after which there should be only a single other (main) variable
+ in each file. A shell-script to process such files can refer to the main variable
+ as <tt><b>-1</b></tt>. The following shows the use of such a variable ID number:</p>
+<pre>
+<strong>$ nc2text geog.nc -1
+11 12 13 14
+21 22 23 24
+31 32 33 34
+</strong>
+</pre>
+<p>The following prints the first attribute of the second variable:</p>
+<pre>
+<strong>$ nc2text geog.nc '1:0'
+degrees_east
+</strong>
+</pre>
+<p>The following Korn shell script <tt><b>pratts</b></tt> prints all the non-global
+ attributes in the files specified by its arguments.</p>
+<pre>
+<strong>$ cat pratts
+#!/bin/ksh
+for FILE
+do
+ integer VARID=0
+ # Following true if variable VARID exists
+ while VARNAME="$(ncmeta -s -w v $FILE $VARID)"; test -n "$VARNAME"
+ do
+ integer ATTID=0
+ # Following true if attribute ATTID exists
+ while ATTNAME="$(ncmeta -s -w a $FILE $VARID:$ATTID)"; test -n "$ATTNAME"
+ do
+ print -n "$FILE $VARNAME:$ATTNAME "
+ nc2text $FILE "$VARNAME:$ATTNAME"
+ (( ATTID += 1 ))
+ done
+ (( VARID += 1 ))
+ done
+done
+</strong>
+</pre>
+<p>We can use <tt><b>pratts</b></tt> on file <tt><b>geog.nc</b></tt> as follows:</p>
+<pre>
+<strong>$ pratts geog.nc
+geog.nc lat:units degrees_north
+geog.nc lat:valid_range -90 90
+geog.nc lon:units degrees_east
+</strong>
+</pre>
+<h1>FAN Utilities</h1>
+<h2>Introduction to Utilities</h2>
+<p>This section provides a more detailed description of the four FAN utilities,
+ <tt><b>nc2text</b></tt>, <tt><b>text2nc</b></tt>, <tt><b>ncmeta</b></tt> and
+ <tt><b>ncrob</b></tt>, commencing with some features common to several utilities.
+ The usage summaries in Sections <a href="#nc2text_Usage"><em>nc2text Usage</em></a>,
+ <a
+href="#text2nc_Usage"><em>text2nc Usage</em></a>, <a
+href="#ncmeta_Usage"><em>ncmeta Usage</em></a> and <a
+href="#ncrob_Usage"><em>ncrob Usage</em></a> can be printed by entering the command
+ name without any arguments.</p>
+<p>All netCDF types (<tt><b>char, byte, short, long, float</b></tt> and <tt><b>double</b></tt>)
+ can be read and written. During input/output there is automatic conversion to
+ or from type <tt><b>double</b></tt>, which is used for internal storage and
+ processing.</p>
+<h3>Options Common to several Utilities</h3>
+<p>The two flags <tt><b>-h</b></tt> and <tt><b>-H</b></tt> specify what is to
+ be written to the global attribute <tt><b>history</b></tt>. The <tt><b>-h</b></tt>
+ flag means `<em>Do not write any history</em>'. The <tt><b>-H</b></tt> flag
+ means `<em>Exclude time-stamp and user-name</em> (<tt><b>LOGNAME</b></tt>) <em>from
+ history</em>'. This flag is useful in program testing, since it causes the
+ same values to be written to <tt><b>history</b></tt> each time, thus facilitating
+ comparison of actual output with that expected.</p>
+<p>Section 4.5 of <a
+href="/software/netcdf/guide_toc.html"> NetCDF
+ User's Guide</a> explains the two aspects of error-handling: suppression
+ of error messages and fatality of errors. The default mode is <em>verbose</em>
+ and <em>fatal</em>. <em>Non-verbose (silent)</em> mode is set by flag <tt><b>-s</b></tt>.
+ <em>Non-fatal (persevere)</em> mode is set by flag <tt><b>-p</b></tt>.</p>
+<p>The <tt><b>-e</b></tt> flag means `<em>Write error messages to</em> <tt><b>stdout</b></tt>
+ <em>not</em> <tt><b>stderr</b></tt>'.</p>
+<p>The option `<tt><b>-t</b></tt> <em>type</em>' sets the data-type for new
+ variables or attributes. Valid values are <tt><b>char, byte, short, long, float</b></tt>
+ and <tt><b>double</b></tt>. These can be abbreviated to their first letter.</p>
+<p>The option `<tt><b>-u</b></tt> <em>unit</em>' sets the unit of measure
+ for ASCII text data, providing conversion to or from those defined by netCDF
+ <tt><b>units</b></tt> attributes.</p>
+<p><a id="Scaling" name="Scaling"></a></p>
+<h3>Scaling and Unit Conversion</h3>
+<p>All netCDF input and output values are transformed by a linear equation defined
+ by the attributes <tt><b>add_offset</b></tt>, <tt><b>scale_factor</b></tt> and
+ <tt><b>units</b></tt>; together with any unit defined by the <tt><b>-u</b></tt>
+ option mentioned above. The output <tt><b>units</b></tt> attribute is defined
+ or modified in some situations such as when it is undefined but the corresponding
+ input attribute is defined.</p>
+<p>All unit conversion is done using the <em>Units Library</em> documented in
+ Appendix C of <a
+href="/software/netcdf/guide_toc.html"> NetCDF
+ User's Guide</a>. The environment variable <tt><b>UDUNITS_PATH</b></tt>
+ can be used to specify a non-standard units file. (See <tt><b>man</b></tt> document
+ <tt><b>udunits(3)</b></tt>.)</p>
+<h3>Missing Values</h3>
+<p>Values read from a netCDF file are considered missing if outside the <em>valid
+ range</em> defined by the attribute <tt><b>valid_range</b></tt> or the attributes
+ <tt><b>valid_min</b></tt>, and <tt><b>valid_max</b></tt>. If these do not define
+ either the minimum or the maximum then an attempt is made to define it based
+ on the principle that the <em>missing value</em> must be outside the valid range.
+ The <em>missing value</em> is defined by the attribute <tt><b>missing_value</b></tt>,
+ or if this is undefined then the <em>fill value</em> (defined by attribute <tt><b>_FillValue</b></tt>
+ if defined, otherwise the default fill value for the data type).</p>
+<h3>Environment Variables</h3>
+<p>The environment variable <tt><b>UDUNITS_PATH</b></tt> was mentioned in Section
+ <a href="#Scaling"><em>Scaling</em></a>. The environment variable <tt><b>COLUMNS</b></tt>
+ (default: 80) defines the page width and is used to print data of type <tt><b>character</b></tt>.</p>
+<h2>nc2text</h2>
+<p>This utility prints variable and attribute values from netCDF files.</p>
+<p><a id="nc2text_Usage" name="nc2text_Usage"></a></p>
+<h3>Usage</h3>
+<pre>
+<strong>Usage: nc2text [-eps] [-f %s] [-m %s] [-n %d] [-u %s] <FANI>
+<FANI> netCDF FAN specification for input
+-e Write error messages to stdout not stderr
+-p Persevere after errors
+-s Silent mode: Suppress warning messages
+-f <string>: Format for output (default: C_format attribute ("%G" if none))
+-m <string>: Missing value for output (default: _ )
+-n <integer>: Number of fields per line of output (default: 10 if numeric)
+ (Environment variable COLUMNS defines default for characters)
+-u <string>: Unit of measure for output (default: unit in file)
+</strong>
+</pre>
+<h3>Examples</h3>
+<p>The following prints the first three elements of variable <tt><b>v</b></tt>
+ of file <tt><b>vec.nc</b></tt>:</p>
+<pre>
+<strong>$ nc2text 'vec.nc v[0 1 2]'
+10 20.3 30.2
+</strong>
+</pre>
+<p>The following uses <tt><b>text2nc</b></tt> to</p>
+<ul>
+ <li>set attribute <tt><b>v:units</b></tt> to `<tt><b>degF</b></tt>'</li>
+ <li>set attribute <tt><b>v:valid_min</b></tt> to -460�F (just below 0�K)</li>
+ <li>modify <tt><b>v[2]</b></tt> so it is less than this valid minimum i.e. missing.</li>
+</ul>
+<pre>
+<strong>$ echo degF | text2nc vec.nc 'v:units'
+$ echo -460 | text2nc -t float vec.nc 'v:valid_min'
+$ echo -999 | text2nc vec.nc 'v[2]'
+</strong>
+</pre>
+<p>Then we print four Celsius temperatures per line. The text `<tt><b>MISSING</b></tt>'
+ is printed for missing values. Normal values are printed using the C format
+ <tt><b>%8.4f</b></tt> (equivalent to the Fortran format <tt><b>F8.4</b></tt>
+ i.e 4 decimal places with a total field width of 8 characters).</p>
+<pre>
+<strong>$ nc2text -f '%8.4f' -m ' MISSING' -n 4 -u degC vec.nc 'v[:4]'
+-12.2222 -6.5000 MISSING 4.9444
+ 10.0000
+</strong>
+</pre>
+<h2>ncmeta</h2>
+<p>This utility prints metadata from netCDF files. This metadata can include rank,
+ shape, file names, variable names, dimension names and attribute names.</p>
+<p><a id="ncmeta_Usage" name="ncmeta_Usage"></a></p>
+<h3>Usage</h3>
+<pre>
+<strong>Usage: ncmeta [-eps] [-w <LETTERS>] <FANI>
+<FANI> netCDF FAN specification for input
+-e Write error messages to stdout not stderr
+-p Persevere after errors
+-s Silent mode: Suppress warning messages
+-w <LETTERS>: What to print using following (default: s)
+ a: attribute names
+ d: dimension names
+ f: file names
+ r: rank (number of dimensions)
+ s: shape (dimension sizes)
+ v: variable names
+
+Example: ncmeta -w fvs abc.nc var1 var2
+</strong>
+</pre>
+<p><a id="ncmeta_Examples" name="ncmeta_Examples"></a></p>
+<h3>Examples</h3>
+<p>The following examples print the shape of the specified variables:</p>
+<pre>
+<strong>$ ncmeta vec.nc v
+5
+$ ncmeta geog.nc tsur
+3 4
+</strong>
+</pre>
+<p>The following example prints the filename, variable name, rank, dimensions
+ and shape of the specified variables:</p>
+<pre>
+<strong>$ ncmeta -w fvrds vec.nc v 'geog.nc tsur' lat lon
+vec.nc v 1 n 5
+geog.nc tsur 2 lat lon 3 4
+geog.nc lat 1 lat 3
+geog.nc lon 1 lon 4
+</strong>
+</pre>
+<p>The following example prints the variable name and attribute name of the first
+ (0) attribute of the first (0) variable:</p>
+<pre>
+<strong>$ ncmeta -w va geog.nc '0:0'
+lat units
+</strong>
+</pre>
+<h2>ncrob</h2>
+<p>This utility reads data from one or more netCDF variables, performs some process
+ on it and then either prints the result or writes it to one or more netCDF variables.
+ The type of process is defined by option `<tt><b>-r</b></tt> <em>string</em>',
+ where <em>string</em> is one of the following:</p>
+<center>
+ <table border="1" summary="option meanings">
+ <tr>
+ <td><tt><b>am</b></tt> </td>
+ <td>arithmetic mean</td>
+ </tr>
+ <tr>
+ <td><tt><b>broadcast</b></tt> </td>
+ <td>cyclic copy</td>
+ </tr>
+ <tr>
+ <td><tt><b>count</b></tt> </td>
+ <td>number of non-missing values</td>
+ </tr>
+ <tr>
+ <td><tt><b>fill</b></tt> </td>
+ <td>fill with missing values</td>
+ </tr>
+ <tr>
+ <td><tt><b>gm</b></tt> </td>
+ <td>geometric mean</td>
+ </tr>
+ <tr>
+ <td><tt><b>max</b></tt> </td>
+ <td>maximum</td>
+ </tr>
+ <tr>
+ <td><tt><b>min</b></tt> </td>
+ <td>minimum</td>
+ </tr>
+ <tr>
+ <td><tt><b>prod</b></tt> </td>
+ <td>product</td>
+ </tr>
+ <tr>
+ <td><tt><b>sd</b></tt> </td>
+ <td>unadjusted standard deviation (divisor is <var>n</var> )</td>
+ </tr>
+ <tr>
+ <td><tt><b>sd1</b></tt> </td>
+ <td>adjusted standard deviation (divisor is <var>n</var>-1 )</td>
+ </tr>
+ <tr>
+ <td><tt><b>sum</b></tt> </td>
+ <td>sum</td>
+ </tr>
+ <tr>
+ <td><tt><b>sum2</b></tt> </td>
+ <td>sum of squares of values</td>
+ </tr>
+ </table>
+</center>
+<p>A <tt><b>broadcast</b></tt> copies successive elements from input to output.
+ Whenever the end of input is reached, reading begins again at the start of input.
+ The whole process continues until reaching the end of output.</p>
+<p>A <tt><b>fill</b></tt> simply fills the output variable with missing values.
+ There must be input, although it is used only to define the shape of new variables.</p>
+<p>The other processes are all <em>reductions</em>, in the sense that they reduce
+ the <em>rank</em> (number of dimensions). The number of input elements ( <var>I</var> )
+ must be a multiple of both the number of output elements ( <var>N</var> )
+ and the number of weights ( <var>M</var> ) (if any, as specified by
+ option <tt><b>-w</b></tt>).</p>
+<p>If the process is <tt><b>count</b></tt> and there are no weights then the result
+ is the number of non-missing values. If there are weights then the result is
+ the sum of the weights of the non-missing values.</p>
+<p>Let vector <var>X</var><sub>0</sub>, <var>X</var><sub>1</sub>, ..., <var>
+ X</var><sub><var>i</var></sub>, ..., <var>X</var><sub><var> I</var>-1</sub>
+ represent the selected input data elements in the specified order. Similarly,
+ let vector <var>Y</var><sub>0</sub>, <var>Y</var><sub>1</sub>, ... <var>
+ Y</var><sub><var>j</var></sub>, ..., <var>Y</var><sub><var> N</var>-1</sub>
+ represent the resultant output data. Let <var>n</var> = <var>I</var> � <var>N</var>.</p>
+<p>If the process is <tt><b>sum</b></tt> and there are no weights then</p>
+<center>
+ <var>Y</var><sub><var>j</var></sub> = <strong> Sum</strong><sub><var>i</var>=0,<var>n</var>-1</sub> <var>X</var><sub>
+ <var>Ni</var>+<var>j</var></sub>
+</center>
+<p>If weights <var>W</var><sub>0</sub>, <var>W</var><sub>1</sub>, ..., <var>
+ W</var><sub><var>k</var></sub>, ..., <var>W</var><sub><var> M</var>-1</sub>
+ are defined and <var>m</var> = <var>I</var> � <var>M</var>
+ then</p>
+<center>
+ <var>Y</var><sub><var>j</var></sub> = <strong> Sum</strong><sub><var>i</var>=0,<var>n</var>-1</sub> <var>W</var><sub>
+ <strong>floor</strong>((<var>Ni</var>+<var>j</var>)/m)</sub><var>X</var><sub>
+ <var>Ni</var>+<var>j</var></sub>
+</center>
+<p>where <strong>floor</strong>( <var>x</var> ) represents
+ the floor of <var>x</var> i.e. the greatest integer <= <var>x</var>.</p>
+<p>This is calculated using the following algorithm:</p>
+<p> <var>n</var> <tt><b>:=</b></tt> <var>I</var>�<var>N</var>
+ <br />
+ <var>m</var> <tt><b>:=</b></tt> <var>I</var>�<var>M</var>
+ <br />
+ <b>for</b> <var>j</var> <b>from</b> 0 <b>to</b> <var>N</var>-1
+ <br />
+ <tt> </tt> <var>Y</var><sub><var>j</var></sub>
+ <tt><b>:=</b></tt> 0 <br />
+ <b>for</b> <var>i</var> <b>from</b> 0 <b>to</b> <var>I</var>-1
+ <br />
+ <tt> </tt> <var>j</var> <tt><b>:=</b></tt> <var>i</var> <strong>mod</strong> <var>n</var>
+ <br />
+ <tt> </tt> <var>k</var> <tt><b>:=</b></tt> <strong>floor</strong>( <var>i</var>/m )
+ <br />
+ <tt> </tt> <b>if</b> <var>Y</var><sub><var>j</var></sub> �=
+ <tt><b>missing_value</b></tt> <br />
+ <tt> </tt> <tt> </tt> <b>if</b> <tt><b>valid_min</b></tt>
+ <= <var>X</var><sub><var>i</var></sub> <= <tt><b>valid_max</b></tt>
+ <br />
+ <tt> </tt> <tt> </tt> <tt> </tt>
+ <var>Y</var><sub><var>j</var></sub> <tt><b>:=</b></tt> <var>Y</var><sub><var>j</var></sub> + <var>W</var><sub>
+ <var>k</var></sub> <var>X</var><sub><var>i</var></sub> <br />
+ <tt> </tt> <tt> </tt> <b>else if</b> <tt><b>suddenDeath</b></tt>
+ <br />
+ <tt> </tt> <tt> </tt> <tt> </tt>
+ <var>Y</var><sub><var>j</var></sub> <tt><b>:=</b></tt> <tt><b>missing_value</b></tt>
+ <br />
+</p>
+<p>Note that this definition of <var>k</var> means that the first
+ <var>m</var> elements have the first weight <var>W</var><sub>0</sub> ,
+ the next <var>m</var> have the second weight <var>W</var><sub>1</sub> ,
+ and so on.</p>
+<p>As an example consider an input array which is a matrix <var>A</var>
+ with <var>R</var> rows and <var>C</var> columns. Thus
+ <var>I</var>=<var>RC</var>. If we want column sums then the output vector
+ would be of length <var>C</var> i.e. <var>N</var>=<var>C</var>.
+ Now <var>n</var>= <var>I</var> � <var>N</var> = <var>
+ R</var>. So the unweighted sum is</p>
+<center>
+ <var>Y</var><sub><var>j</var></sub> = <strong> Sum</strong><sub><var>i</var>=0,<var>R</var>-1</sub> <var>X</var><sub>
+ <var>Ci</var>+<var>j</var></sub> = <strong>Sum</strong><sub> <var>i</var>=0,<var>R</var>-1</sub> <var>A</var><sub><var>ij</var></sub>
+</center>
+<p>and the weighted sum is</p>
+<center>
+ <var>Y</var><sub><var>j</var></sub> = <strong> Sum</strong><sub><var>i</var>=0,<var>R</var>-1</sub> <var>W</var><sub>
+ <strong>floor</strong>((<var>Ci</var>+<var>j</var>)/C)</sub> <var> X</var><sub><var>Ci</var>+<var>j</var></sub> = <strong>Sum</strong><sub>
+ <var>i</var>=0,<var>R</var>-1</sub> <var>W</var><sub><var>i</var></sub> <var>
+ A</var><sub><var>ij</var></sub>
+</center>
+<p>If the process is <tt><b>prod</b></tt> and there are no weights then</p>
+<center>
+ <var>Y</var><sub><var>j</var></sub> = <strong> Product</strong><sub><var>i</var>=0,<var>n</var>-1</sub> <var>X</var><sub>
+ <var>Ni</var>+<var>j</var></sub>
+</center>
+<p>If weights are defined then</p>
+<center>
+ <var>Y</var><sub><var>j</var></sub> = <strong> Product</strong><sub><var>i</var>=0,<var>n</var>-1</sub> <var>X</var><sub>
+ <var>Ni</var>+<var>j</var></sub> <sup><var>W</var><sub><strong> floor</strong>((<var>Ni</var>+<var>j</var>)/m)</sub></sup>
+</center>
+<p>In general the shape (dimension vector) of the destination should match the
+ trailing dimensions of the source. Then the reduction process operates over
+ those leading dimensions absent from the destination.</p>
+<p>Note that FAN allows you to transpose dimensions by specifying them in an order
+ different from that in the file. Thus the leading source dimensions are those
+ specified first. The order of the remaining dimensions must match those of the
+ destination.</p>
+<p>The other reduction processes are treated similarly. However <tt><b>min</b></tt>
+ and <tt><b>max</b></tt> do not allow weights.</p>
+<p>If the <tt><b>-m</b></tt> flag is specified then the result is missing if any
+ of the values it depends on is missing (<em>sudden death mode</em>). Otherwise
+ missing values are omitted (<em>filter mode</em>) i.e. essentially treated as
+ having a weight of 0.</p>
+<p>The <tt><b>-b</b></tt> option sets the size of the input buffer. This can improve
+ efficiency when reading very large variables.</p>
+<p>The <tt><b>-c</b></tt> option creates a new destination variable with the specified
+ rank (number of dimensions). If the variable already exists then this option
+ is ignored. If the destination file does not exist then it is created. The variable
+ is created with the same attributes as the (first if several) source variable,
+ and the specified number of its trailing dimensions, together with any associated
+ coordinate variables. However a broadcast is slightly different in that a new
+ leading dimension is created from the leading source dimensions by taking the
+ product of their sizes (so the total number of elements is unchanged) and concatenating
+ their names. The data-type of the new variable is specified using option <tt><b>-t</b></tt>
+ and defaults to the type of the source variable.</p>
+<p><a id="ncrob_Usage" name="ncrob_Usage"></a></p>
+<h3>Usage</h3>
+<pre>
+<strong>Usage: ncrob [options] <FANI> / <FANO>
+<FANI>: FAN specification for input
+<FANO>: FAN specification for output (default: stdout)
+-e Write error messages to stdout not stderr
+-H Exclude time-stamp & LOGNAME from history
+-h Do not write history
+-m If any value missing then result missing
+-p Persevere after errors
+-s Silent mode: Suppress warning messages
+-b <int>: Max. buffer size (Kbytes) (default: 512)
+-c <int>: Rank (decrement if < 0) of any Created variable including stdout
+ (default: input rank for broadcast, else -1)
+-f <string>: Format for stdout (default: C_format attribute ("%G" if none))
+-M <string>: Missing value for stdout (default: _ )
+-n <integer>: Number of fields per line for stdout (default: 10 if numeric)
+ (Environment variable COLUMNS defines default for characters)
+-r <string>: Reduction type (am broadcast count fill gm max min prod
+ sd sd1 sum sum2) (default: broadcast)
+-t char|byte|short|long|float|double: new variable type (default: input type)
+-u <string>: Unit of measure for stdout (default: unit in file)
+-w <reals>: Weight vector(e.g. -w '3 1.5 .8')
+</strong>
+</pre>
+<p>If the `<tt><b>/</b></tt>' is omitted then the final argument is taken
+ as <tt><b><FANO></b></tt>. (This version 1 convention is deprecated.)
+ If <tt><b><FANO></b></tt> does not specify a filename or variable name
+ then the first one in <tt><b><FANI></b></tt> is used.</p>
+<h3>Examples</h3>
+<p>The following prints the variable <tt><b>M</b></tt> in file <tt><b>mat.nc</b></tt>:</p>
+<pre>
+<strong>$ ncrob mat.nc M /
+11 12 13
+21 22 23
+</strong>
+</pre>
+<p>The following prints the column sums, row means and overall product:</p>
+<pre>
+<strong>$ ncrob -r sum mat.nc M / # sum of each column
+32 34 36
+$ ncrob -r am mat.nc 'M[col]' / # arithmetic mean of each row
+12 22
+$ ncrob -r prod -c 0 -f '%.0f' mat.nc M / # overall product
+18234216
+</strong>
+</pre>
+<p>The first two commands have no <tt><b>-c</b></tt> option, so the rank of the
+ result is one less than that of the input. The third specifies <tt><b>-c 0</b></tt>,
+ so the result has rank 0, i.e. is scalar. The following attempts to put this
+ same data into three new variables in the same file:</p>
+<pre>
+<strong>$ ncrob -h -r sum mat.nc M / col_sum
+$ ncrob -h -r am mat.nc 'M[col]' / row_am
+$ ncrob -h -r prod -c 0 mat.nc M / prod
+$ ncdump mat.nc
+netcdf mat {
+dimensions:
+ row = 2 ;
+ col = 3 ;
+variables:
+ short M(row, col) ;
+ short col_sum(col) ;
+ short row_am(row) ;
+ short prod ;
+data:
+ M =
+ 11, 12, 13,
+ 21, 22, 23 ;
+ col_sum = 32, 34, 36 ;
+ row_am = 12, 22 ;
+ prod = _ ;
+}
+</strong>
+</pre>
+<p>Why is <tt><b>prod</b></tt> dumped as <tt><b>_</b></tt> (i.e. fill) rather
+ than 18234216 as before? The problem is that <tt><b>ncrob</b></tt> has created
+ a new variable of the same type as the source variable, which in this case is
+ <tt><b>short</b></tt> and incapable of storing such a large number. The solution
+ is to specify the type using the <tt><b>-t</b></tt> option. Let's also create
+ a new file <tt><b>prod.nc</b></tt>. E.g.</p>
+<pre>
+<strong>$ ncrob -h -r prod -c 0 -t long mat.nc M / prod.nc prod
+$ ncdump prod.nc
+netcdf prod {
+variables:
+ long prod ;
+data:
+ prod = 18234216 ;
+}
+</strong>
+</pre>
+<p>Next let's calculate a weighted mean of each column. Let's give the
+ first row twice the weight of the second:</p>
+<pre>
+<strong>$ ncrob -r am -w '2 1' M mat.nc /
+14.3333 15.3333 16.3333
+</strong>
+</pre>
+<p>Thus the mean of the first column is (2 * 11 + 1 * 21)/3 = 14.3333. Negative
+ weights can be used to obtain differences. E.g.</p>
+<pre>
+<strong>$ ncrob -r sum -w '1 -1' M mat.nc / # row1 - row2
+-10 -10 -10
+$ ncrob -r sum -w '1 -1' 'M(col=3 1]' mat.nc / # col3 - col1
+</strong>
+</pre>
+<p>Finally we demonstrate broadcasting. Let's first copy the matrix <tt><b>M</b></tt>
+ to two variables in a new file called <tt><b>new.nc</b></tt>. One new variable
+ has the same name (<tt><b>M</b></tt>) and shape. The other is named <tt><b>V</b></tt>
+ and is a vector with the new dimension <tt><b>row_col</b></tt> formed from dimensions
+ <tt><b>row</b></tt> and <tt><b>col</b></tt>.</p>
+<pre>
+<strong>$ ncrob -h M mat.nc / new.nc
+$ ncrob -h -c 1 M mat.nc / new.nc V
+$ ncdump new.nc
+netcdf new {
+dimensions:
+ row = 2 ;
+ col = 3 ;
+ row_col = 6 ;
+variables:
+ short M(row, col) ;
+ short V(row_col) ;
+data:
+ M =
+ 11, 12, 13,
+ 21, 22, 23 ;
+ V = 11, 12, 13, 21, 22, 23 ;
+}
+</strong>
+</pre>
+<p>Now let's broadcast the variable <tt><b>col_sum</b></tt> in file <tt><b>mat.nc</b></tt>
+ to these variables <tt><b>M</b></tt> and <tt><b>V</b></tt> in the file <tt><b>new.nc</b></tt>:</p>
+<pre>
+<strong>$ ncrob -h mat.nc col_sum / new.nc M V
+$ ncdump new.nc
+netcdf new {
+dimensions:
+ row = 2 ;
+ col = 3 ;
+ row_col = 6 ;
+variables:
+ short M(row, col) ;
+ short V(row_col) ;
+data:
+ M =
+ 32, 34, 36,
+ 32, 34, 36 ;
+ V = 32, 34, 36, 32, 34, 36 ;
+}
+</strong>
+</pre>
+<p>Four copies of the input were needed to fill the output.</p>
+<h2>text2nc</h2>
+<p>This utility reads ASCII text data from standard input and writes it to a netCDF
+ variable or attribute. The netCDF file and variable must already exist. However,
+ as discussed in Section <a
+href="#Attributes"><em>Attributes</em></a>, <tt><b>text2nc</b></tt> can create
+ attributes, delete them, and modify their type, size and value. If end-of-input
+ occurs before end-of-output then the input values are recycled.</p>
+<p><a id="text2nc_Usage" name="text2nc_Usage"></a></p>
+<h3>Usage</h3>
+<pre>
+<strong>Usage: text2nc [-eHhps] [-m %f] [-u %s] <FANO>
+<FANO>: netCDF FAN specification for output
+-e Write error messages to stdout not stderr
+-H Exclude time-stamp & LOGNAME from history
+-h Do not write history
+-p Persevere after errors
+-s Silent mode: Suppress warning messages
+-m <real>: Missing value for input (default: 1.79769E+308)
+-t char|byte|short|long|float|double: data-type (for attributes only)
+ (default: double for numeric input data, else char)
+-u <string>: Unit of measure for input (default: unit in file)
+</strong>
+</pre>
+<p><a id="text2nc_Examples" name="text2nc_Examples"></a></p>
+<h3>Examples</h3>
+<p>Let's start with the following file:</p>
+<pre>
+<strong>$ ncdump vec.nc
+netcdf vec {
+dimensions:
+ n = UNLIMITED ; // (5 currently)
+variables:
+ float v(n) ;
+data:
+ v = 10 , 20.3 , 30.2 , 40.9 , 50 ;
+}
+</strong>
+</pre>
+<p>Let's assume these data are Celsius temperatures, so we define a valid
+ minimum by:</p>
+<pre>
+<strong>$ echo -273.2 | text2nc -h vec.nc 'v:valid_min'
+</strong>
+</pre>
+<p>Then we modify two existing values:</p>
+<pre>
+<strong>$ echo 15 17 | text2nc -h -u degC vec.nc 'v[0 3]'
+$ ncdump vec.nc
+netcdf vec {
+dimensions:
+ n = UNLIMITED ; // (5 currently)
+variables:
+ float v(n) ;
+ v:valid_min = -273.2 ;
+ v:units = "degC" ;
+data:
+ v = 15 , 20.3 , 30.2 , 17 , 50 ;
+}
+</strong>
+</pre>
+<p>Note that the <tt><b>units</b></tt> attribute was created because we specified
+ <tt><b>-u degC</b></tt>, but there was no existing <tt><b>units</b></tt>
+ attribute. Now let's append three values and print the resulting <tt><b>v</b></tt>:</p>
+<pre>
+<strong>$ echo -999 32 1e9 | text2nc -h -u degF -m 1e9 vec.nc 'v[-1+1:-1+3]'
+$ nc2text -f '%0.1f' vec.nc v
+15.0 20.3 30.2 17.0 50.0 _ 0.0 _
+</strong>
+</pre>
+<p>The first value (<tt><b>-999</b></tt>) is treated as missing because (even
+ after conversion to Celsius) it is less than the valid mininum of <tt><b>-273.2</b></tt>.
+ The second value (32�F) is converted to 0�C. The third value (<tt><b>1e9</b></tt>)
+ is treated as missing because it matches the input missing value specified by
+ <tt><b>-m 1e9</b></tt>.</p>
+<p>Finally, let's change every second value to 0�K:</p>
+<pre>
+<strong>$ echo 0 | text2nc -h -u degK vec.nc 'v[1::2]'
+$ nc2text -f '%0.1f' vec.nc v
+15.0 -273.1 30.2 -273.1 50.0 -273.1 0.0 -273.1
+</strong>
+</pre>
+<p></p>
+<!-- InstanceEndEditable -->
+ </div> <!-- /#container -->
+ </div> <!-- /#wrap -->
+
+ <!-- See footer.css for the styling of this section -->
+ <footer>
+ <div id="triptych-column-container">
+ <div id="triptych-columns">
+ <div class="column triptych_left">
+ <h2>Follow Unidata</h2>
+ <ul class="tabular half follow-icons">
+ <li>
+ <a href="https://twitter.com/unidata"><img src="/images/twitter.png" alt="Twitter" title="Twitter" /></a>
+ </li>
+ <li>
+ <a href="https://plus.google.com/105982992127916444326/posts"><img src="/images/googleplus.png" alt="Google+" title="Google+" /></a>
+ </li>
+ <li>
+ <a href="https://www.facebook.com/Unidata"><img src="/images/facebook.png" alt="Facebook" title="Facebook"/></a>
+ </li>
+ <li>
+ <a href="http://www.youtube.com/user/unidatanews"><img src="/images/youtube.png" alt="YouTube Channel" title="YouTube Channel"/></a>
+ </li>
+ <li>
+ <a href="http://www.unidata.ucar.edu/blogs/news/feed/entries/atom"><img src="/images/rss.png" alt="News at Unidata blog" title="News at Unidata blog"/></a>
+ </li>
+ <li>
+ <a href="http://www.unidata.ucar.edu/blogs/developer/feed/entries/atom"><img src="/images/blog.png" alt="Developers' Blog" title="Developers' Blog"/></a>
+ </li>
+ </ul>
+ </div> <!-- /.column column_left -->
+
+ <div class="column triptych_center">
+ <h2>Unidata
+ <div class="triptych_logos">
+ <a class="noicon" href="http://www.nsf.gov/"> <img alt="UCP" src="/images/logos/nsf_logo_transparent.png"/></a>
+ </div>
+ <div class="triptych_logos" style="padding-right:1em;">
+ <a class="noicon" href="http://www.ucp.ucar.edu/"> <img alt="UCP" id="ucp_small" src="/images/logos/ucp-logo2_transparent.png"/></a>
+ </div></h2>
+ <ul class="tabular full" style="padding-right:0.5em;">
+ <li style="text-align: center;">
+ Unidata is s a member of the
+ <a href="http://www.ucp.ucar.edu/">UCAR Community Programs</a>,
+ managed by the
+ <a href="http://www.ucar.edu">University Corporation for Atmospheric Research</a>,
+ and funded by the
+ <a href="http://www.nsf.gov">National Science Foundation</a>.
+ </li>
+ <li style="text-align: center;">
+ Read Unidata's <a href="http://www.unidata.ucar.edu/legal/participation.html">Participation Policy</a>.
+ </li>
+ <li>
+ <table style="width:100%">
+ <tr>
+ <td style="width:33%;text-align:left;">©
+ <script type="text/javascript">
+ document.write(new Date().getFullYear());
+ </script> UCAR</td>
+ <td style="width:33%;text-align:center;"><a href="http://www2.ucar.edu/privacy-policy">Privacy Policy</a></td>
+ <td style="width:33%;text-align:right;"><a href="http://www2.ucar.edu/terms-of-use">Terms of Use</a></td>
+ </tr>
+ </table>
+ </li>
+ </ul>
+ </div> <!-- /.column column_center -->
+
+ <div class="column triptych_right">
+ <h2>Contact Unidata</h2>
+ <ul class="tabular full">
+ <li>
+ For support: <b><a href="mailto:support at unidata.ucar.edu">support at unidata.ucar.edu</a></b>
+ </li>
+ <li>
+ By <b><a href="/about/index.html#visit">postal mail</a></b> or <b><a href="/about/index.html#visit">in person</a></b>
+ </li>
+ <li>
+ About this website: <b><a href="mailto:plaza at unidata.ucar.edu">plaza at unidata.ucar.edu</a></b>
+ </li>
+ <li>
+ By telephone: <b>303.497.8643</b>
+ </li>
+ </ul>
+ </div> <!-- /.column column_right -->
+
+ <a href="/about/tour/">
+ <div class="column column_extra" id="who_are_we">
+ <h2>Welcome to Unidata</h2>
+ <ul class="tabular full">
+ <li>
+ Learn more about who we are and what we do...
+ </li>
+ </ul>
+ </div> <!-- /.column column_extra -->
+ </a>
+
+ <span class="stretch"> </span>
+ </div> <!-- /#triptych-columns -->
+ </div> <!-- /#triptych-column-container -->
+ </footer>
+
+
+
+</body>
+
+
+<!-- InstanceEnd -->
diff --git a/docs/release.css b/docs/release.css
index 629b887..c52a18f 100644
--- a/docs/release.css
+++ b/docs/release.css
@@ -9,7 +9,7 @@
.tabs ul.tablist li.linkMenu select#versions {
vertical-align: middle;
height: ;
- margin: 8px 0 0 10px !important;
+ margin: 0 0 0 10px !important;
padding: 0;
}
@@ -21,7 +21,7 @@
.tabs ul.tablist li.searchForm form#cse-search-box {
float: right;
- margin: 8px 10px 0 0;
+ margin: 0 10px 0 0;
}
.tabs ul.tablist li.searchForm form#cse-search-box input#search {
border-radius: 5px;
diff --git a/docs/release_header.html b/docs/release_header.html
index 7670b08..1893b1b 100644
--- a/docs/release_header.html
+++ b/docs/release_header.html
@@ -30,7 +30,7 @@ $extrastylesheet
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/4.4.0\">4.4.0</option>" +
- " <option value=\"http://www.unidata.ucar.edu/software/netcdf/documentation/historic/netcdf\">Historic netCDF Documentation</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>');
diff --git a/docs/software.md b/docs/software.md
index 43ec5ab..ac42931 100644
--- a/docs/software.md
+++ b/docs/software.md
@@ -269,7 +269,7 @@ comments on EzGet, contact Karl Taylor (taylor13 at llnl.gov).
FAN
-------------------------
-[FAN (File Array Notation)](/software/netcdf/fan_utils.html) is Harvey
+[FAN (File Array Notation)](fan_utils.html) is Harvey
Davies' package for extracting and manipulating array data from netCDF
files. The package includes the three utilities nc2text, text2nc, and
ncrob for printing selected data from netCDF arrays, copying ASCII data
@@ -1704,19 +1704,9 @@ for more information.
Quantum GIS (QGIS) {#QGIS}
-----------------------------------------
-[Quantum GIS](http://www.qgis.org/) (QGIS) is an Open Source Geographic
-Information System (GIS) licensed under the GNU General Public License.
-QGIS is an official project of the Open Source Geospatial Foundation
-(OSGeo). It runs on Linux, Unix, Mac OSX, and Windows and supports
-numerous vector, raster, and database formats and functionalities. QGIS
-supports a desktop, browser, server, and client for viewing, editing,
-analysis, serving, and accessing data. Its server complies with the OGC
-WMS 1.3 standard. In addition to PostGIS and SpatiaLite formats, it can
-access data in vector formats supported by the OGR library as well as
-most raster formats supported by the GDAL library, including netCDF. For
-a more detailed list of features of the QGIS desktop, browser, server,
-and client, see the [QGIS features
-page](http://www.qgis.org/en/about-qgis/features.html).
+[Quantum GIS](http://www.qgis.org/) (QGIS) is an Open Source Geographic Information System (GIS) licensed under the GNU General Public License. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). It runs on Linux, Unix, Mac OSX, and Windows and supports numerous vector, raster, and database formats and functionalities. QGIS supports a desktop, browser, server, and client for viewing, editing, analysis, serving, and accessing data. Its server complies with the OG [...]
+
+QGIS also supports displaying netCDF using the [Crayfish plugin in QGIS](http://www.lutraconsulting.co.uk/blog/2016/04/14/crayfish-2-2/). The project repository may be found [here](https://github.com/lutraconsulting/qgis-crayfish-plugin).
Ruby interface {#Ruby}
-------------------------------------
diff --git a/docs/types.dox b/docs/types.dox
index ae5fb44..c33bd13 100644
--- a/docs/types.dox
+++ b/docs/types.dox
@@ -24,9 +24,11 @@ The atomic external types supported by the netCDF interface are:
- ::NC_DOUBLE 64-bit floating point
- ::NC_STRING variable length character string *
-* These types are available only for netCDF-4 format files. All the
- unsigned ints (except \ref NC_CHAR), the 64-bit ints, and string type are
- for netCDF-4 files only.
+\quote
+
+* These types are available only for CDF5 (NC_CDF5) and netCDF-4 format (NC_NETCDF4) files. All the unsigned ints (except \ref NC_CHAR), the 64-bit ints, and string type are for CDF5 or netCDF-4 files only.
+
+\endquote
These types were chosen to provide a reasonably wide range of
trade-offs between data precision and number of bits required for each
diff --git a/docs/windows-binaries.md b/docs/windows-binaries.md
index 15fd414..77269c2 100644
--- a/docs/windows-binaries.md
+++ b/docs/windows-binaries.md
@@ -21,7 +21,7 @@ Users who prefer to build the netCDF-C libraries from source in a Windows enviro
# Getting pre-built netCDF-C Libraries for Visual Studio {#msvc-prebuilt}
-These libraries have been built using Visual Studio 2012. The downloads are installer packages which contain the netCDF-C libraries and utilities (ncgen, ncgen3, ncdump and nccopy), as well as the associated dependencies.
+These libraries have been built using Visual Studio 2013 Community Edition. The downloads are installer packages which contain the netCDF-C libraries and utilities (ncgen, ncgen3, ncdump and nccopy), as well as the associated dependencies.
## Included Dependencies {#msvc-inc-deps}
@@ -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) {#msvc-latest-release}
+## Latest Release (netCDF-C 4.4.1-rc1) {#msvc-latest-release}
Configuration | 32-bit | 64-bit |
:-------------------|:-------- |:-------|
-netCDF 3 | [netCDF4.4.0-NC3-32.exe][r1] | [netCDF4.4.0-NC3-64.exe][r6]
-netCDF3+DAP | [netCDF4.4.0-NC3-DAP-32.exe][r2] | [netCDF4.4.0-NC3-DAP-64.exe][r6]
-netCDF4 | [netCDF4.4.0-NC4-32.exe][r3] | [netCDF4.4.0-NC4-64.exe][r7]
-netCDF4+DAP | [netCDF4.4.0-NC4-DAP-32.exe][r4] | [netCDF4.4.0-NC4-DAP-64.exe][r8]
+netCDF 3 | [netCDF4.4.1-rc1-NC3-32.exe][r1] | [netCDF4.4.1-rc1-NC3-64.exe][r6]
+netCDF3+DAP | [netCDF4.4.1-rc1-NC3-DAP-32.exe][r2] | [netCDF4.4.1-rc1-NC3-DAP-64.exe][r6]
+netCDF4 | [netCDF4.4.1-rc1-NC4-32.exe][r3] | [netCDF4.4.1-rc1-NC4-64.exe][r7]
+netCDF4+DAP | [netCDF4.4.1-rc1-NC4-DAP-32.exe][r4] | [netCDF4.4.1-rc1-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-NC3-32.exe
-[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC3-DAP-32.exe
-[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC4-32.exe
-[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC4-DAP-32.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC3-64.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC3-DAP-64.exe
-[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC4-64.exe
-[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-NC4-DAP-64.exe
+[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC3-32.exe
+[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC3-DAP-32.exe
+[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC4-32.exe
+[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC4-DAP-32.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC3-64.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC3-DAP-64.exe
+[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC4-64.exe
+[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-rc1-NC4-DAP-64.exe
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in
index 89dca55..dcc5a72 100644
--- a/examples/C/Makefile.in
+++ b/examples/C/Makefile.in
@@ -499,6 +499,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/examples/CDL/Makefile.in b/examples/CDL/Makefile.in
index fe20cca..745016a 100644
--- a/examples/CDL/Makefile.in
+++ b/examples/CDL/Makefile.in
@@ -378,6 +378,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 154c835..37e3af9 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -234,6 +234,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/h5_test/CMakeLists.txt b/h5_test/CMakeLists.txt
index bd491b2..f27db47 100644
--- a/h5_test/CMakeLists.txt
+++ b/h5_test/CMakeLists.txt
@@ -7,8 +7,8 @@ FOREACH(CTEST ${H5TESTS})
ADD_EXECUTABLE(${CTEST} ${CTEST}.c)
TARGET_LINK_LIBRARIES(${CTEST}
netcdf
- ${HDF5_C_LIBRARIES}
${HDF5_HL_LIBRARIES}
+ ${HDF5_C_LIBRARIES}
)
ADD_TEST(${CTEST} ${EXECUTABLE_OUTPUT_PATH}/${CTEST})
ENDFOREACH()
diff --git a/h5_test/Makefile.in b/h5_test/Makefile.in
index 7f4d23c..b1120cd 100644
--- a/h5_test/Makefile.in
+++ b/h5_test/Makefile.in
@@ -564,6 +564,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 1e15922..60eabd1 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,3 +1,26 @@
+#####
+# Installation of various netCDF headers.
+#####
+
+INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT headers)
+
+INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf_mem.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT headers)
+
+INSTALL(FILES ${netCDF_BINARY_DIR}/include/netcdf_meta.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT headers)
+
+IF(ENABLE_PNETCDF OR ENABLE_PARALLEL)
+ INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf_par.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT headers)
+ENDIF()
+
+
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} Makefile.am CMakeLists.txt)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/include/Makefile.am b/include/Makefile.am
index f4fb08e..aebb8e4 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -18,7 +18,7 @@ noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h \
nclist.h ncuri.h utf8proc.h ncdispatch.h ncdimscale.h \
netcdf_f.h err_macros.h ncbytes.h nchashmap.h ceconstraints.h rnd.h \
nclog.h ncconfigure.h nc4internal.h nctime.h nc3dispatch.h nc3internal.h \
-onstack.h
+onstack.h nc_hashmap.h
if USE_NETCDF4
noinst_HEADERS += ncaux.h
diff --git a/include/Makefile.in b/include/Makefile.in
index eb56945..b16496a 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -164,7 +164,7 @@ am__noinst_HEADERS_DIST = nc_logging.h nc_tests.h fbits.h nc.h \
nclist.h ncuri.h utf8proc.h ncdispatch.h ncdimscale.h \
netcdf_f.h err_macros.h ncbytes.h nchashmap.h ceconstraints.h \
rnd.h nclog.h ncconfigure.h nc4internal.h nctime.h \
- nc3dispatch.h nc3internal.h onstack.h ncaux.h
+ nc3dispatch.h nc3internal.h onstack.h nc_hashmap.h ncaux.h
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
@@ -232,6 +232,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -364,7 +365,7 @@ noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h nclist.h ncuri.h \
utf8proc.h ncdispatch.h ncdimscale.h netcdf_f.h err_macros.h \
ncbytes.h nchashmap.h ceconstraints.h rnd.h nclog.h \
ncconfigure.h nc4internal.h nctime.h nc3dispatch.h \
- nc3internal.h onstack.h $(am__append_3)
+ nc3internal.h onstack.h nc_hashmap.h $(am__append_3)
EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in
all: all-am
diff --git a/include/nc.h b/include/nc.h
index 4261eb8..5661733 100644
--- a/include/nc.h
+++ b/include/nc.h
@@ -27,7 +27,6 @@ typedef struct NC {
void* dispatchdata; /*per-'file' data; points to e.g. NC3_INFO data*/
char* path;
int mode; /* as provided to nc_open/nc_create */
- int substrate;
#ifdef USE_REFCOUNT
int refcount; /* To enable multiple name-based opens */
#endif
diff --git a/include/nc3internal.h b/include/nc3internal.h
index 73aa48b..7a8eb57 100644
--- a/include/nc3internal.h
+++ b/include/nc3internal.h
@@ -25,6 +25,8 @@
/* Always needed */
#include "nc.h"
+#include "nc_hashmap.h"
+
/*#ifndef HAVE_SSIZE_T
#define ssize_t int
#endif*/
@@ -66,7 +68,6 @@ typedef enum {
typedef struct {
/* all xdr'd */
NC_string *name;
- uint32_t hash;
size_t size;
} NC_dim;
@@ -75,6 +76,7 @@ typedef struct NC_dimarray {
/* below gets xdr'd */
/* NCtype type = NC_DIMENSION */
size_t nelems; /* length of the array */
+ NC_hashmap *hashmap;
NC_dim **value;
} NC_dimarray;
@@ -165,7 +167,6 @@ typedef struct NC_var {
off_t *dsizes; /* compiled info: the right to left product of shape */
/* below gets xdr'd */
NC_string *name;
- uint32_t hash;
/* next two: formerly NC_iarray *assoc */ /* user definition */
size_t ndims; /* assoc->count */
int *dimids; /* assoc->value */
@@ -180,14 +181,12 @@ typedef struct NC_vararray {
/* below gets xdr'd */
/* NCtype type = NC_VARIABLE */
size_t nelems; /* length of the array */
+ NC_hashmap *hashmap;
NC_var **value;
} NC_vararray;
/* Begin defined in lookup3.c */
-extern uint32_t
-hash_fast(const void *key, size_t length);
-
/* End defined in lookup3.c */
/* Begin defined in var.c */
diff --git a/include/nc4internal.h b/include/nc4internal.h
index 0726ea8..b5f1d12 100644
--- a/include/nc4internal.h
+++ b/include/nc4internal.h
@@ -70,7 +70,7 @@ typedef enum {VAR, DIM, ATT} NC_OBJ_T;
#define X_FLOAT_MAX 3.40282347e+38f
#endif /* WIN32 */
#define X_FLOAT_MIN (-X_FLOAT_MAX)
-#define X_DOUBLE_MAX 1.7976931348623157e+308
+#define X_DOUBLE_MAX 1.7976931348623157e+308
#define X_DOUBLE_MIN (-X_DOUBLE_MAX)
/* These have to do with creating chuncked datasets in HDF5. */
@@ -113,6 +113,7 @@ typedef struct NC_DIM_INFO
NC_LIST_NODE_T l; /* Use generic doubly-linked list (must be first) */
char *name;
size_t len;
+ uint32_t hash;
int dimid;
nc_bool_t unlimited; /* True if the dimension is unlimited */
nc_bool_t extended; /* True if the dimension needs to be extended */
@@ -148,6 +149,7 @@ typedef struct NC_VAR_INFO
NC_DIM_INFO_T **dim;
int varid;
int natts;
+ uint32_t hash;
nc_bool_t is_new_var; /* True if variable is newly created */
nc_bool_t was_coord_var; /* True if variable was a coordinate var, but either the dim or var has been renamed */
nc_bool_t became_coord_var; /* True if variable _became_ a coordinate var, because either the dim or var has been renamed */
@@ -315,12 +317,15 @@ typedef struct NC_HDF5_FILE_INFO
} NC_HDF5_FILE_INFO_T;
+/* Defined in lookup3.c */
+extern uint32_t hash_fast(const void *key, size_t length);
+
/* These functions convert between netcdf and HDF5 types. */
-int nc4_get_typelen_mem(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
+int nc4_get_typelen_mem(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
int is_long, size_t *len);
-int nc4_convert_type(const void *src, void *dest,
- const nc_type src_type, const nc_type dest_type,
- const size_t len, int *range_error,
+int nc4_convert_type(const void *src, void *dest,
+ const nc_type src_type, const nc_type dest_type,
+ const size_t len, int *range_error,
const void *fill_value, int strict_nc3, int src_long,
int dest_long);
@@ -328,9 +333,9 @@ int nc4_convert_type(const void *src, void *dest,
int rec_detach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int rec_reattach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int nc4_open_var_grp2(NC_GRP_INFO_T *grp, int varid, hid_t *dataset);
-int nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
+int nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, nc_type xtype, int is_long, void *op);
-int nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
+int nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, nc_type xtype, int is_long, void *op);
int nc4_rec_match_dimscales(NC_GRP_INFO_T *grp);
int nc4_rec_detect_need_to_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp);
@@ -342,7 +347,7 @@ int nc4_adjust_var_cache(NC_GRP_INFO_T *grp, NC_VAR_INFO_T * var);
/* The following functions manipulate the in-memory linked list of
metadata, without using HDF calls. */
-int nc4_find_nc_grp_h5(int ncid, NC **nc, NC_GRP_INFO_T **grp,
+int nc4_find_nc_grp_h5(int ncid, NC **nc, NC_GRP_INFO_T **grp,
NC_HDF5_FILE_INFO_T **h5);
int nc4_find_grp_h5(int ncid, NC_GRP_INFO_T **grp, NC_HDF5_FILE_INFO_T **h5);
int nc4_find_nc4_grp(int ncid, NC_GRP_INFO_T **grp);
@@ -359,11 +364,11 @@ NC_TYPE_INFO_T *nc4_rec_find_named_type(NC_GRP_INFO_T *start_grp, char *name);
NC_TYPE_INFO_T *nc4_rec_find_equal_type(NC_GRP_INFO_T *start_grp, int ncid1, NC_TYPE_INFO_T *type);
int nc4_find_nc_att(int ncid, int varid, const char *name, int attnum,
NC_ATT_INFO_T **att);
-int nc4_find_g_var_nc(NC *nc, int ncid, int varid,
+int nc4_find_g_var_nc(NC *nc, int ncid, int varid,
NC_GRP_INFO_T **grp, NC_VAR_INFO_T **var);
int nc4_find_grp_att(NC_GRP_INFO_T *grp, int varid, const char *name, int attnum,
NC_ATT_INFO_T **att);
-int nc4_get_hdf_typeid(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
+int nc4_get_hdf_typeid(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
hid_t *hdf_typeid, int endianness);
int nc4_get_typeclass(const NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
int *type_class);
@@ -381,11 +386,11 @@ int nc4_att_list_add(NC_ATT_INFO_T **list, NC_ATT_INFO_T **att);
int nc4_type_list_add(NC_GRP_INFO_T *grp, size_t size, const char *name,
NC_TYPE_INFO_T **type);
int nc4_field_list_add(NC_FIELD_INFO_T **list, int fieldid, const char *name,
- size_t offset, hid_t field_hdf_typeid, hid_t native_typeid,
+ size_t offset, hid_t field_hdf_typeid, hid_t native_typeid,
nc_type xtype, int ndims, const int *dim_sizesp);
void nc4_file_list_del(NC *nc);
int nc4_att_list_del(NC_ATT_INFO_T **list, NC_ATT_INFO_T *att);
-int nc4_grp_list_add(NC_GRP_INFO_T **list, int new_nc_grpid, NC_GRP_INFO_T *parent_grp,
+int nc4_grp_list_add(NC_GRP_INFO_T **list, int new_nc_grpid, NC_GRP_INFO_T *parent_grp,
NC *nc, char *name, NC_GRP_INFO_T **grp);
int nc4_rec_grp_del(NC_GRP_INFO_T **list, NC_GRP_INFO_T *grp);
int nc4_enum_member_add(NC_ENUM_MEMBER_INFO_T **list, size_t size,
@@ -401,6 +406,10 @@ int nc4_check_name(const char *name, char *norm_name);
int nc4_normalize_name(const char *name, char *norm_name);
int nc4_check_dup_name(NC_GRP_INFO_T *grp, char *norm_name);
+/* HDF5 initialization */
+static int nc4_hdf5_initialized;
+void nc4_hdf5_initialize(void);
+
/* This is only included if --enable-logging is used for configure; it
prints info about the metadata to stderr. */
#ifdef LOGGING
@@ -412,4 +421,3 @@ int log_metadata_nc(NC *nc);
#define NC4_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data))
#endif /* _NETCDF4_ */
-
diff --git a/include/nc_hashmap.h b/include/nc_hashmap.h
new file mode 100644
index 0000000..a5f7e69
--- /dev/null
+++ b/include/nc_hashmap.h
@@ -0,0 +1,39 @@
+#ifndef HASHMAP_H_INCLUDED
+#define HASHMAP_H_INCLUDED
+#include <stdlib.h>
+
+typedef struct NC_vararray NC_vararray;
+typedef struct NC_dimarray NC_dimarray;
+
+/** Hashmap structure (forward declaration) */
+struct s_hashmap;
+typedef struct s_hashmap NC_hashmap;
+
+/** Creates a new hashmap near the given size. */
+extern NC_hashmap* NC_hashmapCreate(unsigned long startsize);
+
+/** Inserts a new element into the hashmap. */
+extern void NC_hashmapAddDim(const NC_dimarray*, long data, const char *name);
+
+/** Removes the storage for the element of the key and returns the element. */
+extern long NC_hashmapRemoveDim(const NC_dimarray*, const char *name);
+
+/** Returns the element for the key. */
+extern long NC_hashmapGetDim(const NC_dimarray*, const char *name);
+
+/** Inserts a new element into the hashmap. */
+extern void NC_hashmapAddVar(const NC_vararray*, long data, const char *name);
+
+/** Removes the storage for the element of the key and returns the element. */
+extern long NC_hashmapRemoveVar(const NC_vararray*, const char *name);
+
+/** Returns the element for the key. */
+extern long NC_hashmapGetVar(const NC_vararray*, const char *name);
+
+/** Returns the number of saved elements. */
+extern unsigned long NC_hashmapCount(NC_hashmap*);
+
+/** Removes the hashmap structure. */
+extern void NC_hashmapDelete(NC_hashmap*);
+
+#endif
diff --git a/include/nc_tests.h b/include/nc_tests.h
index c923fae..b7a58c4 100644
--- a/include/nc_tests.h
+++ b/include/nc_tests.h
@@ -22,6 +22,9 @@ for conditions of use.
#include "netcdf.h"
#include "err_macros.h"
+
+#define NC_TESTS_MAX_DIMS 1024 /**< NC_MAX_DIMS for tests. Allows different NC_MAX_DIMS values without breaking this test with a heap or stack overflow. */
+
/** Useful define for tests. */
/** \{ */
#define MEGABYTE 1048576
diff --git a/include/ncdispatch.h b/include/ncdispatch.h
index 0cacd0f..2f292e0 100644
--- a/include/ncdispatch.h
+++ b/include/ncdispatch.h
@@ -115,10 +115,6 @@ typedef struct NC_Dispatch NC_Dispatch;
extern int NCDISPATCH_initialize(void);
extern int NCDISPATCH_finalize(void);
-extern NC_Dispatch* NCSUBSTRATE_dispatch_table;
-extern int NCSUBSTRATE_initialize(void);
-extern int NCSUBSTRATE_finalize(void);
-
extern NC_Dispatch* NC3_dispatch_table;
extern int NC3_initialize(void);
extern int NC3_finalize(void);
@@ -319,12 +315,12 @@ typedef struct NCcommon {
struct NC_Dispatch* dispatch;
void* dispatchdata; /* per-protocol instance data */
char* path; /* as specified at open or create */
- int substrate; /* ncid for another protocol on which to build */
} NCcommon;
extern size_t NC_atomictypelen(nc_type xtype);
extern char* NC_atomictypename(nc_type xtype);
+#ifdef OBSOLETE
/* Provide a dispatch table overlay facility */
extern int NC_dispatch_overlay(const NC_Dispatch* overlay,
const NC_Dispatch* base,
@@ -333,6 +329,7 @@ extern int NC_dispatch_overlay(const NC_Dispatch* overlay,
/* Get/set the override dispatch table */
extern NC_Dispatch* NC_get_dispatch_override(void);
extern void NC_set_dispatch_override(NC_Dispatch*);
+#endif
/* Does the path look like a url? */
extern int NC_testurl(const char* path);
@@ -372,6 +369,15 @@ extern int NC_inq_recvar(int ncid, int varid, int* nrecdims, int* is_recdim);
#define nullstring(s) (s==NULL?"(null)":s)
+
+#undef TRACECALLS
+#ifdef TRACECALLS
+#include <stdio.h>
+#define TRACE(fname) fprintf(stderr,"call: %s\n",#fname)
+#else
+#define TRACE(fname)
+#endif
+
extern size_t NC_coord_zero[NC_MAX_VAR_DIMS];
extern size_t NC_coord_one[NC_MAX_VAR_DIMS];
@@ -381,4 +387,22 @@ extern int NC_initialized;
NCD_EXTERNL int nc_initialize();
+
+/**
+Certain functions are in the dispatch table,
+but not in the netcdf.h API. These need to
+be exposed for use in delegation such as
+in libdap2.
+*/
+extern int
+NCDISPATCH_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
+ int *ndimsp, int *dimidsp, int *nattsp,
+ int *shufflep, int *deflatep, int *deflate_levelp,
+ int *fletcher32p, int *contiguousp, size_t *chunksizesp,
+ int *no_fill, void *fill_valuep, int *endiannessp,
+ int *options_maskp, int *pixels_per_blockp);
+
+extern int
+NCDISPATCH_get_att(int ncid, int varid, const char* name, void* value, nc_type t);
+
#endif /* _DISPATCH_H */
diff --git a/include/netcdf.h b/include/netcdf.h
index f298916..9748315 100644
--- a/include/netcdf.h
+++ b/include/netcdf.h
@@ -39,7 +39,7 @@ extern "C" {
#define NC_CHAR 2 /**< ISO/ASCII character */
#define NC_SHORT 3 /**< signed 2 byte integer */
#define NC_INT 4 /**< signed 4 byte integer */
-#define NC_LONG NC_INT /**< deprecated, but required for backward compatibility. */
+#define NC_LONG NC_INT /**< \deprecated required for backward compatibility. */
#define NC_FLOAT 5 /**< single precision floating point number */
#define NC_DOUBLE 6 /**< double precision floating point number */
#define NC_UBYTE 7 /**< unsigned 1 byte int */
diff --git a/include/netcdf_mem.h b/include/netcdf_mem.h
index 3959a98..12f6bfa 100644
--- a/include/netcdf_mem.h
+++ b/include/netcdf_mem.h
@@ -1,4 +1,7 @@
-/* \file netcdf_mem.h
+/*! \file netcdf_mem.h
+ *
+ * Main header file for in-memory (diskless) functionality.
+ *
* Copyright 2010 University Corporation for Atmospheric
* Research/Unidata. See COPYRIGHT file for more info.
*
@@ -27,53 +30,7 @@ extern "C" {
# define EXTERNL MSC_EXTRA extern
-/**
-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.
-
-\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.
-
-\param ncidp Pointer to location where returned netCDF ID is to be
-stored.
-
-\returns ::NC_NOERR No error.
-
-\returns ::NC_ENOMEM Out of memory.
-
-\returns ::NC_EDISKLESS diskless io is not enabled for fails.
-
-\returns ::NC_EINVAL, etc. other errors also returned by nc_open.
-
-<h1>Examples</h1>
-
-Here is an example using nc_open_mem() to open an existing netCDF dataset
-named foo.nc for read-only, non-shared access. It differs from the nc_open()
-example in that it assumes the contents of foo.nc have been read into memory.
-
- at 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);
- at endcode
-*/
-EXTERNL int
-nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp);
+EXTERNL int nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp);
#if defined(__cplusplus)
}
diff --git a/include/netcdf_meta.h.in b/include/netcdf_meta.h.in
index d93c958..3281cbf 100644
--- a/include/netcdf_meta.h.in
+++ b/include/netcdf_meta.h.in
@@ -47,6 +47,6 @@
#define NC_HAS_MMAP @NC_HAS_MMAP@ /*!< mmap support. */
#define NC_HAS_JNA @NC_HAS_JNA@ /*!< jna support. */
#define NC_HAS_PNETCDF @NC_HAS_PNETCDF@ /*!< pnetcdf support. */
-#define NC_HAS_PARALLEL @NC_HAS_PARALLEL@ /*!< parallel IO support via hdf5. */
+#define NC_HAS_PARALLEL @NC_HAS_PARALLEL@ /*!< parallel IO support via hdf5 and/or pnetcdf. */
#endif
diff --git a/include/netcdf_par.h b/include/netcdf_par.h
index 2b49dd2..aa5142c 100644
--- a/include/netcdf_par.h
+++ b/include/netcdf_par.h
@@ -1,9 +1,12 @@
-/*
+/*! \file
+ *
+ * Main header file for the Parallel C API.
+ *
* Copyright 2010 University Corporation for Atmospheric
* Research/Unidata. See COPYRIGHT file for more info.
*
* This header file is for the parallel I/O functions of netCDF.
- *
+ *
*/
/* "$Id: netcdf_par.h,v 1.1 2010/06/01 15:46:49 ed Exp $" */
@@ -36,10 +39,10 @@ extern int
nc_var_par_access(int ncid, int varid, int par_access);
extern int
-nc_create_par_fortran(const char *path, int cmode, int comm,
+nc_create_par_fortran(const char *path, int cmode, int comm,
int info, int *ncidp);
extern int
-nc_open_par_fortran(const char *path, int mode, int comm,
+nc_open_par_fortran(const char *path, int mode, int comm,
int info, int *ncidp);
#if defined(__cplusplus)
diff --git a/libdap2/Makefile.in b/libdap2/Makefile.in
index e487192..7205d18 100644
--- a/libdap2/Makefile.in
+++ b/libdap2/Makefile.in
@@ -258,6 +258,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/libdap2/dapcvt.c b/libdap2/dapcvt.c
index 394f30c..b67ff84 100644
--- a/libdap2/dapcvt.c
+++ b/libdap2/dapcvt.c
@@ -203,8 +203,9 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
char* dstmem = (char*)dst;
for(i=0;i<nvalues;i++) {
-
char* s = (char*)nclistget(src,i);
+ size_t slen = strlen(s);
+ int nread = 0; /* # of chars read by sscanf */
ok = 0;
switch (etype) {
@@ -213,60 +214,60 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
unsigned char* p = (unsigned char*)dstmem;
#ifdef _MSC_VER
- ok = sscanf(s,"%hC",p);
+ ok = sscanf(s,"%hC%n",p,&nread);
_ASSERTE(_CrtCheckMemory());
#else
- ok = sscanf(s,"%hhu",p);
+ ok = sscanf(s,"%hhu%n",p,&nread);
#endif
} break;
case NC_CHAR: {
signed char* p = (signed char*)dstmem;
- ok = sscanf(s,"%c",p);
+ ok = sscanf(s,"%c%n",p,&nread);
} break;
case NC_SHORT: {
short* p = (short*)dstmem;
- ok = sscanf(s,"%hd",p);
+ ok = sscanf(s,"%hd%n",p,&nread);
} break;
case NC_INT: {
int* p = (int*)dstmem;
- ok = sscanf(s,"%d",p);
+ ok = sscanf(s,"%d%n",p,&nread);
} break;
case NC_FLOAT: {
float* p = (float*)dstmem;
- ok = sscanf(s,"%g",p);
+ ok = sscanf(s,"%g%n",p,&nread);
} break;
case NC_DOUBLE: {
double* p = (double*)dstmem;
- ok = sscanf(s,"%lg",p);
+ ok = sscanf(s,"%lg%n",p,&nread);
} break;
case NC_UBYTE: {
unsigned char* p = (unsigned char*)dstmem;
#ifdef _MSC_VER
- ok = sscanf(s, "%hc", p);
+ ok = sscanf(s, "%hc%n", p,&nread);
_ASSERTE(_CrtCheckMemory());
#else
- ok = sscanf(s,"%hhu",p);
+ ok = sscanf(s,"%hhu%n",p,&nread);
#endif
} break;
case NC_USHORT: {
unsigned short* p = (unsigned short*)dstmem;
- ok = sscanf(s,"%hu",p);
+ ok = sscanf(s,"%hu%n",p,&nread);
} break;
case NC_UINT: {
unsigned int* p = (unsigned int*)dstmem;
- ok = sscanf(s,"%u",p);
+ ok = sscanf(s,"%u%n",p,&nread);
} break;
case NC_INT64: {
long long* p = (long long*)dstmem;
#ifdef _MSC_VER
- ok = sscanf(s, "%I64d", p);
+ ok = sscanf(s, "%I64d%n", p,&nread);
#else
- ok = sscanf(s,"%lld",p);
+ ok = sscanf(s,"%lld%n",p,&nread);
#endif
} break;
case NC_UINT64: {
unsigned long long* p = (unsigned long long*)dstmem;
- ok = sscanf(s,"%llu",p);
+ ok = sscanf(s,"%llu%n",p,&nread);
} break;
case NC_STRING: case NC_URL: {
char** p = (char**)dstmem;
@@ -276,7 +277,7 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
default:
PANIC1("unexpected nc_type: %d",(int)etype);
}
- if(ok != 1) {ncstat = NC_EINVAL; goto done;}
+ if(ok != 1 || nread != slen) {ncstat = NC_EINVAL; goto done;}
dstmem += memsize;
}
done:
diff --git a/libdap2/dapdebug.h b/libdap2/dapdebug.h
index 6fe4b05..b54306b 100644
--- a/libdap2/dapdebug.h
+++ b/libdap2/dapdebug.h
@@ -26,12 +26,12 @@
#endif
#undef PARSEDEBUG
+/* Warning: setting CATCHERROR has significant performance impact */
+#define CATCHERROR
#include <stdarg.h>
#include <assert.h>
-/* Warning: setting CATCHERROR has significant performance impact */
-#define CATCHERROR
#ifdef DAPDEBUG
#undef CATCHERROR
#define CATCHERROR
diff --git a/libdap2/env b/libdap2/env
index 97d8030..e4e59c3 100644
--- a/libdap2/env
+++ b/libdap2/env
@@ -1,12 +1,20 @@
-#TOP="/home/dmh/git/netcdf-c"
-TOP="/cygdrive/f/git/netcdf-c"
alias xx="cd ..;make; cd libdap2"
PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""; SHARP='#'
alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=;
-F="http://remotetest.unidata.ucar.edu/dts/test.01"
+F="https://eosdap.hdfgroup.org:8080/opendap/data/test/kent/ceres-converted/edition_4/CER_SSF1deg-Hour_Terra-MODIS_TestSuite_000000.200407D01.hdf"
+
+if test -e "/cygdrive/f/git/netcdf-c" ; then
+TOP="/cygdrive/f/git/netcdf-c"
+elif test -e "/cygdrive/d/git/netcdf-c" ; then
+TOP="/cygdrive/d/git/netcdf-c"
+elif test -e "/home/dmh/git/netcdf-c" ; then
+TOP="/home/dmh/git/netcdf-c"
+else
+echo "cannot locate ncdump"
+fi
if test -f ./ncd ; then
PROG=./ncd
diff --git a/libdap2/getvara.c b/libdap2/getvara.c
index 747dc02..508e579 100644
--- a/libdap2/getvara.c
+++ b/libdap2/getvara.c
@@ -126,7 +126,7 @@ nc3d_getvarx(int ncid, int varid,
if(ncstat != NC_NOERR) goto fail;
dapcomm = (NCDAPCOMMON*)drno->dispatchdata;
- ncstat = NC_check_id(drno->substrate, (NC**)&substrate);
+ ncstat = NC_check_id(getnc3id(drno), (NC**)&substrate);
if(ncstat != NC_NOERR) goto fail;
/* Locate var node via varid */
diff --git a/libdap2/nccommon.h b/libdap2/nccommon.h
index 6ef8f24..abb7b0f 100644
--- a/libdap2/nccommon.h
+++ b/libdap2/nccommon.h
@@ -162,6 +162,7 @@ typedef struct NCDAPCOMMON {
NCCDF cdf;
NCOC oc;
NCCONTROLS controls; /* Control flags and parameters */
+ int nc3id; /* nc3 file ncid used to hold metadata */
} NCDAPCOMMON;
/**************************************************/
@@ -339,5 +340,8 @@ extern int nc__opendap(void);
#define NCD2_DATA(nc) ((NCDAPCOMMON*)(nc)->dispatchdata)
#define NCD2_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data))
+#define getncid(drno) (((NC*)drno)->ext_ncid)
+#define getdap(drno) ((NCDAPCOMMON*)((NC*)drno)->dispatchdata)
+#define getnc3id(drno) (getdap(drno)->nc3id)
#endif /*NCCOMMON_H*/
diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c
index 66c7bc9..63414d0 100644
--- a/libdap2/ncd2dispatch.c
+++ b/libdap2/ncd2dispatch.c
@@ -22,8 +22,6 @@
# endif
#endif
-#define getncid(drno) (((NC*)drno)->ext_ncid)
-
/* Define the set of protocols known to be constrainable */
static char* constrainableprotocols[] = {"http", "https",NULL};
@@ -104,32 +102,32 @@ NCD2__enddef,
NCD2_sync,
NCD2_abort,
NCD2_close,
-NULL, /*set_fill*/
-NULL, /*inq_base_pe*/
-NULL, /*set_base_pe*/
-NULL, /*inq_format*/
+NCD2_set_fill,
+NCD2_inq_base_pe,
+NCD2_set_base_pe,
+NCD2_inq_format,
NCD2_inq_format_extended, /*inq_format_extended*/
-NULL, /*inq*/
-NULL, /*inq_type*/
-
-NULL, /*def_dim*/
-NULL, /*inq_dimid*/
-NULL, /*inq_dim*/
-NULL, /*inq_unlimdim*/
-NULL, /*rename_dim*/
-
-NULL, /*inq_att*/
-NULL, /*inq_attid*/
-NULL, /*inq_attname*/
-NULL, /*rename_att*/
-NULL, /*del_att*/
-NULL, /*get_att*/
-NULL, /*put_att*/
-
-NULL, /*def_var*/
-NULL, /*inq_varid*/
-NULL, /*rename_var*/
+NCD2_inq,
+NCD2_inq_type,
+
+NCD2_def_dim,
+NCD2_inq_dimid,
+NCD2_inq_dim,
+NCD2_inq_unlimdim,
+NCD2_rename_dim,
+
+NCD2_inq_att,
+NCD2_inq_attid,
+NCD2_inq_attname,
+NCD2_rename_att,
+NCD2_del_att,
+NCD2_get_att,
+NCD2_put_att,
+
+NCD2_def_var,
+NCD2_inq_varid,
+NCD2_rename_var,
NCD2_get_vara,
NCD2_put_vara,
NCD2_get_vars,
@@ -137,48 +135,48 @@ NCD2_put_vars,
NCDEFAULT_get_varm,
NCDEFAULT_put_varm,
-NULL, /*inq_var_all*/
+NCD2_inq_var_all,
-NULL, /*var_par_access*/
+NCD2_var_par_access,
#ifdef USE_NETCDF4
-NULL, /*show_metadata*/
-NULL, /*inq_unlimdims*/
-NULL, /*inq_ncid*/
-NULL, /*inq_grps*/
-NULL, /*inq_grpname*/
-NULL, /*inq_grpname_full*/
-NULL, /*inq_grp_parent*/
-NULL, /*inq_grp_full_ncid*/
-NULL, /*inq_varids*/
-NULL, /*inq_dimids*/
-NULL, /*inq_typeids*/
-NULL, /*inq_type_equal*/
-NULL, /*def_grp*/
-NULL, /*rename_grp*/
-NULL, /*inq_user_type*/
-NULL, /*inq_typeid*/
-
-NULL, /*def_compound*/
-NULL, /*insert_compound*/
-NULL, /*insert_array_compound*/
-NULL, /*inq_compound_field*/
-NULL, /*inq_compound_fieldindex*/
-NULL, /*def_vlen*/
-NULL, /*put_vlen_element*/
-NULL, /*get_vlen_element*/
-NULL, /*def_enum*/
-NULL, /*insert_enum*/
-NULL, /*inq_enum_member*/
-NULL, /*inq_enum_ident*/
-NULL, /*def_opaque*/
-NULL, /*def_var_deflate*/
-NULL, /*def_var_fletcher32*/
-NULL, /*def_var_chunking*/
-NULL, /*def_var_fill*/
-NULL, /*def_var_endian*/
-NULL, /*set_var_chunk_cache*/
-NULL, /*get_var_chunk_cache*/
+NCD2_show_metadata,
+NCD2_inq_unlimdims,
+NCD2_inq_ncid,
+NCD2_inq_grps,
+NCD2_inq_grpname,
+NCD2_inq_grpname_full,
+NCD2_inq_grp_parent,
+NCD2_inq_grp_full_ncid,
+NCD2_inq_varids,
+NCD2_inq_dimids,
+NCD2_inq_typeids,
+NCD2_inq_type_equal,
+NCD2_def_grp,
+NCD2_rename_grp,
+NCD2_inq_user_type,
+NCD2_inq_typeid,
+
+NCD2_def_compound,
+NCD2_insert_compound,
+NCD2_insert_array_compound,
+NCD2_inq_compound_field,
+NCD2_inq_compound_fieldindex,
+NCD2_def_vlen,
+NCD2_put_vlen_element,
+NCD2_get_vlen_element,
+NCD2_def_enum,
+NCD2_insert_enum,
+NCD2_inq_enum_member,
+NCD2_inq_enum_ident,
+NCD2_def_opaque,
+NCD2_def_var_deflate,
+NCD2_def_var_fletcher32,
+NCD2_def_var_chunking,
+NCD2_def_var_fill,
+NCD2_def_var_endian,
+NCD2_set_var_chunk_cache,
+NCD2_get_var_chunk_cache,
#endif /*USE_NETCDF4*/
@@ -186,16 +184,14 @@ NULL, /*get_var_chunk_cache*/
NC_Dispatch* NCD2_dispatch_table = NULL; /* moved here from ddispatch.c */
-static NC_Dispatch NCD2_dispatcher; /* overlay result */
+static NC_Dispatch NCD2_dispatcher;
int
NCD2_initialize(void)
{
int i;
- /* Create our dispatch table as the merge of NCD2 table and NCSUBSTRATE */
- /* watch the order because we want NCD2 to overwrite NCSUBSTRATE */
- NC_dispatch_overlay(&NCD2_dispatch_base, NCSUBSTRATE_dispatch_table, &NCD2_dispatcher);
- NCD2_dispatch_table = &NCD2_dispatcher;
+
+ NCD2_dispatch_table = &NCD2_dispatch_base;
/* Local Initialization */
compute_nccalignments();
for(i=0;i<NC_MAX_VAR_DIMS;i++) {
@@ -304,6 +300,7 @@ NCD2_open(const char * path, int mode,
OCerror ocstat = OC_NOERR;
NCDAPCOMMON* dapcomm = NULL;
const char* value;
+ int nc3id = -1;
if(path == NULL)
return NC_EDAPURL;
@@ -370,7 +367,7 @@ NCD2_open(const char * path, int mode,
}
}
- /* Use libsrc code for storing metadata */
+ /* Use libsrc code (netcdf-3) for storing metadata */
{
char tmpname[32];
@@ -380,12 +377,13 @@ NCD2_open(const char * path, int mode,
snprintf(tmpname,sizeof(tmpname),"%d",drno->int_ncid);
/* Now, use the file to create the netcdf file; force classic. */
- ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&drno->substrate);
+ ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&nc3id);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
- }
+ dapcomm->nc3id = nc3id;
+ /* Avoid fill */
+ nc_set_fill(nc3id,NC_NOFILL,NULL);
- /* Avoid fill */
- nc_set_fill(drno->substrate,NC_NOFILL,NULL);
+ }
dapcomm->oc.dapconstraint = (DCEconstraint*)dcecreate(CES_CONSTRAINT);
dapcomm->oc.dapconstraint->projections = nclistnew();
@@ -516,7 +514,7 @@ fprintf(stderr,"constrained dds: %s\n",dumptree(dapcomm->cdf.ddsroot));
if(ncstat) goto done;
/* Process the constraints to map to the constrained CDF tree */
- /* (must follow fixgrids3 */
+ /* (must follow fixgrids3) */
ncstat = dapmapconstraints(dapcomm->oc.dapconstraint,dapcomm->cdf.ddsroot);
if(ncstat != NC_NOERR) goto done;
@@ -558,31 +556,27 @@ fprintf(stderr,"ncdap3: final constraint: %s\n",dapcomm->oc.url->constraint);
about variables that are too large.
*/
#if 0
- ncstat = nc_endef(drno->substrate,NC_NOFILL,NULL);
+ ncstat = nc_endef(nc3id,NC_NOFILL,NULL);
if(ncstat != NC_NOERR && ncstat != NC_EVARSIZE)
{THROWCHK(ncstat); goto done;}
#endif
- {
- NC* ncsub;
- NC* drno = dapcomm->controller;
- CDFnode* unlimited = dapcomm->cdf.recorddim;
- /* (for now) break abstractions*/
- NC3_INFO* nc3i;
-
- /* get the id for the substrate */
- ncstat = NC_check_id(drno->substrate,&ncsub);
- if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
- nc3i = (NC3_INFO*)ncsub->dispatchdata;
-
- if(unlimited != NULL) {
- /* Set the effective size of UNLIMITED */
- NC_set_numrecs(nc3i,unlimited->dim.declsize);
- }
-
- /* Pretend the substrate is read-only */
- NC_set_readonly(nc3i);
-
+ { /* (for now) break abstractions*/
+ NC* ncsub;
+ NC3_INFO* nc3i;
+ CDFnode* unlimited = dapcomm->cdf.recorddim;
+ /* get the dispatch data for the substrate */
+ ncstat = NC_check_id(nc3id,&ncsub);
+ if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
+ nc3i = (NC3_INFO*)ncsub->dispatchdata;
+ /* This must be checked after all dds and data processing
+ so we can figure out the value of numrecs.
+ */
+ if(unlimited != NULL) { /* Set the effective size of UNLIMITED */
+ NC_set_numrecs(nc3i,unlimited->dim.declsize);
+ }
+ /* Pretend the substrate is read-only */
+ NC_set_readonly(nc3i);
}
/* Do any necessary data prefetch */
@@ -617,7 +611,7 @@ NCD2_close(int ncid)
/* We call abort rather than close to avoid
trying to write anything or try to pad file length
*/
- ncstatus = nc_abort(drno->substrate);
+ ncstatus = nc_abort(getnc3id(drno));
/* clean NC* */
freeNCDAPCOMMON(dapcomm);
@@ -634,9 +628,6 @@ buildncstructures(NCDAPCOMMON* dapcomm)
CDFnode* dds = dapcomm->cdf.ddsroot;
NC* ncsub;
- ncstat = NC_check_id(dapcomm->controller->substrate,&ncsub);
- if(ncstat != NC_NOERR) goto done;
-
ncstat = buildglobalattrs(dapcomm,dds);
if(ncstat != NC_NOERR) goto done;
@@ -685,7 +676,7 @@ builddims(NCDAPCOMMON* dapcomm)
if(dapcomm->cdf.recorddim != NULL) {
CDFnode* unlimited = dapcomm->cdf.recorddim;
definename = getdefinename(unlimited);
- ncstat = nc_def_dim(drno->substrate,
+ ncstat = nc_def_dim(dapcomm->nc3id,
definename,
NC_UNLIMITED,
&unlimited->ncid);
@@ -693,7 +684,7 @@ builddims(NCDAPCOMMON* dapcomm)
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
/* get the id for the substrate */
- ncstat = NC_check_id(drno->substrate,&ncsub);
+ ncstat = NC_check_id(dapcomm->nc3id,&ncsub);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
#if 0
nc3sub = (NC3_INFO*)&ncsub->dispatchdata;
@@ -712,7 +703,7 @@ builddims(NCDAPCOMMON* dapcomm)
fprintf(stderr,"define: dim: %s=%ld\n",dim->ncfullname,(long)dim->dim.declsize);
#endif
definename = getdefinename(dim);
- ncstat = nc_def_dim(drno->substrate,definename,dim->dim.declsize,&dimid);
+ ncstat = nc_def_dim(dapcomm->nc3id,definename,dim->dim.declsize,&dimid);
if(ncstat != NC_NOERR) {
THROWCHK(ncstat); nullfree(definename); goto done;
}
@@ -784,7 +775,7 @@ fprintf(stderr,"[%ld]",dim->dim.declsize);
}
fprintf(stderr,"\n");
#endif
- ncstat = nc_def_var(drno->substrate,
+ ncstat = nc_def_var(dapcomm->nc3id,
definename,
var->externaltype,
ncrank,
@@ -845,7 +836,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
}
}
if(ncbyteslength(buf) > 0) {
- ncstat = nc_put_att_text(drno->substrate,NC_GLOBAL,"_sequence_dimensions",
+ ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_sequence_dimensions",
ncbyteslength(buf),ncbytescontents(buf));
}
}
@@ -856,12 +847,12 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
if(dapparamcheck(dapcomm,"show","translate")) {
/* Add a global attribute to show the translation */
- ncstat = nc_put_att_text(drno->substrate,NC_GLOBAL,"_translate",
+ ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_translate",
strlen("netcdf-3"),"netcdf-3");
}
if(dapparamcheck(dapcomm,"show","url")) {
if(dapcomm->oc.rawurltext != NULL)
- ncstat = nc_put_att_text(drno->substrate,NC_GLOBAL,"_url",
+ ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_url",
strlen(dapcomm->oc.rawurltext),dapcomm->oc.rawurltext);
}
if(dapparamcheck(dapcomm,"show","dds")) {
@@ -872,7 +863,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
/* replace newlines with spaces*/
nltxt = nulldup(txt);
for(p=nltxt;*p;p++) {if(*p == '\n' || *p == '\r' || *p == '\t') {*p = ' ';}};
- ncstat = nc_put_att_text(drno->substrate,NC_GLOBAL,"_dds",strlen(nltxt),nltxt);
+ ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_dds",strlen(nltxt),nltxt);
nullfree(nltxt);
}
}
@@ -883,7 +874,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
if(txt != NULL) {
nltxt = nulldup(txt);
for(p=nltxt;*p;p++) {if(*p == '\n' || *p == '\r' || *p == '\t') {*p = ' ';}};
- ncstat = nc_put_att_text(drno->substrate,NC_GLOBAL,"_das",strlen(nltxt),nltxt);
+ ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_das",strlen(nltxt),nltxt);
nullfree(nltxt);
}
}
@@ -925,10 +916,11 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
}
dapexpandescapes(newstring);
if(newstring[0]=='\0')
- ncstat = nc_put_att_text(drno->substrate,varid,att->name,1,newstring);
+ ncstat = nc_put_att_text(dapcomm->nc3id,varid,att->name,1,newstring);
else
- ncstat = nc_put_att_text(drno->substrate,varid,att->name,strlen(newstring),newstring);
+ ncstat = nc_put_att_text(dapcomm->nc3id,varid,att->name,strlen(newstring),newstring);
free(newstring);
+ if(ncstat) goto done;
} else {
nc_type atype;
unsigned int typesize;
@@ -955,13 +947,14 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
#ifdef _MSC_VER
_ASSERTE(_CrtCheckMemory());
#endif
- ncstat = nc_put_att(drno->substrate,varid,att->name,atype,nvalues,mem);
+ if(ncstat) {nullfree(mem); goto done;}
+ ncstat = nc_put_att(dapcomm->nc3id,varid,att->name,atype,nvalues,mem);
#ifdef _MSC_VER
_ASSERTE(_CrtCheckMemory());
#endif
- if (mem != NULL)
- free(mem);
- }
+ if(ncstat) {nullfree(mem); goto done;}
+ }
+done:
return THROW(ncstat);
}
@@ -2197,3 +2190,595 @@ applyclientparamcontrols(NCDAPCOMMON* dapcomm)
nclog(NCLOGNOTE,"Caching=%d",FLAGSET(dapcomm->controls,NCF_CACHE));
}
+
+/*
+Force dap2 access to be read-only
+*/
+int
+NCD2_set_fill(int ncid, int fillmode, int* old_modep)
+{
+ return THROW(NC_EPERM);
+}
+
+int
+NCD2_set_base_pe(int ncid, int pe)
+{
+ return THROW(NC_EPERM);
+}
+
+int
+NCD2_def_dim(int ncid, const char* name, size_t len, int* idp)
+{
+ return THROW(NC_EPERM);
+}
+
+int
+NCD2_put_att(int ncid, int varid, const char* name, nc_type datatype,
+ size_t len, const void* value, nc_type t)
+{
+ return THROW(NC_EPERM);
+}
+
+int
+NCD2_def_var(int ncid, const char *name,
+ nc_type xtype, int ndims, const int *dimidsp, int *varidp)
+{
+ return THROW(NC_EPERM);
+}
+
+/*
+Following functions basically return the netcdf-3 value WRT to the nc3id.
+*/
+
+int
+NCD2_inq_base_pe(int ncid, int* pe)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_base_pe(getnc3id(drno), pe);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_format(int ncid, int* formatp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_format(getnc3id(drno), formatp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq(int ncid, int* ndimsp, int* nvarsp, int* nattsp, int* unlimdimidp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq(getnc3id(drno), ndimsp, nvarsp, nattsp, unlimdimidp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_type(int ncid, nc_type p2, char* p3, size_t* p4)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_type(getnc3id(drno), p2, p3, p4);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_dimid(int ncid, const char* name, int* idp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_dimid(getnc3id(drno), name, idp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_dim(int ncid, int dimid, char* name, size_t* lenp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_dim(getnc3id(drno), dimid, name, lenp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_unlimdim(int ncid, int* unlimdimidp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_unlimdim(getnc3id(drno), unlimdimidp);
+ return THROW(ret);
+}
+
+int
+NCD2_rename_dim(int ncid, int dimid, const char* name)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_rename_dim(getnc3id(drno), dimid, name);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_att(int ncid, int varid, const char* name,
+ nc_type* xtypep, size_t* lenp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_att(getnc3id(drno), varid, name, xtypep, lenp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_attid(int ncid, int varid, const char *name, int *idp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_attid(getnc3id(drno), varid, name, idp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_attname(int ncid, int varid, int attnum, char* name)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_attname(getnc3id(drno), varid, attnum, name);
+ return THROW(ret);
+}
+
+int
+NCD2_rename_att(int ncid, int varid, const char* name, const char* newname)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_rename_att(getnc3id(drno), varid, name, newname);
+ return THROW(ret);
+}
+
+int
+NCD2_del_att(int ncid, int varid, const char* p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_del_att(getnc3id(drno), varid, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_get_att(int ncid, int varid, const char* name, void* value, nc_type t)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = NCDISPATCH_get_att(getnc3id(drno), varid, name, value, t);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_var_all(int ncid, int varid, char *name, nc_type* xtypep,
+ int* ndimsp, int* dimidsp, int* nattsp,
+ int* shufflep, int* deflatep, int* deflate_levelp,
+ int* fletcher32p, int* contiguousp, size_t* chunksizesp,
+ int* no_fill, void* fill_valuep, int* endiannessp,
+ int* options_maskp, int* pixels_per_blockp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = NCDISPATCH_inq_var_all(getnc3id(drno), varid, name, xtypep,
+ ndimsp, dimidsp, nattsp,
+ shufflep, deflatep, deflate_levelp,
+ fletcher32p, contiguousp, chunksizesp,
+ no_fill, fill_valuep, endiannessp,
+ options_maskp, pixels_per_blockp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_varid(int ncid, const char *name, int *varidp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_varid(getnc3id(drno),name,varidp);
+ return THROW(ret);
+}
+
+int
+NCD2_rename_var(int ncid, int varid, const char* name)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_rename_var(getnc3id(drno), varid, name);
+ return THROW(ret);
+}
+
+int
+NCD2_var_par_access(int ncid, int p2, int p3)
+{
+ return THROW(NC_ENOPAR);
+}
+
+EXTERNL int
+NCD2_inq_ncid(int ncid, const char* name, int* grp_ncid)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_ncid(getnc3id(drno), name, grp_ncid);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_grps(int ncid, int* p2, int* p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_grps(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_grpname(int ncid, char* p)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_grpname(getnc3id(drno), p);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_grpname_full(int ncid, size_t* p2, char* p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_grpname_full(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_grp_parent(int ncid, int* p)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_grp_parent(getnc3id(drno), p);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_grp_full_ncid(int ncid, const char* p2, int* p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_grp_full_ncid(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_varids(int ncid, int* nvars, int* p)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_varids(getnc3id(drno), nvars, p);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_dimids(int ncid, int* ndims, int* p3, int p4)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_dimids(getnc3id(drno), ndims, p3, p4);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_typeids(int ncid, int* ntypes, int* p)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_typeids(getnc3id(drno), ntypes, p);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_type_equal(int ncid, nc_type t1, int p3, nc_type t2, int* p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_type_equal(getnc3id(drno), t1, p3, t2, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_user_type(int ncid, nc_type t, char* p3, size_t* p4, nc_type* p5,
+ size_t* p6, int* p7)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_user_type(getnc3id(drno), t, p3, p4, p5, p6, p7);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_typeid(int ncid, const char* name, nc_type* t)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_typeid(getnc3id(drno), name, t);
+ return THROW(ret);
+}
+
+int
+NCD2_def_grp(int ncid, const char* p2, int* p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_grp(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_rename_grp(int ncid, const char* p)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_rename_grp(getnc3id(drno), p);
+ return THROW(ret);
+}
+
+int
+NCD2_def_compound(int ncid, size_t p2, const char* p3, nc_type* t)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_compound(getnc3id(drno), p2, p3, t);
+ return THROW(ret);
+}
+
+int
+NCD2_insert_compound(int ncid, nc_type t1, const char* p3, size_t p4, nc_type t2)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_insert_compound(getnc3id(drno), t1, p3, p4, t2);
+ return THROW(ret);
+}
+
+int
+NCD2_insert_array_compound(int ncid, nc_type t1, const char* p3, size_t p4,
+ nc_type t2, int p6, const int* p7)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_insert_array_compound(getnc3id(drno), t1, p3, p4, t2, p6, p7);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name,
+ size_t *offsetp, nc_type* field_typeidp, int *ndimsp,
+ int *dim_sizesp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_compound_field(getnc3id(drno), xtype, fieldid, name, offsetp, field_typeidp, ndimsp, dim_sizesp);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_compound_fieldindex(int ncid, nc_type xtype, const char *name,
+ int *fieldidp)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_compound_fieldindex(getnc3id(drno), xtype, name, fieldidp);
+ return THROW(ret);
+}
+
+int
+NCD2_def_vlen(int ncid, const char* p2, nc_type base_typeid, nc_type* t)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_vlen(getnc3id(drno), p2, base_typeid, t);
+ return THROW(ret);
+}
+
+int
+NCD2_put_vlen_element(int ncid, int p2, void* p3, size_t p4, const void* p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_put_vlen_element(getnc3id(drno), p2, p3, p4, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_get_vlen_element(int ncid, int p2, const void* p3, size_t* p4, void* p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_get_vlen_element(getnc3id(drno), p2, p3, p4, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_def_enum(int ncid, nc_type t1, const char* p3, nc_type* t)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_enum(getnc3id(drno), t1, p3, t);
+ return THROW(ret);
+}
+
+int
+NCD2_insert_enum(int ncid, nc_type t1, const char* p3, const void* p4)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_insert_enum(getnc3id(drno), t1, p3, p4);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_enum_member(int ncid, nc_type t1, int p3, char* p4, void* p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_enum_member(getnc3id(drno), t1, p3, p4, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_enum_ident(int ncid, nc_type t1, long long p3, char* p4)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_enum_ident(getnc3id(drno), t1, p3, p4);
+ return THROW(ret);
+}
+
+int
+NCD2_def_opaque(int ncid, size_t p2, const char* p3, nc_type* t)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_opaque(getnc3id(drno), p2, p3, t);
+ return THROW(ret);
+}
+
+int
+NCD2_def_var_deflate(int ncid, int p2, int p3, int p4, int p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_var_deflate(getnc3id(drno), p2, p3, p4, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_def_var_fletcher32(int ncid, int p2, int p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_var_fletcher32(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_def_var_chunking(int ncid, int p2, int p3, const size_t* p4)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_var_chunking(getnc3id(drno), p2, p3, p4);
+ return THROW(ret);
+}
+
+int
+NCD2_def_var_fill(int ncid, int p2, int p3, const void* p4)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_var_fill(getnc3id(drno), p2, p3, p4);
+ return THROW(ret);
+}
+
+int
+NCD2_def_var_endian(int ncid, int p2, int p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_def_var_endian(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_set_var_chunk_cache(int ncid, int p2, size_t p3, size_t p4, float p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_set_var_chunk_cache(getnc3id(drno), p2, p3, p4, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_get_var_chunk_cache(int ncid, int p2, size_t* p3, size_t* p4, float* p5)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_get_var_chunk_cache(getnc3id(drno), p2, p3, p4, p5);
+ return THROW(ret);
+}
+
+int
+NCD2_inq_unlimdims(int ncid, int* p2, int* p3)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_inq_unlimdims(getnc3id(drno), p2, p3);
+ return THROW(ret);
+}
+
+int
+NCD2_show_metadata(int ncid)
+{
+ NC* drno;
+ int ret;
+ if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+ ret = nc_show_metadata(getnc3id(drno));
+ return THROW(ret);
+}
+
diff --git a/libdap2/ncd2dispatch.h b/libdap2/ncd2dispatch.h
index f4cd65d..9ba5723 100644
--- a/libdap2/ncd2dispatch.h
+++ b/libdap2/ncd2dispatch.h
@@ -54,9 +54,219 @@ NCD2_close(int ncid);
EXTERNL int
NCD2_inq_format_extended(int ncid, int* formatp, int* modep);
+EXTERNL int
+NCD2_set_fill(int ncid, int fillmode, int *old_modep);
+
+EXTERNL int
+NCD2_set_base_pe(int ncid, int pe);
+
+EXTERNL int
+NCD2_inq_base_pe(int ncid, int *pe);
+
+EXTERNL int
+NCD2_inq_format(int ncid, int *formatp);
+
+EXTERNL int
+NCD2_inq_format_extended(int ncid, int *formatp, int *modep);
+
+EXTERNL int
+NCD2_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp);
+
+EXTERNL int
+NCD2_inq_type(int, nc_type, char *, size_t *);
+
+/* Begin _dim */
+
+EXTERNL int
+NCD2_def_dim(int ncid, const char *name, size_t len, int *idp);
+
+EXTERNL int
+NCD2_inq_dimid(int ncid, const char *name, int *idp);
+
+EXTERNL int
+NCD2_inq_dim(int ncid, int dimid, char *name, size_t *lenp);
+
+EXTERNL int
+NCD2_inq_unlimdim(int ncid, int *unlimdimidp);
+
+EXTERNL int
+NCD2_rename_dim(int ncid, int dimid, const char *name);
+
+/* End _dim */
+/* Begin _att */
+
+EXTERNL int
+NCD2_inq_att(int ncid, int varid, const char *name,
+ nc_type *xtypep, size_t *lenp);
+
+EXTERNL int
+NCD2_inq_attid(int ncid, int varid, const char *name, int *idp);
+
+EXTERNL int
+NCD2_inq_attname(int ncid, int varid, int attnum, char *name);
+
+EXTERNL int
+NCD2_rename_att(int ncid, int varid, const char *name, const char *newname);
+
+EXTERNL int
+NCD2_del_att(int ncid, int varid, const char*);
+
+/* End _att */
+/* Begin {put,get}_att */
+
+EXTERNL int
+NCD2_get_att(int ncid, int varid, const char *name, void *value, nc_type);
+
+EXTERNL int
+NCD2_put_att(int ncid, int varid, const char *name, nc_type datatype,
+ size_t len, const void *value, nc_type);
+
+/* End {put,get}_att */
+/* Begin _var */
+
+EXTERNL int
+NCD2_def_var(int ncid, const char *name,
+ nc_type xtype, int ndims, const int *dimidsp, int *varidp);
+
+EXTERNL int
+NCD2_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
+ int *ndimsp, int *dimidsp, int *nattsp,
+ int *shufflep, int *deflatep, int *deflate_levelp,
+ int *fletcher32p, int *contiguousp, size_t *chunksizesp,
+ int *no_fill, void *fill_valuep, int *endiannessp,
+ int *options_maskp, int *pixels_per_blockp);
+
+EXTERNL int
+NC3_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
+ int *ndimsp, int *dimidsp, int *nattsp,
+ int *shufflep, int *deflatep, int *deflate_levelp,
+ int *fletcher32p, int *contiguousp, size_t *chunksizesp,
+ int *no_fill, void *fill_valuep, int *endiannessp,
+ int *options_maskp, int *pixels_per_blockp);
+
+EXTERNL int
+NCD2_inq_varid(int ncid, const char *name, int *varidp);
+
+EXTERNL int
+NCD2_rename_var(int ncid, int varid, const char *name);
/* End _var */
+/* netCDF4 API only */
+EXTERNL int
+NCD2_var_par_access(int, int, int);
+
+EXTERNL int
+NCD2_inq_ncid(int, const char *, int *);
+
+EXTERNL int
+NCD2_inq_grps(int, int *, int *);
+
+EXTERNL int
+NCD2_inq_grpname(int, char *);
+
+EXTERNL int
+NCD2_inq_grpname_full(int, size_t *, char *);
+
+EXTERNL int
+NCD2_inq_grp_parent(int, int *);
+
+EXTERNL int
+NCD2_inq_grp_full_ncid(int, const char *, int *);
+
+EXTERNL int
+NCD2_inq_varids(int, int * nvars, int *);
+
+EXTERNL int
+NCD2_inq_dimids(int, int * ndims, int *, int);
+
+EXTERNL int
+NCD2_inq_typeids(int, int * ntypes, int *);
+
+EXTERNL int
+NCD2_inq_type_equal(int, nc_type, int, nc_type, int *);
+
+EXTERNL int
+NCD2_def_grp(int, const char *, int *);
+
+EXTERNL int
+NCD2_rename_grp(int, const char *);
+
+EXTERNL int
+NCD2_inq_user_type(int, nc_type, char *, size_t *, nc_type *,
+ size_t *, int *);
+
+EXTERNL int
+NCD2_def_compound(int, size_t, const char *, nc_type *);
+
+EXTERNL int
+NCD2_insert_compound(int, nc_type, const char *, size_t, nc_type);
+
+EXTERNL int
+NCD2_insert_array_compound(int, nc_type, const char *, size_t,
+ nc_type, int, const int *);
+
+EXTERNL int
+NCD2_inq_typeid(int, const char *, nc_type *);
+
+EXTERNL int
+NCD2_inq_compound_field(int, nc_type, int, char *, size_t *,
+ nc_type *, int *, int *);
+
+EXTERNL int
+NCD2_inq_compound_fieldindex(int, nc_type, const char *, int *);
+
+EXTERNL int
+NCD2_def_vlen(int, const char *, nc_type base_typeid, nc_type *);
+
+EXTERNL int
+NCD2_put_vlen_element(int, int, void *, size_t, const void *);
+
+EXTERNL int
+NCD2_get_vlen_element(int, int, const void *, size_t *, void *);
+
+EXTERNL int
+NCD2_def_enum(int, nc_type, const char *, nc_type *);
+
+EXTERNL int
+NCD2_insert_enum(int, nc_type, const char *, const void *);
+
+EXTERNL int
+NCD2_inq_enum_member(int, nc_type, int, char *, void *);
+
+EXTERNL int
+NCD2_inq_enum_ident(int, nc_type, long long, char *);
+
+EXTERNL int
+NCD2_def_opaque(int, size_t, const char *, nc_type *);
+
+EXTERNL int
+NCD2_def_var_deflate(int, int, int, int, int);
+
+EXTERNL int
+NCD2_def_var_fletcher32(int, int, int);
+
+EXTERNL int
+NCD2_def_var_chunking(int, int, int, const size_t *);
+
+EXTERNL int
+NCD2_def_var_fill(int, int, int, const void *);
+
+EXTERNL int
+NCD2_def_var_endian(int, int, int);
+
+EXTERNL int
+NCD2_set_var_chunk_cache(int, int, size_t, size_t, float);
+
+EXTERNL int
+NCD2_get_var_chunk_cache(int, int, size_t *, size_t *, float *);
+
+EXTERNL int
+NCD2_inq_unlimdims(int, int *, int *);
+
+EXTERNL int
+NCD2_show_metadata(int);
+
extern int NCD2_initialize(void);
#if defined(__cplusplus)
diff --git a/libdispatch/CMakeLists.txt b/libdispatch/CMakeLists.txt
index c3f718c..05d96a3 100644
--- a/libdispatch/CMakeLists.txt
+++ b/libdispatch/CMakeLists.txt
@@ -1,4 +1,4 @@
-SET(libdispatch_SOURCES dparallel.c dcopy.c dfile.c ddim.c datt.c dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8proc.c ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c dsubstrate.c nc.c nclistmgr.c)
+SET(libdispatch_SOURCES dparallel.c dcopy.c dfile.c ddim.c datt.c dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8proc.c ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c dinternal.c nc.c nclistmgr.c)
IF(USE_NETCDF4)
SET(libdispatch_SOURCES ${libdispatch_SOURCES} dgroup.c dvlen.c dcompound.c dtype.c denum.c dopaque.c ncaux.c)
@@ -12,4 +12,4 @@ add_library(dispatch OBJECT ${libdispatch_SOURCES})
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
-ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
\ No newline at end of file
+ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/libdispatch/Makefile.am b/libdispatch/Makefile.am
index b3afd32..aab3d9e 100755
--- a/libdispatch/Makefile.am
+++ b/libdispatch/Makefile.am
@@ -17,10 +17,9 @@ libdispatch_la_CPPFLAGS = ${AM_CPPFLAGS}
# The source files.
libdispatch_la_SOURCES = dparallel.c dcopy.c dfile.c ddim.c datt.c \
dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c \
-dvarinq.c ddispatch.c \
+dvarinq.c dinternal.c ddispatch.c \
nclog.c dstring.c dutf8proc.c utf8proc_data.h \
ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c \
-dsubstrate.c \
nc.c nclistmgr.c
# Add functions only found in netCDF-4.
diff --git a/libdispatch/Makefile.in b/libdispatch/Makefile.in
index 6d28941..223c413 100644
--- a/libdispatch/Makefile.in
+++ b/libdispatch/Makefile.in
@@ -137,9 +137,9 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
libdispatch_la_LIBADD =
am__libdispatch_la_SOURCES_DIST = dparallel.c dcopy.c dfile.c ddim.c \
datt.c dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c \
- dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8proc.c \
- utf8proc_data.h ncuri.c nclist.c ncbytes.c nchashmap.c \
- nctime.c dsubstrate.c nc.c nclistmgr.c dgroup.c dvlen.c \
+ dvarput.c dvarinq.c dinternal.c ddispatch.c nclog.c dstring.c \
+ dutf8proc.c utf8proc_data.h ncuri.c nclist.c ncbytes.c \
+ nchashmap.c nctime.c nc.c nclistmgr.c dgroup.c dvlen.c \
dcompound.c dtype.c denum.c dopaque.c ncaux.c
@USE_NETCDF4_TRUE at am__objects_1 = libdispatch_la-dgroup.lo \
@USE_NETCDF4_TRUE@ libdispatch_la-dvlen.lo \
@@ -155,11 +155,11 @@ am_libdispatch_la_OBJECTS = libdispatch_la-dparallel.lo \
libdispatch_la-dattget.lo libdispatch_la-derror.lo \
libdispatch_la-dvar.lo libdispatch_la-dvarget.lo \
libdispatch_la-dvarput.lo libdispatch_la-dvarinq.lo \
- libdispatch_la-ddispatch.lo libdispatch_la-nclog.lo \
- libdispatch_la-dstring.lo libdispatch_la-dutf8proc.lo \
- libdispatch_la-ncuri.lo libdispatch_la-nclist.lo \
- libdispatch_la-ncbytes.lo libdispatch_la-nchashmap.lo \
- libdispatch_la-nctime.lo libdispatch_la-dsubstrate.lo \
+ libdispatch_la-dinternal.lo libdispatch_la-ddispatch.lo \
+ libdispatch_la-nclog.lo libdispatch_la-dstring.lo \
+ libdispatch_la-dutf8proc.lo libdispatch_la-ncuri.lo \
+ libdispatch_la-nclist.lo libdispatch_la-ncbytes.lo \
+ libdispatch_la-nchashmap.lo libdispatch_la-nctime.lo \
libdispatch_la-nc.lo libdispatch_la-nclistmgr.lo \
$(am__objects_1)
libdispatch_la_OBJECTS = $(am_libdispatch_la_OBJECTS)
@@ -281,6 +281,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -417,9 +418,9 @@ libdispatch_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_4)
# The source files.
libdispatch_la_SOURCES = dparallel.c dcopy.c dfile.c ddim.c datt.c \
dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c \
- dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8proc.c \
- utf8proc_data.h ncuri.c nclist.c ncbytes.c nchashmap.c \
- nctime.c dsubstrate.c nc.c nclistmgr.c $(am__append_3)
+ dvarput.c dvarinq.c dinternal.c ddispatch.c nclog.c dstring.c \
+ dutf8proc.c utf8proc_data.h ncuri.c nclist.c ncbytes.c \
+ nchashmap.c nctime.c nc.c nclistmgr.c $(am__append_3)
@BUILD_V2_TRUE at libnetcdf2_la_SOURCES = dv2i.c
@BUILD_V2_TRUE at libnetcdf2_la_CPPFLAGS = ${AM_CPPFLAGS} -DDLL_EXPORT
EXTRA_DIST = CMakeLists.txt ncsettings.hdr
@@ -493,10 +494,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-derror.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dfile.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dgroup.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dinternal.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dopaque.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dparallel.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dstring.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dsubstrate.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dtype.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dutf8proc.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvar.Plo at am__quote@
@@ -630,6 +631,13 @@ libdispatch_la-dvarinq.lo: dvarinq.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) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdispatch_la-dvarinq.lo `test -f 'dvarinq.c' || echo '$(srcdir)/'`dvarinq.c
+libdispatch_la-dinternal.lo: dinternal.c
+ at am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdispatch_la-dinternal.lo -MD -MP -MF $(DEPDIR)/libdispatch_la-dinternal.Tpo -c -o libdispatch_la-dinternal.lo `test -f 'dinternal.c' || echo '$(srcdir)/'`dinternal.c
+ at am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdispatch_la-dinternal.Tpo $(DEPDIR)/libdispatch_la-dinternal.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dinternal.c' object='libdispatch_la-dinternal.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) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdispatch_la-dinternal.lo `test -f 'dinternal.c' || echo '$(srcdir)/'`dinternal.c
+
libdispatch_la-ddispatch.lo: ddispatch.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdispatch_la-ddispatch.lo -MD -MP -MF $(DEPDIR)/libdispatch_la-ddispatch.Tpo -c -o libdispatch_la-ddispatch.lo `test -f 'ddispatch.c' || echo '$(srcdir)/'`ddispatch.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdispatch_la-ddispatch.Tpo $(DEPDIR)/libdispatch_la-ddispatch.Plo
@@ -693,13 +701,6 @@ libdispatch_la-nctime.lo: nctime.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) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdispatch_la-nctime.lo `test -f 'nctime.c' || echo '$(srcdir)/'`nctime.c
-libdispatch_la-dsubstrate.lo: dsubstrate.c
- at am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdispatch_la-dsubstrate.lo -MD -MP -MF $(DEPDIR)/libdispatch_la-dsubstrate.Tpo -c -o libdispatch_la-dsubstrate.lo `test -f 'dsubstrate.c' || echo '$(srcdir)/'`dsubstrate.c
- at am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdispatch_la-dsubstrate.Tpo $(DEPDIR)/libdispatch_la-dsubstrate.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsubstrate.c' object='libdispatch_la-dsubstrate.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) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdispatch_la-dsubstrate.lo `test -f 'dsubstrate.c' || echo '$(srcdir)/'`dsubstrate.c
-
libdispatch_la-nc.lo: nc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdispatch_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdispatch_la-nc.lo -MD -MP -MF $(DEPDIR)/libdispatch_la-nc.Tpo -c -o libdispatch_la-nc.lo `test -f 'nc.c' || echo '$(srcdir)/'`nc.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdispatch_la-nc.Tpo $(DEPDIR)/libdispatch_la-nc.Plo
diff --git a/libdispatch/datt.c b/libdispatch/datt.c
index cfdc501..efd615c 100644
--- a/libdispatch/datt.c
+++ b/libdispatch/datt.c
@@ -109,6 +109,7 @@ nc_rename_att(int ncid, int varid, const char *name, const char *newname)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_rename_att);
return ncp->dispatch->rename_att(ncid, varid, name, newname);
}
@@ -159,6 +160,7 @@ nc_del_att(int ncid, int varid, const char *name)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_del_att);
return ncp->dispatch->del_att(ncid, varid, name);
}
/*! \} */ /* End of named group ...*/
diff --git a/libdispatch/dattget.c b/libdispatch/dattget.c
index a6967e2..2fbc11f 100644
--- a/libdispatch/dattget.c
+++ b/libdispatch/dattget.c
@@ -54,6 +54,7 @@ nc_get_att(int ncid, int varid, const char *name, void *value)
if ((stat = nc_inq_atttype(ncid, varid, name, &xtype)))
return stat;
+ TRACE(nc_get_att);
return ncp->dispatch->get_att(ncid, varid, name, value, xtype);
}
/*! \} */
@@ -138,6 +139,7 @@ nc_get_att_text(int ncid, int varid, const char *name, char *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_text);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_CHAR);
}
@@ -147,6 +149,7 @@ nc_get_att_schar(int ncid, int varid, const char *name, signed char *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_schar);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_BYTE);
}
@@ -156,6 +159,7 @@ nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_uchar);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
}
@@ -165,6 +169,7 @@ nc_get_att_short(int ncid, int varid, const char *name, short *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_short);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_SHORT);
}
@@ -174,6 +179,7 @@ nc_get_att_int(int ncid, int varid, const char *name, int *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_int);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT);
}
@@ -183,6 +189,7 @@ nc_get_att_long(int ncid, int varid, const char *name, long *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_long);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, longtype);
}
@@ -192,6 +199,7 @@ nc_get_att_float(int ncid, int varid, const char *name, float *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_float);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_FLOAT);
}
@@ -201,6 +209,7 @@ nc_get_att_double(int ncid, int varid, const char *name, double *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_double);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_DOUBLE);
}
@@ -210,6 +219,7 @@ nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_ubyte);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
}
@@ -219,6 +229,7 @@ nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_ushort);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_USHORT);
}
@@ -228,6 +239,7 @@ nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_uint);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT);
}
@@ -237,6 +249,7 @@ nc_get_att_longlong(int ncid, int varid, const char *name, long long *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_longlong);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT64);
}
@@ -246,6 +259,7 @@ nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *
NC *ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_ulonglong);
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT64);
}
/*! \} */
@@ -325,11 +339,11 @@ int main(int argc, char ** argv) {
int
nc_get_att_string(int ncid, int varid, const char *name, char **value)
-
{
NC *ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_get_att_string);
return ncp->dispatch->get_att(ncid,varid,name,(void*)value, NC_STRING);
}
/*! \} */
diff --git a/libdispatch/ddim.c b/libdispatch/ddim.c
index b66e876..9b0b500 100644
--- a/libdispatch/ddim.c
+++ b/libdispatch/ddim.c
@@ -120,11 +120,13 @@ named foo.nc:
\endcode
*/
-int nc_def_dim(int ncid, const char *name, size_t len, int *idp)
+int
+nc_def_dim(int ncid, const char *name, size_t len, int *idp)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_def_dim);
return ncp->dispatch->def_dim(ncid, name, len, idp);
}
@@ -154,6 +156,7 @@ nc_inq_dimid(int ncid, const char *name, int *idp)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_dimid);
return ncp->dispatch->inq_dimid(ncid,name,idp);
}
@@ -217,6 +220,7 @@ nc_inq_dim(int ncid, int dimid, char *name, size_t *lenp)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_dim);
return ncp->dispatch->inq_dim(ncid,dimid,name,lenp);
}
@@ -278,6 +282,7 @@ nc_rename_dim(int ncid, int dimid, const char *name)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_rename_dim);
return ncp->dispatch->rename_dim(ncid,dimid,name);
}
@@ -309,6 +314,7 @@ nc_inq_ndims(int ncid, int *ndimsp)
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
if(ndimsp == NULL) return NC_NOERR;
+ TRACE(nc_inq_ndims);
return ncp->dispatch->inq(ncid,ndimsp,NULL,NULL,NULL);
}
@@ -338,6 +344,7 @@ nc_inq_unlimdim(int ncid, int *unlimdimidp)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_unlimdim);
return ncp->dispatch->inq_unlimdim(ncid,unlimdimidp);
}
@@ -397,6 +404,7 @@ nc_inq_dimname(int ncid, int dimid, char *name)
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
if(name == NULL) return NC_NOERR;
+ TRACE(nc_inq_dimname);
return ncp->dispatch->inq_dim(ncid,dimid,name,NULL);
}
@@ -453,6 +461,7 @@ nc_inq_dimlen(int ncid, int dimid, size_t *lenp)
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
if(lenp == NULL) return NC_NOERR;
+ TRACE(nc_inq_dimlen);
return ncp->dispatch->inq_dim(ncid,dimid,NULL,lenp);
}
diff --git a/libdispatch/ddispatch.c b/libdispatch/ddispatch.c
index 320576c..3383ee8 100644
--- a/libdispatch/ddispatch.c
+++ b/libdispatch/ddispatch.c
@@ -3,9 +3,6 @@
#define MAXSERVERURL 4096
-extern int NCSUBSTRATE_initialize(void);
-extern int NCSUBSTRATE_finalize(void);
-
/* Define vectors of zeros and ones for use with various nc_get_varX function*/
size_t nc_sizevector0[NC_MAX_VAR_DIMS];
size_t nc_sizevector1[NC_MAX_VAR_DIMS];
@@ -156,6 +153,7 @@ NC_urlmodel(const char* path)
return model;
}
+#ifdef OBSOLETE
/* Override dispatch table management */
static NC_Dispatch* NC_dispatch_override = NULL;
@@ -169,8 +167,10 @@ void NC_set_dispatch_override(NC_Dispatch* d)
{
NC_dispatch_override = d;
}
+#endif
-/* Overlay by treating the tables as arrays of void*.
+/* OBSOLETE
+ Overlay by treating the tables as arrays of void*.
Overlay rules are:
overlay base merge
------- ---- -----
@@ -180,6 +180,7 @@ void NC_set_dispatch_override(NC_Dispatch* d)
x y x
*/
+#ifdef OBSOLETE
int
NC_dispatch_overlay(const NC_Dispatch* overlay, const NC_Dispatch* base, NC_Dispatch* merge)
{
@@ -199,3 +200,4 @@ NC_dispatch_overlay(const NC_Dispatch* overlay, const NC_Dispatch* base, NC_Disp
merge->model = overlay->model;
return NC_NOERR;
}
+#endif
diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c
index b4e2804..5e17787 100644
--- a/libdispatch/dfile.c
+++ b/libdispatch/dfile.c
@@ -1,4 +1,5 @@
-/** \file
+/** \file dfile.c
+
File create and open functions
These functions end up calling functions in one of the dispatch layers
@@ -27,7 +28,8 @@ Research/Unidata. See COPYRIGHT file for more info.
extern int NC_initialized;
extern int NC_finalized;
-/** \defgroup datasets NetCDF Files
+
+/** \defgroup datasets NetCDF File and Data I/O
NetCDF opens datasets as files or remote access URLs.
@@ -62,8 +64,23 @@ any.
interfaces, the rest of this chapter presents a detailed description
of the interfaces for these operations.
*/
-/**@{*/
+
+/*!
+ Interpret the magic number found in the header of a netCDF file.
+
+ This function interprets the magic number/string contained in the header of a netCDF file and sets the appropriate NC_FORMATX flags.
+
+ @param[in] magic Pointer to a character array with the magic number block.
+ @param[out] model Pointer to an integer to hold the corresponding netCDF type.
+ @param[out] version Pointer to an integer to hold the corresponding netCDF version.
+ @param[in] use_parallel 1 if using parallel, 0 if not.
+ @return Returns an error code or 0 on success.
+
+\internal
+\ingroup datasets
+
+*/
static int
NC_interpret_magic_number(char* magic, int* model, int* version, int use_parallel)
{
@@ -100,13 +117,12 @@ done:
return status;
}
-/**
+/*!
Given an existing file, figure out its format
and return that format value (NC_FORMATX_XXX)
in model arg.
*/
-static int
-NC_check_file_type(const char *path, int flags, void *parameters,
+static int NC_check_file_type(const char *path, int flags, void *parameters,
int* model, int* version)
{
char magic[MAGIC_NUMBER_LEN];
@@ -163,6 +179,23 @@ NC_check_file_type(const char *path, int flags, void *parameters,
/* The file must be at least MAGIC_NUMBER_LEN in size,
or otherwise the following fread will exhibit unexpected
behavior. */
+
+ /* Windows and fstat have some issues, this will work around that. */
+#ifdef HAVE_FILE_LENGTH_I64
+ __int64 file_len = 0;
+ if((file_len = _filelengthi64(fileno(fp))) < 0) {
+ fclose(fp);
+ status = errno;
+ goto done;
+ }
+
+ if(file_len < MAGIC_NUMBER_LEN) {
+ fclose(fp);
+ status = NC_ENOTNC;
+ goto done;
+ }
+#else
+
if(!(fstat(fileno(fp),&st) == 0)) {
fclose(fp);
status = errno;
@@ -170,10 +203,12 @@ NC_check_file_type(const char *path, int flags, void *parameters,
}
if(st.st_size < MAGIC_NUMBER_LEN) {
- fclose(fp);
- status = NC_ENOTNC;
- goto done;
+ fclose(fp);
+ status = NC_ENOTNC;
+ goto done;
}
+#endif //HAVE_FILE_LENGTH_I64
+
#endif
i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
@@ -465,6 +500,9 @@ and initial size for the file.
status = nc__create("foo.nc", NC_NOCLOBBER, initialsz, bufrsize, &ncid);
if (status != NC_NOERR) handle_error(status);
\endcode
+
+\ingroup datasets
+
*/
int
nc__create(const char *path, int cmode, size_t initialsz,
@@ -490,7 +528,7 @@ nc__create_mp(const char *path, int cmode, size_t initialsz,
chunksizehintp, 0, NULL, ncidp);
}
-/**
+/** \ingroup datasets
Open an existing netCDF file.
This function opens an existing netCDF dataset for access. It
@@ -610,7 +648,7 @@ nc_open(const char *path, int mode, int *ncidp)
return NC_open(path, mode, 0, NULL, 0, NULL, ncidp);
}
-/**
+/** \ingroup datasets
Open a netCDF file with extra performance parameters for the classic
library.
@@ -673,7 +711,7 @@ nc__open(const char *path, int mode,
NULL, ncidp);
}
-/**
+/** \ingroup datasets
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.
@@ -754,7 +792,7 @@ nc__open_mp(const char *path, int mode, int basepe,
0, NULL, ncidp);
}
-/**
+/** \ingroup datasets
Get the file pathname (or the opendap URL) which was used to
open/create the ncid's file.
@@ -788,7 +826,7 @@ nc_inq_path(int ncid, size_t *pathlen, char *path)
return stat;
}
-/**
+/** \ingroup datasets
Put open netcdf dataset into define mode
The function nc_redef puts an open netCDF dataset into define mode, so
@@ -845,7 +883,7 @@ nc_redef(int ncid)
return ncp->dispatch->redef(ncid);
}
-/**
+/** \ingroup datasets
Leave define mode
The function nc_enddef() takes an open netCDF dataset out of define
@@ -910,7 +948,7 @@ nc_enddef(int ncid)
return ncp->dispatch->_enddef(ncid,0,1,0,1);
}
-/**
+/** \ingroup datasets
Leave define mode with performance tuning
The function nc__enddef takes an open netCDF dataset out of define
@@ -1001,7 +1039,7 @@ nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree,
return ncp->dispatch->_enddef(ncid,h_minfree,v_align,v_minfree,r_align);
}
-/**
+/** \ingroup datasets
Synchronize an open netcdf dataset to disk
The function nc_sync() offers a way to synchronize the disk copy of a
@@ -1077,10 +1115,11 @@ nc_sync(int ncid)
return ncp->dispatch->sync(ncid);
}
-/**
-\internal
+/** \ingroup datasets
+No longer necessary for user to invoke manually.
-Users no longer need to call this function, since it is called
+
+\warning Users no longer need to call this function since it is called
automatically by nc_close() in case the dataset is in define mode and
something goes wrong with committing the changes. The function
nc_abort() just closes the netCDF dataset, if not in define mode. If
@@ -1138,7 +1177,7 @@ nc_abort(int ncid)
return stat;
}
-/**
+/** \ingroup datasets
Close an open netCDF dataset
If the dataset in define mode, nc_enddef() will be called before
@@ -1190,7 +1229,8 @@ nc_close(int ncid)
if(ncp->refcount <= 0)
#endif
{
- stat = ncp->dispatch->close(ncid);
+
+ stat = ncp->dispatch->close(ncid);
/* Remove from the nc list */
del_from_NCList(ncp);
free_NC(ncp);
@@ -1198,7 +1238,7 @@ nc_close(int ncid)
return stat;
}
-/**
+/** \ingroup datasets
Change the fill-value mode to improve write performance.
This function is intended for advanced usage, to optimize writes under
@@ -1345,7 +1385,7 @@ nc_set_base_pe(int ncid, int pe)
return ncp->dispatch->set_base_pe(ncid,pe);
}
-/**
+/** \ingroup datasets
Inquire about the binary format of a netCDF file
as presented by the API.
@@ -1372,9 +1412,10 @@ nc_inq_format(int ncid, int *formatp)
return ncp->dispatch->inq_format(ncid,formatp);
}
-/**
+/** \ingroup datasets
Obtain more detailed (vis-a-vis nc_inq_format)
format information about an open dataset.
+
Note that the netcdf API will present the file
as if it had the format specified by nc_inq_format.
The true file format, however, may not even be
@@ -1406,7 +1447,7 @@ nc_inq_format_extended(int ncid, int *formatp, int *modep)
return ncp->dispatch->inq_format_extended(ncid,formatp,modep);
}
-/**
+/**\ingroup datasets
Inquire about a file or group.
\param ncid NetCDF or group ID, from a previous call to nc_open(),
@@ -1468,7 +1509,7 @@ nc_inq_nvars(int ncid, int *nvarsp)
return ncp->dispatch->inq(ncid, NULL, nvarsp, NULL, NULL);
}
-/**
+/**\ingroup datasets
Inquire about a type.
Given an ncid and a typeid, get the information about a type. This
@@ -1546,7 +1587,7 @@ nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
if(stat != NC_NOERR) { /* bad ncid; do what we can */
/* For compatibility, we need to allow inq about
atomic types, even if ncid is ill-defined */
- if(xtype <= ATOMICTYPEMAX3) {
+ if(xtype <= ATOMICTYPEMAX5) {
if(name) strncpy(name,NC_atomictypename(xtype),NC_MAX_NAME);
if(size) *size = NC_atomictypelen(xtype);
return NC_NOERR;
@@ -1569,7 +1610,6 @@ nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
}
#endif
}
-/**@}*/
/**
\internal
@@ -1618,6 +1658,7 @@ NC_create(const char *path, int cmode, size_t initialsz,
int isurl = 0; /* dap or cdmremote or neither */
int xcmode = 0; /* for implied cmode flags */
+ TRACE(nc_create);
/* Initialize the dispatch table. The function pointers in the
* dispatch table will depend on how netCDF was built
* (with/without netCDF-4, DAP, CDMREMOTE). */
@@ -1693,7 +1734,10 @@ NC_create(const char *path, int cmode, size_t initialsz,
if((cmode & NC_MPIIO) && (cmode & NC_MPIPOSIX))
return NC_EINVAL;
- if (!(dispatcher = NC_get_dispatch_override()))
+#ifdef OBSOLETE
+ dispatcher = NC_get_dispatch_override();
+#endif
+ if (dispatcher == NULL)
{
/* Figure out what dispatcher to use */
@@ -1767,6 +1811,7 @@ NC_open(const char *path, int cmode,
int version = 0;
int flags = 0;
+ TRACE(nc_open);
if(!NC_initialized) {
stat = nc_initialize();
if(stat) return stat;
@@ -1837,7 +1882,9 @@ NC_open(const char *path, int cmode,
return NC_EINVAL;
/* override any other table choice */
+#ifdef OBSOLETE
dispatcher = NC_get_dispatch_override();
+#endif
if(dispatcher != NULL) goto havetable;
/* Figure out what dispatcher to use */
diff --git a/libdispatch/dinternal.c b/libdispatch/dinternal.c
new file mode 100644
index 0000000..5451a4b
--- /dev/null
+++ b/libdispatch/dinternal.c
@@ -0,0 +1,48 @@
+/*! \internal
+Public functions from dispatch table.
+
+Copyright 2010 University Corporation for Atmospheric
+Research/Unidata. See COPYRIGHT file for more info.
+*/
+
+#include "ncdispatch.h"
+
+/**
+Certain functions are in the dispatch table,
+but not in the netcdf.h API. These need to
+be exposed for use in delegation such as
+in libdap2.
+*/
+
+int
+NCDISPATCH_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
+ int *ndimsp, int *dimidsp, int *nattsp,
+ int *shufflep, int *deflatep, int *deflate_levelp,
+ int *fletcher32p, int *contiguousp, size_t *chunksizesp,
+ int *no_fill, void *fill_valuep, int *endiannessp,
+ int *options_maskp, int *pixels_per_blockp)
+{
+ NC* ncp;
+ int stat = NC_check_id(ncid,&ncp);
+ if(stat != NC_NOERR) return stat;
+ return ncp->dispatch->inq_var_all(
+ ncid, varid, name, xtypep,
+ ndimsp, dimidsp, nattsp,
+ shufflep, deflatep, deflate_levelp, fletcher32p,
+ contiguousp, chunksizesp,
+ no_fill, fill_valuep,
+ endiannessp,
+ options_maskp,
+ pixels_per_blockp);
+}
+
+int
+NCDISPATCH_get_att(int ncid, int varid, const char* name, void* value, nc_type t)
+{
+ NC* ncp;
+ int stat = NC_check_id(ncid,&ncp);
+ if(stat != NC_NOERR) return stat;
+ return ncp->dispatch->get_att(ncid,varid,name,value,t);
+}
+
+/*! \} */ /* End of named group ...*/
diff --git a/libdispatch/dparallel.c b/libdispatch/dparallel.c
index ab99eb6..652053b 100644
--- a/libdispatch/dparallel.c
+++ b/libdispatch/dparallel.c
@@ -1,5 +1,5 @@
-/** \file
-This file has the parallel I/O functions.
+/** \file dparallel.c
+This file has the parallel I/O functions which correspond to the serial I/O functions.
Copyright 2010 University Corporation for Atmospheric
Research/Unidata. See COPYRIGHT file for more info.
@@ -8,16 +8,19 @@ Research/Unidata. See COPYRIGHT file for more info.
#include "config.h"
#include "ncdispatch.h"
-/* This function creates a file for use with parallel I/O. */
-int
-nc_create_par(const char *path, int cmode, MPI_Comm comm,
+/**
+
+ This function creates a file for use with parallel I/O.
+
+*/
+int nc_create_par(const char *path, int cmode, MPI_Comm comm,
MPI_Info info, int *ncidp)
{
#ifndef USE_PARALLEL
return NC_ENOPAR;
-#else
+#else
NC_MPI_INFO data;
-
+
/* One of these two parallel IO modes must be chosen by the user,
* or else pnetcdf must be in use. */
if (!(cmode & NC_MPIIO || cmode & NC_MPIPOSIX) &&
@@ -30,9 +33,13 @@ nc_create_par(const char *path, int cmode, MPI_Comm comm,
#endif /* USE_PARALLEL */
}
-/* This function opens a file for parallel I/O. */
+/*! \ingroup datasets
+
+ This function opens a file for parallel I/O.
+
+*/
int
-nc_open_par(const char *path, int mode, MPI_Comm comm,
+nc_open_par(const char *path, int mode, MPI_Comm comm,
MPI_Info info, int *ncidp)
{
#ifndef USE_PARALLEL
@@ -56,9 +63,13 @@ nc_open_par(const char *path, int mode, MPI_Comm comm,
#endif /* USE_PARALLEL */
}
-/* Fortran needs to pass MPI comm/info as integers. */
+/*! \ingroup datasets
+
+ Fortran needs to pass MPI comm/info as integers.
+
+*/
int
-nc_open_par_fortran(const char *path, int mode, int comm,
+nc_open_par_fortran(const char *path, int mode, int comm,
int info, int *ncidp)
{
#ifndef USE_PARALLEL
@@ -87,7 +98,7 @@ int
nc_var_par_access(int ncid, int varid, int par_access)
{
NC* ncp;
-
+
int stat = NC_NOERR;
if ((stat = NC_check_id(ncid, &ncp)))
@@ -102,7 +113,7 @@ nc_var_par_access(int ncid, int varid, int par_access)
/* when calling from fortran: convert MPI_Comm and MPI_Info to C */
int
-nc_create_par_fortran(const char *path, int cmode, int comm,
+nc_create_par_fortran(const char *path, int cmode, int comm,
int info, int *ncidp)
{
#ifndef USE_PARALLEL
@@ -124,6 +135,3 @@ nc_create_par_fortran(const char *path, int cmode, int comm,
return nc_create_par(path, cmode, comm_c, info_c, ncidp);
#endif
}
-
-
-
diff --git a/libdispatch/dsubstrate.c b/libdispatch/dsubstrate.c
deleted file mode 100644
index b1c0348..0000000
--- a/libdispatch/dsubstrate.c
+++ /dev/null
@@ -1,941 +0,0 @@
-/** \substrate
-Define the substrate dispatch table and functions
-
-The idea of a substrate is that for some dispatch
-tables, it is convenient to delegate many of its functions
-of some other dispatch table, called the substrate.
-For example, the libdap2 code needs to create
-metadata. Rather than duplicate the code in libsrc,
-it is convenient to create a temporary
-netcdf-3 "file" (using in-memory data storage)
-and delegate the creation and inquiries about
-the metadata to that substrate netcdf-3 object.
-
-So, these functions end up calling functions in another
-dispatch table using the substrate field of struct NC.
-
-Copyright 2010 University Corporation for Atmospheric
-Research/Unidata. See COPYRIGHT file for more info.
-*/
-
-#include "netcdf.h"
-#include "ncdispatch.h"
-
-/* forward */
-static NC_Dispatch NCSUBSTRATE_dispatch_base;
-
-/*
-Note that because many of the signatures differ
-from the netcdf API, we need to break
-the abstraction and invoke the
-substrate dispatch table directly.
-*/
-
-int
-NCSUBSTRATE_initialize(void)
-{
- NCSUBSTRATE_dispatch_table = &NCSUBSTRATE_dispatch_base;
- return NC_NOERR;
-}
-
-int
-NCSUBSTRATE_finalize(void)
-{
- return NC_NOERR;
-}
-
-static int
-NCSUB_redef(int ncid)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate,&ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->redef(nc->substrate);
-}
-
-static int
-NCSUB__enddef(int ncid, size_t a1, size_t a2, size_t a3, size_t a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->_enddef(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_sync(int ncid)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->sync(nc->substrate);
-}
-
-static int
-NCSUB_abort(int ncid)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->abort(nc->substrate);
-}
-
-static int
-NCSUB_close(int ncid)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->close(nc->substrate);
-}
-
-static int
-NCSUB_set_fill(int ncid, int a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->set_fill(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_base_pe(int ncid, int* a1)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_base_pe(nc->substrate,a1);
-}
-
-static int
-NCSUB_set_base_pe(int ncid, int a1)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->set_base_pe(nc->substrate,a1);
-}
-
-static int
-NCSUB_inq_format(int ncid, int* a1)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_format(nc->substrate,a1);
-}
-
-static int
-NCSUB_inq_format_extended(int ncid, int* a1, int *a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_format_extended(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq(int ncid, int* a1, int* a2, int* a3, int* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_inq_type(int ncid, nc_type a1, char* a2, size_t* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_type(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_def_dim(int ncid, const char* a1, size_t a2, int* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_dim(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_inq_dimid(int ncid, const char* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_dimid(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_dim(int ncid, int a1, char* a2, size_t* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_dim(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_inq_unlimdim(int ncid, int* a1)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_unlimdim(nc->substrate,a1);
-}
-
-static int
-NCSUB_rename_dim(int ncid, int a1, const char* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_dim(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_att(int ncid, int a1, const char* a2, nc_type* a3, size_t* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_att(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_inq_attid(int ncid, int a1, const char* a2, int* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_attid(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_inq_attname(int ncid, int a1, int a2, char* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_attname(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_rename_att(int ncid, int a1, const char* a2, const char* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_att(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_del_att(int ncid, int a1, const char* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->del_att(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_get_att(int ncid, int a1, const char* a2, void* a3, nc_type a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_att(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_put_att(int ncid, int a1, const char* a2, nc_type a3, size_t a4, const void* a5, nc_type a6)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_att(nc->substrate,a1,a2,a3,a4,a5,a6);
-}
-
-static int
-NCSUB_def_var(int ncid, const char* a1, nc_type a2, int a3, const int* a4, int* a5)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var(nc->substrate,a1,a2,a3,a4,a5);
-}
-
-static int
-NCSUB_inq_varid(int ncid, const char* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_varid(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_rename_var(int ncid, int a1, const char* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_var(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_get_vara(int ncid, int a1, const size_t* a2, const size_t* a3, void* a4, nc_type a5)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_vara(nc->substrate,a1,a2,a3,a4,a5);
-}
-
-static int
-NCSUB_put_vara(int ncid, int a1, const size_t* a2, const size_t* a3, const void* a4, nc_type a5)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_vara(nc->substrate,a1,a2,a3,a4,a5);
-}
-
-/* Added to solve Ferret performance problem with Opendap */
-static int
-NCSUB_get_vars(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, void* a5, nc_type a6)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_vars(nc->substrate,a1,a2,a3,a4,a5,a6);
-}
-
-static int
-NCSUB_put_vars(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, const void* a5, nc_type a6)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_vars(nc->substrate,a1,a2,a3,a4,a5,a6);
-}
-
-static int
-NCSUB_get_varm(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, const ptrdiff_t* a5, void* a6, nc_type a7)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_varm(nc->substrate,a1,a2,a3,a4,a5,a6,a7);
-}
-
-static int
-NCSUB_put_varm(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, const ptrdiff_t* a5, const void* a6, nc_type a7)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_varm(nc->substrate,a1,a2,a3,a4,a5,a6,a7);
-}
-
-
-static int
-NCSUB_inq_var_all(int ncid, int varid, char* name, nc_type* xtypep,
- int* ndimsp, int* dimidsp, int* nattsp,
- int* shufflep, int* deflatep, int* deflate_levelp,
- int* fletcher32p, int* contiguousp, size_t* chunksizesp,
- int* no_fill, void* fill_valuep, int* endiannessp,
- int* options_maskp, int* pixels_per_blockp)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_var_all(nc->substrate,varid,name,xtypep,
- ndimsp,dimidsp,nattsp,shufflep,
- deflatep,deflate_levelp,fletcher32p,
- contiguousp,chunksizesp,
- no_fill,fill_valuep,
- endiannessp,
- options_maskp,pixels_per_blockp);
-}
-
-static int
-NCSUB_var_par_access(int ncid, int a1, int a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->var_par_access(nc->substrate,a1,a2);
-}
-
-#ifdef USE_NETCDF4
-
-static int
-NCSUB_show_metadata(int ncid)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->show_metadata(nc->substrate);
-}
-
-static int
-NCSUB_inq_unlimdims(int ncid, int* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_unlimdims(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_ncid(int ncid, const char* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_ncid(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_grps(int ncid, int* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grps(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_grpname(int ncid, char* a1)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grpname(nc->substrate,a1);
-}
-
-static int
-NCSUB_inq_grpname_full(int ncid, size_t* a1, char* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grpname_full(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_grp_parent(int ncid, int* a1)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grp_parent(nc->substrate,a1);
-}
-
-static int
-NCSUB_inq_grp_full_ncid(int ncid, const char* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grp_full_ncid(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_varids(int ncid, int* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_varids(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_dimids(int ncid, int* a1, int* a2, int a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_dimids(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_inq_typeids(int ncid, int* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_typeids(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_inq_type_equal(int ncid, nc_type a1, int a2, nc_type a3, int* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_type_equal(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_def_grp(int ncid, const char* a1, int* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_grp(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_rename_grp(int ncid, const char* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_grp(nc->substrate,a2);
-}
-
-static int
-NCSUB_inq_user_type(int ncid, nc_type a1, char* a2, size_t* a3, nc_type* a4, size_t* a5, int* a6)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_user_type(nc->substrate,a1,a2,a3,a4,a5,a6);
-}
-
-static int
-NCSUB_inq_typeid(int ncid, const char* a1, nc_type* a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_typeid(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_def_compound(int ncid, size_t a1, const char* a2, nc_type* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_compound(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_insert_compound(int ncid, nc_type a1, const char* a2, size_t a3, nc_type a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->insert_compound(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_insert_array_compound(int ncid, nc_type a1, const char* a2, size_t a3, nc_type a4, int a5, const int* a6)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->insert_array_compound(nc->substrate,a1,a2,a3,a4,a5,a6);
-}
-
-static int
-NCSUB_inq_compound_field(int ncid, nc_type a1, int a2, char* a3, size_t* a4, nc_type* a5, int* a6, int* a7)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_compound_field(nc->substrate,a1,a2,a3,a4,a5,a6,a7);
-}
-
-static int
-NCSUB_inq_compound_fieldindex(int ncid, nc_type a1, const char* a2, int* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_compound_fieldindex(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_def_vlen(int ncid, const char* a1, nc_type a2, nc_type* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_vlen(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_put_vlen_element(int ncid, int a1, void* a2, size_t a3, const void* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_vlen_element(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_get_vlen_element(int ncid, int a1, const void* a2, size_t* a3, void* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_vlen_element(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_def_enum(int ncid, nc_type a1, const char* a2, nc_type* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_enum(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_insert_enum(int ncid, nc_type a1, const char* a2, const void* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->insert_enum(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_inq_enum_member(int ncid, nc_type a1, int a2, char* a3, void* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_enum_member(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_inq_enum_ident(int ncid, nc_type a1, long long a2, char* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_enum_ident(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_def_opaque(int ncid, size_t a1, const char* a2, nc_type* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_opaque(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_def_var_deflate(int ncid, int a1, int a2, int a3, int a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_deflate(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_def_var_fletcher32(int ncid, int a1, int a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_fletcher32(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_def_var_chunking(int ncid, int a1, int a2, const size_t* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_chunking(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_def_var_fill(int ncid, int a1, int a2, const void* a3)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_fill(nc->substrate,a1,a2,a3);
-}
-
-static int
-NCSUB_def_var_endian(int ncid, int a1, int a2)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_endian(nc->substrate,a1,a2);
-}
-
-static int
-NCSUB_set_var_chunk_cache(int ncid, int a1, size_t a2, size_t a3, float a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->set_var_chunk_cache(nc->substrate,a1,a2,a3,a4);
-}
-
-static int
-NCSUB_get_var_chunk_cache(int ncid, int a1, size_t* a2, size_t* a3, float* a4)
-{
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_var_chunk_cache(nc->substrate,a1,a2,a3,a4);
-}
-
-#endif /*USE_NETCDF4*/
-
-/* Declare here to avoid having a bunch of static forward declarations */
-
-static NC_Dispatch NCSUBSTRATE_dispatch_base = {
-
-0,
-
-NULL, /*NC_create*/
-NULL, /*NC_open*/
-
-NCSUB_redef,
-NCSUB__enddef,
-NCSUB_sync,
-NCSUB_abort,
-NCSUB_close,
-NCSUB_set_fill,
-NCSUB_inq_base_pe,
-NCSUB_set_base_pe,
-NCSUB_inq_format,
-NCSUB_inq_format_extended,
-
-NCSUB_inq,
-NCSUB_inq_type,
-
-NCSUB_def_dim,
-NCSUB_inq_dimid,
-NCSUB_inq_dim,
-NCSUB_inq_unlimdim,
-NCSUB_rename_dim,
-
-NCSUB_inq_att,
-NCSUB_inq_attid,
-NCSUB_inq_attname,
-NCSUB_rename_att,
-NCSUB_del_att,
-NCSUB_get_att,
-NCSUB_put_att,
-
-NCSUB_def_var,
-NCSUB_inq_varid,
-NCSUB_rename_var,
-
-NCSUB_get_vara,
-NCSUB_put_vara,
-NCSUB_get_vars,
-NCSUB_put_vars,
-NCSUB_get_varm,
-NCSUB_put_varm,
-
-NCSUB_inq_var_all,
-
-NCSUB_var_par_access,
-
-#ifdef USE_NETCDF4
-NCSUB_show_metadata,
-NCSUB_inq_unlimdims,
-
-NCSUB_inq_ncid,
-NCSUB_inq_grps,
-NCSUB_inq_grpname,
-NCSUB_inq_grpname_full,
-NCSUB_inq_grp_parent,
-NCSUB_inq_grp_full_ncid,
-NCSUB_inq_varids,
-NCSUB_inq_dimids,
-NCSUB_inq_typeids,
-NCSUB_inq_type_equal,
-NCSUB_def_grp,
-NCSUB_rename_grp,
-NCSUB_inq_user_type,
-NCSUB_inq_typeid,
-
-NCSUB_def_compound,
-NCSUB_insert_compound,
-NCSUB_insert_array_compound,
-NCSUB_inq_compound_field,
-NCSUB_inq_compound_fieldindex,
-NCSUB_def_vlen,
-NCSUB_put_vlen_element,
-NCSUB_get_vlen_element,
-NCSUB_def_enum,
-NCSUB_insert_enum,
-NCSUB_inq_enum_member,
-NCSUB_inq_enum_ident,
-NCSUB_def_opaque,
-NCSUB_def_var_deflate,
-NCSUB_def_var_fletcher32,
-NCSUB_def_var_chunking,
-NCSUB_def_var_fill,
-NCSUB_def_var_endian,
-NCSUB_set_var_chunk_cache,
-NCSUB_get_var_chunk_cache
-
-#endif /*USE_NETCDF4*/
-
-};
-
-NC_Dispatch* NCSUBSTRATE_dispatch_table = NULL; /*Moved here from ddispatch.c*/
diff --git a/libdispatch/dvar.c b/libdispatch/dvar.c
index a273a03..507dc90 100644
--- a/libdispatch/dvar.c
+++ b/libdispatch/dvar.c
@@ -212,6 +212,7 @@ nc_def_var(int ncid, const char *name, nc_type xtype,
if ((stat = NC_check_id(ncid, &ncp)))
return stat;
+ TRACE(nc_def_var);
return ncp->dispatch->def_var(ncid, name, xtype, ndims,
dimidsp, varidp);
}
@@ -282,6 +283,7 @@ nc_rename_var(int ncid, int varid, const char *name)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_rename_var);
return ncp->dispatch->rename_var(ncid, varid, name);
}
/*! \} */
diff --git a/libdispatch/dvarget.c b/libdispatch/dvarget.c
index 8b940c8..6db4149 100644
--- a/libdispatch/dvarget.c
+++ b/libdispatch/dvarget.c
@@ -11,9 +11,10 @@ Research/Unidata. See \ref copyright file for more info.
#undef VARS_USES_VARM
#ifndef VARS_USES_VARM
-/*! \internal
+/*!
+ \internal
- */
+*/
struct GETodometer {
int rank;
size_t index[NC_MAX_VAR_DIMS];
diff --git a/libdispatch/dvarinq.c b/libdispatch/dvarinq.c
index 781d8a4..f125a0b 100644
--- a/libdispatch/dvarinq.c
+++ b/libdispatch/dvarinq.c
@@ -119,6 +119,7 @@ nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep,
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var);
return ncp->dispatch->inq_var_all(ncid, varid, name, xtypep, ndimsp,
dimidsp, nattsp, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
@@ -276,6 +277,7 @@ nc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep,
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var_deflate);
return ncp->dispatch->inq_var_all(
ncid, varid,
NULL, /*name*/
@@ -330,6 +332,7 @@ nc_inq_var_szip(int ncid, int varid, int *options_maskp, int *pixels_per_blockp)
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var_szip);
return ncp->dispatch->inq_var_all(
ncid, varid,
NULL, /*name*/
@@ -377,6 +380,7 @@ nc_inq_var_fletcher32(int ncid, int varid, int *fletcher32p)
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var_fletcher32);
return ncp->dispatch->inq_var_all(
ncid, varid,
NULL, /*name*/
@@ -426,6 +430,7 @@ nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp)
NC *ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var_chunking);
return ncp->dispatch->inq_var_all(ncid, varid, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, storagep,
chunksizesp, NULL, NULL, NULL, NULL, NULL);
@@ -460,6 +465,7 @@ nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep)
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var_fill);
return ncp->dispatch->inq_var_all(
ncid, varid,
NULL, /*name*/
@@ -508,6 +514,7 @@ nc_inq_var_endian(int ncid, int varid, int *endianp)
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_var_endian);
return ncp->dispatch->inq_var_all(
ncid, varid,
NULL, /*name*/
@@ -557,9 +564,41 @@ nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
+ TRACE(nc_inq_unlimdims);
return ncp->dispatch->inq_unlimdims(ncid, nunlimdimsp,
unlimdimidsp);
}
#endif /* USE_NETCDF4 */
+
+/**
+\internal
+\ingroup variables
+
+Expose access to nc_inq_var_all().
+Used in libdap2 and libdap4.
+
+*/
+int
+NC_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
+ int *ndimsp, int *dimidsp, int *nattsp,
+ int *shufflep, int *deflatep, int *deflate_levelp,
+ int *fletcher32p, int *contiguousp, size_t *chunksizesp,
+ int *no_fill, void *fill_valuep, int *endiannessp,
+ int *options_maskp, int *pixels_per_blockp)
+{
+ NC* ncp;
+ int stat = NC_check_id(ncid,&ncp);
+ if(stat != NC_NOERR) return stat;
+ return ncp->dispatch->inq_var_all(
+ ncid, varid, name, xtypep,
+ ndimsp, dimidsp, nattsp,
+ shufflep, deflatep, deflate_levelp, fletcher32p,
+ contiguousp, chunksizesp,
+ no_fill, fill_valuep,
+ endiannessp,
+ options_maskp,
+ pixels_per_blockp);
+}
+
/*! \} */ /* End of named group ...*/
diff --git a/libdispatch/dvarput.c b/libdispatch/dvarput.c
index f8341ac..59e071b 100644
--- a/libdispatch/dvarput.c
+++ b/libdispatch/dvarput.c
@@ -1,4 +1,4 @@
-/*!
+/*! \file dvarput.c
Functions for writing data to variables.
Copyright 2010 University Corporation for Atmospheric
@@ -33,7 +33,7 @@ odom_init(struct PUTodometer* odom,
odom->stride[i] = (stride != NULL ? stride[i] : 1);
odom->stop[i] = odom->start[i] + (odom->edges[i]*(size_t)odom->stride[i]);
odom->index[i] = odom->start[i];
- }
+ }
}
static int
@@ -61,7 +61,7 @@ odom_next(struct PUTodometer* odom)
\ingroup variables
*/
static int
-NC_put_vara(int ncid, int varid, const size_t *start,
+NC_put_vara(int ncid, int varid, const size_t *start,
const size_t *edges, const void *value, nc_type memtype)
{
NC* ncp;
@@ -70,7 +70,7 @@ NC_put_vara(int ncid, int varid, const size_t *start,
if(edges == NULL) {
size_t shape[NC_MAX_VAR_DIMS];
int ndims;
- stat = nc_inq_varndims(ncid, varid, &ndims);
+ stat = nc_inq_varndims(ncid, varid, &ndims);
if(stat != NC_NOERR) return stat;
stat = NC_getshape(ncid, varid, ndims, shape);
if(stat != NC_NOERR) return stat;
@@ -98,7 +98,7 @@ NC_put_var(int ncid, int varid, const void *value, nc_type memtype)
\ingroup variables
*/
static int
-NC_put_var1(int ncid, int varid, const size_t *coord, const void* value,
+NC_put_var1(int ncid, int varid, const size_t *coord, const void* value,
nc_type memtype)
{
return NC_put_vara(ncid, varid, coord, NC_coord_one, value, memtype);
@@ -120,7 +120,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
return ncp->dispatch->put_varm(ncid,varid,start,edges,stride,NULL,value0,memtype);
#else
/* Rebuilt put_vars code to simplify and avoid use of put_varm */
-
+
int status = NC_NOERR;
int i,isstride1,isrecvar;
int rank;
@@ -142,7 +142,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
status = NC_check_id (ncid, &ncp);
if(status != NC_NOERR) return status;
- status = nc_inq_vartype(ncid, varid, &vartype);
+ status = nc_inq_vartype(ncid, varid, &vartype);
if(status != NC_NOERR) return status;
if(memtype == NC_NAT) memtype = vartype;
@@ -168,7 +168,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
}
/* Get the variable rank */
- status = nc_inq_varndims(ncid, varid, &rank);
+ status = nc_inq_varndims(ncid, varid, &rank);
if(status != NC_NOERR) return status;
/* Get variable dimension sizes */
@@ -178,7 +178,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
status = NC_inq_recvar(ncid,varid,&nrecdims,is_recdim);
if(status != NC_NOERR) return status;
isrecvar = (nrecdims > 0);
- NC_getshape(ncid,varid,rank,varshape);
+ NC_getshape(ncid,varid,rank,varshape);
/* Optimize out using various checks */
if (rank == 0) {
@@ -215,7 +215,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
/* cast needed for braindead systems with signed size_t */
|| ((unsigned long) mystride[i] >= X_INT_MAX))
return NC_ESTRIDE;
- if(mystride[i] != 1) isstride1 = 0;
+ if(mystride[i] != 1) isstride1 = 0;
/* illegal value checks */
#if 0
dimlen = (i == 0 && isrecvar ? numrecs : varshape[i]);
@@ -228,7 +228,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
/* mystart is unsigned, will never be < 0 */
if(mystart[i] > dimlen)
return NC_EINVALCOORDS;
- /* myediges is unsigned, will never be < 0 */
+ /* myediges is unsigned, will never be < 0 */
if(mystart[i] + myedges[i] > dimlen)
return NC_EEDGE;
}
@@ -295,13 +295,13 @@ NCDEFAULT_put_varm(
*/
/* mid body */
- status = nc_inq_vartype(ncid, varid, &vartype);
+ status = nc_inq_vartype(ncid, varid, &vartype);
if(status != NC_NOERR) return status;
/* Check that this is an atomic type */
if(vartype > NC_MAX_ATOMIC_TYPE)
return NC_EMAPTYPE;
- status = nc_inq_varndims(ncid, varid, &varndims);
+ status = nc_inq_varndims(ncid, varid, &varndims);
if(status != NC_NOERR) return status;
if(memtype == NC_NAT) {
@@ -310,7 +310,7 @@ NCDEFAULT_put_varm(
if(memtype == NC_CHAR && vartype != NC_CHAR)
return NC_ECHAR;
- else if(memtype != NC_CHAR && vartype == NC_CHAR)
+ else if(memtype != NC_CHAR && vartype == NC_CHAR)
return NC_ECHAR;
memtypelen = nctypelen(memtype);
@@ -371,7 +371,7 @@ NCDEFAULT_put_varm(
/* Compute some dimension related values */
isrecvar = NC_is_recvar(ncid,varid,&numrecs);
- NC_getshape(ncid,varid,varndims,varshape);
+ NC_getshape(ncid,varid,varndims,varshape);
/* assert(sizeof(ptrdiff_t) >= sizeof(size_t)); */
mystart = (size_t *)calloc((size_t)(varndims * 7), sizeof(ptrdiff_t));
@@ -436,7 +436,7 @@ NCDEFAULT_put_varm(
/* Lower body */
/*
- * As an optimization, adjust I/O parameters when the fastest
+ * As an optimization, adjust I/O parameters when the fastest
* dimension has unity stride both externally and internally.
* In this case, the user could have called a simpler routine
* (i.e. ncvar$1()
@@ -460,7 +460,7 @@ NCDEFAULT_put_varm(
if (lstatus != NC_NOERR) {
if(status == NC_NOERR || lstatus != NC_ERANGE)
status = lstatus;
- }
+ }
/*
* The following code permutes through the variable s
@@ -510,7 +510,7 @@ NC_put_vars(int ncid, int varid, const size_t *start,
\ingroup variables
*/
static int
-NC_put_varm(int ncid, int varid, const size_t *start,
+NC_put_varm(int ncid, int varid, const size_t *start,
const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map,
const void *value, nc_type memtype)
{
@@ -530,7 +530,7 @@ Functions to write data from variables. */
/*! \{ */ /* All these functions are part of this named group... */
/** \ingroup variables
-Write an array of values to a variable.
+Write an array of values to a variable.
The values to be written are associated with the netCDF variable by
assuming that the last dimension of the netCDF variable varies fastest
@@ -546,7 +546,7 @@ user defined type. For this function, the type of the data in memory
must match the type of the variable - no data conversion is done.
\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 varid Variable ID
@@ -570,7 +570,7 @@ allocated by the user before this function is called.
*/
/**@{*/
int
-nc_put_vara(int ncid, int varid, const size_t *startp,
+nc_put_vara(int ncid, int varid, const size_t *startp,
const size_t *countp, const void *op)
{
NC* ncp;
@@ -583,59 +583,59 @@ nc_put_vara(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_text(int ncid, int varid, const size_t *startp,
+nc_put_vara_text(int ncid, int varid, const size_t *startp,
const size_t *countp, const char *op)
{
- return NC_put_vara(ncid, varid, startp, countp,
+ return NC_put_vara(ncid, varid, startp, countp,
(void*)op, NC_CHAR);
}
int
-nc_put_vara_schar(int ncid, int varid, const size_t *startp,
+nc_put_vara_schar(int ncid, int varid, const size_t *startp,
const size_t *countp, const signed char *op)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return NC_put_vara(ncid, varid, startp, countp, (void *)op,
+ return NC_put_vara(ncid, varid, startp, countp, (void *)op,
NC_BYTE);
}
int
-nc_put_vara_uchar(int ncid, int varid, const size_t *startp,
+nc_put_vara_uchar(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return NC_put_vara(ncid, varid, startp, countp, (void *)op,
+ return NC_put_vara(ncid, varid, startp, countp, (void *)op,
T_uchar);
}
int
-nc_put_vara_short(int ncid, int varid, const size_t *startp,
+nc_put_vara_short(int ncid, int varid, const size_t *startp,
const size_t *countp, const short *op)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return NC_put_vara(ncid, varid, startp, countp, (void *)op,
+ return NC_put_vara(ncid, varid, startp, countp, (void *)op,
NC_SHORT);
}
int
-nc_put_vara_int(int ncid, int varid, const size_t *startp,
+nc_put_vara_int(int ncid, int varid, const size_t *startp,
const size_t *countp, const int *op)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return NC_put_vara(ncid, varid, startp, countp, (void *)op,
+ return NC_put_vara(ncid, varid, startp, countp, (void *)op,
NC_INT);
}
int
-nc_put_vara_long(int ncid, int varid, const size_t *startp,
+nc_put_vara_long(int ncid, int varid, const size_t *startp,
const size_t *countp, const long *op)
{
NC* ncp;
@@ -646,7 +646,7 @@ nc_put_vara_long(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_float(int ncid, int varid, const size_t *startp,
+nc_put_vara_float(int ncid, int varid, const size_t *startp,
const size_t *countp, const float *op)
{
NC* ncp;
@@ -657,7 +657,7 @@ nc_put_vara_float(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_double(int ncid, int varid, const size_t *startp,
+nc_put_vara_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const double *op)
{
NC* ncp;
@@ -668,7 +668,7 @@ nc_put_vara_double(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
+nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op)
{
NC* ncp;
@@ -679,7 +679,7 @@ nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
+nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned short *op)
{
NC* ncp;
@@ -690,7 +690,7 @@ nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_uint(int ncid, int varid, const size_t *startp,
+nc_put_vara_uint(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned int *op)
{
NC* ncp;
@@ -701,7 +701,7 @@ nc_put_vara_uint(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_longlong(int ncid, int varid, const size_t *startp,
+nc_put_vara_longlong(int ncid, int varid, const size_t *startp,
const size_t *countp, const long long *op)
{
NC* ncp;
@@ -712,7 +712,7 @@ nc_put_vara_longlong(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp,
+nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned long long *op)
{
NC* ncp;
@@ -724,7 +724,7 @@ nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp,
#ifdef USE_NETCDF4
int
-nc_put_vara_string(int ncid, int varid, const size_t *startp,
+nc_put_vara_string(int ncid, int varid, const size_t *startp,
const size_t *countp, const char* *op)
{
NC* ncp;
@@ -738,10 +738,10 @@ nc_put_vara_string(int ncid, int varid, const size_t *startp,
/**@}*/
/** \ingroup variables
-Write one datum.
+Write one datum.
\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 varid Variable ID
@@ -895,7 +895,7 @@ nc_put_var1_string(int ncid, int varid, const size_t *indexp, const char* *op)
/**@}*/
/** \ingroup variables
-Write an entire variable with one call.
+Write an entire variable with one call.
The nc_put_var_ type family of functions write all the values of a
variable into a netCDF variable of an open netCDF dataset. This is the
@@ -914,7 +914,7 @@ try to write all the values of a record variable but there are more
records in the file than you assume, more in-memory data will be
accessed than you supply, which may result in a segmentation
violation. To avoid such problems, it is better to use the nc_put_vara
-interfaces for variables that use the ::NC_UNLIMITED dimension.
+interfaces for variables that use the ::NC_UNLIMITED dimension.
The functions for types ubyte, ushort, uint, longlong, ulonglong, and
string are only available for netCDF-4/HDF5 files.
@@ -924,7 +924,7 @@ user defined type. For this function, the type of the data in memory
must match the type of the variable - no data conversion is done.
\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 varid Variable ID
@@ -1076,10 +1076,10 @@ nc_put_var_string(int ncid, int varid, const char* *op)
/**\} */
/** \ingroup variables
-Write a strided array of values to a variable.
+Write a strided array of values to a variable.
\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 varid Variable ID
@@ -1115,12 +1115,12 @@ nc_put_vars (int ncid, int varid, const size_t *startp,
if ((stat = NC_check_id(ncid, &ncp)))
return stat;
- return ncp->dispatch->put_vars(ncid, varid, startp, countp,
+ return ncp->dispatch->put_vars(ncid, varid, startp, countp,
stridep, op, NC_NAT);
}
int
-nc_put_vars_text(int ncid, int varid, const size_t *startp,
+nc_put_vars_text(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const char *op)
{
@@ -1132,14 +1132,14 @@ nc_put_vars_text(int ncid, int varid, const size_t *startp,
}
int
-nc_put_vars_schar(int ncid, int varid, const size_t *startp,
+nc_put_vars_schar(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const signed char *op)
{
NC *ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return NC_put_vars(ncid, varid, startp, countp,
+ return NC_put_vars(ncid, varid, startp, countp,
stridep,(void*)op,NC_BYTE);
}
@@ -1303,7 +1303,7 @@ nc_put_vars_string(int ncid, int varid,
/**\} */
/** \ingroup variables
-Write a mapped array of values to a variable.
+Write a mapped array of values to a variable.
The nc_put_varm() function will only write a variable of an
atomic type; it will not write user defined types. For this
@@ -1316,7 +1316,7 @@ The reason is the complexity of the
algorithm makes its use difficult for users to properly use.
\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 varid Variable ID
@@ -1355,13 +1355,13 @@ nc_put_varm (int ncid, int varid, const size_t *startp,
if ((stat = NC_check_id(ncid, &ncp)))
return stat;
- return ncp->dispatch->put_varm(ncid, varid, startp, countp,
+ return ncp->dispatch->put_varm(ncid, varid, startp, countp,
stridep, imapp, op, NC_NAT);
}
int
-nc_put_varm_text(int ncid, int varid, const size_t *startp,
- const size_t *countp, const ptrdiff_t *stridep,
+nc_put_varm_text(int ncid, int varid, const size_t *startp,
+ const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, const char *op)
{
NC *ncp;
@@ -1545,4 +1545,3 @@ nc_put_varm_string(int ncid, int varid,
/*! \} */ /*End of named group... */
-
diff --git a/libdispatch/ncuri.c b/libdispatch/ncuri.c
index 9d29685..b29b106 100644
--- a/libdispatch/ncuri.c
+++ b/libdispatch/ncuri.c
@@ -650,20 +650,24 @@ ncuridecodeparams(NCURI* ncuri)
int
ncurilookup(NCURI* uri, const char* key, const char** resultp)
{
- int i;
- char* value = NULL;
- if(uri == NULL || key == NULL || uri->params == NULL) return 0;
- if(uri->paramlist == NULL) {
+ int i;
+ char* value = NULL;
+ if(uri == NULL || key == NULL || uri->params == NULL) return 0;
+ if(uri->paramlist == NULL) {
i = ncuridecodeparams(uri);
if(!i) return 0;
- }
- /* Coverity[FORWARD_NULL] */
- i = ncfind(uri->paramlist,key);
- if(i < 0)
+ }
+ /* Coverity[FORWARD_NULL] */
+ i = ncfind(uri->paramlist,key);
+ if(i < 0)
return 0;
+
+ if(uri->paramlist) {
value = uri->paramlist[(2*i)+1];
if(resultp) *resultp = value;
- return 1;
+ }
+
+ return 1;
}
int
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index cc39c19..7fb5096 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -94,10 +94,12 @@ IF(NOT MSVC)
ENDIF()
ENDIF()
-SET_TARGET_PROPERTIES(netcdf PROPERTIES
- VERSION ${netCDF_LIB_VERSION}
- SOVERSION ${netCDF_SO_VERSION}
- )
+IF(ENABLE_SHARED_LIBRARY_VERSION)
+ SET_TARGET_PROPERTIES(netcdf PROPERTIES
+ VERSION ${netCDF_LIB_VERSION}
+ SOVERSION ${netCDF_SO_VERSION}
+ )
+ENDIF(ENABLE_SHARED_LIBRARY_VERSION)
###
# The INCLUDES directive was introduced in 2.8.12.
diff --git a/liblib/Makefile.am b/liblib/Makefile.am
index b24664f..f2431ce 100755
--- a/liblib/Makefile.am
+++ b/liblib/Makefile.am
@@ -19,7 +19,7 @@ lib_LTLIBRARIES = libnetcdf.la
# for information regarding incrementing `-version-info`.
##
-libnetcdf_la_LDFLAGS = -version-info 11:0:0 ${NOUNDEFINED}
+libnetcdf_la_LDFLAGS = -version-info 12:0:0 ${NOUNDEFINED}
libnetcdf_la_CPPFLAGS = ${AM_CPPFLAGS}
libnetcdf_la_LIBADD =
diff --git a/liblib/Makefile.in b/liblib/Makefile.in
index d92ea97..1a5cb0d 100644
--- a/liblib/Makefile.in
+++ b/liblib/Makefile.in
@@ -292,6 +292,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -428,7 +429,7 @@ lib_LTLIBRARIES = libnetcdf.la
# Note: version-info of "9:0:2" results in soname of libnetcdf.so.7 -> libnetcdf.so.7.2.0
# See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
# for information regarding incrementing `-version-info`.
-libnetcdf_la_LDFLAGS = -version-info 11:0:0 ${NOUNDEFINED} \
+libnetcdf_la_LDFLAGS = -version-info 12:0:0 ${NOUNDEFINED} \
$(am__append_3)
libnetcdf_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_4)
diff --git a/liblib/nc_initialize.c b/liblib/nc_initialize.c
index 81f1a2c..ca7c766 100644
--- a/liblib/nc_initialize.c
+++ b/liblib/nc_initialize.c
@@ -58,8 +58,6 @@ nc_initialize()
/* Initialize each active protocol */
- if((stat = NCSUBSTRATE_initialize())) return stat;
-
if((stat = NC3_initialize())) return stat;
#ifdef USE_DAP
@@ -111,8 +109,6 @@ nc_finalize(void)
if((stat = NC3_finalize())) return stat;
- if((stat = NCSUBSTRATE_finalize())) return stat;
-
/* Do general finalization */
if((stat = NCDISPATCH_finalize())) return stat;
diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt
index ee41fc4..76eecc8 100644
--- a/libsrc/CMakeLists.txt
+++ b/libsrc/CMakeLists.txt
@@ -10,7 +10,7 @@ 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)
+ nc3internal.c var.c dim.c ncx.c lookup3.c ncio.c nc_hashmap.c)
SET(libsrc_SOURCES ${libsrc_SOURCES} pstdint.h ncio.h ncx.h)
diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am
index 6814aef..f7baf87 100644
--- a/libsrc/Makefile.am
+++ b/libsrc/Makefile.am
@@ -15,7 +15,7 @@ endif # BUILD_DLL
# These files comprise the netCDF-3 classic library code.
libnetcdf3_la_SOURCES = v1hpg.c \
-putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c \
+putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c nc_hashmap.c \
ncx.h lookup3.c pstdint.h ncio.c ncio.h
if BUILD_DISKLESS
@@ -42,12 +42,12 @@ 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
+MAINTAINERCLEANFILES = $(man_MANS) attrx.c ncx.c putgetx.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 $< >$@
+ m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >${srcdir}/$@
# The C API man page.
man_MANS = netcdf.3
diff --git a/libsrc/Makefile.in b/libsrc/Makefile.in
index c26efaf..02dc4d0 100644
--- a/libsrc/Makefile.in
+++ b/libsrc/Makefile.in
@@ -136,8 +136,9 @@ CONFIG_CLEAN_VPATH_FILES =
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 ncstdio.c posixio.c
+ nc3internal.c var.c dim.c ncx.c nc_hashmap.c ncx.h lookup3.c \
+ pstdint.h 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
@@ -150,9 +151,9 @@ 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_5)
+ libnetcdf3_la-nc_hashmap.lo libnetcdf3_la-lookup3.lo \
+ libnetcdf3_la-ncio.lo $(am__objects_1) $(am__objects_2) \
+ $(am__objects_3) $(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@)
@@ -297,6 +298,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -427,15 +429,15 @@ libnetcdf3_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_3)
# These files comprise the netCDF-3 classic library code.
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_8)
+ nc3internal.c var.c dim.c ncx.c nc_hashmap.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_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
+MAINTAINERCLEANFILES = $(man_MANS) attrx.c ncx.c putgetx.c
EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
# The C API man page.
@@ -507,6 +509,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-mmapio.Plo at am__quote@
@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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncio.Plo at am__quote@
@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@
@@ -595,6 +598,13 @@ libnetcdf3_la-ncx.lo: ncx.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-ncx.lo `test -f 'ncx.c' || echo '$(srcdir)/'`ncx.c
+libnetcdf3_la-nc_hashmap.lo: nc_hashmap.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-nc_hashmap.lo -MD -MP -MF $(DEPDIR)/libnetcdf3_la-nc_hashmap.Tpo -c -o libnetcdf3_la-nc_hashmap.lo `test -f 'nc_hashmap.c' || echo '$(srcdir)/'`nc_hashmap.c
+ at am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdf3_la-nc_hashmap.Tpo $(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nc_hashmap.c' object='libnetcdf3_la-nc_hashmap.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-nc_hashmap.lo `test -f 'nc_hashmap.c' || echo '$(srcdir)/'`nc_hashmap.c
+
libnetcdf3_la-lookup3.lo: lookup3.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-lookup3.lo -MD -MP -MF $(DEPDIR)/libnetcdf3_la-lookup3.Tpo -c -o libnetcdf3_la-lookup3.lo `test -f 'lookup3.c' || echo '$(srcdir)/'`lookup3.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdf3_la-lookup3.Tpo $(DEPDIR)/libnetcdf3_la-lookup3.Plo
@@ -908,7 +918,7 @@ uninstall-man: uninstall-man3
# This tells make how to turn .m4 files into .c files.
.m4.c:
- m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >$@
+ m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >${srcdir}/$@
# This rule generates the C manpage.
netcdf.3: $(top_srcdir)/docs/netcdf.m4
diff --git a/libsrc/attr.c b/libsrc/attr.c
index f02d5b3..b59c314 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.
@@ -620,722 +622,1405 @@ NC3_del_att(int ncid, int varid, const char *uname)
return NC_NOERR;
}
+#line 703
static int
+#line 704
ncx_pad_putn_Iuchar(void **xpp, size_t nelems, const uchar *tp, nc_type type)
+#line 704
{
+#line 704
switch(type) {
+#line 704
case NC_CHAR:
+#line 704
return NC_ECHAR;
+#line 704
case NC_BYTE:
+#line 704
return ncx_pad_putn_schar_uchar(xpp, nelems, tp);
+#line 704
case NC_SHORT:
+#line 704
return ncx_pad_putn_short_uchar(xpp, nelems, tp);
+#line 704
case NC_INT:
+#line 704
return ncx_putn_int_uchar(xpp, nelems, tp);
+#line 704
case NC_FLOAT:
+#line 704
return ncx_putn_float_uchar(xpp, nelems, tp);
+#line 704
case NC_DOUBLE:
+#line 704
return ncx_putn_double_uchar(xpp, nelems, tp);
+#line 704
case NC_UBYTE:
+#line 704
return ncx_pad_putn_uchar_uchar(xpp, nelems, tp);
+#line 704
case NC_USHORT:
+#line 704
return ncx_putn_ushort_uchar(xpp, nelems, tp);
+#line 704
case NC_UINT:
+#line 704
return ncx_putn_uint_uchar(xpp, nelems, tp);
+#line 704
case NC_INT64:
+#line 704
return ncx_putn_longlong_uchar(xpp, nelems, tp);
+#line 704
case NC_UINT64:
+#line 704
return ncx_putn_ulonglong_uchar(xpp, nelems, tp);
+#line 704
default:
+#line 704
assert("ncx_pad_putn_Iuchar invalid type" == 0);
+#line 704
}
+#line 704
return NC_EBADTYPE;
+#line 704
}
+#line 704
static int
+#line 705
ncx_pad_getn_Iuchar(const void **xpp, size_t nelems, uchar *tp, nc_type type)
+#line 705
{
+#line 705
switch(type) {
+#line 705
case NC_CHAR:
+#line 705
return NC_ECHAR;
+#line 705
case NC_BYTE:
+#line 705
return ncx_pad_getn_schar_uchar(xpp, nelems, tp);
+#line 705
case NC_SHORT:
+#line 705
return ncx_pad_getn_short_uchar(xpp, nelems, tp);
+#line 705
case NC_INT:
+#line 705
return ncx_getn_int_uchar(xpp, nelems, tp);
+#line 705
case NC_FLOAT:
+#line 705
return ncx_getn_float_uchar(xpp, nelems, tp);
+#line 705
case NC_DOUBLE:
+#line 705
return ncx_getn_double_uchar(xpp, nelems, tp);
+#line 705
case NC_UBYTE:
+#line 705
return ncx_pad_getn_uchar_uchar(xpp, nelems, tp);
+#line 705
case NC_USHORT:
+#line 705
return ncx_getn_ushort_uchar(xpp, nelems, tp);
+#line 705
case NC_UINT:
+#line 705
return ncx_getn_uint_uchar(xpp, nelems, tp);
+#line 705
case NC_INT64:
+#line 705
return ncx_getn_longlong_uchar(xpp, nelems, tp);
+#line 705
case NC_UINT64:
+#line 705
return ncx_getn_ulonglong_uchar(xpp, nelems, tp);
+#line 705
default:
+#line 705
assert("ncx_pad_getn_Iuchar invalid type" == 0);
+#line 705
}
+#line 705
return NC_EBADTYPE;
+#line 705
}
+#line 705
static int
+#line 707
ncx_pad_putn_Ischar(void **xpp, size_t nelems, const schar *tp, nc_type type)
+#line 707
{
+#line 707
switch(type) {
+#line 707
case NC_CHAR:
+#line 707
return NC_ECHAR;
+#line 707
case NC_BYTE:
+#line 707
return ncx_pad_putn_schar_schar(xpp, nelems, tp);
+#line 707
case NC_SHORT:
+#line 707
return ncx_pad_putn_short_schar(xpp, nelems, tp);
+#line 707
case NC_INT:
+#line 707
return ncx_putn_int_schar(xpp, nelems, tp);
+#line 707
case NC_FLOAT:
+#line 707
return ncx_putn_float_schar(xpp, nelems, tp);
+#line 707
case NC_DOUBLE:
+#line 707
return ncx_putn_double_schar(xpp, nelems, tp);
+#line 707
case NC_UBYTE:
+#line 707
return ncx_pad_putn_uchar_schar(xpp, nelems, tp);
+#line 707
case NC_USHORT:
+#line 707
return ncx_putn_ushort_schar(xpp, nelems, tp);
+#line 707
case NC_UINT:
+#line 707
return ncx_putn_uint_schar(xpp, nelems, tp);
+#line 707
case NC_INT64:
+#line 707
return ncx_putn_longlong_schar(xpp, nelems, tp);
+#line 707
case NC_UINT64:
+#line 707
return ncx_putn_ulonglong_schar(xpp, nelems, tp);
+#line 707
default:
+#line 707
assert("ncx_pad_putn_Ischar invalid type" == 0);
+#line 707
}
+#line 707
return NC_EBADTYPE;
+#line 707
}
+#line 707
static int
+#line 708
ncx_pad_getn_Ischar(const void **xpp, size_t nelems, schar *tp, nc_type type)
+#line 708
{
+#line 708
switch(type) {
+#line 708
case NC_CHAR:
+#line 708
return NC_ECHAR;
+#line 708
case NC_BYTE:
+#line 708
return ncx_pad_getn_schar_schar(xpp, nelems, tp);
+#line 708
case NC_SHORT:
+#line 708
return ncx_pad_getn_short_schar(xpp, nelems, tp);
+#line 708
case NC_INT:
+#line 708
return ncx_getn_int_schar(xpp, nelems, tp);
+#line 708
case NC_FLOAT:
+#line 708
return ncx_getn_float_schar(xpp, nelems, tp);
+#line 708
case NC_DOUBLE:
+#line 708
return ncx_getn_double_schar(xpp, nelems, tp);
+#line 708
case NC_UBYTE:
+#line 708
return ncx_pad_getn_uchar_schar(xpp, nelems, tp);
+#line 708
case NC_USHORT:
+#line 708
return ncx_getn_ushort_schar(xpp, nelems, tp);
+#line 708
case NC_UINT:
+#line 708
return ncx_getn_uint_schar(xpp, nelems, tp);
+#line 708
case NC_INT64:
+#line 708
return ncx_getn_longlong_schar(xpp, nelems, tp);
+#line 708
case NC_UINT64:
+#line 708
return ncx_getn_ulonglong_schar(xpp, nelems, tp);
+#line 708
default:
+#line 708
assert("ncx_pad_getn_Ischar invalid type" == 0);
+#line 708
}
+#line 708
return NC_EBADTYPE;
+#line 708
}
+#line 708
static int
+#line 710
ncx_pad_putn_Ishort(void **xpp, size_t nelems, const short *tp, nc_type type)
+#line 710
{
+#line 710
switch(type) {
+#line 710
case NC_CHAR:
+#line 710
return NC_ECHAR;
+#line 710
case NC_BYTE:
+#line 710
return ncx_pad_putn_schar_short(xpp, nelems, tp);
+#line 710
case NC_SHORT:
+#line 710
return ncx_pad_putn_short_short(xpp, nelems, tp);
+#line 710
case NC_INT:
+#line 710
return ncx_putn_int_short(xpp, nelems, tp);
+#line 710
case NC_FLOAT:
+#line 710
return ncx_putn_float_short(xpp, nelems, tp);
+#line 710
case NC_DOUBLE:
+#line 710
return ncx_putn_double_short(xpp, nelems, tp);
+#line 710
case NC_UBYTE:
+#line 710
return ncx_pad_putn_uchar_short(xpp, nelems, tp);
+#line 710
case NC_USHORT:
+#line 710
return ncx_putn_ushort_short(xpp, nelems, tp);
+#line 710
case NC_UINT:
+#line 710
return ncx_putn_uint_short(xpp, nelems, tp);
+#line 710
case NC_INT64:
+#line 710
return ncx_putn_longlong_short(xpp, nelems, tp);
+#line 710
case NC_UINT64:
+#line 710
return ncx_putn_ulonglong_short(xpp, nelems, tp);
+#line 710
default:
+#line 710
assert("ncx_pad_putn_Ishort invalid type" == 0);
+#line 710
}
+#line 710
return NC_EBADTYPE;
+#line 710
}
+#line 710
static int
+#line 711
ncx_pad_getn_Ishort(const void **xpp, size_t nelems, short *tp, nc_type type)
+#line 711
{
+#line 711
switch(type) {
+#line 711
case NC_CHAR:
+#line 711
return NC_ECHAR;
+#line 711
case NC_BYTE:
+#line 711
return ncx_pad_getn_schar_short(xpp, nelems, tp);
+#line 711
case NC_SHORT:
+#line 711
return ncx_pad_getn_short_short(xpp, nelems, tp);
+#line 711
case NC_INT:
+#line 711
return ncx_getn_int_short(xpp, nelems, tp);
+#line 711
case NC_FLOAT:
+#line 711
return ncx_getn_float_short(xpp, nelems, tp);
+#line 711
case NC_DOUBLE:
+#line 711
return ncx_getn_double_short(xpp, nelems, tp);
+#line 711
case NC_UBYTE:
+#line 711
return ncx_pad_getn_uchar_short(xpp, nelems, tp);
+#line 711
case NC_USHORT:
+#line 711
return ncx_getn_ushort_short(xpp, nelems, tp);
+#line 711
case NC_UINT:
+#line 711
return ncx_getn_uint_short(xpp, nelems, tp);
+#line 711
case NC_INT64:
+#line 711
return ncx_getn_longlong_short(xpp, nelems, tp);
+#line 711
case NC_UINT64:
+#line 711
return ncx_getn_ulonglong_short(xpp, nelems, tp);
+#line 711
default:
+#line 711
assert("ncx_pad_getn_Ishort invalid type" == 0);
+#line 711
}
+#line 711
return NC_EBADTYPE;
+#line 711
}
+#line 711
static int
+#line 713
ncx_pad_putn_Iint(void **xpp, size_t nelems, const int *tp, nc_type type)
+#line 713
{
+#line 713
switch(type) {
+#line 713
case NC_CHAR:
+#line 713
return NC_ECHAR;
+#line 713
case NC_BYTE:
+#line 713
return ncx_pad_putn_schar_int(xpp, nelems, tp);
+#line 713
case NC_SHORT:
+#line 713
return ncx_pad_putn_short_int(xpp, nelems, tp);
+#line 713
case NC_INT:
+#line 713
return ncx_putn_int_int(xpp, nelems, tp);
+#line 713
case NC_FLOAT:
+#line 713
return ncx_putn_float_int(xpp, nelems, tp);
+#line 713
case NC_DOUBLE:
+#line 713
return ncx_putn_double_int(xpp, nelems, tp);
+#line 713
case NC_UBYTE:
+#line 713
return ncx_pad_putn_uchar_int(xpp, nelems, tp);
+#line 713
case NC_USHORT:
+#line 713
return ncx_putn_ushort_int(xpp, nelems, tp);
+#line 713
case NC_UINT:
+#line 713
return ncx_putn_uint_int(xpp, nelems, tp);
+#line 713
case NC_INT64:
+#line 713
return ncx_putn_longlong_int(xpp, nelems, tp);
+#line 713
case NC_UINT64:
+#line 713
return ncx_putn_ulonglong_int(xpp, nelems, tp);
+#line 713
default:
+#line 713
assert("ncx_pad_putn_Iint invalid type" == 0);
+#line 713
}
+#line 713
return NC_EBADTYPE;
+#line 713
}
+#line 713
static int
+#line 714
ncx_pad_getn_Iint(const void **xpp, size_t nelems, int *tp, nc_type type)
+#line 714
{
+#line 714
switch(type) {
+#line 714
case NC_CHAR:
+#line 714
return NC_ECHAR;
+#line 714
case NC_BYTE:
+#line 714
return ncx_pad_getn_schar_int(xpp, nelems, tp);
+#line 714
case NC_SHORT:
+#line 714
return ncx_pad_getn_short_int(xpp, nelems, tp);
+#line 714
case NC_INT:
+#line 714
return ncx_getn_int_int(xpp, nelems, tp);
+#line 714
case NC_FLOAT:
+#line 714
return ncx_getn_float_int(xpp, nelems, tp);
+#line 714
case NC_DOUBLE:
+#line 714
return ncx_getn_double_int(xpp, nelems, tp);
+#line 714
case NC_UBYTE:
+#line 714
return ncx_pad_getn_uchar_int(xpp, nelems, tp);
+#line 714
case NC_USHORT:
+#line 714
return ncx_getn_ushort_int(xpp, nelems, tp);
+#line 714
case NC_UINT:
+#line 714
return ncx_getn_uint_int(xpp, nelems, tp);
+#line 714
case NC_INT64:
+#line 714
return ncx_getn_longlong_int(xpp, nelems, tp);
+#line 714
case NC_UINT64:
+#line 714
return ncx_getn_ulonglong_int(xpp, nelems, tp);
+#line 714
default:
+#line 714
assert("ncx_pad_getn_Iint invalid type" == 0);
+#line 714
}
+#line 714
return NC_EBADTYPE;
+#line 714
}
+#line 714
static int
+#line 716
ncx_pad_putn_Ifloat(void **xpp, size_t nelems, const float *tp, nc_type type)
+#line 716
{
+#line 716
switch(type) {
+#line 716
case NC_CHAR:
+#line 716
return NC_ECHAR;
+#line 716
case NC_BYTE:
+#line 716
return ncx_pad_putn_schar_float(xpp, nelems, tp);
+#line 716
case NC_SHORT:
+#line 716
return ncx_pad_putn_short_float(xpp, nelems, tp);
+#line 716
case NC_INT:
+#line 716
return ncx_putn_int_float(xpp, nelems, tp);
+#line 716
case NC_FLOAT:
+#line 716
return ncx_putn_float_float(xpp, nelems, tp);
+#line 716
case NC_DOUBLE:
+#line 716
return ncx_putn_double_float(xpp, nelems, tp);
+#line 716
case NC_UBYTE:
+#line 716
return ncx_pad_putn_uchar_float(xpp, nelems, tp);
+#line 716
case NC_USHORT:
+#line 716
return ncx_putn_ushort_float(xpp, nelems, tp);
+#line 716
case NC_UINT:
+#line 716
return ncx_putn_uint_float(xpp, nelems, tp);
+#line 716
case NC_INT64:
+#line 716
return ncx_putn_longlong_float(xpp, nelems, tp);
+#line 716
case NC_UINT64:
+#line 716
return ncx_putn_ulonglong_float(xpp, nelems, tp);
+#line 716
default:
+#line 716
assert("ncx_pad_putn_Ifloat invalid type" == 0);
+#line 716
}
+#line 716
return NC_EBADTYPE;
+#line 716
}
+#line 716
static int
+#line 717
ncx_pad_getn_Ifloat(const void **xpp, size_t nelems, float *tp, nc_type type)
+#line 717
{
+#line 717
switch(type) {
+#line 717
case NC_CHAR:
+#line 717
return NC_ECHAR;
+#line 717
case NC_BYTE:
+#line 717
return ncx_pad_getn_schar_float(xpp, nelems, tp);
+#line 717
case NC_SHORT:
+#line 717
return ncx_pad_getn_short_float(xpp, nelems, tp);
+#line 717
case NC_INT:
+#line 717
return ncx_getn_int_float(xpp, nelems, tp);
+#line 717
case NC_FLOAT:
+#line 717
return ncx_getn_float_float(xpp, nelems, tp);
+#line 717
case NC_DOUBLE:
+#line 717
return ncx_getn_double_float(xpp, nelems, tp);
+#line 717
case NC_UBYTE:
+#line 717
return ncx_pad_getn_uchar_float(xpp, nelems, tp);
+#line 717
case NC_USHORT:
+#line 717
return ncx_getn_ushort_float(xpp, nelems, tp);
+#line 717
case NC_UINT:
+#line 717
return ncx_getn_uint_float(xpp, nelems, tp);
+#line 717
case NC_INT64:
+#line 717
return ncx_getn_longlong_float(xpp, nelems, tp);
+#line 717
case NC_UINT64:
+#line 717
return ncx_getn_ulonglong_float(xpp, nelems, tp);
+#line 717
default:
+#line 717
assert("ncx_pad_getn_Ifloat invalid type" == 0);
+#line 717
}
+#line 717
return NC_EBADTYPE;
+#line 717
}
+#line 717
static int
+#line 719
ncx_pad_putn_Idouble(void **xpp, size_t nelems, const double *tp, nc_type type)
+#line 719
{
+#line 719
switch(type) {
+#line 719
case NC_CHAR:
+#line 719
return NC_ECHAR;
+#line 719
case NC_BYTE:
+#line 719
return ncx_pad_putn_schar_double(xpp, nelems, tp);
+#line 719
case NC_SHORT:
+#line 719
return ncx_pad_putn_short_double(xpp, nelems, tp);
+#line 719
case NC_INT:
+#line 719
return ncx_putn_int_double(xpp, nelems, tp);
+#line 719
case NC_FLOAT:
+#line 719
return ncx_putn_float_double(xpp, nelems, tp);
+#line 719
case NC_DOUBLE:
+#line 719
return ncx_putn_double_double(xpp, nelems, tp);
+#line 719
case NC_UBYTE:
+#line 719
return ncx_pad_putn_uchar_double(xpp, nelems, tp);
+#line 719
case NC_USHORT:
+#line 719
return ncx_putn_ushort_double(xpp, nelems, tp);
+#line 719
case NC_UINT:
+#line 719
return ncx_putn_uint_double(xpp, nelems, tp);
+#line 719
case NC_INT64:
+#line 719
return ncx_putn_longlong_double(xpp, nelems, tp);
+#line 719
case NC_UINT64:
+#line 719
return ncx_putn_ulonglong_double(xpp, nelems, tp);
+#line 719
default:
+#line 719
assert("ncx_pad_putn_Idouble invalid type" == 0);
+#line 719
}
+#line 719
return NC_EBADTYPE;
+#line 719
}
+#line 719
static int
+#line 720
ncx_pad_getn_Idouble(const void **xpp, size_t nelems, double *tp, nc_type type)
+#line 720
{
+#line 720
switch(type) {
+#line 720
case NC_CHAR:
+#line 720
return NC_ECHAR;
+#line 720
case NC_BYTE:
+#line 720
return ncx_pad_getn_schar_double(xpp, nelems, tp);
+#line 720
case NC_SHORT:
+#line 720
return ncx_pad_getn_short_double(xpp, nelems, tp);
+#line 720
case NC_INT:
+#line 720
return ncx_getn_int_double(xpp, nelems, tp);
+#line 720
case NC_FLOAT:
+#line 720
return ncx_getn_float_double(xpp, nelems, tp);
+#line 720
case NC_DOUBLE:
+#line 720
return ncx_getn_double_double(xpp, nelems, tp);
+#line 720
case NC_UBYTE:
+#line 720
return ncx_pad_getn_uchar_double(xpp, nelems, tp);
+#line 720
case NC_USHORT:
+#line 720
return ncx_getn_ushort_double(xpp, nelems, tp);
+#line 720
case NC_UINT:
+#line 720
return ncx_getn_uint_double(xpp, nelems, tp);
+#line 720
case NC_INT64:
+#line 720
return ncx_getn_longlong_double(xpp, nelems, tp);
+#line 720
case NC_UINT64:
+#line 720
return ncx_getn_ulonglong_double(xpp, nelems, tp);
+#line 720
default:
+#line 720
assert("ncx_pad_getn_Idouble invalid type" == 0);
+#line 720
}
+#line 720
return NC_EBADTYPE;
+#line 720
}
+#line 720
#ifdef IGNORE
static int
+#line 723
ncx_pad_putn_Ilong(void **xpp, size_t nelems, const long *tp, nc_type type)
+#line 723
{
+#line 723
switch(type) {
+#line 723
case NC_CHAR:
+#line 723
return NC_ECHAR;
+#line 723
case NC_BYTE:
+#line 723
return ncx_pad_putn_schar_long(xpp, nelems, tp);
+#line 723
case NC_SHORT:
+#line 723
return ncx_pad_putn_short_long(xpp, nelems, tp);
+#line 723
case NC_INT:
+#line 723
return ncx_putn_int_long(xpp, nelems, tp);
+#line 723
case NC_FLOAT:
+#line 723
return ncx_putn_float_long(xpp, nelems, tp);
+#line 723
case NC_DOUBLE:
+#line 723
return ncx_putn_double_long(xpp, nelems, tp);
+#line 723
case NC_UBYTE:
+#line 723
return ncx_pad_putn_uchar_long(xpp, nelems, tp);
+#line 723
case NC_USHORT:
+#line 723
return ncx_putn_ushort_long(xpp, nelems, tp);
+#line 723
case NC_UINT:
+#line 723
return ncx_putn_uint_long(xpp, nelems, tp);
+#line 723
case NC_INT64:
+#line 723
return ncx_putn_longlong_long(xpp, nelems, tp);
+#line 723
case NC_UINT64:
+#line 723
return ncx_putn_ulonglong_long(xpp, nelems, tp);
+#line 723
default:
+#line 723
assert("ncx_pad_putn_Ilong invalid type" == 0);
+#line 723
}
+#line 723
return NC_EBADTYPE;
+#line 723
}
+#line 723
static int
+#line 724
ncx_pad_getn_Ilong(const void **xpp, size_t nelems, long *tp, nc_type type)
+#line 724
{
+#line 724
switch(type) {
+#line 724
case NC_CHAR:
+#line 724
return NC_ECHAR;
+#line 724
case NC_BYTE:
+#line 724
return ncx_pad_getn_schar_long(xpp, nelems, tp);
+#line 724
case NC_SHORT:
+#line 724
return ncx_pad_getn_short_long(xpp, nelems, tp);
+#line 724
case NC_INT:
+#line 724
return ncx_getn_int_long(xpp, nelems, tp);
+#line 724
case NC_FLOAT:
+#line 724
return ncx_getn_float_long(xpp, nelems, tp);
+#line 724
case NC_DOUBLE:
+#line 724
return ncx_getn_double_long(xpp, nelems, tp);
+#line 724
case NC_UBYTE:
+#line 724
return ncx_pad_getn_uchar_long(xpp, nelems, tp);
+#line 724
case NC_USHORT:
+#line 724
return ncx_getn_ushort_long(xpp, nelems, tp);
+#line 724
case NC_UINT:
+#line 724
return ncx_getn_uint_long(xpp, nelems, tp);
+#line 724
case NC_INT64:
+#line 724
return ncx_getn_longlong_long(xpp, nelems, tp);
+#line 724
case NC_UINT64:
+#line 724
return ncx_getn_ulonglong_long(xpp, nelems, tp);
+#line 724
default:
+#line 724
assert("ncx_pad_getn_Ilong invalid type" == 0);
+#line 724
}
+#line 724
return NC_EBADTYPE;
+#line 724
}
+#line 724
#endif
static int
+#line 727
ncx_pad_putn_Ilonglong(void **xpp, size_t nelems, const longlong *tp, nc_type type)
+#line 727
{
+#line 727
switch(type) {
+#line 727
case NC_CHAR:
+#line 727
return NC_ECHAR;
+#line 727
case NC_BYTE:
+#line 727
return ncx_pad_putn_schar_longlong(xpp, nelems, tp);
+#line 727
case NC_SHORT:
+#line 727
return ncx_pad_putn_short_longlong(xpp, nelems, tp);
+#line 727
case NC_INT:
+#line 727
return ncx_putn_int_longlong(xpp, nelems, tp);
+#line 727
case NC_FLOAT:
+#line 727
return ncx_putn_float_longlong(xpp, nelems, tp);
+#line 727
case NC_DOUBLE:
+#line 727
return ncx_putn_double_longlong(xpp, nelems, tp);
+#line 727
case NC_UBYTE:
+#line 727
return ncx_pad_putn_uchar_longlong(xpp, nelems, tp);
+#line 727
case NC_USHORT:
+#line 727
return ncx_putn_ushort_longlong(xpp, nelems, tp);
+#line 727
case NC_UINT:
+#line 727
return ncx_putn_uint_longlong(xpp, nelems, tp);
+#line 727
case NC_INT64:
+#line 727
return ncx_putn_longlong_longlong(xpp, nelems, tp);
+#line 727
case NC_UINT64:
+#line 727
return ncx_putn_ulonglong_longlong(xpp, nelems, tp);
+#line 727
default:
+#line 727
assert("ncx_pad_putn_Ilonglong invalid type" == 0);
+#line 727
}
+#line 727
return NC_EBADTYPE;
+#line 727
}
+#line 727
static int
+#line 728
ncx_pad_getn_Ilonglong(const void **xpp, size_t nelems, longlong *tp, nc_type type)
+#line 728
{
+#line 728
switch(type) {
+#line 728
case NC_CHAR:
+#line 728
return NC_ECHAR;
+#line 728
case NC_BYTE:
+#line 728
return ncx_pad_getn_schar_longlong(xpp, nelems, tp);
+#line 728
case NC_SHORT:
+#line 728
return ncx_pad_getn_short_longlong(xpp, nelems, tp);
+#line 728
case NC_INT:
+#line 728
return ncx_getn_int_longlong(xpp, nelems, tp);
+#line 728
case NC_FLOAT:
+#line 728
return ncx_getn_float_longlong(xpp, nelems, tp);
+#line 728
case NC_DOUBLE:
+#line 728
return ncx_getn_double_longlong(xpp, nelems, tp);
+#line 728
case NC_UBYTE:
+#line 728
return ncx_pad_getn_uchar_longlong(xpp, nelems, tp);
+#line 728
case NC_USHORT:
+#line 728
return ncx_getn_ushort_longlong(xpp, nelems, tp);
+#line 728
case NC_UINT:
+#line 728
return ncx_getn_uint_longlong(xpp, nelems, tp);
+#line 728
case NC_INT64:
+#line 728
return ncx_getn_longlong_longlong(xpp, nelems, tp);
+#line 728
case NC_UINT64:
+#line 728
return ncx_getn_ulonglong_longlong(xpp, nelems, tp);
+#line 728
default:
+#line 728
assert("ncx_pad_getn_Ilonglong invalid type" == 0);
+#line 728
}
+#line 728
return NC_EBADTYPE;
+#line 728
}
+#line 728
static int
+#line 730
ncx_pad_putn_Iushort(void **xpp, size_t nelems, const ushort *tp, nc_type type)
+#line 730
{
+#line 730
switch(type) {
+#line 730
case NC_CHAR:
+#line 730
return NC_ECHAR;
+#line 730
case NC_BYTE:
+#line 730
return ncx_pad_putn_schar_ushort(xpp, nelems, tp);
+#line 730
case NC_SHORT:
+#line 730
return ncx_pad_putn_short_ushort(xpp, nelems, tp);
+#line 730
case NC_INT:
+#line 730
return ncx_putn_int_ushort(xpp, nelems, tp);
+#line 730
case NC_FLOAT:
+#line 730
return ncx_putn_float_ushort(xpp, nelems, tp);
+#line 730
case NC_DOUBLE:
+#line 730
return ncx_putn_double_ushort(xpp, nelems, tp);
+#line 730
case NC_UBYTE:
+#line 730
return ncx_pad_putn_uchar_ushort(xpp, nelems, tp);
+#line 730
case NC_USHORT:
+#line 730
return ncx_putn_ushort_ushort(xpp, nelems, tp);
+#line 730
case NC_UINT:
+#line 730
return ncx_putn_uint_ushort(xpp, nelems, tp);
+#line 730
case NC_INT64:
+#line 730
return ncx_putn_longlong_ushort(xpp, nelems, tp);
+#line 730
case NC_UINT64:
+#line 730
return ncx_putn_ulonglong_ushort(xpp, nelems, tp);
+#line 730
default:
+#line 730
assert("ncx_pad_putn_Iushort invalid type" == 0);
+#line 730
}
+#line 730
return NC_EBADTYPE;
+#line 730
}
+#line 730
static int
+#line 731
ncx_pad_getn_Iushort(const void **xpp, size_t nelems, ushort *tp, nc_type type)
+#line 731
{
+#line 731
switch(type) {
+#line 731
case NC_CHAR:
+#line 731
return NC_ECHAR;
+#line 731
case NC_BYTE:
+#line 731
return ncx_pad_getn_schar_ushort(xpp, nelems, tp);
+#line 731
case NC_SHORT:
+#line 731
return ncx_pad_getn_short_ushort(xpp, nelems, tp);
+#line 731
case NC_INT:
+#line 731
return ncx_getn_int_ushort(xpp, nelems, tp);
+#line 731
case NC_FLOAT:
+#line 731
return ncx_getn_float_ushort(xpp, nelems, tp);
+#line 731
case NC_DOUBLE:
+#line 731
return ncx_getn_double_ushort(xpp, nelems, tp);
+#line 731
case NC_UBYTE:
+#line 731
return ncx_pad_getn_uchar_ushort(xpp, nelems, tp);
+#line 731
case NC_USHORT:
+#line 731
return ncx_getn_ushort_ushort(xpp, nelems, tp);
+#line 731
case NC_UINT:
+#line 731
return ncx_getn_uint_ushort(xpp, nelems, tp);
+#line 731
case NC_INT64:
+#line 731
return ncx_getn_longlong_ushort(xpp, nelems, tp);
+#line 731
case NC_UINT64:
+#line 731
return ncx_getn_ulonglong_ushort(xpp, nelems, tp);
+#line 731
default:
+#line 731
assert("ncx_pad_getn_Iushort invalid type" == 0);
+#line 731
}
+#line 731
return NC_EBADTYPE;
+#line 731
}
+#line 731
static int
+#line 733
ncx_pad_putn_Iuint(void **xpp, size_t nelems, const uint *tp, nc_type type)
+#line 733
{
+#line 733
switch(type) {
+#line 733
case NC_CHAR:
+#line 733
return NC_ECHAR;
+#line 733
case NC_BYTE:
+#line 733
return ncx_pad_putn_schar_uint(xpp, nelems, tp);
+#line 733
case NC_SHORT:
+#line 733
return ncx_pad_putn_short_uint(xpp, nelems, tp);
+#line 733
case NC_INT:
+#line 733
return ncx_putn_int_uint(xpp, nelems, tp);
+#line 733
case NC_FLOAT:
+#line 733
return ncx_putn_float_uint(xpp, nelems, tp);
+#line 733
case NC_DOUBLE:
+#line 733
return ncx_putn_double_uint(xpp, nelems, tp);
+#line 733
case NC_UBYTE:
+#line 733
return ncx_pad_putn_uchar_uint(xpp, nelems, tp);
+#line 733
case NC_USHORT:
+#line 733
return ncx_putn_ushort_uint(xpp, nelems, tp);
+#line 733
case NC_UINT:
+#line 733
return ncx_putn_uint_uint(xpp, nelems, tp);
+#line 733
case NC_INT64:
+#line 733
return ncx_putn_longlong_uint(xpp, nelems, tp);
+#line 733
case NC_UINT64:
+#line 733
return ncx_putn_ulonglong_uint(xpp, nelems, tp);
+#line 733
default:
+#line 733
assert("ncx_pad_putn_Iuint invalid type" == 0);
+#line 733
}
+#line 733
return NC_EBADTYPE;
+#line 733
}
+#line 733
static int
+#line 734
ncx_pad_getn_Iuint(const void **xpp, size_t nelems, uint *tp, nc_type type)
+#line 734
{
+#line 734
switch(type) {
+#line 734
case NC_CHAR:
+#line 734
return NC_ECHAR;
+#line 734
case NC_BYTE:
+#line 734
return ncx_pad_getn_schar_uint(xpp, nelems, tp);
+#line 734
case NC_SHORT:
+#line 734
return ncx_pad_getn_short_uint(xpp, nelems, tp);
+#line 734
case NC_INT:
+#line 734
return ncx_getn_int_uint(xpp, nelems, tp);
+#line 734
case NC_FLOAT:
+#line 734
return ncx_getn_float_uint(xpp, nelems, tp);
+#line 734
case NC_DOUBLE:
+#line 734
return ncx_getn_double_uint(xpp, nelems, tp);
+#line 734
case NC_UBYTE:
+#line 734
return ncx_pad_getn_uchar_uint(xpp, nelems, tp);
+#line 734
case NC_USHORT:
+#line 734
return ncx_getn_ushort_uint(xpp, nelems, tp);
+#line 734
case NC_UINT:
+#line 734
return ncx_getn_uint_uint(xpp, nelems, tp);
+#line 734
case NC_INT64:
+#line 734
return ncx_getn_longlong_uint(xpp, nelems, tp);
+#line 734
case NC_UINT64:
+#line 734
return ncx_getn_ulonglong_uint(xpp, nelems, tp);
+#line 734
default:
+#line 734
assert("ncx_pad_getn_Iuint invalid type" == 0);
+#line 734
}
+#line 734
return NC_EBADTYPE;
+#line 734
}
+#line 734
static int
+#line 736
ncx_pad_putn_Iulonglong(void **xpp, size_t nelems, const ulonglong *tp, nc_type type)
+#line 736
{
+#line 736
switch(type) {
+#line 736
case NC_CHAR:
+#line 736
return NC_ECHAR;
+#line 736
case NC_BYTE:
+#line 736
return ncx_pad_putn_schar_ulonglong(xpp, nelems, tp);
+#line 736
case NC_SHORT:
+#line 736
return ncx_pad_putn_short_ulonglong(xpp, nelems, tp);
+#line 736
case NC_INT:
+#line 736
return ncx_putn_int_ulonglong(xpp, nelems, tp);
+#line 736
case NC_FLOAT:
+#line 736
return ncx_putn_float_ulonglong(xpp, nelems, tp);
+#line 736
case NC_DOUBLE:
+#line 736
return ncx_putn_double_ulonglong(xpp, nelems, tp);
+#line 736
case NC_UBYTE:
+#line 736
return ncx_pad_putn_uchar_ulonglong(xpp, nelems, tp);
+#line 736
case NC_USHORT:
+#line 736
return ncx_putn_ushort_ulonglong(xpp, nelems, tp);
+#line 736
case NC_UINT:
+#line 736
return ncx_putn_uint_ulonglong(xpp, nelems, tp);
+#line 736
case NC_INT64:
+#line 736
return ncx_putn_longlong_ulonglong(xpp, nelems, tp);
+#line 736
case NC_UINT64:
+#line 736
return ncx_putn_ulonglong_ulonglong(xpp, nelems, tp);
+#line 736
default:
+#line 736
assert("ncx_pad_putn_Iulonglong invalid type" == 0);
+#line 736
}
+#line 736
return NC_EBADTYPE;
+#line 736
}
+#line 736
static int
+#line 737
ncx_pad_getn_Iulonglong(const void **xpp, size_t nelems, ulonglong *tp, nc_type type)
+#line 737
{
+#line 737
switch(type) {
+#line 737
case NC_CHAR:
+#line 737
return NC_ECHAR;
+#line 737
case NC_BYTE:
+#line 737
return ncx_pad_getn_schar_ulonglong(xpp, nelems, tp);
+#line 737
case NC_SHORT:
+#line 737
return ncx_pad_getn_short_ulonglong(xpp, nelems, tp);
+#line 737
case NC_INT:
+#line 737
return ncx_getn_int_ulonglong(xpp, nelems, tp);
+#line 737
case NC_FLOAT:
+#line 737
return ncx_getn_float_ulonglong(xpp, nelems, tp);
+#line 737
case NC_DOUBLE:
+#line 737
return ncx_getn_double_ulonglong(xpp, nelems, tp);
+#line 737
case NC_UBYTE:
+#line 737
return ncx_pad_getn_uchar_ulonglong(xpp, nelems, tp);
+#line 737
case NC_USHORT:
+#line 737
return ncx_getn_ushort_ulonglong(xpp, nelems, tp);
+#line 737
case NC_UINT:
+#line 737
return ncx_getn_uint_ulonglong(xpp, nelems, tp);
+#line 737
case NC_INT64:
+#line 737
return ncx_getn_longlong_ulonglong(xpp, nelems, tp);
+#line 737
case NC_UINT64:
+#line 737
return ncx_getn_ulonglong_ulonglong(xpp, nelems, tp);
+#line 737
default:
+#line 737
assert("ncx_pad_getn_Iulonglong invalid type" == 0);
+#line 737
}
+#line 737
return NC_EBADTYPE;
+#line 737
}
+#line 737
diff --git a/libsrc/dim.c b/libsrc/dim.c
index 2386ee8..ef7dfb3 100644
--- a/libsrc/dim.c
+++ b/libsrc/dim.c
@@ -37,7 +37,6 @@ new_x_NC_dim(NC_string *name)
return NULL;
dimp->name = name;
- dimp->hash = hash_fast(name->cp, strlen(name->cp));
dimp->size = 0;
return(dimp);
@@ -127,7 +126,6 @@ NC_finddim(const NC_dimarray *ncap, const char *uname, NC_dim **dimpp)
{
int dimid;
- uint32_t shash;
NC_dim ** loc;
char *name;
@@ -139,27 +137,20 @@ NC_finddim(const NC_dimarray *ncap, const char *uname, NC_dim **dimpp)
{
dimid = 0;
loc = (NC_dim **) ncap->value;
+
/* normalized version of uname */
name = (char *)utf8proc_NFC((const unsigned char *)uname);
if(name == NULL)
return NC_ENOMEM;
- shash = hash_fast(name, strlen(name));
-
- for(; (size_t) dimid < ncap->nelems
- && ((*loc)->hash != shash
- || strncmp((*loc)->name->cp, name, strlen(name)) != 0);
- dimid++, loc++)
- {
- /*EMPTY*/
- }
+ dimid = (int)NC_hashmapGetDim(ncap, name);
free(name);
- if(dimid >= ncap->nelems)
- return(-1); /* not found */
- /* else, normal return */
- if(dimpp != NULL)
- *dimpp = *loc;
- return(dimid);
+ if (dimid >= 0) {
+ if (dimpp != NULL)
+ *dimpp = ncap->value[dimid];
+ }
+ return(dimid); /* Normal return */
}
+ return -1;
}
@@ -202,10 +193,13 @@ void
free_NC_dimarrayV(NC_dimarray *ncap)
{
assert(ncap != NULL);
-
+
if(ncap->nalloc == 0)
return;
+ NC_hashmapDelete(ncap->hashmap);
+ ncap->hashmap = NULL;
+
assert(ncap->value != NULL);
free_NC_dimarrayV0(ncap);
@@ -282,6 +276,7 @@ incr_NC_dimarray(NC_dimarray *ncap, NC_dim *newelemp)
return NC_ENOMEM;
ncap->value = vp;
ncap->nalloc = NC_ARRAY_GROWBY;
+ ncap->hashmap = NC_hashmapCreate(0);
}
else if(ncap->nelems +1 > ncap->nalloc)
{
@@ -295,6 +290,7 @@ incr_NC_dimarray(NC_dimarray *ncap, NC_dim *newelemp)
if(newelemp != NULL)
{
+ NC_hashmapAddDim(ncap, (long)ncap->nelems, newelemp->name->cp);
ncap->value[ncap->nelems] = newelemp;
ncap->nelems++;
}
@@ -469,30 +465,37 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname)
if(dimp == NULL)
return NC_EBADDIM;
+ NC_string *old = dimp->name;
newname = (char *)utf8proc_NFC((const unsigned char *)unewname);
if(newname == NULL)
return NC_ENOMEM;
if(NC_indef(ncp))
{
- NC_string *old = dimp->name;
NC_string *newStr = new_NC_string(strlen(newname), newname);
free(newname);
if(newStr == NULL)
return NC_ENOMEM;
dimp->name = newStr;
- dimp->hash = hash_fast(newStr->cp, strlen(newStr->cp));
+
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveDim(&ncp->dims, old->cp);
+ NC_hashmapAddDim(&ncp->dims, dimid, newStr->cp);
free_NC_string(old);
+
return NC_NOERR;
}
/* else, not in define mode */
status = set_NC_string(dimp->name, newname);
- dimp->hash = hash_fast(newname, strlen(newname));
free(newname);
if(status != NC_NOERR)
return status;
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveDim(&ncp->dims, old->cp);
+ NC_hashmapAddDim(&ncp->dims, dimid, dimp->name->cp);
+
set_NC_hdirty(ncp);
if(NC_doHsync(ncp))
diff --git a/libsrc/ffio.c b/libsrc/ffio.c
index 75dd03f..5f43e38 100644
--- a/libsrc/ffio.c
+++ b/libsrc/ffio.c
@@ -12,8 +12,8 @@
#include <stdlib.h>
#include <stdio.h> /* DEBUG */
#include <errno.h>
-#ifndef ENOERR
-#define ENOERR 0
+#ifndef NC_NOERR
+#define NC_NOERR 0
#endif
#include <fcntl.h>
#include <unistd.h>
@@ -81,7 +81,7 @@ fgrow(const int fd, const off_t len)
if (fffcntl(fd, FC_STAT, &sb, &sw) < 0)
return errno;
if (len < sb.st_size)
- return ENOERR;
+ return NC_NOERR;
{
const long dumb = 0;
/* cache current position */
@@ -96,7 +96,7 @@ fgrow(const int fd, const off_t len)
return errno;
}
/* else */
- return ENOERR;
+ return NC_NOERR;
}
@@ -113,7 +113,7 @@ fgrow2(const int fd, const off_t len)
if (fffcntl(fd, FC_STAT, &sb, &sw) < 0)
return errno;
if (len <= sb.st_size)
- return ENOERR;
+ return NC_NOERR;
{
const char dumb = 0;
/* we don't use ftruncate() due to problem with FAT32 file systems */
@@ -128,7 +128,7 @@ fgrow2(const int fd, const off_t len)
if (ffseek(fd, pos, SEEK_SET) < 0)
return errno;
}
- return ENOERR;
+ return NC_NOERR;
}
/* End OS */
/* Begin ffio */
@@ -157,7 +157,7 @@ ffio_pgout(ncio *const nciop,
}
*posp += extent;
- return ENOERR;
+ return NC_NOERR;
}
@@ -189,14 +189,14 @@ ffio_pgin(ncio *const nciop,
if(nread != extent)
{
status = errno;
- if(nread == -1 || status != ENOERR)
+ if(nread == -1 || status != NC_NOERR)
return status;
/* else it's okay we read 0. */
}
*nreadp = nread;
*posp += nread;
- return ENOERR;
+ return NC_NOERR;
}
/* */
@@ -215,7 +215,7 @@ static int
ncio_ffio_rel(ncio *const nciop, off_t offset, int rflags)
{
ncio_ffio *ffp = (ncio_ffio *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
assert(ffp->bf_offset <= offset);
assert(ffp->bf_cnt != 0);
@@ -248,7 +248,7 @@ ncio_ffio_get(ncio *const nciop,
void **const vpp)
{
ncio_ffio *ffp = (ncio_ffio *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
#ifdef X_ALIGN
size_t rem;
#endif
@@ -299,7 +299,7 @@ ncio_ffio_get(ncio *const nciop,
extent,
ffp->bf_base,
&ffp->bf_cnt, &ffp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
ffp->bf_offset = offset;
@@ -317,7 +317,7 @@ ncio_ffio_get(ncio *const nciop,
#else
*vpp = (char *)ffp->bf_base;
#endif
- return ENOERR;
+ return NC_NOERR;
}
@@ -325,7 +325,7 @@ static int
ncio_ffio_move(ncio *const nciop, off_t to, off_t from,
size_t nbytes, int rflags)
{
- int status = ENOERR;
+ int status = NC_NOERR;
off_t lower = from;
off_t upper = to;
char *base;
@@ -335,7 +335,7 @@ ncio_ffio_move(ncio *const nciop, off_t to, off_t from,
rflags &= RGN_NOLOCK; /* filter unwanted flags */
if(to == from)
- return ENOERR; /* NOOP */
+ return NC_NOERR; /* NOOP */
if(to > from)
{
@@ -356,7 +356,7 @@ ncio_ffio_move(ncio *const nciop, off_t to, off_t from,
status = ncio_ffio_get(nciop, lower, extent, RGN_WRITE|rflags,
(void **)&base);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(to > from)
@@ -382,7 +382,7 @@ ncio_ffio_sync_noffflush(ncio *const nciop)
/* run some innocuous ffio routine to get if any errno */
if(fffcntl(nciop->fd, FC_STAT, &si, &ffstatus) < 0)
return ffstatus.sw_error;
- return ENOERR;
+ return NC_NOERR;
}
/* this tests to see if the global FFIO layer is being called for
* returns ~0 if it is, else returns 0
@@ -408,7 +408,7 @@ ncio_ffio_sync(ncio *const nciop)
if(ffflush(nciop->fd) < 0)
#endif
return errno;
- return ENOERR;
+ return NC_NOERR;
}
static void
@@ -448,7 +448,7 @@ ncio_ffio_init2(ncio *const nciop, size_t *sizehintp)
return ENOMEM;
}
/* else */
- return ENOERR;
+ return NC_NOERR;
}
@@ -551,7 +551,7 @@ ncio_ffio_assign(const char *filename) {
/* put things into known states */
memset(buffer,'\0',BUFLEN);
- errno = ENOERR;
+ errno = NC_NOERR;
/* set up Fortran character pointers */
#ifdef __crayx1
@@ -673,13 +673,13 @@ ffio_create(const char *path, int ioflags,
}
status = ncio_ffio_init2(nciop, sizehintp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
if(initialsz != 0)
{
status = fgrow(fd, (off_t)initialsz);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
@@ -689,12 +689,12 @@ ffio_create(const char *path, int ioflags,
igeto, igetsz,
RGN_WRITE,
igetvpp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
*nciopp = nciop;
- return ENOERR;
+ return NC_NOERR;
unwind_open:
(void) ffclose(fd);
@@ -765,7 +765,7 @@ ffio_open(const char *path,
}
status = ncio_ffio_init2(nciop, sizehintp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
if(igetsz != 0)
@@ -774,12 +774,12 @@ ffio_open(const char *path,
igeto, igetsz,
0,
igetvpp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
*nciopp = nciop;
- return ENOERR;
+ return NC_NOERR;
unwind_open:
(void) ffclose(fd);
@@ -809,7 +809,7 @@ ncio_ffio_filesize(ncio *nciop, off_t *filesizep)
if(reset != current)
return EINVAL;
- return ENOERR;
+ return NC_NOERR;
}
@@ -823,7 +823,7 @@ ncio_ffio_filesize(ncio *nciop, off_t *filesizep)
static int
ncio_ffio_pad_length(ncio *nciop, off_t length)
{
- int status = ENOERR;
+ int status = NC_NOERR;
if(nciop == NULL)
return EINVAL;
@@ -832,13 +832,13 @@ ncio_ffio_pad_length(ncio *nciop, off_t length)
return EPERM; /* attempt to write readonly file */
status = nciop->sync(nciop);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = fgrow2(nciop->fd, length);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return errno;
- return ENOERR;
+ return NC_NOERR;
}
@@ -851,7 +851,7 @@ ncio_ffio_close(ncio *nciop, int doUnlink)
* 2002-07-10.
*/
- int status = ENOERR;
+ int status = NC_NOERR;
if(nciop == NULL)
return EINVAL;
diff --git a/libsrc/nc3internal.c b/libsrc/nc3internal.c
index 343d574..13e83ce 100644
--- a/libsrc/nc3internal.c
+++ b/libsrc/nc3internal.c
@@ -699,7 +699,7 @@ NC_check_vlens(NC3_INFO *ncp)
if (fIsSet(ncp->flags,NC_64BIT_DATA)) {
/* CDF5 format allows many large vars */
return NC_NOERR;
- }
+ }
if (fIsSet(ncp->flags,NC_64BIT_OFFSET) && sizeof(off_t) > 4) {
/* CDF2 format and LFS */
vlen_max = X_UINT_MAX - 3; /* "- 3" handles rounded-up size */
@@ -1582,7 +1582,7 @@ NC3_inq_format(int ncid, int *formatp)
else if (fIsSet(nc3->flags, NC_64BIT_OFFSET))
*formatp = NC_FORMAT_64BIT_OFFSET;
else
- *formatp = NC_FORMAT_CLASSIC;
+ *formatp = NC_FORMAT_CLASSIC;
return NC_NOERR;
}
@@ -1628,11 +1628,18 @@ NC3_inq_type(int ncid, nc_type typeid, char *name, size_t *size)
return stat;
/* Only netCDF classic model and CDF-5 need to be handled. */
+ /* After discussion, this seems like an artificial limitation.
+ See https://github.com/Unidata/netcdf-c/issues/240 for more
+ discussion. */
+ /*
if((ncp->mode & NC_CDF5) != 0) {
if (typeid < NC_BYTE || typeid > NC_STRING)
return NC_EBADTYPE;
} else if (typeid < NC_BYTE || typeid > NC_DOUBLE)
return NC_EBADTYPE;
+ */
+ if(typeid < NC_BYTE || typeid > NC_STRING)
+ return NC_EBADTYPE;
/* Give the user the values they want. Subtract one because types
* are numbered starting at 1, not 0. */
diff --git a/libsrc/nc_hashmap.c b/libsrc/nc_hashmap.c
new file mode 100644
index 0000000..638c5d9
--- /dev/null
+++ b/libsrc/nc_hashmap.c
@@ -0,0 +1,392 @@
+#include "nc_hashmap.h"
+#include "nc3internal.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+/* this should be prime */
+#define TABLE_STARTSIZE 1021
+
+#define ACTIVE 1
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+extern uint32_t hash_fast(const void *key, size_t length);
+
+/* NOTE: 'data' is the dimid or varid which is non-negative.
+ we store the dimid+1 so a valid entry will have
+ data > 0
+*/
+typedef struct {
+ long data;
+ int flags;
+ unsigned long key;
+} hEntry;
+
+struct s_hashmap{
+ hEntry* table;
+ unsigned long size;
+ unsigned long count;
+};
+
+static int isPrime(unsigned long val)
+{
+ int i;
+
+ for (i = 9; i--;)
+ {
+#ifdef HAVE_RANDOM
+ unsigned long a = ((unsigned long)random() % (val-4)) + 2;
+#else
+ unsigned long a = ((unsigned long)rand() % (val - 4)) + 2;
+#endif
+ unsigned long p = 1;
+ unsigned long exp = val-1;
+ while (exp)
+ {
+ if (exp & 1)
+ p = (p*a)%val;
+
+ a = (a*a)%val;
+ exp >>= 1;
+ }
+
+ if (p != 1)
+ return 0;
+ }
+
+ return 1;
+}
+
+static unsigned long findPrimeGreaterThan(unsigned long val)
+{
+ if (val & 1)
+ val+=2;
+ else
+ val++;
+
+ while (!isPrime(val))
+ val+=2;
+
+ return val;
+}
+
+static void rehashDim(const NC_dimarray* ncap)
+{
+ NC_hashmap* hm = ncap->hashmap;
+ unsigned long size = hm->size;
+ unsigned long count = hm->count;
+
+ hEntry* table = hm->table;
+
+ hm->size = findPrimeGreaterThan(size<<1);
+ hm->table = (hEntry*)calloc(sizeof(hEntry), hm->size);
+ hm->count = 0;
+
+ while(size > 0) {
+ --size;
+ if (table[size].flags == ACTIVE) {
+ NC_dim *elem = ncap->value[table[size].data-1];
+ NC_hashmapAddDim(ncap, table[size].data-1, elem->name->cp);
+ assert(NC_hashmapGetDim(ncap, elem->name->cp) == table[size].data-1);
+ }
+ }
+
+ free(table);
+ assert(count == hm->count);
+}
+
+static void rehashVar(const NC_vararray* ncap)
+{
+ NC_hashmap* hm = ncap->hashmap;
+ unsigned long size = hm->size;
+ unsigned long count = hm->count;
+
+ hEntry* table = hm->table;
+
+ hm->size = findPrimeGreaterThan(size<<1);
+ hm->table = (hEntry*)calloc(sizeof(hEntry), (size_t)hm->size);
+ hm->count = 0;
+
+ while(size > 0) {
+ --size;
+ if (table[size].flags == ACTIVE) {
+ NC_var *elem = ncap->value[table[size].data-1];
+ NC_hashmapAddVar(ncap, table[size].data-1, elem->name->cp);
+ assert(NC_hashmapGetVar(ncap, elem->name->cp) == table[size].data-1);
+ }
+ }
+
+ free(table);
+ assert(count == hm->count);
+}
+
+NC_hashmap* NC_hashmapCreate(unsigned long startsize)
+{
+ NC_hashmap* hm = (NC_hashmap*)malloc(sizeof(NC_hashmap));
+
+ if (!startsize)
+ startsize = TABLE_STARTSIZE;
+ else {
+ startsize *= 4;
+ startsize /= 3;
+ startsize = findPrimeGreaterThan(startsize-2);
+ }
+
+ hm->table = (hEntry*)calloc(sizeof(hEntry), (size_t)startsize);
+ hm->size = startsize;
+ hm->count = 0;
+
+ return hm;
+}
+
+void NC_hashmapAddDim(const NC_dimarray* ncap, long data, const char *name)
+{
+ unsigned long key = hash_fast(name, strlen(name));
+ NC_hashmap* hash = ncap->hashmap;
+
+ if (hash->size*3/4 <= hash->count) {
+ rehashDim(ncap);
+ }
+
+ do
+ {
+ unsigned long i;
+ unsigned long index = key % hash->size;
+ unsigned long step = (key % MAX(1,(hash->size-2))) + 1;
+
+ for (i = 0; i < hash->size; i++)
+ {
+ if (hash->table[index].flags & ACTIVE)
+ {
+ hEntry entry = hash->table[index];
+ if (entry.key == key &&
+ strncmp(name, ncap->value[entry.data-1]->name->cp,
+ ncap->value[entry.data-1]->name->nchars) == 0)
+ {
+ hash->table[index].data = data+1;
+ return;
+ }
+ }
+ else
+ {
+ hash->table[index].flags |= ACTIVE;
+ hash->table[index].data = data+1;
+ hash->table[index].key = key;
+ ++hash->count;
+ return;
+ }
+
+ index = (index + step) % hash->size;
+ }
+
+ /* it should not be possible that we EVER come this far, but unfortunately
+ not every generated prime number is prime (Carmichael numbers...) */
+ rehashDim(ncap);
+ }
+ while (1);
+}
+
+void NC_hashmapAddVar(const NC_vararray* ncap, long data, const char *name)
+{
+ unsigned long key = hash_fast(name, strlen(name));
+ NC_hashmap* hash = ncap->hashmap;
+
+ if (hash->size*3/4 <= hash->count) {
+ rehashVar(ncap);
+ }
+
+ do
+ {
+ unsigned long i;
+ unsigned long index = key % hash->size;
+ unsigned long step = (key % MAX(1,(hash->size-2))) + 1;
+
+ for (i = 0; i < hash->size; i++)
+ {
+ if (hash->table[index].flags & ACTIVE)
+ {
+ hEntry entry = hash->table[index];
+ if (entry.key == key &&
+ strncmp(name, ncap->value[entry.data-1]->name->cp,
+ ncap->value[entry.data-1]->name->nchars) == 0)
+ {
+ hash->table[index].data = data+1;
+ return;
+ }
+ }
+ else
+ {
+ hash->table[index].flags |= ACTIVE;
+ hash->table[index].data = data+1;
+ hash->table[index].key = key;
+ ++hash->count;
+ return;
+ }
+
+ index = (index + step) % hash->size;
+ }
+
+ /* it should not be possible that we EVER come this far, but unfortunately
+ not every generated prime number is prime (Carmichael numbers...) */
+ rehashVar(ncap);
+ }
+ while (1);
+}
+
+long NC_hashmapRemoveDim(const NC_dimarray* ncap, const char *name)
+{
+ unsigned long i;
+ unsigned long key = hash_fast(name, strlen(name));
+ NC_hashmap* hash = ncap->hashmap;
+
+ unsigned long index = key % hash->size;
+ unsigned long step = (key % (hash->size-2)) + 1;
+
+ for (i = 0; i < hash->size; i++)
+ {
+ if (hash->table[index].data > 0)
+ {
+ hEntry entry = hash->table[index];
+ if (entry.key == key &&
+ strncmp(name, ncap->value[entry.data-1]->name->cp,
+ ncap->value[entry.data-1]->name->nchars) == 0)
+ {
+ if (hash->table[index].flags & ACTIVE)
+ {
+ hash->table[index].flags &= ~ACTIVE;
+ --hash->count;
+ return hash->table[index].data-1;
+ }
+ else /* in, but not active (i.e. deleted) */
+ return -1;
+ }
+ }
+ else /* found an empty place (can't be in) */
+ return -1;
+
+ index = (index + step) % hash->size;
+ }
+ /* everything searched through, but not in */
+ return -1;
+}
+
+long NC_hashmapRemoveVar(const NC_vararray* ncap, const char *name)
+{
+ unsigned long i;
+ unsigned long key = hash_fast(name, strlen(name));
+ NC_hashmap* hash = ncap->hashmap;
+
+ unsigned long index = key % hash->size;
+ unsigned long step = (key % (hash->size-2)) + 1;
+
+ for (i = 0; i < hash->size; i++)
+ {
+ if (hash->table[index].data > 0)
+ {
+ hEntry entry = hash->table[index];
+ if (entry.key == key &&
+ strncmp(name, ncap->value[entry.data-1]->name->cp,
+ ncap->value[entry.data-1]->name->nchars) == 0)
+ {
+ if (hash->table[index].flags & ACTIVE)
+ {
+ hash->table[index].flags &= ~ACTIVE;
+ --hash->count;
+ return hash->table[index].data-1;
+ }
+ else /* in, but not active (i.e. deleted) */
+ return -1;
+ }
+ }
+ else /* found an empty place (can't be in) */
+ return -1;
+
+ index = (index + step) % hash->size;
+ }
+ /* everything searched through, but not in */
+ return -1;
+}
+
+long NC_hashmapGetDim(const NC_dimarray* ncap, const char *name)
+{
+ NC_hashmap* hash = ncap->hashmap;
+ if (hash->count)
+ {
+ unsigned long key = hash_fast(name, strlen(name));
+ NC_hashmap* hash = ncap->hashmap;
+
+ unsigned long i;
+ unsigned long index = key % hash->size;
+ unsigned long step = (key % (hash->size-2)) + 1;
+
+ for (i = 0; i < hash->size; i++)
+ {
+ hEntry entry = hash->table[index];
+ if (entry.key == key &&
+ strncmp(name, ncap->value[entry.data-1]->name->cp,
+ ncap->value[entry.data-1]->name->nchars) == 0)
+ {
+ if (entry.flags & ACTIVE)
+ return entry.data-1;
+ break;
+ }
+ else
+ if (!(entry.flags & ACTIVE))
+ break;
+
+ index = (index + step) % hash->size;
+ }
+ }
+
+ return -1;
+}
+
+long NC_hashmapGetVar(const NC_vararray* ncap, const char *name)
+{
+ NC_hashmap* hash = ncap->hashmap;
+ if (hash->count)
+ {
+ unsigned long key = hash_fast(name, strlen(name));
+ NC_hashmap* hash = ncap->hashmap;
+
+ unsigned long i;
+ unsigned long index = key % hash->size;
+ unsigned long step = (key % (hash->size-2)) + 1;
+
+ for (i = 0; i < hash->size; i++)
+ {
+ hEntry entry = hash->table[index];
+ if (entry.key == key &&
+ strncmp(name, ncap->value[entry.data-1]->name->cp,
+ ncap->value[entry.data-1]->name->nchars) == 0)
+ {
+ if (entry.flags & ACTIVE)
+ return entry.data-1;
+ break;
+ }
+ else
+ if (!(entry.flags & ACTIVE))
+ break;
+
+ index = (index + step) % hash->size;
+ }
+ }
+
+ return -1;
+}
+
+unsigned long NC_hashmapCount(NC_hashmap* hash)
+{
+ return hash->count;
+}
+
+void NC_hashmapDelete(NC_hashmap* hash)
+{
+ if (hash) {
+ free(hash->table);
+ free(hash);
+ }
+}
diff --git a/libsrc/ncx.c b/libsrc/ncx.c
index 9272bfc..993cf03 100644
--- a/libsrc/ncx.c
+++ b/libsrc/ncx.c
@@ -1,4 +1,6 @@
+#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.
@@ -351,24 +353,35 @@ swapn8b(void *dst, const void *src, size_t nn)
#endif /* LITTLE_ENDIAN */
+#line 388
+#line 396
+#line 404
+#line 411
+#line 419
+#line 427
+#line 435
/*
* Primitive numeric conversion functions.
*/
+#line 457
+#line 483
+#line 499
+#line 524
/* x_schar */
/* x_uchar */
@@ -422,143 +435,272 @@ put_ix_short(void *xp, const ix_short *ip)
}
static int
+#line 576
ncx_get_short_schar(const void *xp, schar *ip)
+#line 576
{
+#line 576
ix_short xx;
+#line 576
get_ix_short(xp, &xx);
+#line 576
*ip = (schar) xx;
+#line 576
#if IX_SHORT_MAX > SCHAR_MAX
+#line 576
if (xx > SCHAR_MAX || xx < SCHAR_MIN) return NC_ERANGE;
+#line 576
#endif
+#line 576
- return ENOERR;
+#line 576
+ return NC_NOERR;
+#line 576
}
+#line 576
static int
+#line 577
ncx_get_short_short(const void *xp, short *ip)
+#line 577
{
+#line 577
#if SIZEOF_IX_SHORT == SIZEOF_SHORT && IX_SHORT_MAX == SHORT_MAX
+#line 577
get_ix_short(xp, (ix_short *)ip);
- return ENOERR;
+#line 577
+ return NC_NOERR;
+#line 577
#else
+#line 577
ix_short xx;
+#line 577
get_ix_short(xp, &xx);
+#line 577
*ip = (short) xx;
+#line 577
#if IX_SHORT_MAX > SHORT_MAX
+#line 577
if (xx > SHORT_MAX || xx < SHORT_MIN) return NC_ERANGE;
+#line 577
#endif
+#line 577
+#line 577
#endif
- return ENOERR;
+#line 577
+ return NC_NOERR;
+#line 577
}
+#line 577
static int
+#line 578
ncx_get_short_int(const void *xp, int *ip)
+#line 578
{
+#line 578
#if SIZEOF_IX_SHORT == SIZEOF_INT && IX_SHORT_MAX == INT_MAX
+#line 578
get_ix_short(xp, (ix_short *)ip);
- return ENOERR;
+#line 578
+ return NC_NOERR;
+#line 578
#else
+#line 578
ix_short xx;
+#line 578
get_ix_short(xp, &xx);
+#line 578
*ip = (int) xx;
+#line 578
#if IX_SHORT_MAX > INT_MAX
+#line 578
if (xx > INT_MAX || xx < INT_MIN) return NC_ERANGE;
+#line 578
#endif
+#line 578
+#line 578
#endif
- return ENOERR;
+#line 578
+ return NC_NOERR;
+#line 578
}
+#line 578
static int
+#line 579
ncx_get_short_longlong(const void *xp, longlong *ip)
+#line 579
{
+#line 579
#if SIZEOF_IX_SHORT == SIZEOF_LONGLONG && IX_SHORT_MAX == LONGLONG_MAX
+#line 579
get_ix_short(xp, (ix_short *)ip);
- return ENOERR;
+#line 579
+ return NC_NOERR;
+#line 579
#else
+#line 579
ix_short xx;
+#line 579
get_ix_short(xp, &xx);
+#line 579
*ip = (longlong) xx;
+#line 579
#if IX_SHORT_MAX > LONGLONG_MAX
+#line 579
if (xx > LONGLONG_MAX || xx < LONGLONG_MIN) return NC_ERANGE;
+#line 579
#endif
+#line 579
+#line 579
#endif
- return ENOERR;
+#line 579
+ return NC_NOERR;
+#line 579
}
+#line 579
static int
+#line 580
ncx_get_short_ushort(const void *xp, ushort *ip)
+#line 580
{
+#line 580
ix_short xx;
+#line 580
get_ix_short(xp, &xx);
+#line 580
*ip = (ushort) xx;
+#line 580
#if IX_SHORT_MAX > USHORT_MAX
+#line 580
if (xx > USHORT_MAX) return NC_ERANGE;
+#line 580
#endif
+#line 580
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 580
+ return NC_NOERR;
+#line 580
}
+#line 580
static int
+#line 581
ncx_get_short_uchar(const void *xp, uchar *ip)
+#line 581
{
+#line 581
ix_short xx;
+#line 581
get_ix_short(xp, &xx);
+#line 581
*ip = (uchar) xx;
+#line 581
#if IX_SHORT_MAX > UCHAR_MAX
+#line 581
if (xx > UCHAR_MAX) return NC_ERANGE;
+#line 581
#endif
+#line 581
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 581
+ return NC_NOERR;
+#line 581
}
+#line 581
static int
+#line 582
ncx_get_short_uint(const void *xp, uint *ip)
+#line 582
{
+#line 582
ix_short xx;
+#line 582
get_ix_short(xp, &xx);
+#line 582
*ip = (uint) xx;
+#line 582
#if IX_SHORT_MAX > UINT_MAX
+#line 582
if (xx > UINT_MAX) return NC_ERANGE;
+#line 582
#endif
+#line 582
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 582
+ return NC_NOERR;
+#line 582
}
+#line 582
static int
+#line 583
ncx_get_short_ulonglong(const void *xp, ulonglong *ip)
+#line 583
{
+#line 583
ix_short xx;
+#line 583
get_ix_short(xp, &xx);
+#line 583
*ip = (ulonglong) xx;
+#line 583
#if IX_SHORT_MAX > ULONGLONG_MAX
+#line 583
if (xx > ULONGLONG_MAX) return NC_ERANGE;
+#line 583
#endif
+#line 583
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 583
+ return NC_NOERR;
+#line 583
}
+#line 583
static int
+#line 584
ncx_get_short_float(const void *xp, float *ip)
+#line 584
{
+#line 584
ix_short xx;
+#line 584
get_ix_short(xp, &xx);
+#line 584
*ip = (float) xx;
+#line 584
- return ENOERR;
+#line 584
+ return NC_NOERR;
+#line 584
}
+#line 584
static int
+#line 585
ncx_get_short_double(const void *xp, double *ip)
+#line 585
{
+#line 585
ix_short xx;
+#line 585
get_ix_short(xp, &xx);
+#line 585
*ip = (double) xx;
+#line 585
- return ENOERR;
+#line 585
+ return NC_NOERR;
+#line 585
}
+#line 585
static int
@@ -569,8 +711,8 @@ ncx_put_short_schar(void *xp, const schar *ip)
*cp++ = 0xff;
else
*cp++ = 0;
- *cp = (uchar)*ip;
- return ENOERR;
+ *cp = (uchar)(signed)*ip;
+ return NC_NOERR;
}
static int
@@ -579,113 +721,210 @@ ncx_put_short_uchar(void *xp, const uchar *ip)
uchar *cp = (uchar *) xp;
*cp++ = 0;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
static int
+#line 608
ncx_put_short_short(void *xp, const short *ip)
+#line 608
{
+#line 608
#if SIZEOF_IX_SHORT == SIZEOF_SHORT && IX_SHORT_MAX == SHORT_MAX
+#line 608
put_ix_short(xp, (const ix_short *)ip);
- return ENOERR;
+#line 608
+ return NC_NOERR;
+#line 608
#else
+#line 608
ix_short xx = (ix_short)*ip;
+#line 608
put_ix_short(xp, &xx);
+#line 608
#if IX_SHORT_MAX < SHORT_MAX
+#line 608
if (*ip > IX_SHORT_MAX || *ip < X_SHORT_MIN) return NC_ERANGE;
+#line 608
#endif
+#line 608
+#line 608
#endif
- return ENOERR;
+#line 608
+ return NC_NOERR;
+#line 608
}
+#line 608
static int
+#line 609
ncx_put_short_int(void *xp, const int *ip)
+#line 609
{
+#line 609
#if SIZEOF_IX_SHORT == SIZEOF_INT && IX_SHORT_MAX == INT_MAX
+#line 609
put_ix_short(xp, (const ix_short *)ip);
- return ENOERR;
+#line 609
+ return NC_NOERR;
+#line 609
#else
+#line 609
ix_short xx = (ix_short)*ip;
+#line 609
put_ix_short(xp, &xx);
+#line 609
#if IX_SHORT_MAX < INT_MAX
+#line 609
if (*ip > IX_SHORT_MAX || *ip < X_SHORT_MIN) return NC_ERANGE;
+#line 609
#endif
+#line 609
+#line 609
#endif
- return ENOERR;
+#line 609
+ return NC_NOERR;
+#line 609
}
+#line 609
static int
+#line 610
ncx_put_short_longlong(void *xp, const longlong *ip)
+#line 610
{
+#line 610
#if SIZEOF_IX_SHORT == SIZEOF_LONGLONG && IX_SHORT_MAX == LONGLONG_MAX
+#line 610
put_ix_short(xp, (const ix_short *)ip);
- return ENOERR;
+#line 610
+ return NC_NOERR;
+#line 610
#else
+#line 610
ix_short xx = (ix_short)*ip;
+#line 610
put_ix_short(xp, &xx);
+#line 610
#if IX_SHORT_MAX < LONGLONG_MAX
+#line 610
if (*ip > IX_SHORT_MAX || *ip < X_SHORT_MIN) return NC_ERANGE;
+#line 610
#endif
+#line 610
+#line 610
#endif
- return ENOERR;
+#line 610
+ return NC_NOERR;
+#line 610
}
+#line 610
static int
+#line 611
ncx_put_short_ushort(void *xp, const ushort *ip)
+#line 611
{
+#line 611
ix_short xx = (ix_short)*ip;
+#line 611
put_ix_short(xp, &xx);
+#line 611
#if IX_SHORT_MAX < USHORT_MAX
+#line 611
if (*ip > IX_SHORT_MAX) return NC_ERANGE;
+#line 611
#endif
+#line 611
- return ENOERR;
+#line 611
+ return NC_NOERR;
+#line 611
}
+#line 611
static int
+#line 612
ncx_put_short_uint(void *xp, const uint *ip)
+#line 612
{
+#line 612
ix_short xx = (ix_short)*ip;
+#line 612
put_ix_short(xp, &xx);
+#line 612
#if IX_SHORT_MAX < UINT_MAX
+#line 612
if (*ip > IX_SHORT_MAX) return NC_ERANGE;
+#line 612
#endif
+#line 612
- return ENOERR;
+#line 612
+ return NC_NOERR;
+#line 612
}
+#line 612
static int
+#line 613
ncx_put_short_ulonglong(void *xp, const ulonglong *ip)
+#line 613
{
+#line 613
ix_short xx = (ix_short)*ip;
+#line 613
put_ix_short(xp, &xx);
+#line 613
#if IX_SHORT_MAX < ULONGLONG_MAX
+#line 613
if (*ip > IX_SHORT_MAX) return NC_ERANGE;
+#line 613
#endif
+#line 613
- return ENOERR;
+#line 613
+ return NC_NOERR;
+#line 613
}
+#line 613
static int
+#line 614
ncx_put_short_float(void *xp, const float *ip)
+#line 614
{
+#line 614
ix_short xx = (ix_short)*ip;
+#line 614
put_ix_short(xp, &xx);
+#line 614
if(*ip > (double)X_SHORT_MAX || *ip < (double)X_SHORT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 614
+ return NC_NOERR;
+#line 614
}
+#line 614
static int
+#line 615
ncx_put_short_double(void *xp, const double *ip)
+#line 615
{
+#line 615
ix_short xx = (ix_short)*ip;
+#line 615
put_ix_short(xp, &xx);
+#line 615
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 615
+ return NC_NOERR;
+#line 615
}
+#line 615
/* x_ushort ------------------------------------------------------------------*/
@@ -722,7 +961,7 @@ get_ix_ushort(const void *xp, ix_ushort *ip)
*ip |= (~(0xffff)); /* N.B. Assumes "twos complement" */
}
#endif
- *ip |= *cp;
+ *ip |= *cp;
}
static void
@@ -734,148 +973,282 @@ put_ix_ushort(void *xp, const ix_ushort *ip)
}
static int
+#line 662
ncx_get_ushort_schar(const void *xp, schar *ip)
+#line 662
{
+#line 662
ix_ushort xx;
+#line 662
get_ix_ushort(xp, &xx);
+#line 662
*ip = (schar) xx;
+#line 662
#if IX_USHORT_MAX > SCHAR_MAX
+#line 662
if (xx > SCHAR_MAX) return NC_ERANGE;
+#line 662
#endif
+#line 662
- return ENOERR;
+#line 662
+ return NC_NOERR;
+#line 662
}
+#line 662
static int
+#line 663
ncx_get_ushort_short(const void *xp, short *ip)
+#line 663
{
+#line 663
ix_ushort xx;
+#line 663
get_ix_ushort(xp, &xx);
+#line 663
*ip = (short) xx;
+#line 663
#if IX_USHORT_MAX > SHORT_MAX
+#line 663
if (xx > SHORT_MAX) return NC_ERANGE;
+#line 663
#endif
+#line 663
- return ENOERR;
+#line 663
+ return NC_NOERR;
+#line 663
}
+#line 663
static int
+#line 664
ncx_get_ushort_int(const void *xp, int *ip)
+#line 664
{
+#line 664
ix_ushort xx;
+#line 664
get_ix_ushort(xp, &xx);
+#line 664
*ip = (int) xx;
+#line 664
#if IX_USHORT_MAX > INT_MAX
+#line 664
if (xx > INT_MAX) return NC_ERANGE;
+#line 664
#endif
+#line 664
- return ENOERR;
+#line 664
+ return NC_NOERR;
+#line 664
}
+#line 664
static int
+#line 665
ncx_get_ushort_longlong(const void *xp, longlong *ip)
+#line 665
{
+#line 665
ix_ushort xx;
+#line 665
get_ix_ushort(xp, &xx);
+#line 665
*ip = (longlong) xx;
+#line 665
#if IX_USHORT_MAX > LONGLONG_MAX
+#line 665
if (xx > LONGLONG_MAX) return NC_ERANGE;
+#line 665
#endif
+#line 665
- return ENOERR;
+#line 665
+ return NC_NOERR;
+#line 665
}
+#line 665
static int
+#line 666
ncx_get_ushort_ushort(const void *xp, ushort *ip)
+#line 666
{
+#line 666
#if SIZEOF_IX_USHORT == SIZEOF_USHORT && IX_USHORT_MAX == USHORT_MAX
+#line 666
get_ix_ushort(xp, (ix_ushort *)ip);
- return ENOERR;
+#line 666
+ return NC_NOERR;
+#line 666
#else
+#line 666
ix_ushort xx;
+#line 666
get_ix_ushort(xp, &xx);
+#line 666
*ip = (ushort) xx;
+#line 666
#if IX_USHORT_MAX > USHORT_MAX
+#line 666
if (xx > USHORT_MAX) return NC_ERANGE;
+#line 666
#endif
+#line 666
+#line 666
#endif
- return ENOERR;
+#line 666
+ return NC_NOERR;
+#line 666
}
+#line 666
static int
+#line 667
ncx_get_ushort_uchar(const void *xp, uchar *ip)
+#line 667
{
+#line 667
#if SIZEOF_IX_USHORT == SIZEOF_UCHAR && IX_USHORT_MAX == UCHAR_MAX
+#line 667
get_ix_ushort(xp, (ix_ushort *)ip);
- return ENOERR;
+#line 667
+ return NC_NOERR;
+#line 667
#else
+#line 667
ix_ushort xx;
+#line 667
get_ix_ushort(xp, &xx);
+#line 667
*ip = (uchar) xx;
+#line 667
#if IX_USHORT_MAX > UCHAR_MAX
+#line 667
if (xx > UCHAR_MAX) return NC_ERANGE;
+#line 667
#endif
+#line 667
+#line 667
#endif
- return ENOERR;
+#line 667
+ return NC_NOERR;
+#line 667
}
+#line 667
static int
+#line 668
ncx_get_ushort_uint(const void *xp, uint *ip)
+#line 668
{
+#line 668
#if SIZEOF_IX_USHORT == SIZEOF_UINT && IX_USHORT_MAX == UINT_MAX
+#line 668
get_ix_ushort(xp, (ix_ushort *)ip);
- return ENOERR;
+#line 668
+ return NC_NOERR;
+#line 668
#else
+#line 668
ix_ushort xx;
+#line 668
get_ix_ushort(xp, &xx);
+#line 668
*ip = (uint) xx;
+#line 668
#if IX_USHORT_MAX > UINT_MAX
+#line 668
if (xx > UINT_MAX) return NC_ERANGE;
+#line 668
#endif
+#line 668
+#line 668
#endif
- return ENOERR;
+#line 668
+ return NC_NOERR;
+#line 668
}
+#line 668
static int
+#line 669
ncx_get_ushort_ulonglong(const void *xp, ulonglong *ip)
+#line 669
{
+#line 669
#if SIZEOF_IX_USHORT == SIZEOF_ULONGLONG && IX_USHORT_MAX == ULONGLONG_MAX
+#line 669
get_ix_ushort(xp, (ix_ushort *)ip);
- return ENOERR;
+#line 669
+ return NC_NOERR;
+#line 669
#else
+#line 669
ix_ushort xx;
+#line 669
get_ix_ushort(xp, &xx);
+#line 669
*ip = (ulonglong) xx;
+#line 669
#if IX_USHORT_MAX > ULONGLONG_MAX
+#line 669
if (xx > ULONGLONG_MAX) return NC_ERANGE;
+#line 669
#endif
+#line 669
+#line 669
#endif
- return ENOERR;
+#line 669
+ return NC_NOERR;
+#line 669
}
+#line 669
static int
+#line 670
ncx_get_ushort_float(const void *xp, float *ip)
+#line 670
{
+#line 670
ix_ushort xx;
+#line 670
get_ix_ushort(xp, &xx);
+#line 670
*ip = (float) xx;
+#line 670
- return ENOERR;
+#line 670
+ return NC_NOERR;
+#line 670
}
+#line 670
static int
+#line 671
ncx_get_ushort_double(const void *xp, double *ip)
+#line 671
{
+#line 671
ix_ushort xx;
+#line 671
get_ix_ushort(xp, &xx);
+#line 671
*ip = (double) xx;
+#line 671
- return ENOERR;
+#line 671
+ return NC_NOERR;
+#line 671
}
+#line 671
static int
@@ -886,10 +1259,10 @@ ncx_put_ushort_schar(void *xp, const schar *ip)
*cp++ = 0xff;
else
*cp++ = 0;
- *cp = (uchar)*ip;
+ *cp = (uchar)(signed)*ip;
if (*ip < 0) return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -898,113 +1271,210 @@ ncx_put_ushort_uchar(void *xp, const uchar *ip)
uchar *cp = (uchar *) xp;
*cp++ = 0;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
static int
+#line 696
ncx_put_ushort_short(void *xp, const short *ip)
+#line 696
{
+#line 696
ix_ushort xx = (ix_ushort)*ip;
+#line 696
put_ix_ushort(xp, &xx);
+#line 696
#if IX_USHORT_MAX < SHORT_MAX
+#line 696
if (*ip > IX_USHORT_MAX) return NC_ERANGE;
+#line 696
#endif
+#line 696
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 696
+ return NC_NOERR;
+#line 696
}
+#line 696
static int
+#line 697
ncx_put_ushort_int(void *xp, const int *ip)
+#line 697
{
+#line 697
ix_ushort xx = (ix_ushort)*ip;
+#line 697
put_ix_ushort(xp, &xx);
+#line 697
#if IX_USHORT_MAX < INT_MAX
+#line 697
if (*ip > IX_USHORT_MAX) return NC_ERANGE;
+#line 697
#endif
+#line 697
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 697
+ return NC_NOERR;
+#line 697
}
+#line 697
static int
+#line 698
ncx_put_ushort_longlong(void *xp, const longlong *ip)
+#line 698
{
+#line 698
ix_ushort xx = (ix_ushort)*ip;
+#line 698
put_ix_ushort(xp, &xx);
+#line 698
#if IX_USHORT_MAX < LONGLONG_MAX
+#line 698
if (*ip > IX_USHORT_MAX) return NC_ERANGE;
+#line 698
#endif
+#line 698
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 698
+ return NC_NOERR;
+#line 698
}
+#line 698
static int
+#line 699
ncx_put_ushort_ushort(void *xp, const ushort *ip)
+#line 699
{
+#line 699
#if SIZEOF_IX_USHORT == SIZEOF_USHORT && IX_USHORT_MAX == USHORT_MAX
+#line 699
put_ix_ushort(xp, (const ix_ushort *)ip);
- return ENOERR;
+#line 699
+ return NC_NOERR;
+#line 699
#else
+#line 699
ix_ushort xx = (ix_ushort)*ip;
+#line 699
put_ix_ushort(xp, &xx);
+#line 699
#if IX_USHORT_MAX < USHORT_MAX
+#line 699
if (*ip > IX_USHORT_MAX) return NC_ERANGE;
+#line 699
#endif
+#line 699
+#line 699
#endif
- return ENOERR;
+#line 699
+ return NC_NOERR;
+#line 699
}
+#line 699
static int
+#line 700
ncx_put_ushort_uint(void *xp, const uint *ip)
+#line 700
{
+#line 700
#if SIZEOF_IX_USHORT == SIZEOF_UINT && IX_USHORT_MAX == UINT_MAX
+#line 700
put_ix_ushort(xp, (const ix_ushort *)ip);
- return ENOERR;
+#line 700
+ return NC_NOERR;
+#line 700
#else
+#line 700
ix_ushort xx = (ix_ushort)*ip;
+#line 700
put_ix_ushort(xp, &xx);
+#line 700
#if IX_USHORT_MAX < UINT_MAX
+#line 700
if (*ip > IX_USHORT_MAX) return NC_ERANGE;
+#line 700
#endif
+#line 700
+#line 700
#endif
- return ENOERR;
+#line 700
+ return NC_NOERR;
+#line 700
}
+#line 700
static int
+#line 701
ncx_put_ushort_ulonglong(void *xp, const ulonglong *ip)
+#line 701
{
+#line 701
#if SIZEOF_IX_USHORT == SIZEOF_ULONGLONG && IX_USHORT_MAX == ULONGLONG_MAX
+#line 701
put_ix_ushort(xp, (const ix_ushort *)ip);
- return ENOERR;
+#line 701
+ return NC_NOERR;
+#line 701
#else
+#line 701
ix_ushort xx = (ix_ushort)*ip;
+#line 701
put_ix_ushort(xp, &xx);
+#line 701
#if IX_USHORT_MAX < ULONGLONG_MAX
+#line 701
if (*ip > IX_USHORT_MAX) return NC_ERANGE;
+#line 701
#endif
+#line 701
+#line 701
#endif
- return ENOERR;
+#line 701
+ return NC_NOERR;
+#line 701
}
+#line 701
static int
+#line 702
ncx_put_ushort_float(void *xp, const float *ip)
+#line 702
{
+#line 702
ix_ushort xx = (ix_ushort)*ip;
+#line 702
put_ix_ushort(xp, &xx);
+#line 702
if(*ip > (double)X_USHORT_MAX || *ip < 0) return NC_ERANGE;
- return ENOERR;
+#line 702
+ return NC_NOERR;
+#line 702
}
+#line 702
static int
+#line 703
ncx_put_ushort_double(void *xp, const double *ip)
+#line 703
{
+#line 703
ix_ushort xx = (ix_ushort)*ip;
+#line 703
put_ix_ushort(xp, &xx);
+#line 703
if(*ip > X_USHORT_MAX || *ip < 0) return NC_ERANGE;
- return ENOERR;
+#line 703
+ return NC_NOERR;
+#line 703
}
+#line 703
/* x_int ---------------------------------------------------------------------*/
@@ -1056,143 +1526,272 @@ put_ix_int(void *xp, const ix_int *ip)
}
static int
+#line 753
ncx_get_int_schar(const void *xp, schar *ip)
+#line 753
{
+#line 753
ix_int xx;
+#line 753
get_ix_int(xp, &xx);
+#line 753
*ip = (schar) xx;
+#line 753
#if IX_INT_MAX > SCHAR_MAX
+#line 753
if (xx > SCHAR_MAX || xx < SCHAR_MIN) return NC_ERANGE;
+#line 753
#endif
+#line 753
- return ENOERR;
+#line 753
+ return NC_NOERR;
+#line 753
}
+#line 753
static int
+#line 754
ncx_get_int_short(const void *xp, short *ip)
+#line 754
{
+#line 754
#if SIZEOF_IX_INT == SIZEOF_SHORT && IX_INT_MAX == SHORT_MAX
+#line 754
get_ix_int(xp, (ix_int *)ip);
- return ENOERR;
+#line 754
+ return NC_NOERR;
+#line 754
#else
+#line 754
ix_int xx;
+#line 754
get_ix_int(xp, &xx);
+#line 754
*ip = (short) xx;
+#line 754
#if IX_INT_MAX > SHORT_MAX
+#line 754
if (xx > SHORT_MAX || xx < SHORT_MIN) return NC_ERANGE;
+#line 754
#endif
+#line 754
+#line 754
#endif
- return ENOERR;
+#line 754
+ return NC_NOERR;
+#line 754
}
+#line 754
int
+#line 755
ncx_get_int_int(const void *xp, int *ip)
+#line 755
{
+#line 755
#if SIZEOF_IX_INT == SIZEOF_INT && IX_INT_MAX == INT_MAX
+#line 755
get_ix_int(xp, (ix_int *)ip);
- return ENOERR;
+#line 755
+ return NC_NOERR;
+#line 755
#else
+#line 755
ix_int xx;
+#line 755
get_ix_int(xp, &xx);
+#line 755
*ip = (int) xx;
+#line 755
#if IX_INT_MAX > INT_MAX
+#line 755
if (xx > INT_MAX || xx < INT_MIN) return NC_ERANGE;
+#line 755
#endif
+#line 755
+#line 755
#endif
- return ENOERR;
+#line 755
+ return NC_NOERR;
+#line 755
}
+#line 755
static int
+#line 756
ncx_get_int_longlong(const void *xp, longlong *ip)
+#line 756
{
+#line 756
#if SIZEOF_IX_INT == SIZEOF_LONGLONG && IX_INT_MAX == LONGLONG_MAX
+#line 756
get_ix_int(xp, (ix_int *)ip);
- return ENOERR;
+#line 756
+ return NC_NOERR;
+#line 756
#else
+#line 756
ix_int xx;
+#line 756
get_ix_int(xp, &xx);
+#line 756
*ip = (longlong) xx;
+#line 756
#if IX_INT_MAX > LONGLONG_MAX
+#line 756
if (xx > LONGLONG_MAX || xx < LONGLONG_MIN) return NC_ERANGE;
+#line 756
#endif
+#line 756
+#line 756
#endif
- return ENOERR;
+#line 756
+ return NC_NOERR;
+#line 756
}
+#line 756
static int
+#line 757
ncx_get_int_ushort(const void *xp, ushort *ip)
+#line 757
{
+#line 757
ix_int xx;
+#line 757
get_ix_int(xp, &xx);
+#line 757
*ip = (ushort) xx;
+#line 757
#if IX_INT_MAX > USHORT_MAX
+#line 757
if (xx > USHORT_MAX) return NC_ERANGE;
+#line 757
#endif
+#line 757
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 757
+ return NC_NOERR;
+#line 757
}
+#line 757
static int
+#line 758
ncx_get_int_uchar(const void *xp, uchar *ip)
+#line 758
{
+#line 758
ix_int xx;
+#line 758
get_ix_int(xp, &xx);
+#line 758
*ip = (uchar) xx;
+#line 758
#if IX_INT_MAX > UCHAR_MAX
+#line 758
if (xx > UCHAR_MAX) return NC_ERANGE;
+#line 758
#endif
+#line 758
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 758
+ return NC_NOERR;
+#line 758
}
+#line 758
static int
+#line 759
ncx_get_int_uint(const void *xp, uint *ip)
+#line 759
{
+#line 759
ix_int xx;
+#line 759
get_ix_int(xp, &xx);
+#line 759
*ip = (uint) xx;
+#line 759
#if IX_INT_MAX > UINT_MAX
+#line 759
if (xx > UINT_MAX) return NC_ERANGE;
+#line 759
#endif
+#line 759
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 759
+ return NC_NOERR;
+#line 759
}
+#line 759
static int
+#line 760
ncx_get_int_ulonglong(const void *xp, ulonglong *ip)
+#line 760
{
+#line 760
ix_int xx;
+#line 760
get_ix_int(xp, &xx);
+#line 760
*ip = (ulonglong) xx;
+#line 760
#if IX_INT_MAX > ULONGLONG_MAX
+#line 760
if (xx > ULONGLONG_MAX) return NC_ERANGE;
+#line 760
#endif
+#line 760
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 760
+ return NC_NOERR;
+#line 760
}
+#line 760
static int
+#line 761
ncx_get_int_float(const void *xp, float *ip)
+#line 761
{
+#line 761
ix_int xx;
+#line 761
get_ix_int(xp, &xx);
+#line 761
*ip = (float) xx;
+#line 761
- return ENOERR;
+#line 761
+ return NC_NOERR;
+#line 761
}
+#line 761
static int
+#line 762
ncx_get_int_double(const void *xp, double *ip)
+#line 762
{
+#line 762
ix_int xx;
+#line 762
get_ix_int(xp, &xx);
+#line 762
*ip = (double) xx;
+#line 762
- return ENOERR;
+#line 762
+ return NC_NOERR;
+#line 762
}
+#line 762
static int
@@ -1211,8 +1810,8 @@ ncx_put_int_schar(void *xp, const schar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
}
- *cp = (uchar)*ip;
- return ENOERR;
+ *cp = (uchar)(signed)*ip;
+ return NC_NOERR;
}
static int
@@ -1223,113 +1822,210 @@ ncx_put_int_uchar(void *xp, const uchar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
static int
+#line 795
ncx_put_int_short(void *xp, const short *ip)
+#line 795
{
+#line 795
#if SIZEOF_IX_INT == SIZEOF_SHORT && IX_INT_MAX == SHORT_MAX
+#line 795
put_ix_int(xp, (const ix_int *)ip);
- return ENOERR;
+#line 795
+ return NC_NOERR;
+#line 795
#else
+#line 795
ix_int xx = (ix_int)*ip;
+#line 795
put_ix_int(xp, &xx);
+#line 795
#if IX_INT_MAX < SHORT_MAX
+#line 795
if (*ip > IX_INT_MAX || *ip < X_INT_MIN) return NC_ERANGE;
+#line 795
#endif
+#line 795
+#line 795
#endif
- return ENOERR;
+#line 795
+ return NC_NOERR;
+#line 795
}
+#line 795
int
+#line 796
ncx_put_int_int(void *xp, const int *ip)
+#line 796
{
+#line 796
#if SIZEOF_IX_INT == SIZEOF_INT && IX_INT_MAX == INT_MAX
+#line 796
put_ix_int(xp, (const ix_int *)ip);
- return ENOERR;
+#line 796
+ return NC_NOERR;
+#line 796
#else
+#line 796
ix_int xx = (ix_int)*ip;
+#line 796
put_ix_int(xp, &xx);
+#line 796
#if IX_INT_MAX < INT_MAX
+#line 796
if (*ip > IX_INT_MAX || *ip < X_INT_MIN) return NC_ERANGE;
+#line 796
#endif
+#line 796
+#line 796
#endif
- return ENOERR;
+#line 796
+ return NC_NOERR;
+#line 796
}
+#line 796
static int
+#line 797
ncx_put_int_longlong(void *xp, const longlong *ip)
+#line 797
{
+#line 797
#if SIZEOF_IX_INT == SIZEOF_LONGLONG && IX_INT_MAX == LONGLONG_MAX
+#line 797
put_ix_int(xp, (const ix_int *)ip);
- return ENOERR;
+#line 797
+ return NC_NOERR;
+#line 797
#else
+#line 797
ix_int xx = (ix_int)*ip;
+#line 797
put_ix_int(xp, &xx);
+#line 797
#if IX_INT_MAX < LONGLONG_MAX
+#line 797
if (*ip > IX_INT_MAX || *ip < X_INT_MIN) return NC_ERANGE;
+#line 797
#endif
+#line 797
+#line 797
#endif
- return ENOERR;
+#line 797
+ return NC_NOERR;
+#line 797
}
+#line 797
static int
+#line 798
ncx_put_int_ushort(void *xp, const ushort *ip)
+#line 798
{
+#line 798
ix_int xx = (ix_int)*ip;
+#line 798
put_ix_int(xp, &xx);
+#line 798
#if IX_INT_MAX < USHORT_MAX
+#line 798
if (*ip > IX_INT_MAX) return NC_ERANGE;
+#line 798
#endif
+#line 798
- return ENOERR;
+#line 798
+ return NC_NOERR;
+#line 798
}
+#line 798
static int
+#line 799
ncx_put_int_uint(void *xp, const uint *ip)
+#line 799
{
+#line 799
ix_int xx = (ix_int)*ip;
+#line 799
put_ix_int(xp, &xx);
+#line 799
#if IX_INT_MAX < UINT_MAX
+#line 799
if (*ip > IX_INT_MAX) return NC_ERANGE;
+#line 799
#endif
+#line 799
- return ENOERR;
+#line 799
+ return NC_NOERR;
+#line 799
}
+#line 799
static int
+#line 800
ncx_put_int_ulonglong(void *xp, const ulonglong *ip)
+#line 800
{
+#line 800
ix_int xx = (ix_int)*ip;
+#line 800
put_ix_int(xp, &xx);
+#line 800
#if IX_INT_MAX < ULONGLONG_MAX
+#line 800
if (*ip > IX_INT_MAX) return NC_ERANGE;
+#line 800
#endif
+#line 800
- return ENOERR;
+#line 800
+ return NC_NOERR;
+#line 800
}
+#line 800
static int
+#line 801
ncx_put_int_float(void *xp, const float *ip)
+#line 801
{
+#line 801
ix_int xx = (ix_int)*ip;
+#line 801
put_ix_int(xp, &xx);
+#line 801
if(*ip > (double)X_INT_MAX || *ip < (double)X_INT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 801
+ return NC_NOERR;
+#line 801
}
+#line 801
static int
+#line 802
ncx_put_int_double(void *xp, const double *ip)
+#line 802
{
+#line 802
ix_int xx = (ix_int)*ip;
+#line 802
put_ix_int(xp, &xx);
+#line 802
if(*ip > X_INT_MAX || *ip < X_INT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 802
+ return NC_NOERR;
+#line 802
}
+#line 802
@@ -1360,7 +2056,7 @@ get_ix_uint(const void *xp, ix_uint *ip)
*ip = *cp++ << 24;
*ip |= (*cp++ << 16);
*ip |= (*cp++ << 8);
- *ip |= *cp;
+ *ip |= *cp;
}
static void
@@ -1376,150 +2072,284 @@ put_ix_uint(void *xp, const ix_uint *ip)
#if X_SIZEOF_UINT != SIZEOF_UINT
static int
+#line 847
ncx_get_uint_uint(const void *xp, uint *ip)
+#line 847
{
+#line 847
#if SIZEOF_IX_UINT == SIZEOF_UINT && IX_UINT_MAX == UINT_MAX
+#line 847
get_ix_uint(xp, (ix_uint *)ip);
- return ENOERR;
+#line 847
+ return NC_NOERR;
+#line 847
#else
+#line 847
ix_uint xx;
+#line 847
get_ix_uint(xp, &xx);
+#line 847
*ip = (uint) xx;
+#line 847
#if IX_UINT_MAX > UINT_MAX
+#line 847
if (xx > UINT_MAX) return NC_ERANGE;
+#line 847
#endif
+#line 847
+#line 847
#endif
- return ENOERR;
+#line 847
+ return NC_NOERR;
+#line 847
}
+#line 847
#endif
static int
+#line 850
ncx_get_uint_schar(const void *xp, schar *ip)
+#line 850
{
+#line 850
ix_uint xx;
+#line 850
get_ix_uint(xp, &xx);
+#line 850
*ip = (schar) xx;
+#line 850
#if IX_UINT_MAX > SCHAR_MAX
+#line 850
if (xx > SCHAR_MAX) return NC_ERANGE;
+#line 850
#endif
+#line 850
- return ENOERR;
+#line 850
+ return NC_NOERR;
+#line 850
}
+#line 850
static int
+#line 851
ncx_get_uint_short(const void *xp, short *ip)
+#line 851
{
+#line 851
ix_uint xx;
+#line 851
get_ix_uint(xp, &xx);
+#line 851
*ip = (short) xx;
+#line 851
#if IX_UINT_MAX > SHORT_MAX
+#line 851
if (xx > SHORT_MAX) return NC_ERANGE;
+#line 851
#endif
+#line 851
- return ENOERR;
+#line 851
+ return NC_NOERR;
+#line 851
}
+#line 851
static int
+#line 852
ncx_get_uint_int(const void *xp, int *ip)
+#line 852
{
+#line 852
ix_uint xx;
+#line 852
get_ix_uint(xp, &xx);
+#line 852
*ip = (int) xx;
+#line 852
#if IX_UINT_MAX > INT_MAX
+#line 852
if (xx > INT_MAX) return NC_ERANGE;
+#line 852
#endif
+#line 852
- return ENOERR;
+#line 852
+ return NC_NOERR;
+#line 852
}
+#line 852
static int
+#line 853
ncx_get_uint_longlong(const void *xp, longlong *ip)
+#line 853
{
+#line 853
ix_uint xx;
+#line 853
get_ix_uint(xp, &xx);
+#line 853
*ip = (longlong) xx;
+#line 853
#if IX_UINT_MAX > LONGLONG_MAX
+#line 853
if (xx > LONGLONG_MAX) return NC_ERANGE;
+#line 853
#endif
+#line 853
- return ENOERR;
+#line 853
+ return NC_NOERR;
+#line 853
}
+#line 853
static int
+#line 854
ncx_get_uint_ushort(const void *xp, ushort *ip)
+#line 854
{
+#line 854
#if SIZEOF_IX_UINT == SIZEOF_USHORT && IX_UINT_MAX == USHORT_MAX
+#line 854
get_ix_uint(xp, (ix_uint *)ip);
- return ENOERR;
+#line 854
+ return NC_NOERR;
+#line 854
#else
+#line 854
ix_uint xx;
+#line 854
get_ix_uint(xp, &xx);
+#line 854
*ip = (ushort) xx;
+#line 854
#if IX_UINT_MAX > USHORT_MAX
+#line 854
if (xx > USHORT_MAX) return NC_ERANGE;
+#line 854
#endif
+#line 854
+#line 854
#endif
- return ENOERR;
+#line 854
+ return NC_NOERR;
+#line 854
}
+#line 854
static int
+#line 855
ncx_get_uint_uchar(const void *xp, uchar *ip)
+#line 855
{
+#line 855
#if SIZEOF_IX_UINT == SIZEOF_UCHAR && IX_UINT_MAX == UCHAR_MAX
+#line 855
get_ix_uint(xp, (ix_uint *)ip);
- return ENOERR;
+#line 855
+ return NC_NOERR;
+#line 855
#else
+#line 855
ix_uint xx;
+#line 855
get_ix_uint(xp, &xx);
+#line 855
*ip = (uchar) xx;
+#line 855
#if IX_UINT_MAX > UCHAR_MAX
+#line 855
if (xx > UCHAR_MAX) return NC_ERANGE;
+#line 855
#endif
+#line 855
+#line 855
#endif
- return ENOERR;
+#line 855
+ return NC_NOERR;
+#line 855
}
+#line 855
static int
+#line 856
ncx_get_uint_ulonglong(const void *xp, ulonglong *ip)
+#line 856
{
+#line 856
#if SIZEOF_IX_UINT == SIZEOF_ULONGLONG && IX_UINT_MAX == ULONGLONG_MAX
+#line 856
get_ix_uint(xp, (ix_uint *)ip);
- return ENOERR;
+#line 856
+ return NC_NOERR;
+#line 856
#else
+#line 856
ix_uint xx;
+#line 856
get_ix_uint(xp, &xx);
+#line 856
*ip = (ulonglong) xx;
+#line 856
#if IX_UINT_MAX > ULONGLONG_MAX
+#line 856
if (xx > ULONGLONG_MAX) return NC_ERANGE;
+#line 856
#endif
+#line 856
+#line 856
#endif
- return ENOERR;
+#line 856
+ return NC_NOERR;
+#line 856
}
+#line 856
static int
+#line 857
ncx_get_uint_float(const void *xp, float *ip)
+#line 857
{
+#line 857
ix_uint xx;
+#line 857
get_ix_uint(xp, &xx);
+#line 857
*ip = (float) xx;
+#line 857
- return ENOERR;
+#line 857
+ return NC_NOERR;
+#line 857
}
+#line 857
static int
+#line 858
ncx_get_uint_double(const void *xp, double *ip)
+#line 858
{
+#line 858
ix_uint xx;
+#line 858
get_ix_uint(xp, &xx);
+#line 858
*ip = (double) xx;
+#line 858
- return ENOERR;
+#line 858
+ return NC_NOERR;
+#line 858
}
+#line 858
static int
@@ -1529,11 +2359,11 @@ ncx_put_uint_schar(void *xp, const schar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
*cp++ = 0x00;
- *cp = (uchar)*ip;
+ *cp = (uchar)(signed)*ip;
if (*ip < 0) return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -1544,116 +2374,213 @@ ncx_put_uint_uchar(void *xp, const uchar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
#if X_SIZEOF_UINT != SIZEOF_UINT
static int
+#line 886
ncx_put_uint_uint(void *xp, const uint *ip)
+#line 886
{
+#line 886
#if SIZEOF_IX_UINT == SIZEOF_UINT && IX_UINT_MAX == UINT_MAX
+#line 886
put_ix_uint(xp, (const ix_uint *)ip);
- return ENOERR;
+#line 886
+ return NC_NOERR;
+#line 886
#else
+#line 886
ix_uint xx = (ix_uint)*ip;
+#line 886
put_ix_uint(xp, &xx);
+#line 886
#if IX_UINT_MAX < UINT_MAX
+#line 886
if (*ip > IX_UINT_MAX) return NC_ERANGE;
+#line 886
#endif
+#line 886
+#line 886
#endif
- return ENOERR;
+#line 886
+ return NC_NOERR;
+#line 886
}
+#line 886
#endif
static int
+#line 889
ncx_put_uint_short(void *xp, const short *ip)
+#line 889
{
+#line 889
ix_uint xx = (ix_uint)*ip;
+#line 889
put_ix_uint(xp, &xx);
+#line 889
#if IX_UINT_MAX < SHORT_MAX
+#line 889
if (*ip > IX_UINT_MAX) return NC_ERANGE;
+#line 889
#endif
+#line 889
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 889
+ return NC_NOERR;
+#line 889
}
+#line 889
static int
+#line 890
ncx_put_uint_int(void *xp, const int *ip)
+#line 890
{
+#line 890
ix_uint xx = (ix_uint)*ip;
+#line 890
put_ix_uint(xp, &xx);
+#line 890
#if IX_UINT_MAX < INT_MAX
+#line 890
if (*ip > IX_UINT_MAX) return NC_ERANGE;
+#line 890
#endif
+#line 890
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 890
+ return NC_NOERR;
+#line 890
}
+#line 890
static int
+#line 891
ncx_put_uint_longlong(void *xp, const longlong *ip)
+#line 891
{
+#line 891
ix_uint xx = (ix_uint)*ip;
+#line 891
put_ix_uint(xp, &xx);
+#line 891
#if IX_UINT_MAX < LONGLONG_MAX
+#line 891
if (*ip > IX_UINT_MAX) return NC_ERANGE;
+#line 891
#endif
+#line 891
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 891
+ return NC_NOERR;
+#line 891
}
+#line 891
static int
+#line 892
ncx_put_uint_ushort(void *xp, const ushort *ip)
+#line 892
{
+#line 892
#if SIZEOF_IX_UINT == SIZEOF_USHORT && IX_UINT_MAX == USHORT_MAX
+#line 892
put_ix_uint(xp, (const ix_uint *)ip);
- return ENOERR;
+#line 892
+ return NC_NOERR;
+#line 892
#else
+#line 892
ix_uint xx = (ix_uint)*ip;
+#line 892
put_ix_uint(xp, &xx);
+#line 892
#if IX_UINT_MAX < USHORT_MAX
+#line 892
if (*ip > IX_UINT_MAX) return NC_ERANGE;
+#line 892
#endif
+#line 892
+#line 892
#endif
- return ENOERR;
+#line 892
+ return NC_NOERR;
+#line 892
}
+#line 892
static int
+#line 893
ncx_put_uint_ulonglong(void *xp, const ulonglong *ip)
+#line 893
{
+#line 893
#if SIZEOF_IX_UINT == SIZEOF_ULONGLONG && IX_UINT_MAX == ULONGLONG_MAX
+#line 893
put_ix_uint(xp, (const ix_uint *)ip);
- return ENOERR;
+#line 893
+ return NC_NOERR;
+#line 893
#else
+#line 893
ix_uint xx = (ix_uint)*ip;
+#line 893
put_ix_uint(xp, &xx);
+#line 893
#if IX_UINT_MAX < ULONGLONG_MAX
+#line 893
if (*ip > IX_UINT_MAX) return NC_ERANGE;
+#line 893
#endif
+#line 893
+#line 893
#endif
- return ENOERR;
+#line 893
+ return NC_NOERR;
+#line 893
}
+#line 893
static int
+#line 894
ncx_put_uint_float(void *xp, const float *ip)
+#line 894
{
+#line 894
ix_uint xx = (ix_uint)*ip;
+#line 894
put_ix_uint(xp, &xx);
+#line 894
if(*ip > (double)X_UINT_MAX || *ip < 0) return NC_ERANGE;
- return ENOERR;
+#line 894
+ return NC_NOERR;
+#line 894
}
+#line 894
static int
+#line 895
ncx_put_uint_double(void *xp, const double *ip)
+#line 895
{
+#line 895
ix_uint xx = (ix_uint)*ip;
+#line 895
put_ix_uint(xp, &xx);
+#line 895
if(*ip > X_UINT_MAX || *ip < 0) return NC_ERANGE;
- return ENOERR;
+#line 895
+ return NC_NOERR;
+#line 895
}
+#line 895
/* x_float -------------------------------------------------------------------*/
@@ -1715,105 +2642,196 @@ static struct sgl_limits min = {
{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } /* Min IEEE */
};
+#line 1008
static void
get_ix_float(const void *xp, float *ip)
{
struct vax_single *const vsp = (struct vax_single *) ip;
+#line 1011
const struct ieee_single *const isp =
+#line 1011
(const struct ieee_single *) xp;
+#line 1011
unsigned exp = isp->exp_hi << 1 | isp->exp_lo;
+#line 1011
+#line 1011
switch(exp) {
+#line 1011
case 0 :
+#line 1011
/* ieee subnormal */
+#line 1011
if(isp->mant_hi == min.ieee.mant_hi
+#line 1011
&& isp->mant_lo_hi == min.ieee.mant_lo_hi
+#line 1011
&& isp->mant_lo_lo == min.ieee.mant_lo_lo)
+#line 1011
{
+#line 1011
*vsp = min.s;
+#line 1011
}
+#line 1011
else
+#line 1011
{
+#line 1011
unsigned mantissa = (isp->mant_hi << 16)
+#line 1011
| isp->mant_lo_hi << 8
+#line 1011
| isp->mant_lo_lo;
+#line 1011
unsigned tmp = mantissa >> 20;
+#line 1011
if(tmp >= 4) {
+#line 1011
vsp->exp = 2;
+#line 1011
} else if (tmp >= 2) {
+#line 1011
vsp->exp = 1;
+#line 1011
} else {
+#line 1011
*vsp = min.s;
+#line 1011
break;
+#line 1011
} /* else */
+#line 1011
tmp = mantissa - (1 << (20 + vsp->exp ));
+#line 1011
tmp <<= 3 - vsp->exp;
+#line 1011
vsp->mantissa2 = tmp;
+#line 1011
vsp->mantissa1 = (tmp >> 16);
+#line 1011
}
+#line 1011
break;
+#line 1011
case 0xfe :
+#line 1011
case 0xff :
+#line 1011
*vsp = max.s;
+#line 1011
break;
+#line 1011
default :
+#line 1011
vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
+#line 1011
vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo;
+#line 1011
vsp->mantissa1 = isp->mant_hi;
+#line 1011
}
+#line 1011
+#line 1011
vsp->sign = isp->sign;
+#line 1011
}
+#line 1065
static void
put_ix_float(void *xp, const float *ip)
{
const struct vax_single *const vsp =
+#line 1069
(const struct vax_single *)ip;
+#line 1069
struct ieee_single *const isp = (struct ieee_single *) xp;
+#line 1069
+#line 1069
switch(vsp->exp){
+#line 1069
case 0 :
+#line 1069
/* all vax float with zero exponent map to zero */
+#line 1069
*isp = min.ieee;
+#line 1069
break;
+#line 1069
case 2 :
+#line 1069
case 1 :
+#line 1069
{
+#line 1069
/* These will map to subnormals */
+#line 1069
unsigned mantissa = (vsp->mantissa1 << 16)
+#line 1069
| vsp->mantissa2;
+#line 1069
mantissa >>= 3 - vsp->exp;
+#line 1069
mantissa += (1 << (20 + vsp->exp));
+#line 1069
isp->mant_lo_lo = mantissa;
+#line 1069
isp->mant_lo_hi = mantissa >> 8;
+#line 1069
isp->mant_hi = mantissa >> 16;
+#line 1069
isp->exp_lo = 0;
+#line 1069
isp->exp_hi = 0;
+#line 1069
}
+#line 1069
break;
+#line 1069
case 0xff : /* max.s.exp */
+#line 1069
if( vsp->mantissa2 == max.s.mantissa2
+#line 1069
&& vsp->mantissa1 == max.s.mantissa1)
+#line 1069
{
+#line 1069
/* map largest vax float to ieee infinity */
+#line 1069
*isp = max.ieee;
+#line 1069
break;
+#line 1069
} /* else, fall thru */
+#line 1069
default :
+#line 1069
{
+#line 1069
unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
+#line 1069
isp->exp_hi = exp >> 1;
+#line 1069
isp->exp_lo = exp;
+#line 1069
isp->mant_lo_lo = vsp->mantissa2;
+#line 1069
isp->mant_lo_hi = vsp->mantissa2 >> 8;
+#line 1069
isp->mant_hi = vsp->mantissa1;
+#line 1069
}
+#line 1069
}
+#line 1069
+#line 1069
isp->sign = vsp->sign;
+#line 1069
}
@@ -1873,6 +2891,7 @@ static const int cs_ieis_bias = 0x4000 - 0x7f;
static const int cs_id_bias = 0x4000 - 0x3ff;
+#line 1204
static void
get_ix_float(const void *xp, float *ip)
@@ -1882,48 +2901,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 1212
+#line 1212
if(isp->exp == 0)
+#line 1212
{
+#line 1212
/* ieee subnormal */
+#line 1212
*ip = (double)isp->mant;
+#line 1212
if(isp->mant != 0)
+#line 1212
{
+#line 1212
csp->exp -= (ieee_single_bias + 22);
+#line 1212
}
+#line 1212
}
+#line 1212
else
+#line 1212
{
+#line 1212
csp->exp = isp->exp + cs_ieis_bias + 1;
+#line 1212
csp->mant = isp->mant << (48 - 1 - 23);
+#line 1212
csp->mant |= (1 << (48 - 1));
+#line 1212
}
+#line 1212
csp->sign = isp->sign;
+#line 1212
+#line 1212
}
else
{
const ieee_single_lo *isp = (const ieee_single_lo *) xp;
cray_single *csp = (cray_single *) ip;
+#line 1217
+#line 1217
if(isp->exp == 0)
+#line 1217
{
+#line 1217
/* ieee subnormal */
+#line 1217
*ip = (double)isp->mant;
+#line 1217
if(isp->mant != 0)
+#line 1217
{
+#line 1217
csp->exp -= (ieee_single_bias + 22);
+#line 1217
}
+#line 1217
}
+#line 1217
else
+#line 1217
{
+#line 1217
csp->exp = isp->exp + cs_ieis_bias + 1;
+#line 1217
csp->mant = isp->mant << (48 - 1 - 23);
+#line 1217
csp->mant |= (1 << (48 - 1));
+#line 1217
}
+#line 1217
csp->sign = isp->sign;
+#line 1217
+#line 1217
}
}
@@ -1935,96 +2992,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 1227
int ieee_exp = csp->exp - cs_ieis_bias -1;
+#line 1227
+#line 1227
isp->sign = csp->sign;
+#line 1227
+#line 1227
if(ieee_exp >= 0xff)
+#line 1227
{
+#line 1227
/* NC_ERANGE => ieee Inf */
+#line 1227
isp->exp = 0xff;
+#line 1227
isp->mant = 0x0;
+#line 1227
}
+#line 1227
else if(ieee_exp > 0)
+#line 1227
{
+#line 1227
/* normal ieee representation */
+#line 1227
isp->exp = ieee_exp;
+#line 1227
/* assumes cray rep is in normal form */
+#line 1227
assert(csp->mant & 0x800000000000);
+#line 1227
isp->mant = (((csp->mant << 1) &
+#line 1227
0xffffffffffff) >> (48 - 23));
+#line 1227
}
+#line 1227
else if(ieee_exp > -23)
+#line 1227
{
+#line 1227
/* ieee subnormal, right shift */
+#line 1227
const int rshift = (48 - 23 - ieee_exp);
+#line 1227
+#line 1227
isp->mant = csp->mant >> rshift;
+#line 1227
+#line 1227
#if 0
+#line 1227
if(csp->mant & (1 << (rshift -1)))
+#line 1227
{
+#line 1227
/* round up */
+#line 1227
isp->mant++;
+#line 1227
}
+#line 1227
#endif
+#line 1227
+#line 1227
isp->exp = 0;
+#line 1227
}
+#line 1227
else
+#line 1227
{
+#line 1227
/* smaller than ieee can represent */
+#line 1227
isp->exp = 0;
+#line 1227
isp->mant = 0;
+#line 1227
}
+#line 1227
}
else
{
ieee_single_lo *isp = (ieee_single_lo*)xp;
const cray_single *csp = (const cray_single *) ip;
+#line 1232
int ieee_exp = csp->exp - cs_ieis_bias -1;
+#line 1232
+#line 1232
isp->sign = csp->sign;
+#line 1232
+#line 1232
if(ieee_exp >= 0xff)
+#line 1232
{
+#line 1232
/* NC_ERANGE => ieee Inf */
+#line 1232
isp->exp = 0xff;
+#line 1232
isp->mant = 0x0;
+#line 1232
}
+#line 1232
else if(ieee_exp > 0)
+#line 1232
{
+#line 1232
/* normal ieee representation */
+#line 1232
isp->exp = ieee_exp;
+#line 1232
/* assumes cray rep is in normal form */
+#line 1232
assert(csp->mant & 0x800000000000);
+#line 1232
isp->mant = (((csp->mant << 1) &
+#line 1232
0xffffffffffff) >> (48 - 23));
+#line 1232
}
+#line 1232
else if(ieee_exp > -23)
+#line 1232
{
+#line 1232
/* ieee subnormal, right shift */
+#line 1232
const int rshift = (48 - 23 - ieee_exp);
+#line 1232
+#line 1232
isp->mant = csp->mant >> rshift;
+#line 1232
+#line 1232
#if 0
+#line 1232
if(csp->mant & (1 << (rshift -1)))
+#line 1232
{
+#line 1232
/* round up */
+#line 1232
isp->mant++;
+#line 1232
}
+#line 1232
#endif
+#line 1232
+#line 1232
isp->exp = 0;
+#line 1232
}
+#line 1232
else
+#line 1232
{
+#line 1232
/* smaller than ieee can represent */
+#line 1232
isp->exp = 0;
+#line 1232
isp->mant = 0;
+#line 1232
}
+#line 1232
}
}
@@ -2106,101 +3249,182 @@ ncx_get_float_float(const void *xp, float *ip)
{
/* TODO */
get_ix_float(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
#endif
#define ix_float float
static int
+#line 1319
ncx_get_float_schar(const void *xp, schar *ip)
+#line 1319
{
+#line 1319
ix_float xx;
+#line 1319
get_ix_float(xp, &xx);
+#line 1319
*ip = (schar) xx;
+#line 1319
if(xx > (double)SCHAR_MAX || xx < (double)SCHAR_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1319
+ return NC_NOERR;
+#line 1319
}
+#line 1319
static int
+#line 1320
ncx_get_float_short(const void *xp, short *ip)
+#line 1320
{
+#line 1320
ix_float xx;
+#line 1320
get_ix_float(xp, &xx);
+#line 1320
*ip = (short) xx;
+#line 1320
if(xx > (double)SHORT_MAX || xx < (double)SHORT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1320
+ return NC_NOERR;
+#line 1320
}
+#line 1320
static int
+#line 1321
ncx_get_float_int(const void *xp, int *ip)
+#line 1321
{
+#line 1321
ix_float xx;
+#line 1321
get_ix_float(xp, &xx);
+#line 1321
*ip = (int) xx;
+#line 1321
if(xx > (double)INT_MAX || xx < (double)INT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1321
+ return NC_NOERR;
+#line 1321
}
+#line 1321
static int
+#line 1322
ncx_get_float_double(const void *xp, double *ip)
+#line 1322
{
+#line 1322
ix_float xx;
+#line 1322
get_ix_float(xp, &xx);
+#line 1322
*ip = (double) xx;
+#line 1322
- return ENOERR;
+#line 1322
+ return NC_NOERR;
+#line 1322
}
+#line 1322
static int
+#line 1323
ncx_get_float_longlong(const void *xp, longlong *ip)
+#line 1323
{
+#line 1323
ix_float xx;
+#line 1323
get_ix_float(xp, &xx);
+#line 1323
*ip = (longlong) xx;
+#line 1323
if(xx > (double)LONGLONG_MAX || xx < (double)LONGLONG_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1323
+ return NC_NOERR;
+#line 1323
}
+#line 1323
static int
+#line 1324
ncx_get_float_uchar(const void *xp, uchar *ip)
+#line 1324
{
+#line 1324
ix_float xx;
+#line 1324
get_ix_float(xp, &xx);
+#line 1324
*ip = (uchar) xx;
+#line 1324
if(xx > (double)UCHAR_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1324
+ return NC_NOERR;
+#line 1324
}
+#line 1324
static int
+#line 1325
ncx_get_float_ushort(const void *xp, ushort *ip)
+#line 1325
{
+#line 1325
ix_float xx;
+#line 1325
get_ix_float(xp, &xx);
+#line 1325
*ip = (ushort) xx;
+#line 1325
if(xx > (double)USHORT_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1325
+ return NC_NOERR;
+#line 1325
}
+#line 1325
static int
+#line 1326
ncx_get_float_uint(const void *xp, uint *ip)
+#line 1326
{
+#line 1326
ix_float xx;
+#line 1326
get_ix_float(xp, &xx);
+#line 1326
*ip = (uint) xx;
+#line 1326
if(xx > (double)UINT_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1326
+ return NC_NOERR;
+#line 1326
}
+#line 1326
static int
+#line 1327
ncx_get_float_ulonglong(const void *xp, ulonglong *ip)
+#line 1327
{
+#line 1327
ix_float xx;
+#line 1327
get_ix_float(xp, &xx);
+#line 1327
*ip = (ulonglong) xx;
+#line 1327
if(xx > (double)ULONGLONG_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1327
+ return NC_NOERR;
+#line 1327
}
+#line 1327
#if X_SIZEOF_FLOAT != SIZEOF_FLOAT || defined(NO_IEEE_FLOAT)
@@ -2212,90 +3436,162 @@ ncx_put_float_float(void *xp, const float *ip)
if(*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
return NC_ERANGE;
#endif
- return ENOERR;
+ return NC_NOERR;
}
#endif
static int
+#line 1342
ncx_put_float_schar(void *xp, const schar *ip)
+#line 1342
{
+#line 1342
ix_float xx = (ix_float)*ip;
+#line 1342
put_ix_float(xp, &xx);
+#line 1342
- return ENOERR;
+#line 1342
+ return NC_NOERR;
+#line 1342
}
+#line 1342
static int
+#line 1343
ncx_put_float_short(void *xp, const short *ip)
+#line 1343
{
+#line 1343
ix_float xx = (ix_float)*ip;
+#line 1343
put_ix_float(xp, &xx);
+#line 1343
- return ENOERR;
+#line 1343
+ return NC_NOERR;
+#line 1343
}
+#line 1343
static int
+#line 1344
ncx_put_float_int(void *xp, const int *ip)
+#line 1344
{
+#line 1344
ix_float xx = (ix_float)*ip;
+#line 1344
put_ix_float(xp, &xx);
+#line 1344
- return ENOERR;
+#line 1344
+ return NC_NOERR;
+#line 1344
}
+#line 1344
static int
+#line 1345
ncx_put_float_double(void *xp, const double *ip)
+#line 1345
{
+#line 1345
ix_float xx = (ix_float)*ip;
+#line 1345
put_ix_float(xp, &xx);
+#line 1345
if(*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1345
+ return NC_NOERR;
+#line 1345
}
+#line 1345
static int
+#line 1346
ncx_put_float_longlong(void *xp, const longlong *ip)
+#line 1346
{
+#line 1346
ix_float xx = (ix_float)*ip;
+#line 1346
put_ix_float(xp, &xx);
+#line 1346
- return ENOERR;
+#line 1346
+ return NC_NOERR;
+#line 1346
}
+#line 1346
static int
+#line 1347
ncx_put_float_uchar(void *xp, const uchar *ip)
+#line 1347
{
+#line 1347
ix_float xx = (ix_float)*ip;
+#line 1347
put_ix_float(xp, &xx);
+#line 1347
- return ENOERR;
+#line 1347
+ return NC_NOERR;
+#line 1347
}
+#line 1347
static int
+#line 1348
ncx_put_float_ushort(void *xp, const ushort *ip)
+#line 1348
{
+#line 1348
ix_float xx = (ix_float)*ip;
+#line 1348
put_ix_float(xp, &xx);
+#line 1348
- return ENOERR;
+#line 1348
+ return NC_NOERR;
+#line 1348
}
+#line 1348
static int
+#line 1349
ncx_put_float_uint(void *xp, const uint *ip)
+#line 1349
{
+#line 1349
ix_float xx = (ix_float)*ip;
+#line 1349
put_ix_float(xp, &xx);
+#line 1349
- return ENOERR;
+#line 1349
+ return NC_NOERR;
+#line 1349
}
+#line 1349
static int
+#line 1350
ncx_put_float_ulonglong(void *xp, const ulonglong *ip)
+#line 1350
{
+#line 1350
ix_float xx = (ix_float)*ip;
+#line 1350
put_ix_float(xp, &xx);
+#line 1350
- return ENOERR;
+#line 1350
+ return NC_NOERR;
+#line 1350
}
+#line 1350
@@ -2362,116 +3658,218 @@ static const struct dbl_limits {
};
+#line 1464
static void
get_ix_double(const void *xp, double *ip)
{
struct vax_double *const vdp =
+#line 1467
(struct vax_double *)ip;
+#line 1467
const struct ieee_double *const idp =
+#line 1467
(const struct ieee_double *) xp;
+#line 1467
{
+#line 1467
const struct dbl_limits *lim;
+#line 1467
int ii;
+#line 1467
for (ii = 0, lim = dbl_limits;
+#line 1467
ii < sizeof(dbl_limits)/sizeof(struct dbl_limits);
+#line 1467
ii++, lim++)
+#line 1467
{
+#line 1467
if ((idp->mant_lo == lim->ieee.mant_lo)
+#line 1467
&& (idp->mant_4 == lim->ieee.mant_4)
+#line 1467
&& (idp->mant_5 == lim->ieee.mant_5)
+#line 1467
&& (idp->mant_6 == lim->ieee.mant_6)
+#line 1467
&& (idp->exp_lo == lim->ieee.exp_lo)
+#line 1467
&& (idp->exp_hi == lim->ieee.exp_hi)
+#line 1467
)
+#line 1467
{
+#line 1467
*vdp = lim->d;
+#line 1467
goto doneit;
+#line 1467
}
+#line 1467
}
+#line 1467
}
+#line 1467
{
+#line 1467
unsigned exp = idp->exp_hi << 4 | idp->exp_lo;
+#line 1467
vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
+#line 1467
}
+#line 1467
{
+#line 1467
unsigned mant_hi = ((idp->mant_6 << 16)
+#line 1467
| (idp->mant_5 << 8)
+#line 1467
| idp->mant_4);
+#line 1467
unsigned mant_lo = SWAP4(idp->mant_lo);
+#line 1467
vdp->mantissa1 = (mant_hi >> 13);
+#line 1467
vdp->mantissa2 = ((mant_hi & MASK(13)) << 3)
+#line 1467
| (mant_lo >> 29);
+#line 1467
vdp->mantissa3 = (mant_lo >> 13);
+#line 1467
vdp->mantissa4 = (mant_lo << 3);
+#line 1467
}
+#line 1467
doneit:
+#line 1467
vdp->sign = idp->sign;
+#line 1467
}
+#line 1537
static void
put_ix_double(void *xp, const double *ip)
{
const struct vax_double *const vdp =
+#line 1540
(const struct vax_double *)ip;
+#line 1540
struct ieee_double *const idp =
+#line 1540
(struct ieee_double *) xp;
+#line 1540
+#line 1540
if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) &&
+#line 1540
(vdp->mantissa3 == dbl_limits[0].d.mantissa3) &&
+#line 1540
(vdp->mantissa2 == dbl_limits[0].d.mantissa2) &&
+#line 1540
(vdp->mantissa1 == dbl_limits[0].d.mantissa1) &&
+#line 1540
(vdp->exp == dbl_limits[0].d.exp))
+#line 1540
{
+#line 1540
*idp = dbl_limits[0].ieee;
+#line 1540
goto shipit;
+#line 1540
}
+#line 1540
if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) &&
+#line 1540
(vdp->mantissa3 == dbl_limits[1].d.mantissa3) &&
+#line 1540
(vdp->mantissa2 == dbl_limits[1].d.mantissa2) &&
+#line 1540
(vdp->mantissa1 == dbl_limits[1].d.mantissa1) &&
+#line 1540
(vdp->exp == dbl_limits[1].d.exp))
+#line 1540
{
+#line 1540
*idp = dbl_limits[1].ieee;
+#line 1540
goto shipit;
+#line 1540
}
+#line 1540
+#line 1540
{
+#line 1540
unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
+#line 1540
+#line 1540
unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) |
+#line 1540
(vdp->mantissa3 << 13) |
+#line 1540
((vdp->mantissa4 >> 3) & MASK(13));
+#line 1540
+#line 1540
unsigned mant_hi = (vdp->mantissa1 << 13)
+#line 1540
| (vdp->mantissa2 >> 3);
+#line 1540
+#line 1540
if((vdp->mantissa4 & 7) > 4)
+#line 1540
{
+#line 1540
/* round up */
+#line 1540
mant_lo++;
+#line 1540
if(mant_lo == 0)
+#line 1540
{
+#line 1540
mant_hi++;
+#line 1540
if(mant_hi > 0xffffff)
+#line 1540
{
+#line 1540
mant_hi = 0;
+#line 1540
exp++;
+#line 1540
}
+#line 1540
}
+#line 1540
}
+#line 1540
+#line 1540
idp->mant_lo = SWAP4(mant_lo);
+#line 1540
idp->mant_6 = mant_hi >> 16;
+#line 1540
idp->mant_5 = (mant_hi & 0xff00) >> 8;
+#line 1540
idp->mant_4 = mant_hi;
+#line 1540
idp->exp_hi = exp >> 4;
+#line 1540
idp->exp_lo = exp;
+#line 1540
}
+#line 1540
+#line 1540
shipit:
+#line 1540
idp->sign = vdp->sign;
+#line 1540
}
@@ -2565,74 +3963,137 @@ put_ix_double(void *xp, const double *ip)
#define ix_double double
static int
+#line 1632
ncx_get_double_schar(const void *xp, schar *ip)
+#line 1632
{
+#line 1632
ix_double xx;
+#line 1632
get_ix_double(xp, &xx);
+#line 1632
*ip = (schar) xx;
+#line 1632
if(xx > SCHAR_MAX || xx < SCHAR_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1632
+ return NC_NOERR;
+#line 1632
}
+#line 1632
static int
+#line 1633
ncx_get_double_short(const void *xp, short *ip)
+#line 1633
{
+#line 1633
ix_double xx;
+#line 1633
get_ix_double(xp, &xx);
+#line 1633
*ip = (short) xx;
+#line 1633
if(xx > SHORT_MAX || xx < SHORT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1633
+ return NC_NOERR;
+#line 1633
}
+#line 1633
static int
+#line 1634
ncx_get_double_int(const void *xp, int *ip)
+#line 1634
{
+#line 1634
ix_double xx;
+#line 1634
get_ix_double(xp, &xx);
+#line 1634
*ip = (int) xx;
+#line 1634
if(xx > INT_MAX || xx < INT_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1634
+ return NC_NOERR;
+#line 1634
}
+#line 1634
static int
+#line 1635
ncx_get_double_longlong(const void *xp, longlong *ip)
+#line 1635
{
+#line 1635
ix_double xx;
+#line 1635
get_ix_double(xp, &xx);
+#line 1635
*ip = (longlong) xx;
+#line 1635
if(xx > LONGLONG_MAX || xx < LONGLONG_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1635
+ return NC_NOERR;
+#line 1635
}
+#line 1635
static int
+#line 1636
ncx_get_double_uchar(const void *xp, uchar *ip)
+#line 1636
{
+#line 1636
ix_double xx;
+#line 1636
get_ix_double(xp, &xx);
+#line 1636
*ip = (uchar) xx;
+#line 1636
if(xx > UCHAR_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1636
+ return NC_NOERR;
+#line 1636
}
+#line 1636
static int
+#line 1637
ncx_get_double_ushort(const void *xp, ushort *ip)
+#line 1637
{
+#line 1637
ix_double xx;
+#line 1637
get_ix_double(xp, &xx);
+#line 1637
*ip = (ushort) xx;
+#line 1637
if(xx > USHORT_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1637
+ return NC_NOERR;
+#line 1637
}
+#line 1637
static int
+#line 1638
ncx_get_double_uint(const void *xp, uint *ip)
+#line 1638
{
+#line 1638
ix_double xx;
+#line 1638
get_ix_double(xp, &xx);
+#line 1638
*ip = (uint) xx;
+#line 1638
if(xx > UINT_MAX || xx < 0) return NC_ERANGE;
- return ENOERR;
+#line 1638
+ return NC_NOERR;
+#line 1638
}
+#line 1638
int
@@ -2643,7 +4104,7 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip)
*ip = (unsigned long long) xx;
if(xx > ULONG_LONG_MAX || xx < 0)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -2662,7 +4123,7 @@ ncx_get_double_float(const void *xp, float *ip)
return NC_ERANGE;
}
*ip = (float) xx;
- return ENOERR;
+ return NC_NOERR;
}
#if X_SIZEOF_DOUBLE != SIZEOF_DOUBLE || defined(NO_IEEE_FLOAT)
@@ -2671,81 +4132,145 @@ ncx_get_double_double(const void *xp, double *ip)
{
/* TODO */
get_ix_double(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
#endif
static int
+#line 1680
ncx_put_double_schar(void *xp, const schar *ip)
+#line 1680
{
+#line 1680
ix_double xx = (ix_double)*ip;
+#line 1680
put_ix_double(xp, &xx);
+#line 1680
- return ENOERR;
+#line 1680
+ return NC_NOERR;
+#line 1680
}
+#line 1680
static int
+#line 1681
ncx_put_double_uchar(void *xp, const uchar *ip)
+#line 1681
{
+#line 1681
ix_double xx = (ix_double)*ip;
+#line 1681
put_ix_double(xp, &xx);
+#line 1681
- return ENOERR;
+#line 1681
+ return NC_NOERR;
+#line 1681
}
+#line 1681
static int
+#line 1682
ncx_put_double_short(void *xp, const short *ip)
+#line 1682
{
+#line 1682
ix_double xx = (ix_double)*ip;
+#line 1682
put_ix_double(xp, &xx);
+#line 1682
- return ENOERR;
+#line 1682
+ return NC_NOERR;
+#line 1682
}
+#line 1682
static int
+#line 1683
ncx_put_double_ushort(void *xp, const ushort *ip)
+#line 1683
{
+#line 1683
ix_double xx = (ix_double)*ip;
+#line 1683
put_ix_double(xp, &xx);
+#line 1683
- return ENOERR;
+#line 1683
+ return NC_NOERR;
+#line 1683
}
+#line 1683
static int
+#line 1684
ncx_put_double_int(void *xp, const int *ip)
+#line 1684
{
+#line 1684
ix_double xx = (ix_double)*ip;
+#line 1684
put_ix_double(xp, &xx);
+#line 1684
- return ENOERR;
+#line 1684
+ return NC_NOERR;
+#line 1684
}
+#line 1684
static int
+#line 1685
ncx_put_double_uint(void *xp, const uint *ip)
+#line 1685
{
+#line 1685
ix_double xx = (ix_double)*ip;
+#line 1685
put_ix_double(xp, &xx);
+#line 1685
- return ENOERR;
+#line 1685
+ return NC_NOERR;
+#line 1685
}
+#line 1685
static int
+#line 1686
ncx_put_double_longlong(void *xp, const longlong *ip)
+#line 1686
{
+#line 1686
ix_double xx = (ix_double)*ip;
+#line 1686
put_ix_double(xp, &xx);
+#line 1686
- return ENOERR;
+#line 1686
+ return NC_NOERR;
+#line 1686
}
+#line 1686
static int
+#line 1687
ncx_put_double_ulonglong(void *xp, const ulonglong *ip)
+#line 1687
{
+#line 1687
ix_double xx = (ix_double)*ip;
+#line 1687
put_ix_double(xp, &xx);
+#line 1687
- return ENOERR;
+#line 1687
+ return NC_NOERR;
+#line 1687
}
+#line 1687
static int
@@ -2757,7 +4282,7 @@ ncx_put_double_float(void *xp, const float *ip)
if((double)(*ip) > X_DOUBLE_MAX || (double)(*ip) < X_DOUBLE_MIN)
return NC_ERANGE;
#endif
- return ENOERR;
+ return NC_NOERR;
}
#if X_SIZEOF_DOUBLE != SIZEOF_DOUBLE || defined(NO_IEEE_FLOAT)
@@ -2769,7 +4294,7 @@ ncx_put_double_double(void *xp, const double *ip)
if(*ip > X_DOUBLE_MAX || *ip < X_DOUBLE_MIN)
return NC_ERANGE;
#endif
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -2824,273 +4349,521 @@ put_ix_longlong(void *xp, const ix_longlong *ip)
}
static int
+#line 1764
ncx_get_longlong_schar(const void *xp, schar *ip)
+#line 1764
{
+#line 1764
ix_longlong xx;
+#line 1764
get_ix_longlong(xp, &xx);
+#line 1764
*ip = (schar) xx;
+#line 1764
#if IX_LONGLONG_MAX > SCHAR_MAX
+#line 1764
if (xx > SCHAR_MAX || xx < SCHAR_MIN) return NC_ERANGE;
+#line 1764
#endif
+#line 1764
- return ENOERR;
+#line 1764
+ return NC_NOERR;
+#line 1764
}
+#line 1764
static int
+#line 1765
ncx_get_longlong_short(const void *xp, short *ip)
+#line 1765
{
+#line 1765
#if SIZEOF_IX_LONGLONG == SIZEOF_SHORT && IX_LONGLONG_MAX == SHORT_MAX
+#line 1765
get_ix_longlong(xp, (ix_longlong *)ip);
- return ENOERR;
+#line 1765
+ return NC_NOERR;
+#line 1765
#else
+#line 1765
ix_longlong xx;
+#line 1765
get_ix_longlong(xp, &xx);
+#line 1765
*ip = (short) xx;
+#line 1765
#if IX_LONGLONG_MAX > SHORT_MAX
+#line 1765
if (xx > SHORT_MAX || xx < SHORT_MIN) return NC_ERANGE;
+#line 1765
#endif
+#line 1765
+#line 1765
#endif
- return ENOERR;
+#line 1765
+ return NC_NOERR;
+#line 1765
}
+#line 1765
static int
+#line 1766
ncx_get_longlong_int(const void *xp, int *ip)
+#line 1766
{
+#line 1766
#if SIZEOF_IX_LONGLONG == SIZEOF_INT && IX_LONGLONG_MAX == INT_MAX
+#line 1766
get_ix_longlong(xp, (ix_longlong *)ip);
- return ENOERR;
+#line 1766
+ return NC_NOERR;
+#line 1766
#else
+#line 1766
ix_longlong xx;
+#line 1766
get_ix_longlong(xp, &xx);
+#line 1766
*ip = (int) xx;
+#line 1766
#if IX_LONGLONG_MAX > INT_MAX
+#line 1766
if (xx > INT_MAX || xx < INT_MIN) return NC_ERANGE;
+#line 1766
#endif
+#line 1766
+#line 1766
#endif
- return ENOERR;
+#line 1766
+ return NC_NOERR;
+#line 1766
}
+#line 1766
static int
+#line 1767
ncx_get_longlong_longlong(const void *xp, longlong *ip)
+#line 1767
{
+#line 1767
#if SIZEOF_IX_LONGLONG == SIZEOF_LONGLONG && IX_LONGLONG_MAX == LONGLONG_MAX
+#line 1767
get_ix_longlong(xp, (ix_longlong *)ip);
- return ENOERR;
+#line 1767
+ return NC_NOERR;
+#line 1767
#else
+#line 1767
ix_longlong xx;
+#line 1767
get_ix_longlong(xp, &xx);
+#line 1767
*ip = (longlong) xx;
+#line 1767
#if IX_LONGLONG_MAX > LONGLONG_MAX
+#line 1767
if (xx > LONGLONG_MAX || xx < LONGLONG_MIN) return NC_ERANGE;
+#line 1767
#endif
+#line 1767
+#line 1767
#endif
- return ENOERR;
+#line 1767
+ return NC_NOERR;
+#line 1767
}
+#line 1767
static int
+#line 1768
ncx_get_longlong_ushort(const void *xp, ushort *ip)
+#line 1768
{
+#line 1768
ix_longlong xx;
+#line 1768
get_ix_longlong(xp, &xx);
+#line 1768
*ip = (ushort) xx;
+#line 1768
#if IX_LONGLONG_MAX > USHORT_MAX
+#line 1768
if (xx > USHORT_MAX) return NC_ERANGE;
+#line 1768
#endif
+#line 1768
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 1768
+ return NC_NOERR;
+#line 1768
}
+#line 1768
static int
+#line 1769
ncx_get_longlong_uchar(const void *xp, uchar *ip)
+#line 1769
{
+#line 1769
ix_longlong xx;
+#line 1769
get_ix_longlong(xp, &xx);
+#line 1769
*ip = (uchar) xx;
+#line 1769
#if IX_LONGLONG_MAX > UCHAR_MAX
+#line 1769
if (xx > UCHAR_MAX) return NC_ERANGE;
+#line 1769
#endif
+#line 1769
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 1769
+ return NC_NOERR;
+#line 1769
}
+#line 1769
static int
+#line 1770
ncx_get_longlong_uint(const void *xp, uint *ip)
+#line 1770
{
+#line 1770
ix_longlong xx;
+#line 1770
get_ix_longlong(xp, &xx);
+#line 1770
*ip = (uint) xx;
+#line 1770
#if IX_LONGLONG_MAX > UINT_MAX
+#line 1770
if (xx > UINT_MAX) return NC_ERANGE;
+#line 1770
#endif
+#line 1770
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 1770
+ return NC_NOERR;
+#line 1770
}
+#line 1770
static int
+#line 1771
ncx_get_longlong_ulonglong(const void *xp, ulonglong *ip)
+#line 1771
{
+#line 1771
ix_longlong xx;
+#line 1771
get_ix_longlong(xp, &xx);
+#line 1771
*ip = (ulonglong) xx;
+#line 1771
#if IX_LONGLONG_MAX > ULONGLONG_MAX
+#line 1771
if (xx > ULONGLONG_MAX) return NC_ERANGE;
+#line 1771
#endif
+#line 1771
if (xx < 0) return NC_ERANGE; /* because ip is unsigned */
- return ENOERR;
+#line 1771
+ return NC_NOERR;
+#line 1771
}
+#line 1771
static int
+#line 1772
ncx_get_longlong_float(const void *xp, float *ip)
+#line 1772
{
+#line 1772
ix_longlong xx;
+#line 1772
get_ix_longlong(xp, &xx);
+#line 1772
*ip = (float) xx;
+#line 1772
- return ENOERR;
+#line 1772
+ return NC_NOERR;
+#line 1772
}
+#line 1772
static int
+#line 1773
ncx_get_longlong_double(const void *xp, double *ip)
+#line 1773
{
+#line 1773
ix_longlong xx;
+#line 1773
get_ix_longlong(xp, &xx);
+#line 1773
*ip = (double) xx;
+#line 1773
- return ENOERR;
+#line 1773
+ return NC_NOERR;
+#line 1773
}
+#line 1773
static int
+#line 1775
ncx_put_longlong_schar(void *xp, const schar *ip)
+#line 1775
{
+#line 1775
ix_longlong xx = (ix_longlong)*ip;
+#line 1775
put_ix_longlong(xp, &xx);
+#line 1775
#if IX_LONGLONG_MAX < SCHAR_MAX
+#line 1775
if (*ip > IX_LONGLONG_MAX || *ip < X_LONGLONG_MIN) return NC_ERANGE;
+#line 1775
#endif
+#line 1775
- return ENOERR;
+#line 1775
+ return NC_NOERR;
+#line 1775
}
+#line 1775
static int
+#line 1776
ncx_put_longlong_short(void *xp, const short *ip)
+#line 1776
{
+#line 1776
#if SIZEOF_IX_LONGLONG == SIZEOF_SHORT && IX_LONGLONG_MAX == SHORT_MAX
+#line 1776
put_ix_longlong(xp, (const ix_longlong *)ip);
- return ENOERR;
+#line 1776
+ return NC_NOERR;
+#line 1776
#else
+#line 1776
ix_longlong xx = (ix_longlong)*ip;
+#line 1776
put_ix_longlong(xp, &xx);
+#line 1776
#if IX_LONGLONG_MAX < SHORT_MAX
+#line 1776
if (*ip > IX_LONGLONG_MAX || *ip < X_LONGLONG_MIN) return NC_ERANGE;
+#line 1776
#endif
+#line 1776
+#line 1776
#endif
- return ENOERR;
+#line 1776
+ return NC_NOERR;
+#line 1776
}
+#line 1776
static int
+#line 1777
ncx_put_longlong_int(void *xp, const int *ip)
+#line 1777
{
+#line 1777
#if SIZEOF_IX_LONGLONG == SIZEOF_INT && IX_LONGLONG_MAX == INT_MAX
+#line 1777
put_ix_longlong(xp, (const ix_longlong *)ip);
- return ENOERR;
+#line 1777
+ return NC_NOERR;
+#line 1777
#else
+#line 1777
ix_longlong xx = (ix_longlong)*ip;
+#line 1777
put_ix_longlong(xp, &xx);
+#line 1777
#if IX_LONGLONG_MAX < INT_MAX
+#line 1777
if (*ip > IX_LONGLONG_MAX || *ip < X_LONGLONG_MIN) return NC_ERANGE;
+#line 1777
#endif
+#line 1777
+#line 1777
#endif
- return ENOERR;
+#line 1777
+ return NC_NOERR;
+#line 1777
}
+#line 1777
static int
+#line 1778
ncx_put_longlong_longlong(void *xp, const longlong *ip)
+#line 1778
{
+#line 1778
#if SIZEOF_IX_LONGLONG == SIZEOF_LONGLONG && IX_LONGLONG_MAX == LONGLONG_MAX
+#line 1778
put_ix_longlong(xp, (const ix_longlong *)ip);
- return ENOERR;
+#line 1778
+ return NC_NOERR;
+#line 1778
#else
+#line 1778
ix_longlong xx = (ix_longlong)*ip;
+#line 1778
put_ix_longlong(xp, &xx);
+#line 1778
#if IX_LONGLONG_MAX < LONGLONG_MAX
+#line 1778
if (*ip > IX_LONGLONG_MAX || *ip < X_LONGLONG_MIN) return NC_ERANGE;
+#line 1778
#endif
+#line 1778
+#line 1778
#endif
- return ENOERR;
+#line 1778
+ return NC_NOERR;
+#line 1778
}
+#line 1778
static int
+#line 1779
ncx_put_longlong_ushort(void *xp, const ushort *ip)
+#line 1779
{
+#line 1779
ix_longlong xx = (ix_longlong)*ip;
+#line 1779
put_ix_longlong(xp, &xx);
+#line 1779
#if IX_LONGLONG_MAX < USHORT_MAX
+#line 1779
if (*ip > IX_LONGLONG_MAX) return NC_ERANGE;
+#line 1779
#endif
+#line 1779
- return ENOERR;
+#line 1779
+ return NC_NOERR;
+#line 1779
}
+#line 1779
static int
+#line 1780
ncx_put_longlong_uchar(void *xp, const uchar *ip)
+#line 1780
{
+#line 1780
ix_longlong xx = (ix_longlong)*ip;
+#line 1780
put_ix_longlong(xp, &xx);
+#line 1780
#if IX_LONGLONG_MAX < UCHAR_MAX
+#line 1780
if (*ip > IX_LONGLONG_MAX) return NC_ERANGE;
+#line 1780
#endif
+#line 1780
- return ENOERR;
+#line 1780
+ return NC_NOERR;
+#line 1780
}
+#line 1780
static int
+#line 1781
ncx_put_longlong_uint(void *xp, const uint *ip)
+#line 1781
{
+#line 1781
ix_longlong xx = (ix_longlong)*ip;
+#line 1781
put_ix_longlong(xp, &xx);
+#line 1781
#if IX_LONGLONG_MAX < UINT_MAX
+#line 1781
if (*ip > IX_LONGLONG_MAX) return NC_ERANGE;
+#line 1781
#endif
+#line 1781
- return ENOERR;
+#line 1781
+ return NC_NOERR;
+#line 1781
}
+#line 1781
static int
+#line 1782
ncx_put_longlong_ulonglong(void *xp, const ulonglong *ip)
+#line 1782
{
+#line 1782
ix_longlong xx = (ix_longlong)*ip;
+#line 1782
put_ix_longlong(xp, &xx);
+#line 1782
#if IX_LONGLONG_MAX < ULONGLONG_MAX
+#line 1782
if (*ip > IX_LONGLONG_MAX) return NC_ERANGE;
+#line 1782
#endif
+#line 1782
- return ENOERR;
+#line 1782
+ return NC_NOERR;
+#line 1782
}
+#line 1782
static int
+#line 1783
ncx_put_longlong_float(void *xp, const float *ip)
+#line 1783
{
+#line 1783
ix_longlong xx = (ix_longlong)*ip;
+#line 1783
put_ix_longlong(xp, &xx);
+#line 1783
if(*ip > (double)X_LONGLONG_MAX || *ip < (double)X_LONGLONG_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1783
+ return NC_NOERR;
+#line 1783
}
+#line 1783
static int
+#line 1784
ncx_put_longlong_double(void *xp, const double *ip)
+#line 1784
{
+#line 1784
ix_longlong xx = (ix_longlong)*ip;
+#line 1784
put_ix_longlong(xp, &xx);
+#line 1784
if(*ip > X_LONGLONG_MAX || *ip < X_LONGLONG_MIN) return NC_ERANGE;
- return ENOERR;
+#line 1784
+ return NC_NOERR;
+#line 1784
}
+#line 1784
/* x_ulonglong --------------------------------------------------------------------*/
@@ -3143,283 +4916,541 @@ put_ix_ulonglong(void *xp, const ix_ulonglong *ip)
}
static int
+#line 1835
ncx_get_ulonglong_schar(const void *xp, schar *ip)
+#line 1835
{
+#line 1835
ix_ulonglong xx;
+#line 1835
get_ix_ulonglong(xp, &xx);
+#line 1835
*ip = (schar) xx;
+#line 1835
#if IX_ULONGLONG_MAX > SCHAR_MAX
+#line 1835
if (xx > SCHAR_MAX) return NC_ERANGE;
+#line 1835
#endif
+#line 1835
- return ENOERR;
+#line 1835
+ return NC_NOERR;
+#line 1835
}
+#line 1835
static int
+#line 1836
ncx_get_ulonglong_short(const void *xp, short *ip)
+#line 1836
{
+#line 1836
ix_ulonglong xx;
+#line 1836
get_ix_ulonglong(xp, &xx);
+#line 1836
*ip = (short) xx;
+#line 1836
#if IX_ULONGLONG_MAX > SHORT_MAX
+#line 1836
if (xx > SHORT_MAX) return NC_ERANGE;
+#line 1836
#endif
+#line 1836
- return ENOERR;
+#line 1836
+ return NC_NOERR;
+#line 1836
}
+#line 1836
static int
+#line 1837
ncx_get_ulonglong_int(const void *xp, int *ip)
+#line 1837
{
+#line 1837
ix_ulonglong xx;
+#line 1837
get_ix_ulonglong(xp, &xx);
+#line 1837
*ip = (int) xx;
+#line 1837
#if IX_ULONGLONG_MAX > INT_MAX
+#line 1837
if (xx > INT_MAX) return NC_ERANGE;
+#line 1837
#endif
+#line 1837
- return ENOERR;
+#line 1837
+ return NC_NOERR;
+#line 1837
}
+#line 1837
static int
+#line 1838
ncx_get_ulonglong_longlong(const void *xp, longlong *ip)
+#line 1838
{
+#line 1838
ix_ulonglong xx;
+#line 1838
get_ix_ulonglong(xp, &xx);
+#line 1838
*ip = (longlong) xx;
+#line 1838
#if IX_ULONGLONG_MAX > LONGLONG_MAX
+#line 1838
if (xx > LONGLONG_MAX) return NC_ERANGE;
+#line 1838
#endif
+#line 1838
- return ENOERR;
+#line 1838
+ return NC_NOERR;
+#line 1838
}
+#line 1838
static int
+#line 1839
ncx_get_ulonglong_ushort(const void *xp, ushort *ip)
+#line 1839
{
+#line 1839
#if SIZEOF_IX_ULONGLONG == SIZEOF_USHORT && IX_ULONGLONG_MAX == USHORT_MAX
+#line 1839
get_ix_ulonglong(xp, (ix_ulonglong *)ip);
- return ENOERR;
+#line 1839
+ return NC_NOERR;
+#line 1839
#else
+#line 1839
ix_ulonglong xx;
+#line 1839
get_ix_ulonglong(xp, &xx);
+#line 1839
*ip = (ushort) xx;
+#line 1839
#if IX_ULONGLONG_MAX > USHORT_MAX
+#line 1839
if (xx > USHORT_MAX) return NC_ERANGE;
+#line 1839
#endif
+#line 1839
+#line 1839
#endif
- return ENOERR;
+#line 1839
+ return NC_NOERR;
+#line 1839
}
+#line 1839
static int
+#line 1840
ncx_get_ulonglong_uchar(const void *xp, uchar *ip)
+#line 1840
{
+#line 1840
#if SIZEOF_IX_ULONGLONG == SIZEOF_UCHAR && IX_ULONGLONG_MAX == UCHAR_MAX
+#line 1840
get_ix_ulonglong(xp, (ix_ulonglong *)ip);
- return ENOERR;
+#line 1840
+ return NC_NOERR;
+#line 1840
#else
+#line 1840
ix_ulonglong xx;
+#line 1840
get_ix_ulonglong(xp, &xx);
+#line 1840
*ip = (uchar) xx;
+#line 1840
#if IX_ULONGLONG_MAX > UCHAR_MAX
+#line 1840
if (xx > UCHAR_MAX) return NC_ERANGE;
+#line 1840
#endif
+#line 1840
+#line 1840
#endif
- return ENOERR;
+#line 1840
+ return NC_NOERR;
+#line 1840
}
+#line 1840
static int
+#line 1841
ncx_get_ulonglong_uint(const void *xp, uint *ip)
+#line 1841
{
+#line 1841
#if SIZEOF_IX_ULONGLONG == SIZEOF_UINT && IX_ULONGLONG_MAX == UINT_MAX
+#line 1841
get_ix_ulonglong(xp, (ix_ulonglong *)ip);
- return ENOERR;
+#line 1841
+ return NC_NOERR;
+#line 1841
#else
+#line 1841
ix_ulonglong xx;
+#line 1841
get_ix_ulonglong(xp, &xx);
+#line 1841
*ip = (uint) xx;
+#line 1841
#if IX_ULONGLONG_MAX > UINT_MAX
+#line 1841
if (xx > UINT_MAX) return NC_ERANGE;
+#line 1841
#endif
+#line 1841
+#line 1841
#endif
- return ENOERR;
+#line 1841
+ return NC_NOERR;
+#line 1841
}
+#line 1841
static int
+#line 1842
ncx_get_ulonglong_ulonglong(const void *xp, ulonglong *ip)
+#line 1842
{
+#line 1842
#if SIZEOF_IX_ULONGLONG == SIZEOF_ULONGLONG && IX_ULONGLONG_MAX == ULONGLONG_MAX
+#line 1842
get_ix_ulonglong(xp, (ix_ulonglong *)ip);
- return ENOERR;
+#line 1842
+ return NC_NOERR;
+#line 1842
#else
+#line 1842
ix_ulonglong xx;
+#line 1842
get_ix_ulonglong(xp, &xx);
+#line 1842
*ip = (ulonglong) xx;
+#line 1842
#if IX_ULONGLONG_MAX > ULONGLONG_MAX
+#line 1842
if (xx > ULONGLONG_MAX) return NC_ERANGE;
+#line 1842
#endif
+#line 1842
+#line 1842
#endif
- return ENOERR;
+#line 1842
+ return NC_NOERR;
+#line 1842
}
+#line 1842
static int
+#line 1843
ncx_get_ulonglong_float(const void *xp, float *ip)
+#line 1843
{
+#line 1843
ix_ulonglong xx;
+#line 1843
get_ix_ulonglong(xp, &xx);
+#line 1843
*ip = (float) xx;
+#line 1843
- return ENOERR;
+#line 1843
+ return NC_NOERR;
+#line 1843
}
+#line 1843
static int
+#line 1844
ncx_get_ulonglong_double(const void *xp, double *ip)
+#line 1844
{
+#line 1844
ix_ulonglong xx;
+#line 1844
get_ix_ulonglong(xp, &xx);
+#line 1844
*ip = (double) xx;
+#line 1844
- return ENOERR;
+#line 1844
+ return NC_NOERR;
+#line 1844
}
+#line 1844
static int
+#line 1846
ncx_put_ulonglong_schar(void *xp, const schar *ip)
+#line 1846
{
+#line 1846
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1846
put_ix_ulonglong(xp, &xx);
+#line 1846
#if IX_ULONGLONG_MAX < SCHAR_MAX
+#line 1846
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1846
#endif
+#line 1846
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 1846
+ return NC_NOERR;
+#line 1846
}
+#line 1846
static int
+#line 1847
ncx_put_ulonglong_short(void *xp, const short *ip)
+#line 1847
{
+#line 1847
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1847
put_ix_ulonglong(xp, &xx);
+#line 1847
#if IX_ULONGLONG_MAX < SHORT_MAX
+#line 1847
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1847
#endif
+#line 1847
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 1847
+ return NC_NOERR;
+#line 1847
}
+#line 1847
static int
+#line 1848
ncx_put_ulonglong_int(void *xp, const int *ip)
+#line 1848
{
+#line 1848
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1848
put_ix_ulonglong(xp, &xx);
+#line 1848
#if IX_ULONGLONG_MAX < INT_MAX
+#line 1848
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1848
#endif
+#line 1848
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 1848
+ return NC_NOERR;
+#line 1848
}
+#line 1848
static int
+#line 1849
ncx_put_ulonglong_longlong(void *xp, const longlong *ip)
+#line 1849
{
+#line 1849
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1849
put_ix_ulonglong(xp, &xx);
+#line 1849
#if IX_ULONGLONG_MAX < LONGLONG_MAX
+#line 1849
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1849
#endif
+#line 1849
if (*ip < 0) return NC_ERANGE; /* because xp is unsigned */
- return ENOERR;
+#line 1849
+ return NC_NOERR;
+#line 1849
}
+#line 1849
static int
+#line 1850
ncx_put_ulonglong_uchar(void *xp, const uchar *ip)
+#line 1850
{
+#line 1850
#if SIZEOF_IX_ULONGLONG == SIZEOF_UCHAR && IX_ULONGLONG_MAX == UCHAR_MAX
+#line 1850
put_ix_ulonglong(xp, (const ix_ulonglong *)ip);
- return ENOERR;
+#line 1850
+ return NC_NOERR;
+#line 1850
#else
+#line 1850
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1850
put_ix_ulonglong(xp, &xx);
+#line 1850
#if IX_ULONGLONG_MAX < UCHAR_MAX
+#line 1850
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1850
#endif
+#line 1850
+#line 1850
#endif
- return ENOERR;
+#line 1850
+ return NC_NOERR;
+#line 1850
}
+#line 1850
static int
+#line 1851
ncx_put_ulonglong_ushort(void *xp, const ushort *ip)
+#line 1851
{
+#line 1851
#if SIZEOF_IX_ULONGLONG == SIZEOF_USHORT && IX_ULONGLONG_MAX == USHORT_MAX
+#line 1851
put_ix_ulonglong(xp, (const ix_ulonglong *)ip);
- return ENOERR;
+#line 1851
+ return NC_NOERR;
+#line 1851
#else
+#line 1851
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1851
put_ix_ulonglong(xp, &xx);
+#line 1851
#if IX_ULONGLONG_MAX < USHORT_MAX
+#line 1851
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1851
#endif
+#line 1851
+#line 1851
#endif
- return ENOERR;
+#line 1851
+ return NC_NOERR;
+#line 1851
}
+#line 1851
static int
+#line 1852
ncx_put_ulonglong_uint(void *xp, const uint *ip)
+#line 1852
{
+#line 1852
#if SIZEOF_IX_ULONGLONG == SIZEOF_UINT && IX_ULONGLONG_MAX == UINT_MAX
+#line 1852
put_ix_ulonglong(xp, (const ix_ulonglong *)ip);
- return ENOERR;
+#line 1852
+ return NC_NOERR;
+#line 1852
#else
+#line 1852
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1852
put_ix_ulonglong(xp, &xx);
+#line 1852
#if IX_ULONGLONG_MAX < UINT_MAX
+#line 1852
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1852
#endif
+#line 1852
+#line 1852
#endif
- return ENOERR;
+#line 1852
+ return NC_NOERR;
+#line 1852
}
+#line 1852
static int
+#line 1853
ncx_put_ulonglong_ulonglong(void *xp, const ulonglong *ip)
+#line 1853
{
+#line 1853
#if SIZEOF_IX_ULONGLONG == SIZEOF_ULONGLONG && IX_ULONGLONG_MAX == ULONGLONG_MAX
+#line 1853
put_ix_ulonglong(xp, (const ix_ulonglong *)ip);
- return ENOERR;
+#line 1853
+ return NC_NOERR;
+#line 1853
#else
+#line 1853
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1853
put_ix_ulonglong(xp, &xx);
+#line 1853
#if IX_ULONGLONG_MAX < ULONGLONG_MAX
+#line 1853
if (*ip > IX_ULONGLONG_MAX) return NC_ERANGE;
+#line 1853
#endif
+#line 1853
+#line 1853
#endif
- return ENOERR;
+#line 1853
+ return NC_NOERR;
+#line 1853
}
+#line 1853
static int
+#line 1854
ncx_put_ulonglong_float(void *xp, const float *ip)
+#line 1854
{
+#line 1854
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1854
put_ix_ulonglong(xp, &xx);
+#line 1854
if(*ip > (double)X_ULONGLONG_MAX || *ip < 0) return NC_ERANGE;
- return ENOERR;
+#line 1854
+ return NC_NOERR;
+#line 1854
}
+#line 1854
static int
+#line 1855
ncx_put_ulonglong_double(void *xp, const double *ip)
+#line 1855
{
+#line 1855
ix_ulonglong xx = (ix_ulonglong)*ip;
+#line 1855
put_ix_ulonglong(xp, &xx);
+#line 1855
if(*ip > X_ULONGLONG_MAX || *ip < 0) return NC_ERANGE;
- return ENOERR;
+#line 1855
+ return NC_NOERR;
+#line 1855
}
+#line 1855
/* x_size_t */
@@ -3442,7 +5473,7 @@ ncx_put_size_t(void **xpp, const size_t *ulp)
*cp = (uchar)((*ulp) & 0x000000ff);
*xpp = (void *)((char *)(*xpp) + X_SIZEOF_SIZE_T);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -3457,7 +5488,7 @@ ncx_get_size_t(const void **xpp, size_t *ulp)
*ulp |= *cp;
*xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_SIZE_T);
- return ENOERR;
+ return NC_NOERR;
}
/* x_off_t */
@@ -3504,7 +5535,7 @@ ncx_put_off_t(void **xpp, const off_t *lp, size_t sizeof_off_t)
#endif
}
*xpp = (void *)((char *)(*xpp) + sizeof_off_t);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -3561,7 +5592,7 @@ ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t)
#endif
}
*xpp = (const void *)((const char *)(*xpp) + sizeof_off_t);
- return ENOERR;
+ return NC_NOERR;
}
/*----< ncx_get_int32() >--------------------------------------------------*/
@@ -3665,1519 +5696,2894 @@ ncx_put_int64(void **xpp,
/*
* Aggregate numeric conversion functions.
*/
+#line 2103
+#line 2539
+#line 2545
/* schar ---------------------------------------------------------------------*/
+#line 2549
int
ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
{
(void) memcpy(tp, *xpp, nelems);
- *xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+#line 2552
+ *xpp = (void *)((schar *)(*xpp) + nelems);
+#line 2552
+ return NC_NOERR;
+#line 2552
}
+#line 2555
int
ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
{
(void) memcpy(tp, *xpp, nelems);
- *xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+#line 2558
+ *xpp = (void *)((schar *)(*xpp) + nelems);
+#line 2558
+ return NC_NOERR;
+#line 2558
}
int
+#line 2560
ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp)
+#line 2560
{
- int status = ENOERR;
+#line 2560
+ int status = NC_NOERR;
+#line 2560
schar *xp = (schar *)(*xpp);
+#line 2560
+#line 2560
while(nelems-- != 0)
+#line 2560
{
+#line 2560
+#line 2560
*tp++ = *xp++;
+#line 2560
}
+#line 2560
+#line 2560
*xpp = (const void *)xp;
+#line 2560
return status;
+#line 2560
}
+#line 2560
int
+#line 2561
ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp)
+#line 2561
{
- int status = ENOERR;
+#line 2561
+ int status = NC_NOERR;
+#line 2561
schar *xp = (schar *)(*xpp);
+#line 2561
+#line 2561
while(nelems-- != 0)
+#line 2561
{
+#line 2561
+#line 2561
*tp++ = *xp++;
+#line 2561
}
+#line 2561
+#line 2561
*xpp = (const void *)xp;
+#line 2561
return status;
+#line 2561
}
+#line 2561
int
+#line 2562
ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
+#line 2562
{
- int status = ENOERR;
+#line 2562
+ int status = NC_NOERR;
+#line 2562
schar *xp = (schar *)(*xpp);
+#line 2562
+#line 2562
while(nelems-- != 0)
+#line 2562
{
+#line 2562
+#line 2562
*tp++ = *xp++;
+#line 2562
}
+#line 2562
+#line 2562
*xpp = (const void *)xp;
+#line 2562
return status;
+#line 2562
}
+#line 2562
int
+#line 2563
ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
+#line 2563
{
- int status = ENOERR;
+#line 2563
+ int status = NC_NOERR;
+#line 2563
schar *xp = (schar *)(*xpp);
+#line 2563
+#line 2563
while(nelems-- != 0)
+#line 2563
{
+#line 2563
+#line 2563
*tp++ = *xp++;
+#line 2563
}
+#line 2563
+#line 2563
*xpp = (const void *)xp;
+#line 2563
return status;
+#line 2563
}
+#line 2563
int
+#line 2564
ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2564
{
- int status = ENOERR;
+#line 2564
+ int status = NC_NOERR;
+#line 2564
schar *xp = (schar *)(*xpp);
+#line 2564
+#line 2564
while(nelems-- != 0)
+#line 2564
{
+#line 2564
+#line 2564
*tp++ = *xp++;
+#line 2564
}
+#line 2564
+#line 2564
*xpp = (const void *)xp;
+#line 2564
return status;
+#line 2564
}
+#line 2564
int
+#line 2565
ncx_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2565
{
- int status = ENOERR;
+#line 2565
+ int status = NC_NOERR;
+#line 2565
schar *xp = (schar *)(*xpp);
+#line 2565
+#line 2565
while(nelems-- != 0)
+#line 2565
{
+#line 2565
if (*xp < 0) status = NC_ERANGE;
+#line 2565
*tp++ = *xp++;
+#line 2565
}
+#line 2565
+#line 2565
*xpp = (const void *)xp;
+#line 2565
return status;
+#line 2565
}
+#line 2565
int
+#line 2566
ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2566
{
- int status = ENOERR;
+#line 2566
+ int status = NC_NOERR;
+#line 2566
schar *xp = (schar *)(*xpp);
+#line 2566
+#line 2566
while(nelems-- != 0)
+#line 2566
{
+#line 2566
if (*xp < 0) status = NC_ERANGE;
+#line 2566
*tp++ = *xp++;
+#line 2566
}
+#line 2566
+#line 2566
*xpp = (const void *)xp;
+#line 2566
return status;
+#line 2566
}
+#line 2566
int
+#line 2567
ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2567
{
- int status = ENOERR;
+#line 2567
+ int status = NC_NOERR;
+#line 2567
schar *xp = (schar *)(*xpp);
+#line 2567
+#line 2567
while(nelems-- != 0)
+#line 2567
{
+#line 2567
if (*xp < 0) status = NC_ERANGE;
+#line 2567
*tp++ = *xp++;
+#line 2567
}
+#line 2567
+#line 2567
*xpp = (const void *)xp;
+#line 2567
return status;
+#line 2567
}
+#line 2567
+#line 2570
int
ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2573
+#line 2573
if(rndup)
+#line 2573
rndup = X_ALIGN - rndup;
+#line 2573
+#line 2573
(void) memcpy(tp, *xpp, nelems);
+#line 2573
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 2573
- return ENOERR;
+#line 2573
+ return NC_NOERR;
+#line 2573
}
+#line 2576
int
ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2579
+#line 2579
if(rndup)
+#line 2579
rndup = X_ALIGN - rndup;
+#line 2579
+#line 2579
(void) memcpy(tp, *xpp, nelems);
+#line 2579
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 2579
- return ENOERR;
+#line 2579
+ return NC_NOERR;
+#line 2579
}
int
+#line 2581
ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp)
+#line 2581
{
- int status = ENOERR;
+#line 2581
+ int status = NC_NOERR;
+#line 2581
size_t rndup = nelems % X_ALIGN;
+#line 2581
schar *xp = (schar *) *xpp;
+#line 2581
+#line 2581
if(rndup)
+#line 2581
rndup = X_ALIGN - rndup;
+#line 2581
+#line 2581
while(nelems-- != 0)
+#line 2581
{
+#line 2581
+#line 2581
*tp++ = *xp++;
+#line 2581
}
+#line 2581
+#line 2581
*xpp = (void *)(xp + rndup);
+#line 2581
return status;
+#line 2581
}
+#line 2581
int
+#line 2582
ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp)
+#line 2582
{
- int status = ENOERR;
+#line 2582
+ int status = NC_NOERR;
+#line 2582
size_t rndup = nelems % X_ALIGN;
+#line 2582
schar *xp = (schar *) *xpp;
+#line 2582
+#line 2582
if(rndup)
+#line 2582
rndup = X_ALIGN - rndup;
+#line 2582
+#line 2582
while(nelems-- != 0)
+#line 2582
{
+#line 2582
+#line 2582
*tp++ = *xp++;
+#line 2582
}
+#line 2582
+#line 2582
*xpp = (void *)(xp + rndup);
+#line 2582
return status;
+#line 2582
}
+#line 2582
int
+#line 2583
ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
+#line 2583
{
- int status = ENOERR;
+#line 2583
+ int status = NC_NOERR;
+#line 2583
size_t rndup = nelems % X_ALIGN;
+#line 2583
schar *xp = (schar *) *xpp;
+#line 2583
+#line 2583
if(rndup)
+#line 2583
rndup = X_ALIGN - rndup;
+#line 2583
+#line 2583
while(nelems-- != 0)
+#line 2583
{
+#line 2583
+#line 2583
*tp++ = *xp++;
+#line 2583
}
+#line 2583
+#line 2583
*xpp = (void *)(xp + rndup);
+#line 2583
return status;
+#line 2583
}
+#line 2583
int
+#line 2584
ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
+#line 2584
{
- int status = ENOERR;
+#line 2584
+ int status = NC_NOERR;
+#line 2584
size_t rndup = nelems % X_ALIGN;
+#line 2584
schar *xp = (schar *) *xpp;
+#line 2584
+#line 2584
if(rndup)
+#line 2584
rndup = X_ALIGN - rndup;
+#line 2584
+#line 2584
while(nelems-- != 0)
+#line 2584
{
+#line 2584
+#line 2584
*tp++ = *xp++;
+#line 2584
}
+#line 2584
+#line 2584
*xpp = (void *)(xp + rndup);
+#line 2584
return status;
+#line 2584
}
+#line 2584
int
+#line 2585
ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2585
{
- int status = ENOERR;
+#line 2585
+ int status = NC_NOERR;
+#line 2585
size_t rndup = nelems % X_ALIGN;
+#line 2585
schar *xp = (schar *) *xpp;
+#line 2585
+#line 2585
if(rndup)
+#line 2585
rndup = X_ALIGN - rndup;
+#line 2585
+#line 2585
while(nelems-- != 0)
+#line 2585
{
+#line 2585
+#line 2585
*tp++ = *xp++;
+#line 2585
}
+#line 2585
+#line 2585
*xpp = (void *)(xp + rndup);
+#line 2585
return status;
+#line 2585
}
+#line 2585
int
+#line 2586
ncx_pad_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2586
{
- int status = ENOERR;
+#line 2586
+ int status = NC_NOERR;
+#line 2586
size_t rndup = nelems % X_ALIGN;
+#line 2586
schar *xp = (schar *) *xpp;
+#line 2586
+#line 2586
if(rndup)
+#line 2586
rndup = X_ALIGN - rndup;
+#line 2586
+#line 2586
while(nelems-- != 0)
+#line 2586
{
+#line 2586
if (*xp < 0) status = NC_ERANGE;
+#line 2586
*tp++ = *xp++;
+#line 2586
}
+#line 2586
+#line 2586
*xpp = (void *)(xp + rndup);
+#line 2586
return status;
+#line 2586
}
+#line 2586
int
+#line 2587
ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2587
{
- int status = ENOERR;
+#line 2587
+ int status = NC_NOERR;
+#line 2587
size_t rndup = nelems % X_ALIGN;
+#line 2587
schar *xp = (schar *) *xpp;
+#line 2587
+#line 2587
if(rndup)
+#line 2587
rndup = X_ALIGN - rndup;
+#line 2587
+#line 2587
while(nelems-- != 0)
+#line 2587
{
+#line 2587
if (*xp < 0) status = NC_ERANGE;
+#line 2587
*tp++ = *xp++;
+#line 2587
}
+#line 2587
+#line 2587
*xpp = (void *)(xp + rndup);
+#line 2587
return status;
+#line 2587
}
+#line 2587
int
+#line 2588
ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2588
{
- int status = ENOERR;
+#line 2588
+ int status = NC_NOERR;
+#line 2588
size_t rndup = nelems % X_ALIGN;
+#line 2588
schar *xp = (schar *) *xpp;
+#line 2588
+#line 2588
if(rndup)
+#line 2588
rndup = X_ALIGN - rndup;
+#line 2588
+#line 2588
while(nelems-- != 0)
+#line 2588
{
+#line 2588
if (*xp < 0) status = NC_ERANGE;
+#line 2588
*tp++ = *xp++;
+#line 2588
}
+#line 2588
+#line 2588
*xpp = (void *)(xp + rndup);
+#line 2588
return status;
+#line 2588
}
+#line 2588
+#line 2591
int
ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 2594
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2594
- return ENOERR;
+#line 2594
+ return NC_NOERR;
+#line 2594
}
+#line 2597
int
ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 2600
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2600
- return ENOERR;
+#line 2600
+ return NC_NOERR;
+#line 2600
}
int
+#line 2602
ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp)
+#line 2602
{
- int status = ENOERR;
+#line 2602
+ int status = NC_NOERR;
+#line 2602
schar *xp = (schar *) *xpp;
+#line 2602
+#line 2602
while(nelems-- != 0)
+#line 2602
{
+#line 2602
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2602
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2602
+ *xp++ = (schar) (signed)*tp++;
+#line 2602
}
+#line 2602
+#line 2602
*xpp = (void *)xp;
+#line 2602
return status;
+#line 2602
}
+#line 2602
int
+#line 2603
ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp)
+#line 2603
{
- int status = ENOERR;
+#line 2603
+ int status = NC_NOERR;
+#line 2603
schar *xp = (schar *) *xpp;
+#line 2603
+#line 2603
while(nelems-- != 0)
+#line 2603
{
+#line 2603
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2603
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2603
+ *xp++ = (schar) (signed)*tp++;
+#line 2603
}
+#line 2603
+#line 2603
*xpp = (void *)xp;
+#line 2603
return status;
+#line 2603
}
+#line 2603
int
+#line 2604
ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp)
+#line 2604
{
- int status = ENOERR;
+#line 2604
+ int status = NC_NOERR;
+#line 2604
schar *xp = (schar *) *xpp;
+#line 2604
+#line 2604
while(nelems-- != 0)
+#line 2604
{
+#line 2604
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2604
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2604
+ *xp++ = (schar) (signed)*tp++;
+#line 2604
}
+#line 2604
+#line 2604
*xpp = (void *)xp;
+#line 2604
return status;
+#line 2604
}
+#line 2604
int
+#line 2605
ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp)
+#line 2605
{
- int status = ENOERR;
+#line 2605
+ int status = NC_NOERR;
+#line 2605
schar *xp = (schar *) *xpp;
+#line 2605
+#line 2605
while(nelems-- != 0)
+#line 2605
{
+#line 2605
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2605
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2605
+ *xp++ = (schar) (signed)*tp++;
+#line 2605
}
+#line 2605
+#line 2605
*xpp = (void *)xp;
+#line 2605
return status;
+#line 2605
}
+#line 2605
int
+#line 2606
ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2606
{
- int status = ENOERR;
+#line 2606
+ int status = NC_NOERR;
+#line 2606
schar *xp = (schar *) *xpp;
+#line 2606
+#line 2606
while(nelems-- != 0)
+#line 2606
{
+#line 2606
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2606
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2606
+ *xp++ = (schar) (signed)*tp++;
+#line 2606
}
+#line 2606
+#line 2606
*xpp = (void *)xp;
+#line 2606
return status;
+#line 2606
}
+#line 2606
int
+#line 2607
ncx_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2607
{
- int status = ENOERR;
+#line 2607
+ int status = NC_NOERR;
+#line 2607
schar *xp = (schar *) *xpp;
+#line 2607
+#line 2607
while(nelems-- != 0)
+#line 2607
{
+#line 2607
if(*tp > X_SCHAR_MAX )
+#line 2607
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2607
+ *xp++ = (schar) (signed)*tp++;
+#line 2607
}
+#line 2607
+#line 2607
*xpp = (void *)xp;
+#line 2607
return status;
+#line 2607
}
+#line 2607
int
+#line 2608
ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2608
{
- int status = ENOERR;
+#line 2608
+ int status = NC_NOERR;
+#line 2608
schar *xp = (schar *) *xpp;
+#line 2608
+#line 2608
while(nelems-- != 0)
+#line 2608
{
+#line 2608
if(*tp > X_SCHAR_MAX )
+#line 2608
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2608
+ *xp++ = (schar) (signed)*tp++;
+#line 2608
}
+#line 2608
+#line 2608
*xpp = (void *)xp;
+#line 2608
return status;
+#line 2608
}
+#line 2608
int
+#line 2609
ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2609
{
- int status = ENOERR;
+#line 2609
+ int status = NC_NOERR;
+#line 2609
schar *xp = (schar *) *xpp;
+#line 2609
+#line 2609
while(nelems-- != 0)
+#line 2609
{
+#line 2609
if(*tp > X_SCHAR_MAX )
+#line 2609
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2609
+ *xp++ = (schar) (signed)*tp++;
+#line 2609
}
+#line 2609
+#line 2609
*xpp = (void *)xp;
+#line 2609
return status;
+#line 2609
}
+#line 2609
+#line 2612
int
ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2615
+#line 2615
if(rndup)
+#line 2615
rndup = X_ALIGN - rndup;
+#line 2615
+#line 2615
(void) memcpy(*xpp, tp, nelems);
+#line 2615
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2615
+#line 2615
if(rndup)
+#line 2615
{
+#line 2615
(void) memcpy(*xpp, nada, rndup);
+#line 2615
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2615
}
+#line 2615
- return ENOERR;
+#line 2615
+ return NC_NOERR;
+#line 2615
}
+#line 2618
int
ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2621
+#line 2621
if(rndup)
+#line 2621
rndup = X_ALIGN - rndup;
+#line 2621
+#line 2621
(void) memcpy(*xpp, tp, nelems);
+#line 2621
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2621
+#line 2621
if(rndup)
+#line 2621
{
+#line 2621
(void) memcpy(*xpp, nada, rndup);
+#line 2621
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2621
}
+#line 2621
- return ENOERR;
+#line 2621
+ return NC_NOERR;
+#line 2621
}
int
+#line 2623
ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp)
+#line 2623
{
- int status = ENOERR;
+#line 2623
+ int status = NC_NOERR;
+#line 2623
size_t rndup = nelems % X_ALIGN;
+#line 2623
schar *xp = (schar *) *xpp;
+#line 2623
+#line 2623
if(rndup)
+#line 2623
rndup = X_ALIGN - rndup;
+#line 2623
+#line 2623
while(nelems-- != 0)
+#line 2623
{
+#line 2623
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2623
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2623
+ *xp++ = (schar) (signed) *tp++;
+#line 2623
}
+#line 2623
+#line 2623
+#line 2623
if(rndup)
+#line 2623
{
+#line 2623
(void) memcpy(xp, nada, rndup);
+#line 2623
xp += rndup;
+#line 2623
}
+#line 2623
+#line 2623
*xpp = (void *)xp;
+#line 2623
return status;
+#line 2623
}
+#line 2623
int
+#line 2624
ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp)
+#line 2624
{
- int status = ENOERR;
+#line 2624
+ int status = NC_NOERR;
+#line 2624
size_t rndup = nelems % X_ALIGN;
+#line 2624
schar *xp = (schar *) *xpp;
+#line 2624
+#line 2624
if(rndup)
+#line 2624
rndup = X_ALIGN - rndup;
+#line 2624
+#line 2624
while(nelems-- != 0)
+#line 2624
{
+#line 2624
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2624
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2624
+ *xp++ = (schar) (signed) *tp++;
+#line 2624
}
+#line 2624
+#line 2624
+#line 2624
if(rndup)
+#line 2624
{
+#line 2624
(void) memcpy(xp, nada, rndup);
+#line 2624
xp += rndup;
+#line 2624
}
+#line 2624
+#line 2624
*xpp = (void *)xp;
+#line 2624
return status;
+#line 2624
}
+#line 2624
int
+#line 2625
ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp)
+#line 2625
{
- int status = ENOERR;
+#line 2625
+ int status = NC_NOERR;
+#line 2625
size_t rndup = nelems % X_ALIGN;
+#line 2625
schar *xp = (schar *) *xpp;
+#line 2625
+#line 2625
if(rndup)
+#line 2625
rndup = X_ALIGN - rndup;
+#line 2625
+#line 2625
while(nelems-- != 0)
+#line 2625
{
+#line 2625
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2625
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2625
+ *xp++ = (schar) (signed) *tp++;
+#line 2625
}
+#line 2625
+#line 2625
+#line 2625
if(rndup)
+#line 2625
{
+#line 2625
(void) memcpy(xp, nada, rndup);
+#line 2625
xp += rndup;
+#line 2625
}
+#line 2625
+#line 2625
*xpp = (void *)xp;
+#line 2625
return status;
+#line 2625
}
+#line 2625
int
+#line 2626
ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp)
+#line 2626
{
- int status = ENOERR;
+#line 2626
+ int status = NC_NOERR;
+#line 2626
size_t rndup = nelems % X_ALIGN;
+#line 2626
schar *xp = (schar *) *xpp;
+#line 2626
+#line 2626
if(rndup)
+#line 2626
rndup = X_ALIGN - rndup;
+#line 2626
+#line 2626
while(nelems-- != 0)
+#line 2626
{
+#line 2626
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2626
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2626
+ *xp++ = (schar) (signed) *tp++;
+#line 2626
}
+#line 2626
+#line 2626
+#line 2626
if(rndup)
+#line 2626
{
+#line 2626
(void) memcpy(xp, nada, rndup);
+#line 2626
xp += rndup;
+#line 2626
}
+#line 2626
+#line 2626
*xpp = (void *)xp;
+#line 2626
return status;
+#line 2626
}
+#line 2626
int
+#line 2627
ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2627
{
- int status = ENOERR;
+#line 2627
+ int status = NC_NOERR;
+#line 2627
size_t rndup = nelems % X_ALIGN;
+#line 2627
schar *xp = (schar *) *xpp;
+#line 2627
+#line 2627
if(rndup)
+#line 2627
rndup = X_ALIGN - rndup;
+#line 2627
+#line 2627
while(nelems-- != 0)
+#line 2627
{
+#line 2627
if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
+#line 2627
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2627
+ *xp++ = (schar) (signed) *tp++;
+#line 2627
}
+#line 2627
+#line 2627
+#line 2627
if(rndup)
+#line 2627
{
+#line 2627
(void) memcpy(xp, nada, rndup);
+#line 2627
xp += rndup;
+#line 2627
}
+#line 2627
+#line 2627
*xpp = (void *)xp;
+#line 2627
return status;
+#line 2627
}
+#line 2627
int
+#line 2628
ncx_pad_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2628
{
- int status = ENOERR;
+#line 2628
+ int status = NC_NOERR;
+#line 2628
size_t rndup = nelems % X_ALIGN;
+#line 2628
schar *xp = (schar *) *xpp;
+#line 2628
+#line 2628
if(rndup)
+#line 2628
rndup = X_ALIGN - rndup;
+#line 2628
+#line 2628
while(nelems-- != 0)
+#line 2628
{
+#line 2628
if(*tp > X_SCHAR_MAX )
+#line 2628
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2628
+ *xp++ = (schar) (signed) *tp++;
+#line 2628
}
+#line 2628
+#line 2628
+#line 2628
if(rndup)
+#line 2628
{
+#line 2628
(void) memcpy(xp, nada, rndup);
+#line 2628
xp += rndup;
+#line 2628
}
+#line 2628
+#line 2628
*xpp = (void *)xp;
+#line 2628
return status;
+#line 2628
}
+#line 2628
int
+#line 2629
ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2629
{
- int status = ENOERR;
+#line 2629
+ int status = NC_NOERR;
+#line 2629
size_t rndup = nelems % X_ALIGN;
+#line 2629
schar *xp = (schar *) *xpp;
+#line 2629
+#line 2629
if(rndup)
+#line 2629
rndup = X_ALIGN - rndup;
+#line 2629
+#line 2629
while(nelems-- != 0)
+#line 2629
{
+#line 2629
if(*tp > X_SCHAR_MAX )
+#line 2629
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2629
+ *xp++ = (schar) (signed) *tp++;
+#line 2629
}
+#line 2629
+#line 2629
+#line 2629
if(rndup)
+#line 2629
{
+#line 2629
(void) memcpy(xp, nada, rndup);
+#line 2629
xp += rndup;
+#line 2629
}
+#line 2629
+#line 2629
*xpp = (void *)xp;
+#line 2629
return status;
+#line 2629
}
+#line 2629
int
+#line 2630
ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2630
{
- int status = ENOERR;
+#line 2630
+ int status = NC_NOERR;
+#line 2630
size_t rndup = nelems % X_ALIGN;
+#line 2630
schar *xp = (schar *) *xpp;
+#line 2630
+#line 2630
if(rndup)
+#line 2630
rndup = X_ALIGN - rndup;
+#line 2630
+#line 2630
while(nelems-- != 0)
+#line 2630
{
+#line 2630
if(*tp > X_SCHAR_MAX )
+#line 2630
status = NC_ERANGE;
- *xp++ = (schar) *tp++;
+#line 2630
+ *xp++ = (schar) (signed) *tp++;
+#line 2630
}
+#line 2630
+#line 2630
+#line 2630
if(rndup)
+#line 2630
{
+#line 2630
(void) memcpy(xp, nada, rndup);
+#line 2630
xp += rndup;
+#line 2630
}
+#line 2630
+#line 2630
*xpp = (void *)xp;
+#line 2630
return status;
+#line 2630
}
+#line 2630
/* uchar ---------------------------------------------------------------------*/
+#line 2636
int
ncx_getn_uchar_schar(const void **xpp, size_t nelems, schar *tp)
{
(void) memcpy(tp, *xpp, nelems);
- *xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+#line 2639
+ *xpp = (void *)((schar *)(*xpp) + nelems);
+#line 2639
+ return NC_NOERR;
+#line 2639
}
+#line 2642
int
ncx_getn_uchar_uchar(const void **xpp, size_t nelems, uchar *tp)
{
(void) memcpy(tp, *xpp, nelems);
- *xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+#line 2645
+ *xpp = (void *)((schar *)(*xpp) + nelems);
+#line 2645
+ return NC_NOERR;
+#line 2645
}
int
+#line 2647
ncx_getn_uchar_short(const void **xpp, size_t nelems, short *tp)
+#line 2647
{
- int status = ENOERR;
+#line 2647
+ int status = NC_NOERR;
+#line 2647
uchar *xp = (uchar *)(*xpp);
+#line 2647
+#line 2647
while(nelems-- != 0)
+#line 2647
{
+#line 2647
+#line 2647
*tp++ = *xp++;
+#line 2647
}
+#line 2647
+#line 2647
*xpp = (const void *)xp;
+#line 2647
return status;
+#line 2647
}
+#line 2647
int
+#line 2648
ncx_getn_uchar_int(const void **xpp, size_t nelems, int *tp)
+#line 2648
{
- int status = ENOERR;
+#line 2648
+ int status = NC_NOERR;
+#line 2648
uchar *xp = (uchar *)(*xpp);
+#line 2648
+#line 2648
while(nelems-- != 0)
+#line 2648
{
+#line 2648
+#line 2648
*tp++ = *xp++;
+#line 2648
}
+#line 2648
+#line 2648
*xpp = (const void *)xp;
+#line 2648
return status;
+#line 2648
}
+#line 2648
int
+#line 2649
ncx_getn_uchar_float(const void **xpp, size_t nelems, float *tp)
+#line 2649
{
- int status = ENOERR;
+#line 2649
+ int status = NC_NOERR;
+#line 2649
uchar *xp = (uchar *)(*xpp);
+#line 2649
+#line 2649
while(nelems-- != 0)
+#line 2649
{
+#line 2649
+#line 2649
*tp++ = *xp++;
+#line 2649
}
+#line 2649
+#line 2649
*xpp = (const void *)xp;
+#line 2649
return status;
+#line 2649
}
+#line 2649
int
+#line 2650
ncx_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
+#line 2650
{
- int status = ENOERR;
+#line 2650
+ int status = NC_NOERR;
+#line 2650
uchar *xp = (uchar *)(*xpp);
+#line 2650
+#line 2650
while(nelems-- != 0)
+#line 2650
{
+#line 2650
+#line 2650
*tp++ = *xp++;
+#line 2650
}
+#line 2650
+#line 2650
*xpp = (const void *)xp;
+#line 2650
return status;
+#line 2650
}
+#line 2650
int
+#line 2651
ncx_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2651
{
- int status = ENOERR;
+#line 2651
+ int status = NC_NOERR;
+#line 2651
uchar *xp = (uchar *)(*xpp);
+#line 2651
+#line 2651
while(nelems-- != 0)
+#line 2651
{
+#line 2651
+#line 2651
*tp++ = *xp++;
+#line 2651
}
+#line 2651
+#line 2651
*xpp = (const void *)xp;
+#line 2651
return status;
+#line 2651
}
+#line 2651
int
+#line 2652
ncx_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2652
{
- int status = ENOERR;
+#line 2652
+ int status = NC_NOERR;
+#line 2652
uchar *xp = (uchar *)(*xpp);
+#line 2652
+#line 2652
while(nelems-- != 0)
+#line 2652
{
+#line 2652
+#line 2652
*tp++ = *xp++;
+#line 2652
}
+#line 2652
+#line 2652
*xpp = (const void *)xp;
+#line 2652
return status;
+#line 2652
}
+#line 2652
int
+#line 2653
ncx_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2653
{
- int status = ENOERR;
+#line 2653
+ int status = NC_NOERR;
+#line 2653
uchar *xp = (uchar *)(*xpp);
+#line 2653
+#line 2653
while(nelems-- != 0)
+#line 2653
{
+#line 2653
+#line 2653
*tp++ = *xp++;
+#line 2653
}
+#line 2653
+#line 2653
*xpp = (const void *)xp;
+#line 2653
return status;
+#line 2653
}
+#line 2653
int
+#line 2654
ncx_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2654
{
- int status = ENOERR;
+#line 2654
+ int status = NC_NOERR;
+#line 2654
uchar *xp = (uchar *)(*xpp);
+#line 2654
+#line 2654
while(nelems-- != 0)
+#line 2654
{
+#line 2654
+#line 2654
*tp++ = *xp++;
+#line 2654
}
+#line 2654
+#line 2654
*xpp = (const void *)xp;
+#line 2654
return status;
+#line 2654
}
+#line 2654
+#line 2657
int
ncx_pad_getn_uchar_schar(const void **xpp, size_t nelems, schar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2660
+#line 2660
if(rndup)
+#line 2660
rndup = X_ALIGN - rndup;
+#line 2660
+#line 2660
(void) memcpy(tp, *xpp, nelems);
+#line 2660
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 2660
- return ENOERR;
+#line 2660
+ return NC_NOERR;
+#line 2660
}
+#line 2663
int
ncx_pad_getn_uchar_uchar(const void **xpp, size_t nelems, uchar *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
- return ENOERR;
+#line 2666
+ return NC_NOERR;
+#line 2666
}
int
+#line 2668
ncx_pad_getn_uchar_short(const void **xpp, size_t nelems, short *tp)
+#line 2668
{
- int status = ENOERR;
+#line 2668
+ int status = NC_NOERR;
+#line 2668
size_t rndup = nelems % X_ALIGN;
+#line 2668
uchar *xp = (uchar *) *xpp;
+#line 2668
+#line 2668
if(rndup)
+#line 2668
rndup = X_ALIGN - rndup;
+#line 2668
+#line 2668
while(nelems-- != 0)
+#line 2668
{
+#line 2668
+#line 2668
*tp++ = *xp++;
+#line 2668
}
+#line 2668
+#line 2668
*xpp = (void *)(xp + rndup);
+#line 2668
return status;
+#line 2668
}
+#line 2668
int
+#line 2669
ncx_pad_getn_uchar_int(const void **xpp, size_t nelems, int *tp)
+#line 2669
{
- int status = ENOERR;
+#line 2669
+ int status = NC_NOERR;
+#line 2669
size_t rndup = nelems % X_ALIGN;
+#line 2669
uchar *xp = (uchar *) *xpp;
+#line 2669
+#line 2669
if(rndup)
+#line 2669
rndup = X_ALIGN - rndup;
+#line 2669
+#line 2669
while(nelems-- != 0)
+#line 2669
{
+#line 2669
+#line 2669
*tp++ = *xp++;
+#line 2669
}
+#line 2669
+#line 2669
*xpp = (void *)(xp + rndup);
+#line 2669
return status;
+#line 2669
}
+#line 2669
int
+#line 2670
ncx_pad_getn_uchar_float(const void **xpp, size_t nelems, float *tp)
+#line 2670
{
- int status = ENOERR;
+#line 2670
+ int status = NC_NOERR;
+#line 2670
size_t rndup = nelems % X_ALIGN;
+#line 2670
uchar *xp = (uchar *) *xpp;
+#line 2670
+#line 2670
if(rndup)
+#line 2670
rndup = X_ALIGN - rndup;
+#line 2670
+#line 2670
while(nelems-- != 0)
+#line 2670
{
+#line 2670
+#line 2670
*tp++ = *xp++;
+#line 2670
}
+#line 2670
+#line 2670
*xpp = (void *)(xp + rndup);
+#line 2670
return status;
+#line 2670
}
+#line 2670
int
+#line 2671
ncx_pad_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
+#line 2671
{
- int status = ENOERR;
+#line 2671
+ int status = NC_NOERR;
+#line 2671
size_t rndup = nelems % X_ALIGN;
+#line 2671
uchar *xp = (uchar *) *xpp;
+#line 2671
+#line 2671
if(rndup)
+#line 2671
rndup = X_ALIGN - rndup;
+#line 2671
+#line 2671
while(nelems-- != 0)
+#line 2671
{
+#line 2671
+#line 2671
*tp++ = *xp++;
+#line 2671
}
+#line 2671
+#line 2671
*xpp = (void *)(xp + rndup);
+#line 2671
return status;
+#line 2671
}
+#line 2671
int
+#line 2672
ncx_pad_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2672
{
- int status = ENOERR;
+#line 2672
+ int status = NC_NOERR;
+#line 2672
size_t rndup = nelems % X_ALIGN;
+#line 2672
uchar *xp = (uchar *) *xpp;
+#line 2672
+#line 2672
if(rndup)
+#line 2672
rndup = X_ALIGN - rndup;
+#line 2672
+#line 2672
while(nelems-- != 0)
+#line 2672
{
+#line 2672
+#line 2672
*tp++ = *xp++;
+#line 2672
}
+#line 2672
+#line 2672
*xpp = (void *)(xp + rndup);
+#line 2672
return status;
+#line 2672
}
+#line 2672
int
+#line 2673
ncx_pad_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2673
{
- int status = ENOERR;
+#line 2673
+ int status = NC_NOERR;
+#line 2673
size_t rndup = nelems % X_ALIGN;
+#line 2673
uchar *xp = (uchar *) *xpp;
+#line 2673
+#line 2673
if(rndup)
+#line 2673
rndup = X_ALIGN - rndup;
+#line 2673
+#line 2673
while(nelems-- != 0)
+#line 2673
{
+#line 2673
+#line 2673
*tp++ = *xp++;
+#line 2673
}
+#line 2673
+#line 2673
*xpp = (void *)(xp + rndup);
+#line 2673
return status;
+#line 2673
}
+#line 2673
int
+#line 2674
ncx_pad_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2674
{
- int status = ENOERR;
+#line 2674
+ int status = NC_NOERR;
+#line 2674
size_t rndup = nelems % X_ALIGN;
+#line 2674
uchar *xp = (uchar *) *xpp;
+#line 2674
+#line 2674
if(rndup)
+#line 2674
rndup = X_ALIGN - rndup;
+#line 2674
+#line 2674
while(nelems-- != 0)
+#line 2674
{
+#line 2674
+#line 2674
*tp++ = *xp++;
+#line 2674
}
+#line 2674
+#line 2674
*xpp = (void *)(xp + rndup);
+#line 2674
return status;
+#line 2674
}
+#line 2674
int
+#line 2675
ncx_pad_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2675
{
- int status = ENOERR;
+#line 2675
+ int status = NC_NOERR;
+#line 2675
size_t rndup = nelems % X_ALIGN;
+#line 2675
uchar *xp = (uchar *) *xpp;
+#line 2675
+#line 2675
if(rndup)
+#line 2675
rndup = X_ALIGN - rndup;
+#line 2675
+#line 2675
while(nelems-- != 0)
+#line 2675
{
+#line 2675
+#line 2675
*tp++ = *xp++;
+#line 2675
}
+#line 2675
+#line 2675
*xpp = (void *)(xp + rndup);
+#line 2675
return status;
+#line 2675
}
+#line 2675
+#line 2678
int
ncx_putn_uchar_schar(void **xpp, size_t nelems, const schar *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 2681
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2681
- return ENOERR;
+#line 2681
+ return NC_NOERR;
+#line 2681
}
+#line 2684
int
ncx_putn_uchar_uchar(void **xpp, size_t nelems, const uchar *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 2687
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2687
- return ENOERR;
+#line 2687
+ return NC_NOERR;
+#line 2687
}
int
+#line 2689
ncx_putn_uchar_short(void **xpp, size_t nelems, const short *tp)
+#line 2689
{
- int status = ENOERR;
+#line 2689
+ int status = NC_NOERR;
+#line 2689
uchar *xp = (uchar *) *xpp;
+#line 2689
+#line 2689
while(nelems-- != 0)
+#line 2689
{
+#line 2689
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2689
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2689
+ *xp++ = (uchar) (signed)*tp++;
+#line 2689
}
+#line 2689
+#line 2689
*xpp = (void *)xp;
+#line 2689
return status;
+#line 2689
}
+#line 2689
int
+#line 2690
ncx_putn_uchar_int(void **xpp, size_t nelems, const int *tp)
+#line 2690
{
- int status = ENOERR;
+#line 2690
+ int status = NC_NOERR;
+#line 2690
uchar *xp = (uchar *) *xpp;
+#line 2690
+#line 2690
while(nelems-- != 0)
+#line 2690
{
+#line 2690
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2690
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2690
+ *xp++ = (uchar) (signed)*tp++;
+#line 2690
}
+#line 2690
+#line 2690
*xpp = (void *)xp;
+#line 2690
return status;
+#line 2690
}
+#line 2690
int
+#line 2691
ncx_putn_uchar_float(void **xpp, size_t nelems, const float *tp)
+#line 2691
{
- int status = ENOERR;
+#line 2691
+ int status = NC_NOERR;
+#line 2691
uchar *xp = (uchar *) *xpp;
+#line 2691
+#line 2691
while(nelems-- != 0)
+#line 2691
{
+#line 2691
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2691
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2691
+ *xp++ = (uchar) (signed)*tp++;
+#line 2691
}
+#line 2691
+#line 2691
*xpp = (void *)xp;
+#line 2691
return status;
+#line 2691
}
+#line 2691
int
+#line 2692
ncx_putn_uchar_double(void **xpp, size_t nelems, const double *tp)
+#line 2692
{
- int status = ENOERR;
+#line 2692
+ int status = NC_NOERR;
+#line 2692
uchar *xp = (uchar *) *xpp;
+#line 2692
+#line 2692
while(nelems-- != 0)
+#line 2692
{
+#line 2692
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2692
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2692
+ *xp++ = (uchar) (signed)*tp++;
+#line 2692
}
+#line 2692
+#line 2692
*xpp = (void *)xp;
+#line 2692
return status;
+#line 2692
}
+#line 2692
int
+#line 2693
ncx_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2693
{
- int status = ENOERR;
+#line 2693
+ int status = NC_NOERR;
+#line 2693
uchar *xp = (uchar *) *xpp;
+#line 2693
+#line 2693
while(nelems-- != 0)
+#line 2693
{
+#line 2693
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2693
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2693
+ *xp++ = (uchar) (signed)*tp++;
+#line 2693
}
+#line 2693
+#line 2693
*xpp = (void *)xp;
+#line 2693
return status;
+#line 2693
}
+#line 2693
int
+#line 2694
ncx_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2694
{
- int status = ENOERR;
+#line 2694
+ int status = NC_NOERR;
+#line 2694
uchar *xp = (uchar *) *xpp;
+#line 2694
+#line 2694
while(nelems-- != 0)
+#line 2694
{
+#line 2694
if(*tp > X_UCHAR_MAX )
+#line 2694
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2694
+ *xp++ = (uchar) (signed)*tp++;
+#line 2694
}
+#line 2694
+#line 2694
*xpp = (void *)xp;
+#line 2694
return status;
+#line 2694
}
+#line 2694
int
+#line 2695
ncx_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2695
{
- int status = ENOERR;
+#line 2695
+ int status = NC_NOERR;
+#line 2695
uchar *xp = (uchar *) *xpp;
+#line 2695
+#line 2695
while(nelems-- != 0)
+#line 2695
{
+#line 2695
if(*tp > X_UCHAR_MAX )
+#line 2695
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2695
+ *xp++ = (uchar) (signed)*tp++;
+#line 2695
}
+#line 2695
+#line 2695
*xpp = (void *)xp;
+#line 2695
return status;
+#line 2695
}
+#line 2695
int
+#line 2696
ncx_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2696
{
- int status = ENOERR;
+#line 2696
+ int status = NC_NOERR;
+#line 2696
uchar *xp = (uchar *) *xpp;
+#line 2696
+#line 2696
while(nelems-- != 0)
+#line 2696
{
+#line 2696
if(*tp > X_UCHAR_MAX )
+#line 2696
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2696
+ *xp++ = (uchar) (signed)*tp++;
+#line 2696
}
+#line 2696
+#line 2696
*xpp = (void *)xp;
+#line 2696
return status;
+#line 2696
}
+#line 2696
+#line 2699
int
ncx_pad_putn_uchar_schar(void **xpp, size_t nelems, const schar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2702
+#line 2702
if(rndup)
+#line 2702
rndup = X_ALIGN - rndup;
+#line 2702
+#line 2702
(void) memcpy(*xpp, tp, nelems);
+#line 2702
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2702
+#line 2702
if(rndup)
+#line 2702
{
+#line 2702
(void) memcpy(*xpp, nada, rndup);
+#line 2702
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2702
}
+#line 2702
- return ENOERR;
+#line 2702
+ return NC_NOERR;
+#line 2702
}
+#line 2705
int
ncx_pad_putn_uchar_uchar(void **xpp, size_t nelems, const uchar *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 2708
+#line 2708
if(rndup)
+#line 2708
rndup = X_ALIGN - rndup;
+#line 2708
+#line 2708
(void) memcpy(*xpp, tp, nelems);
+#line 2708
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2708
+#line 2708
if(rndup)
+#line 2708
{
+#line 2708
(void) memcpy(*xpp, nada, rndup);
+#line 2708
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2708
}
+#line 2708
- return ENOERR;
+#line 2708
+ return NC_NOERR;
+#line 2708
}
int
+#line 2710
ncx_pad_putn_uchar_short(void **xpp, size_t nelems, const short *tp)
+#line 2710
{
- int status = ENOERR;
+#line 2710
+ int status = NC_NOERR;
+#line 2710
size_t rndup = nelems % X_ALIGN;
+#line 2710
uchar *xp = (uchar *) *xpp;
+#line 2710
+#line 2710
if(rndup)
+#line 2710
rndup = X_ALIGN - rndup;
+#line 2710
+#line 2710
while(nelems-- != 0)
+#line 2710
{
+#line 2710
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2710
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2710
+ *xp++ = (uchar) (signed) *tp++;
+#line 2710
}
+#line 2710
+#line 2710
+#line 2710
if(rndup)
+#line 2710
{
+#line 2710
(void) memcpy(xp, nada, rndup);
+#line 2710
xp += rndup;
+#line 2710
}
+#line 2710
+#line 2710
*xpp = (void *)xp;
+#line 2710
return status;
+#line 2710
}
+#line 2710
int
+#line 2711
ncx_pad_putn_uchar_int(void **xpp, size_t nelems, const int *tp)
+#line 2711
{
- int status = ENOERR;
+#line 2711
+ int status = NC_NOERR;
+#line 2711
size_t rndup = nelems % X_ALIGN;
+#line 2711
uchar *xp = (uchar *) *xpp;
+#line 2711
+#line 2711
if(rndup)
+#line 2711
rndup = X_ALIGN - rndup;
+#line 2711
+#line 2711
while(nelems-- != 0)
+#line 2711
{
+#line 2711
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2711
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2711
+ *xp++ = (uchar) (signed) *tp++;
+#line 2711
}
+#line 2711
+#line 2711
+#line 2711
if(rndup)
+#line 2711
{
+#line 2711
(void) memcpy(xp, nada, rndup);
+#line 2711
xp += rndup;
+#line 2711
}
+#line 2711
+#line 2711
*xpp = (void *)xp;
+#line 2711
return status;
+#line 2711
}
+#line 2711
int
+#line 2712
ncx_pad_putn_uchar_float(void **xpp, size_t nelems, const float *tp)
+#line 2712
{
- int status = ENOERR;
+#line 2712
+ int status = NC_NOERR;
+#line 2712
size_t rndup = nelems % X_ALIGN;
+#line 2712
uchar *xp = (uchar *) *xpp;
+#line 2712
+#line 2712
if(rndup)
+#line 2712
rndup = X_ALIGN - rndup;
+#line 2712
+#line 2712
while(nelems-- != 0)
+#line 2712
{
+#line 2712
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2712
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2712
+ *xp++ = (uchar) (signed) *tp++;
+#line 2712
}
+#line 2712
+#line 2712
+#line 2712
if(rndup)
+#line 2712
{
+#line 2712
(void) memcpy(xp, nada, rndup);
+#line 2712
xp += rndup;
+#line 2712
}
+#line 2712
+#line 2712
*xpp = (void *)xp;
+#line 2712
return status;
+#line 2712
}
+#line 2712
int
+#line 2713
ncx_pad_putn_uchar_double(void **xpp, size_t nelems, const double *tp)
+#line 2713
{
- int status = ENOERR;
+#line 2713
+ int status = NC_NOERR;
+#line 2713
size_t rndup = nelems % X_ALIGN;
+#line 2713
uchar *xp = (uchar *) *xpp;
+#line 2713
+#line 2713
if(rndup)
+#line 2713
rndup = X_ALIGN - rndup;
+#line 2713
+#line 2713
while(nelems-- != 0)
+#line 2713
{
+#line 2713
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2713
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2713
+ *xp++ = (uchar) (signed) *tp++;
+#line 2713
}
+#line 2713
+#line 2713
+#line 2713
if(rndup)
+#line 2713
{
+#line 2713
(void) memcpy(xp, nada, rndup);
+#line 2713
xp += rndup;
+#line 2713
}
+#line 2713
+#line 2713
*xpp = (void *)xp;
+#line 2713
return status;
+#line 2713
}
+#line 2713
int
+#line 2714
ncx_pad_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2714
{
- int status = ENOERR;
+#line 2714
+ int status = NC_NOERR;
+#line 2714
size_t rndup = nelems % X_ALIGN;
+#line 2714
uchar *xp = (uchar *) *xpp;
+#line 2714
+#line 2714
if(rndup)
+#line 2714
rndup = X_ALIGN - rndup;
+#line 2714
+#line 2714
while(nelems-- != 0)
+#line 2714
{
+#line 2714
if(*tp > X_UCHAR_MAX || *tp < 0)
+#line 2714
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2714
+ *xp++ = (uchar) (signed) *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_uchar_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2715
{
- int status = ENOERR;
+#line 2715
+ int status = NC_NOERR;
+#line 2715
size_t rndup = nelems % X_ALIGN;
+#line 2715
uchar *xp = (uchar *) *xpp;
+#line 2715
+#line 2715
if(rndup)
+#line 2715
rndup = X_ALIGN - rndup;
+#line 2715
+#line 2715
while(nelems-- != 0)
+#line 2715
{
+#line 2715
if(*tp > X_UCHAR_MAX )
+#line 2715
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2715
+ *xp++ = (uchar) (signed) *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_uchar_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2716
{
- int status = ENOERR;
+#line 2716
+ int status = NC_NOERR;
+#line 2716
size_t rndup = nelems % X_ALIGN;
+#line 2716
uchar *xp = (uchar *) *xpp;
+#line 2716
+#line 2716
if(rndup)
+#line 2716
rndup = X_ALIGN - rndup;
+#line 2716
+#line 2716
while(nelems-- != 0)
+#line 2716
{
+#line 2716
if(*tp > X_UCHAR_MAX )
+#line 2716
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2716
+ *xp++ = (uchar) (signed) *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_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2717
{
- int status = ENOERR;
+#line 2717
+ int status = NC_NOERR;
+#line 2717
size_t rndup = nelems % X_ALIGN;
+#line 2717
uchar *xp = (uchar *) *xpp;
+#line 2717
+#line 2717
if(rndup)
+#line 2717
rndup = X_ALIGN - rndup;
+#line 2717
+#line 2717
while(nelems-- != 0)
+#line 2717
{
+#line 2717
if(*tp > X_UCHAR_MAX )
+#line 2717
status = NC_ERANGE;
- *xp++ = (uchar) *tp++;
+#line 2717
+ *xp++ = (uchar) (signed) *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
/* short ---------------------------------------------------------------------*/
@@ -5193,870 +8599,1710 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
swapn2b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_SHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2735
ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
+#line 2735
{
+#line 2735
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2735
+#line 2735
/* basic algorithm is:
+#line 2735
* - ensure sane alignment of input data
+#line 2735
* - copy (conversion happens automatically) input data
+#line 2735
* to output
+#line 2735
* - update xpp to point at next unconverted input, and tp to point
+#line 2735
* at next location for converted output
+#line 2735
*/
+#line 2735
long i, j, ni;
+#line 2735
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2735
short *xp;
+#line 2735
int nrange = 0; /* number of range errors */
+#line 2735
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2735
long cxp = (long) *((char**)xpp);
+#line 2735
+#line 2735
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2735
/* sjl: manually stripmine so we can limit amount of
+#line 2735
* vector work space reserved to LOOPCNT elements. Also
+#line 2735
* makes vectorisation easy */
+#line 2735
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2735
ni=Min(nelems-j,LOOPCNT);
+#line 2735
if (realign) {
+#line 2735
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2735
xp = tmp;
+#line 2735
} else {
+#line 2735
xp = (short *) *xpp;
+#line 2735
}
+#line 2735
/* copy the next block */
+#line 2735
#pragma cdir loopcnt=LOOPCNT
+#line 2735
#pragma cdir shortloop
+#line 2735
for (i=0; i<ni; i++) {
+#line 2735
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2735
/* test for range errors (not always needed but do it anyway) */
+#line 2735
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2735
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2735
nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
+#line 2735
}
+#line 2735
/* update xpp and tp */
+#line 2735
if (realign) xp = (short *) *xpp;
+#line 2735
xp += ni;
+#line 2735
tp += ni;
+#line 2735
*xpp = (void*)xp;
+#line 2735
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2735
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2735
+#line 2735
#else /* not SX */
+#line 2735
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2735
+ int status = NC_NOERR;
+#line 2735
+#line 2735
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2735
{
+#line 2735
const int lstatus = ncx_get_short_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2735
+ if(lstatus != NC_NOERR)
+#line 2735
status = lstatus;
+#line 2735
}
+#line 2735
+#line 2735
*xpp = (const void *)xp;
+#line 2735
return status;
+#line 2735
# endif
+#line 2735
}
+#line 2735
#endif
int
+#line 2737
ncx_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2737
{
+#line 2737
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2737
+#line 2737
/* basic algorithm is:
+#line 2737
* - ensure sane alignment of input data
+#line 2737
* - copy (conversion happens automatically) input data
+#line 2737
* to output
+#line 2737
* - update xpp to point at next unconverted input, and tp to point
+#line 2737
* at next location for converted output
+#line 2737
*/
+#line 2737
long i, j, ni;
+#line 2737
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2737
short *xp;
+#line 2737
int nrange = 0; /* number of range errors */
+#line 2737
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2737
long cxp = (long) *((char**)xpp);
+#line 2737
+#line 2737
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2737
/* sjl: manually stripmine so we can limit amount of
+#line 2737
* vector work space reserved to LOOPCNT elements. Also
+#line 2737
* makes vectorisation easy */
+#line 2737
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2737
ni=Min(nelems-j,LOOPCNT);
+#line 2737
if (realign) {
+#line 2737
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2737
xp = tmp;
+#line 2737
} else {
+#line 2737
xp = (short *) *xpp;
+#line 2737
}
+#line 2737
/* copy the next block */
+#line 2737
#pragma cdir loopcnt=LOOPCNT
+#line 2737
#pragma cdir shortloop
+#line 2737
for (i=0; i<ni; i++) {
+#line 2737
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2737
/* test for range errors (not always needed but do it anyway) */
+#line 2737
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2737
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2737
nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
+#line 2737
}
+#line 2737
/* update xpp and tp */
+#line 2737
if (realign) xp = (short *) *xpp;
+#line 2737
xp += ni;
+#line 2737
tp += ni;
+#line 2737
*xpp = (void*)xp;
+#line 2737
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2737
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2737
+#line 2737
#else /* not SX */
+#line 2737
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2737
+ int status = NC_NOERR;
+#line 2737
+#line 2737
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2737
{
+#line 2737
const int lstatus = ncx_get_short_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2737
+ if(lstatus != NC_NOERR)
+#line 2737
status = lstatus;
+#line 2737
}
+#line 2737
+#line 2737
*xpp = (const void *)xp;
+#line 2737
return status;
+#line 2737
# endif
+#line 2737
}
+#line 2737
int
+#line 2738
ncx_getn_short_int(const void **xpp, size_t nelems, int *tp)
+#line 2738
{
+#line 2738
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2738
+#line 2738
/* basic algorithm is:
+#line 2738
* - ensure sane alignment of input data
+#line 2738
* - copy (conversion happens automatically) input data
+#line 2738
* to output
+#line 2738
* - update xpp to point at next unconverted input, and tp to point
+#line 2738
* at next location for converted output
+#line 2738
*/
+#line 2738
long i, j, ni;
+#line 2738
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2738
short *xp;
+#line 2738
int nrange = 0; /* number of range errors */
+#line 2738
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2738
long cxp = (long) *((char**)xpp);
+#line 2738
+#line 2738
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2738
/* sjl: manually stripmine so we can limit amount of
+#line 2738
* vector work space reserved to LOOPCNT elements. Also
+#line 2738
* makes vectorisation easy */
+#line 2738
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2738
ni=Min(nelems-j,LOOPCNT);
+#line 2738
if (realign) {
+#line 2738
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2738
xp = tmp;
+#line 2738
} else {
+#line 2738
xp = (short *) *xpp;
+#line 2738
}
+#line 2738
/* copy the next block */
+#line 2738
#pragma cdir loopcnt=LOOPCNT
+#line 2738
#pragma cdir shortloop
+#line 2738
for (i=0; i<ni; i++) {
+#line 2738
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2738
/* test for range errors (not always needed but do it anyway) */
+#line 2738
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2738
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2738
nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
+#line 2738
}
+#line 2738
/* update xpp and tp */
+#line 2738
if (realign) xp = (short *) *xpp;
+#line 2738
xp += ni;
+#line 2738
tp += ni;
+#line 2738
*xpp = (void*)xp;
+#line 2738
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2738
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2738
+#line 2738
#else /* not SX */
+#line 2738
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2738
+ int status = NC_NOERR;
+#line 2738
+#line 2738
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2738
{
+#line 2738
const int lstatus = ncx_get_short_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2738
+ if(lstatus != NC_NOERR)
+#line 2738
status = lstatus;
+#line 2738
}
+#line 2738
+#line 2738
*xpp = (const void *)xp;
+#line 2738
return status;
+#line 2738
# endif
+#line 2738
}
+#line 2738
int
+#line 2739
ncx_getn_short_float(const void **xpp, size_t nelems, float *tp)
+#line 2739
{
+#line 2739
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2739
+#line 2739
/* basic algorithm is:
+#line 2739
* - ensure sane alignment of input data
+#line 2739
* - copy (conversion happens automatically) input data
+#line 2739
* to output
+#line 2739
* - update xpp to point at next unconverted input, and tp to point
+#line 2739
* at next location for converted output
+#line 2739
*/
+#line 2739
long i, j, ni;
+#line 2739
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2739
short *xp;
+#line 2739
int nrange = 0; /* number of range errors */
+#line 2739
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2739
long cxp = (long) *((char**)xpp);
+#line 2739
+#line 2739
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2739
/* sjl: manually stripmine so we can limit amount of
+#line 2739
* vector work space reserved to LOOPCNT elements. Also
+#line 2739
* makes vectorisation easy */
+#line 2739
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2739
ni=Min(nelems-j,LOOPCNT);
+#line 2739
if (realign) {
+#line 2739
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2739
xp = tmp;
+#line 2739
} else {
+#line 2739
xp = (short *) *xpp;
+#line 2739
}
+#line 2739
/* copy the next block */
+#line 2739
#pragma cdir loopcnt=LOOPCNT
+#line 2739
#pragma cdir shortloop
+#line 2739
for (i=0; i<ni; i++) {
+#line 2739
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2739
/* test for range errors (not always needed but do it anyway) */
+#line 2739
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2739
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2739
nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
+#line 2739
}
+#line 2739
/* update xpp and tp */
+#line 2739
if (realign) xp = (short *) *xpp;
+#line 2739
xp += ni;
+#line 2739
tp += ni;
+#line 2739
*xpp = (void*)xp;
+#line 2739
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2739
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2739
+#line 2739
#else /* not SX */
+#line 2739
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2739
+ int status = NC_NOERR;
+#line 2739
+#line 2739
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2739
{
+#line 2739
const int lstatus = ncx_get_short_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2739
+ if(lstatus != NC_NOERR)
+#line 2739
status = lstatus;
+#line 2739
}
+#line 2739
+#line 2739
*xpp = (const void *)xp;
+#line 2739
return status;
+#line 2739
# endif
+#line 2739
}
+#line 2739
int
+#line 2740
ncx_getn_short_double(const void **xpp, size_t nelems, double *tp)
+#line 2740
{
+#line 2740
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2740
+#line 2740
/* basic algorithm is:
+#line 2740
* - ensure sane alignment of input data
+#line 2740
* - copy (conversion happens automatically) input data
+#line 2740
* to output
+#line 2740
* - update xpp to point at next unconverted input, and tp to point
+#line 2740
* at next location for converted output
+#line 2740
*/
+#line 2740
long i, j, ni;
+#line 2740
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2740
short *xp;
+#line 2740
int nrange = 0; /* number of range errors */
+#line 2740
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2740
long cxp = (long) *((char**)xpp);
+#line 2740
+#line 2740
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2740
/* sjl: manually stripmine so we can limit amount of
+#line 2740
* vector work space reserved to LOOPCNT elements. Also
+#line 2740
* makes vectorisation easy */
+#line 2740
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2740
ni=Min(nelems-j,LOOPCNT);
+#line 2740
if (realign) {
+#line 2740
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2740
xp = tmp;
+#line 2740
} else {
+#line 2740
xp = (short *) *xpp;
+#line 2740
}
+#line 2740
/* copy the next block */
+#line 2740
#pragma cdir loopcnt=LOOPCNT
+#line 2740
#pragma cdir shortloop
+#line 2740
for (i=0; i<ni; i++) {
+#line 2740
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2740
/* test for range errors (not always needed but do it anyway) */
+#line 2740
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2740
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2740
nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
+#line 2740
}
+#line 2740
/* update xpp and tp */
+#line 2740
if (realign) xp = (short *) *xpp;
+#line 2740
xp += ni;
+#line 2740
tp += ni;
+#line 2740
*xpp = (void*)xp;
+#line 2740
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2740
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2740
+#line 2740
#else /* not SX */
+#line 2740
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2740
+ int status = NC_NOERR;
+#line 2740
+#line 2740
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2740
{
+#line 2740
const int lstatus = ncx_get_short_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2740
+ if(lstatus != NC_NOERR)
+#line 2740
status = lstatus;
+#line 2740
}
+#line 2740
+#line 2740
*xpp = (const void *)xp;
+#line 2740
return status;
+#line 2740
# endif
+#line 2740
}
+#line 2740
int
+#line 2741
ncx_getn_short_longlong(const void **xpp, size_t nelems, longlong *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] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2741
/* test for range errors (not always needed but do it anyway) */
+#line 2741
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2741
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2741
nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2741
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2741
+#line 2741
#else /* not SX */
+#line 2741
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2741
+ int status = NC_NOERR;
+#line 2741
+#line 2741
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2741
{
+#line 2741
const int lstatus = ncx_get_short_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2741
+ if(lstatus != NC_NOERR)
+#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
int
+#line 2742
ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2742
{
+#line 2742
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2742
+#line 2742
/* basic algorithm is:
+#line 2742
* - ensure sane alignment of input data
+#line 2742
* - copy (conversion happens automatically) input data
+#line 2742
* to output
+#line 2742
* - update xpp to point at next unconverted input, and tp to point
+#line 2742
* at next location for converted output
+#line 2742
*/
+#line 2742
long i, j, ni;
+#line 2742
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2742
short *xp;
+#line 2742
int nrange = 0; /* number of range errors */
+#line 2742
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2742
long cxp = (long) *((char**)xpp);
+#line 2742
+#line 2742
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2742
/* sjl: manually stripmine so we can limit amount of
+#line 2742
* vector work space reserved to LOOPCNT elements. Also
+#line 2742
* makes vectorisation easy */
+#line 2742
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2742
ni=Min(nelems-j,LOOPCNT);
+#line 2742
if (realign) {
+#line 2742
memcpy(tmp, *xpp, ni*SIZEOF_SHORT);
+#line 2742
xp = tmp;
+#line 2742
} else {
+#line 2742
xp = (short *) *xpp;
+#line 2742
}
+#line 2742
/* copy the next block */
+#line 2742
#pragma cdir loopcnt=LOOPCNT
+#line 2742
#pragma cdir shortloop
+#line 2742
for (i=0; i<ni; i++) {
+#line 2742
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2742
/* test for range errors (not always needed but do it anyway) */
+#line 2742
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2742
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2742
nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
+#line 2742
}
+#line 2742
/* update xpp and tp */
+#line 2742
if (realign) xp = (short *) *xpp;
+#line 2742
xp += ni;
+#line 2742
tp += ni;
+#line 2742
*xpp = (void*)xp;
+#line 2742
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2742
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2742
+#line 2742
#else /* not SX */
+#line 2742
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2742
+ int status = NC_NOERR;
+#line 2742
+#line 2742
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2742
{
+#line 2742
const int lstatus = ncx_get_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2742
+ if(lstatus != NC_NOERR)
+#line 2742
status = lstatus;
+#line 2742
}
+#line 2742
+#line 2742
*xpp = (const void *)xp;
+#line 2742
return status;
+#line 2742
# endif
+#line 2742
}
+#line 2742
int
+#line 2743
ncx_getn_short_ushort(const void **xpp, size_t nelems, ushort *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] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 2743
/* test for range errors (not always needed but do it anyway) */
+#line 2743
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2743
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2743
nrange += xp[i] > USHORT_MAX || xp[i] < 0;
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2743
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2743
+#line 2743
#else /* not SX */
+#line 2743
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2743
+ int status = NC_NOERR;
+#line 2743
+#line 2743
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2743
{
+#line 2743
const int lstatus = ncx_get_short_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2743
+ if(lstatus != NC_NOERR)
+#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_uint(const void **xpp, size_t nelems, uint *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] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2744
/* test for range errors (not always needed but do it anyway) */
+#line 2744
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2744
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2744
nrange += xp[i] > UINT_MAX || xp[i] < 0;
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2744
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2744
+#line 2744
#else /* not SX */
+#line 2744
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2744
+ int status = NC_NOERR;
+#line 2744
+#line 2744
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2744
{
+#line 2744
const int lstatus = ncx_get_short_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2744
+ if(lstatus != NC_NOERR)
+#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_ulonglong(const void **xpp, size_t nelems, ulonglong *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] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2745
/* test for range errors (not always needed but do it anyway) */
+#line 2745
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2745
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2745
nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2745
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2745
+#line 2745
#else /* not SX */
+#line 2745
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2745
+ int status = NC_NOERR;
+#line 2745
+#line 2745
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2745
{
+#line 2745
const int lstatus = ncx_get_short_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2745
+ if(lstatus != NC_NOERR)
+#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 2747
ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2747
{
+#line 2747
const size_t rndup = nelems % 2;
+#line 2747
+#line 2747
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2747
+ int status = NC_NOERR;
+#line 2747
+#line 2747
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2747
{
+#line 2747
const int lstatus = ncx_get_short_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2747
+ if(lstatus != NC_NOERR)
+#line 2747
status = lstatus;
+#line 2747
}
+#line 2747
+#line 2747
if(rndup != 0)
+#line 2747
xp += X_SIZEOF_SHORT;
+#line 2747
*xpp = (void *)xp;
+#line 2747
return status;
+#line 2747
}
+#line 2747
int
+#line 2748
ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2748
{
+#line 2748
const size_t rndup = nelems % 2;
+#line 2748
+#line 2748
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2748
+ int status = NC_NOERR;
+#line 2748
+#line 2748
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2748
{
+#line 2748
const int lstatus = ncx_get_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2748
+ if(lstatus != NC_NOERR)
+#line 2748
status = lstatus;
+#line 2748
}
+#line 2748
+#line 2748
if(rndup != 0)
+#line 2748
xp += X_SIZEOF_SHORT;
+#line 2748
*xpp = (void *)xp;
+#line 2748
return status;
+#line 2748
}
+#line 2748
int
+#line 2749
ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *tp)
+#line 2749
{
+#line 2749
const size_t rndup = nelems % 2;
+#line 2749
+#line 2749
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2749
+ int status = NC_NOERR;
+#line 2749
+#line 2749
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2749
{
+#line 2749
const int lstatus = ncx_get_short_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2749
+ if(lstatus != NC_NOERR)
+#line 2749
status = lstatus;
+#line 2749
}
+#line 2749
+#line 2749
if(rndup != 0)
+#line 2749
xp += X_SIZEOF_SHORT;
+#line 2749
*xpp = (void *)xp;
+#line 2749
return status;
+#line 2749
}
+#line 2749
int
+#line 2750
ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp)
+#line 2750
{
+#line 2750
const size_t rndup = nelems % 2;
+#line 2750
+#line 2750
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2750
+ int status = NC_NOERR;
+#line 2750
+#line 2750
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2750
{
+#line 2750
const int lstatus = ncx_get_short_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2750
+ if(lstatus != NC_NOERR)
+#line 2750
status = lstatus;
+#line 2750
}
+#line 2750
+#line 2750
if(rndup != 0)
+#line 2750
xp += X_SIZEOF_SHORT;
+#line 2750
*xpp = (void *)xp;
+#line 2750
return status;
+#line 2750
}
+#line 2750
int
+#line 2751
ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp)
+#line 2751
{
+#line 2751
const size_t rndup = nelems % 2;
+#line 2751
+#line 2751
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2751
+ int status = NC_NOERR;
+#line 2751
+#line 2751
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2751
{
+#line 2751
const int lstatus = ncx_get_short_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2751
+ if(lstatus != NC_NOERR)
+#line 2751
status = lstatus;
+#line 2751
}
+#line 2751
+#line 2751
if(rndup != 0)
+#line 2751
xp += X_SIZEOF_SHORT;
+#line 2751
*xpp = (void *)xp;
+#line 2751
return status;
+#line 2751
}
+#line 2751
int
+#line 2752
ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
+#line 2752
{
+#line 2752
const size_t rndup = nelems % 2;
+#line 2752
+#line 2752
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2752
+ int status = NC_NOERR;
+#line 2752
+#line 2752
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2752
{
+#line 2752
const int lstatus = ncx_get_short_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2752
+ if(lstatus != NC_NOERR)
+#line 2752
status = lstatus;
+#line 2752
}
+#line 2752
+#line 2752
if(rndup != 0)
+#line 2752
xp += X_SIZEOF_SHORT;
+#line 2752
*xpp = (void *)xp;
+#line 2752
return status;
+#line 2752
}
+#line 2752
int
+#line 2753
ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2753
{
+#line 2753
const size_t rndup = nelems % 2;
+#line 2753
+#line 2753
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2753
+ int status = NC_NOERR;
+#line 2753
+#line 2753
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2753
{
+#line 2753
const int lstatus = ncx_get_short_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2753
+ if(lstatus != NC_NOERR)
+#line 2753
status = lstatus;
+#line 2753
}
+#line 2753
+#line 2753
if(rndup != 0)
+#line 2753
xp += X_SIZEOF_SHORT;
+#line 2753
*xpp = (void *)xp;
+#line 2753
return status;
+#line 2753
}
+#line 2753
int
+#line 2754
ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2754
{
+#line 2754
const size_t rndup = nelems % 2;
+#line 2754
+#line 2754
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2754
+ int status = NC_NOERR;
+#line 2754
+#line 2754
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2754
{
+#line 2754
const int lstatus = ncx_get_short_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2754
+ if(lstatus != NC_NOERR)
+#line 2754
status = lstatus;
+#line 2754
}
+#line 2754
+#line 2754
if(rndup != 0)
+#line 2754
xp += X_SIZEOF_SHORT;
+#line 2754
*xpp = (void *)xp;
+#line 2754
return status;
+#line 2754
}
+#line 2754
int
+#line 2755
ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2755
{
+#line 2755
const size_t rndup = nelems % 2;
+#line 2755
+#line 2755
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2755
+ int status = NC_NOERR;
+#line 2755
+#line 2755
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2755
{
+#line 2755
const int lstatus = ncx_get_short_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2755
+ if(lstatus != NC_NOERR)
+#line 2755
status = lstatus;
+#line 2755
}
+#line 2755
+#line 2755
if(rndup != 0)
+#line 2755
xp += X_SIZEOF_SHORT;
+#line 2755
*xpp = (void *)xp;
+#line 2755
return status;
+#line 2755
}
+#line 2755
int
+#line 2756
ncx_pad_getn_short_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2756
{
+#line 2756
const size_t rndup = nelems % 2;
+#line 2756
+#line 2756
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2756
+ int status = NC_NOERR;
+#line 2756
+#line 2756
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2756
{
+#line 2756
const int lstatus = ncx_get_short_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2756
+ if(lstatus != NC_NOERR)
+#line 2756
status = lstatus;
+#line 2756
}
+#line 2756
+#line 2756
if(rndup != 0)
+#line 2756
xp += X_SIZEOF_SHORT;
+#line 2756
*xpp = (void *)xp;
+#line 2756
return status;
+#line 2756
}
+#line 2756
#if X_SIZEOF_SHORT == SIZEOF_SHORT
@@ -6070,960 +10316,1890 @@ ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
swapn2b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_SHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2772
ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
+#line 2772
{
+#line 2772
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2772
+#line 2772
/* basic algorithm is:
+#line 2772
* - ensure sane alignment of output data
+#line 2772
* - copy (conversion happens automatically) input data
+#line 2772
* to output
+#line 2772
* - update tp to point at next unconverted input, and xpp to point
+#line 2772
* at next location for converted output
+#line 2772
*/
+#line 2772
long i, j, ni;
+#line 2772
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2772
short *xp;
+#line 2772
int nrange = 0; /* number of range errors */
+#line 2772
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2772
long cxp = (long) *((char**)xpp);
+#line 2772
+#line 2772
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2772
/* sjl: manually stripmine so we can limit amount of
+#line 2772
* vector work space reserved to LOOPCNT elements. Also
+#line 2772
* makes vectorisation easy */
+#line 2772
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2772
ni=Min(nelems-j,LOOPCNT);
+#line 2772
if (realign) {
+#line 2772
xp = tmp;
+#line 2772
} else {
+#line 2772
xp = (short *) *xpp;
+#line 2772
}
+#line 2772
/* copy the next block */
+#line 2772
#pragma cdir loopcnt=LOOPCNT
+#line 2772
#pragma cdir shortloop
+#line 2772
for (i=0; i<ni; i++) {
+#line 2772
/* the normal case: */
+#line 2772
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2772
/* test for range errors (not always needed but do it anyway) */
+#line 2772
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2772
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2772
nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
+#line 2772
}
+#line 2772
/* copy workspace back if necessary */
+#line 2772
if (realign) {
+#line 2772
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2772
xp = (short *) *xpp;
+#line 2772
}
+#line 2772
/* update xpp and tp */
+#line 2772
xp += ni;
+#line 2772
tp += ni;
+#line 2772
*xpp = (void*)xp;
+#line 2772
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2772
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2772
+#line 2772
#else /* not SX */
+#line 2772
+#line 2772
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2772
+ int status = NC_NOERR;
+#line 2772
+#line 2772
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2772
{
+#line 2772
int lstatus = ncx_put_short_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2772
+ if(lstatus != NC_NOERR)
+#line 2772
status = lstatus;
+#line 2772
}
+#line 2772
+#line 2772
*xpp = (void *)xp;
+#line 2772
return status;
+#line 2772
#endif
+#line 2772
}
+#line 2772
#endif
int
+#line 2774
ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2774
{
+#line 2774
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2774
+#line 2774
/* basic algorithm is:
+#line 2774
* - ensure sane alignment of output data
+#line 2774
* - copy (conversion happens automatically) input data
+#line 2774
* to output
+#line 2774
* - update tp to point at next unconverted input, and xpp to point
+#line 2774
* at next location for converted output
+#line 2774
*/
+#line 2774
long i, j, ni;
+#line 2774
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2774
short *xp;
+#line 2774
int nrange = 0; /* number of range errors */
+#line 2774
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2774
long cxp = (long) *((char**)xpp);
+#line 2774
+#line 2774
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2774
/* sjl: manually stripmine so we can limit amount of
+#line 2774
* vector work space reserved to LOOPCNT elements. Also
+#line 2774
* makes vectorisation easy */
+#line 2774
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2774
ni=Min(nelems-j,LOOPCNT);
+#line 2774
if (realign) {
+#line 2774
xp = tmp;
+#line 2774
} else {
+#line 2774
xp = (short *) *xpp;
+#line 2774
}
+#line 2774
/* copy the next block */
+#line 2774
#pragma cdir loopcnt=LOOPCNT
+#line 2774
#pragma cdir shortloop
+#line 2774
for (i=0; i<ni; i++) {
+#line 2774
/* the normal case: */
+#line 2774
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2774
/* test for range errors (not always needed but do it anyway) */
+#line 2774
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2774
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2774
nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
+#line 2774
}
+#line 2774
/* copy workspace back if necessary */
+#line 2774
if (realign) {
+#line 2774
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2774
xp = (short *) *xpp;
+#line 2774
}
+#line 2774
/* update xpp and tp */
+#line 2774
xp += ni;
+#line 2774
tp += ni;
+#line 2774
*xpp = (void*)xp;
+#line 2774
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2774
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2774
+#line 2774
#else /* not SX */
+#line 2774
+#line 2774
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2774
+ int status = NC_NOERR;
+#line 2774
+#line 2774
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2774
{
+#line 2774
int lstatus = ncx_put_short_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2774
+ if(lstatus != NC_NOERR)
+#line 2774
status = lstatus;
+#line 2774
}
+#line 2774
+#line 2774
*xpp = (void *)xp;
+#line 2774
return status;
+#line 2774
#endif
+#line 2774
}
+#line 2774
int
+#line 2775
ncx_putn_short_int(void **xpp, size_t nelems, const int *tp)
+#line 2775
{
+#line 2775
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2775
+#line 2775
/* basic algorithm is:
+#line 2775
* - ensure sane alignment of output data
+#line 2775
* - copy (conversion happens automatically) input data
+#line 2775
* to output
+#line 2775
* - update tp to point at next unconverted input, and xpp to point
+#line 2775
* at next location for converted output
+#line 2775
*/
+#line 2775
long i, j, ni;
+#line 2775
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2775
short *xp;
+#line 2775
int nrange = 0; /* number of range errors */
+#line 2775
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2775
long cxp = (long) *((char**)xpp);
+#line 2775
+#line 2775
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2775
/* sjl: manually stripmine so we can limit amount of
+#line 2775
* vector work space reserved to LOOPCNT elements. Also
+#line 2775
* makes vectorisation easy */
+#line 2775
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2775
ni=Min(nelems-j,LOOPCNT);
+#line 2775
if (realign) {
+#line 2775
xp = tmp;
+#line 2775
} else {
+#line 2775
xp = (short *) *xpp;
+#line 2775
}
+#line 2775
/* copy the next block */
+#line 2775
#pragma cdir loopcnt=LOOPCNT
+#line 2775
#pragma cdir shortloop
+#line 2775
for (i=0; i<ni; i++) {
+#line 2775
/* the normal case: */
+#line 2775
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2775
/* test for range errors (not always needed but do it anyway) */
+#line 2775
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2775
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2775
nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
+#line 2775
}
+#line 2775
/* copy workspace back if necessary */
+#line 2775
if (realign) {
+#line 2775
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2775
xp = (short *) *xpp;
+#line 2775
}
+#line 2775
/* update xpp and tp */
+#line 2775
xp += ni;
+#line 2775
tp += ni;
+#line 2775
*xpp = (void*)xp;
+#line 2775
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2775
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2775
+#line 2775
#else /* not SX */
+#line 2775
+#line 2775
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2775
+ int status = NC_NOERR;
+#line 2775
+#line 2775
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2775
{
+#line 2775
int lstatus = ncx_put_short_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2775
+ if(lstatus != NC_NOERR)
+#line 2775
status = lstatus;
+#line 2775
}
+#line 2775
+#line 2775
*xpp = (void *)xp;
+#line 2775
return status;
+#line 2775
#endif
+#line 2775
}
+#line 2775
int
+#line 2776
ncx_putn_short_float(void **xpp, size_t nelems, const float *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
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2776
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2776
nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
+#line 2776
}
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2776
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2776
+#line 2776
#else /* not SX */
+#line 2776
+#line 2776
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2776
+ int status = NC_NOERR;
+#line 2776
+#line 2776
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2776
{
+#line 2776
int lstatus = ncx_put_short_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2776
+ if(lstatus != NC_NOERR)
+#line 2776
status = lstatus;
+#line 2776
}
+#line 2776
+#line 2776
*xpp = (void *)xp;
+#line 2776
return status;
+#line 2776
#endif
+#line 2776
}
+#line 2776
int
+#line 2777
ncx_putn_short_double(void **xpp, size_t nelems, const double *tp)
+#line 2777
{
+#line 2777
#if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 2777
+#line 2777
/* basic algorithm is:
+#line 2777
* - ensure sane alignment of output data
+#line 2777
* - copy (conversion happens automatically) input data
+#line 2777
* to output
+#line 2777
* - update tp to point at next unconverted input, and xpp to point
+#line 2777
* at next location for converted output
+#line 2777
*/
+#line 2777
long i, j, ni;
+#line 2777
short tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2777
short *xp;
+#line 2777
int nrange = 0; /* number of range errors */
+#line 2777
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2777
long cxp = (long) *((char**)xpp);
+#line 2777
+#line 2777
realign = (cxp & 7) % SIZEOF_SHORT;
+#line 2777
/* sjl: manually stripmine so we can limit amount of
+#line 2777
* vector work space reserved to LOOPCNT elements. Also
+#line 2777
* makes vectorisation easy */
+#line 2777
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2777
ni=Min(nelems-j,LOOPCNT);
+#line 2777
if (realign) {
+#line 2777
xp = tmp;
+#line 2777
} else {
+#line 2777
xp = (short *) *xpp;
+#line 2777
}
+#line 2777
/* copy the next block */
+#line 2777
#pragma cdir loopcnt=LOOPCNT
+#line 2777
#pragma cdir shortloop
+#line 2777
for (i=0; i<ni; i++) {
+#line 2777
/* the normal case: */
+#line 2777
xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 2777
/* test for range errors (not always needed but do it anyway) */
+#line 2777
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2777
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2777
nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
+#line 2777
}
+#line 2777
/* copy workspace back if necessary */
+#line 2777
if (realign) {
+#line 2777
memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT);
+#line 2777
xp = (short *) *xpp;
+#line 2777
}
+#line 2777
/* update xpp and tp */
+#line 2777
xp += ni;
+#line 2777
tp += ni;
+#line 2777
*xpp = (void*)xp;
+#line 2777
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2777
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2777
+#line 2777
#else /* not SX */
+#line 2777
+#line 2777
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2777
+ int status = NC_NOERR;
+#line 2777
+#line 2777
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2777
{
+#line 2777
int lstatus = ncx_put_short_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2777
+ if(lstatus != NC_NOERR)
+#line 2777
status = lstatus;
+#line 2777
}
+#line 2777
+#line 2777
*xpp = (void *)xp;
+#line 2777
return status;
+#line 2777
#endif
+#line 2777
}
+#line 2777
int
+#line 2778
ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *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
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2778
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2778
nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
+#line 2778
}
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2778
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2778
+#line 2778
#else /* not SX */
+#line 2778
+#line 2778
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2778
+ int status = NC_NOERR;
+#line 2778
+#line 2778
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2778
{
+#line 2778
int lstatus = ncx_put_short_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2778
+ if(lstatus != NC_NOERR)
+#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_uchar(void **xpp, size_t nelems, const uchar *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
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2779
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2779
nrange += tp[i] > X_SHORT_MAX ;
+#line 2779
}
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2779
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2779
+#line 2779
#else /* not SX */
+#line 2779
+#line 2779
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2779
+ int status = NC_NOERR;
+#line 2779
+#line 2779
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2779
{
+#line 2779
int lstatus = ncx_put_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2779
+ if(lstatus != NC_NOERR)
+#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_uint(void **xpp, size_t nelems, const uint *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
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2780
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2780
nrange += tp[i] > X_SHORT_MAX ;
+#line 2780
}
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2780
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2780
+#line 2780
#else /* not SX */
+#line 2780
+#line 2780
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2780
+ int status = NC_NOERR;
+#line 2780
+#line 2780
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2780
{
+#line 2780
int lstatus = ncx_put_short_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2780
+ if(lstatus != NC_NOERR)
+#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_ulonglong(void **xpp, size_t nelems, const ulonglong *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
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2781
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2781
nrange += tp[i] > X_SHORT_MAX ;
+#line 2781
}
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2781
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2781
+#line 2781
#else /* not SX */
+#line 2781
+#line 2781
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2781
+ int status = NC_NOERR;
+#line 2781
+#line 2781
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2781
{
+#line 2781
int lstatus = ncx_put_short_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2781
+ if(lstatus != NC_NOERR)
+#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_ushort(void **xpp, size_t nelems, const ushort *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
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2782
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2782
nrange += tp[i] > X_SHORT_MAX ;
+#line 2782
}
+#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
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2782
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2782
+#line 2782
#else /* not SX */
+#line 2782
+#line 2782
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2782
+ int status = NC_NOERR;
+#line 2782
+#line 2782
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2782
{
+#line 2782
int lstatus = ncx_put_short_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2782
+ if(lstatus != NC_NOERR)
+#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 2784
ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2784
{
+#line 2784
const size_t rndup = nelems % 2;
+#line 2784
+#line 2784
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2784
+ int status = NC_NOERR;
+#line 2784
+#line 2784
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2784
{
+#line 2784
int lstatus = ncx_put_short_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2784
+ if(lstatus != NC_NOERR)
+#line 2784
status = lstatus;
+#line 2784
}
+#line 2784
+#line 2784
if(rndup != 0)
+#line 2784
{
+#line 2784
(void) memcpy(xp, nada, X_SIZEOF_SHORT);
+#line 2784
xp += X_SIZEOF_SHORT;
+#line 2784
}
+#line 2784
+#line 2784
*xpp = (void *)xp;
+#line 2784
return status;
+#line 2784
}
+#line 2784
int
+#line 2785
ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2785
{
+#line 2785
const size_t rndup = nelems % 2;
+#line 2785
+#line 2785
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2785
+ int status = NC_NOERR;
+#line 2785
+#line 2785
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2785
{
+#line 2785
int lstatus = ncx_put_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2785
+ if(lstatus != NC_NOERR)
+#line 2785
status = lstatus;
+#line 2785
}
+#line 2785
+#line 2785
if(rndup != 0)
+#line 2785
{
+#line 2785
(void) memcpy(xp, nada, 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_short(void **xpp, size_t nelems, const short *tp)
+#line 2786
{
+#line 2786
const size_t rndup = nelems % 2;
+#line 2786
+#line 2786
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2786
+ int status = NC_NOERR;
+#line 2786
+#line 2786
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2786
{
+#line 2786
int lstatus = ncx_put_short_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2786
+ if(lstatus != NC_NOERR)
+#line 2786
status = lstatus;
+#line 2786
}
+#line 2786
+#line 2786
if(rndup != 0)
+#line 2786
{
+#line 2786
(void) memcpy(xp, nada, 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_int(void **xpp, size_t nelems, const int *tp)
+#line 2787
{
+#line 2787
const size_t rndup = nelems % 2;
+#line 2787
+#line 2787
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2787
+ int status = NC_NOERR;
+#line 2787
+#line 2787
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2787
{
+#line 2787
int lstatus = ncx_put_short_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2787
+ if(lstatus != NC_NOERR)
+#line 2787
status = lstatus;
+#line 2787
}
+#line 2787
+#line 2787
if(rndup != 0)
+#line 2787
{
+#line 2787
(void) memcpy(xp, nada, 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_float(void **xpp, size_t nelems, const float *tp)
+#line 2788
{
+#line 2788
const size_t rndup = nelems % 2;
+#line 2788
+#line 2788
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2788
+ int status = NC_NOERR;
+#line 2788
+#line 2788
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2788
{
+#line 2788
int lstatus = ncx_put_short_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2788
+ if(lstatus != NC_NOERR)
+#line 2788
status = lstatus;
+#line 2788
}
+#line 2788
+#line 2788
if(rndup != 0)
+#line 2788
{
+#line 2788
(void) memcpy(xp, nada, 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_double(void **xpp, size_t nelems, const double *tp)
+#line 2789
{
+#line 2789
const size_t rndup = nelems % 2;
+#line 2789
+#line 2789
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2789
+ int status = NC_NOERR;
+#line 2789
+#line 2789
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2789
{
+#line 2789
int lstatus = ncx_put_short_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2789
+ if(lstatus != NC_NOERR)
+#line 2789
status = lstatus;
+#line 2789
}
+#line 2789
+#line 2789
if(rndup != 0)
+#line 2789
{
+#line 2789
(void) memcpy(xp, nada, 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_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2790
{
+#line 2790
const size_t rndup = nelems % 2;
+#line 2790
+#line 2790
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2790
+ int status = NC_NOERR;
+#line 2790
+#line 2790
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2790
{
+#line 2790
int lstatus = ncx_put_short_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2790
+ if(lstatus != NC_NOERR)
+#line 2790
status = lstatus;
+#line 2790
}
+#line 2790
+#line 2790
if(rndup != 0)
+#line 2790
{
+#line 2790
(void) memcpy(xp, nada, 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_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2791
{
+#line 2791
const size_t rndup = nelems % 2;
+#line 2791
+#line 2791
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2791
+ int status = NC_NOERR;
+#line 2791
+#line 2791
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2791
{
+#line 2791
int lstatus = ncx_put_short_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2791
+ if(lstatus != NC_NOERR)
+#line 2791
status = lstatus;
+#line 2791
}
+#line 2791
+#line 2791
if(rndup != 0)
+#line 2791
{
+#line 2791
(void) memcpy(xp, nada, 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_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2792
{
+#line 2792
const size_t rndup = nelems % 2;
+#line 2792
+#line 2792
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2792
+ int status = NC_NOERR;
+#line 2792
+#line 2792
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2792
{
+#line 2792
int lstatus = ncx_put_short_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2792
+ if(lstatus != NC_NOERR)
+#line 2792
status = lstatus;
+#line 2792
}
+#line 2792
+#line 2792
if(rndup != 0)
+#line 2792
{
+#line 2792
(void) memcpy(xp, nada, 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_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2793
{
+#line 2793
const size_t rndup = nelems % 2;
+#line 2793
+#line 2793
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2793
+ int status = NC_NOERR;
+#line 2793
+#line 2793
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 2793
{
+#line 2793
int lstatus = ncx_put_short_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2793
+ if(lstatus != NC_NOERR)
+#line 2793
status = lstatus;
+#line 2793
}
+#line 2793
+#line 2793
if(rndup != 0)
+#line 2793
{
+#line 2793
(void) memcpy(xp, nada, 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
@@ -7040,870 +12216,1710 @@ ncx_getn_ushort_ushort(const void **xpp, size_t nelems, unsigned short *tp)
swapn2b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_USHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2812
ncx_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2812
{
+#line 2812
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2812
+#line 2812
/* basic algorithm is:
+#line 2812
* - ensure sane alignment of input data
+#line 2812
* - copy (conversion happens automatically) input data
+#line 2812
* to output
+#line 2812
* - update xpp to point at next unconverted input, and tp to point
+#line 2812
* at next location for converted output
+#line 2812
*/
+#line 2812
long i, j, ni;
+#line 2812
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2812
ushort *xp;
+#line 2812
int nrange = 0; /* number of range errors */
+#line 2812
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2812
long cxp = (long) *((char**)xpp);
+#line 2812
+#line 2812
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2812
/* sjl: manually stripmine so we can limit amount of
+#line 2812
* vector work space reserved to LOOPCNT elements. Also
+#line 2812
* makes vectorisation easy */
+#line 2812
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2812
ni=Min(nelems-j,LOOPCNT);
+#line 2812
if (realign) {
+#line 2812
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2812
xp = tmp;
+#line 2812
} else {
+#line 2812
xp = (ushort *) *xpp;
+#line 2812
}
+#line 2812
/* copy the next block */
+#line 2812
#pragma cdir loopcnt=LOOPCNT
+#line 2812
#pragma cdir shortloop
+#line 2812
for (i=0; i<ni; i++) {
+#line 2812
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 2812
/* test for range errors (not always needed but do it anyway) */
+#line 2812
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2812
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2812
nrange += xp[i] > USHORT_MAX ;
+#line 2812
}
+#line 2812
/* update xpp and tp */
+#line 2812
if (realign) xp = (ushort *) *xpp;
+#line 2812
xp += ni;
+#line 2812
tp += ni;
+#line 2812
*xpp = (void*)xp;
+#line 2812
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2812
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2812
+#line 2812
#else /* not SX */
+#line 2812
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2812
+ int status = NC_NOERR;
+#line 2812
+#line 2812
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2812
{
+#line 2812
const int lstatus = ncx_get_ushort_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2812
+ if(lstatus != NC_NOERR)
+#line 2812
status = lstatus;
+#line 2812
}
+#line 2812
+#line 2812
*xpp = (const void *)xp;
+#line 2812
return status;
+#line 2812
# endif
+#line 2812
}
+#line 2812
#endif
int
+#line 2814
ncx_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2814
{
+#line 2814
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2814
+#line 2814
/* basic algorithm is:
+#line 2814
* - ensure sane alignment of input data
+#line 2814
* - copy (conversion happens automatically) input data
+#line 2814
* to output
+#line 2814
* - update xpp to point at next unconverted input, and tp to point
+#line 2814
* at next location for converted output
+#line 2814
*/
+#line 2814
long i, j, ni;
+#line 2814
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2814
ushort *xp;
+#line 2814
int nrange = 0; /* number of range errors */
+#line 2814
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2814
long cxp = (long) *((char**)xpp);
+#line 2814
+#line 2814
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2814
/* sjl: manually stripmine so we can limit amount of
+#line 2814
* vector work space reserved to LOOPCNT elements. Also
+#line 2814
* makes vectorisation easy */
+#line 2814
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2814
ni=Min(nelems-j,LOOPCNT);
+#line 2814
if (realign) {
+#line 2814
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2814
xp = tmp;
+#line 2814
} else {
+#line 2814
xp = (ushort *) *xpp;
+#line 2814
}
+#line 2814
/* copy the next block */
+#line 2814
#pragma cdir loopcnt=LOOPCNT
+#line 2814
#pragma cdir shortloop
+#line 2814
for (i=0; i<ni; i++) {
+#line 2814
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2814
/* test for range errors (not always needed but do it anyway) */
+#line 2814
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2814
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2814
nrange += xp[i] > SCHAR_MAX ;
+#line 2814
}
+#line 2814
/* update xpp and tp */
+#line 2814
if (realign) xp = (ushort *) *xpp;
+#line 2814
xp += ni;
+#line 2814
tp += ni;
+#line 2814
*xpp = (void*)xp;
+#line 2814
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2814
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2814
+#line 2814
#else /* not SX */
+#line 2814
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2814
+ int status = NC_NOERR;
+#line 2814
+#line 2814
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2814
{
+#line 2814
const int lstatus = ncx_get_ushort_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2814
+ if(lstatus != NC_NOERR)
+#line 2814
status = lstatus;
+#line 2814
}
+#line 2814
+#line 2814
*xpp = (const void *)xp;
+#line 2814
return status;
+#line 2814
# endif
+#line 2814
}
+#line 2814
int
+#line 2815
ncx_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
+#line 2815
{
+#line 2815
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2815
+#line 2815
/* basic algorithm is:
+#line 2815
* - ensure sane alignment of input data
+#line 2815
* - copy (conversion happens automatically) input data
+#line 2815
* to output
+#line 2815
* - update xpp to point at next unconverted input, and tp to point
+#line 2815
* at next location for converted output
+#line 2815
*/
+#line 2815
long i, j, ni;
+#line 2815
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2815
ushort *xp;
+#line 2815
int nrange = 0; /* number of range errors */
+#line 2815
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2815
long cxp = (long) *((char**)xpp);
+#line 2815
+#line 2815
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2815
/* sjl: manually stripmine so we can limit amount of
+#line 2815
* vector work space reserved to LOOPCNT elements. Also
+#line 2815
* makes vectorisation easy */
+#line 2815
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2815
ni=Min(nelems-j,LOOPCNT);
+#line 2815
if (realign) {
+#line 2815
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2815
xp = tmp;
+#line 2815
} else {
+#line 2815
xp = (ushort *) *xpp;
+#line 2815
}
+#line 2815
/* copy the next block */
+#line 2815
#pragma cdir loopcnt=LOOPCNT
+#line 2815
#pragma cdir shortloop
+#line 2815
for (i=0; i<ni; i++) {
+#line 2815
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2815
/* test for range errors (not always needed but do it anyway) */
+#line 2815
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2815
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2815
nrange += xp[i] > SHORT_MAX ;
+#line 2815
}
+#line 2815
/* update xpp and tp */
+#line 2815
if (realign) xp = (ushort *) *xpp;
+#line 2815
xp += ni;
+#line 2815
tp += ni;
+#line 2815
*xpp = (void*)xp;
+#line 2815
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2815
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2815
+#line 2815
#else /* not SX */
+#line 2815
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2815
+ int status = NC_NOERR;
+#line 2815
+#line 2815
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2815
{
+#line 2815
const int lstatus = ncx_get_ushort_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2815
+ if(lstatus != NC_NOERR)
+#line 2815
status = lstatus;
+#line 2815
}
+#line 2815
+#line 2815
*xpp = (const void *)xp;
+#line 2815
return status;
+#line 2815
# endif
+#line 2815
}
+#line 2815
int
+#line 2816
ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
+#line 2816
{
+#line 2816
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2816
+#line 2816
/* basic algorithm is:
+#line 2816
* - ensure sane alignment of input data
+#line 2816
* - copy (conversion happens automatically) input data
+#line 2816
* to output
+#line 2816
* - update xpp to point at next unconverted input, and tp to point
+#line 2816
* at next location for converted output
+#line 2816
*/
+#line 2816
long i, j, ni;
+#line 2816
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2816
ushort *xp;
+#line 2816
int nrange = 0; /* number of range errors */
+#line 2816
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2816
long cxp = (long) *((char**)xpp);
+#line 2816
+#line 2816
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2816
/* sjl: manually stripmine so we can limit amount of
+#line 2816
* vector work space reserved to LOOPCNT elements. Also
+#line 2816
* makes vectorisation easy */
+#line 2816
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2816
ni=Min(nelems-j,LOOPCNT);
+#line 2816
if (realign) {
+#line 2816
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2816
xp = tmp;
+#line 2816
} else {
+#line 2816
xp = (ushort *) *xpp;
+#line 2816
}
+#line 2816
/* copy the next block */
+#line 2816
#pragma cdir loopcnt=LOOPCNT
+#line 2816
#pragma cdir shortloop
+#line 2816
for (i=0; i<ni; i++) {
+#line 2816
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2816
/* test for range errors (not always needed but do it anyway) */
+#line 2816
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2816
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2816
nrange += xp[i] > INT_MAX ;
+#line 2816
}
+#line 2816
/* update xpp and tp */
+#line 2816
if (realign) xp = (ushort *) *xpp;
+#line 2816
xp += ni;
+#line 2816
tp += ni;
+#line 2816
*xpp = (void*)xp;
+#line 2816
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2816
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2816
+#line 2816
#else /* not SX */
+#line 2816
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2816
+ int status = NC_NOERR;
+#line 2816
+#line 2816
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2816
{
+#line 2816
const int lstatus = ncx_get_ushort_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2816
+ if(lstatus != NC_NOERR)
+#line 2816
status = lstatus;
+#line 2816
}
+#line 2816
+#line 2816
*xpp = (const void *)xp;
+#line 2816
return status;
+#line 2816
# endif
+#line 2816
}
+#line 2816
int
+#line 2817
ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
+#line 2817
{
+#line 2817
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2817
+#line 2817
/* basic algorithm is:
+#line 2817
* - ensure sane alignment of input data
+#line 2817
* - copy (conversion happens automatically) input data
+#line 2817
* to output
+#line 2817
* - update xpp to point at next unconverted input, and tp to point
+#line 2817
* at next location for converted output
+#line 2817
*/
+#line 2817
long i, j, ni;
+#line 2817
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2817
ushort *xp;
+#line 2817
int nrange = 0; /* number of range errors */
+#line 2817
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2817
long cxp = (long) *((char**)xpp);
+#line 2817
+#line 2817
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2817
/* sjl: manually stripmine so we can limit amount of
+#line 2817
* vector work space reserved to LOOPCNT elements. Also
+#line 2817
* makes vectorisation easy */
+#line 2817
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2817
ni=Min(nelems-j,LOOPCNT);
+#line 2817
if (realign) {
+#line 2817
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2817
xp = tmp;
+#line 2817
} else {
+#line 2817
xp = (ushort *) *xpp;
+#line 2817
}
+#line 2817
/* copy the next block */
+#line 2817
#pragma cdir loopcnt=LOOPCNT
+#line 2817
#pragma cdir shortloop
+#line 2817
for (i=0; i<ni; i++) {
+#line 2817
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2817
/* test for range errors (not always needed but do it anyway) */
+#line 2817
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2817
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2817
nrange += xp[i] > FLOAT_MAX ;
+#line 2817
}
+#line 2817
/* update xpp and tp */
+#line 2817
if (realign) xp = (ushort *) *xpp;
+#line 2817
xp += ni;
+#line 2817
tp += ni;
+#line 2817
*xpp = (void*)xp;
+#line 2817
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2817
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2817
+#line 2817
#else /* not SX */
+#line 2817
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2817
+ int status = NC_NOERR;
+#line 2817
+#line 2817
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2817
{
+#line 2817
const int lstatus = ncx_get_ushort_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2817
+ if(lstatus != NC_NOERR)
+#line 2817
status = lstatus;
+#line 2817
}
+#line 2817
+#line 2817
*xpp = (const void *)xp;
+#line 2817
return status;
+#line 2817
# endif
+#line 2817
}
+#line 2817
int
+#line 2818
ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
+#line 2818
{
+#line 2818
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2818
+#line 2818
/* basic algorithm is:
+#line 2818
* - ensure sane alignment of input data
+#line 2818
* - copy (conversion happens automatically) input data
+#line 2818
* to output
+#line 2818
* - update xpp to point at next unconverted input, and tp to point
+#line 2818
* at next location for converted output
+#line 2818
*/
+#line 2818
long i, j, ni;
+#line 2818
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2818
ushort *xp;
+#line 2818
int nrange = 0; /* number of range errors */
+#line 2818
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2818
long cxp = (long) *((char**)xpp);
+#line 2818
+#line 2818
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2818
/* sjl: manually stripmine so we can limit amount of
+#line 2818
* vector work space reserved to LOOPCNT elements. Also
+#line 2818
* makes vectorisation easy */
+#line 2818
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2818
ni=Min(nelems-j,LOOPCNT);
+#line 2818
if (realign) {
+#line 2818
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2818
xp = tmp;
+#line 2818
} else {
+#line 2818
xp = (ushort *) *xpp;
+#line 2818
}
+#line 2818
/* copy the next block */
+#line 2818
#pragma cdir loopcnt=LOOPCNT
+#line 2818
#pragma cdir shortloop
+#line 2818
for (i=0; i<ni; i++) {
+#line 2818
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2818
/* test for range errors (not always needed but do it anyway) */
+#line 2818
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2818
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2818
nrange += xp[i] > DOUBLE_MAX ;
+#line 2818
}
+#line 2818
/* update xpp and tp */
+#line 2818
if (realign) xp = (ushort *) *xpp;
+#line 2818
xp += ni;
+#line 2818
tp += ni;
+#line 2818
*xpp = (void*)xp;
+#line 2818
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2818
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2818
+#line 2818
#else /* not SX */
+#line 2818
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2818
+ int status = NC_NOERR;
+#line 2818
+#line 2818
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2818
{
+#line 2818
const int lstatus = ncx_get_ushort_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2818
+ if(lstatus != NC_NOERR)
+#line 2818
status = lstatus;
+#line 2818
}
+#line 2818
+#line 2818
*xpp = (const void *)xp;
+#line 2818
return status;
+#line 2818
# endif
+#line 2818
}
+#line 2818
int
+#line 2819
ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2819
{
+#line 2819
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2819
+#line 2819
/* basic algorithm is:
+#line 2819
* - ensure sane alignment of input data
+#line 2819
* - copy (conversion happens automatically) input data
+#line 2819
* to output
+#line 2819
* - update xpp to point at next unconverted input, and tp to point
+#line 2819
* at next location for converted output
+#line 2819
*/
+#line 2819
long i, j, ni;
+#line 2819
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2819
ushort *xp;
+#line 2819
int nrange = 0; /* number of range errors */
+#line 2819
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2819
long cxp = (long) *((char**)xpp);
+#line 2819
+#line 2819
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2819
/* sjl: manually stripmine so we can limit amount of
+#line 2819
* vector work space reserved to LOOPCNT elements. Also
+#line 2819
* makes vectorisation easy */
+#line 2819
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2819
ni=Min(nelems-j,LOOPCNT);
+#line 2819
if (realign) {
+#line 2819
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2819
xp = tmp;
+#line 2819
} else {
+#line 2819
xp = (ushort *) *xpp;
+#line 2819
}
+#line 2819
/* copy the next block */
+#line 2819
#pragma cdir loopcnt=LOOPCNT
+#line 2819
#pragma cdir shortloop
+#line 2819
for (i=0; i<ni; i++) {
+#line 2819
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2819
/* test for range errors (not always needed but do it anyway) */
+#line 2819
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2819
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2819
nrange += xp[i] > LONGLONG_MAX ;
+#line 2819
}
+#line 2819
/* update xpp and tp */
+#line 2819
if (realign) xp = (ushort *) *xpp;
+#line 2819
xp += ni;
+#line 2819
tp += ni;
+#line 2819
*xpp = (void*)xp;
+#line 2819
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2819
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2819
+#line 2819
#else /* not SX */
+#line 2819
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2819
+ int status = NC_NOERR;
+#line 2819
+#line 2819
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2819
{
+#line 2819
const int lstatus = ncx_get_ushort_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2819
+ if(lstatus != NC_NOERR)
+#line 2819
status = lstatus;
+#line 2819
}
+#line 2819
+#line 2819
*xpp = (const void *)xp;
+#line 2819
return status;
+#line 2819
# endif
+#line 2819
}
+#line 2819
int
+#line 2820
ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2820
{
+#line 2820
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2820
+#line 2820
/* basic algorithm is:
+#line 2820
* - ensure sane alignment of input data
+#line 2820
* - copy (conversion happens automatically) input data
+#line 2820
* to output
+#line 2820
* - update xpp to point at next unconverted input, and tp to point
+#line 2820
* at next location for converted output
+#line 2820
*/
+#line 2820
long i, j, ni;
+#line 2820
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2820
ushort *xp;
+#line 2820
int nrange = 0; /* number of range errors */
+#line 2820
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2820
long cxp = (long) *((char**)xpp);
+#line 2820
+#line 2820
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2820
/* sjl: manually stripmine so we can limit amount of
+#line 2820
* vector work space reserved to LOOPCNT elements. Also
+#line 2820
* makes vectorisation easy */
+#line 2820
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2820
ni=Min(nelems-j,LOOPCNT);
+#line 2820
if (realign) {
+#line 2820
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2820
xp = tmp;
+#line 2820
} else {
+#line 2820
xp = (ushort *) *xpp;
+#line 2820
}
+#line 2820
/* copy the next block */
+#line 2820
#pragma cdir loopcnt=LOOPCNT
+#line 2820
#pragma cdir shortloop
+#line 2820
for (i=0; i<ni; i++) {
+#line 2820
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2820
/* test for range errors (not always needed but do it anyway) */
+#line 2820
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2820
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2820
nrange += xp[i] > UCHAR_MAX ;
+#line 2820
}
+#line 2820
/* update xpp and tp */
+#line 2820
if (realign) xp = (ushort *) *xpp;
+#line 2820
xp += ni;
+#line 2820
tp += ni;
+#line 2820
*xpp = (void*)xp;
+#line 2820
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2820
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2820
+#line 2820
#else /* not SX */
+#line 2820
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2820
+ int status = NC_NOERR;
+#line 2820
+#line 2820
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2820
{
+#line 2820
const int lstatus = ncx_get_ushort_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2820
+ if(lstatus != NC_NOERR)
+#line 2820
status = lstatus;
+#line 2820
}
+#line 2820
+#line 2820
*xpp = (const void *)xp;
+#line 2820
return status;
+#line 2820
# endif
+#line 2820
}
+#line 2820
int
+#line 2821
ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2821
{
+#line 2821
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2821
+#line 2821
/* basic algorithm is:
+#line 2821
* - ensure sane alignment of input data
+#line 2821
* - copy (conversion happens automatically) input data
+#line 2821
* to output
+#line 2821
* - update xpp to point at next unconverted input, and tp to point
+#line 2821
* at next location for converted output
+#line 2821
*/
+#line 2821
long i, j, ni;
+#line 2821
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2821
ushort *xp;
+#line 2821
int nrange = 0; /* number of range errors */
+#line 2821
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2821
long cxp = (long) *((char**)xpp);
+#line 2821
+#line 2821
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2821
/* sjl: manually stripmine so we can limit amount of
+#line 2821
* vector work space reserved to LOOPCNT elements. Also
+#line 2821
* makes vectorisation easy */
+#line 2821
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2821
ni=Min(nelems-j,LOOPCNT);
+#line 2821
if (realign) {
+#line 2821
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2821
xp = tmp;
+#line 2821
} else {
+#line 2821
xp = (ushort *) *xpp;
+#line 2821
}
+#line 2821
/* copy the next block */
+#line 2821
#pragma cdir loopcnt=LOOPCNT
+#line 2821
#pragma cdir shortloop
+#line 2821
for (i=0; i<ni; i++) {
+#line 2821
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2821
/* test for range errors (not always needed but do it anyway) */
+#line 2821
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2821
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2821
nrange += xp[i] > UINT_MAX ;
+#line 2821
}
+#line 2821
/* update xpp and tp */
+#line 2821
if (realign) xp = (ushort *) *xpp;
+#line 2821
xp += ni;
+#line 2821
tp += ni;
+#line 2821
*xpp = (void*)xp;
+#line 2821
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2821
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2821
+#line 2821
#else /* not SX */
+#line 2821
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2821
+ int status = NC_NOERR;
+#line 2821
+#line 2821
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2821
{
+#line 2821
const int lstatus = ncx_get_ushort_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2821
+ if(lstatus != NC_NOERR)
+#line 2821
status = lstatus;
+#line 2821
}
+#line 2821
+#line 2821
*xpp = (const void *)xp;
+#line 2821
return status;
+#line 2821
# endif
+#line 2821
}
+#line 2821
int
+#line 2822
ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2822
{
+#line 2822
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2822
+#line 2822
/* basic algorithm is:
+#line 2822
* - ensure sane alignment of input data
+#line 2822
* - copy (conversion happens automatically) input data
+#line 2822
* to output
+#line 2822
* - update xpp to point at next unconverted input, and tp to point
+#line 2822
* at next location for converted output
+#line 2822
*/
+#line 2822
long i, j, ni;
+#line 2822
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2822
ushort *xp;
+#line 2822
int nrange = 0; /* number of range errors */
+#line 2822
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2822
long cxp = (long) *((char**)xpp);
+#line 2822
+#line 2822
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2822
/* sjl: manually stripmine so we can limit amount of
+#line 2822
* vector work space reserved to LOOPCNT elements. Also
+#line 2822
* makes vectorisation easy */
+#line 2822
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2822
ni=Min(nelems-j,LOOPCNT);
+#line 2822
if (realign) {
+#line 2822
memcpy(tmp, *xpp, ni*SIZEOF_USHORT);
+#line 2822
xp = tmp;
+#line 2822
} else {
+#line 2822
xp = (ushort *) *xpp;
+#line 2822
}
+#line 2822
/* copy the next block */
+#line 2822
#pragma cdir loopcnt=LOOPCNT
+#line 2822
#pragma cdir shortloop
+#line 2822
for (i=0; i<ni; i++) {
+#line 2822
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2822
/* test for range errors (not always needed but do it anyway) */
+#line 2822
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2822
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2822
nrange += xp[i] > ULONGLONG_MAX ;
+#line 2822
}
+#line 2822
/* update xpp and tp */
+#line 2822
if (realign) xp = (ushort *) *xpp;
+#line 2822
xp += ni;
+#line 2822
tp += ni;
+#line 2822
*xpp = (void*)xp;
+#line 2822
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2822
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2822
+#line 2822
#else /* not SX */
+#line 2822
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2822
+ int status = NC_NOERR;
+#line 2822
+#line 2822
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2822
{
+#line 2822
const int lstatus = ncx_get_ushort_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2822
+ if(lstatus != NC_NOERR)
+#line 2822
status = lstatus;
+#line 2822
}
+#line 2822
+#line 2822
*xpp = (const void *)xp;
+#line 2822
return status;
+#line 2822
# endif
+#line 2822
}
+#line 2822
int
+#line 2824
ncx_pad_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2824
{
+#line 2824
const size_t rndup = nelems % 2;
+#line 2824
+#line 2824
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2824
+ int status = NC_NOERR;
+#line 2824
+#line 2824
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2824
{
+#line 2824
const int lstatus = ncx_get_ushort_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2824
+ if(lstatus != NC_NOERR)
+#line 2824
status = lstatus;
+#line 2824
}
+#line 2824
+#line 2824
if(rndup != 0)
+#line 2824
xp += X_SIZEOF_USHORT;
+#line 2824
*xpp = (void *)xp;
+#line 2824
return status;
+#line 2824
}
+#line 2824
int
+#line 2825
ncx_pad_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2825
{
+#line 2825
const size_t rndup = nelems % 2;
+#line 2825
+#line 2825
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2825
+ int status = NC_NOERR;
+#line 2825
+#line 2825
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2825
{
+#line 2825
const int lstatus = ncx_get_ushort_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2825
+ if(lstatus != NC_NOERR)
+#line 2825
status = lstatus;
+#line 2825
}
+#line 2825
+#line 2825
if(rndup != 0)
+#line 2825
xp += X_SIZEOF_USHORT;
+#line 2825
*xpp = (void *)xp;
+#line 2825
return status;
+#line 2825
}
+#line 2825
int
+#line 2826
ncx_pad_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
+#line 2826
{
+#line 2826
const size_t rndup = nelems % 2;
+#line 2826
+#line 2826
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2826
+ int status = NC_NOERR;
+#line 2826
+#line 2826
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2826
{
+#line 2826
const int lstatus = ncx_get_ushort_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2826
+ if(lstatus != NC_NOERR)
+#line 2826
status = lstatus;
+#line 2826
}
+#line 2826
+#line 2826
if(rndup != 0)
+#line 2826
xp += X_SIZEOF_USHORT;
+#line 2826
*xpp = (void *)xp;
+#line 2826
return status;
+#line 2826
}
+#line 2826
int
+#line 2827
ncx_pad_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2827
{
+#line 2827
const size_t rndup = nelems % 2;
+#line 2827
+#line 2827
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2827
+ int status = NC_NOERR;
+#line 2827
+#line 2827
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2827
{
+#line 2827
const int lstatus = ncx_get_ushort_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2827
+ if(lstatus != NC_NOERR)
+#line 2827
status = lstatus;
+#line 2827
}
+#line 2827
+#line 2827
if(rndup != 0)
+#line 2827
xp += X_SIZEOF_USHORT;
+#line 2827
*xpp = (void *)xp;
+#line 2827
return status;
+#line 2827
}
+#line 2827
int
+#line 2828
ncx_pad_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
+#line 2828
{
+#line 2828
const size_t rndup = nelems % 2;
+#line 2828
+#line 2828
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2828
+ int status = NC_NOERR;
+#line 2828
+#line 2828
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2828
{
+#line 2828
const int lstatus = ncx_get_ushort_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2828
+ if(lstatus != NC_NOERR)
+#line 2828
status = lstatus;
+#line 2828
}
+#line 2828
+#line 2828
if(rndup != 0)
+#line 2828
xp += X_SIZEOF_USHORT;
+#line 2828
*xpp = (void *)xp;
+#line 2828
return status;
+#line 2828
}
+#line 2828
int
+#line 2829
ncx_pad_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2829
{
+#line 2829
const size_t rndup = nelems % 2;
+#line 2829
+#line 2829
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2829
+ int status = NC_NOERR;
+#line 2829
+#line 2829
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2829
{
+#line 2829
const int lstatus = ncx_get_ushort_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2829
+ if(lstatus != NC_NOERR)
+#line 2829
status = lstatus;
+#line 2829
}
+#line 2829
+#line 2829
if(rndup != 0)
+#line 2829
xp += X_SIZEOF_USHORT;
+#line 2829
*xpp = (void *)xp;
+#line 2829
return status;
+#line 2829
}
+#line 2829
int
+#line 2830
ncx_pad_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
+#line 2830
{
+#line 2830
const size_t rndup = nelems % 2;
+#line 2830
+#line 2830
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2830
+ int status = NC_NOERR;
+#line 2830
+#line 2830
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2830
{
+#line 2830
const int lstatus = ncx_get_ushort_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2830
+ if(lstatus != NC_NOERR)
+#line 2830
status = lstatus;
+#line 2830
}
+#line 2830
+#line 2830
if(rndup != 0)
+#line 2830
xp += X_SIZEOF_USHORT;
+#line 2830
*xpp = (void *)xp;
+#line 2830
return status;
+#line 2830
}
+#line 2830
int
+#line 2831
ncx_pad_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
+#line 2831
{
+#line 2831
const size_t rndup = nelems % 2;
+#line 2831
+#line 2831
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2831
+ int status = NC_NOERR;
+#line 2831
+#line 2831
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2831
{
+#line 2831
const int lstatus = ncx_get_ushort_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2831
+ if(lstatus != NC_NOERR)
+#line 2831
status = lstatus;
+#line 2831
}
+#line 2831
+#line 2831
if(rndup != 0)
+#line 2831
xp += X_SIZEOF_USHORT;
+#line 2831
*xpp = (void *)xp;
+#line 2831
return status;
+#line 2831
}
+#line 2831
int
+#line 2832
ncx_pad_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2832
{
+#line 2832
const size_t rndup = nelems % 2;
+#line 2832
+#line 2832
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2832
+ int status = NC_NOERR;
+#line 2832
+#line 2832
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2832
{
+#line 2832
const int lstatus = ncx_get_ushort_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2832
+ if(lstatus != NC_NOERR)
+#line 2832
status = lstatus;
+#line 2832
}
+#line 2832
+#line 2832
if(rndup != 0)
+#line 2832
xp += X_SIZEOF_USHORT;
+#line 2832
*xpp = (void *)xp;
+#line 2832
return status;
+#line 2832
}
+#line 2832
int
+#line 2833
ncx_pad_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2833
{
+#line 2833
const size_t rndup = nelems % 2;
+#line 2833
+#line 2833
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2833
+ int status = NC_NOERR;
+#line 2833
+#line 2833
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2833
{
+#line 2833
const int lstatus = ncx_get_ushort_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2833
+ if(lstatus != NC_NOERR)
+#line 2833
status = lstatus;
+#line 2833
}
+#line 2833
+#line 2833
if(rndup != 0)
+#line 2833
xp += X_SIZEOF_USHORT;
+#line 2833
*xpp = (void *)xp;
+#line 2833
return status;
+#line 2833
}
+#line 2833
#if X_SIZEOF_USHORT == SIZEOF_USHORT
@@ -7917,960 +13933,1890 @@ ncx_putn_ushort_ushort(void **xpp, size_t nelems, const unsigned short *tp)
swapn2b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_USHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2849
ncx_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2849
{
+#line 2849
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2849
+#line 2849
/* basic algorithm is:
+#line 2849
* - ensure sane alignment of output data
+#line 2849
* - copy (conversion happens automatically) input data
+#line 2849
* to output
+#line 2849
* - update tp to point at next unconverted input, and xpp to point
+#line 2849
* at next location for converted output
+#line 2849
*/
+#line 2849
long i, j, ni;
+#line 2849
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2849
ushort *xp;
+#line 2849
int nrange = 0; /* number of range errors */
+#line 2849
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2849
long cxp = (long) *((char**)xpp);
+#line 2849
+#line 2849
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2849
/* sjl: manually stripmine so we can limit amount of
+#line 2849
* vector work space reserved to LOOPCNT elements. Also
+#line 2849
* makes vectorisation easy */
+#line 2849
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2849
ni=Min(nelems-j,LOOPCNT);
+#line 2849
if (realign) {
+#line 2849
xp = tmp;
+#line 2849
} else {
+#line 2849
xp = (ushort *) *xpp;
+#line 2849
}
+#line 2849
/* copy the next block */
+#line 2849
#pragma cdir loopcnt=LOOPCNT
+#line 2849
#pragma cdir shortloop
+#line 2849
for (i=0; i<ni; i++) {
+#line 2849
/* the normal case: */
+#line 2849
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2849
/* test for range errors (not always needed but do it anyway) */
+#line 2849
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2849
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2849
nrange += tp[i] > X_USHORT_MAX ;
+#line 2849
}
+#line 2849
/* copy workspace back if necessary */
+#line 2849
if (realign) {
+#line 2849
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2849
xp = (ushort *) *xpp;
+#line 2849
}
+#line 2849
/* update xpp and tp */
+#line 2849
xp += ni;
+#line 2849
tp += ni;
+#line 2849
*xpp = (void*)xp;
+#line 2849
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2849
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2849
+#line 2849
#else /* not SX */
+#line 2849
+#line 2849
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2849
+ int status = NC_NOERR;
+#line 2849
+#line 2849
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2849
{
+#line 2849
int lstatus = ncx_put_ushort_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2849
+ if(lstatus != NC_NOERR)
+#line 2849
status = lstatus;
+#line 2849
}
+#line 2849
+#line 2849
*xpp = (void *)xp;
+#line 2849
return status;
+#line 2849
#endif
+#line 2849
}
+#line 2849
#endif
int
+#line 2851
ncx_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2851
{
+#line 2851
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2851
+#line 2851
/* basic algorithm is:
+#line 2851
* - ensure sane alignment of output data
+#line 2851
* - copy (conversion happens automatically) input data
+#line 2851
* to output
+#line 2851
* - update tp to point at next unconverted input, and xpp to point
+#line 2851
* at next location for converted output
+#line 2851
*/
+#line 2851
long i, j, ni;
+#line 2851
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2851
ushort *xp;
+#line 2851
int nrange = 0; /* number of range errors */
+#line 2851
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2851
long cxp = (long) *((char**)xpp);
+#line 2851
+#line 2851
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2851
/* sjl: manually stripmine so we can limit amount of
+#line 2851
* vector work space reserved to LOOPCNT elements. Also
+#line 2851
* makes vectorisation easy */
+#line 2851
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2851
ni=Min(nelems-j,LOOPCNT);
+#line 2851
if (realign) {
+#line 2851
xp = tmp;
+#line 2851
} else {
+#line 2851
xp = (ushort *) *xpp;
+#line 2851
}
+#line 2851
/* copy the next block */
+#line 2851
#pragma cdir loopcnt=LOOPCNT
+#line 2851
#pragma cdir shortloop
+#line 2851
for (i=0; i<ni; i++) {
+#line 2851
/* the normal case: */
+#line 2851
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2851
/* test for range errors (not always needed but do it anyway) */
+#line 2851
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2851
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2851
nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
+#line 2851
}
+#line 2851
/* copy workspace back if necessary */
+#line 2851
if (realign) {
+#line 2851
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2851
xp = (ushort *) *xpp;
+#line 2851
}
+#line 2851
/* update xpp and tp */
+#line 2851
xp += ni;
+#line 2851
tp += ni;
+#line 2851
*xpp = (void*)xp;
+#line 2851
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2851
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2851
+#line 2851
#else /* not SX */
+#line 2851
+#line 2851
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2851
+ int status = NC_NOERR;
+#line 2851
+#line 2851
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2851
{
+#line 2851
int lstatus = ncx_put_ushort_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2851
+ if(lstatus != NC_NOERR)
+#line 2851
status = lstatus;
+#line 2851
}
+#line 2851
+#line 2851
*xpp = (void *)xp;
+#line 2851
return status;
+#line 2851
#endif
+#line 2851
}
+#line 2851
int
+#line 2852
ncx_putn_ushort_short(void **xpp, size_t nelems, const short *tp)
+#line 2852
{
+#line 2852
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2852
+#line 2852
/* basic algorithm is:
+#line 2852
* - ensure sane alignment of output data
+#line 2852
* - copy (conversion happens automatically) input data
+#line 2852
* to output
+#line 2852
* - update tp to point at next unconverted input, and xpp to point
+#line 2852
* at next location for converted output
+#line 2852
*/
+#line 2852
long i, j, ni;
+#line 2852
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2852
ushort *xp;
+#line 2852
int nrange = 0; /* number of range errors */
+#line 2852
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2852
long cxp = (long) *((char**)xpp);
+#line 2852
+#line 2852
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2852
/* sjl: manually stripmine so we can limit amount of
+#line 2852
* vector work space reserved to LOOPCNT elements. Also
+#line 2852
* makes vectorisation easy */
+#line 2852
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2852
ni=Min(nelems-j,LOOPCNT);
+#line 2852
if (realign) {
+#line 2852
xp = tmp;
+#line 2852
} else {
+#line 2852
xp = (ushort *) *xpp;
+#line 2852
}
+#line 2852
/* copy the next block */
+#line 2852
#pragma cdir loopcnt=LOOPCNT
+#line 2852
#pragma cdir shortloop
+#line 2852
for (i=0; i<ni; i++) {
+#line 2852
/* the normal case: */
+#line 2852
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2852
/* test for range errors (not always needed but do it anyway) */
+#line 2852
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2852
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2852
nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
+#line 2852
}
+#line 2852
/* copy workspace back if necessary */
+#line 2852
if (realign) {
+#line 2852
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2852
xp = (ushort *) *xpp;
+#line 2852
}
+#line 2852
/* update xpp and tp */
+#line 2852
xp += ni;
+#line 2852
tp += ni;
+#line 2852
*xpp = (void*)xp;
+#line 2852
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2852
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2852
+#line 2852
#else /* not SX */
+#line 2852
+#line 2852
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2852
+ int status = NC_NOERR;
+#line 2852
+#line 2852
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2852
{
+#line 2852
int lstatus = ncx_put_ushort_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2852
+ if(lstatus != NC_NOERR)
+#line 2852
status = lstatus;
+#line 2852
}
+#line 2852
+#line 2852
*xpp = (void *)xp;
+#line 2852
return status;
+#line 2852
#endif
+#line 2852
}
+#line 2852
int
+#line 2853
ncx_putn_ushort_int(void **xpp, size_t nelems, const int *tp)
+#line 2853
{
+#line 2853
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2853
+#line 2853
/* basic algorithm is:
+#line 2853
* - ensure sane alignment of output data
+#line 2853
* - copy (conversion happens automatically) input data
+#line 2853
* to output
+#line 2853
* - update tp to point at next unconverted input, and xpp to point
+#line 2853
* at next location for converted output
+#line 2853
*/
+#line 2853
long i, j, ni;
+#line 2853
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2853
ushort *xp;
+#line 2853
int nrange = 0; /* number of range errors */
+#line 2853
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2853
long cxp = (long) *((char**)xpp);
+#line 2853
+#line 2853
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2853
/* sjl: manually stripmine so we can limit amount of
+#line 2853
* vector work space reserved to LOOPCNT elements. Also
+#line 2853
* makes vectorisation easy */
+#line 2853
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2853
ni=Min(nelems-j,LOOPCNT);
+#line 2853
if (realign) {
+#line 2853
xp = tmp;
+#line 2853
} else {
+#line 2853
xp = (ushort *) *xpp;
+#line 2853
}
+#line 2853
/* copy the next block */
+#line 2853
#pragma cdir loopcnt=LOOPCNT
+#line 2853
#pragma cdir shortloop
+#line 2853
for (i=0; i<ni; i++) {
+#line 2853
/* the normal case: */
+#line 2853
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2853
/* test for range errors (not always needed but do it anyway) */
+#line 2853
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2853
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2853
nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
+#line 2853
}
+#line 2853
/* copy workspace back if necessary */
+#line 2853
if (realign) {
+#line 2853
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2853
xp = (ushort *) *xpp;
+#line 2853
}
+#line 2853
/* update xpp and tp */
+#line 2853
xp += ni;
+#line 2853
tp += ni;
+#line 2853
*xpp = (void*)xp;
+#line 2853
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2853
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2853
+#line 2853
#else /* not SX */
+#line 2853
+#line 2853
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2853
+ int status = NC_NOERR;
+#line 2853
+#line 2853
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2853
{
+#line 2853
int lstatus = ncx_put_ushort_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2853
+ if(lstatus != NC_NOERR)
+#line 2853
status = lstatus;
+#line 2853
}
+#line 2853
+#line 2853
*xpp = (void *)xp;
+#line 2853
return status;
+#line 2853
#endif
+#line 2853
}
+#line 2853
int
+#line 2854
ncx_putn_ushort_float(void **xpp, size_t nelems, const float *tp)
+#line 2854
{
+#line 2854
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2854
+#line 2854
/* basic algorithm is:
+#line 2854
* - ensure sane alignment of output data
+#line 2854
* - copy (conversion happens automatically) input data
+#line 2854
* to output
+#line 2854
* - update tp to point at next unconverted input, and xpp to point
+#line 2854
* at next location for converted output
+#line 2854
*/
+#line 2854
long i, j, ni;
+#line 2854
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2854
ushort *xp;
+#line 2854
int nrange = 0; /* number of range errors */
+#line 2854
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2854
long cxp = (long) *((char**)xpp);
+#line 2854
+#line 2854
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2854
/* sjl: manually stripmine so we can limit amount of
+#line 2854
* vector work space reserved to LOOPCNT elements. Also
+#line 2854
* makes vectorisation easy */
+#line 2854
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2854
ni=Min(nelems-j,LOOPCNT);
+#line 2854
if (realign) {
+#line 2854
xp = tmp;
+#line 2854
} else {
+#line 2854
xp = (ushort *) *xpp;
+#line 2854
}
+#line 2854
/* copy the next block */
+#line 2854
#pragma cdir loopcnt=LOOPCNT
+#line 2854
#pragma cdir shortloop
+#line 2854
for (i=0; i<ni; i++) {
+#line 2854
/* the normal case: */
+#line 2854
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2854
/* test for range errors (not always needed but do it anyway) */
+#line 2854
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2854
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2854
nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
+#line 2854
}
+#line 2854
/* copy workspace back if necessary */
+#line 2854
if (realign) {
+#line 2854
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2854
xp = (ushort *) *xpp;
+#line 2854
}
+#line 2854
/* update xpp and tp */
+#line 2854
xp += ni;
+#line 2854
tp += ni;
+#line 2854
*xpp = (void*)xp;
+#line 2854
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2854
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2854
+#line 2854
#else /* not SX */
+#line 2854
+#line 2854
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2854
+ int status = NC_NOERR;
+#line 2854
+#line 2854
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2854
{
+#line 2854
int lstatus = ncx_put_ushort_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2854
+ if(lstatus != NC_NOERR)
+#line 2854
status = lstatus;
+#line 2854
}
+#line 2854
+#line 2854
*xpp = (void *)xp;
+#line 2854
return status;
+#line 2854
#endif
+#line 2854
}
+#line 2854
int
+#line 2855
ncx_putn_ushort_double(void **xpp, size_t nelems, const double *tp)
+#line 2855
{
+#line 2855
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2855
+#line 2855
/* basic algorithm is:
+#line 2855
* - ensure sane alignment of output data
+#line 2855
* - copy (conversion happens automatically) input data
+#line 2855
* to output
+#line 2855
* - update tp to point at next unconverted input, and xpp to point
+#line 2855
* at next location for converted output
+#line 2855
*/
+#line 2855
long i, j, ni;
+#line 2855
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2855
ushort *xp;
+#line 2855
int nrange = 0; /* number of range errors */
+#line 2855
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2855
long cxp = (long) *((char**)xpp);
+#line 2855
+#line 2855
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2855
/* sjl: manually stripmine so we can limit amount of
+#line 2855
* vector work space reserved to LOOPCNT elements. Also
+#line 2855
* makes vectorisation easy */
+#line 2855
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2855
ni=Min(nelems-j,LOOPCNT);
+#line 2855
if (realign) {
+#line 2855
xp = tmp;
+#line 2855
} else {
+#line 2855
xp = (ushort *) *xpp;
+#line 2855
}
+#line 2855
/* copy the next block */
+#line 2855
#pragma cdir loopcnt=LOOPCNT
+#line 2855
#pragma cdir shortloop
+#line 2855
for (i=0; i<ni; i++) {
+#line 2855
/* the normal case: */
+#line 2855
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2855
/* test for range errors (not always needed but do it anyway) */
+#line 2855
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2855
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2855
nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
+#line 2855
}
+#line 2855
/* copy workspace back if necessary */
+#line 2855
if (realign) {
+#line 2855
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2855
xp = (ushort *) *xpp;
+#line 2855
}
+#line 2855
/* update xpp and tp */
+#line 2855
xp += ni;
+#line 2855
tp += ni;
+#line 2855
*xpp = (void*)xp;
+#line 2855
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2855
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2855
+#line 2855
#else /* not SX */
+#line 2855
+#line 2855
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2855
+ int status = NC_NOERR;
+#line 2855
+#line 2855
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2855
{
+#line 2855
int lstatus = ncx_put_ushort_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2855
+ if(lstatus != NC_NOERR)
+#line 2855
status = lstatus;
+#line 2855
}
+#line 2855
+#line 2855
*xpp = (void *)xp;
+#line 2855
return status;
+#line 2855
#endif
+#line 2855
}
+#line 2855
int
+#line 2856
ncx_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2856
{
+#line 2856
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2856
+#line 2856
/* basic algorithm is:
+#line 2856
* - ensure sane alignment of output data
+#line 2856
* - copy (conversion happens automatically) input data
+#line 2856
* to output
+#line 2856
* - update tp to point at next unconverted input, and xpp to point
+#line 2856
* at next location for converted output
+#line 2856
*/
+#line 2856
long i, j, ni;
+#line 2856
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2856
ushort *xp;
+#line 2856
int nrange = 0; /* number of range errors */
+#line 2856
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2856
long cxp = (long) *((char**)xpp);
+#line 2856
+#line 2856
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2856
/* sjl: manually stripmine so we can limit amount of
+#line 2856
* vector work space reserved to LOOPCNT elements. Also
+#line 2856
* makes vectorisation easy */
+#line 2856
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2856
ni=Min(nelems-j,LOOPCNT);
+#line 2856
if (realign) {
+#line 2856
xp = tmp;
+#line 2856
} else {
+#line 2856
xp = (ushort *) *xpp;
+#line 2856
}
+#line 2856
/* copy the next block */
+#line 2856
#pragma cdir loopcnt=LOOPCNT
+#line 2856
#pragma cdir shortloop
+#line 2856
for (i=0; i<ni; i++) {
+#line 2856
/* the normal case: */
+#line 2856
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2856
/* test for range errors (not always needed but do it anyway) */
+#line 2856
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2856
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2856
nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
+#line 2856
}
+#line 2856
/* copy workspace back if necessary */
+#line 2856
if (realign) {
+#line 2856
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2856
xp = (ushort *) *xpp;
+#line 2856
}
+#line 2856
/* update xpp and tp */
+#line 2856
xp += ni;
+#line 2856
tp += ni;
+#line 2856
*xpp = (void*)xp;
+#line 2856
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2856
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2856
+#line 2856
#else /* not SX */
+#line 2856
+#line 2856
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2856
+ int status = NC_NOERR;
+#line 2856
+#line 2856
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2856
{
+#line 2856
int lstatus = ncx_put_ushort_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2856
+ if(lstatus != NC_NOERR)
+#line 2856
status = lstatus;
+#line 2856
}
+#line 2856
+#line 2856
*xpp = (void *)xp;
+#line 2856
return status;
+#line 2856
#endif
+#line 2856
}
+#line 2856
int
+#line 2857
ncx_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2857
{
+#line 2857
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2857
+#line 2857
/* basic algorithm is:
+#line 2857
* - ensure sane alignment of output data
+#line 2857
* - copy (conversion happens automatically) input data
+#line 2857
* to output
+#line 2857
* - update tp to point at next unconverted input, and xpp to point
+#line 2857
* at next location for converted output
+#line 2857
*/
+#line 2857
long i, j, ni;
+#line 2857
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2857
ushort *xp;
+#line 2857
int nrange = 0; /* number of range errors */
+#line 2857
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2857
long cxp = (long) *((char**)xpp);
+#line 2857
+#line 2857
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2857
/* sjl: manually stripmine so we can limit amount of
+#line 2857
* vector work space reserved to LOOPCNT elements. Also
+#line 2857
* makes vectorisation easy */
+#line 2857
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2857
ni=Min(nelems-j,LOOPCNT);
+#line 2857
if (realign) {
+#line 2857
xp = tmp;
+#line 2857
} else {
+#line 2857
xp = (ushort *) *xpp;
+#line 2857
}
+#line 2857
/* copy the next block */
+#line 2857
#pragma cdir loopcnt=LOOPCNT
+#line 2857
#pragma cdir shortloop
+#line 2857
for (i=0; i<ni; i++) {
+#line 2857
/* the normal case: */
+#line 2857
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2857
/* test for range errors (not always needed but do it anyway) */
+#line 2857
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2857
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2857
nrange += tp[i] > X_USHORT_MAX ;
+#line 2857
}
+#line 2857
/* copy workspace back if necessary */
+#line 2857
if (realign) {
+#line 2857
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2857
xp = (ushort *) *xpp;
+#line 2857
}
+#line 2857
/* update xpp and tp */
+#line 2857
xp += ni;
+#line 2857
tp += ni;
+#line 2857
*xpp = (void*)xp;
+#line 2857
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2857
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2857
+#line 2857
#else /* not SX */
+#line 2857
+#line 2857
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2857
+ int status = NC_NOERR;
+#line 2857
+#line 2857
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2857
{
+#line 2857
int lstatus = ncx_put_ushort_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2857
+ if(lstatus != NC_NOERR)
+#line 2857
status = lstatus;
+#line 2857
}
+#line 2857
+#line 2857
*xpp = (void *)xp;
+#line 2857
return status;
+#line 2857
#endif
+#line 2857
}
+#line 2857
int
+#line 2858
ncx_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2858
{
+#line 2858
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2858
+#line 2858
/* basic algorithm is:
+#line 2858
* - ensure sane alignment of output data
+#line 2858
* - copy (conversion happens automatically) input data
+#line 2858
* to output
+#line 2858
* - update tp to point at next unconverted input, and xpp to point
+#line 2858
* at next location for converted output
+#line 2858
*/
+#line 2858
long i, j, ni;
+#line 2858
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2858
ushort *xp;
+#line 2858
int nrange = 0; /* number of range errors */
+#line 2858
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2858
long cxp = (long) *((char**)xpp);
+#line 2858
+#line 2858
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2858
/* sjl: manually stripmine so we can limit amount of
+#line 2858
* vector work space reserved to LOOPCNT elements. Also
+#line 2858
* makes vectorisation easy */
+#line 2858
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2858
ni=Min(nelems-j,LOOPCNT);
+#line 2858
if (realign) {
+#line 2858
xp = tmp;
+#line 2858
} else {
+#line 2858
xp = (ushort *) *xpp;
+#line 2858
}
+#line 2858
/* copy the next block */
+#line 2858
#pragma cdir loopcnt=LOOPCNT
+#line 2858
#pragma cdir shortloop
+#line 2858
for (i=0; i<ni; i++) {
+#line 2858
/* the normal case: */
+#line 2858
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2858
/* test for range errors (not always needed but do it anyway) */
+#line 2858
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2858
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2858
nrange += tp[i] > X_USHORT_MAX ;
+#line 2858
}
+#line 2858
/* copy workspace back if necessary */
+#line 2858
if (realign) {
+#line 2858
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2858
xp = (ushort *) *xpp;
+#line 2858
}
+#line 2858
/* update xpp and tp */
+#line 2858
xp += ni;
+#line 2858
tp += ni;
+#line 2858
*xpp = (void*)xp;
+#line 2858
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2858
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2858
+#line 2858
#else /* not SX */
+#line 2858
+#line 2858
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2858
+ int status = NC_NOERR;
+#line 2858
+#line 2858
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2858
{
+#line 2858
int lstatus = ncx_put_ushort_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2858
+ if(lstatus != NC_NOERR)
+#line 2858
status = lstatus;
+#line 2858
}
+#line 2858
+#line 2858
*xpp = (void *)xp;
+#line 2858
return status;
+#line 2858
#endif
+#line 2858
}
+#line 2858
int
+#line 2859
ncx_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2859
{
+#line 2859
#if _SX && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 2859
+#line 2859
/* basic algorithm is:
+#line 2859
* - ensure sane alignment of output data
+#line 2859
* - copy (conversion happens automatically) input data
+#line 2859
* to output
+#line 2859
* - update tp to point at next unconverted input, and xpp to point
+#line 2859
* at next location for converted output
+#line 2859
*/
+#line 2859
long i, j, ni;
+#line 2859
ushort tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2859
ushort *xp;
+#line 2859
int nrange = 0; /* number of range errors */
+#line 2859
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2859
long cxp = (long) *((char**)xpp);
+#line 2859
+#line 2859
realign = (cxp & 7) % SIZEOF_USHORT;
+#line 2859
/* sjl: manually stripmine so we can limit amount of
+#line 2859
* vector work space reserved to LOOPCNT elements. Also
+#line 2859
* makes vectorisation easy */
+#line 2859
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2859
ni=Min(nelems-j,LOOPCNT);
+#line 2859
if (realign) {
+#line 2859
xp = tmp;
+#line 2859
} else {
+#line 2859
xp = (ushort *) *xpp;
+#line 2859
}
+#line 2859
/* copy the next block */
+#line 2859
#pragma cdir loopcnt=LOOPCNT
+#line 2859
#pragma cdir shortloop
+#line 2859
for (i=0; i<ni; i++) {
+#line 2859
/* the normal case: */
+#line 2859
xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
+#line 2859
/* test for range errors (not always needed but do it anyway) */
+#line 2859
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2859
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2859
nrange += tp[i] > X_USHORT_MAX ;
+#line 2859
}
+#line 2859
/* copy workspace back if necessary */
+#line 2859
if (realign) {
+#line 2859
memcpy(*xpp, tmp, ni*X_SIZEOF_USHORT);
+#line 2859
xp = (ushort *) *xpp;
+#line 2859
}
+#line 2859
/* update xpp and tp */
+#line 2859
xp += ni;
+#line 2859
tp += ni;
+#line 2859
*xpp = (void*)xp;
+#line 2859
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2859
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2859
+#line 2859
#else /* not SX */
+#line 2859
+#line 2859
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2859
+ int status = NC_NOERR;
+#line 2859
+#line 2859
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2859
{
+#line 2859
int lstatus = ncx_put_ushort_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2859
+ if(lstatus != NC_NOERR)
+#line 2859
status = lstatus;
+#line 2859
}
+#line 2859
+#line 2859
*xpp = (void *)xp;
+#line 2859
return status;
+#line 2859
#endif
+#line 2859
}
+#line 2859
int
+#line 2861
ncx_pad_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2861
{
+#line 2861
const size_t rndup = nelems % 2;
+#line 2861
+#line 2861
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2861
+ int status = NC_NOERR;
+#line 2861
+#line 2861
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2861
{
+#line 2861
int lstatus = ncx_put_ushort_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2861
+ if(lstatus != NC_NOERR)
+#line 2861
status = lstatus;
+#line 2861
}
+#line 2861
+#line 2861
if(rndup != 0)
+#line 2861
{
+#line 2861
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2861
xp += X_SIZEOF_USHORT;
+#line 2861
}
+#line 2861
+#line 2861
*xpp = (void *)xp;
+#line 2861
return status;
+#line 2861
}
+#line 2861
int
+#line 2862
ncx_pad_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2862
{
+#line 2862
const size_t rndup = nelems % 2;
+#line 2862
+#line 2862
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2862
+ int status = NC_NOERR;
+#line 2862
+#line 2862
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2862
{
+#line 2862
int lstatus = ncx_put_ushort_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2862
+ if(lstatus != NC_NOERR)
+#line 2862
status = lstatus;
+#line 2862
}
+#line 2862
+#line 2862
if(rndup != 0)
+#line 2862
{
+#line 2862
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2862
xp += X_SIZEOF_USHORT;
+#line 2862
}
+#line 2862
+#line 2862
*xpp = (void *)xp;
+#line 2862
return status;
+#line 2862
}
+#line 2862
int
+#line 2863
ncx_pad_putn_ushort_short(void **xpp, size_t nelems, const short *tp)
+#line 2863
{
+#line 2863
const size_t rndup = nelems % 2;
+#line 2863
+#line 2863
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2863
+ int status = NC_NOERR;
+#line 2863
+#line 2863
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2863
{
+#line 2863
int lstatus = ncx_put_ushort_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2863
+ if(lstatus != NC_NOERR)
+#line 2863
status = lstatus;
+#line 2863
}
+#line 2863
+#line 2863
if(rndup != 0)
+#line 2863
{
+#line 2863
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2863
xp += X_SIZEOF_USHORT;
+#line 2863
}
+#line 2863
+#line 2863
*xpp = (void *)xp;
+#line 2863
return status;
+#line 2863
}
+#line 2863
int
+#line 2864
ncx_pad_putn_ushort_int(void **xpp, size_t nelems, const int *tp)
+#line 2864
{
+#line 2864
const size_t rndup = nelems % 2;
+#line 2864
+#line 2864
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2864
+ int status = NC_NOERR;
+#line 2864
+#line 2864
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2864
{
+#line 2864
int lstatus = ncx_put_ushort_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2864
+ if(lstatus != NC_NOERR)
+#line 2864
status = lstatus;
+#line 2864
}
+#line 2864
+#line 2864
if(rndup != 0)
+#line 2864
{
+#line 2864
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2864
xp += X_SIZEOF_USHORT;
+#line 2864
}
+#line 2864
+#line 2864
*xpp = (void *)xp;
+#line 2864
return status;
+#line 2864
}
+#line 2864
int
+#line 2865
ncx_pad_putn_ushort_float(void **xpp, size_t nelems, const float *tp)
+#line 2865
{
+#line 2865
const size_t rndup = nelems % 2;
+#line 2865
+#line 2865
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2865
+ int status = NC_NOERR;
+#line 2865
+#line 2865
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2865
{
+#line 2865
int lstatus = ncx_put_ushort_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2865
+ if(lstatus != NC_NOERR)
+#line 2865
status = lstatus;
+#line 2865
}
+#line 2865
+#line 2865
if(rndup != 0)
+#line 2865
{
+#line 2865
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2865
xp += X_SIZEOF_USHORT;
+#line 2865
}
+#line 2865
+#line 2865
*xpp = (void *)xp;
+#line 2865
return status;
+#line 2865
}
+#line 2865
int
+#line 2866
ncx_pad_putn_ushort_double(void **xpp, size_t nelems, const double *tp)
+#line 2866
{
+#line 2866
const size_t rndup = nelems % 2;
+#line 2866
+#line 2866
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2866
+ int status = NC_NOERR;
+#line 2866
+#line 2866
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2866
{
+#line 2866
int lstatus = ncx_put_ushort_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2866
+ if(lstatus != NC_NOERR)
+#line 2866
status = lstatus;
+#line 2866
}
+#line 2866
+#line 2866
if(rndup != 0)
+#line 2866
{
+#line 2866
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2866
xp += X_SIZEOF_USHORT;
+#line 2866
}
+#line 2866
+#line 2866
*xpp = (void *)xp;
+#line 2866
return status;
+#line 2866
}
+#line 2866
int
+#line 2867
ncx_pad_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2867
{
+#line 2867
const size_t rndup = nelems % 2;
+#line 2867
+#line 2867
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2867
+ int status = NC_NOERR;
+#line 2867
+#line 2867
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2867
{
+#line 2867
int lstatus = ncx_put_ushort_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2867
+ if(lstatus != NC_NOERR)
+#line 2867
status = lstatus;
+#line 2867
}
+#line 2867
+#line 2867
if(rndup != 0)
+#line 2867
{
+#line 2867
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2867
xp += X_SIZEOF_USHORT;
+#line 2867
}
+#line 2867
+#line 2867
*xpp = (void *)xp;
+#line 2867
return status;
+#line 2867
}
+#line 2867
int
+#line 2868
ncx_pad_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2868
{
+#line 2868
const size_t rndup = nelems % 2;
+#line 2868
+#line 2868
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2868
+ int status = NC_NOERR;
+#line 2868
+#line 2868
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2868
{
+#line 2868
int lstatus = ncx_put_ushort_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2868
+ if(lstatus != NC_NOERR)
+#line 2868
status = lstatus;
+#line 2868
}
+#line 2868
+#line 2868
if(rndup != 0)
+#line 2868
{
+#line 2868
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2868
xp += X_SIZEOF_USHORT;
+#line 2868
}
+#line 2868
+#line 2868
*xpp = (void *)xp;
+#line 2868
return status;
+#line 2868
}
+#line 2868
int
+#line 2869
ncx_pad_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2869
{
+#line 2869
const size_t rndup = nelems % 2;
+#line 2869
+#line 2869
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2869
+ int status = NC_NOERR;
+#line 2869
+#line 2869
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2869
{
+#line 2869
int lstatus = ncx_put_ushort_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2869
+ if(lstatus != NC_NOERR)
+#line 2869
status = lstatus;
+#line 2869
}
+#line 2869
+#line 2869
if(rndup != 0)
+#line 2869
{
+#line 2869
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2869
xp += X_SIZEOF_USHORT;
+#line 2869
}
+#line 2869
+#line 2869
*xpp = (void *)xp;
+#line 2869
return status;
+#line 2869
}
+#line 2869
int
+#line 2870
ncx_pad_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2870
{
+#line 2870
const size_t rndup = nelems % 2;
+#line 2870
+#line 2870
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2870
+ int status = NC_NOERR;
+#line 2870
+#line 2870
for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 2870
{
+#line 2870
int lstatus = ncx_put_ushort_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2870
+ if(lstatus != NC_NOERR)
+#line 2870
status = lstatus;
+#line 2870
}
+#line 2870
+#line 2870
if(rndup != 0)
+#line 2870
{
+#line 2870
(void) memcpy(xp, nada, X_SIZEOF_USHORT);
+#line 2870
xp += X_SIZEOF_USHORT;
+#line 2870
}
+#line 2870
+#line 2870
*xpp = (void *)xp;
+#line 2870
return status;
+#line 2870
}
+#line 2870
@@ -8887,659 +15833,1299 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
swapn4b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_INT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2889
ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
+#line 2889
{
+#line 2889
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2889
+#line 2889
/* basic algorithm is:
+#line 2889
* - ensure sane alignment of input data
+#line 2889
* - copy (conversion happens automatically) input data
+#line 2889
* to output
+#line 2889
* - update xpp to point at next unconverted input, and tp to point
+#line 2889
* at next location for converted output
+#line 2889
*/
+#line 2889
long i, j, ni;
+#line 2889
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2889
int *xp;
+#line 2889
int nrange = 0; /* number of range errors */
+#line 2889
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2889
long cxp = (long) *((char**)xpp);
+#line 2889
+#line 2889
realign = (cxp & 7) % SIZEOF_INT;
+#line 2889
/* sjl: manually stripmine so we can limit amount of
+#line 2889
* vector work space reserved to LOOPCNT elements. Also
+#line 2889
* makes vectorisation easy */
+#line 2889
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2889
ni=Min(nelems-j,LOOPCNT);
+#line 2889
if (realign) {
+#line 2889
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2889
xp = tmp;
+#line 2889
} else {
+#line 2889
xp = (int *) *xpp;
+#line 2889
}
+#line 2889
/* copy the next block */
+#line 2889
#pragma cdir loopcnt=LOOPCNT
+#line 2889
#pragma cdir shortloop
+#line 2889
for (i=0; i<ni; i++) {
+#line 2889
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2889
/* test for range errors (not always needed but do it anyway) */
+#line 2889
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2889
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2889
nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
+#line 2889
}
+#line 2889
/* update xpp and tp */
+#line 2889
if (realign) xp = (int *) *xpp;
+#line 2889
xp += ni;
+#line 2889
tp += ni;
+#line 2889
*xpp = (void*)xp;
+#line 2889
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2889
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2889
+#line 2889
#else /* not SX */
+#line 2889
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2889
+ int status = NC_NOERR;
+#line 2889
+#line 2889
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2889
{
+#line 2889
const int lstatus = ncx_get_int_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2889
+ if(lstatus != NC_NOERR)
+#line 2889
status = lstatus;
+#line 2889
}
+#line 2889
+#line 2889
*xpp = (const void *)xp;
+#line 2889
return status;
+#line 2889
# endif
+#line 2889
}
+#line 2889
#endif
int
+#line 2891
ncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2891
{
+#line 2891
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2891
+#line 2891
/* basic algorithm is:
+#line 2891
* - ensure sane alignment of input data
+#line 2891
* - copy (conversion happens automatically) input data
+#line 2891
* to output
+#line 2891
* - update xpp to point at next unconverted input, and tp to point
+#line 2891
* at next location for converted output
+#line 2891
*/
+#line 2891
long i, j, ni;
+#line 2891
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2891
int *xp;
+#line 2891
int nrange = 0; /* number of range errors */
+#line 2891
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2891
long cxp = (long) *((char**)xpp);
+#line 2891
+#line 2891
realign = (cxp & 7) % SIZEOF_INT;
+#line 2891
/* sjl: manually stripmine so we can limit amount of
+#line 2891
* vector work space reserved to LOOPCNT elements. Also
+#line 2891
* makes vectorisation easy */
+#line 2891
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2891
ni=Min(nelems-j,LOOPCNT);
+#line 2891
if (realign) {
+#line 2891
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2891
xp = tmp;
+#line 2891
} else {
+#line 2891
xp = (int *) *xpp;
+#line 2891
}
+#line 2891
/* copy the next block */
+#line 2891
#pragma cdir loopcnt=LOOPCNT
+#line 2891
#pragma cdir shortloop
+#line 2891
for (i=0; i<ni; i++) {
+#line 2891
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2891
/* test for range errors (not always needed but do it anyway) */
+#line 2891
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2891
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2891
nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
+#line 2891
}
+#line 2891
/* update xpp and tp */
+#line 2891
if (realign) xp = (int *) *xpp;
+#line 2891
xp += ni;
+#line 2891
tp += ni;
+#line 2891
*xpp = (void*)xp;
+#line 2891
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2891
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2891
+#line 2891
#else /* not SX */
+#line 2891
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2891
+ int status = NC_NOERR;
+#line 2891
+#line 2891
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2891
{
+#line 2891
const int lstatus = ncx_get_int_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2891
+ if(lstatus != NC_NOERR)
+#line 2891
status = lstatus;
+#line 2891
}
+#line 2891
+#line 2891
*xpp = (const void *)xp;
+#line 2891
return status;
+#line 2891
# endif
+#line 2891
}
+#line 2891
int
+#line 2892
ncx_getn_int_short(const void **xpp, size_t nelems, short *tp)
+#line 2892
{
+#line 2892
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2892
+#line 2892
/* basic algorithm is:
+#line 2892
* - ensure sane alignment of input data
+#line 2892
* - copy (conversion happens automatically) input data
+#line 2892
* to output
+#line 2892
* - update xpp to point at next unconverted input, and tp to point
+#line 2892
* at next location for converted output
+#line 2892
*/
+#line 2892
long i, j, ni;
+#line 2892
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2892
int *xp;
+#line 2892
int nrange = 0; /* number of range errors */
+#line 2892
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2892
long cxp = (long) *((char**)xpp);
+#line 2892
+#line 2892
realign = (cxp & 7) % SIZEOF_INT;
+#line 2892
/* sjl: manually stripmine so we can limit amount of
+#line 2892
* vector work space reserved to LOOPCNT elements. Also
+#line 2892
* makes vectorisation easy */
+#line 2892
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2892
ni=Min(nelems-j,LOOPCNT);
+#line 2892
if (realign) {
+#line 2892
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2892
xp = tmp;
+#line 2892
} else {
+#line 2892
xp = (int *) *xpp;
+#line 2892
}
+#line 2892
/* copy the next block */
+#line 2892
#pragma cdir loopcnt=LOOPCNT
+#line 2892
#pragma cdir shortloop
+#line 2892
for (i=0; i<ni; i++) {
+#line 2892
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2892
/* test for range errors (not always needed but do it anyway) */
+#line 2892
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2892
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2892
nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
+#line 2892
}
+#line 2892
/* update xpp and tp */
+#line 2892
if (realign) xp = (int *) *xpp;
+#line 2892
xp += ni;
+#line 2892
tp += ni;
+#line 2892
*xpp = (void*)xp;
+#line 2892
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2892
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2892
+#line 2892
#else /* not SX */
+#line 2892
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2892
+ int status = NC_NOERR;
+#line 2892
+#line 2892
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2892
{
+#line 2892
const int lstatus = ncx_get_int_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2892
+ if(lstatus != NC_NOERR)
+#line 2892
status = lstatus;
+#line 2892
}
+#line 2892
+#line 2892
*xpp = (const void *)xp;
+#line 2892
return status;
+#line 2892
# endif
+#line 2892
}
+#line 2892
int
+#line 2893
ncx_getn_int_float(const void **xpp, size_t nelems, float *tp)
+#line 2893
{
+#line 2893
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2893
+#line 2893
/* basic algorithm is:
+#line 2893
* - ensure sane alignment of input data
+#line 2893
* - copy (conversion happens automatically) input data
+#line 2893
* to output
+#line 2893
* - update xpp to point at next unconverted input, and tp to point
+#line 2893
* at next location for converted output
+#line 2893
*/
+#line 2893
long i, j, ni;
+#line 2893
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2893
int *xp;
+#line 2893
int nrange = 0; /* number of range errors */
+#line 2893
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2893
long cxp = (long) *((char**)xpp);
+#line 2893
+#line 2893
realign = (cxp & 7) % SIZEOF_INT;
+#line 2893
/* sjl: manually stripmine so we can limit amount of
+#line 2893
* vector work space reserved to LOOPCNT elements. Also
+#line 2893
* makes vectorisation easy */
+#line 2893
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2893
ni=Min(nelems-j,LOOPCNT);
+#line 2893
if (realign) {
+#line 2893
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2893
xp = tmp;
+#line 2893
} else {
+#line 2893
xp = (int *) *xpp;
+#line 2893
}
+#line 2893
/* copy the next block */
+#line 2893
#pragma cdir loopcnt=LOOPCNT
+#line 2893
#pragma cdir shortloop
+#line 2893
for (i=0; i<ni; i++) {
+#line 2893
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2893
/* test for range errors (not always needed but do it anyway) */
+#line 2893
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2893
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2893
nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
+#line 2893
}
+#line 2893
/* update xpp and tp */
+#line 2893
if (realign) xp = (int *) *xpp;
+#line 2893
xp += ni;
+#line 2893
tp += ni;
+#line 2893
*xpp = (void*)xp;
+#line 2893
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2893
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2893
+#line 2893
#else /* not SX */
+#line 2893
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2893
+ int status = NC_NOERR;
+#line 2893
+#line 2893
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2893
{
+#line 2893
const int lstatus = ncx_get_int_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2893
+ if(lstatus != NC_NOERR)
+#line 2893
status = lstatus;
+#line 2893
}
+#line 2893
+#line 2893
*xpp = (const void *)xp;
+#line 2893
return status;
+#line 2893
# endif
+#line 2893
}
+#line 2893
int
+#line 2894
ncx_getn_int_double(const void **xpp, size_t nelems, double *tp)
+#line 2894
{
+#line 2894
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2894
+#line 2894
/* basic algorithm is:
+#line 2894
* - ensure sane alignment of input data
+#line 2894
* - copy (conversion happens automatically) input data
+#line 2894
* to output
+#line 2894
* - update xpp to point at next unconverted input, and tp to point
+#line 2894
* at next location for converted output
+#line 2894
*/
+#line 2894
long i, j, ni;
+#line 2894
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2894
int *xp;
+#line 2894
int nrange = 0; /* number of range errors */
+#line 2894
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2894
long cxp = (long) *((char**)xpp);
+#line 2894
+#line 2894
realign = (cxp & 7) % SIZEOF_INT;
+#line 2894
/* sjl: manually stripmine so we can limit amount of
+#line 2894
* vector work space reserved to LOOPCNT elements. Also
+#line 2894
* makes vectorisation easy */
+#line 2894
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2894
ni=Min(nelems-j,LOOPCNT);
+#line 2894
if (realign) {
+#line 2894
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2894
xp = tmp;
+#line 2894
} else {
+#line 2894
xp = (int *) *xpp;
+#line 2894
}
+#line 2894
/* copy the next block */
+#line 2894
#pragma cdir loopcnt=LOOPCNT
+#line 2894
#pragma cdir shortloop
+#line 2894
for (i=0; i<ni; i++) {
+#line 2894
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2894
/* test for range errors (not always needed but do it anyway) */
+#line 2894
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2894
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2894
nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
+#line 2894
}
+#line 2894
/* update xpp and tp */
+#line 2894
if (realign) xp = (int *) *xpp;
+#line 2894
xp += ni;
+#line 2894
tp += ni;
+#line 2894
*xpp = (void*)xp;
+#line 2894
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2894
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2894
+#line 2894
#else /* not SX */
+#line 2894
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2894
+ int status = NC_NOERR;
+#line 2894
+#line 2894
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2894
{
+#line 2894
const int lstatus = ncx_get_int_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2894
+ if(lstatus != NC_NOERR)
+#line 2894
status = lstatus;
+#line 2894
}
+#line 2894
+#line 2894
*xpp = (const void *)xp;
+#line 2894
return status;
+#line 2894
# endif
+#line 2894
}
+#line 2894
int
+#line 2895
ncx_getn_int_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2895
{
+#line 2895
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2895
+#line 2895
/* basic algorithm is:
+#line 2895
* - ensure sane alignment of input data
+#line 2895
* - copy (conversion happens automatically) input data
+#line 2895
* to output
+#line 2895
* - update xpp to point at next unconverted input, and tp to point
+#line 2895
* at next location for converted output
+#line 2895
*/
+#line 2895
long i, j, ni;
+#line 2895
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2895
int *xp;
+#line 2895
int nrange = 0; /* number of range errors */
+#line 2895
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2895
long cxp = (long) *((char**)xpp);
+#line 2895
+#line 2895
realign = (cxp & 7) % SIZEOF_INT;
+#line 2895
/* sjl: manually stripmine so we can limit amount of
+#line 2895
* vector work space reserved to LOOPCNT elements. Also
+#line 2895
* makes vectorisation easy */
+#line 2895
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2895
ni=Min(nelems-j,LOOPCNT);
+#line 2895
if (realign) {
+#line 2895
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2895
xp = tmp;
+#line 2895
} else {
+#line 2895
xp = (int *) *xpp;
+#line 2895
}
+#line 2895
/* copy the next block */
+#line 2895
#pragma cdir loopcnt=LOOPCNT
+#line 2895
#pragma cdir shortloop
+#line 2895
for (i=0; i<ni; i++) {
+#line 2895
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2895
/* test for range errors (not always needed but do it anyway) */
+#line 2895
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2895
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2895
nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
+#line 2895
}
+#line 2895
/* update xpp and tp */
+#line 2895
if (realign) xp = (int *) *xpp;
+#line 2895
xp += ni;
+#line 2895
tp += ni;
+#line 2895
*xpp = (void*)xp;
+#line 2895
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2895
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2895
+#line 2895
#else /* not SX */
+#line 2895
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2895
+ int status = NC_NOERR;
+#line 2895
+#line 2895
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2895
{
+#line 2895
const int lstatus = ncx_get_int_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2895
+ if(lstatus != NC_NOERR)
+#line 2895
status = lstatus;
+#line 2895
}
+#line 2895
+#line 2895
*xpp = (const void *)xp;
+#line 2895
return status;
+#line 2895
# endif
+#line 2895
}
+#line 2895
int
+#line 2896
ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2896
{
+#line 2896
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2896
+#line 2896
/* basic algorithm is:
+#line 2896
* - ensure sane alignment of input data
+#line 2896
* - copy (conversion happens automatically) input data
+#line 2896
* to output
+#line 2896
* - update xpp to point at next unconverted input, and tp to point
+#line 2896
* at next location for converted output
+#line 2896
*/
+#line 2896
long i, j, ni;
+#line 2896
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2896
int *xp;
+#line 2896
int nrange = 0; /* number of range errors */
+#line 2896
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2896
long cxp = (long) *((char**)xpp);
+#line 2896
+#line 2896
realign = (cxp & 7) % SIZEOF_INT;
+#line 2896
/* sjl: manually stripmine so we can limit amount of
+#line 2896
* vector work space reserved to LOOPCNT elements. Also
+#line 2896
* makes vectorisation easy */
+#line 2896
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2896
ni=Min(nelems-j,LOOPCNT);
+#line 2896
if (realign) {
+#line 2896
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2896
xp = tmp;
+#line 2896
} else {
+#line 2896
xp = (int *) *xpp;
+#line 2896
}
+#line 2896
/* copy the next block */
+#line 2896
#pragma cdir loopcnt=LOOPCNT
+#line 2896
#pragma cdir shortloop
+#line 2896
for (i=0; i<ni; i++) {
+#line 2896
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2896
/* test for range errors (not always needed but do it anyway) */
+#line 2896
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2896
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2896
nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
+#line 2896
}
+#line 2896
/* update xpp and tp */
+#line 2896
if (realign) xp = (int *) *xpp;
+#line 2896
xp += ni;
+#line 2896
tp += ni;
+#line 2896
*xpp = (void*)xp;
+#line 2896
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2896
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2896
+#line 2896
#else /* not SX */
+#line 2896
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2896
+ int status = NC_NOERR;
+#line 2896
+#line 2896
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2896
{
+#line 2896
const int lstatus = ncx_get_int_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2896
+ if(lstatus != NC_NOERR)
+#line 2896
status = lstatus;
+#line 2896
}
+#line 2896
+#line 2896
*xpp = (const void *)xp;
+#line 2896
return status;
+#line 2896
# endif
+#line 2896
}
+#line 2896
int
+#line 2897
ncx_getn_int_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2897
{
+#line 2897
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2897
+#line 2897
/* basic algorithm is:
+#line 2897
* - ensure sane alignment of input data
+#line 2897
* - copy (conversion happens automatically) input data
+#line 2897
* to output
+#line 2897
* - update xpp to point at next unconverted input, and tp to point
+#line 2897
* at next location for converted output
+#line 2897
*/
+#line 2897
long i, j, ni;
+#line 2897
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2897
int *xp;
+#line 2897
int nrange = 0; /* number of range errors */
+#line 2897
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2897
long cxp = (long) *((char**)xpp);
+#line 2897
+#line 2897
realign = (cxp & 7) % SIZEOF_INT;
+#line 2897
/* sjl: manually stripmine so we can limit amount of
+#line 2897
* vector work space reserved to LOOPCNT elements. Also
+#line 2897
* makes vectorisation easy */
+#line 2897
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2897
ni=Min(nelems-j,LOOPCNT);
+#line 2897
if (realign) {
+#line 2897
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2897
xp = tmp;
+#line 2897
} else {
+#line 2897
xp = (int *) *xpp;
+#line 2897
}
+#line 2897
/* copy the next block */
+#line 2897
#pragma cdir loopcnt=LOOPCNT
+#line 2897
#pragma cdir shortloop
+#line 2897
for (i=0; i<ni; i++) {
+#line 2897
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 2897
/* test for range errors (not always needed but do it anyway) */
+#line 2897
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2897
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2897
nrange += xp[i] > USHORT_MAX || xp[i] < 0;
+#line 2897
}
+#line 2897
/* update xpp and tp */
+#line 2897
if (realign) xp = (int *) *xpp;
+#line 2897
xp += ni;
+#line 2897
tp += ni;
+#line 2897
*xpp = (void*)xp;
+#line 2897
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2897
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2897
+#line 2897
#else /* not SX */
+#line 2897
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2897
+ int status = NC_NOERR;
+#line 2897
+#line 2897
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2897
{
+#line 2897
const int lstatus = ncx_get_int_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2897
+ if(lstatus != NC_NOERR)
+#line 2897
status = lstatus;
+#line 2897
}
+#line 2897
+#line 2897
*xpp = (const void *)xp;
+#line 2897
return status;
+#line 2897
# endif
+#line 2897
}
+#line 2897
int
+#line 2898
ncx_getn_int_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2898
{
+#line 2898
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2898
+#line 2898
/* basic algorithm is:
+#line 2898
* - ensure sane alignment of input data
+#line 2898
* - copy (conversion happens automatically) input data
+#line 2898
* to output
+#line 2898
* - update xpp to point at next unconverted input, and tp to point
+#line 2898
* at next location for converted output
+#line 2898
*/
+#line 2898
long i, j, ni;
+#line 2898
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2898
int *xp;
+#line 2898
int nrange = 0; /* number of range errors */
+#line 2898
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2898
long cxp = (long) *((char**)xpp);
+#line 2898
+#line 2898
realign = (cxp & 7) % SIZEOF_INT;
+#line 2898
/* sjl: manually stripmine so we can limit amount of
+#line 2898
* vector work space reserved to LOOPCNT elements. Also
+#line 2898
* makes vectorisation easy */
+#line 2898
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2898
ni=Min(nelems-j,LOOPCNT);
+#line 2898
if (realign) {
+#line 2898
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2898
xp = tmp;
+#line 2898
} else {
+#line 2898
xp = (int *) *xpp;
+#line 2898
}
+#line 2898
/* copy the next block */
+#line 2898
#pragma cdir loopcnt=LOOPCNT
+#line 2898
#pragma cdir shortloop
+#line 2898
for (i=0; i<ni; i++) {
+#line 2898
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2898
/* test for range errors (not always needed but do it anyway) */
+#line 2898
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2898
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2898
nrange += xp[i] > UINT_MAX || xp[i] < 0;
+#line 2898
}
+#line 2898
/* update xpp and tp */
+#line 2898
if (realign) xp = (int *) *xpp;
+#line 2898
xp += ni;
+#line 2898
tp += ni;
+#line 2898
*xpp = (void*)xp;
+#line 2898
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2898
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2898
+#line 2898
#else /* not SX */
+#line 2898
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2898
+ int status = NC_NOERR;
+#line 2898
+#line 2898
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2898
{
+#line 2898
const int lstatus = ncx_get_int_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2898
+ if(lstatus != NC_NOERR)
+#line 2898
status = lstatus;
+#line 2898
}
+#line 2898
+#line 2898
*xpp = (const void *)xp;
+#line 2898
return status;
+#line 2898
# endif
+#line 2898
}
+#line 2898
int
+#line 2899
ncx_getn_int_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2899
{
+#line 2899
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2899
+#line 2899
/* basic algorithm is:
+#line 2899
* - ensure sane alignment of input data
+#line 2899
* - copy (conversion happens automatically) input data
+#line 2899
* to output
+#line 2899
* - update xpp to point at next unconverted input, and tp to point
+#line 2899
* at next location for converted output
+#line 2899
*/
+#line 2899
long i, j, ni;
+#line 2899
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2899
int *xp;
+#line 2899
int nrange = 0; /* number of range errors */
+#line 2899
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2899
long cxp = (long) *((char**)xpp);
+#line 2899
+#line 2899
realign = (cxp & 7) % SIZEOF_INT;
+#line 2899
/* sjl: manually stripmine so we can limit amount of
+#line 2899
* vector work space reserved to LOOPCNT elements. Also
+#line 2899
* makes vectorisation easy */
+#line 2899
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2899
ni=Min(nelems-j,LOOPCNT);
+#line 2899
if (realign) {
+#line 2899
memcpy(tmp, *xpp, ni*SIZEOF_INT);
+#line 2899
xp = tmp;
+#line 2899
} else {
+#line 2899
xp = (int *) *xpp;
+#line 2899
}
+#line 2899
/* copy the next block */
+#line 2899
#pragma cdir loopcnt=LOOPCNT
+#line 2899
#pragma cdir shortloop
+#line 2899
for (i=0; i<ni; i++) {
+#line 2899
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2899
/* test for range errors (not always needed but do it anyway) */
+#line 2899
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2899
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2899
nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
+#line 2899
}
+#line 2899
/* update xpp and tp */
+#line 2899
if (realign) xp = (int *) *xpp;
+#line 2899
xp += ni;
+#line 2899
tp += ni;
+#line 2899
*xpp = (void*)xp;
+#line 2899
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2899
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2899
+#line 2899
#else /* not SX */
+#line 2899
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2899
+ int status = NC_NOERR;
+#line 2899
+#line 2899
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2899
{
+#line 2899
const int lstatus = ncx_get_int_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2899
+ if(lstatus != NC_NOERR)
+#line 2899
status = lstatus;
+#line 2899
}
+#line 2899
+#line 2899
*xpp = (const void *)xp;
+#line 2899
return status;
+#line 2899
# endif
+#line 2899
}
+#line 2899
#if X_SIZEOF_INT == SIZEOF_INT
@@ -9553,708 +17139,1397 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
swapn4b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_INT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2915
ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
+#line 2915
{
+#line 2915
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2915
+#line 2915
/* basic algorithm is:
+#line 2915
* - ensure sane alignment of output data
+#line 2915
* - copy (conversion happens automatically) input data
+#line 2915
* to output
+#line 2915
* - update tp to point at next unconverted input, and xpp to point
+#line 2915
* at next location for converted output
+#line 2915
*/
+#line 2915
long i, j, ni;
+#line 2915
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2915
int *xp;
+#line 2915
int nrange = 0; /* number of range errors */
+#line 2915
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2915
long cxp = (long) *((char**)xpp);
+#line 2915
+#line 2915
realign = (cxp & 7) % SIZEOF_INT;
+#line 2915
/* sjl: manually stripmine so we can limit amount of
+#line 2915
* vector work space reserved to LOOPCNT elements. Also
+#line 2915
* makes vectorisation easy */
+#line 2915
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2915
ni=Min(nelems-j,LOOPCNT);
+#line 2915
if (realign) {
+#line 2915
xp = tmp;
+#line 2915
} else {
+#line 2915
xp = (int *) *xpp;
+#line 2915
}
+#line 2915
/* copy the next block */
+#line 2915
#pragma cdir loopcnt=LOOPCNT
+#line 2915
#pragma cdir shortloop
+#line 2915
for (i=0; i<ni; i++) {
+#line 2915
/* the normal case: */
+#line 2915
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2915
/* test for range errors (not always needed but do it anyway) */
+#line 2915
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2915
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2915
nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
+#line 2915
}
+#line 2915
/* copy workspace back if necessary */
+#line 2915
if (realign) {
+#line 2915
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2915
xp = (int *) *xpp;
+#line 2915
}
+#line 2915
/* update xpp and tp */
+#line 2915
xp += ni;
+#line 2915
tp += ni;
+#line 2915
*xpp = (void*)xp;
+#line 2915
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2915
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2915
+#line 2915
#else /* not SX */
+#line 2915
+#line 2915
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2915
+ int status = NC_NOERR;
+#line 2915
+#line 2915
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2915
{
+#line 2915
int lstatus = ncx_put_int_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2915
+ if(lstatus != NC_NOERR)
+#line 2915
status = lstatus;
+#line 2915
}
+#line 2915
+#line 2915
*xpp = (void *)xp;
+#line 2915
return status;
+#line 2915
#endif
+#line 2915
}
+#line 2915
#endif
int
+#line 2917
ncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2917
{
+#line 2917
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2917
+#line 2917
/* basic algorithm is:
+#line 2917
* - ensure sane alignment of output data
+#line 2917
* - copy (conversion happens automatically) input data
+#line 2917
* to output
+#line 2917
* - update tp to point at next unconverted input, and xpp to point
+#line 2917
* at next location for converted output
+#line 2917
*/
+#line 2917
long i, j, ni;
+#line 2917
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2917
int *xp;
+#line 2917
int nrange = 0; /* number of range errors */
+#line 2917
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2917
long cxp = (long) *((char**)xpp);
+#line 2917
+#line 2917
realign = (cxp & 7) % SIZEOF_INT;
+#line 2917
/* sjl: manually stripmine so we can limit amount of
+#line 2917
* vector work space reserved to LOOPCNT elements. Also
+#line 2917
* makes vectorisation easy */
+#line 2917
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2917
ni=Min(nelems-j,LOOPCNT);
+#line 2917
if (realign) {
+#line 2917
xp = tmp;
+#line 2917
} else {
+#line 2917
xp = (int *) *xpp;
+#line 2917
}
+#line 2917
/* copy the next block */
+#line 2917
#pragma cdir loopcnt=LOOPCNT
+#line 2917
#pragma cdir shortloop
+#line 2917
for (i=0; i<ni; i++) {
+#line 2917
/* the normal case: */
+#line 2917
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2917
/* test for range errors (not always needed but do it anyway) */
+#line 2917
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2917
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2917
nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
+#line 2917
}
+#line 2917
/* copy workspace back if necessary */
+#line 2917
if (realign) {
+#line 2917
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2917
xp = (int *) *xpp;
+#line 2917
}
+#line 2917
/* update xpp and tp */
+#line 2917
xp += ni;
+#line 2917
tp += ni;
+#line 2917
*xpp = (void*)xp;
+#line 2917
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2917
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2917
+#line 2917
#else /* not SX */
+#line 2917
+#line 2917
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2917
+ int status = NC_NOERR;
+#line 2917
+#line 2917
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2917
{
+#line 2917
int lstatus = ncx_put_int_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2917
+ if(lstatus != NC_NOERR)
+#line 2917
status = lstatus;
+#line 2917
}
+#line 2917
+#line 2917
*xpp = (void *)xp;
+#line 2917
return status;
+#line 2917
#endif
+#line 2917
}
+#line 2917
int
+#line 2918
ncx_putn_int_short(void **xpp, size_t nelems, const short *tp)
+#line 2918
{
+#line 2918
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2918
+#line 2918
/* basic algorithm is:
+#line 2918
* - ensure sane alignment of output data
+#line 2918
* - copy (conversion happens automatically) input data
+#line 2918
* to output
+#line 2918
* - update tp to point at next unconverted input, and xpp to point
+#line 2918
* at next location for converted output
+#line 2918
*/
+#line 2918
long i, j, ni;
+#line 2918
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2918
int *xp;
+#line 2918
int nrange = 0; /* number of range errors */
+#line 2918
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2918
long cxp = (long) *((char**)xpp);
+#line 2918
+#line 2918
realign = (cxp & 7) % SIZEOF_INT;
+#line 2918
/* sjl: manually stripmine so we can limit amount of
+#line 2918
* vector work space reserved to LOOPCNT elements. Also
+#line 2918
* makes vectorisation easy */
+#line 2918
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2918
ni=Min(nelems-j,LOOPCNT);
+#line 2918
if (realign) {
+#line 2918
xp = tmp;
+#line 2918
} else {
+#line 2918
xp = (int *) *xpp;
+#line 2918
}
+#line 2918
/* copy the next block */
+#line 2918
#pragma cdir loopcnt=LOOPCNT
+#line 2918
#pragma cdir shortloop
+#line 2918
for (i=0; i<ni; i++) {
+#line 2918
/* the normal case: */
+#line 2918
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2918
/* test for range errors (not always needed but do it anyway) */
+#line 2918
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2918
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2918
nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
+#line 2918
}
+#line 2918
/* copy workspace back if necessary */
+#line 2918
if (realign) {
+#line 2918
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2918
xp = (int *) *xpp;
+#line 2918
}
+#line 2918
/* update xpp and tp */
+#line 2918
xp += ni;
+#line 2918
tp += ni;
+#line 2918
*xpp = (void*)xp;
+#line 2918
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2918
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2918
+#line 2918
#else /* not SX */
+#line 2918
+#line 2918
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2918
+ int status = NC_NOERR;
+#line 2918
+#line 2918
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2918
{
+#line 2918
int lstatus = ncx_put_int_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2918
+ if(lstatus != NC_NOERR)
+#line 2918
status = lstatus;
+#line 2918
}
+#line 2918
+#line 2918
*xpp = (void *)xp;
+#line 2918
return status;
+#line 2918
#endif
+#line 2918
}
+#line 2918
int
+#line 2919
ncx_putn_int_float(void **xpp, size_t nelems, const float *tp)
+#line 2919
{
+#line 2919
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2919
+#line 2919
/* basic algorithm is:
+#line 2919
* - ensure sane alignment of output data
+#line 2919
* - copy (conversion happens automatically) input data
+#line 2919
* to output
+#line 2919
* - update tp to point at next unconverted input, and xpp to point
+#line 2919
* at next location for converted output
+#line 2919
*/
+#line 2919
long i, j, ni;
+#line 2919
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2919
int *xp;
+#line 2919
double d; /* special case for ncx_putn_int_float */
+#line 2919
int nrange = 0; /* number of range errors */
+#line 2919
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2919
long cxp = (long) *((char**)xpp);
+#line 2919
+#line 2919
realign = (cxp & 7) % SIZEOF_INT;
+#line 2919
/* sjl: manually stripmine so we can limit amount of
+#line 2919
* vector work space reserved to LOOPCNT elements. Also
+#line 2919
* makes vectorisation easy */
+#line 2919
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2919
ni=Min(nelems-j,LOOPCNT);
+#line 2919
if (realign) {
+#line 2919
xp = tmp;
+#line 2919
} else {
+#line 2919
xp = (int *) *xpp;
+#line 2919
}
+#line 2919
/* copy the next block */
+#line 2919
#pragma cdir loopcnt=LOOPCNT
+#line 2919
#pragma cdir shortloop
+#line 2919
for (i=0; i<ni; i++) {
+#line 2919
/* for some reason int to float, for putn, requires a special case */
+#line 2919
d = tp[i];
+#line 2919
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) d));
+#line 2919
nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
+#line 2919
}
+#line 2919
/* copy workspace back if necessary */
+#line 2919
if (realign) {
+#line 2919
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2919
xp = (int *) *xpp;
+#line 2919
}
+#line 2919
/* update xpp and tp */
+#line 2919
xp += ni;
+#line 2919
tp += ni;
+#line 2919
*xpp = (void*)xp;
+#line 2919
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2919
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2919
+#line 2919
#else /* not SX */
+#line 2919
+#line 2919
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2919
+ int status = NC_NOERR;
+#line 2919
+#line 2919
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2919
{
+#line 2919
int lstatus = ncx_put_int_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2919
+ if(lstatus != NC_NOERR)
+#line 2919
status = lstatus;
+#line 2919
}
+#line 2919
+#line 2919
*xpp = (void *)xp;
+#line 2919
return status;
+#line 2919
#endif
+#line 2919
}
+#line 2919
int
+#line 2920
ncx_putn_int_double(void **xpp, size_t nelems, const double *tp)
+#line 2920
{
+#line 2920
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2920
+#line 2920
/* basic algorithm is:
+#line 2920
* - ensure sane alignment of output data
+#line 2920
* - copy (conversion happens automatically) input data
+#line 2920
* to output
+#line 2920
* - update tp to point at next unconverted input, and xpp to point
+#line 2920
* at next location for converted output
+#line 2920
*/
+#line 2920
long i, j, ni;
+#line 2920
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2920
int *xp;
+#line 2920
int nrange = 0; /* number of range errors */
+#line 2920
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2920
long cxp = (long) *((char**)xpp);
+#line 2920
+#line 2920
realign = (cxp & 7) % SIZEOF_INT;
+#line 2920
/* sjl: manually stripmine so we can limit amount of
+#line 2920
* vector work space reserved to LOOPCNT elements. Also
+#line 2920
* makes vectorisation easy */
+#line 2920
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2920
ni=Min(nelems-j,LOOPCNT);
+#line 2920
if (realign) {
+#line 2920
xp = tmp;
+#line 2920
} else {
+#line 2920
xp = (int *) *xpp;
+#line 2920
}
+#line 2920
/* copy the next block */
+#line 2920
#pragma cdir loopcnt=LOOPCNT
+#line 2920
#pragma cdir shortloop
+#line 2920
for (i=0; i<ni; i++) {
+#line 2920
/* the normal case: */
+#line 2920
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2920
/* test for range errors (not always needed but do it anyway) */
+#line 2920
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2920
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2920
nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
+#line 2920
}
+#line 2920
/* copy workspace back if necessary */
+#line 2920
if (realign) {
+#line 2920
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2920
xp = (int *) *xpp;
+#line 2920
}
+#line 2920
/* update xpp and tp */
+#line 2920
xp += ni;
+#line 2920
tp += ni;
+#line 2920
*xpp = (void*)xp;
+#line 2920
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2920
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2920
+#line 2920
#else /* not SX */
+#line 2920
+#line 2920
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2920
+ int status = NC_NOERR;
+#line 2920
+#line 2920
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2920
{
+#line 2920
int lstatus = ncx_put_int_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2920
+ if(lstatus != NC_NOERR)
+#line 2920
status = lstatus;
+#line 2920
}
+#line 2920
+#line 2920
*xpp = (void *)xp;
+#line 2920
return status;
+#line 2920
#endif
+#line 2920
}
+#line 2920
int
+#line 2921
ncx_putn_int_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2921
{
+#line 2921
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2921
+#line 2921
/* basic algorithm is:
+#line 2921
* - ensure sane alignment of output data
+#line 2921
* - copy (conversion happens automatically) input data
+#line 2921
* to output
+#line 2921
* - update tp to point at next unconverted input, and xpp to point
+#line 2921
* at next location for converted output
+#line 2921
*/
+#line 2921
long i, j, ni;
+#line 2921
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2921
int *xp;
+#line 2921
int nrange = 0; /* number of range errors */
+#line 2921
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2921
long cxp = (long) *((char**)xpp);
+#line 2921
+#line 2921
realign = (cxp & 7) % SIZEOF_INT;
+#line 2921
/* sjl: manually stripmine so we can limit amount of
+#line 2921
* vector work space reserved to LOOPCNT elements. Also
+#line 2921
* makes vectorisation easy */
+#line 2921
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2921
ni=Min(nelems-j,LOOPCNT);
+#line 2921
if (realign) {
+#line 2921
xp = tmp;
+#line 2921
} else {
+#line 2921
xp = (int *) *xpp;
+#line 2921
}
+#line 2921
/* copy the next block */
+#line 2921
#pragma cdir loopcnt=LOOPCNT
+#line 2921
#pragma cdir shortloop
+#line 2921
for (i=0; i<ni; i++) {
+#line 2921
/* the normal case: */
+#line 2921
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2921
/* test for range errors (not always needed but do it anyway) */
+#line 2921
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2921
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2921
nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
+#line 2921
}
+#line 2921
/* copy workspace back if necessary */
+#line 2921
if (realign) {
+#line 2921
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2921
xp = (int *) *xpp;
+#line 2921
}
+#line 2921
/* update xpp and tp */
+#line 2921
xp += ni;
+#line 2921
tp += ni;
+#line 2921
*xpp = (void*)xp;
+#line 2921
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2921
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2921
+#line 2921
#else /* not SX */
+#line 2921
+#line 2921
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2921
+ int status = NC_NOERR;
+#line 2921
+#line 2921
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2921
{
+#line 2921
int lstatus = ncx_put_int_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2921
+ if(lstatus != NC_NOERR)
+#line 2921
status = lstatus;
+#line 2921
}
+#line 2921
+#line 2921
*xpp = (void *)xp;
+#line 2921
return status;
+#line 2921
#endif
+#line 2921
}
+#line 2921
int
+#line 2922
ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2922
{
+#line 2922
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2922
+#line 2922
/* basic algorithm is:
+#line 2922
* - ensure sane alignment of output data
+#line 2922
* - copy (conversion happens automatically) input data
+#line 2922
* to output
+#line 2922
* - update tp to point at next unconverted input, and xpp to point
+#line 2922
* at next location for converted output
+#line 2922
*/
+#line 2922
long i, j, ni;
+#line 2922
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2922
int *xp;
+#line 2922
int nrange = 0; /* number of range errors */
+#line 2922
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2922
long cxp = (long) *((char**)xpp);
+#line 2922
+#line 2922
realign = (cxp & 7) % SIZEOF_INT;
+#line 2922
/* sjl: manually stripmine so we can limit amount of
+#line 2922
* vector work space reserved to LOOPCNT elements. Also
+#line 2922
* makes vectorisation easy */
+#line 2922
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2922
ni=Min(nelems-j,LOOPCNT);
+#line 2922
if (realign) {
+#line 2922
xp = tmp;
+#line 2922
} else {
+#line 2922
xp = (int *) *xpp;
+#line 2922
}
+#line 2922
/* copy the next block */
+#line 2922
#pragma cdir loopcnt=LOOPCNT
+#line 2922
#pragma cdir shortloop
+#line 2922
for (i=0; i<ni; i++) {
+#line 2922
/* the normal case: */
+#line 2922
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2922
/* test for range errors (not always needed but do it anyway) */
+#line 2922
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2922
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2922
nrange += tp[i] > X_INT_MAX ;
+#line 2922
}
+#line 2922
/* copy workspace back if necessary */
+#line 2922
if (realign) {
+#line 2922
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2922
xp = (int *) *xpp;
+#line 2922
}
+#line 2922
/* update xpp and tp */
+#line 2922
xp += ni;
+#line 2922
tp += ni;
+#line 2922
*xpp = (void*)xp;
+#line 2922
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2922
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2922
+#line 2922
#else /* not SX */
+#line 2922
+#line 2922
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2922
+ int status = NC_NOERR;
+#line 2922
+#line 2922
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2922
{
+#line 2922
int lstatus = ncx_put_int_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2922
+ if(lstatus != NC_NOERR)
+#line 2922
status = lstatus;
+#line 2922
}
+#line 2922
+#line 2922
*xpp = (void *)xp;
+#line 2922
return status;
+#line 2922
#endif
+#line 2922
}
+#line 2922
int
+#line 2923
ncx_putn_int_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2923
{
+#line 2923
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2923
+#line 2923
/* basic algorithm is:
+#line 2923
* - ensure sane alignment of output data
+#line 2923
* - copy (conversion happens automatically) input data
+#line 2923
* to output
+#line 2923
* - update tp to point at next unconverted input, and xpp to point
+#line 2923
* at next location for converted output
+#line 2923
*/
+#line 2923
long i, j, ni;
+#line 2923
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2923
int *xp;
+#line 2923
int nrange = 0; /* number of range errors */
+#line 2923
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2923
long cxp = (long) *((char**)xpp);
+#line 2923
+#line 2923
realign = (cxp & 7) % SIZEOF_INT;
+#line 2923
/* sjl: manually stripmine so we can limit amount of
+#line 2923
* vector work space reserved to LOOPCNT elements. Also
+#line 2923
* makes vectorisation easy */
+#line 2923
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2923
ni=Min(nelems-j,LOOPCNT);
+#line 2923
if (realign) {
+#line 2923
xp = tmp;
+#line 2923
} else {
+#line 2923
xp = (int *) *xpp;
+#line 2923
}
+#line 2923
/* copy the next block */
+#line 2923
#pragma cdir loopcnt=LOOPCNT
+#line 2923
#pragma cdir shortloop
+#line 2923
for (i=0; i<ni; i++) {
+#line 2923
/* the normal case: */
+#line 2923
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2923
/* test for range errors (not always needed but do it anyway) */
+#line 2923
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2923
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2923
nrange += tp[i] > X_INT_MAX ;
+#line 2923
}
+#line 2923
/* copy workspace back if necessary */
+#line 2923
if (realign) {
+#line 2923
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2923
xp = (int *) *xpp;
+#line 2923
}
+#line 2923
/* update xpp and tp */
+#line 2923
xp += ni;
+#line 2923
tp += ni;
+#line 2923
*xpp = (void*)xp;
+#line 2923
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2923
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2923
+#line 2923
#else /* not SX */
+#line 2923
+#line 2923
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2923
+ int status = NC_NOERR;
+#line 2923
+#line 2923
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2923
{
+#line 2923
int lstatus = ncx_put_int_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2923
+ if(lstatus != NC_NOERR)
+#line 2923
status = lstatus;
+#line 2923
}
+#line 2923
+#line 2923
*xpp = (void *)xp;
+#line 2923
return status;
+#line 2923
#endif
+#line 2923
}
+#line 2923
int
+#line 2924
ncx_putn_int_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2924
{
+#line 2924
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2924
+#line 2924
/* basic algorithm is:
+#line 2924
* - ensure sane alignment of output data
+#line 2924
* - copy (conversion happens automatically) input data
+#line 2924
* to output
+#line 2924
* - update tp to point at next unconverted input, and xpp to point
+#line 2924
* at next location for converted output
+#line 2924
*/
+#line 2924
long i, j, ni;
+#line 2924
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2924
int *xp;
+#line 2924
int nrange = 0; /* number of range errors */
+#line 2924
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2924
long cxp = (long) *((char**)xpp);
+#line 2924
+#line 2924
realign = (cxp & 7) % SIZEOF_INT;
+#line 2924
/* sjl: manually stripmine so we can limit amount of
+#line 2924
* vector work space reserved to LOOPCNT elements. Also
+#line 2924
* makes vectorisation easy */
+#line 2924
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2924
ni=Min(nelems-j,LOOPCNT);
+#line 2924
if (realign) {
+#line 2924
xp = tmp;
+#line 2924
} else {
+#line 2924
xp = (int *) *xpp;
+#line 2924
}
+#line 2924
/* copy the next block */
+#line 2924
#pragma cdir loopcnt=LOOPCNT
+#line 2924
#pragma cdir shortloop
+#line 2924
for (i=0; i<ni; i++) {
+#line 2924
/* the normal case: */
+#line 2924
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2924
/* test for range errors (not always needed but do it anyway) */
+#line 2924
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2924
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2924
nrange += tp[i] > X_INT_MAX ;
+#line 2924
}
+#line 2924
/* copy workspace back if necessary */
+#line 2924
if (realign) {
+#line 2924
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2924
xp = (int *) *xpp;
+#line 2924
}
+#line 2924
/* update xpp and tp */
+#line 2924
xp += ni;
+#line 2924
tp += ni;
+#line 2924
*xpp = (void*)xp;
+#line 2924
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2924
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2924
+#line 2924
#else /* not SX */
+#line 2924
+#line 2924
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2924
+ int status = NC_NOERR;
+#line 2924
+#line 2924
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2924
{
+#line 2924
int lstatus = ncx_put_int_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2924
+ if(lstatus != NC_NOERR)
+#line 2924
status = lstatus;
+#line 2924
}
+#line 2924
+#line 2924
*xpp = (void *)xp;
+#line 2924
return status;
+#line 2924
#endif
+#line 2924
}
+#line 2924
int
+#line 2925
ncx_putn_int_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2925
{
+#line 2925
#if _SX && X_SIZEOF_INT == SIZEOF_INT
+#line 2925
+#line 2925
/* basic algorithm is:
+#line 2925
* - ensure sane alignment of output data
+#line 2925
* - copy (conversion happens automatically) input data
+#line 2925
* to output
+#line 2925
* - update tp to point at next unconverted input, and xpp to point
+#line 2925
* at next location for converted output
+#line 2925
*/
+#line 2925
long i, j, ni;
+#line 2925
int tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2925
int *xp;
+#line 2925
int nrange = 0; /* number of range errors */
+#line 2925
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2925
long cxp = (long) *((char**)xpp);
+#line 2925
+#line 2925
realign = (cxp & 7) % SIZEOF_INT;
+#line 2925
/* sjl: manually stripmine so we can limit amount of
+#line 2925
* vector work space reserved to LOOPCNT elements. Also
+#line 2925
* makes vectorisation easy */
+#line 2925
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2925
ni=Min(nelems-j,LOOPCNT);
+#line 2925
if (realign) {
+#line 2925
xp = tmp;
+#line 2925
} else {
+#line 2925
xp = (int *) *xpp;
+#line 2925
}
+#line 2925
/* copy the next block */
+#line 2925
#pragma cdir loopcnt=LOOPCNT
+#line 2925
#pragma cdir shortloop
+#line 2925
for (i=0; i<ni; i++) {
+#line 2925
/* the normal case: */
+#line 2925
xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
+#line 2925
/* test for range errors (not always needed but do it anyway) */
+#line 2925
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2925
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2925
nrange += tp[i] > X_INT_MAX ;
+#line 2925
}
+#line 2925
/* copy workspace back if necessary */
+#line 2925
if (realign) {
+#line 2925
memcpy(*xpp, tmp, ni*X_SIZEOF_INT);
+#line 2925
xp = (int *) *xpp;
+#line 2925
}
+#line 2925
/* update xpp and tp */
+#line 2925
xp += ni;
+#line 2925
tp += ni;
+#line 2925
*xpp = (void*)xp;
+#line 2925
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2925
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2925
+#line 2925
#else /* not SX */
+#line 2925
+#line 2925
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2925
+ int status = NC_NOERR;
+#line 2925
+#line 2925
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
+#line 2925
{
+#line 2925
int lstatus = ncx_put_int_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2925
+ if(lstatus != NC_NOERR)
+#line 2925
status = lstatus;
+#line 2925
}
+#line 2925
+#line 2925
*xpp = (void *)xp;
+#line 2925
return status;
+#line 2925
#endif
+#line 2925
}
+#line 2925
/* uint ----------------------------------------------------------------------*/
@@ -10270,659 +18545,1299 @@ ncx_getn_uint_uint(const void **xpp, size_t nelems, unsigned int *tp)
swapn4b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_UINT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2943
ncx_getn_uint_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2943
{
+#line 2943
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2943
+#line 2943
/* basic algorithm is:
+#line 2943
* - ensure sane alignment of input data
+#line 2943
* - copy (conversion happens automatically) input data
+#line 2943
* to output
+#line 2943
* - update xpp to point at next unconverted input, and tp to point
+#line 2943
* at next location for converted output
+#line 2943
*/
+#line 2943
long i, j, ni;
+#line 2943
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2943
uint *xp;
+#line 2943
int nrange = 0; /* number of range errors */
+#line 2943
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2943
long cxp = (long) *((char**)xpp);
+#line 2943
+#line 2943
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2943
/* sjl: manually stripmine so we can limit amount of
+#line 2943
* vector work space reserved to LOOPCNT elements. Also
+#line 2943
* makes vectorisation easy */
+#line 2943
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2943
ni=Min(nelems-j,LOOPCNT);
+#line 2943
if (realign) {
+#line 2943
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2943
xp = tmp;
+#line 2943
} else {
+#line 2943
xp = (uint *) *xpp;
+#line 2943
}
+#line 2943
/* copy the next block */
+#line 2943
#pragma cdir loopcnt=LOOPCNT
+#line 2943
#pragma cdir shortloop
+#line 2943
for (i=0; i<ni; i++) {
+#line 2943
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 2943
/* test for range errors (not always needed but do it anyway) */
+#line 2943
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2943
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2943
nrange += xp[i] > UINT_MAX ;
+#line 2943
}
+#line 2943
/* update xpp and tp */
+#line 2943
if (realign) xp = (uint *) *xpp;
+#line 2943
xp += ni;
+#line 2943
tp += ni;
+#line 2943
*xpp = (void*)xp;
+#line 2943
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2943
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2943
+#line 2943
#else /* not SX */
+#line 2943
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2943
+ int status = NC_NOERR;
+#line 2943
+#line 2943
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2943
{
+#line 2943
const int lstatus = ncx_get_uint_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2943
+ if(lstatus != NC_NOERR)
+#line 2943
status = lstatus;
+#line 2943
}
+#line 2943
+#line 2943
*xpp = (const void *)xp;
+#line 2943
return status;
+#line 2943
# endif
+#line 2943
}
+#line 2943
#endif
int
+#line 2945
ncx_getn_uint_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2945
{
+#line 2945
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2945
+#line 2945
/* basic algorithm is:
+#line 2945
* - ensure sane alignment of input data
+#line 2945
* - copy (conversion happens automatically) input data
+#line 2945
* to output
+#line 2945
* - update xpp to point at next unconverted input, and tp to point
+#line 2945
* at next location for converted output
+#line 2945
*/
+#line 2945
long i, j, ni;
+#line 2945
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2945
uint *xp;
+#line 2945
int nrange = 0; /* number of range errors */
+#line 2945
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2945
long cxp = (long) *((char**)xpp);
+#line 2945
+#line 2945
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2945
/* sjl: manually stripmine so we can limit amount of
+#line 2945
* vector work space reserved to LOOPCNT elements. Also
+#line 2945
* makes vectorisation easy */
+#line 2945
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2945
ni=Min(nelems-j,LOOPCNT);
+#line 2945
if (realign) {
+#line 2945
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2945
xp = tmp;
+#line 2945
} else {
+#line 2945
xp = (uint *) *xpp;
+#line 2945
}
+#line 2945
/* copy the next block */
+#line 2945
#pragma cdir loopcnt=LOOPCNT
+#line 2945
#pragma cdir shortloop
+#line 2945
for (i=0; i<ni; i++) {
+#line 2945
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 2945
/* test for range errors (not always needed but do it anyway) */
+#line 2945
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2945
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2945
nrange += xp[i] > SCHAR_MAX ;
+#line 2945
}
+#line 2945
/* update xpp and tp */
+#line 2945
if (realign) xp = (uint *) *xpp;
+#line 2945
xp += ni;
+#line 2945
tp += ni;
+#line 2945
*xpp = (void*)xp;
+#line 2945
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2945
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2945
+#line 2945
#else /* not SX */
+#line 2945
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2945
+ int status = NC_NOERR;
+#line 2945
+#line 2945
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2945
{
+#line 2945
const int lstatus = ncx_get_uint_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2945
+ if(lstatus != NC_NOERR)
+#line 2945
status = lstatus;
+#line 2945
}
+#line 2945
+#line 2945
*xpp = (const void *)xp;
+#line 2945
return status;
+#line 2945
# endif
+#line 2945
}
+#line 2945
int
+#line 2946
ncx_getn_uint_short(const void **xpp, size_t nelems, short *tp)
+#line 2946
{
+#line 2946
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2946
+#line 2946
/* basic algorithm is:
+#line 2946
* - ensure sane alignment of input data
+#line 2946
* - copy (conversion happens automatically) input data
+#line 2946
* to output
+#line 2946
* - update xpp to point at next unconverted input, and tp to point
+#line 2946
* at next location for converted output
+#line 2946
*/
+#line 2946
long i, j, ni;
+#line 2946
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2946
uint *xp;
+#line 2946
int nrange = 0; /* number of range errors */
+#line 2946
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2946
long cxp = (long) *((char**)xpp);
+#line 2946
+#line 2946
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2946
/* sjl: manually stripmine so we can limit amount of
+#line 2946
* vector work space reserved to LOOPCNT elements. Also
+#line 2946
* makes vectorisation easy */
+#line 2946
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2946
ni=Min(nelems-j,LOOPCNT);
+#line 2946
if (realign) {
+#line 2946
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2946
xp = tmp;
+#line 2946
} else {
+#line 2946
xp = (uint *) *xpp;
+#line 2946
}
+#line 2946
/* copy the next block */
+#line 2946
#pragma cdir loopcnt=LOOPCNT
+#line 2946
#pragma cdir shortloop
+#line 2946
for (i=0; i<ni; i++) {
+#line 2946
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 2946
/* test for range errors (not always needed but do it anyway) */
+#line 2946
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2946
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2946
nrange += xp[i] > SHORT_MAX ;
+#line 2946
}
+#line 2946
/* update xpp and tp */
+#line 2946
if (realign) xp = (uint *) *xpp;
+#line 2946
xp += ni;
+#line 2946
tp += ni;
+#line 2946
*xpp = (void*)xp;
+#line 2946
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2946
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2946
+#line 2946
#else /* not SX */
+#line 2946
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2946
+ int status = NC_NOERR;
+#line 2946
+#line 2946
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2946
{
+#line 2946
const int lstatus = ncx_get_uint_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2946
+ if(lstatus != NC_NOERR)
+#line 2946
status = lstatus;
+#line 2946
}
+#line 2946
+#line 2946
*xpp = (const void *)xp;
+#line 2946
return status;
+#line 2946
# endif
+#line 2946
}
+#line 2946
int
+#line 2947
ncx_getn_uint_int(const void **xpp, size_t nelems, int *tp)
+#line 2947
{
+#line 2947
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2947
+#line 2947
/* basic algorithm is:
+#line 2947
* - ensure sane alignment of input data
+#line 2947
* - copy (conversion happens automatically) input data
+#line 2947
* to output
+#line 2947
* - update xpp to point at next unconverted input, and tp to point
+#line 2947
* at next location for converted output
+#line 2947
*/
+#line 2947
long i, j, ni;
+#line 2947
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2947
uint *xp;
+#line 2947
int nrange = 0; /* number of range errors */
+#line 2947
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2947
long cxp = (long) *((char**)xpp);
+#line 2947
+#line 2947
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2947
/* sjl: manually stripmine so we can limit amount of
+#line 2947
* vector work space reserved to LOOPCNT elements. Also
+#line 2947
* makes vectorisation easy */
+#line 2947
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2947
ni=Min(nelems-j,LOOPCNT);
+#line 2947
if (realign) {
+#line 2947
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2947
xp = tmp;
+#line 2947
} else {
+#line 2947
xp = (uint *) *xpp;
+#line 2947
}
+#line 2947
/* copy the next block */
+#line 2947
#pragma cdir loopcnt=LOOPCNT
+#line 2947
#pragma cdir shortloop
+#line 2947
for (i=0; i<ni; i++) {
+#line 2947
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 2947
/* test for range errors (not always needed but do it anyway) */
+#line 2947
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2947
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2947
nrange += xp[i] > INT_MAX ;
+#line 2947
}
+#line 2947
/* update xpp and tp */
+#line 2947
if (realign) xp = (uint *) *xpp;
+#line 2947
xp += ni;
+#line 2947
tp += ni;
+#line 2947
*xpp = (void*)xp;
+#line 2947
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2947
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2947
+#line 2947
#else /* not SX */
+#line 2947
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2947
+ int status = NC_NOERR;
+#line 2947
+#line 2947
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2947
{
+#line 2947
const int lstatus = ncx_get_uint_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2947
+ if(lstatus != NC_NOERR)
+#line 2947
status = lstatus;
+#line 2947
}
+#line 2947
+#line 2947
*xpp = (const void *)xp;
+#line 2947
return status;
+#line 2947
# endif
+#line 2947
}
+#line 2947
int
+#line 2948
ncx_getn_uint_float(const void **xpp, size_t nelems, float *tp)
+#line 2948
{
+#line 2948
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2948
+#line 2948
/* basic algorithm is:
+#line 2948
* - ensure sane alignment of input data
+#line 2948
* - copy (conversion happens automatically) input data
+#line 2948
* to output
+#line 2948
* - update xpp to point at next unconverted input, and tp to point
+#line 2948
* at next location for converted output
+#line 2948
*/
+#line 2948
long i, j, ni;
+#line 2948
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2948
uint *xp;
+#line 2948
int nrange = 0; /* number of range errors */
+#line 2948
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2948
long cxp = (long) *((char**)xpp);
+#line 2948
+#line 2948
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2948
/* sjl: manually stripmine so we can limit amount of
+#line 2948
* vector work space reserved to LOOPCNT elements. Also
+#line 2948
* makes vectorisation easy */
+#line 2948
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2948
ni=Min(nelems-j,LOOPCNT);
+#line 2948
if (realign) {
+#line 2948
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2948
xp = tmp;
+#line 2948
} else {
+#line 2948
xp = (uint *) *xpp;
+#line 2948
}
+#line 2948
/* copy the next block */
+#line 2948
#pragma cdir loopcnt=LOOPCNT
+#line 2948
#pragma cdir shortloop
+#line 2948
for (i=0; i<ni; i++) {
+#line 2948
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 2948
/* test for range errors (not always needed but do it anyway) */
+#line 2948
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2948
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2948
nrange += xp[i] > FLOAT_MAX ;
+#line 2948
}
+#line 2948
/* update xpp and tp */
+#line 2948
if (realign) xp = (uint *) *xpp;
+#line 2948
xp += ni;
+#line 2948
tp += ni;
+#line 2948
*xpp = (void*)xp;
+#line 2948
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2948
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2948
+#line 2948
#else /* not SX */
+#line 2948
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2948
+ int status = NC_NOERR;
+#line 2948
+#line 2948
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2948
{
+#line 2948
const int lstatus = ncx_get_uint_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2948
+ if(lstatus != NC_NOERR)
+#line 2948
status = lstatus;
+#line 2948
}
+#line 2948
+#line 2948
*xpp = (const void *)xp;
+#line 2948
return status;
+#line 2948
# endif
+#line 2948
}
+#line 2948
int
+#line 2949
ncx_getn_uint_double(const void **xpp, size_t nelems, double *tp)
+#line 2949
{
+#line 2949
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2949
+#line 2949
/* basic algorithm is:
+#line 2949
* - ensure sane alignment of input data
+#line 2949
* - copy (conversion happens automatically) input data
+#line 2949
* to output
+#line 2949
* - update xpp to point at next unconverted input, and tp to point
+#line 2949
* at next location for converted output
+#line 2949
*/
+#line 2949
long i, j, ni;
+#line 2949
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2949
uint *xp;
+#line 2949
int nrange = 0; /* number of range errors */
+#line 2949
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2949
long cxp = (long) *((char**)xpp);
+#line 2949
+#line 2949
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2949
/* sjl: manually stripmine so we can limit amount of
+#line 2949
* vector work space reserved to LOOPCNT elements. Also
+#line 2949
* makes vectorisation easy */
+#line 2949
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2949
ni=Min(nelems-j,LOOPCNT);
+#line 2949
if (realign) {
+#line 2949
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2949
xp = tmp;
+#line 2949
} else {
+#line 2949
xp = (uint *) *xpp;
+#line 2949
}
+#line 2949
/* copy the next block */
+#line 2949
#pragma cdir loopcnt=LOOPCNT
+#line 2949
#pragma cdir shortloop
+#line 2949
for (i=0; i<ni; i++) {
+#line 2949
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 2949
/* test for range errors (not always needed but do it anyway) */
+#line 2949
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2949
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2949
nrange += xp[i] > DOUBLE_MAX ;
+#line 2949
}
+#line 2949
/* update xpp and tp */
+#line 2949
if (realign) xp = (uint *) *xpp;
+#line 2949
xp += ni;
+#line 2949
tp += ni;
+#line 2949
*xpp = (void*)xp;
+#line 2949
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2949
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2949
+#line 2949
#else /* not SX */
+#line 2949
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2949
+ int status = NC_NOERR;
+#line 2949
+#line 2949
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2949
{
+#line 2949
const int lstatus = ncx_get_uint_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2949
+ if(lstatus != NC_NOERR)
+#line 2949
status = lstatus;
+#line 2949
}
+#line 2949
+#line 2949
*xpp = (const void *)xp;
+#line 2949
return status;
+#line 2949
# endif
+#line 2949
}
+#line 2949
int
+#line 2950
ncx_getn_uint_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2950
{
+#line 2950
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2950
+#line 2950
/* basic algorithm is:
+#line 2950
* - ensure sane alignment of input data
+#line 2950
* - copy (conversion happens automatically) input data
+#line 2950
* to output
+#line 2950
* - update xpp to point at next unconverted input, and tp to point
+#line 2950
* at next location for converted output
+#line 2950
*/
+#line 2950
long i, j, ni;
+#line 2950
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2950
uint *xp;
+#line 2950
int nrange = 0; /* number of range errors */
+#line 2950
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2950
long cxp = (long) *((char**)xpp);
+#line 2950
+#line 2950
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2950
/* sjl: manually stripmine so we can limit amount of
+#line 2950
* vector work space reserved to LOOPCNT elements. Also
+#line 2950
* makes vectorisation easy */
+#line 2950
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2950
ni=Min(nelems-j,LOOPCNT);
+#line 2950
if (realign) {
+#line 2950
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2950
xp = tmp;
+#line 2950
} else {
+#line 2950
xp = (uint *) *xpp;
+#line 2950
}
+#line 2950
/* copy the next block */
+#line 2950
#pragma cdir loopcnt=LOOPCNT
+#line 2950
#pragma cdir shortloop
+#line 2950
for (i=0; i<ni; i++) {
+#line 2950
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 2950
/* test for range errors (not always needed but do it anyway) */
+#line 2950
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2950
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2950
nrange += xp[i] > LONGLONG_MAX ;
+#line 2950
}
+#line 2950
/* update xpp and tp */
+#line 2950
if (realign) xp = (uint *) *xpp;
+#line 2950
xp += ni;
+#line 2950
tp += ni;
+#line 2950
*xpp = (void*)xp;
+#line 2950
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2950
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2950
+#line 2950
#else /* not SX */
+#line 2950
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2950
+ int status = NC_NOERR;
+#line 2950
+#line 2950
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2950
{
+#line 2950
const int lstatus = ncx_get_uint_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2950
+ if(lstatus != NC_NOERR)
+#line 2950
status = lstatus;
+#line 2950
}
+#line 2950
+#line 2950
*xpp = (const void *)xp;
+#line 2950
return status;
+#line 2950
# endif
+#line 2950
}
+#line 2950
int
+#line 2951
ncx_getn_uint_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 2951
{
+#line 2951
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2951
+#line 2951
/* basic algorithm is:
+#line 2951
* - ensure sane alignment of input data
+#line 2951
* - copy (conversion happens automatically) input data
+#line 2951
* to output
+#line 2951
* - update xpp to point at next unconverted input, and tp to point
+#line 2951
* at next location for converted output
+#line 2951
*/
+#line 2951
long i, j, ni;
+#line 2951
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2951
uint *xp;
+#line 2951
int nrange = 0; /* number of range errors */
+#line 2951
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2951
long cxp = (long) *((char**)xpp);
+#line 2951
+#line 2951
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2951
/* sjl: manually stripmine so we can limit amount of
+#line 2951
* vector work space reserved to LOOPCNT elements. Also
+#line 2951
* makes vectorisation easy */
+#line 2951
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2951
ni=Min(nelems-j,LOOPCNT);
+#line 2951
if (realign) {
+#line 2951
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2951
xp = tmp;
+#line 2951
} else {
+#line 2951
xp = (uint *) *xpp;
+#line 2951
}
+#line 2951
/* copy the next block */
+#line 2951
#pragma cdir loopcnt=LOOPCNT
+#line 2951
#pragma cdir shortloop
+#line 2951
for (i=0; i<ni; i++) {
+#line 2951
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 2951
/* test for range errors (not always needed but do it anyway) */
+#line 2951
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2951
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2951
nrange += xp[i] > UCHAR_MAX ;
+#line 2951
}
+#line 2951
/* update xpp and tp */
+#line 2951
if (realign) xp = (uint *) *xpp;
+#line 2951
xp += ni;
+#line 2951
tp += ni;
+#line 2951
*xpp = (void*)xp;
+#line 2951
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2951
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2951
+#line 2951
#else /* not SX */
+#line 2951
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2951
+ int status = NC_NOERR;
+#line 2951
+#line 2951
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2951
{
+#line 2951
const int lstatus = ncx_get_uint_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2951
+ if(lstatus != NC_NOERR)
+#line 2951
status = lstatus;
+#line 2951
}
+#line 2951
+#line 2951
*xpp = (const void *)xp;
+#line 2951
return status;
+#line 2951
# endif
+#line 2951
}
+#line 2951
int
+#line 2952
ncx_getn_uint_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2952
{
+#line 2952
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2952
+#line 2952
/* basic algorithm is:
+#line 2952
* - ensure sane alignment of input data
+#line 2952
* - copy (conversion happens automatically) input data
+#line 2952
* to output
+#line 2952
* - update xpp to point at next unconverted input, and tp to point
+#line 2952
* at next location for converted output
+#line 2952
*/
+#line 2952
long i, j, ni;
+#line 2952
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2952
uint *xp;
+#line 2952
int nrange = 0; /* number of range errors */
+#line 2952
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2952
long cxp = (long) *((char**)xpp);
+#line 2952
+#line 2952
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2952
/* sjl: manually stripmine so we can limit amount of
+#line 2952
* vector work space reserved to LOOPCNT elements. Also
+#line 2952
* makes vectorisation easy */
+#line 2952
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2952
ni=Min(nelems-j,LOOPCNT);
+#line 2952
if (realign) {
+#line 2952
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2952
xp = tmp;
+#line 2952
} else {
+#line 2952
xp = (uint *) *xpp;
+#line 2952
}
+#line 2952
/* copy the next block */
+#line 2952
#pragma cdir loopcnt=LOOPCNT
+#line 2952
#pragma cdir shortloop
+#line 2952
for (i=0; i<ni; i++) {
+#line 2952
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 2952
/* test for range errors (not always needed but do it anyway) */
+#line 2952
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2952
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2952
nrange += xp[i] > USHORT_MAX ;
+#line 2952
}
+#line 2952
/* update xpp and tp */
+#line 2952
if (realign) xp = (uint *) *xpp;
+#line 2952
xp += ni;
+#line 2952
tp += ni;
+#line 2952
*xpp = (void*)xp;
+#line 2952
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2952
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2952
+#line 2952
#else /* not SX */
+#line 2952
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2952
+ int status = NC_NOERR;
+#line 2952
+#line 2952
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2952
{
+#line 2952
const int lstatus = ncx_get_uint_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2952
+ if(lstatus != NC_NOERR)
+#line 2952
status = lstatus;
+#line 2952
}
+#line 2952
+#line 2952
*xpp = (const void *)xp;
+#line 2952
return status;
+#line 2952
# endif
+#line 2952
}
+#line 2952
int
+#line 2953
ncx_getn_uint_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2953
{
+#line 2953
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2953
+#line 2953
/* basic algorithm is:
+#line 2953
* - ensure sane alignment of input data
+#line 2953
* - copy (conversion happens automatically) input data
+#line 2953
* to output
+#line 2953
* - update xpp to point at next unconverted input, and tp to point
+#line 2953
* at next location for converted output
+#line 2953
*/
+#line 2953
long i, j, ni;
+#line 2953
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2953
uint *xp;
+#line 2953
int nrange = 0; /* number of range errors */
+#line 2953
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2953
long cxp = (long) *((char**)xpp);
+#line 2953
+#line 2953
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2953
/* sjl: manually stripmine so we can limit amount of
+#line 2953
* vector work space reserved to LOOPCNT elements. Also
+#line 2953
* makes vectorisation easy */
+#line 2953
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2953
ni=Min(nelems-j,LOOPCNT);
+#line 2953
if (realign) {
+#line 2953
memcpy(tmp, *xpp, ni*SIZEOF_UINT);
+#line 2953
xp = tmp;
+#line 2953
} else {
+#line 2953
xp = (uint *) *xpp;
+#line 2953
}
+#line 2953
/* copy the next block */
+#line 2953
#pragma cdir loopcnt=LOOPCNT
+#line 2953
#pragma cdir shortloop
+#line 2953
for (i=0; i<ni; i++) {
+#line 2953
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 2953
/* test for range errors (not always needed but do it anyway) */
+#line 2953
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 2953
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 2953
nrange += xp[i] > ULONGLONG_MAX ;
+#line 2953
}
+#line 2953
/* update xpp and tp */
+#line 2953
if (realign) xp = (uint *) *xpp;
+#line 2953
xp += ni;
+#line 2953
tp += ni;
+#line 2953
*xpp = (void*)xp;
+#line 2953
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2953
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2953
+#line 2953
#else /* not SX */
+#line 2953
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 2953
+ int status = NC_NOERR;
+#line 2953
+#line 2953
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2953
{
+#line 2953
const int lstatus = ncx_get_uint_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2953
+ if(lstatus != NC_NOERR)
+#line 2953
status = lstatus;
+#line 2953
}
+#line 2953
+#line 2953
*xpp = (const void *)xp;
+#line 2953
return status;
+#line 2953
# endif
+#line 2953
}
+#line 2953
#if X_SIZEOF_UINT == SIZEOF_UINT
@@ -10936,709 +19851,1399 @@ ncx_putn_uint_uint(void **xpp, size_t nelems, const unsigned int *tp)
swapn4b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_UINT);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 2969
ncx_putn_uint_uint(void **xpp, size_t nelems, const uint *tp)
+#line 2969
{
+#line 2969
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2969
+#line 2969
/* basic algorithm is:
+#line 2969
* - ensure sane alignment of output data
+#line 2969
* - copy (conversion happens automatically) input data
+#line 2969
* to output
+#line 2969
* - update tp to point at next unconverted input, and xpp to point
+#line 2969
* at next location for converted output
+#line 2969
*/
+#line 2969
long i, j, ni;
+#line 2969
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2969
uint *xp;
+#line 2969
int nrange = 0; /* number of range errors */
+#line 2969
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2969
long cxp = (long) *((char**)xpp);
+#line 2969
+#line 2969
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2969
/* sjl: manually stripmine so we can limit amount of
+#line 2969
* vector work space reserved to LOOPCNT elements. Also
+#line 2969
* makes vectorisation easy */
+#line 2969
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2969
ni=Min(nelems-j,LOOPCNT);
+#line 2969
if (realign) {
+#line 2969
xp = tmp;
+#line 2969
} else {
+#line 2969
xp = (uint *) *xpp;
+#line 2969
}
+#line 2969
/* copy the next block */
+#line 2969
#pragma cdir loopcnt=LOOPCNT
+#line 2969
#pragma cdir shortloop
+#line 2969
for (i=0; i<ni; i++) {
+#line 2969
/* the normal case: */
+#line 2969
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2969
/* test for range errors (not always needed but do it anyway) */
+#line 2969
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2969
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2969
nrange += tp[i] > X_UINT_MAX ;
+#line 2969
}
+#line 2969
/* copy workspace back if necessary */
+#line 2969
if (realign) {
+#line 2969
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2969
xp = (uint *) *xpp;
+#line 2969
}
+#line 2969
/* update xpp and tp */
+#line 2969
xp += ni;
+#line 2969
tp += ni;
+#line 2969
*xpp = (void*)xp;
+#line 2969
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2969
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2969
+#line 2969
#else /* not SX */
+#line 2969
+#line 2969
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2969
+ int status = NC_NOERR;
+#line 2969
+#line 2969
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2969
{
+#line 2969
int lstatus = ncx_put_uint_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 2969
+ if(lstatus != NC_NOERR)
+#line 2969
status = lstatus;
+#line 2969
}
+#line 2969
+#line 2969
*xpp = (void *)xp;
+#line 2969
return status;
+#line 2969
#endif
+#line 2969
}
+#line 2969
#endif
int
+#line 2971
ncx_putn_uint_schar(void **xpp, size_t nelems, const schar *tp)
+#line 2971
{
+#line 2971
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2971
+#line 2971
/* basic algorithm is:
+#line 2971
* - ensure sane alignment of output data
+#line 2971
* - copy (conversion happens automatically) input data
+#line 2971
* to output
+#line 2971
* - update tp to point at next unconverted input, and xpp to point
+#line 2971
* at next location for converted output
+#line 2971
*/
+#line 2971
long i, j, ni;
+#line 2971
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2971
uint *xp;
+#line 2971
int nrange = 0; /* number of range errors */
+#line 2971
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2971
long cxp = (long) *((char**)xpp);
+#line 2971
+#line 2971
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2971
/* sjl: manually stripmine so we can limit amount of
+#line 2971
* vector work space reserved to LOOPCNT elements. Also
+#line 2971
* makes vectorisation easy */
+#line 2971
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2971
ni=Min(nelems-j,LOOPCNT);
+#line 2971
if (realign) {
+#line 2971
xp = tmp;
+#line 2971
} else {
+#line 2971
xp = (uint *) *xpp;
+#line 2971
}
+#line 2971
/* copy the next block */
+#line 2971
#pragma cdir loopcnt=LOOPCNT
+#line 2971
#pragma cdir shortloop
+#line 2971
for (i=0; i<ni; i++) {
+#line 2971
/* the normal case: */
+#line 2971
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2971
/* test for range errors (not always needed but do it anyway) */
+#line 2971
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2971
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2971
nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
+#line 2971
}
+#line 2971
/* copy workspace back if necessary */
+#line 2971
if (realign) {
+#line 2971
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2971
xp = (uint *) *xpp;
+#line 2971
}
+#line 2971
/* update xpp and tp */
+#line 2971
xp += ni;
+#line 2971
tp += ni;
+#line 2971
*xpp = (void*)xp;
+#line 2971
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2971
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2971
+#line 2971
#else /* not SX */
+#line 2971
+#line 2971
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2971
+ int status = NC_NOERR;
+#line 2971
+#line 2971
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2971
{
+#line 2971
int lstatus = ncx_put_uint_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 2971
+ if(lstatus != NC_NOERR)
+#line 2971
status = lstatus;
+#line 2971
}
+#line 2971
+#line 2971
*xpp = (void *)xp;
+#line 2971
return status;
+#line 2971
#endif
+#line 2971
}
+#line 2971
int
+#line 2972
ncx_putn_uint_short(void **xpp, size_t nelems, const short *tp)
+#line 2972
{
+#line 2972
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2972
+#line 2972
/* basic algorithm is:
+#line 2972
* - ensure sane alignment of output data
+#line 2972
* - copy (conversion happens automatically) input data
+#line 2972
* to output
+#line 2972
* - update tp to point at next unconverted input, and xpp to point
+#line 2972
* at next location for converted output
+#line 2972
*/
+#line 2972
long i, j, ni;
+#line 2972
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2972
uint *xp;
+#line 2972
int nrange = 0; /* number of range errors */
+#line 2972
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2972
long cxp = (long) *((char**)xpp);
+#line 2972
+#line 2972
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2972
/* sjl: manually stripmine so we can limit amount of
+#line 2972
* vector work space reserved to LOOPCNT elements. Also
+#line 2972
* makes vectorisation easy */
+#line 2972
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2972
ni=Min(nelems-j,LOOPCNT);
+#line 2972
if (realign) {
+#line 2972
xp = tmp;
+#line 2972
} else {
+#line 2972
xp = (uint *) *xpp;
+#line 2972
}
+#line 2972
/* copy the next block */
+#line 2972
#pragma cdir loopcnt=LOOPCNT
+#line 2972
#pragma cdir shortloop
+#line 2972
for (i=0; i<ni; i++) {
+#line 2972
/* the normal case: */
+#line 2972
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2972
/* test for range errors (not always needed but do it anyway) */
+#line 2972
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2972
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2972
nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
+#line 2972
}
+#line 2972
/* copy workspace back if necessary */
+#line 2972
if (realign) {
+#line 2972
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2972
xp = (uint *) *xpp;
+#line 2972
}
+#line 2972
/* update xpp and tp */
+#line 2972
xp += ni;
+#line 2972
tp += ni;
+#line 2972
*xpp = (void*)xp;
+#line 2972
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2972
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2972
+#line 2972
#else /* not SX */
+#line 2972
+#line 2972
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2972
+ int status = NC_NOERR;
+#line 2972
+#line 2972
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2972
{
+#line 2972
int lstatus = ncx_put_uint_short(xp, tp);
- if(lstatus != ENOERR)
+#line 2972
+ if(lstatus != NC_NOERR)
+#line 2972
status = lstatus;
+#line 2972
}
+#line 2972
+#line 2972
*xpp = (void *)xp;
+#line 2972
return status;
+#line 2972
#endif
+#line 2972
}
+#line 2972
int
+#line 2973
ncx_putn_uint_int(void **xpp, size_t nelems, const int *tp)
+#line 2973
{
+#line 2973
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2973
+#line 2973
/* basic algorithm is:
+#line 2973
* - ensure sane alignment of output data
+#line 2973
* - copy (conversion happens automatically) input data
+#line 2973
* to output
+#line 2973
* - update tp to point at next unconverted input, and xpp to point
+#line 2973
* at next location for converted output
+#line 2973
*/
+#line 2973
long i, j, ni;
+#line 2973
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2973
uint *xp;
+#line 2973
int nrange = 0; /* number of range errors */
+#line 2973
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2973
long cxp = (long) *((char**)xpp);
+#line 2973
+#line 2973
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2973
/* sjl: manually stripmine so we can limit amount of
+#line 2973
* vector work space reserved to LOOPCNT elements. Also
+#line 2973
* makes vectorisation easy */
+#line 2973
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2973
ni=Min(nelems-j,LOOPCNT);
+#line 2973
if (realign) {
+#line 2973
xp = tmp;
+#line 2973
} else {
+#line 2973
xp = (uint *) *xpp;
+#line 2973
}
+#line 2973
/* copy the next block */
+#line 2973
#pragma cdir loopcnt=LOOPCNT
+#line 2973
#pragma cdir shortloop
+#line 2973
for (i=0; i<ni; i++) {
+#line 2973
/* the normal case: */
+#line 2973
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2973
/* test for range errors (not always needed but do it anyway) */
+#line 2973
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2973
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2973
nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
+#line 2973
}
+#line 2973
/* copy workspace back if necessary */
+#line 2973
if (realign) {
+#line 2973
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2973
xp = (uint *) *xpp;
+#line 2973
}
+#line 2973
/* update xpp and tp */
+#line 2973
xp += ni;
+#line 2973
tp += ni;
+#line 2973
*xpp = (void*)xp;
+#line 2973
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2973
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2973
+#line 2973
#else /* not SX */
+#line 2973
+#line 2973
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2973
+ int status = NC_NOERR;
+#line 2973
+#line 2973
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2973
{
+#line 2973
int lstatus = ncx_put_uint_int(xp, tp);
- if(lstatus != ENOERR)
+#line 2973
+ if(lstatus != NC_NOERR)
+#line 2973
status = lstatus;
+#line 2973
}
+#line 2973
+#line 2973
*xpp = (void *)xp;
+#line 2973
return status;
+#line 2973
#endif
+#line 2973
}
+#line 2973
int
+#line 2974
ncx_putn_uint_float(void **xpp, size_t nelems, const float *tp)
+#line 2974
{
+#line 2974
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2974
+#line 2974
/* basic algorithm is:
+#line 2974
* - ensure sane alignment of output data
+#line 2974
* - copy (conversion happens automatically) input data
+#line 2974
* to output
+#line 2974
* - update tp to point at next unconverted input, and xpp to point
+#line 2974
* at next location for converted output
+#line 2974
*/
+#line 2974
long i, j, ni;
+#line 2974
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2974
uint *xp;
+#line 2974
int nrange = 0; /* number of range errors */
+#line 2974
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2974
long cxp = (long) *((char**)xpp);
+#line 2974
+#line 2974
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2974
/* sjl: manually stripmine so we can limit amount of
+#line 2974
* vector work space reserved to LOOPCNT elements. Also
+#line 2974
* makes vectorisation easy */
+#line 2974
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2974
ni=Min(nelems-j,LOOPCNT);
+#line 2974
if (realign) {
+#line 2974
xp = tmp;
+#line 2974
} else {
+#line 2974
xp = (uint *) *xpp;
+#line 2974
}
+#line 2974
/* copy the next block */
+#line 2974
#pragma cdir loopcnt=LOOPCNT
+#line 2974
#pragma cdir shortloop
+#line 2974
for (i=0; i<ni; i++) {
+#line 2974
/* the normal case: */
+#line 2974
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2974
/* test for range errors (not always needed but do it anyway) */
+#line 2974
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2974
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2974
nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
+#line 2974
}
+#line 2974
/* copy workspace back if necessary */
+#line 2974
if (realign) {
+#line 2974
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2974
xp = (uint *) *xpp;
+#line 2974
}
+#line 2974
/* update xpp and tp */
+#line 2974
xp += ni;
+#line 2974
tp += ni;
+#line 2974
*xpp = (void*)xp;
+#line 2974
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2974
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2974
+#line 2974
#else /* not SX */
+#line 2974
+#line 2974
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2974
+ int status = NC_NOERR;
+#line 2974
+#line 2974
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2974
{
+#line 2974
int lstatus = ncx_put_uint_float(xp, tp);
- if(lstatus != ENOERR)
+#line 2974
+ if(lstatus != NC_NOERR)
+#line 2974
status = lstatus;
+#line 2974
}
+#line 2974
+#line 2974
*xpp = (void *)xp;
+#line 2974
return status;
+#line 2974
#endif
+#line 2974
}
+#line 2974
int
+#line 2975
ncx_putn_uint_double(void **xpp, size_t nelems, const double *tp)
+#line 2975
{
+#line 2975
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2975
+#line 2975
/* basic algorithm is:
+#line 2975
* - ensure sane alignment of output data
+#line 2975
* - copy (conversion happens automatically) input data
+#line 2975
* to output
+#line 2975
* - update tp to point at next unconverted input, and xpp to point
+#line 2975
* at next location for converted output
+#line 2975
*/
+#line 2975
long i, j, ni;
+#line 2975
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2975
uint *xp;
+#line 2975
int nrange = 0; /* number of range errors */
+#line 2975
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2975
long cxp = (long) *((char**)xpp);
+#line 2975
+#line 2975
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2975
/* sjl: manually stripmine so we can limit amount of
+#line 2975
* vector work space reserved to LOOPCNT elements. Also
+#line 2975
* makes vectorisation easy */
+#line 2975
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2975
ni=Min(nelems-j,LOOPCNT);
+#line 2975
if (realign) {
+#line 2975
xp = tmp;
+#line 2975
} else {
+#line 2975
xp = (uint *) *xpp;
+#line 2975
}
+#line 2975
/* copy the next block */
+#line 2975
#pragma cdir loopcnt=LOOPCNT
+#line 2975
#pragma cdir shortloop
+#line 2975
for (i=0; i<ni; i++) {
+#line 2975
/* the normal case: */
+#line 2975
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2975
/* test for range errors (not always needed but do it anyway) */
+#line 2975
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2975
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2975
nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
+#line 2975
}
+#line 2975
/* copy workspace back if necessary */
+#line 2975
if (realign) {
+#line 2975
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2975
xp = (uint *) *xpp;
+#line 2975
}
+#line 2975
/* update xpp and tp */
+#line 2975
xp += ni;
+#line 2975
tp += ni;
+#line 2975
*xpp = (void*)xp;
+#line 2975
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2975
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2975
+#line 2975
#else /* not SX */
+#line 2975
+#line 2975
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2975
+ int status = NC_NOERR;
+#line 2975
+#line 2975
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2975
{
+#line 2975
int lstatus = ncx_put_uint_double(xp, tp);
- if(lstatus != ENOERR)
+#line 2975
+ if(lstatus != NC_NOERR)
+#line 2975
status = lstatus;
+#line 2975
}
+#line 2975
+#line 2975
*xpp = (void *)xp;
+#line 2975
return status;
+#line 2975
#endif
+#line 2975
}
+#line 2975
int
+#line 2976
ncx_putn_uint_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 2976
{
+#line 2976
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2976
+#line 2976
/* basic algorithm is:
+#line 2976
* - ensure sane alignment of output data
+#line 2976
* - copy (conversion happens automatically) input data
+#line 2976
* to output
+#line 2976
* - update tp to point at next unconverted input, and xpp to point
+#line 2976
* at next location for converted output
+#line 2976
*/
+#line 2976
long i, j, ni;
+#line 2976
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2976
uint *xp;
+#line 2976
int nrange = 0; /* number of range errors */
+#line 2976
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2976
long cxp = (long) *((char**)xpp);
+#line 2976
+#line 2976
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2976
/* sjl: manually stripmine so we can limit amount of
+#line 2976
* vector work space reserved to LOOPCNT elements. Also
+#line 2976
* makes vectorisation easy */
+#line 2976
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2976
ni=Min(nelems-j,LOOPCNT);
+#line 2976
if (realign) {
+#line 2976
xp = tmp;
+#line 2976
} else {
+#line 2976
xp = (uint *) *xpp;
+#line 2976
}
+#line 2976
/* copy the next block */
+#line 2976
#pragma cdir loopcnt=LOOPCNT
+#line 2976
#pragma cdir shortloop
+#line 2976
for (i=0; i<ni; i++) {
+#line 2976
/* the normal case: */
+#line 2976
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2976
/* test for range errors (not always needed but do it anyway) */
+#line 2976
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2976
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2976
nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
+#line 2976
}
+#line 2976
/* copy workspace back if necessary */
+#line 2976
if (realign) {
+#line 2976
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2976
xp = (uint *) *xpp;
+#line 2976
}
+#line 2976
/* update xpp and tp */
+#line 2976
xp += ni;
+#line 2976
tp += ni;
+#line 2976
*xpp = (void*)xp;
+#line 2976
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2976
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2976
+#line 2976
#else /* not SX */
+#line 2976
+#line 2976
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2976
+ int status = NC_NOERR;
+#line 2976
+#line 2976
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2976
{
+#line 2976
int lstatus = ncx_put_uint_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 2976
+ if(lstatus != NC_NOERR)
+#line 2976
status = lstatus;
+#line 2976
}
+#line 2976
+#line 2976
*xpp = (void *)xp;
+#line 2976
return status;
+#line 2976
#endif
+#line 2976
}
+#line 2976
int
+#line 2977
ncx_putn_uint_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 2977
{
+#line 2977
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2977
+#line 2977
/* basic algorithm is:
+#line 2977
* - ensure sane alignment of output data
+#line 2977
* - copy (conversion happens automatically) input data
+#line 2977
* to output
+#line 2977
* - update tp to point at next unconverted input, and xpp to point
+#line 2977
* at next location for converted output
+#line 2977
*/
+#line 2977
long i, j, ni;
+#line 2977
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2977
uint *xp;
+#line 2977
int nrange = 0; /* number of range errors */
+#line 2977
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2977
long cxp = (long) *((char**)xpp);
+#line 2977
+#line 2977
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2977
/* sjl: manually stripmine so we can limit amount of
+#line 2977
* vector work space reserved to LOOPCNT elements. Also
+#line 2977
* makes vectorisation easy */
+#line 2977
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2977
ni=Min(nelems-j,LOOPCNT);
+#line 2977
if (realign) {
+#line 2977
xp = tmp;
+#line 2977
} else {
+#line 2977
xp = (uint *) *xpp;
+#line 2977
}
+#line 2977
/* copy the next block */
+#line 2977
#pragma cdir loopcnt=LOOPCNT
+#line 2977
#pragma cdir shortloop
+#line 2977
for (i=0; i<ni; i++) {
+#line 2977
/* the normal case: */
+#line 2977
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2977
/* test for range errors (not always needed but do it anyway) */
+#line 2977
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2977
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2977
nrange += tp[i] > X_UINT_MAX ;
+#line 2977
}
+#line 2977
/* copy workspace back if necessary */
+#line 2977
if (realign) {
+#line 2977
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2977
xp = (uint *) *xpp;
+#line 2977
}
+#line 2977
/* update xpp and tp */
+#line 2977
xp += ni;
+#line 2977
tp += ni;
+#line 2977
*xpp = (void*)xp;
+#line 2977
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2977
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2977
+#line 2977
#else /* not SX */
+#line 2977
+#line 2977
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2977
+ int status = NC_NOERR;
+#line 2977
+#line 2977
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2977
{
+#line 2977
int lstatus = ncx_put_uint_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 2977
+ if(lstatus != NC_NOERR)
+#line 2977
status = lstatus;
+#line 2977
}
+#line 2977
+#line 2977
*xpp = (void *)xp;
+#line 2977
return status;
+#line 2977
#endif
+#line 2977
}
+#line 2977
int
+#line 2978
ncx_putn_uint_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 2978
{
+#line 2978
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2978
+#line 2978
/* basic algorithm is:
+#line 2978
* - ensure sane alignment of output data
+#line 2978
* - copy (conversion happens automatically) input data
+#line 2978
* to output
+#line 2978
* - update tp to point at next unconverted input, and xpp to point
+#line 2978
* at next location for converted output
+#line 2978
*/
+#line 2978
long i, j, ni;
+#line 2978
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2978
uint *xp;
+#line 2978
int nrange = 0; /* number of range errors */
+#line 2978
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2978
long cxp = (long) *((char**)xpp);
+#line 2978
+#line 2978
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2978
/* sjl: manually stripmine so we can limit amount of
+#line 2978
* vector work space reserved to LOOPCNT elements. Also
+#line 2978
* makes vectorisation easy */
+#line 2978
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2978
ni=Min(nelems-j,LOOPCNT);
+#line 2978
if (realign) {
+#line 2978
xp = tmp;
+#line 2978
} else {
+#line 2978
xp = (uint *) *xpp;
+#line 2978
}
+#line 2978
/* copy the next block */
+#line 2978
#pragma cdir loopcnt=LOOPCNT
+#line 2978
#pragma cdir shortloop
+#line 2978
for (i=0; i<ni; i++) {
+#line 2978
/* the normal case: */
+#line 2978
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2978
/* test for range errors (not always needed but do it anyway) */
+#line 2978
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2978
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2978
nrange += tp[i] > X_UINT_MAX ;
+#line 2978
}
+#line 2978
/* copy workspace back if necessary */
+#line 2978
if (realign) {
+#line 2978
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2978
xp = (uint *) *xpp;
+#line 2978
}
+#line 2978
/* update xpp and tp */
+#line 2978
xp += ni;
+#line 2978
tp += ni;
+#line 2978
*xpp = (void*)xp;
+#line 2978
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2978
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2978
+#line 2978
#else /* not SX */
+#line 2978
+#line 2978
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2978
+ int status = NC_NOERR;
+#line 2978
+#line 2978
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2978
{
+#line 2978
int lstatus = ncx_put_uint_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 2978
+ if(lstatus != NC_NOERR)
+#line 2978
status = lstatus;
+#line 2978
}
+#line 2978
+#line 2978
*xpp = (void *)xp;
+#line 2978
return status;
+#line 2978
#endif
+#line 2978
}
+#line 2978
int
+#line 2979
ncx_putn_uint_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 2979
{
+#line 2979
#if _SX && X_SIZEOF_UINT == SIZEOF_UINT
+#line 2979
+#line 2979
/* basic algorithm is:
+#line 2979
* - ensure sane alignment of output data
+#line 2979
* - copy (conversion happens automatically) input data
+#line 2979
* to output
+#line 2979
* - update tp to point at next unconverted input, and xpp to point
+#line 2979
* at next location for converted output
+#line 2979
*/
+#line 2979
long i, j, ni;
+#line 2979
uint tmp[LOOPCNT]; /* in case input is misaligned */
+#line 2979
uint *xp;
+#line 2979
int nrange = 0; /* number of range errors */
+#line 2979
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 2979
long cxp = (long) *((char**)xpp);
+#line 2979
+#line 2979
realign = (cxp & 7) % SIZEOF_UINT;
+#line 2979
/* sjl: manually stripmine so we can limit amount of
+#line 2979
* vector work space reserved to LOOPCNT elements. Also
+#line 2979
* makes vectorisation easy */
+#line 2979
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 2979
ni=Min(nelems-j,LOOPCNT);
+#line 2979
if (realign) {
+#line 2979
xp = tmp;
+#line 2979
} else {
+#line 2979
xp = (uint *) *xpp;
+#line 2979
}
+#line 2979
/* copy the next block */
+#line 2979
#pragma cdir loopcnt=LOOPCNT
+#line 2979
#pragma cdir shortloop
+#line 2979
for (i=0; i<ni; i++) {
+#line 2979
/* the normal case: */
+#line 2979
xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
+#line 2979
/* test for range errors (not always needed but do it anyway) */
+#line 2979
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 2979
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 2979
nrange += tp[i] > X_UINT_MAX ;
+#line 2979
}
+#line 2979
/* copy workspace back if necessary */
+#line 2979
if (realign) {
+#line 2979
memcpy(*xpp, tmp, ni*X_SIZEOF_UINT);
+#line 2979
xp = (uint *) *xpp;
+#line 2979
}
+#line 2979
/* update xpp and tp */
+#line 2979
xp += ni;
+#line 2979
tp += ni;
+#line 2979
*xpp = (void*)xp;
+#line 2979
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 2979
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 2979
+#line 2979
#else /* not SX */
+#line 2979
+#line 2979
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 2979
+ int status = NC_NOERR;
+#line 2979
+#line 2979
for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
+#line 2979
{
+#line 2979
int lstatus = ncx_put_uint_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 2979
+ if(lstatus != NC_NOERR)
+#line 2979
status = lstatus;
+#line 2979
}
+#line 2979
+#line 2979
*xpp = (void *)xp;
+#line 2979
return status;
+#line 2979
#endif
+#line 2979
}
+#line 2979
@@ -11655,7 +21260,7 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
swapn4b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_FLOAT);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -11666,68 +21271,113 @@ 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 3005
const struct ieee_single *const isp =
+#line 3005
(const struct ieee_single *) (*xpp);
+#line 3005
unsigned exp = isp->exp_hi << 1 | isp->exp_lo;
+#line 3005
+#line 3005
switch(exp) {
+#line 3005
case 0 :
+#line 3005
/* ieee subnormal */
+#line 3005
if(isp->mant_hi == min.ieee.mant_hi
+#line 3005
&& isp->mant_lo_hi == min.ieee.mant_lo_hi
+#line 3005
&& isp->mant_lo_lo == min.ieee.mant_lo_lo)
+#line 3005
{
+#line 3005
*vsp = min.s;
+#line 3005
}
+#line 3005
else
+#line 3005
{
+#line 3005
unsigned mantissa = (isp->mant_hi << 16)
+#line 3005
| isp->mant_lo_hi << 8
+#line 3005
| isp->mant_lo_lo;
+#line 3005
unsigned tmp = mantissa >> 20;
+#line 3005
if(tmp >= 4) {
+#line 3005
vsp->exp = 2;
+#line 3005
} else if (tmp >= 2) {
+#line 3005
vsp->exp = 1;
+#line 3005
} else {
+#line 3005
*vsp = min.s;
+#line 3005
break;
+#line 3005
} /* else */
+#line 3005
tmp = mantissa - (1 << (20 + vsp->exp ));
+#line 3005
tmp <<= 3 - vsp->exp;
+#line 3005
vsp->mantissa2 = tmp;
+#line 3005
vsp->mantissa1 = (tmp >> 16);
+#line 3005
}
+#line 3005
break;
+#line 3005
case 0xfe :
+#line 3005
case 0xff :
+#line 3005
*vsp = max.s;
+#line 3005
break;
+#line 3005
default :
+#line 3005
vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
+#line 3005
vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo;
+#line 3005
vsp->mantissa1 = isp->mant_hi;
+#line 3005
}
+#line 3005
+#line 3005
vsp->sign = isp->sign;
+#line 3005
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -11737,589 +21387,1165 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
#endif
int
+#line 3031
ncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp)
+#line 3031
{
+#line 3031
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3031
+#line 3031
/* basic algorithm is:
+#line 3031
* - ensure sane alignment of input data
+#line 3031
* - copy (conversion happens automatically) input data
+#line 3031
* to output
+#line 3031
* - update xpp to point at next unconverted input, and tp to point
+#line 3031
* at next location for converted output
+#line 3031
*/
+#line 3031
long i, j, ni;
+#line 3031
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3031
float *xp;
+#line 3031
int nrange = 0; /* number of range errors */
+#line 3031
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3031
long cxp = (long) *((char**)xpp);
+#line 3031
+#line 3031
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3031
/* sjl: manually stripmine so we can limit amount of
+#line 3031
* vector work space reserved to LOOPCNT elements. Also
+#line 3031
* makes vectorisation easy */
+#line 3031
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3031
ni=Min(nelems-j,LOOPCNT);
+#line 3031
if (realign) {
+#line 3031
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3031
xp = tmp;
+#line 3031
} else {
+#line 3031
xp = (float *) *xpp;
+#line 3031
}
+#line 3031
/* copy the next block */
+#line 3031
#pragma cdir loopcnt=LOOPCNT
+#line 3031
#pragma cdir shortloop
+#line 3031
for (i=0; i<ni; i++) {
+#line 3031
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 3031
/* test for range errors (not always needed but do it anyway) */
+#line 3031
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3031
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3031
nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
+#line 3031
}
+#line 3031
/* update xpp and tp */
+#line 3031
if (realign) xp = (float *) *xpp;
+#line 3031
xp += ni;
+#line 3031
tp += ni;
+#line 3031
*xpp = (void*)xp;
+#line 3031
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3031
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3031
+#line 3031
#else /* not SX */
+#line 3031
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3031
+ int status = NC_NOERR;
+#line 3031
+#line 3031
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3031
{
+#line 3031
const int lstatus = ncx_get_float_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3031
+ if(lstatus != NC_NOERR)
+#line 3031
status = lstatus;
+#line 3031
}
+#line 3031
+#line 3031
*xpp = (const void *)xp;
+#line 3031
return status;
+#line 3031
# endif
+#line 3031
}
+#line 3031
int
+#line 3032
ncx_getn_float_short(const void **xpp, size_t nelems, short *tp)
+#line 3032
{
+#line 3032
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3032
+#line 3032
/* basic algorithm is:
+#line 3032
* - ensure sane alignment of input data
+#line 3032
* - copy (conversion happens automatically) input data
+#line 3032
* to output
+#line 3032
* - update xpp to point at next unconverted input, and tp to point
+#line 3032
* at next location for converted output
+#line 3032
*/
+#line 3032
long i, j, ni;
+#line 3032
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3032
float *xp;
+#line 3032
int nrange = 0; /* number of range errors */
+#line 3032
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3032
long cxp = (long) *((char**)xpp);
+#line 3032
+#line 3032
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3032
/* sjl: manually stripmine so we can limit amount of
+#line 3032
* vector work space reserved to LOOPCNT elements. Also
+#line 3032
* makes vectorisation easy */
+#line 3032
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3032
ni=Min(nelems-j,LOOPCNT);
+#line 3032
if (realign) {
+#line 3032
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3032
xp = tmp;
+#line 3032
} else {
+#line 3032
xp = (float *) *xpp;
+#line 3032
}
+#line 3032
/* copy the next block */
+#line 3032
#pragma cdir loopcnt=LOOPCNT
+#line 3032
#pragma cdir shortloop
+#line 3032
for (i=0; i<ni; i++) {
+#line 3032
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 3032
/* test for range errors (not always needed but do it anyway) */
+#line 3032
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3032
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3032
nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
+#line 3032
}
+#line 3032
/* update xpp and tp */
+#line 3032
if (realign) xp = (float *) *xpp;
+#line 3032
xp += ni;
+#line 3032
tp += ni;
+#line 3032
*xpp = (void*)xp;
+#line 3032
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3032
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3032
+#line 3032
#else /* not SX */
+#line 3032
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3032
+ int status = NC_NOERR;
+#line 3032
+#line 3032
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3032
{
+#line 3032
const int lstatus = ncx_get_float_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3032
+ if(lstatus != NC_NOERR)
+#line 3032
status = lstatus;
+#line 3032
}
+#line 3032
+#line 3032
*xpp = (const void *)xp;
+#line 3032
return status;
+#line 3032
# endif
+#line 3032
}
+#line 3032
int
+#line 3033
ncx_getn_float_int(const void **xpp, size_t nelems, int *tp)
+#line 3033
{
+#line 3033
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3033
+#line 3033
/* basic algorithm is:
+#line 3033
* - ensure sane alignment of input data
+#line 3033
* - copy (conversion happens automatically) input data
+#line 3033
* to output
+#line 3033
* - update xpp to point at next unconverted input, and tp to point
+#line 3033
* at next location for converted output
+#line 3033
*/
+#line 3033
long i, j, ni;
+#line 3033
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3033
float *xp;
+#line 3033
int nrange = 0; /* number of range errors */
+#line 3033
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3033
long cxp = (long) *((char**)xpp);
+#line 3033
+#line 3033
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3033
/* sjl: manually stripmine so we can limit amount of
+#line 3033
* vector work space reserved to LOOPCNT elements. Also
+#line 3033
* makes vectorisation easy */
+#line 3033
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3033
ni=Min(nelems-j,LOOPCNT);
+#line 3033
if (realign) {
+#line 3033
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3033
xp = tmp;
+#line 3033
} else {
+#line 3033
xp = (float *) *xpp;
+#line 3033
}
+#line 3033
/* copy the next block */
+#line 3033
#pragma cdir loopcnt=LOOPCNT
+#line 3033
#pragma cdir shortloop
+#line 3033
for (i=0; i<ni; i++) {
+#line 3033
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 3033
/* test for range errors (not always needed but do it anyway) */
+#line 3033
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3033
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3033
nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
+#line 3033
}
+#line 3033
/* update xpp and tp */
+#line 3033
if (realign) xp = (float *) *xpp;
+#line 3033
xp += ni;
+#line 3033
tp += ni;
+#line 3033
*xpp = (void*)xp;
+#line 3033
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3033
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3033
+#line 3033
#else /* not SX */
+#line 3033
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3033
+ int status = NC_NOERR;
+#line 3033
+#line 3033
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3033
{
+#line 3033
const int lstatus = ncx_get_float_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3033
+ if(lstatus != NC_NOERR)
+#line 3033
status = lstatus;
+#line 3033
}
+#line 3033
+#line 3033
*xpp = (const void *)xp;
+#line 3033
return status;
+#line 3033
# endif
+#line 3033
}
+#line 3033
int
+#line 3034
ncx_getn_float_double(const void **xpp, size_t nelems, double *tp)
+#line 3034
{
+#line 3034
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3034
+#line 3034
/* basic algorithm is:
+#line 3034
* - ensure sane alignment of input data
+#line 3034
* - copy (conversion happens automatically) input data
+#line 3034
* to output
+#line 3034
* - update xpp to point at next unconverted input, and tp to point
+#line 3034
* at next location for converted output
+#line 3034
*/
+#line 3034
long i, j, ni;
+#line 3034
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3034
float *xp;
+#line 3034
int nrange = 0; /* number of range errors */
+#line 3034
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3034
long cxp = (long) *((char**)xpp);
+#line 3034
+#line 3034
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3034
/* sjl: manually stripmine so we can limit amount of
+#line 3034
* vector work space reserved to LOOPCNT elements. Also
+#line 3034
* makes vectorisation easy */
+#line 3034
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3034
ni=Min(nelems-j,LOOPCNT);
+#line 3034
if (realign) {
+#line 3034
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3034
xp = tmp;
+#line 3034
} else {
+#line 3034
xp = (float *) *xpp;
+#line 3034
}
+#line 3034
/* copy the next block */
+#line 3034
#pragma cdir loopcnt=LOOPCNT
+#line 3034
#pragma cdir shortloop
+#line 3034
for (i=0; i<ni; i++) {
+#line 3034
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 3034
/* test for range errors (not always needed but do it anyway) */
+#line 3034
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3034
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3034
nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
+#line 3034
}
+#line 3034
/* update xpp and tp */
+#line 3034
if (realign) xp = (float *) *xpp;
+#line 3034
xp += ni;
+#line 3034
tp += ni;
+#line 3034
*xpp = (void*)xp;
+#line 3034
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3034
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3034
+#line 3034
#else /* not SX */
+#line 3034
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3034
+ int status = NC_NOERR;
+#line 3034
+#line 3034
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3034
{
+#line 3034
const int lstatus = ncx_get_float_double(xp, tp);
- if(lstatus != ENOERR)
+#line 3034
+ if(lstatus != NC_NOERR)
+#line 3034
status = lstatus;
+#line 3034
}
+#line 3034
+#line 3034
*xpp = (const void *)xp;
+#line 3034
return status;
+#line 3034
# endif
+#line 3034
}
+#line 3034
int
+#line 3035
ncx_getn_float_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3035
{
+#line 3035
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3035
+#line 3035
/* basic algorithm is:
+#line 3035
* - ensure sane alignment of input data
+#line 3035
* - copy (conversion happens automatically) input data
+#line 3035
* to output
+#line 3035
* - update xpp to point at next unconverted input, and tp to point
+#line 3035
* at next location for converted output
+#line 3035
*/
+#line 3035
long i, j, ni;
+#line 3035
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3035
float *xp;
+#line 3035
int nrange = 0; /* number of range errors */
+#line 3035
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3035
long cxp = (long) *((char**)xpp);
+#line 3035
+#line 3035
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3035
/* sjl: manually stripmine so we can limit amount of
+#line 3035
* vector work space reserved to LOOPCNT elements. Also
+#line 3035
* makes vectorisation easy */
+#line 3035
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3035
ni=Min(nelems-j,LOOPCNT);
+#line 3035
if (realign) {
+#line 3035
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3035
xp = tmp;
+#line 3035
} else {
+#line 3035
xp = (float *) *xpp;
+#line 3035
}
+#line 3035
/* copy the next block */
+#line 3035
#pragma cdir loopcnt=LOOPCNT
+#line 3035
#pragma cdir shortloop
+#line 3035
for (i=0; i<ni; i++) {
+#line 3035
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 3035
/* test for range errors (not always needed but do it anyway) */
+#line 3035
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3035
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3035
nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
+#line 3035
}
+#line 3035
/* update xpp and tp */
+#line 3035
if (realign) xp = (float *) *xpp;
+#line 3035
xp += ni;
+#line 3035
tp += ni;
+#line 3035
*xpp = (void*)xp;
+#line 3035
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3035
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3035
+#line 3035
#else /* not SX */
+#line 3035
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3035
+ int status = NC_NOERR;
+#line 3035
+#line 3035
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3035
{
+#line 3035
const int lstatus = ncx_get_float_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3035
+ if(lstatus != NC_NOERR)
+#line 3035
status = lstatus;
+#line 3035
}
+#line 3035
+#line 3035
*xpp = (const void *)xp;
+#line 3035
return status;
+#line 3035
# endif
+#line 3035
}
+#line 3035
int
+#line 3036
ncx_getn_float_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 3036
{
+#line 3036
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3036
+#line 3036
/* basic algorithm is:
+#line 3036
* - ensure sane alignment of input data
+#line 3036
* - copy (conversion happens automatically) input data
+#line 3036
* to output
+#line 3036
* - update xpp to point at next unconverted input, and tp to point
+#line 3036
* at next location for converted output
+#line 3036
*/
+#line 3036
long i, j, ni;
+#line 3036
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3036
float *xp;
+#line 3036
int nrange = 0; /* number of range errors */
+#line 3036
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3036
long cxp = (long) *((char**)xpp);
+#line 3036
+#line 3036
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3036
/* sjl: manually stripmine so we can limit amount of
+#line 3036
* vector work space reserved to LOOPCNT elements. Also
+#line 3036
* makes vectorisation easy */
+#line 3036
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3036
ni=Min(nelems-j,LOOPCNT);
+#line 3036
if (realign) {
+#line 3036
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3036
xp = tmp;
+#line 3036
} else {
+#line 3036
xp = (float *) *xpp;
+#line 3036
}
+#line 3036
/* copy the next block */
+#line 3036
#pragma cdir loopcnt=LOOPCNT
+#line 3036
#pragma cdir shortloop
+#line 3036
for (i=0; i<ni; i++) {
+#line 3036
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 3036
/* test for range errors (not always needed but do it anyway) */
+#line 3036
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3036
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3036
nrange += xp[i] > USHORT_MAX || xp[i] < 0;
+#line 3036
}
+#line 3036
/* update xpp and tp */
+#line 3036
if (realign) xp = (float *) *xpp;
+#line 3036
xp += ni;
+#line 3036
tp += ni;
+#line 3036
*xpp = (void*)xp;
+#line 3036
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3036
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3036
+#line 3036
#else /* not SX */
+#line 3036
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3036
+ int status = NC_NOERR;
+#line 3036
+#line 3036
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3036
{
+#line 3036
const int lstatus = ncx_get_float_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3036
+ if(lstatus != NC_NOERR)
+#line 3036
status = lstatus;
+#line 3036
}
+#line 3036
+#line 3036
*xpp = (const void *)xp;
+#line 3036
return status;
+#line 3036
# endif
+#line 3036
}
+#line 3036
int
+#line 3037
ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 3037
{
+#line 3037
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3037
+#line 3037
/* basic algorithm is:
+#line 3037
* - ensure sane alignment of input data
+#line 3037
* - copy (conversion happens automatically) input data
+#line 3037
* to output
+#line 3037
* - update xpp to point at next unconverted input, and tp to point
+#line 3037
* at next location for converted output
+#line 3037
*/
+#line 3037
long i, j, ni;
+#line 3037
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3037
float *xp;
+#line 3037
int nrange = 0; /* number of range errors */
+#line 3037
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3037
long cxp = (long) *((char**)xpp);
+#line 3037
+#line 3037
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3037
/* sjl: manually stripmine so we can limit amount of
+#line 3037
* vector work space reserved to LOOPCNT elements. Also
+#line 3037
* makes vectorisation easy */
+#line 3037
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3037
ni=Min(nelems-j,LOOPCNT);
+#line 3037
if (realign) {
+#line 3037
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3037
xp = tmp;
+#line 3037
} else {
+#line 3037
xp = (float *) *xpp;
+#line 3037
}
+#line 3037
/* copy the next block */
+#line 3037
#pragma cdir loopcnt=LOOPCNT
+#line 3037
#pragma cdir shortloop
+#line 3037
for (i=0; i<ni; i++) {
+#line 3037
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 3037
/* test for range errors (not always needed but do it anyway) */
+#line 3037
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3037
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3037
nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
+#line 3037
}
+#line 3037
/* update xpp and tp */
+#line 3037
if (realign) xp = (float *) *xpp;
+#line 3037
xp += ni;
+#line 3037
tp += ni;
+#line 3037
*xpp = (void*)xp;
+#line 3037
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3037
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3037
+#line 3037
#else /* not SX */
+#line 3037
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3037
+ int status = NC_NOERR;
+#line 3037
+#line 3037
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3037
{
+#line 3037
const int lstatus = ncx_get_float_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3037
+ if(lstatus != NC_NOERR)
+#line 3037
status = lstatus;
+#line 3037
}
+#line 3037
+#line 3037
*xpp = (const void *)xp;
+#line 3037
return status;
+#line 3037
# endif
+#line 3037
}
+#line 3037
int
+#line 3038
ncx_getn_float_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3038
{
+#line 3038
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3038
+#line 3038
/* basic algorithm is:
+#line 3038
* - ensure sane alignment of input data
+#line 3038
* - copy (conversion happens automatically) input data
+#line 3038
* to output
+#line 3038
* - update xpp to point at next unconverted input, and tp to point
+#line 3038
* at next location for converted output
+#line 3038
*/
+#line 3038
long i, j, ni;
+#line 3038
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3038
float *xp;
+#line 3038
int nrange = 0; /* number of range errors */
+#line 3038
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3038
long cxp = (long) *((char**)xpp);
+#line 3038
+#line 3038
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3038
/* sjl: manually stripmine so we can limit amount of
+#line 3038
* vector work space reserved to LOOPCNT elements. Also
+#line 3038
* makes vectorisation easy */
+#line 3038
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3038
ni=Min(nelems-j,LOOPCNT);
+#line 3038
if (realign) {
+#line 3038
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3038
xp = tmp;
+#line 3038
} else {
+#line 3038
xp = (float *) *xpp;
+#line 3038
}
+#line 3038
/* copy the next block */
+#line 3038
#pragma cdir loopcnt=LOOPCNT
+#line 3038
#pragma cdir shortloop
+#line 3038
for (i=0; i<ni; i++) {
+#line 3038
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 3038
/* test for range errors (not always needed but do it anyway) */
+#line 3038
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3038
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3038
nrange += xp[i] > UINT_MAX || xp[i] < 0;
+#line 3038
}
+#line 3038
/* update xpp and tp */
+#line 3038
if (realign) xp = (float *) *xpp;
+#line 3038
xp += ni;
+#line 3038
tp += ni;
+#line 3038
*xpp = (void*)xp;
+#line 3038
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3038
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3038
+#line 3038
#else /* not SX */
+#line 3038
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3038
+ int status = NC_NOERR;
+#line 3038
+#line 3038
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3038
{
+#line 3038
const int lstatus = ncx_get_float_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3038
+ if(lstatus != NC_NOERR)
+#line 3038
status = lstatus;
+#line 3038
}
+#line 3038
+#line 3038
*xpp = (const void *)xp;
+#line 3038
return status;
+#line 3038
# endif
+#line 3038
}
+#line 3038
int
+#line 3039
ncx_getn_float_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 3039
{
+#line 3039
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3039
+#line 3039
/* basic algorithm is:
+#line 3039
* - ensure sane alignment of input data
+#line 3039
* - copy (conversion happens automatically) input data
+#line 3039
* to output
+#line 3039
* - update xpp to point at next unconverted input, and tp to point
+#line 3039
* at next location for converted output
+#line 3039
*/
+#line 3039
long i, j, ni;
+#line 3039
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3039
float *xp;
+#line 3039
int nrange = 0; /* number of range errors */
+#line 3039
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3039
long cxp = (long) *((char**)xpp);
+#line 3039
+#line 3039
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3039
/* sjl: manually stripmine so we can limit amount of
+#line 3039
* vector work space reserved to LOOPCNT elements. Also
+#line 3039
* makes vectorisation easy */
+#line 3039
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3039
ni=Min(nelems-j,LOOPCNT);
+#line 3039
if (realign) {
+#line 3039
memcpy(tmp, *xpp, ni*SIZEOF_FLOAT);
+#line 3039
xp = tmp;
+#line 3039
} else {
+#line 3039
xp = (float *) *xpp;
+#line 3039
}
+#line 3039
/* copy the next block */
+#line 3039
#pragma cdir loopcnt=LOOPCNT
+#line 3039
#pragma cdir shortloop
+#line 3039
for (i=0; i<ni; i++) {
+#line 3039
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 3039
/* test for range errors (not always needed but do it anyway) */
+#line 3039
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3039
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3039
nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
+#line 3039
}
+#line 3039
/* update xpp and tp */
+#line 3039
if (realign) xp = (float *) *xpp;
+#line 3039
xp += ni;
+#line 3039
tp += ni;
+#line 3039
*xpp = (void*)xp;
+#line 3039
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3039
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3039
+#line 3039
#else /* not SX */
+#line 3039
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3039
+ int status = NC_NOERR;
+#line 3039
+#line 3039
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3039
{
+#line 3039
const int lstatus = ncx_get_float_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3039
+ if(lstatus != NC_NOERR)
+#line 3039
status = lstatus;
+#line 3039
}
+#line 3039
+#line 3039
*xpp = (const void *)xp;
+#line 3039
return status;
+#line 3039
# endif
+#line 3039
}
+#line 3039
#if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT)
@@ -12333,7 +22559,7 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
swapn4b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_FLOAT);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -12344,67 +22570,111 @@ ncx_putn_float_float(void **xpp, size_t nfloats, const float *ip)
while(ip < end)
{
const struct vax_single *const vsp =
+#line 3062
(const struct vax_single *)ip;
+#line 3062
struct ieee_single *const isp = (struct ieee_single *) (*xpp);
+#line 3062
+#line 3062
switch(vsp->exp){
+#line 3062
case 0 :
+#line 3062
/* all vax float with zero exponent map to zero */
+#line 3062
*isp = min.ieee;
+#line 3062
break;
+#line 3062
case 2 :
+#line 3062
case 1 :
+#line 3062
{
+#line 3062
/* These will map to subnormals */
+#line 3062
unsigned mantissa = (vsp->mantissa1 << 16)
+#line 3062
| vsp->mantissa2;
+#line 3062
mantissa >>= 3 - vsp->exp;
+#line 3062
mantissa += (1 << (20 + vsp->exp));
+#line 3062
isp->mant_lo_lo = mantissa;
+#line 3062
isp->mant_lo_hi = mantissa >> 8;
+#line 3062
isp->mant_hi = mantissa >> 16;
+#line 3062
isp->exp_lo = 0;
+#line 3062
isp->exp_hi = 0;
+#line 3062
}
+#line 3062
break;
+#line 3062
case 0xff : /* max.s.exp */
+#line 3062
if( vsp->mantissa2 == max.s.mantissa2
+#line 3062
&& vsp->mantissa1 == max.s.mantissa1)
+#line 3062
{
+#line 3062
/* map largest vax float to ieee infinity */
+#line 3062
*isp = max.ieee;
+#line 3062
break;
+#line 3062
} /* else, fall thru */
+#line 3062
default :
+#line 3062
{
+#line 3062
unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
+#line 3062
isp->exp_hi = exp >> 1;
+#line 3062
isp->exp_lo = exp;
+#line 3062
isp->mant_lo_lo = vsp->mantissa2;
+#line 3062
isp->mant_lo_hi = vsp->mantissa2 >> 8;
+#line 3062
isp->mant_hi = vsp->mantissa1;
+#line 3062
}
+#line 3062
}
+#line 3062
+#line 3062
isp->sign = vsp->sign;
+#line 3062
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
int lstatus = ncx_put_float_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -12413,634 +22683,1255 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
}
#endif
int
+#line 3087
ncx_putn_float_schar(void **xpp, size_t nelems, const schar *tp)
+#line 3087
{
+#line 3087
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3087
+#line 3087
/* basic algorithm is:
+#line 3087
* - ensure sane alignment of output data
+#line 3087
* - copy (conversion happens automatically) input data
+#line 3087
* to output
+#line 3087
* - update tp to point at next unconverted input, and xpp to point
+#line 3087
* at next location for converted output
+#line 3087
*/
+#line 3087
long i, j, ni;
+#line 3087
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3087
float *xp;
+#line 3087
int nrange = 0; /* number of range errors */
+#line 3087
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3087
long cxp = (long) *((char**)xpp);
+#line 3087
+#line 3087
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3087
/* sjl: manually stripmine so we can limit amount of
+#line 3087
* vector work space reserved to LOOPCNT elements. Also
+#line 3087
* makes vectorisation easy */
+#line 3087
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3087
ni=Min(nelems-j,LOOPCNT);
+#line 3087
if (realign) {
+#line 3087
xp = tmp;
+#line 3087
} else {
+#line 3087
xp = (float *) *xpp;
+#line 3087
}
+#line 3087
/* copy the next block */
+#line 3087
#pragma cdir loopcnt=LOOPCNT
+#line 3087
#pragma cdir shortloop
+#line 3087
for (i=0; i<ni; i++) {
+#line 3087
/* the normal case: */
+#line 3087
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3087
/* test for range errors (not always needed but do it anyway) */
+#line 3087
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3087
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3087
nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
+#line 3087
}
+#line 3087
/* copy workspace back if necessary */
+#line 3087
if (realign) {
+#line 3087
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3087
xp = (float *) *xpp;
+#line 3087
}
+#line 3087
/* update xpp and tp */
+#line 3087
xp += ni;
+#line 3087
tp += ni;
+#line 3087
*xpp = (void*)xp;
+#line 3087
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3087
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3087
+#line 3087
#else /* not SX */
+#line 3087
+#line 3087
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3087
+ int status = NC_NOERR;
+#line 3087
+#line 3087
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3087
{
+#line 3087
int lstatus = ncx_put_float_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3087
+ if(lstatus != NC_NOERR)
+#line 3087
status = lstatus;
+#line 3087
}
+#line 3087
+#line 3087
*xpp = (void *)xp;
+#line 3087
return status;
+#line 3087
#endif
+#line 3087
}
+#line 3087
int
+#line 3088
ncx_putn_float_short(void **xpp, size_t nelems, const short *tp)
+#line 3088
{
+#line 3088
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3088
+#line 3088
/* basic algorithm is:
+#line 3088
* - ensure sane alignment of output data
+#line 3088
* - copy (conversion happens automatically) input data
+#line 3088
* to output
+#line 3088
* - update tp to point at next unconverted input, and xpp to point
+#line 3088
* at next location for converted output
+#line 3088
*/
+#line 3088
long i, j, ni;
+#line 3088
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3088
float *xp;
+#line 3088
int nrange = 0; /* number of range errors */
+#line 3088
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3088
long cxp = (long) *((char**)xpp);
+#line 3088
+#line 3088
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3088
/* sjl: manually stripmine so we can limit amount of
+#line 3088
* vector work space reserved to LOOPCNT elements. Also
+#line 3088
* makes vectorisation easy */
+#line 3088
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3088
ni=Min(nelems-j,LOOPCNT);
+#line 3088
if (realign) {
+#line 3088
xp = tmp;
+#line 3088
} else {
+#line 3088
xp = (float *) *xpp;
+#line 3088
}
+#line 3088
/* copy the next block */
+#line 3088
#pragma cdir loopcnt=LOOPCNT
+#line 3088
#pragma cdir shortloop
+#line 3088
for (i=0; i<ni; i++) {
+#line 3088
/* the normal case: */
+#line 3088
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3088
/* test for range errors (not always needed but do it anyway) */
+#line 3088
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3088
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3088
nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
+#line 3088
}
+#line 3088
/* copy workspace back if necessary */
+#line 3088
if (realign) {
+#line 3088
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3088
xp = (float *) *xpp;
+#line 3088
}
+#line 3088
/* update xpp and tp */
+#line 3088
xp += ni;
+#line 3088
tp += ni;
+#line 3088
*xpp = (void*)xp;
+#line 3088
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3088
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3088
+#line 3088
#else /* not SX */
+#line 3088
+#line 3088
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3088
+ int status = NC_NOERR;
+#line 3088
+#line 3088
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3088
{
+#line 3088
int lstatus = ncx_put_float_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3088
+ if(lstatus != NC_NOERR)
+#line 3088
status = lstatus;
+#line 3088
}
+#line 3088
+#line 3088
*xpp = (void *)xp;
+#line 3088
return status;
+#line 3088
#endif
+#line 3088
}
+#line 3088
int
+#line 3089
ncx_putn_float_int(void **xpp, size_t nelems, const int *tp)
+#line 3089
{
+#line 3089
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3089
+#line 3089
/* basic algorithm is:
+#line 3089
* - ensure sane alignment of output data
+#line 3089
* - copy (conversion happens automatically) input data
+#line 3089
* to output
+#line 3089
* - update tp to point at next unconverted input, and xpp to point
+#line 3089
* at next location for converted output
+#line 3089
*/
+#line 3089
long i, j, ni;
+#line 3089
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3089
float *xp;
+#line 3089
int nrange = 0; /* number of range errors */
+#line 3089
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3089
long cxp = (long) *((char**)xpp);
+#line 3089
+#line 3089
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3089
/* sjl: manually stripmine so we can limit amount of
+#line 3089
* vector work space reserved to LOOPCNT elements. Also
+#line 3089
* makes vectorisation easy */
+#line 3089
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3089
ni=Min(nelems-j,LOOPCNT);
+#line 3089
if (realign) {
+#line 3089
xp = tmp;
+#line 3089
} else {
+#line 3089
xp = (float *) *xpp;
+#line 3089
}
+#line 3089
/* copy the next block */
+#line 3089
#pragma cdir loopcnt=LOOPCNT
+#line 3089
#pragma cdir shortloop
+#line 3089
for (i=0; i<ni; i++) {
+#line 3089
/* the normal case: */
+#line 3089
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3089
/* test for range errors (not always needed but do it anyway) */
+#line 3089
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3089
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3089
nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
+#line 3089
}
+#line 3089
/* copy workspace back if necessary */
+#line 3089
if (realign) {
+#line 3089
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3089
xp = (float *) *xpp;
+#line 3089
}
+#line 3089
/* update xpp and tp */
+#line 3089
xp += ni;
+#line 3089
tp += ni;
+#line 3089
*xpp = (void*)xp;
+#line 3089
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3089
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3089
+#line 3089
#else /* not SX */
+#line 3089
+#line 3089
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3089
+ int status = NC_NOERR;
+#line 3089
+#line 3089
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3089
{
+#line 3089
int lstatus = ncx_put_float_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3089
+ if(lstatus != NC_NOERR)
+#line 3089
status = lstatus;
+#line 3089
}
+#line 3089
+#line 3089
*xpp = (void *)xp;
+#line 3089
return status;
+#line 3089
#endif
+#line 3089
}
+#line 3089
int
+#line 3090
ncx_putn_float_double(void **xpp, size_t nelems, const double *tp)
+#line 3090
{
+#line 3090
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3090
+#line 3090
/* basic algorithm is:
+#line 3090
* - ensure sane alignment of output data
+#line 3090
* - copy (conversion happens automatically) input data
+#line 3090
* to output
+#line 3090
* - update tp to point at next unconverted input, and xpp to point
+#line 3090
* at next location for converted output
+#line 3090
*/
+#line 3090
long i, j, ni;
+#line 3090
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3090
float *xp;
+#line 3090
int nrange = 0; /* number of range errors */
+#line 3090
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3090
long cxp = (long) *((char**)xpp);
+#line 3090
+#line 3090
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3090
/* sjl: manually stripmine so we can limit amount of
+#line 3090
* vector work space reserved to LOOPCNT elements. Also
+#line 3090
* makes vectorisation easy */
+#line 3090
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3090
ni=Min(nelems-j,LOOPCNT);
+#line 3090
if (realign) {
+#line 3090
xp = tmp;
+#line 3090
} else {
+#line 3090
xp = (float *) *xpp;
+#line 3090
}
+#line 3090
/* copy the next block */
+#line 3090
#pragma cdir loopcnt=LOOPCNT
+#line 3090
#pragma cdir shortloop
+#line 3090
for (i=0; i<ni; i++) {
+#line 3090
/* the normal case: */
+#line 3090
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3090
/* test for range errors (not always needed but do it anyway) */
+#line 3090
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3090
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3090
nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
+#line 3090
}
+#line 3090
/* copy workspace back if necessary */
+#line 3090
if (realign) {
+#line 3090
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3090
xp = (float *) *xpp;
+#line 3090
}
+#line 3090
/* update xpp and tp */
+#line 3090
xp += ni;
+#line 3090
tp += ni;
+#line 3090
*xpp = (void*)xp;
+#line 3090
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3090
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3090
+#line 3090
#else /* not SX */
+#line 3090
+#line 3090
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3090
+ int status = NC_NOERR;
+#line 3090
+#line 3090
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3090
{
+#line 3090
int lstatus = ncx_put_float_double(xp, tp);
- if(lstatus != ENOERR)
+#line 3090
+ if(lstatus != NC_NOERR)
+#line 3090
status = lstatus;
+#line 3090
}
+#line 3090
+#line 3090
*xpp = (void *)xp;
+#line 3090
return status;
+#line 3090
#endif
+#line 3090
}
+#line 3090
int
+#line 3091
ncx_putn_float_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 3091
{
+#line 3091
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3091
+#line 3091
/* basic algorithm is:
+#line 3091
* - ensure sane alignment of output data
+#line 3091
* - copy (conversion happens automatically) input data
+#line 3091
* to output
+#line 3091
* - update tp to point at next unconverted input, and xpp to point
+#line 3091
* at next location for converted output
+#line 3091
*/
+#line 3091
long i, j, ni;
+#line 3091
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3091
float *xp;
+#line 3091
int nrange = 0; /* number of range errors */
+#line 3091
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3091
long cxp = (long) *((char**)xpp);
+#line 3091
+#line 3091
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3091
/* sjl: manually stripmine so we can limit amount of
+#line 3091
* vector work space reserved to LOOPCNT elements. Also
+#line 3091
* makes vectorisation easy */
+#line 3091
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3091
ni=Min(nelems-j,LOOPCNT);
+#line 3091
if (realign) {
+#line 3091
xp = tmp;
+#line 3091
} else {
+#line 3091
xp = (float *) *xpp;
+#line 3091
}
+#line 3091
/* copy the next block */
+#line 3091
#pragma cdir loopcnt=LOOPCNT
+#line 3091
#pragma cdir shortloop
+#line 3091
for (i=0; i<ni; i++) {
+#line 3091
/* the normal case: */
+#line 3091
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3091
/* test for range errors (not always needed but do it anyway) */
+#line 3091
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3091
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3091
nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
+#line 3091
}
+#line 3091
/* copy workspace back if necessary */
+#line 3091
if (realign) {
+#line 3091
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3091
xp = (float *) *xpp;
+#line 3091
}
+#line 3091
/* update xpp and tp */
+#line 3091
xp += ni;
+#line 3091
tp += ni;
+#line 3091
*xpp = (void*)xp;
+#line 3091
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3091
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3091
+#line 3091
#else /* not SX */
+#line 3091
+#line 3091
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3091
+ int status = NC_NOERR;
+#line 3091
+#line 3091
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3091
{
+#line 3091
int lstatus = ncx_put_float_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3091
+ if(lstatus != NC_NOERR)
+#line 3091
status = lstatus;
+#line 3091
}
+#line 3091
+#line 3091
*xpp = (void *)xp;
+#line 3091
return status;
+#line 3091
#endif
+#line 3091
}
+#line 3091
int
+#line 3092
ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 3092
{
+#line 3092
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3092
+#line 3092
/* basic algorithm is:
+#line 3092
* - ensure sane alignment of output data
+#line 3092
* - copy (conversion happens automatically) input data
+#line 3092
* to output
+#line 3092
* - update tp to point at next unconverted input, and xpp to point
+#line 3092
* at next location for converted output
+#line 3092
*/
+#line 3092
long i, j, ni;
+#line 3092
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3092
float *xp;
+#line 3092
int nrange = 0; /* number of range errors */
+#line 3092
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3092
long cxp = (long) *((char**)xpp);
+#line 3092
+#line 3092
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3092
/* sjl: manually stripmine so we can limit amount of
+#line 3092
* vector work space reserved to LOOPCNT elements. Also
+#line 3092
* makes vectorisation easy */
+#line 3092
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3092
ni=Min(nelems-j,LOOPCNT);
+#line 3092
if (realign) {
+#line 3092
xp = tmp;
+#line 3092
} else {
+#line 3092
xp = (float *) *xpp;
+#line 3092
}
+#line 3092
/* copy the next block */
+#line 3092
#pragma cdir loopcnt=LOOPCNT
+#line 3092
#pragma cdir shortloop
+#line 3092
for (i=0; i<ni; i++) {
+#line 3092
/* the normal case: */
+#line 3092
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3092
/* test for range errors (not always needed but do it anyway) */
+#line 3092
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3092
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3092
nrange += tp[i] > X_FLOAT_MAX ;
+#line 3092
}
+#line 3092
/* copy workspace back if necessary */
+#line 3092
if (realign) {
+#line 3092
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3092
xp = (float *) *xpp;
+#line 3092
}
+#line 3092
/* update xpp and tp */
+#line 3092
xp += ni;
+#line 3092
tp += ni;
+#line 3092
*xpp = (void*)xp;
+#line 3092
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3092
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3092
+#line 3092
#else /* not SX */
+#line 3092
+#line 3092
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3092
+ int status = NC_NOERR;
+#line 3092
+#line 3092
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3092
{
+#line 3092
int lstatus = ncx_put_float_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3092
+ if(lstatus != NC_NOERR)
+#line 3092
status = lstatus;
+#line 3092
}
+#line 3092
+#line 3092
*xpp = (void *)xp;
+#line 3092
return status;
+#line 3092
#endif
+#line 3092
}
+#line 3092
int
+#line 3093
ncx_putn_float_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 3093
{
+#line 3093
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3093
+#line 3093
/* basic algorithm is:
+#line 3093
* - ensure sane alignment of output data
+#line 3093
* - copy (conversion happens automatically) input data
+#line 3093
* to output
+#line 3093
* - update tp to point at next unconverted input, and xpp to point
+#line 3093
* at next location for converted output
+#line 3093
*/
+#line 3093
long i, j, ni;
+#line 3093
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3093
float *xp;
+#line 3093
int nrange = 0; /* number of range errors */
+#line 3093
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3093
long cxp = (long) *((char**)xpp);
+#line 3093
+#line 3093
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3093
/* sjl: manually stripmine so we can limit amount of
+#line 3093
* vector work space reserved to LOOPCNT elements. Also
+#line 3093
* makes vectorisation easy */
+#line 3093
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3093
ni=Min(nelems-j,LOOPCNT);
+#line 3093
if (realign) {
+#line 3093
xp = tmp;
+#line 3093
} else {
+#line 3093
xp = (float *) *xpp;
+#line 3093
}
+#line 3093
/* copy the next block */
+#line 3093
#pragma cdir loopcnt=LOOPCNT
+#line 3093
#pragma cdir shortloop
+#line 3093
for (i=0; i<ni; i++) {
+#line 3093
/* the normal case: */
+#line 3093
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3093
/* test for range errors (not always needed but do it anyway) */
+#line 3093
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3093
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3093
nrange += tp[i] > X_FLOAT_MAX ;
+#line 3093
}
+#line 3093
/* copy workspace back if necessary */
+#line 3093
if (realign) {
+#line 3093
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3093
xp = (float *) *xpp;
+#line 3093
}
+#line 3093
/* update xpp and tp */
+#line 3093
xp += ni;
+#line 3093
tp += ni;
+#line 3093
*xpp = (void*)xp;
+#line 3093
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3093
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3093
+#line 3093
#else /* not SX */
+#line 3093
+#line 3093
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3093
+ int status = NC_NOERR;
+#line 3093
+#line 3093
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3093
{
+#line 3093
int lstatus = ncx_put_float_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3093
+ if(lstatus != NC_NOERR)
+#line 3093
status = lstatus;
+#line 3093
}
+#line 3093
+#line 3093
*xpp = (void *)xp;
+#line 3093
return status;
+#line 3093
#endif
+#line 3093
}
+#line 3093
int
+#line 3094
ncx_putn_float_uint(void **xpp, size_t nelems, const uint *tp)
+#line 3094
{
+#line 3094
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3094
+#line 3094
/* basic algorithm is:
+#line 3094
* - ensure sane alignment of output data
+#line 3094
* - copy (conversion happens automatically) input data
+#line 3094
* to output
+#line 3094
* - update tp to point at next unconverted input, and xpp to point
+#line 3094
* at next location for converted output
+#line 3094
*/
+#line 3094
long i, j, ni;
+#line 3094
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3094
float *xp;
+#line 3094
int nrange = 0; /* number of range errors */
+#line 3094
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3094
long cxp = (long) *((char**)xpp);
+#line 3094
+#line 3094
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3094
/* sjl: manually stripmine so we can limit amount of
+#line 3094
* vector work space reserved to LOOPCNT elements. Also
+#line 3094
* makes vectorisation easy */
+#line 3094
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3094
ni=Min(nelems-j,LOOPCNT);
+#line 3094
if (realign) {
+#line 3094
xp = tmp;
+#line 3094
} else {
+#line 3094
xp = (float *) *xpp;
+#line 3094
}
+#line 3094
/* copy the next block */
+#line 3094
#pragma cdir loopcnt=LOOPCNT
+#line 3094
#pragma cdir shortloop
+#line 3094
for (i=0; i<ni; i++) {
+#line 3094
/* the normal case: */
+#line 3094
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3094
/* test for range errors (not always needed but do it anyway) */
+#line 3094
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3094
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3094
nrange += tp[i] > X_FLOAT_MAX ;
+#line 3094
}
+#line 3094
/* copy workspace back if necessary */
+#line 3094
if (realign) {
+#line 3094
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3094
xp = (float *) *xpp;
+#line 3094
}
+#line 3094
/* update xpp and tp */
+#line 3094
xp += ni;
+#line 3094
tp += ni;
+#line 3094
*xpp = (void*)xp;
+#line 3094
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3094
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3094
+#line 3094
#else /* not SX */
+#line 3094
+#line 3094
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3094
+ int status = NC_NOERR;
+#line 3094
+#line 3094
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3094
{
+#line 3094
int lstatus = ncx_put_float_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3094
+ if(lstatus != NC_NOERR)
+#line 3094
status = lstatus;
+#line 3094
}
+#line 3094
+#line 3094
*xpp = (void *)xp;
+#line 3094
return status;
+#line 3094
#endif
+#line 3094
}
+#line 3094
int
+#line 3095
ncx_putn_float_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 3095
{
+#line 3095
#if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT
+#line 3095
+#line 3095
/* basic algorithm is:
+#line 3095
* - ensure sane alignment of output data
+#line 3095
* - copy (conversion happens automatically) input data
+#line 3095
* to output
+#line 3095
* - update tp to point at next unconverted input, and xpp to point
+#line 3095
* at next location for converted output
+#line 3095
*/
+#line 3095
long i, j, ni;
+#line 3095
float tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3095
float *xp;
+#line 3095
int nrange = 0; /* number of range errors */
+#line 3095
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3095
long cxp = (long) *((char**)xpp);
+#line 3095
+#line 3095
realign = (cxp & 7) % SIZEOF_FLOAT;
+#line 3095
/* sjl: manually stripmine so we can limit amount of
+#line 3095
* vector work space reserved to LOOPCNT elements. Also
+#line 3095
* makes vectorisation easy */
+#line 3095
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3095
ni=Min(nelems-j,LOOPCNT);
+#line 3095
if (realign) {
+#line 3095
xp = tmp;
+#line 3095
} else {
+#line 3095
xp = (float *) *xpp;
+#line 3095
}
+#line 3095
/* copy the next block */
+#line 3095
#pragma cdir loopcnt=LOOPCNT
+#line 3095
#pragma cdir shortloop
+#line 3095
for (i=0; i<ni; i++) {
+#line 3095
/* the normal case: */
+#line 3095
xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
+#line 3095
/* test for range errors (not always needed but do it anyway) */
+#line 3095
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3095
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3095
nrange += tp[i] > X_FLOAT_MAX ;
+#line 3095
}
+#line 3095
/* copy workspace back if necessary */
+#line 3095
if (realign) {
+#line 3095
memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT);
+#line 3095
xp = (float *) *xpp;
+#line 3095
}
+#line 3095
/* update xpp and tp */
+#line 3095
xp += ni;
+#line 3095
tp += ni;
+#line 3095
*xpp = (void*)xp;
+#line 3095
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3095
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3095
+#line 3095
#else /* not SX */
+#line 3095
+#line 3095
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3095
+ int status = NC_NOERR;
+#line 3095
+#line 3095
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
+#line 3095
{
+#line 3095
int lstatus = ncx_put_float_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3095
+ if(lstatus != NC_NOERR)
+#line 3095
status = lstatus;
+#line 3095
}
+#line 3095
+#line 3095
*xpp = (void *)xp;
+#line 3095
return status;
+#line 3095
#endif
+#line 3095
}
+#line 3095
/* double --------------------------------------------------------------------*/
@@ -13056,7 +23947,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
swapn8b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -13067,51 +23958,92 @@ ncx_getn_double_double(const void **xpp, size_t ndoubles, double *ip)
while(ip < end)
{
struct vax_double *const vdp =
+#line 3120
(struct vax_double *)ip;
+#line 3120
const struct ieee_double *const idp =
+#line 3120
(const struct ieee_double *) (*xpp);
+#line 3120
{
+#line 3120
const struct dbl_limits *lim;
+#line 3120
int ii;
+#line 3120
for (ii = 0, lim = dbl_limits;
+#line 3120
ii < sizeof(dbl_limits)/sizeof(struct dbl_limits);
+#line 3120
ii++, lim++)
+#line 3120
{
+#line 3120
if ((idp->mant_lo == lim->ieee.mant_lo)
+#line 3120
&& (idp->mant_4 == lim->ieee.mant_4)
+#line 3120
&& (idp->mant_5 == lim->ieee.mant_5)
+#line 3120
&& (idp->mant_6 == lim->ieee.mant_6)
+#line 3120
&& (idp->exp_lo == lim->ieee.exp_lo)
+#line 3120
&& (idp->exp_hi == lim->ieee.exp_hi)
+#line 3120
)
+#line 3120
{
+#line 3120
*vdp = lim->d;
+#line 3120
goto doneit;
+#line 3120
}
+#line 3120
}
+#line 3120
}
+#line 3120
{
+#line 3120
unsigned exp = idp->exp_hi << 4 | idp->exp_lo;
+#line 3120
vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
+#line 3120
}
+#line 3120
{
+#line 3120
unsigned mant_hi = ((idp->mant_6 << 16)
+#line 3120
| (idp->mant_5 << 8)
+#line 3120
| idp->mant_4);
+#line 3120
unsigned mant_lo = SWAP4(idp->mant_lo);
+#line 3120
vdp->mantissa1 = (mant_hi >> 13);
+#line 3120
vdp->mantissa2 = ((mant_hi & MASK(13)) << 3)
+#line 3120
| (mant_lo >> 29);
+#line 3120
vdp->mantissa3 = (mant_lo >> 13);
+#line 3120
vdp->mantissa4 = (mant_lo << 3);
+#line 3120
}
+#line 3120
doneit:
+#line 3120
vdp->sign = idp->sign;
+#line 3120
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
}
- return ENOERR;
+ return NC_NOERR;
}
/* vax */
#else
@@ -13119,12 +24051,12 @@ int
ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -13133,589 +24065,1165 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
}
#endif
int
+#line 3145
ncx_getn_double_schar(const void **xpp, size_t nelems, schar *tp)
+#line 3145
{
+#line 3145
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3145
+#line 3145
/* basic algorithm is:
+#line 3145
* - ensure sane alignment of input data
+#line 3145
* - copy (conversion happens automatically) input data
+#line 3145
* to output
+#line 3145
* - update xpp to point at next unconverted input, and tp to point
+#line 3145
* at next location for converted output
+#line 3145
*/
+#line 3145
long i, j, ni;
+#line 3145
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3145
double *xp;
+#line 3145
int nrange = 0; /* number of range errors */
+#line 3145
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3145
long cxp = (long) *((char**)xpp);
+#line 3145
+#line 3145
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3145
/* sjl: manually stripmine so we can limit amount of
+#line 3145
* vector work space reserved to LOOPCNT elements. Also
+#line 3145
* makes vectorisation easy */
+#line 3145
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3145
ni=Min(nelems-j,LOOPCNT);
+#line 3145
if (realign) {
+#line 3145
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3145
xp = tmp;
+#line 3145
} else {
+#line 3145
xp = (double *) *xpp;
+#line 3145
}
+#line 3145
/* copy the next block */
+#line 3145
#pragma cdir loopcnt=LOOPCNT
+#line 3145
#pragma cdir shortloop
+#line 3145
for (i=0; i<ni; i++) {
+#line 3145
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 3145
/* test for range errors (not always needed but do it anyway) */
+#line 3145
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3145
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3145
nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
+#line 3145
}
+#line 3145
/* update xpp and tp */
+#line 3145
if (realign) xp = (double *) *xpp;
+#line 3145
xp += ni;
+#line 3145
tp += ni;
+#line 3145
*xpp = (void*)xp;
+#line 3145
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3145
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3145
+#line 3145
#else /* not SX */
+#line 3145
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3145
+ int status = NC_NOERR;
+#line 3145
+#line 3145
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3145
{
+#line 3145
const int lstatus = ncx_get_double_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3145
+ if(lstatus != NC_NOERR)
+#line 3145
status = lstatus;
+#line 3145
}
+#line 3145
+#line 3145
*xpp = (const void *)xp;
+#line 3145
return status;
+#line 3145
# endif
+#line 3145
}
+#line 3145
int
+#line 3146
ncx_getn_double_short(const void **xpp, size_t nelems, short *tp)
+#line 3146
{
+#line 3146
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3146
+#line 3146
/* basic algorithm is:
+#line 3146
* - ensure sane alignment of input data
+#line 3146
* - copy (conversion happens automatically) input data
+#line 3146
* to output
+#line 3146
* - update xpp to point at next unconverted input, and tp to point
+#line 3146
* at next location for converted output
+#line 3146
*/
+#line 3146
long i, j, ni;
+#line 3146
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3146
double *xp;
+#line 3146
int nrange = 0; /* number of range errors */
+#line 3146
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3146
long cxp = (long) *((char**)xpp);
+#line 3146
+#line 3146
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3146
/* sjl: manually stripmine so we can limit amount of
+#line 3146
* vector work space reserved to LOOPCNT elements. Also
+#line 3146
* makes vectorisation easy */
+#line 3146
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3146
ni=Min(nelems-j,LOOPCNT);
+#line 3146
if (realign) {
+#line 3146
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3146
xp = tmp;
+#line 3146
} else {
+#line 3146
xp = (double *) *xpp;
+#line 3146
}
+#line 3146
/* copy the next block */
+#line 3146
#pragma cdir loopcnt=LOOPCNT
+#line 3146
#pragma cdir shortloop
+#line 3146
for (i=0; i<ni; i++) {
+#line 3146
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 3146
/* test for range errors (not always needed but do it anyway) */
+#line 3146
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3146
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3146
nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
+#line 3146
}
+#line 3146
/* update xpp and tp */
+#line 3146
if (realign) xp = (double *) *xpp;
+#line 3146
xp += ni;
+#line 3146
tp += ni;
+#line 3146
*xpp = (void*)xp;
+#line 3146
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3146
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3146
+#line 3146
#else /* not SX */
+#line 3146
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3146
+ int status = NC_NOERR;
+#line 3146
+#line 3146
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3146
{
+#line 3146
const int lstatus = ncx_get_double_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3146
+ if(lstatus != NC_NOERR)
+#line 3146
status = lstatus;
+#line 3146
}
+#line 3146
+#line 3146
*xpp = (const void *)xp;
+#line 3146
return status;
+#line 3146
# endif
+#line 3146
}
+#line 3146
int
+#line 3147
ncx_getn_double_int(const void **xpp, size_t nelems, int *tp)
+#line 3147
{
+#line 3147
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3147
+#line 3147
/* basic algorithm is:
+#line 3147
* - ensure sane alignment of input data
+#line 3147
* - copy (conversion happens automatically) input data
+#line 3147
* to output
+#line 3147
* - update xpp to point at next unconverted input, and tp to point
+#line 3147
* at next location for converted output
+#line 3147
*/
+#line 3147
long i, j, ni;
+#line 3147
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3147
double *xp;
+#line 3147
int nrange = 0; /* number of range errors */
+#line 3147
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3147
long cxp = (long) *((char**)xpp);
+#line 3147
+#line 3147
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3147
/* sjl: manually stripmine so we can limit amount of
+#line 3147
* vector work space reserved to LOOPCNT elements. Also
+#line 3147
* makes vectorisation easy */
+#line 3147
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3147
ni=Min(nelems-j,LOOPCNT);
+#line 3147
if (realign) {
+#line 3147
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3147
xp = tmp;
+#line 3147
} else {
+#line 3147
xp = (double *) *xpp;
+#line 3147
}
+#line 3147
/* copy the next block */
+#line 3147
#pragma cdir loopcnt=LOOPCNT
+#line 3147
#pragma cdir shortloop
+#line 3147
for (i=0; i<ni; i++) {
+#line 3147
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 3147
/* test for range errors (not always needed but do it anyway) */
+#line 3147
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3147
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3147
nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
+#line 3147
}
+#line 3147
/* update xpp and tp */
+#line 3147
if (realign) xp = (double *) *xpp;
+#line 3147
xp += ni;
+#line 3147
tp += ni;
+#line 3147
*xpp = (void*)xp;
+#line 3147
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3147
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3147
+#line 3147
#else /* not SX */
+#line 3147
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3147
+ int status = NC_NOERR;
+#line 3147
+#line 3147
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3147
{
+#line 3147
const int lstatus = ncx_get_double_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3147
+ if(lstatus != NC_NOERR)
+#line 3147
status = lstatus;
+#line 3147
}
+#line 3147
+#line 3147
*xpp = (const void *)xp;
+#line 3147
return status;
+#line 3147
# endif
+#line 3147
}
+#line 3147
int
+#line 3148
ncx_getn_double_float(const void **xpp, size_t nelems, float *tp)
+#line 3148
{
+#line 3148
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3148
+#line 3148
/* basic algorithm is:
+#line 3148
* - ensure sane alignment of input data
+#line 3148
* - copy (conversion happens automatically) input data
+#line 3148
* to output
+#line 3148
* - update xpp to point at next unconverted input, and tp to point
+#line 3148
* at next location for converted output
+#line 3148
*/
+#line 3148
long i, j, ni;
+#line 3148
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3148
double *xp;
+#line 3148
int nrange = 0; /* number of range errors */
+#line 3148
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3148
long cxp = (long) *((char**)xpp);
+#line 3148
+#line 3148
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3148
/* sjl: manually stripmine so we can limit amount of
+#line 3148
* vector work space reserved to LOOPCNT elements. Also
+#line 3148
* makes vectorisation easy */
+#line 3148
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3148
ni=Min(nelems-j,LOOPCNT);
+#line 3148
if (realign) {
+#line 3148
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3148
xp = tmp;
+#line 3148
} else {
+#line 3148
xp = (double *) *xpp;
+#line 3148
}
+#line 3148
/* copy the next block */
+#line 3148
#pragma cdir loopcnt=LOOPCNT
+#line 3148
#pragma cdir shortloop
+#line 3148
for (i=0; i<ni; i++) {
+#line 3148
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 3148
/* test for range errors (not always needed but do it anyway) */
+#line 3148
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3148
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3148
nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
+#line 3148
}
+#line 3148
/* update xpp and tp */
+#line 3148
if (realign) xp = (double *) *xpp;
+#line 3148
xp += ni;
+#line 3148
tp += ni;
+#line 3148
*xpp = (void*)xp;
+#line 3148
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3148
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3148
+#line 3148
#else /* not SX */
+#line 3148
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3148
+ int status = NC_NOERR;
+#line 3148
+#line 3148
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3148
{
+#line 3148
const int lstatus = ncx_get_double_float(xp, tp);
- if(lstatus != ENOERR)
+#line 3148
+ if(lstatus != NC_NOERR)
+#line 3148
status = lstatus;
+#line 3148
}
+#line 3148
+#line 3148
*xpp = (const void *)xp;
+#line 3148
return status;
+#line 3148
# endif
+#line 3148
}
+#line 3148
int
+#line 3149
ncx_getn_double_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3149
{
+#line 3149
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3149
+#line 3149
/* basic algorithm is:
+#line 3149
* - ensure sane alignment of input data
+#line 3149
* - copy (conversion happens automatically) input data
+#line 3149
* to output
+#line 3149
* - update xpp to point at next unconverted input, and tp to point
+#line 3149
* at next location for converted output
+#line 3149
*/
+#line 3149
long i, j, ni;
+#line 3149
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3149
double *xp;
+#line 3149
int nrange = 0; /* number of range errors */
+#line 3149
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3149
long cxp = (long) *((char**)xpp);
+#line 3149
+#line 3149
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3149
/* sjl: manually stripmine so we can limit amount of
+#line 3149
* vector work space reserved to LOOPCNT elements. Also
+#line 3149
* makes vectorisation easy */
+#line 3149
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3149
ni=Min(nelems-j,LOOPCNT);
+#line 3149
if (realign) {
+#line 3149
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3149
xp = tmp;
+#line 3149
} else {
+#line 3149
xp = (double *) *xpp;
+#line 3149
}
+#line 3149
/* copy the next block */
+#line 3149
#pragma cdir loopcnt=LOOPCNT
+#line 3149
#pragma cdir shortloop
+#line 3149
for (i=0; i<ni; i++) {
+#line 3149
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 3149
/* test for range errors (not always needed but do it anyway) */
+#line 3149
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3149
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3149
nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
+#line 3149
}
+#line 3149
/* update xpp and tp */
+#line 3149
if (realign) xp = (double *) *xpp;
+#line 3149
xp += ni;
+#line 3149
tp += ni;
+#line 3149
*xpp = (void*)xp;
+#line 3149
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3149
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3149
+#line 3149
#else /* not SX */
+#line 3149
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3149
+ int status = NC_NOERR;
+#line 3149
+#line 3149
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3149
{
+#line 3149
const int lstatus = ncx_get_double_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3149
+ if(lstatus != NC_NOERR)
+#line 3149
status = lstatus;
+#line 3149
}
+#line 3149
+#line 3149
*xpp = (const void *)xp;
+#line 3149
return status;
+#line 3149
# endif
+#line 3149
}
+#line 3149
int
+#line 3150
ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 3150
{
+#line 3150
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3150
+#line 3150
/* basic algorithm is:
+#line 3150
* - ensure sane alignment of input data
+#line 3150
* - copy (conversion happens automatically) input data
+#line 3150
* to output
+#line 3150
* - update xpp to point at next unconverted input, and tp to point
+#line 3150
* at next location for converted output
+#line 3150
*/
+#line 3150
long i, j, ni;
+#line 3150
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3150
double *xp;
+#line 3150
int nrange = 0; /* number of range errors */
+#line 3150
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3150
long cxp = (long) *((char**)xpp);
+#line 3150
+#line 3150
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3150
/* sjl: manually stripmine so we can limit amount of
+#line 3150
* vector work space reserved to LOOPCNT elements. Also
+#line 3150
* makes vectorisation easy */
+#line 3150
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3150
ni=Min(nelems-j,LOOPCNT);
+#line 3150
if (realign) {
+#line 3150
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3150
xp = tmp;
+#line 3150
} else {
+#line 3150
xp = (double *) *xpp;
+#line 3150
}
+#line 3150
/* copy the next block */
+#line 3150
#pragma cdir loopcnt=LOOPCNT
+#line 3150
#pragma cdir shortloop
+#line 3150
for (i=0; i<ni; i++) {
+#line 3150
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 3150
/* test for range errors (not always needed but do it anyway) */
+#line 3150
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3150
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3150
nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
+#line 3150
}
+#line 3150
/* update xpp and tp */
+#line 3150
if (realign) xp = (double *) *xpp;
+#line 3150
xp += ni;
+#line 3150
tp += ni;
+#line 3150
*xpp = (void*)xp;
+#line 3150
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3150
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3150
+#line 3150
#else /* not SX */
+#line 3150
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3150
+ int status = NC_NOERR;
+#line 3150
+#line 3150
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3150
{
+#line 3150
const int lstatus = ncx_get_double_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3150
+ if(lstatus != NC_NOERR)
+#line 3150
status = lstatus;
+#line 3150
}
+#line 3150
+#line 3150
*xpp = (const void *)xp;
+#line 3150
return status;
+#line 3150
# endif
+#line 3150
}
+#line 3150
int
+#line 3151
ncx_getn_double_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 3151
{
+#line 3151
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3151
+#line 3151
/* basic algorithm is:
+#line 3151
* - ensure sane alignment of input data
+#line 3151
* - copy (conversion happens automatically) input data
+#line 3151
* to output
+#line 3151
* - update xpp to point at next unconverted input, and tp to point
+#line 3151
* at next location for converted output
+#line 3151
*/
+#line 3151
long i, j, ni;
+#line 3151
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3151
double *xp;
+#line 3151
int nrange = 0; /* number of range errors */
+#line 3151
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3151
long cxp = (long) *((char**)xpp);
+#line 3151
+#line 3151
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3151
/* sjl: manually stripmine so we can limit amount of
+#line 3151
* vector work space reserved to LOOPCNT elements. Also
+#line 3151
* makes vectorisation easy */
+#line 3151
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3151
ni=Min(nelems-j,LOOPCNT);
+#line 3151
if (realign) {
+#line 3151
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3151
xp = tmp;
+#line 3151
} else {
+#line 3151
xp = (double *) *xpp;
+#line 3151
}
+#line 3151
/* copy the next block */
+#line 3151
#pragma cdir loopcnt=LOOPCNT
+#line 3151
#pragma cdir shortloop
+#line 3151
for (i=0; i<ni; i++) {
+#line 3151
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 3151
/* test for range errors (not always needed but do it anyway) */
+#line 3151
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3151
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3151
nrange += xp[i] > USHORT_MAX || xp[i] < 0;
+#line 3151
}
+#line 3151
/* update xpp and tp */
+#line 3151
if (realign) xp = (double *) *xpp;
+#line 3151
xp += ni;
+#line 3151
tp += ni;
+#line 3151
*xpp = (void*)xp;
+#line 3151
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3151
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3151
+#line 3151
#else /* not SX */
+#line 3151
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3151
+ int status = NC_NOERR;
+#line 3151
+#line 3151
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3151
{
+#line 3151
const int lstatus = ncx_get_double_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3151
+ if(lstatus != NC_NOERR)
+#line 3151
status = lstatus;
+#line 3151
}
+#line 3151
+#line 3151
*xpp = (const void *)xp;
+#line 3151
return status;
+#line 3151
# endif
+#line 3151
}
+#line 3151
int
+#line 3152
ncx_getn_double_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3152
{
+#line 3152
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3152
+#line 3152
/* basic algorithm is:
+#line 3152
* - ensure sane alignment of input data
+#line 3152
* - copy (conversion happens automatically) input data
+#line 3152
* to output
+#line 3152
* - update xpp to point at next unconverted input, and tp to point
+#line 3152
* at next location for converted output
+#line 3152
*/
+#line 3152
long i, j, ni;
+#line 3152
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3152
double *xp;
+#line 3152
int nrange = 0; /* number of range errors */
+#line 3152
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3152
long cxp = (long) *((char**)xpp);
+#line 3152
+#line 3152
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3152
/* sjl: manually stripmine so we can limit amount of
+#line 3152
* vector work space reserved to LOOPCNT elements. Also
+#line 3152
* makes vectorisation easy */
+#line 3152
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3152
ni=Min(nelems-j,LOOPCNT);
+#line 3152
if (realign) {
+#line 3152
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3152
xp = tmp;
+#line 3152
} else {
+#line 3152
xp = (double *) *xpp;
+#line 3152
}
+#line 3152
/* copy the next block */
+#line 3152
#pragma cdir loopcnt=LOOPCNT
+#line 3152
#pragma cdir shortloop
+#line 3152
for (i=0; i<ni; i++) {
+#line 3152
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 3152
/* test for range errors (not always needed but do it anyway) */
+#line 3152
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3152
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3152
nrange += xp[i] > UINT_MAX || xp[i] < 0;
+#line 3152
}
+#line 3152
/* update xpp and tp */
+#line 3152
if (realign) xp = (double *) *xpp;
+#line 3152
xp += ni;
+#line 3152
tp += ni;
+#line 3152
*xpp = (void*)xp;
+#line 3152
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3152
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3152
+#line 3152
#else /* not SX */
+#line 3152
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3152
+ int status = NC_NOERR;
+#line 3152
+#line 3152
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3152
{
+#line 3152
const int lstatus = ncx_get_double_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3152
+ if(lstatus != NC_NOERR)
+#line 3152
status = lstatus;
+#line 3152
}
+#line 3152
+#line 3152
*xpp = (const void *)xp;
+#line 3152
return status;
+#line 3152
# endif
+#line 3152
}
+#line 3152
int
+#line 3153
ncx_getn_double_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 3153
{
+#line 3153
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3153
+#line 3153
/* basic algorithm is:
+#line 3153
* - ensure sane alignment of input data
+#line 3153
* - copy (conversion happens automatically) input data
+#line 3153
* to output
+#line 3153
* - update xpp to point at next unconverted input, and tp to point
+#line 3153
* at next location for converted output
+#line 3153
*/
+#line 3153
long i, j, ni;
+#line 3153
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3153
double *xp;
+#line 3153
int nrange = 0; /* number of range errors */
+#line 3153
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3153
long cxp = (long) *((char**)xpp);
+#line 3153
+#line 3153
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3153
/* sjl: manually stripmine so we can limit amount of
+#line 3153
* vector work space reserved to LOOPCNT elements. Also
+#line 3153
* makes vectorisation easy */
+#line 3153
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3153
ni=Min(nelems-j,LOOPCNT);
+#line 3153
if (realign) {
+#line 3153
memcpy(tmp, *xpp, ni*SIZEOF_DOUBLE);
+#line 3153
xp = tmp;
+#line 3153
} else {
+#line 3153
xp = (double *) *xpp;
+#line 3153
}
+#line 3153
/* copy the next block */
+#line 3153
#pragma cdir loopcnt=LOOPCNT
+#line 3153
#pragma cdir shortloop
+#line 3153
for (i=0; i<ni; i++) {
+#line 3153
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 3153
/* test for range errors (not always needed but do it anyway) */
+#line 3153
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3153
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3153
nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
+#line 3153
}
+#line 3153
/* update xpp and tp */
+#line 3153
if (realign) xp = (double *) *xpp;
+#line 3153
xp += ni;
+#line 3153
tp += ni;
+#line 3153
*xpp = (void*)xp;
+#line 3153
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3153
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3153
+#line 3153
#else /* not SX */
+#line 3153
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3153
+ int status = NC_NOERR;
+#line 3153
+#line 3153
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3153
{
+#line 3153
const int lstatus = ncx_get_double_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3153
+ if(lstatus != NC_NOERR)
+#line 3153
status = lstatus;
+#line 3153
}
+#line 3153
+#line 3153
*xpp = (const void *)xp;
+#line 3153
return status;
+#line 3153
# endif
+#line 3153
}
+#line 3153
#if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT)
@@ -13729,7 +25237,7 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
swapn8b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -13740,69 +25248,128 @@ ncx_putn_double_double(void **xpp, size_t ndoubles, const double *ip)
while(ip < end)
{
const struct vax_double *const vdp =
+#line 3176
(const struct vax_double *)ip;
+#line 3176
struct ieee_double *const idp =
+#line 3176
(struct ieee_double *) (*xpp);
+#line 3176
+#line 3176
if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) &&
+#line 3176
(vdp->mantissa3 == dbl_limits[0].d.mantissa3) &&
+#line 3176
(vdp->mantissa2 == dbl_limits[0].d.mantissa2) &&
+#line 3176
(vdp->mantissa1 == dbl_limits[0].d.mantissa1) &&
+#line 3176
(vdp->exp == dbl_limits[0].d.exp))
+#line 3176
{
+#line 3176
*idp = dbl_limits[0].ieee;
+#line 3176
goto shipit;
+#line 3176
}
+#line 3176
if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) &&
+#line 3176
(vdp->mantissa3 == dbl_limits[1].d.mantissa3) &&
+#line 3176
(vdp->mantissa2 == dbl_limits[1].d.mantissa2) &&
+#line 3176
(vdp->mantissa1 == dbl_limits[1].d.mantissa1) &&
+#line 3176
(vdp->exp == dbl_limits[1].d.exp))
+#line 3176
{
+#line 3176
*idp = dbl_limits[1].ieee;
+#line 3176
goto shipit;
+#line 3176
}
+#line 3176
+#line 3176
{
+#line 3176
unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
+#line 3176
+#line 3176
unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) |
+#line 3176
(vdp->mantissa3 << 13) |
+#line 3176
((vdp->mantissa4 >> 3) & MASK(13));
+#line 3176
+#line 3176
unsigned mant_hi = (vdp->mantissa1 << 13)
+#line 3176
| (vdp->mantissa2 >> 3);
+#line 3176
+#line 3176
if((vdp->mantissa4 & 7) > 4)
+#line 3176
{
+#line 3176
/* round up */
+#line 3176
mant_lo++;
+#line 3176
if(mant_lo == 0)
+#line 3176
{
+#line 3176
mant_hi++;
+#line 3176
if(mant_hi > 0xffffff)
+#line 3176
{
+#line 3176
mant_hi = 0;
+#line 3176
exp++;
+#line 3176
}
+#line 3176
}
+#line 3176
}
+#line 3176
+#line 3176
idp->mant_lo = SWAP4(mant_lo);
+#line 3176
idp->mant_6 = mant_hi >> 16;
+#line 3176
idp->mant_5 = (mant_hi & 0xff00) >> 8;
+#line 3176
idp->mant_4 = mant_hi;
+#line 3176
idp->exp_hi = exp >> 4;
+#line 3176
idp->exp_lo = exp;
+#line 3176
}
+#line 3176
+#line 3176
shipit:
+#line 3176
idp->sign = vdp->sign;
+#line 3176
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
}
- return ENOERR;
+ return NC_NOERR;
}
/* vax */
#else
@@ -13810,12 +25377,12 @@ int
ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
int lstatus = ncx_put_double_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -13824,634 +25391,1255 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
}
#endif
int
+#line 3201
ncx_putn_double_schar(void **xpp, size_t nelems, const schar *tp)
+#line 3201
{
+#line 3201
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3201
+#line 3201
/* basic algorithm is:
+#line 3201
* - ensure sane alignment of output data
+#line 3201
* - copy (conversion happens automatically) input data
+#line 3201
* to output
+#line 3201
* - update tp to point at next unconverted input, and xpp to point
+#line 3201
* at next location for converted output
+#line 3201
*/
+#line 3201
long i, j, ni;
+#line 3201
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3201
double *xp;
+#line 3201
int nrange = 0; /* number of range errors */
+#line 3201
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3201
long cxp = (long) *((char**)xpp);
+#line 3201
+#line 3201
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3201
/* sjl: manually stripmine so we can limit amount of
+#line 3201
* vector work space reserved to LOOPCNT elements. Also
+#line 3201
* makes vectorisation easy */
+#line 3201
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3201
ni=Min(nelems-j,LOOPCNT);
+#line 3201
if (realign) {
+#line 3201
xp = tmp;
+#line 3201
} else {
+#line 3201
xp = (double *) *xpp;
+#line 3201
}
+#line 3201
/* copy the next block */
+#line 3201
#pragma cdir loopcnt=LOOPCNT
+#line 3201
#pragma cdir shortloop
+#line 3201
for (i=0; i<ni; i++) {
+#line 3201
/* the normal case: */
+#line 3201
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3201
/* test for range errors (not always needed but do it anyway) */
+#line 3201
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3201
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3201
nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
+#line 3201
}
+#line 3201
/* copy workspace back if necessary */
+#line 3201
if (realign) {
+#line 3201
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3201
xp = (double *) *xpp;
+#line 3201
}
+#line 3201
/* update xpp and tp */
+#line 3201
xp += ni;
+#line 3201
tp += ni;
+#line 3201
*xpp = (void*)xp;
+#line 3201
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3201
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3201
+#line 3201
#else /* not SX */
+#line 3201
+#line 3201
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3201
+ int status = NC_NOERR;
+#line 3201
+#line 3201
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3201
{
+#line 3201
int lstatus = ncx_put_double_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3201
+ if(lstatus != NC_NOERR)
+#line 3201
status = lstatus;
+#line 3201
}
+#line 3201
+#line 3201
*xpp = (void *)xp;
+#line 3201
return status;
+#line 3201
#endif
+#line 3201
}
+#line 3201
int
+#line 3202
ncx_putn_double_short(void **xpp, size_t nelems, const short *tp)
+#line 3202
{
+#line 3202
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3202
+#line 3202
/* basic algorithm is:
+#line 3202
* - ensure sane alignment of output data
+#line 3202
* - copy (conversion happens automatically) input data
+#line 3202
* to output
+#line 3202
* - update tp to point at next unconverted input, and xpp to point
+#line 3202
* at next location for converted output
+#line 3202
*/
+#line 3202
long i, j, ni;
+#line 3202
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3202
double *xp;
+#line 3202
int nrange = 0; /* number of range errors */
+#line 3202
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3202
long cxp = (long) *((char**)xpp);
+#line 3202
+#line 3202
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3202
/* sjl: manually stripmine so we can limit amount of
+#line 3202
* vector work space reserved to LOOPCNT elements. Also
+#line 3202
* makes vectorisation easy */
+#line 3202
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3202
ni=Min(nelems-j,LOOPCNT);
+#line 3202
if (realign) {
+#line 3202
xp = tmp;
+#line 3202
} else {
+#line 3202
xp = (double *) *xpp;
+#line 3202
}
+#line 3202
/* copy the next block */
+#line 3202
#pragma cdir loopcnt=LOOPCNT
+#line 3202
#pragma cdir shortloop
+#line 3202
for (i=0; i<ni; i++) {
+#line 3202
/* the normal case: */
+#line 3202
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3202
/* test for range errors (not always needed but do it anyway) */
+#line 3202
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3202
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3202
nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
+#line 3202
}
+#line 3202
/* copy workspace back if necessary */
+#line 3202
if (realign) {
+#line 3202
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3202
xp = (double *) *xpp;
+#line 3202
}
+#line 3202
/* update xpp and tp */
+#line 3202
xp += ni;
+#line 3202
tp += ni;
+#line 3202
*xpp = (void*)xp;
+#line 3202
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3202
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3202
+#line 3202
#else /* not SX */
+#line 3202
+#line 3202
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3202
+ int status = NC_NOERR;
+#line 3202
+#line 3202
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3202
{
+#line 3202
int lstatus = ncx_put_double_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3202
+ if(lstatus != NC_NOERR)
+#line 3202
status = lstatus;
+#line 3202
}
+#line 3202
+#line 3202
*xpp = (void *)xp;
+#line 3202
return status;
+#line 3202
#endif
+#line 3202
}
+#line 3202
int
+#line 3203
ncx_putn_double_int(void **xpp, size_t nelems, const int *tp)
+#line 3203
{
+#line 3203
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3203
+#line 3203
/* basic algorithm is:
+#line 3203
* - ensure sane alignment of output data
+#line 3203
* - copy (conversion happens automatically) input data
+#line 3203
* to output
+#line 3203
* - update tp to point at next unconverted input, and xpp to point
+#line 3203
* at next location for converted output
+#line 3203
*/
+#line 3203
long i, j, ni;
+#line 3203
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3203
double *xp;
+#line 3203
int nrange = 0; /* number of range errors */
+#line 3203
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3203
long cxp = (long) *((char**)xpp);
+#line 3203
+#line 3203
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3203
/* sjl: manually stripmine so we can limit amount of
+#line 3203
* vector work space reserved to LOOPCNT elements. Also
+#line 3203
* makes vectorisation easy */
+#line 3203
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3203
ni=Min(nelems-j,LOOPCNT);
+#line 3203
if (realign) {
+#line 3203
xp = tmp;
+#line 3203
} else {
+#line 3203
xp = (double *) *xpp;
+#line 3203
}
+#line 3203
/* copy the next block */
+#line 3203
#pragma cdir loopcnt=LOOPCNT
+#line 3203
#pragma cdir shortloop
+#line 3203
for (i=0; i<ni; i++) {
+#line 3203
/* the normal case: */
+#line 3203
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3203
/* test for range errors (not always needed but do it anyway) */
+#line 3203
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3203
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3203
nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
+#line 3203
}
+#line 3203
/* copy workspace back if necessary */
+#line 3203
if (realign) {
+#line 3203
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3203
xp = (double *) *xpp;
+#line 3203
}
+#line 3203
/* update xpp and tp */
+#line 3203
xp += ni;
+#line 3203
tp += ni;
+#line 3203
*xpp = (void*)xp;
+#line 3203
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3203
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3203
+#line 3203
#else /* not SX */
+#line 3203
+#line 3203
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3203
+ int status = NC_NOERR;
+#line 3203
+#line 3203
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3203
{
+#line 3203
int lstatus = ncx_put_double_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3203
+ if(lstatus != NC_NOERR)
+#line 3203
status = lstatus;
+#line 3203
}
+#line 3203
+#line 3203
*xpp = (void *)xp;
+#line 3203
return status;
+#line 3203
#endif
+#line 3203
}
+#line 3203
int
+#line 3204
ncx_putn_double_float(void **xpp, size_t nelems, const float *tp)
+#line 3204
{
+#line 3204
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3204
+#line 3204
/* basic algorithm is:
+#line 3204
* - ensure sane alignment of output data
+#line 3204
* - copy (conversion happens automatically) input data
+#line 3204
* to output
+#line 3204
* - update tp to point at next unconverted input, and xpp to point
+#line 3204
* at next location for converted output
+#line 3204
*/
+#line 3204
long i, j, ni;
+#line 3204
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3204
double *xp;
+#line 3204
int nrange = 0; /* number of range errors */
+#line 3204
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3204
long cxp = (long) *((char**)xpp);
+#line 3204
+#line 3204
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3204
/* sjl: manually stripmine so we can limit amount of
+#line 3204
* vector work space reserved to LOOPCNT elements. Also
+#line 3204
* makes vectorisation easy */
+#line 3204
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3204
ni=Min(nelems-j,LOOPCNT);
+#line 3204
if (realign) {
+#line 3204
xp = tmp;
+#line 3204
} else {
+#line 3204
xp = (double *) *xpp;
+#line 3204
}
+#line 3204
/* copy the next block */
+#line 3204
#pragma cdir loopcnt=LOOPCNT
+#line 3204
#pragma cdir shortloop
+#line 3204
for (i=0; i<ni; i++) {
+#line 3204
/* the normal case: */
+#line 3204
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3204
/* test for range errors (not always needed but do it anyway) */
+#line 3204
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3204
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3204
nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
+#line 3204
}
+#line 3204
/* copy workspace back if necessary */
+#line 3204
if (realign) {
+#line 3204
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3204
xp = (double *) *xpp;
+#line 3204
}
+#line 3204
/* update xpp and tp */
+#line 3204
xp += ni;
+#line 3204
tp += ni;
+#line 3204
*xpp = (void*)xp;
+#line 3204
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3204
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3204
+#line 3204
#else /* not SX */
+#line 3204
+#line 3204
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3204
+ int status = NC_NOERR;
+#line 3204
+#line 3204
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3204
{
+#line 3204
int lstatus = ncx_put_double_float(xp, tp);
- if(lstatus != ENOERR)
+#line 3204
+ if(lstatus != NC_NOERR)
+#line 3204
status = lstatus;
+#line 3204
}
+#line 3204
+#line 3204
*xpp = (void *)xp;
+#line 3204
return status;
+#line 3204
#endif
+#line 3204
}
+#line 3204
int
+#line 3205
ncx_putn_double_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 3205
{
+#line 3205
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3205
+#line 3205
/* basic algorithm is:
+#line 3205
* - ensure sane alignment of output data
+#line 3205
* - copy (conversion happens automatically) input data
+#line 3205
* to output
+#line 3205
* - update tp to point at next unconverted input, and xpp to point
+#line 3205
* at next location for converted output
+#line 3205
*/
+#line 3205
long i, j, ni;
+#line 3205
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3205
double *xp;
+#line 3205
int nrange = 0; /* number of range errors */
+#line 3205
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3205
long cxp = (long) *((char**)xpp);
+#line 3205
+#line 3205
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3205
/* sjl: manually stripmine so we can limit amount of
+#line 3205
* vector work space reserved to LOOPCNT elements. Also
+#line 3205
* makes vectorisation easy */
+#line 3205
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3205
ni=Min(nelems-j,LOOPCNT);
+#line 3205
if (realign) {
+#line 3205
xp = tmp;
+#line 3205
} else {
+#line 3205
xp = (double *) *xpp;
+#line 3205
}
+#line 3205
/* copy the next block */
+#line 3205
#pragma cdir loopcnt=LOOPCNT
+#line 3205
#pragma cdir shortloop
+#line 3205
for (i=0; i<ni; i++) {
+#line 3205
/* the normal case: */
+#line 3205
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3205
/* test for range errors (not always needed but do it anyway) */
+#line 3205
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3205
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3205
nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
+#line 3205
}
+#line 3205
/* copy workspace back if necessary */
+#line 3205
if (realign) {
+#line 3205
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3205
xp = (double *) *xpp;
+#line 3205
}
+#line 3205
/* update xpp and tp */
+#line 3205
xp += ni;
+#line 3205
tp += ni;
+#line 3205
*xpp = (void*)xp;
+#line 3205
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3205
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3205
+#line 3205
#else /* not SX */
+#line 3205
+#line 3205
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3205
+ int status = NC_NOERR;
+#line 3205
+#line 3205
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3205
{
+#line 3205
int lstatus = ncx_put_double_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3205
+ if(lstatus != NC_NOERR)
+#line 3205
status = lstatus;
+#line 3205
}
+#line 3205
+#line 3205
*xpp = (void *)xp;
+#line 3205
return status;
+#line 3205
#endif
+#line 3205
}
+#line 3205
int
+#line 3206
ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 3206
{
+#line 3206
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3206
+#line 3206
/* basic algorithm is:
+#line 3206
* - ensure sane alignment of output data
+#line 3206
* - copy (conversion happens automatically) input data
+#line 3206
* to output
+#line 3206
* - update tp to point at next unconverted input, and xpp to point
+#line 3206
* at next location for converted output
+#line 3206
*/
+#line 3206
long i, j, ni;
+#line 3206
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3206
double *xp;
+#line 3206
int nrange = 0; /* number of range errors */
+#line 3206
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3206
long cxp = (long) *((char**)xpp);
+#line 3206
+#line 3206
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3206
/* sjl: manually stripmine so we can limit amount of
+#line 3206
* vector work space reserved to LOOPCNT elements. Also
+#line 3206
* makes vectorisation easy */
+#line 3206
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3206
ni=Min(nelems-j,LOOPCNT);
+#line 3206
if (realign) {
+#line 3206
xp = tmp;
+#line 3206
} else {
+#line 3206
xp = (double *) *xpp;
+#line 3206
}
+#line 3206
/* copy the next block */
+#line 3206
#pragma cdir loopcnt=LOOPCNT
+#line 3206
#pragma cdir shortloop
+#line 3206
for (i=0; i<ni; i++) {
+#line 3206
/* the normal case: */
+#line 3206
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3206
/* test for range errors (not always needed but do it anyway) */
+#line 3206
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3206
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3206
nrange += tp[i] > X_DOUBLE_MAX ;
+#line 3206
}
+#line 3206
/* copy workspace back if necessary */
+#line 3206
if (realign) {
+#line 3206
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3206
xp = (double *) *xpp;
+#line 3206
}
+#line 3206
/* update xpp and tp */
+#line 3206
xp += ni;
+#line 3206
tp += ni;
+#line 3206
*xpp = (void*)xp;
+#line 3206
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3206
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3206
+#line 3206
#else /* not SX */
+#line 3206
+#line 3206
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3206
+ int status = NC_NOERR;
+#line 3206
+#line 3206
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3206
{
+#line 3206
int lstatus = ncx_put_double_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3206
+ if(lstatus != NC_NOERR)
+#line 3206
status = lstatus;
+#line 3206
}
+#line 3206
+#line 3206
*xpp = (void *)xp;
+#line 3206
return status;
+#line 3206
#endif
+#line 3206
}
+#line 3206
int
+#line 3207
ncx_putn_double_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 3207
{
+#line 3207
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3207
+#line 3207
/* basic algorithm is:
+#line 3207
* - ensure sane alignment of output data
+#line 3207
* - copy (conversion happens automatically) input data
+#line 3207
* to output
+#line 3207
* - update tp to point at next unconverted input, and xpp to point
+#line 3207
* at next location for converted output
+#line 3207
*/
+#line 3207
long i, j, ni;
+#line 3207
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3207
double *xp;
+#line 3207
int nrange = 0; /* number of range errors */
+#line 3207
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3207
long cxp = (long) *((char**)xpp);
+#line 3207
+#line 3207
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3207
/* sjl: manually stripmine so we can limit amount of
+#line 3207
* vector work space reserved to LOOPCNT elements. Also
+#line 3207
* makes vectorisation easy */
+#line 3207
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3207
ni=Min(nelems-j,LOOPCNT);
+#line 3207
if (realign) {
+#line 3207
xp = tmp;
+#line 3207
} else {
+#line 3207
xp = (double *) *xpp;
+#line 3207
}
+#line 3207
/* copy the next block */
+#line 3207
#pragma cdir loopcnt=LOOPCNT
+#line 3207
#pragma cdir shortloop
+#line 3207
for (i=0; i<ni; i++) {
+#line 3207
/* the normal case: */
+#line 3207
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3207
/* test for range errors (not always needed but do it anyway) */
+#line 3207
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3207
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3207
nrange += tp[i] > X_DOUBLE_MAX ;
+#line 3207
}
+#line 3207
/* copy workspace back if necessary */
+#line 3207
if (realign) {
+#line 3207
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3207
xp = (double *) *xpp;
+#line 3207
}
+#line 3207
/* update xpp and tp */
+#line 3207
xp += ni;
+#line 3207
tp += ni;
+#line 3207
*xpp = (void*)xp;
+#line 3207
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3207
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3207
+#line 3207
#else /* not SX */
+#line 3207
+#line 3207
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3207
+ int status = NC_NOERR;
+#line 3207
+#line 3207
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3207
{
+#line 3207
int lstatus = ncx_put_double_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3207
+ if(lstatus != NC_NOERR)
+#line 3207
status = lstatus;
+#line 3207
}
+#line 3207
+#line 3207
*xpp = (void *)xp;
+#line 3207
return status;
+#line 3207
#endif
+#line 3207
}
+#line 3207
int
+#line 3208
ncx_putn_double_uint(void **xpp, size_t nelems, const uint *tp)
+#line 3208
{
+#line 3208
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3208
+#line 3208
/* basic algorithm is:
+#line 3208
* - ensure sane alignment of output data
+#line 3208
* - copy (conversion happens automatically) input data
+#line 3208
* to output
+#line 3208
* - update tp to point at next unconverted input, and xpp to point
+#line 3208
* at next location for converted output
+#line 3208
*/
+#line 3208
long i, j, ni;
+#line 3208
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3208
double *xp;
+#line 3208
int nrange = 0; /* number of range errors */
+#line 3208
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3208
long cxp = (long) *((char**)xpp);
+#line 3208
+#line 3208
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3208
/* sjl: manually stripmine so we can limit amount of
+#line 3208
* vector work space reserved to LOOPCNT elements. Also
+#line 3208
* makes vectorisation easy */
+#line 3208
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3208
ni=Min(nelems-j,LOOPCNT);
+#line 3208
if (realign) {
+#line 3208
xp = tmp;
+#line 3208
} else {
+#line 3208
xp = (double *) *xpp;
+#line 3208
}
+#line 3208
/* copy the next block */
+#line 3208
#pragma cdir loopcnt=LOOPCNT
+#line 3208
#pragma cdir shortloop
+#line 3208
for (i=0; i<ni; i++) {
+#line 3208
/* the normal case: */
+#line 3208
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3208
/* test for range errors (not always needed but do it anyway) */
+#line 3208
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3208
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3208
nrange += tp[i] > X_DOUBLE_MAX ;
+#line 3208
}
+#line 3208
/* copy workspace back if necessary */
+#line 3208
if (realign) {
+#line 3208
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3208
xp = (double *) *xpp;
+#line 3208
}
+#line 3208
/* update xpp and tp */
+#line 3208
xp += ni;
+#line 3208
tp += ni;
+#line 3208
*xpp = (void*)xp;
+#line 3208
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3208
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3208
+#line 3208
#else /* not SX */
+#line 3208
+#line 3208
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3208
+ int status = NC_NOERR;
+#line 3208
+#line 3208
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3208
{
+#line 3208
int lstatus = ncx_put_double_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3208
+ if(lstatus != NC_NOERR)
+#line 3208
status = lstatus;
+#line 3208
}
+#line 3208
+#line 3208
*xpp = (void *)xp;
+#line 3208
return status;
+#line 3208
#endif
+#line 3208
}
+#line 3208
int
+#line 3209
ncx_putn_double_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 3209
{
+#line 3209
#if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
+#line 3209
+#line 3209
/* basic algorithm is:
+#line 3209
* - ensure sane alignment of output data
+#line 3209
* - copy (conversion happens automatically) input data
+#line 3209
* to output
+#line 3209
* - update tp to point at next unconverted input, and xpp to point
+#line 3209
* at next location for converted output
+#line 3209
*/
+#line 3209
long i, j, ni;
+#line 3209
double tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3209
double *xp;
+#line 3209
int nrange = 0; /* number of range errors */
+#line 3209
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3209
long cxp = (long) *((char**)xpp);
+#line 3209
+#line 3209
realign = (cxp & 7) % SIZEOF_DOUBLE;
+#line 3209
/* sjl: manually stripmine so we can limit amount of
+#line 3209
* vector work space reserved to LOOPCNT elements. Also
+#line 3209
* makes vectorisation easy */
+#line 3209
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3209
ni=Min(nelems-j,LOOPCNT);
+#line 3209
if (realign) {
+#line 3209
xp = tmp;
+#line 3209
} else {
+#line 3209
xp = (double *) *xpp;
+#line 3209
}
+#line 3209
/* copy the next block */
+#line 3209
#pragma cdir loopcnt=LOOPCNT
+#line 3209
#pragma cdir shortloop
+#line 3209
for (i=0; i<ni; i++) {
+#line 3209
/* the normal case: */
+#line 3209
xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
+#line 3209
/* test for range errors (not always needed but do it anyway) */
+#line 3209
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3209
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3209
nrange += tp[i] > X_DOUBLE_MAX ;
+#line 3209
}
+#line 3209
/* copy workspace back if necessary */
+#line 3209
if (realign) {
+#line 3209
memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE);
+#line 3209
xp = (double *) *xpp;
+#line 3209
}
+#line 3209
/* update xpp and tp */
+#line 3209
xp += ni;
+#line 3209
tp += ni;
+#line 3209
*xpp = (void*)xp;
+#line 3209
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3209
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3209
+#line 3209
#else /* not SX */
+#line 3209
+#line 3209
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3209
+ int status = NC_NOERR;
+#line 3209
+#line 3209
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
+#line 3209
{
+#line 3209
int lstatus = ncx_put_double_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3209
+ if(lstatus != NC_NOERR)
+#line 3209
status = lstatus;
+#line 3209
}
+#line 3209
+#line 3209
*xpp = (void *)xp;
+#line 3209
return status;
+#line 3209
#endif
+#line 3209
}
+#line 3209
@@ -14468,659 +26656,1299 @@ ncx_getn_longlong_longlong(const void **xpp, size_t nelems, long long *tp)
swapn8b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_LONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 3228
ncx_getn_longlong_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3228
{
+#line 3228
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3228
+#line 3228
/* basic algorithm is:
+#line 3228
* - ensure sane alignment of input data
+#line 3228
* - copy (conversion happens automatically) input data
+#line 3228
* to output
+#line 3228
* - update xpp to point at next unconverted input, and tp to point
+#line 3228
* at next location for converted output
+#line 3228
*/
+#line 3228
long i, j, ni;
+#line 3228
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3228
longlong *xp;
+#line 3228
int nrange = 0; /* number of range errors */
+#line 3228
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3228
long cxp = (long) *((char**)xpp);
+#line 3228
+#line 3228
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3228
/* sjl: manually stripmine so we can limit amount of
+#line 3228
* vector work space reserved to LOOPCNT elements. Also
+#line 3228
* makes vectorisation easy */
+#line 3228
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3228
ni=Min(nelems-j,LOOPCNT);
+#line 3228
if (realign) {
+#line 3228
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3228
xp = tmp;
+#line 3228
} else {
+#line 3228
xp = (longlong *) *xpp;
+#line 3228
}
+#line 3228
/* copy the next block */
+#line 3228
#pragma cdir loopcnt=LOOPCNT
+#line 3228
#pragma cdir shortloop
+#line 3228
for (i=0; i<ni; i++) {
+#line 3228
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 3228
/* test for range errors (not always needed but do it anyway) */
+#line 3228
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3228
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3228
nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
+#line 3228
}
+#line 3228
/* update xpp and tp */
+#line 3228
if (realign) xp = (longlong *) *xpp;
+#line 3228
xp += ni;
+#line 3228
tp += ni;
+#line 3228
*xpp = (void*)xp;
+#line 3228
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3228
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3228
+#line 3228
#else /* not SX */
+#line 3228
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3228
+ int status = NC_NOERR;
+#line 3228
+#line 3228
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3228
{
+#line 3228
const int lstatus = ncx_get_longlong_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3228
+ if(lstatus != NC_NOERR)
+#line 3228
status = lstatus;
+#line 3228
}
+#line 3228
+#line 3228
*xpp = (const void *)xp;
+#line 3228
return status;
+#line 3228
# endif
+#line 3228
}
+#line 3228
#endif
int
+#line 3230
ncx_getn_longlong_schar(const void **xpp, size_t nelems, schar *tp)
+#line 3230
{
+#line 3230
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3230
+#line 3230
/* basic algorithm is:
+#line 3230
* - ensure sane alignment of input data
+#line 3230
* - copy (conversion happens automatically) input data
+#line 3230
* to output
+#line 3230
* - update xpp to point at next unconverted input, and tp to point
+#line 3230
* at next location for converted output
+#line 3230
*/
+#line 3230
long i, j, ni;
+#line 3230
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3230
longlong *xp;
+#line 3230
int nrange = 0; /* number of range errors */
+#line 3230
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3230
long cxp = (long) *((char**)xpp);
+#line 3230
+#line 3230
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3230
/* sjl: manually stripmine so we can limit amount of
+#line 3230
* vector work space reserved to LOOPCNT elements. Also
+#line 3230
* makes vectorisation easy */
+#line 3230
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3230
ni=Min(nelems-j,LOOPCNT);
+#line 3230
if (realign) {
+#line 3230
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3230
xp = tmp;
+#line 3230
} else {
+#line 3230
xp = (longlong *) *xpp;
+#line 3230
}
+#line 3230
/* copy the next block */
+#line 3230
#pragma cdir loopcnt=LOOPCNT
+#line 3230
#pragma cdir shortloop
+#line 3230
for (i=0; i<ni; i++) {
+#line 3230
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 3230
/* test for range errors (not always needed but do it anyway) */
+#line 3230
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3230
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3230
nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
+#line 3230
}
+#line 3230
/* update xpp and tp */
+#line 3230
if (realign) xp = (longlong *) *xpp;
+#line 3230
xp += ni;
+#line 3230
tp += ni;
+#line 3230
*xpp = (void*)xp;
+#line 3230
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3230
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3230
+#line 3230
#else /* not SX */
+#line 3230
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3230
+ int status = NC_NOERR;
+#line 3230
+#line 3230
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3230
{
+#line 3230
const int lstatus = ncx_get_longlong_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3230
+ if(lstatus != NC_NOERR)
+#line 3230
status = lstatus;
+#line 3230
}
+#line 3230
+#line 3230
*xpp = (const void *)xp;
+#line 3230
return status;
+#line 3230
# endif
+#line 3230
}
+#line 3230
int
+#line 3231
ncx_getn_longlong_short(const void **xpp, size_t nelems, short *tp)
+#line 3231
{
+#line 3231
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3231
+#line 3231
/* basic algorithm is:
+#line 3231
* - ensure sane alignment of input data
+#line 3231
* - copy (conversion happens automatically) input data
+#line 3231
* to output
+#line 3231
* - update xpp to point at next unconverted input, and tp to point
+#line 3231
* at next location for converted output
+#line 3231
*/
+#line 3231
long i, j, ni;
+#line 3231
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3231
longlong *xp;
+#line 3231
int nrange = 0; /* number of range errors */
+#line 3231
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3231
long cxp = (long) *((char**)xpp);
+#line 3231
+#line 3231
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3231
/* sjl: manually stripmine so we can limit amount of
+#line 3231
* vector work space reserved to LOOPCNT elements. Also
+#line 3231
* makes vectorisation easy */
+#line 3231
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3231
ni=Min(nelems-j,LOOPCNT);
+#line 3231
if (realign) {
+#line 3231
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3231
xp = tmp;
+#line 3231
} else {
+#line 3231
xp = (longlong *) *xpp;
+#line 3231
}
+#line 3231
/* copy the next block */
+#line 3231
#pragma cdir loopcnt=LOOPCNT
+#line 3231
#pragma cdir shortloop
+#line 3231
for (i=0; i<ni; i++) {
+#line 3231
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 3231
/* test for range errors (not always needed but do it anyway) */
+#line 3231
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3231
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3231
nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
+#line 3231
}
+#line 3231
/* update xpp and tp */
+#line 3231
if (realign) xp = (longlong *) *xpp;
+#line 3231
xp += ni;
+#line 3231
tp += ni;
+#line 3231
*xpp = (void*)xp;
+#line 3231
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3231
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3231
+#line 3231
#else /* not SX */
+#line 3231
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3231
+ int status = NC_NOERR;
+#line 3231
+#line 3231
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3231
{
+#line 3231
const int lstatus = ncx_get_longlong_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3231
+ if(lstatus != NC_NOERR)
+#line 3231
status = lstatus;
+#line 3231
}
+#line 3231
+#line 3231
*xpp = (const void *)xp;
+#line 3231
return status;
+#line 3231
# endif
+#line 3231
}
+#line 3231
int
+#line 3232
ncx_getn_longlong_int(const void **xpp, size_t nelems, int *tp)
+#line 3232
{
+#line 3232
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3232
+#line 3232
/* basic algorithm is:
+#line 3232
* - ensure sane alignment of input data
+#line 3232
* - copy (conversion happens automatically) input data
+#line 3232
* to output
+#line 3232
* - update xpp to point at next unconverted input, and tp to point
+#line 3232
* at next location for converted output
+#line 3232
*/
+#line 3232
long i, j, ni;
+#line 3232
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3232
longlong *xp;
+#line 3232
int nrange = 0; /* number of range errors */
+#line 3232
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3232
long cxp = (long) *((char**)xpp);
+#line 3232
+#line 3232
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3232
/* sjl: manually stripmine so we can limit amount of
+#line 3232
* vector work space reserved to LOOPCNT elements. Also
+#line 3232
* makes vectorisation easy */
+#line 3232
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3232
ni=Min(nelems-j,LOOPCNT);
+#line 3232
if (realign) {
+#line 3232
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3232
xp = tmp;
+#line 3232
} else {
+#line 3232
xp = (longlong *) *xpp;
+#line 3232
}
+#line 3232
/* copy the next block */
+#line 3232
#pragma cdir loopcnt=LOOPCNT
+#line 3232
#pragma cdir shortloop
+#line 3232
for (i=0; i<ni; i++) {
+#line 3232
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 3232
/* test for range errors (not always needed but do it anyway) */
+#line 3232
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3232
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3232
nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
+#line 3232
}
+#line 3232
/* update xpp and tp */
+#line 3232
if (realign) xp = (longlong *) *xpp;
+#line 3232
xp += ni;
+#line 3232
tp += ni;
+#line 3232
*xpp = (void*)xp;
+#line 3232
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3232
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3232
+#line 3232
#else /* not SX */
+#line 3232
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3232
+ int status = NC_NOERR;
+#line 3232
+#line 3232
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3232
{
+#line 3232
const int lstatus = ncx_get_longlong_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3232
+ if(lstatus != NC_NOERR)
+#line 3232
status = lstatus;
+#line 3232
}
+#line 3232
+#line 3232
*xpp = (const void *)xp;
+#line 3232
return status;
+#line 3232
# endif
+#line 3232
}
+#line 3232
int
+#line 3233
ncx_getn_longlong_float(const void **xpp, size_t nelems, float *tp)
+#line 3233
{
+#line 3233
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3233
+#line 3233
/* basic algorithm is:
+#line 3233
* - ensure sane alignment of input data
+#line 3233
* - copy (conversion happens automatically) input data
+#line 3233
* to output
+#line 3233
* - update xpp to point at next unconverted input, and tp to point
+#line 3233
* at next location for converted output
+#line 3233
*/
+#line 3233
long i, j, ni;
+#line 3233
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3233
longlong *xp;
+#line 3233
int nrange = 0; /* number of range errors */
+#line 3233
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3233
long cxp = (long) *((char**)xpp);
+#line 3233
+#line 3233
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3233
/* sjl: manually stripmine so we can limit amount of
+#line 3233
* vector work space reserved to LOOPCNT elements. Also
+#line 3233
* makes vectorisation easy */
+#line 3233
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3233
ni=Min(nelems-j,LOOPCNT);
+#line 3233
if (realign) {
+#line 3233
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3233
xp = tmp;
+#line 3233
} else {
+#line 3233
xp = (longlong *) *xpp;
+#line 3233
}
+#line 3233
/* copy the next block */
+#line 3233
#pragma cdir loopcnt=LOOPCNT
+#line 3233
#pragma cdir shortloop
+#line 3233
for (i=0; i<ni; i++) {
+#line 3233
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 3233
/* test for range errors (not always needed but do it anyway) */
+#line 3233
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3233
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3233
nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
+#line 3233
}
+#line 3233
/* update xpp and tp */
+#line 3233
if (realign) xp = (longlong *) *xpp;
+#line 3233
xp += ni;
+#line 3233
tp += ni;
+#line 3233
*xpp = (void*)xp;
+#line 3233
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3233
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3233
+#line 3233
#else /* not SX */
+#line 3233
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3233
+ int status = NC_NOERR;
+#line 3233
+#line 3233
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3233
{
+#line 3233
const int lstatus = ncx_get_longlong_float(xp, tp);
- if(lstatus != ENOERR)
+#line 3233
+ if(lstatus != NC_NOERR)
+#line 3233
status = lstatus;
+#line 3233
}
+#line 3233
+#line 3233
*xpp = (const void *)xp;
+#line 3233
return status;
+#line 3233
# endif
+#line 3233
}
+#line 3233
int
+#line 3234
ncx_getn_longlong_double(const void **xpp, size_t nelems, double *tp)
+#line 3234
{
+#line 3234
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3234
+#line 3234
/* basic algorithm is:
+#line 3234
* - ensure sane alignment of input data
+#line 3234
* - copy (conversion happens automatically) input data
+#line 3234
* to output
+#line 3234
* - update xpp to point at next unconverted input, and tp to point
+#line 3234
* at next location for converted output
+#line 3234
*/
+#line 3234
long i, j, ni;
+#line 3234
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3234
longlong *xp;
+#line 3234
int nrange = 0; /* number of range errors */
+#line 3234
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3234
long cxp = (long) *((char**)xpp);
+#line 3234
+#line 3234
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3234
/* sjl: manually stripmine so we can limit amount of
+#line 3234
* vector work space reserved to LOOPCNT elements. Also
+#line 3234
* makes vectorisation easy */
+#line 3234
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3234
ni=Min(nelems-j,LOOPCNT);
+#line 3234
if (realign) {
+#line 3234
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3234
xp = tmp;
+#line 3234
} else {
+#line 3234
xp = (longlong *) *xpp;
+#line 3234
}
+#line 3234
/* copy the next block */
+#line 3234
#pragma cdir loopcnt=LOOPCNT
+#line 3234
#pragma cdir shortloop
+#line 3234
for (i=0; i<ni; i++) {
+#line 3234
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 3234
/* test for range errors (not always needed but do it anyway) */
+#line 3234
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3234
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3234
nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
+#line 3234
}
+#line 3234
/* update xpp and tp */
+#line 3234
if (realign) xp = (longlong *) *xpp;
+#line 3234
xp += ni;
+#line 3234
tp += ni;
+#line 3234
*xpp = (void*)xp;
+#line 3234
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3234
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3234
+#line 3234
#else /* not SX */
+#line 3234
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3234
+ int status = NC_NOERR;
+#line 3234
+#line 3234
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3234
{
+#line 3234
const int lstatus = ncx_get_longlong_double(xp, tp);
- if(lstatus != ENOERR)
+#line 3234
+ if(lstatus != NC_NOERR)
+#line 3234
status = lstatus;
+#line 3234
}
+#line 3234
+#line 3234
*xpp = (const void *)xp;
+#line 3234
return status;
+#line 3234
# endif
+#line 3234
}
+#line 3234
int
+#line 3235
ncx_getn_longlong_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 3235
{
+#line 3235
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3235
+#line 3235
/* basic algorithm is:
+#line 3235
* - ensure sane alignment of input data
+#line 3235
* - copy (conversion happens automatically) input data
+#line 3235
* to output
+#line 3235
* - update xpp to point at next unconverted input, and tp to point
+#line 3235
* at next location for converted output
+#line 3235
*/
+#line 3235
long i, j, ni;
+#line 3235
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3235
longlong *xp;
+#line 3235
int nrange = 0; /* number of range errors */
+#line 3235
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3235
long cxp = (long) *((char**)xpp);
+#line 3235
+#line 3235
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3235
/* sjl: manually stripmine so we can limit amount of
+#line 3235
* vector work space reserved to LOOPCNT elements. Also
+#line 3235
* makes vectorisation easy */
+#line 3235
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3235
ni=Min(nelems-j,LOOPCNT);
+#line 3235
if (realign) {
+#line 3235
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3235
xp = tmp;
+#line 3235
} else {
+#line 3235
xp = (longlong *) *xpp;
+#line 3235
}
+#line 3235
/* copy the next block */
+#line 3235
#pragma cdir loopcnt=LOOPCNT
+#line 3235
#pragma cdir shortloop
+#line 3235
for (i=0; i<ni; i++) {
+#line 3235
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 3235
/* test for range errors (not always needed but do it anyway) */
+#line 3235
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3235
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3235
nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
+#line 3235
}
+#line 3235
/* update xpp and tp */
+#line 3235
if (realign) xp = (longlong *) *xpp;
+#line 3235
xp += ni;
+#line 3235
tp += ni;
+#line 3235
*xpp = (void*)xp;
+#line 3235
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3235
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3235
+#line 3235
#else /* not SX */
+#line 3235
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3235
+ int status = NC_NOERR;
+#line 3235
+#line 3235
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3235
{
+#line 3235
const int lstatus = ncx_get_longlong_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3235
+ if(lstatus != NC_NOERR)
+#line 3235
status = lstatus;
+#line 3235
}
+#line 3235
+#line 3235
*xpp = (const void *)xp;
+#line 3235
return status;
+#line 3235
# endif
+#line 3235
}
+#line 3235
int
+#line 3236
ncx_getn_longlong_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 3236
{
+#line 3236
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3236
+#line 3236
/* basic algorithm is:
+#line 3236
* - ensure sane alignment of input data
+#line 3236
* - copy (conversion happens automatically) input data
+#line 3236
* to output
+#line 3236
* - update xpp to point at next unconverted input, and tp to point
+#line 3236
* at next location for converted output
+#line 3236
*/
+#line 3236
long i, j, ni;
+#line 3236
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3236
longlong *xp;
+#line 3236
int nrange = 0; /* number of range errors */
+#line 3236
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3236
long cxp = (long) *((char**)xpp);
+#line 3236
+#line 3236
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3236
/* sjl: manually stripmine so we can limit amount of
+#line 3236
* vector work space reserved to LOOPCNT elements. Also
+#line 3236
* makes vectorisation easy */
+#line 3236
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3236
ni=Min(nelems-j,LOOPCNT);
+#line 3236
if (realign) {
+#line 3236
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3236
xp = tmp;
+#line 3236
} else {
+#line 3236
xp = (longlong *) *xpp;
+#line 3236
}
+#line 3236
/* copy the next block */
+#line 3236
#pragma cdir loopcnt=LOOPCNT
+#line 3236
#pragma cdir shortloop
+#line 3236
for (i=0; i<ni; i++) {
+#line 3236
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 3236
/* test for range errors (not always needed but do it anyway) */
+#line 3236
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3236
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3236
nrange += xp[i] > USHORT_MAX || xp[i] < 0;
+#line 3236
}
+#line 3236
/* update xpp and tp */
+#line 3236
if (realign) xp = (longlong *) *xpp;
+#line 3236
xp += ni;
+#line 3236
tp += ni;
+#line 3236
*xpp = (void*)xp;
+#line 3236
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3236
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3236
+#line 3236
#else /* not SX */
+#line 3236
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3236
+ int status = NC_NOERR;
+#line 3236
+#line 3236
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3236
{
+#line 3236
const int lstatus = ncx_get_longlong_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3236
+ if(lstatus != NC_NOERR)
+#line 3236
status = lstatus;
+#line 3236
}
+#line 3236
+#line 3236
*xpp = (const void *)xp;
+#line 3236
return status;
+#line 3236
# endif
+#line 3236
}
+#line 3236
int
+#line 3237
ncx_getn_longlong_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3237
{
+#line 3237
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3237
+#line 3237
/* basic algorithm is:
+#line 3237
* - ensure sane alignment of input data
+#line 3237
* - copy (conversion happens automatically) input data
+#line 3237
* to output
+#line 3237
* - update xpp to point at next unconverted input, and tp to point
+#line 3237
* at next location for converted output
+#line 3237
*/
+#line 3237
long i, j, ni;
+#line 3237
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3237
longlong *xp;
+#line 3237
int nrange = 0; /* number of range errors */
+#line 3237
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3237
long cxp = (long) *((char**)xpp);
+#line 3237
+#line 3237
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3237
/* sjl: manually stripmine so we can limit amount of
+#line 3237
* vector work space reserved to LOOPCNT elements. Also
+#line 3237
* makes vectorisation easy */
+#line 3237
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3237
ni=Min(nelems-j,LOOPCNT);
+#line 3237
if (realign) {
+#line 3237
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3237
xp = tmp;
+#line 3237
} else {
+#line 3237
xp = (longlong *) *xpp;
+#line 3237
}
+#line 3237
/* copy the next block */
+#line 3237
#pragma cdir loopcnt=LOOPCNT
+#line 3237
#pragma cdir shortloop
+#line 3237
for (i=0; i<ni; i++) {
+#line 3237
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 3237
/* test for range errors (not always needed but do it anyway) */
+#line 3237
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3237
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3237
nrange += xp[i] > UINT_MAX || xp[i] < 0;
+#line 3237
}
+#line 3237
/* update xpp and tp */
+#line 3237
if (realign) xp = (longlong *) *xpp;
+#line 3237
xp += ni;
+#line 3237
tp += ni;
+#line 3237
*xpp = (void*)xp;
+#line 3237
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3237
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3237
+#line 3237
#else /* not SX */
+#line 3237
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3237
+ int status = NC_NOERR;
+#line 3237
+#line 3237
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3237
{
+#line 3237
const int lstatus = ncx_get_longlong_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3237
+ if(lstatus != NC_NOERR)
+#line 3237
status = lstatus;
+#line 3237
}
+#line 3237
+#line 3237
*xpp = (const void *)xp;
+#line 3237
return status;
+#line 3237
# endif
+#line 3237
}
+#line 3237
int
+#line 3238
ncx_getn_longlong_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 3238
{
+#line 3238
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3238
+#line 3238
/* basic algorithm is:
+#line 3238
* - ensure sane alignment of input data
+#line 3238
* - copy (conversion happens automatically) input data
+#line 3238
* to output
+#line 3238
* - update xpp to point at next unconverted input, and tp to point
+#line 3238
* at next location for converted output
+#line 3238
*/
+#line 3238
long i, j, ni;
+#line 3238
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3238
longlong *xp;
+#line 3238
int nrange = 0; /* number of range errors */
+#line 3238
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3238
long cxp = (long) *((char**)xpp);
+#line 3238
+#line 3238
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3238
/* sjl: manually stripmine so we can limit amount of
+#line 3238
* vector work space reserved to LOOPCNT elements. Also
+#line 3238
* makes vectorisation easy */
+#line 3238
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3238
ni=Min(nelems-j,LOOPCNT);
+#line 3238
if (realign) {
+#line 3238
memcpy(tmp, *xpp, ni*SIZEOF_LONGLONG);
+#line 3238
xp = tmp;
+#line 3238
} else {
+#line 3238
xp = (longlong *) *xpp;
+#line 3238
}
+#line 3238
/* copy the next block */
+#line 3238
#pragma cdir loopcnt=LOOPCNT
+#line 3238
#pragma cdir shortloop
+#line 3238
for (i=0; i<ni; i++) {
+#line 3238
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 3238
/* test for range errors (not always needed but do it anyway) */
+#line 3238
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3238
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3238
nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
+#line 3238
}
+#line 3238
/* update xpp and tp */
+#line 3238
if (realign) xp = (longlong *) *xpp;
+#line 3238
xp += ni;
+#line 3238
tp += ni;
+#line 3238
*xpp = (void*)xp;
+#line 3238
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3238
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3238
+#line 3238
#else /* not SX */
+#line 3238
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3238
+ int status = NC_NOERR;
+#line 3238
+#line 3238
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3238
{
+#line 3238
const int lstatus = ncx_get_longlong_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3238
+ if(lstatus != NC_NOERR)
+#line 3238
status = lstatus;
+#line 3238
}
+#line 3238
+#line 3238
*xpp = (const void *)xp;
+#line 3238
return status;
+#line 3238
# endif
+#line 3238
}
+#line 3238
#if X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
@@ -15134,709 +27962,1399 @@ ncx_putn_longlong_longlong(void **xpp, size_t nelems, const long long *tp)
swapn8b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_LONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 3254
ncx_putn_longlong_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 3254
{
+#line 3254
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3254
+#line 3254
/* basic algorithm is:
+#line 3254
* - ensure sane alignment of output data
+#line 3254
* - copy (conversion happens automatically) input data
+#line 3254
* to output
+#line 3254
* - update tp to point at next unconverted input, and xpp to point
+#line 3254
* at next location for converted output
+#line 3254
*/
+#line 3254
long i, j, ni;
+#line 3254
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3254
longlong *xp;
+#line 3254
int nrange = 0; /* number of range errors */
+#line 3254
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3254
long cxp = (long) *((char**)xpp);
+#line 3254
+#line 3254
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3254
/* sjl: manually stripmine so we can limit amount of
+#line 3254
* vector work space reserved to LOOPCNT elements. Also
+#line 3254
* makes vectorisation easy */
+#line 3254
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3254
ni=Min(nelems-j,LOOPCNT);
+#line 3254
if (realign) {
+#line 3254
xp = tmp;
+#line 3254
} else {
+#line 3254
xp = (longlong *) *xpp;
+#line 3254
}
+#line 3254
/* copy the next block */
+#line 3254
#pragma cdir loopcnt=LOOPCNT
+#line 3254
#pragma cdir shortloop
+#line 3254
for (i=0; i<ni; i++) {
+#line 3254
/* the normal case: */
+#line 3254
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3254
/* test for range errors (not always needed but do it anyway) */
+#line 3254
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3254
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3254
nrange += tp[i] > X_LONGLONG_MAX || tp[i] < X_LONGLONG_MIN;
+#line 3254
}
+#line 3254
/* copy workspace back if necessary */
+#line 3254
if (realign) {
+#line 3254
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3254
xp = (longlong *) *xpp;
+#line 3254
}
+#line 3254
/* update xpp and tp */
+#line 3254
xp += ni;
+#line 3254
tp += ni;
+#line 3254
*xpp = (void*)xp;
+#line 3254
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3254
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3254
+#line 3254
#else /* not SX */
+#line 3254
+#line 3254
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3254
+ int status = NC_NOERR;
+#line 3254
+#line 3254
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3254
{
+#line 3254
int lstatus = ncx_put_longlong_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3254
+ if(lstatus != NC_NOERR)
+#line 3254
status = lstatus;
+#line 3254
}
+#line 3254
+#line 3254
*xpp = (void *)xp;
+#line 3254
return status;
+#line 3254
#endif
+#line 3254
}
+#line 3254
#endif
int
+#line 3256
ncx_putn_longlong_schar(void **xpp, size_t nelems, const schar *tp)
+#line 3256
{
+#line 3256
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3256
+#line 3256
/* basic algorithm is:
+#line 3256
* - ensure sane alignment of output data
+#line 3256
* - copy (conversion happens automatically) input data
+#line 3256
* to output
+#line 3256
* - update tp to point at next unconverted input, and xpp to point
+#line 3256
* at next location for converted output
+#line 3256
*/
+#line 3256
long i, j, ni;
+#line 3256
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3256
longlong *xp;
+#line 3256
int nrange = 0; /* number of range errors */
+#line 3256
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3256
long cxp = (long) *((char**)xpp);
+#line 3256
+#line 3256
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3256
/* sjl: manually stripmine so we can limit amount of
+#line 3256
* vector work space reserved to LOOPCNT elements. Also
+#line 3256
* makes vectorisation easy */
+#line 3256
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3256
ni=Min(nelems-j,LOOPCNT);
+#line 3256
if (realign) {
+#line 3256
xp = tmp;
+#line 3256
} else {
+#line 3256
xp = (longlong *) *xpp;
+#line 3256
}
+#line 3256
/* copy the next block */
+#line 3256
#pragma cdir loopcnt=LOOPCNT
+#line 3256
#pragma cdir shortloop
+#line 3256
for (i=0; i<ni; i++) {
+#line 3256
/* the normal case: */
+#line 3256
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3256
/* test for range errors (not always needed but do it anyway) */
+#line 3256
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3256
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3256
nrange += tp[i] > X_LONGLONG_MAX || tp[i] < X_LONGLONG_MIN;
+#line 3256
}
+#line 3256
/* copy workspace back if necessary */
+#line 3256
if (realign) {
+#line 3256
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3256
xp = (longlong *) *xpp;
+#line 3256
}
+#line 3256
/* update xpp and tp */
+#line 3256
xp += ni;
+#line 3256
tp += ni;
+#line 3256
*xpp = (void*)xp;
+#line 3256
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3256
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3256
+#line 3256
#else /* not SX */
+#line 3256
+#line 3256
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3256
+ int status = NC_NOERR;
+#line 3256
+#line 3256
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3256
{
+#line 3256
int lstatus = ncx_put_longlong_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3256
+ if(lstatus != NC_NOERR)
+#line 3256
status = lstatus;
+#line 3256
}
+#line 3256
+#line 3256
*xpp = (void *)xp;
+#line 3256
return status;
+#line 3256
#endif
+#line 3256
}
+#line 3256
int
+#line 3257
ncx_putn_longlong_short(void **xpp, size_t nelems, const short *tp)
+#line 3257
{
+#line 3257
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3257
+#line 3257
/* basic algorithm is:
+#line 3257
* - ensure sane alignment of output data
+#line 3257
* - copy (conversion happens automatically) input data
+#line 3257
* to output
+#line 3257
* - update tp to point at next unconverted input, and xpp to point
+#line 3257
* at next location for converted output
+#line 3257
*/
+#line 3257
long i, j, ni;
+#line 3257
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3257
longlong *xp;
+#line 3257
int nrange = 0; /* number of range errors */
+#line 3257
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3257
long cxp = (long) *((char**)xpp);
+#line 3257
+#line 3257
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3257
/* sjl: manually stripmine so we can limit amount of
+#line 3257
* vector work space reserved to LOOPCNT elements. Also
+#line 3257
* makes vectorisation easy */
+#line 3257
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3257
ni=Min(nelems-j,LOOPCNT);
+#line 3257
if (realign) {
+#line 3257
xp = tmp;
+#line 3257
} else {
+#line 3257
xp = (longlong *) *xpp;
+#line 3257
}
+#line 3257
/* copy the next block */
+#line 3257
#pragma cdir loopcnt=LOOPCNT
+#line 3257
#pragma cdir shortloop
+#line 3257
for (i=0; i<ni; i++) {
+#line 3257
/* the normal case: */
+#line 3257
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3257
/* test for range errors (not always needed but do it anyway) */
+#line 3257
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3257
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3257
nrange += tp[i] > X_LONGLONG_MAX || tp[i] < X_LONGLONG_MIN;
+#line 3257
}
+#line 3257
/* copy workspace back if necessary */
+#line 3257
if (realign) {
+#line 3257
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3257
xp = (longlong *) *xpp;
+#line 3257
}
+#line 3257
/* update xpp and tp */
+#line 3257
xp += ni;
+#line 3257
tp += ni;
+#line 3257
*xpp = (void*)xp;
+#line 3257
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3257
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3257
+#line 3257
#else /* not SX */
+#line 3257
+#line 3257
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3257
+ int status = NC_NOERR;
+#line 3257
+#line 3257
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3257
{
+#line 3257
int lstatus = ncx_put_longlong_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3257
+ if(lstatus != NC_NOERR)
+#line 3257
status = lstatus;
+#line 3257
}
+#line 3257
+#line 3257
*xpp = (void *)xp;
+#line 3257
return status;
+#line 3257
#endif
+#line 3257
}
+#line 3257
int
+#line 3258
ncx_putn_longlong_int(void **xpp, size_t nelems, const int *tp)
+#line 3258
{
+#line 3258
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3258
+#line 3258
/* basic algorithm is:
+#line 3258
* - ensure sane alignment of output data
+#line 3258
* - copy (conversion happens automatically) input data
+#line 3258
* to output
+#line 3258
* - update tp to point at next unconverted input, and xpp to point
+#line 3258
* at next location for converted output
+#line 3258
*/
+#line 3258
long i, j, ni;
+#line 3258
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3258
longlong *xp;
+#line 3258
int nrange = 0; /* number of range errors */
+#line 3258
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3258
long cxp = (long) *((char**)xpp);
+#line 3258
+#line 3258
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3258
/* sjl: manually stripmine so we can limit amount of
+#line 3258
* vector work space reserved to LOOPCNT elements. Also
+#line 3258
* makes vectorisation easy */
+#line 3258
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3258
ni=Min(nelems-j,LOOPCNT);
+#line 3258
if (realign) {
+#line 3258
xp = tmp;
+#line 3258
} else {
+#line 3258
xp = (longlong *) *xpp;
+#line 3258
}
+#line 3258
/* copy the next block */
+#line 3258
#pragma cdir loopcnt=LOOPCNT
+#line 3258
#pragma cdir shortloop
+#line 3258
for (i=0; i<ni; i++) {
+#line 3258
/* the normal case: */
+#line 3258
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3258
/* test for range errors (not always needed but do it anyway) */
+#line 3258
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3258
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3258
nrange += tp[i] > X_LONGLONG_MAX || tp[i] < X_LONGLONG_MIN;
+#line 3258
}
+#line 3258
/* copy workspace back if necessary */
+#line 3258
if (realign) {
+#line 3258
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3258
xp = (longlong *) *xpp;
+#line 3258
}
+#line 3258
/* update xpp and tp */
+#line 3258
xp += ni;
+#line 3258
tp += ni;
+#line 3258
*xpp = (void*)xp;
+#line 3258
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3258
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3258
+#line 3258
#else /* not SX */
+#line 3258
+#line 3258
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3258
+ int status = NC_NOERR;
+#line 3258
+#line 3258
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3258
{
+#line 3258
int lstatus = ncx_put_longlong_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3258
+ if(lstatus != NC_NOERR)
+#line 3258
status = lstatus;
+#line 3258
}
+#line 3258
+#line 3258
*xpp = (void *)xp;
+#line 3258
return status;
+#line 3258
#endif
+#line 3258
}
+#line 3258
int
+#line 3259
ncx_putn_longlong_float(void **xpp, size_t nelems, const float *tp)
+#line 3259
{
+#line 3259
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3259
+#line 3259
/* basic algorithm is:
+#line 3259
* - ensure sane alignment of output data
+#line 3259
* - copy (conversion happens automatically) input data
+#line 3259
* to output
+#line 3259
* - update tp to point at next unconverted input, and xpp to point
+#line 3259
* at next location for converted output
+#line 3259
*/
+#line 3259
long i, j, ni;
+#line 3259
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3259
longlong *xp;
+#line 3259
int nrange = 0; /* number of range errors */
+#line 3259
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3259
long cxp = (long) *((char**)xpp);
+#line 3259
+#line 3259
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3259
/* sjl: manually stripmine so we can limit amount of
+#line 3259
* vector work space reserved to LOOPCNT elements. Also
+#line 3259
* makes vectorisation easy */
+#line 3259
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3259
ni=Min(nelems-j,LOOPCNT);
+#line 3259
if (realign) {
+#line 3259
xp = tmp;
+#line 3259
} else {
+#line 3259
xp = (longlong *) *xpp;
+#line 3259
}
+#line 3259
/* copy the next block */
+#line 3259
#pragma cdir loopcnt=LOOPCNT
+#line 3259
#pragma cdir shortloop
+#line 3259
for (i=0; i<ni; i++) {
+#line 3259
/* the normal case: */
+#line 3259
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3259
/* test for range errors (not always needed but do it anyway) */
+#line 3259
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3259
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3259
nrange += tp[i] > X_LONGLONG_MAX || tp[i] < X_LONGLONG_MIN;
+#line 3259
}
+#line 3259
/* copy workspace back if necessary */
+#line 3259
if (realign) {
+#line 3259
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3259
xp = (longlong *) *xpp;
+#line 3259
}
+#line 3259
/* update xpp and tp */
+#line 3259
xp += ni;
+#line 3259
tp += ni;
+#line 3259
*xpp = (void*)xp;
+#line 3259
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3259
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3259
+#line 3259
#else /* not SX */
+#line 3259
+#line 3259
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3259
+ int status = NC_NOERR;
+#line 3259
+#line 3259
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3259
{
+#line 3259
int lstatus = ncx_put_longlong_float(xp, tp);
- if(lstatus != ENOERR)
+#line 3259
+ if(lstatus != NC_NOERR)
+#line 3259
status = lstatus;
+#line 3259
}
+#line 3259
+#line 3259
*xpp = (void *)xp;
+#line 3259
return status;
+#line 3259
#endif
+#line 3259
}
+#line 3259
int
+#line 3260
ncx_putn_longlong_double(void **xpp, size_t nelems, const double *tp)
+#line 3260
{
+#line 3260
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3260
+#line 3260
/* basic algorithm is:
+#line 3260
* - ensure sane alignment of output data
+#line 3260
* - copy (conversion happens automatically) input data
+#line 3260
* to output
+#line 3260
* - update tp to point at next unconverted input, and xpp to point
+#line 3260
* at next location for converted output
+#line 3260
*/
+#line 3260
long i, j, ni;
+#line 3260
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3260
longlong *xp;
+#line 3260
int nrange = 0; /* number of range errors */
+#line 3260
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3260
long cxp = (long) *((char**)xpp);
+#line 3260
+#line 3260
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3260
/* sjl: manually stripmine so we can limit amount of
+#line 3260
* vector work space reserved to LOOPCNT elements. Also
+#line 3260
* makes vectorisation easy */
+#line 3260
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3260
ni=Min(nelems-j,LOOPCNT);
+#line 3260
if (realign) {
+#line 3260
xp = tmp;
+#line 3260
} else {
+#line 3260
xp = (longlong *) *xpp;
+#line 3260
}
+#line 3260
/* copy the next block */
+#line 3260
#pragma cdir loopcnt=LOOPCNT
+#line 3260
#pragma cdir shortloop
+#line 3260
for (i=0; i<ni; i++) {
+#line 3260
/* the normal case: */
+#line 3260
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3260
/* test for range errors (not always needed but do it anyway) */
+#line 3260
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3260
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3260
nrange += tp[i] > X_LONGLONG_MAX || tp[i] < X_LONGLONG_MIN;
+#line 3260
}
+#line 3260
/* copy workspace back if necessary */
+#line 3260
if (realign) {
+#line 3260
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3260
xp = (longlong *) *xpp;
+#line 3260
}
+#line 3260
/* update xpp and tp */
+#line 3260
xp += ni;
+#line 3260
tp += ni;
+#line 3260
*xpp = (void*)xp;
+#line 3260
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3260
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3260
+#line 3260
#else /* not SX */
+#line 3260
+#line 3260
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3260
+ int status = NC_NOERR;
+#line 3260
+#line 3260
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3260
{
+#line 3260
int lstatus = ncx_put_longlong_double(xp, tp);
- if(lstatus != ENOERR)
+#line 3260
+ if(lstatus != NC_NOERR)
+#line 3260
status = lstatus;
+#line 3260
}
+#line 3260
+#line 3260
*xpp = (void *)xp;
+#line 3260
return status;
+#line 3260
#endif
+#line 3260
}
+#line 3260
int
+#line 3261
ncx_putn_longlong_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 3261
{
+#line 3261
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3261
+#line 3261
/* basic algorithm is:
+#line 3261
* - ensure sane alignment of output data
+#line 3261
* - copy (conversion happens automatically) input data
+#line 3261
* to output
+#line 3261
* - update tp to point at next unconverted input, and xpp to point
+#line 3261
* at next location for converted output
+#line 3261
*/
+#line 3261
long i, j, ni;
+#line 3261
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3261
longlong *xp;
+#line 3261
int nrange = 0; /* number of range errors */
+#line 3261
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3261
long cxp = (long) *((char**)xpp);
+#line 3261
+#line 3261
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3261
/* sjl: manually stripmine so we can limit amount of
+#line 3261
* vector work space reserved to LOOPCNT elements. Also
+#line 3261
* makes vectorisation easy */
+#line 3261
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3261
ni=Min(nelems-j,LOOPCNT);
+#line 3261
if (realign) {
+#line 3261
xp = tmp;
+#line 3261
} else {
+#line 3261
xp = (longlong *) *xpp;
+#line 3261
}
+#line 3261
/* copy the next block */
+#line 3261
#pragma cdir loopcnt=LOOPCNT
+#line 3261
#pragma cdir shortloop
+#line 3261
for (i=0; i<ni; i++) {
+#line 3261
/* the normal case: */
+#line 3261
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3261
/* test for range errors (not always needed but do it anyway) */
+#line 3261
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3261
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3261
nrange += tp[i] > X_LONGLONG_MAX ;
+#line 3261
}
+#line 3261
/* copy workspace back if necessary */
+#line 3261
if (realign) {
+#line 3261
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3261
xp = (longlong *) *xpp;
+#line 3261
}
+#line 3261
/* update xpp and tp */
+#line 3261
xp += ni;
+#line 3261
tp += ni;
+#line 3261
*xpp = (void*)xp;
+#line 3261
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3261
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3261
+#line 3261
#else /* not SX */
+#line 3261
+#line 3261
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3261
+ int status = NC_NOERR;
+#line 3261
+#line 3261
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3261
{
+#line 3261
int lstatus = ncx_put_longlong_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3261
+ if(lstatus != NC_NOERR)
+#line 3261
status = lstatus;
+#line 3261
}
+#line 3261
+#line 3261
*xpp = (void *)xp;
+#line 3261
return status;
+#line 3261
#endif
+#line 3261
}
+#line 3261
int
+#line 3262
ncx_putn_longlong_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 3262
{
+#line 3262
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3262
+#line 3262
/* basic algorithm is:
+#line 3262
* - ensure sane alignment of output data
+#line 3262
* - copy (conversion happens automatically) input data
+#line 3262
* to output
+#line 3262
* - update tp to point at next unconverted input, and xpp to point
+#line 3262
* at next location for converted output
+#line 3262
*/
+#line 3262
long i, j, ni;
+#line 3262
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3262
longlong *xp;
+#line 3262
int nrange = 0; /* number of range errors */
+#line 3262
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3262
long cxp = (long) *((char**)xpp);
+#line 3262
+#line 3262
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3262
/* sjl: manually stripmine so we can limit amount of
+#line 3262
* vector work space reserved to LOOPCNT elements. Also
+#line 3262
* makes vectorisation easy */
+#line 3262
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3262
ni=Min(nelems-j,LOOPCNT);
+#line 3262
if (realign) {
+#line 3262
xp = tmp;
+#line 3262
} else {
+#line 3262
xp = (longlong *) *xpp;
+#line 3262
}
+#line 3262
/* copy the next block */
+#line 3262
#pragma cdir loopcnt=LOOPCNT
+#line 3262
#pragma cdir shortloop
+#line 3262
for (i=0; i<ni; i++) {
+#line 3262
/* the normal case: */
+#line 3262
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3262
/* test for range errors (not always needed but do it anyway) */
+#line 3262
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3262
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3262
nrange += tp[i] > X_LONGLONG_MAX ;
+#line 3262
}
+#line 3262
/* copy workspace back if necessary */
+#line 3262
if (realign) {
+#line 3262
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3262
xp = (longlong *) *xpp;
+#line 3262
}
+#line 3262
/* update xpp and tp */
+#line 3262
xp += ni;
+#line 3262
tp += ni;
+#line 3262
*xpp = (void*)xp;
+#line 3262
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3262
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3262
+#line 3262
#else /* not SX */
+#line 3262
+#line 3262
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3262
+ int status = NC_NOERR;
+#line 3262
+#line 3262
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3262
{
+#line 3262
int lstatus = ncx_put_longlong_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3262
+ if(lstatus != NC_NOERR)
+#line 3262
status = lstatus;
+#line 3262
}
+#line 3262
+#line 3262
*xpp = (void *)xp;
+#line 3262
return status;
+#line 3262
#endif
+#line 3262
}
+#line 3262
int
+#line 3263
ncx_putn_longlong_uint(void **xpp, size_t nelems, const uint *tp)
+#line 3263
{
+#line 3263
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3263
+#line 3263
/* basic algorithm is:
+#line 3263
* - ensure sane alignment of output data
+#line 3263
* - copy (conversion happens automatically) input data
+#line 3263
* to output
+#line 3263
* - update tp to point at next unconverted input, and xpp to point
+#line 3263
* at next location for converted output
+#line 3263
*/
+#line 3263
long i, j, ni;
+#line 3263
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3263
longlong *xp;
+#line 3263
int nrange = 0; /* number of range errors */
+#line 3263
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3263
long cxp = (long) *((char**)xpp);
+#line 3263
+#line 3263
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3263
/* sjl: manually stripmine so we can limit amount of
+#line 3263
* vector work space reserved to LOOPCNT elements. Also
+#line 3263
* makes vectorisation easy */
+#line 3263
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3263
ni=Min(nelems-j,LOOPCNT);
+#line 3263
if (realign) {
+#line 3263
xp = tmp;
+#line 3263
} else {
+#line 3263
xp = (longlong *) *xpp;
+#line 3263
}
+#line 3263
/* copy the next block */
+#line 3263
#pragma cdir loopcnt=LOOPCNT
+#line 3263
#pragma cdir shortloop
+#line 3263
for (i=0; i<ni; i++) {
+#line 3263
/* the normal case: */
+#line 3263
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3263
/* test for range errors (not always needed but do it anyway) */
+#line 3263
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3263
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3263
nrange += tp[i] > X_LONGLONG_MAX ;
+#line 3263
}
+#line 3263
/* copy workspace back if necessary */
+#line 3263
if (realign) {
+#line 3263
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3263
xp = (longlong *) *xpp;
+#line 3263
}
+#line 3263
/* update xpp and tp */
+#line 3263
xp += ni;
+#line 3263
tp += ni;
+#line 3263
*xpp = (void*)xp;
+#line 3263
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3263
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3263
+#line 3263
#else /* not SX */
+#line 3263
+#line 3263
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3263
+ int status = NC_NOERR;
+#line 3263
+#line 3263
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3263
{
+#line 3263
int lstatus = ncx_put_longlong_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3263
+ if(lstatus != NC_NOERR)
+#line 3263
status = lstatus;
+#line 3263
}
+#line 3263
+#line 3263
*xpp = (void *)xp;
+#line 3263
return status;
+#line 3263
#endif
+#line 3263
}
+#line 3263
int
+#line 3264
ncx_putn_longlong_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 3264
{
+#line 3264
#if _SX && X_SIZEOF_LONGLONG == SIZEOF_LONGLONG
+#line 3264
+#line 3264
/* basic algorithm is:
+#line 3264
* - ensure sane alignment of output data
+#line 3264
* - copy (conversion happens automatically) input data
+#line 3264
* to output
+#line 3264
* - update tp to point at next unconverted input, and xpp to point
+#line 3264
* at next location for converted output
+#line 3264
*/
+#line 3264
long i, j, ni;
+#line 3264
longlong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3264
longlong *xp;
+#line 3264
int nrange = 0; /* number of range errors */
+#line 3264
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3264
long cxp = (long) *((char**)xpp);
+#line 3264
+#line 3264
realign = (cxp & 7) % SIZEOF_LONGLONG;
+#line 3264
/* sjl: manually stripmine so we can limit amount of
+#line 3264
* vector work space reserved to LOOPCNT elements. Also
+#line 3264
* makes vectorisation easy */
+#line 3264
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3264
ni=Min(nelems-j,LOOPCNT);
+#line 3264
if (realign) {
+#line 3264
xp = tmp;
+#line 3264
} else {
+#line 3264
xp = (longlong *) *xpp;
+#line 3264
}
+#line 3264
/* copy the next block */
+#line 3264
#pragma cdir loopcnt=LOOPCNT
+#line 3264
#pragma cdir shortloop
+#line 3264
for (i=0; i<ni; i++) {
+#line 3264
/* the normal case: */
+#line 3264
xp[i] = (longlong) Max( X_LONGLONG_MIN, Min(X_LONGLONG_MAX, (longlong) tp[i]));
+#line 3264
/* test for range errors (not always needed but do it anyway) */
+#line 3264
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3264
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3264
nrange += tp[i] > X_LONGLONG_MAX ;
+#line 3264
}
+#line 3264
/* copy workspace back if necessary */
+#line 3264
if (realign) {
+#line 3264
memcpy(*xpp, tmp, ni*X_SIZEOF_LONGLONG);
+#line 3264
xp = (longlong *) *xpp;
+#line 3264
}
+#line 3264
/* update xpp and tp */
+#line 3264
xp += ni;
+#line 3264
tp += ni;
+#line 3264
*xpp = (void*)xp;
+#line 3264
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3264
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3264
+#line 3264
#else /* not SX */
+#line 3264
+#line 3264
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3264
+ int status = NC_NOERR;
+#line 3264
+#line 3264
for( ; nelems != 0; nelems--, xp += X_SIZEOF_LONGLONG, tp++)
+#line 3264
{
+#line 3264
int lstatus = ncx_put_longlong_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3264
+ if(lstatus != NC_NOERR)
+#line 3264
status = lstatus;
+#line 3264
}
+#line 3264
+#line 3264
*xpp = (void *)xp;
+#line 3264
return status;
+#line 3264
#endif
+#line 3264
}
+#line 3264
/* ulonglong ----------------------------------------------------------------------*/
@@ -15852,659 +29370,1299 @@ ncx_getn_ulonglong_ulonglong(const void **xpp, size_t nelems, unsigned long long
swapn8b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_ULONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 3282
ncx_getn_ulonglong_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 3282
{
+#line 3282
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3282
+#line 3282
/* basic algorithm is:
+#line 3282
* - ensure sane alignment of input data
+#line 3282
* - copy (conversion happens automatically) input data
+#line 3282
* to output
+#line 3282
* - update xpp to point at next unconverted input, and tp to point
+#line 3282
* at next location for converted output
+#line 3282
*/
+#line 3282
long i, j, ni;
+#line 3282
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3282
ulonglong *xp;
+#line 3282
int nrange = 0; /* number of range errors */
+#line 3282
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3282
long cxp = (long) *((char**)xpp);
+#line 3282
+#line 3282
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3282
/* sjl: manually stripmine so we can limit amount of
+#line 3282
* vector work space reserved to LOOPCNT elements. Also
+#line 3282
* makes vectorisation easy */
+#line 3282
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3282
ni=Min(nelems-j,LOOPCNT);
+#line 3282
if (realign) {
+#line 3282
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3282
xp = tmp;
+#line 3282
} else {
+#line 3282
xp = (ulonglong *) *xpp;
+#line 3282
}
+#line 3282
/* copy the next block */
+#line 3282
#pragma cdir loopcnt=LOOPCNT
+#line 3282
#pragma cdir shortloop
+#line 3282
for (i=0; i<ni; i++) {
+#line 3282
tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 3282
/* test for range errors (not always needed but do it anyway) */
+#line 3282
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3282
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3282
nrange += xp[i] > ULONGLONG_MAX ;
+#line 3282
}
+#line 3282
/* update xpp and tp */
+#line 3282
if (realign) xp = (ulonglong *) *xpp;
+#line 3282
xp += ni;
+#line 3282
tp += ni;
+#line 3282
*xpp = (void*)xp;
+#line 3282
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3282
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3282
+#line 3282
#else /* not SX */
+#line 3282
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3282
+ int status = NC_NOERR;
+#line 3282
+#line 3282
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3282
{
+#line 3282
const int lstatus = ncx_get_ulonglong_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3282
+ if(lstatus != NC_NOERR)
+#line 3282
status = lstatus;
+#line 3282
}
+#line 3282
+#line 3282
*xpp = (const void *)xp;
+#line 3282
return status;
+#line 3282
# endif
+#line 3282
}
+#line 3282
#endif
int
+#line 3284
ncx_getn_ulonglong_schar(const void **xpp, size_t nelems, schar *tp)
+#line 3284
{
+#line 3284
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3284
+#line 3284
/* basic algorithm is:
+#line 3284
* - ensure sane alignment of input data
+#line 3284
* - copy (conversion happens automatically) input data
+#line 3284
* to output
+#line 3284
* - update xpp to point at next unconverted input, and tp to point
+#line 3284
* at next location for converted output
+#line 3284
*/
+#line 3284
long i, j, ni;
+#line 3284
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3284
ulonglong *xp;
+#line 3284
int nrange = 0; /* number of range errors */
+#line 3284
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3284
long cxp = (long) *((char**)xpp);
+#line 3284
+#line 3284
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3284
/* sjl: manually stripmine so we can limit amount of
+#line 3284
* vector work space reserved to LOOPCNT elements. Also
+#line 3284
* makes vectorisation easy */
+#line 3284
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3284
ni=Min(nelems-j,LOOPCNT);
+#line 3284
if (realign) {
+#line 3284
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3284
xp = tmp;
+#line 3284
} else {
+#line 3284
xp = (ulonglong *) *xpp;
+#line 3284
}
+#line 3284
/* copy the next block */
+#line 3284
#pragma cdir loopcnt=LOOPCNT
+#line 3284
#pragma cdir shortloop
+#line 3284
for (i=0; i<ni; i++) {
+#line 3284
tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
+#line 3284
/* test for range errors (not always needed but do it anyway) */
+#line 3284
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3284
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3284
nrange += xp[i] > SCHAR_MAX ;
+#line 3284
}
+#line 3284
/* update xpp and tp */
+#line 3284
if (realign) xp = (ulonglong *) *xpp;
+#line 3284
xp += ni;
+#line 3284
tp += ni;
+#line 3284
*xpp = (void*)xp;
+#line 3284
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3284
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3284
+#line 3284
#else /* not SX */
+#line 3284
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3284
+ int status = NC_NOERR;
+#line 3284
+#line 3284
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3284
{
+#line 3284
const int lstatus = ncx_get_ulonglong_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3284
+ if(lstatus != NC_NOERR)
+#line 3284
status = lstatus;
+#line 3284
}
+#line 3284
+#line 3284
*xpp = (const void *)xp;
+#line 3284
return status;
+#line 3284
# endif
+#line 3284
}
+#line 3284
int
+#line 3285
ncx_getn_ulonglong_short(const void **xpp, size_t nelems, short *tp)
+#line 3285
{
+#line 3285
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3285
+#line 3285
/* basic algorithm is:
+#line 3285
* - ensure sane alignment of input data
+#line 3285
* - copy (conversion happens automatically) input data
+#line 3285
* to output
+#line 3285
* - update xpp to point at next unconverted input, and tp to point
+#line 3285
* at next location for converted output
+#line 3285
*/
+#line 3285
long i, j, ni;
+#line 3285
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3285
ulonglong *xp;
+#line 3285
int nrange = 0; /* number of range errors */
+#line 3285
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3285
long cxp = (long) *((char**)xpp);
+#line 3285
+#line 3285
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3285
/* sjl: manually stripmine so we can limit amount of
+#line 3285
* vector work space reserved to LOOPCNT elements. Also
+#line 3285
* makes vectorisation easy */
+#line 3285
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3285
ni=Min(nelems-j,LOOPCNT);
+#line 3285
if (realign) {
+#line 3285
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3285
xp = tmp;
+#line 3285
} else {
+#line 3285
xp = (ulonglong *) *xpp;
+#line 3285
}
+#line 3285
/* copy the next block */
+#line 3285
#pragma cdir loopcnt=LOOPCNT
+#line 3285
#pragma cdir shortloop
+#line 3285
for (i=0; i<ni; i++) {
+#line 3285
tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
+#line 3285
/* test for range errors (not always needed but do it anyway) */
+#line 3285
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3285
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3285
nrange += xp[i] > SHORT_MAX ;
+#line 3285
}
+#line 3285
/* update xpp and tp */
+#line 3285
if (realign) xp = (ulonglong *) *xpp;
+#line 3285
xp += ni;
+#line 3285
tp += ni;
+#line 3285
*xpp = (void*)xp;
+#line 3285
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3285
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3285
+#line 3285
#else /* not SX */
+#line 3285
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3285
+ int status = NC_NOERR;
+#line 3285
+#line 3285
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3285
{
+#line 3285
const int lstatus = ncx_get_ulonglong_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3285
+ if(lstatus != NC_NOERR)
+#line 3285
status = lstatus;
+#line 3285
}
+#line 3285
+#line 3285
*xpp = (const void *)xp;
+#line 3285
return status;
+#line 3285
# endif
+#line 3285
}
+#line 3285
int
+#line 3286
ncx_getn_ulonglong_int(const void **xpp, size_t nelems, int *tp)
+#line 3286
{
+#line 3286
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3286
+#line 3286
/* basic algorithm is:
+#line 3286
* - ensure sane alignment of input data
+#line 3286
* - copy (conversion happens automatically) input data
+#line 3286
* to output
+#line 3286
* - update xpp to point at next unconverted input, and tp to point
+#line 3286
* at next location for converted output
+#line 3286
*/
+#line 3286
long i, j, ni;
+#line 3286
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3286
ulonglong *xp;
+#line 3286
int nrange = 0; /* number of range errors */
+#line 3286
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3286
long cxp = (long) *((char**)xpp);
+#line 3286
+#line 3286
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3286
/* sjl: manually stripmine so we can limit amount of
+#line 3286
* vector work space reserved to LOOPCNT elements. Also
+#line 3286
* makes vectorisation easy */
+#line 3286
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3286
ni=Min(nelems-j,LOOPCNT);
+#line 3286
if (realign) {
+#line 3286
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3286
xp = tmp;
+#line 3286
} else {
+#line 3286
xp = (ulonglong *) *xpp;
+#line 3286
}
+#line 3286
/* copy the next block */
+#line 3286
#pragma cdir loopcnt=LOOPCNT
+#line 3286
#pragma cdir shortloop
+#line 3286
for (i=0; i<ni; i++) {
+#line 3286
tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+#line 3286
/* test for range errors (not always needed but do it anyway) */
+#line 3286
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3286
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3286
nrange += xp[i] > INT_MAX ;
+#line 3286
}
+#line 3286
/* update xpp and tp */
+#line 3286
if (realign) xp = (ulonglong *) *xpp;
+#line 3286
xp += ni;
+#line 3286
tp += ni;
+#line 3286
*xpp = (void*)xp;
+#line 3286
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3286
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3286
+#line 3286
#else /* not SX */
+#line 3286
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3286
+ int status = NC_NOERR;
+#line 3286
+#line 3286
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3286
{
+#line 3286
const int lstatus = ncx_get_ulonglong_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3286
+ if(lstatus != NC_NOERR)
+#line 3286
status = lstatus;
+#line 3286
}
+#line 3286
+#line 3286
*xpp = (const void *)xp;
+#line 3286
return status;
+#line 3286
# endif
+#line 3286
}
+#line 3286
int
+#line 3287
ncx_getn_ulonglong_float(const void **xpp, size_t nelems, float *tp)
+#line 3287
{
+#line 3287
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3287
+#line 3287
/* basic algorithm is:
+#line 3287
* - ensure sane alignment of input data
+#line 3287
* - copy (conversion happens automatically) input data
+#line 3287
* to output
+#line 3287
* - update xpp to point at next unconverted input, and tp to point
+#line 3287
* at next location for converted output
+#line 3287
*/
+#line 3287
long i, j, ni;
+#line 3287
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3287
ulonglong *xp;
+#line 3287
int nrange = 0; /* number of range errors */
+#line 3287
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3287
long cxp = (long) *((char**)xpp);
+#line 3287
+#line 3287
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3287
/* sjl: manually stripmine so we can limit amount of
+#line 3287
* vector work space reserved to LOOPCNT elements. Also
+#line 3287
* makes vectorisation easy */
+#line 3287
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3287
ni=Min(nelems-j,LOOPCNT);
+#line 3287
if (realign) {
+#line 3287
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3287
xp = tmp;
+#line 3287
} else {
+#line 3287
xp = (ulonglong *) *xpp;
+#line 3287
}
+#line 3287
/* copy the next block */
+#line 3287
#pragma cdir loopcnt=LOOPCNT
+#line 3287
#pragma cdir shortloop
+#line 3287
for (i=0; i<ni; i++) {
+#line 3287
tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+#line 3287
/* test for range errors (not always needed but do it anyway) */
+#line 3287
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3287
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3287
nrange += xp[i] > FLOAT_MAX ;
+#line 3287
}
+#line 3287
/* update xpp and tp */
+#line 3287
if (realign) xp = (ulonglong *) *xpp;
+#line 3287
xp += ni;
+#line 3287
tp += ni;
+#line 3287
*xpp = (void*)xp;
+#line 3287
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3287
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3287
+#line 3287
#else /* not SX */
+#line 3287
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3287
+ int status = NC_NOERR;
+#line 3287
+#line 3287
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3287
{
+#line 3287
const int lstatus = ncx_get_ulonglong_float(xp, tp);
- if(lstatus != ENOERR)
+#line 3287
+ if(lstatus != NC_NOERR)
+#line 3287
status = lstatus;
+#line 3287
}
+#line 3287
+#line 3287
*xpp = (const void *)xp;
+#line 3287
return status;
+#line 3287
# endif
+#line 3287
}
+#line 3287
int
+#line 3288
ncx_getn_ulonglong_double(const void **xpp, size_t nelems, double *tp)
+#line 3288
{
+#line 3288
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3288
+#line 3288
/* basic algorithm is:
+#line 3288
* - ensure sane alignment of input data
+#line 3288
* - copy (conversion happens automatically) input data
+#line 3288
* to output
+#line 3288
* - update xpp to point at next unconverted input, and tp to point
+#line 3288
* at next location for converted output
+#line 3288
*/
+#line 3288
long i, j, ni;
+#line 3288
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3288
ulonglong *xp;
+#line 3288
int nrange = 0; /* number of range errors */
+#line 3288
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3288
long cxp = (long) *((char**)xpp);
+#line 3288
+#line 3288
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3288
/* sjl: manually stripmine so we can limit amount of
+#line 3288
* vector work space reserved to LOOPCNT elements. Also
+#line 3288
* makes vectorisation easy */
+#line 3288
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3288
ni=Min(nelems-j,LOOPCNT);
+#line 3288
if (realign) {
+#line 3288
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3288
xp = tmp;
+#line 3288
} else {
+#line 3288
xp = (ulonglong *) *xpp;
+#line 3288
}
+#line 3288
/* copy the next block */
+#line 3288
#pragma cdir loopcnt=LOOPCNT
+#line 3288
#pragma cdir shortloop
+#line 3288
for (i=0; i<ni; i++) {
+#line 3288
tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+#line 3288
/* test for range errors (not always needed but do it anyway) */
+#line 3288
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3288
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3288
nrange += xp[i] > DOUBLE_MAX ;
+#line 3288
}
+#line 3288
/* update xpp and tp */
+#line 3288
if (realign) xp = (ulonglong *) *xpp;
+#line 3288
xp += ni;
+#line 3288
tp += ni;
+#line 3288
*xpp = (void*)xp;
+#line 3288
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3288
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3288
+#line 3288
#else /* not SX */
+#line 3288
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3288
+ int status = NC_NOERR;
+#line 3288
+#line 3288
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3288
{
+#line 3288
const int lstatus = ncx_get_ulonglong_double(xp, tp);
- if(lstatus != ENOERR)
+#line 3288
+ if(lstatus != NC_NOERR)
+#line 3288
status = lstatus;
+#line 3288
}
+#line 3288
+#line 3288
*xpp = (const void *)xp;
+#line 3288
return status;
+#line 3288
# endif
+#line 3288
}
+#line 3288
int
+#line 3289
ncx_getn_ulonglong_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3289
{
+#line 3289
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3289
+#line 3289
/* basic algorithm is:
+#line 3289
* - ensure sane alignment of input data
+#line 3289
* - copy (conversion happens automatically) input data
+#line 3289
* to output
+#line 3289
* - update xpp to point at next unconverted input, and tp to point
+#line 3289
* at next location for converted output
+#line 3289
*/
+#line 3289
long i, j, ni;
+#line 3289
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3289
ulonglong *xp;
+#line 3289
int nrange = 0; /* number of range errors */
+#line 3289
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3289
long cxp = (long) *((char**)xpp);
+#line 3289
+#line 3289
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3289
/* sjl: manually stripmine so we can limit amount of
+#line 3289
* vector work space reserved to LOOPCNT elements. Also
+#line 3289
* makes vectorisation easy */
+#line 3289
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3289
ni=Min(nelems-j,LOOPCNT);
+#line 3289
if (realign) {
+#line 3289
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3289
xp = tmp;
+#line 3289
} else {
+#line 3289
xp = (ulonglong *) *xpp;
+#line 3289
}
+#line 3289
/* copy the next block */
+#line 3289
#pragma cdir loopcnt=LOOPCNT
+#line 3289
#pragma cdir shortloop
+#line 3289
for (i=0; i<ni; i++) {
+#line 3289
tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 3289
/* test for range errors (not always needed but do it anyway) */
+#line 3289
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3289
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3289
nrange += xp[i] > LONGLONG_MAX ;
+#line 3289
}
+#line 3289
/* update xpp and tp */
+#line 3289
if (realign) xp = (ulonglong *) *xpp;
+#line 3289
xp += ni;
+#line 3289
tp += ni;
+#line 3289
*xpp = (void*)xp;
+#line 3289
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3289
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3289
+#line 3289
#else /* not SX */
+#line 3289
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3289
+ int status = NC_NOERR;
+#line 3289
+#line 3289
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3289
{
+#line 3289
const int lstatus = ncx_get_ulonglong_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3289
+ if(lstatus != NC_NOERR)
+#line 3289
status = lstatus;
+#line 3289
}
+#line 3289
+#line 3289
*xpp = (const void *)xp;
+#line 3289
return status;
+#line 3289
# endif
+#line 3289
}
+#line 3289
int
+#line 3290
ncx_getn_ulonglong_uchar(const void **xpp, size_t nelems, uchar *tp)
+#line 3290
{
+#line 3290
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3290
+#line 3290
/* basic algorithm is:
+#line 3290
* - ensure sane alignment of input data
+#line 3290
* - copy (conversion happens automatically) input data
+#line 3290
* to output
+#line 3290
* - update xpp to point at next unconverted input, and tp to point
+#line 3290
* at next location for converted output
+#line 3290
*/
+#line 3290
long i, j, ni;
+#line 3290
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3290
ulonglong *xp;
+#line 3290
int nrange = 0; /* number of range errors */
+#line 3290
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3290
long cxp = (long) *((char**)xpp);
+#line 3290
+#line 3290
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3290
/* sjl: manually stripmine so we can limit amount of
+#line 3290
* vector work space reserved to LOOPCNT elements. Also
+#line 3290
* makes vectorisation easy */
+#line 3290
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3290
ni=Min(nelems-j,LOOPCNT);
+#line 3290
if (realign) {
+#line 3290
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3290
xp = tmp;
+#line 3290
} else {
+#line 3290
xp = (ulonglong *) *xpp;
+#line 3290
}
+#line 3290
/* copy the next block */
+#line 3290
#pragma cdir loopcnt=LOOPCNT
+#line 3290
#pragma cdir shortloop
+#line 3290
for (i=0; i<ni; i++) {
+#line 3290
tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 3290
/* test for range errors (not always needed but do it anyway) */
+#line 3290
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3290
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3290
nrange += xp[i] > UCHAR_MAX ;
+#line 3290
}
+#line 3290
/* update xpp and tp */
+#line 3290
if (realign) xp = (ulonglong *) *xpp;
+#line 3290
xp += ni;
+#line 3290
tp += ni;
+#line 3290
*xpp = (void*)xp;
+#line 3290
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3290
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3290
+#line 3290
#else /* not SX */
+#line 3290
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3290
+ int status = NC_NOERR;
+#line 3290
+#line 3290
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3290
{
+#line 3290
const int lstatus = ncx_get_ulonglong_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3290
+ if(lstatus != NC_NOERR)
+#line 3290
status = lstatus;
+#line 3290
}
+#line 3290
+#line 3290
*xpp = (const void *)xp;
+#line 3290
return status;
+#line 3290
# endif
+#line 3290
}
+#line 3290
int
+#line 3291
ncx_getn_ulonglong_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 3291
{
+#line 3291
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3291
+#line 3291
/* basic algorithm is:
+#line 3291
* - ensure sane alignment of input data
+#line 3291
* - copy (conversion happens automatically) input data
+#line 3291
* to output
+#line 3291
* - update xpp to point at next unconverted input, and tp to point
+#line 3291
* at next location for converted output
+#line 3291
*/
+#line 3291
long i, j, ni;
+#line 3291
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3291
ulonglong *xp;
+#line 3291
int nrange = 0; /* number of range errors */
+#line 3291
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3291
long cxp = (long) *((char**)xpp);
+#line 3291
+#line 3291
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3291
/* sjl: manually stripmine so we can limit amount of
+#line 3291
* vector work space reserved to LOOPCNT elements. Also
+#line 3291
* makes vectorisation easy */
+#line 3291
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3291
ni=Min(nelems-j,LOOPCNT);
+#line 3291
if (realign) {
+#line 3291
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3291
xp = tmp;
+#line 3291
} else {
+#line 3291
xp = (ulonglong *) *xpp;
+#line 3291
}
+#line 3291
/* copy the next block */
+#line 3291
#pragma cdir loopcnt=LOOPCNT
+#line 3291
#pragma cdir shortloop
+#line 3291
for (i=0; i<ni; i++) {
+#line 3291
tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
+#line 3291
/* test for range errors (not always needed but do it anyway) */
+#line 3291
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3291
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3291
nrange += xp[i] > USHORT_MAX ;
+#line 3291
}
+#line 3291
/* update xpp and tp */
+#line 3291
if (realign) xp = (ulonglong *) *xpp;
+#line 3291
xp += ni;
+#line 3291
tp += ni;
+#line 3291
*xpp = (void*)xp;
+#line 3291
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3291
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3291
+#line 3291
#else /* not SX */
+#line 3291
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3291
+ int status = NC_NOERR;
+#line 3291
+#line 3291
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3291
{
+#line 3291
const int lstatus = ncx_get_ulonglong_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3291
+ if(lstatus != NC_NOERR)
+#line 3291
status = lstatus;
+#line 3291
}
+#line 3291
+#line 3291
*xpp = (const void *)xp;
+#line 3291
return status;
+#line 3291
# endif
+#line 3291
}
+#line 3291
int
+#line 3292
ncx_getn_ulonglong_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3292
{
+#line 3292
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3292
+#line 3292
/* basic algorithm is:
+#line 3292
* - ensure sane alignment of input data
+#line 3292
* - copy (conversion happens automatically) input data
+#line 3292
* to output
+#line 3292
* - update xpp to point at next unconverted input, and tp to point
+#line 3292
* at next location for converted output
+#line 3292
*/
+#line 3292
long i, j, ni;
+#line 3292
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3292
ulonglong *xp;
+#line 3292
int nrange = 0; /* number of range errors */
+#line 3292
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3292
long cxp = (long) *((char**)xpp);
+#line 3292
+#line 3292
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3292
/* sjl: manually stripmine so we can limit amount of
+#line 3292
* vector work space reserved to LOOPCNT elements. Also
+#line 3292
* makes vectorisation easy */
+#line 3292
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3292
ni=Min(nelems-j,LOOPCNT);
+#line 3292
if (realign) {
+#line 3292
memcpy(tmp, *xpp, ni*SIZEOF_ULONGLONG);
+#line 3292
xp = tmp;
+#line 3292
} else {
+#line 3292
xp = (ulonglong *) *xpp;
+#line 3292
}
+#line 3292
/* copy the next block */
+#line 3292
#pragma cdir loopcnt=LOOPCNT
+#line 3292
#pragma cdir shortloop
+#line 3292
for (i=0; i<ni; i++) {
+#line 3292
tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 3292
/* test for range errors (not always needed but do it anyway) */
+#line 3292
/* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3292
/* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3292
nrange += xp[i] > UINT_MAX ;
+#line 3292
}
+#line 3292
/* update xpp and tp */
+#line 3292
if (realign) xp = (ulonglong *) *xpp;
+#line 3292
xp += ni;
+#line 3292
tp += ni;
+#line 3292
*xpp = (void*)xp;
+#line 3292
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3292
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3292
+#line 3292
#else /* not SX */
+#line 3292
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+#line 3292
+ int status = NC_NOERR;
+#line 3292
+#line 3292
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3292
{
+#line 3292
const int lstatus = ncx_get_ulonglong_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3292
+ if(lstatus != NC_NOERR)
+#line 3292
status = lstatus;
+#line 3292
}
+#line 3292
+#line 3292
*xpp = (const void *)xp;
+#line 3292
return status;
+#line 3292
# endif
+#line 3292
}
+#line 3292
#if X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
@@ -16518,709 +30676,1399 @@ ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const unsigned long long
swapn8b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_ULONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
+#line 3308
ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const ulonglong *tp)
+#line 3308
{
+#line 3308
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3308
+#line 3308
/* basic algorithm is:
+#line 3308
* - ensure sane alignment of output data
+#line 3308
* - copy (conversion happens automatically) input data
+#line 3308
* to output
+#line 3308
* - update tp to point at next unconverted input, and xpp to point
+#line 3308
* at next location for converted output
+#line 3308
*/
+#line 3308
long i, j, ni;
+#line 3308
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3308
ulonglong *xp;
+#line 3308
int nrange = 0; /* number of range errors */
+#line 3308
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3308
long cxp = (long) *((char**)xpp);
+#line 3308
+#line 3308
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3308
/* sjl: manually stripmine so we can limit amount of
+#line 3308
* vector work space reserved to LOOPCNT elements. Also
+#line 3308
* makes vectorisation easy */
+#line 3308
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3308
ni=Min(nelems-j,LOOPCNT);
+#line 3308
if (realign) {
+#line 3308
xp = tmp;
+#line 3308
} else {
+#line 3308
xp = (ulonglong *) *xpp;
+#line 3308
}
+#line 3308
/* copy the next block */
+#line 3308
#pragma cdir loopcnt=LOOPCNT
+#line 3308
#pragma cdir shortloop
+#line 3308
for (i=0; i<ni; i++) {
+#line 3308
/* the normal case: */
+#line 3308
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3308
/* test for range errors (not always needed but do it anyway) */
+#line 3308
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3308
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3308
nrange += tp[i] > X_ULONGLONG_MAX ;
+#line 3308
}
+#line 3308
/* copy workspace back if necessary */
+#line 3308
if (realign) {
+#line 3308
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3308
xp = (ulonglong *) *xpp;
+#line 3308
}
+#line 3308
/* update xpp and tp */
+#line 3308
xp += ni;
+#line 3308
tp += ni;
+#line 3308
*xpp = (void*)xp;
+#line 3308
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3308
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3308
+#line 3308
#else /* not SX */
+#line 3308
+#line 3308
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3308
+ int status = NC_NOERR;
+#line 3308
+#line 3308
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3308
{
+#line 3308
int lstatus = ncx_put_ulonglong_ulonglong(xp, tp);
- if(lstatus != ENOERR)
+#line 3308
+ if(lstatus != NC_NOERR)
+#line 3308
status = lstatus;
+#line 3308
}
+#line 3308
+#line 3308
*xpp = (void *)xp;
+#line 3308
return status;
+#line 3308
#endif
+#line 3308
}
+#line 3308
#endif
int
+#line 3310
ncx_putn_ulonglong_schar(void **xpp, size_t nelems, const schar *tp)
+#line 3310
{
+#line 3310
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3310
+#line 3310
/* basic algorithm is:
+#line 3310
* - ensure sane alignment of output data
+#line 3310
* - copy (conversion happens automatically) input data
+#line 3310
* to output
+#line 3310
* - update tp to point at next unconverted input, and xpp to point
+#line 3310
* at next location for converted output
+#line 3310
*/
+#line 3310
long i, j, ni;
+#line 3310
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3310
ulonglong *xp;
+#line 3310
int nrange = 0; /* number of range errors */
+#line 3310
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3310
long cxp = (long) *((char**)xpp);
+#line 3310
+#line 3310
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3310
/* sjl: manually stripmine so we can limit amount of
+#line 3310
* vector work space reserved to LOOPCNT elements. Also
+#line 3310
* makes vectorisation easy */
+#line 3310
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3310
ni=Min(nelems-j,LOOPCNT);
+#line 3310
if (realign) {
+#line 3310
xp = tmp;
+#line 3310
} else {
+#line 3310
xp = (ulonglong *) *xpp;
+#line 3310
}
+#line 3310
/* copy the next block */
+#line 3310
#pragma cdir loopcnt=LOOPCNT
+#line 3310
#pragma cdir shortloop
+#line 3310
for (i=0; i<ni; i++) {
+#line 3310
/* the normal case: */
+#line 3310
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3310
/* test for range errors (not always needed but do it anyway) */
+#line 3310
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3310
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3310
nrange += tp[i] > X_ULONGLONG_MAX || tp[i] < 0;
+#line 3310
}
+#line 3310
/* copy workspace back if necessary */
+#line 3310
if (realign) {
+#line 3310
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3310
xp = (ulonglong *) *xpp;
+#line 3310
}
+#line 3310
/* update xpp and tp */
+#line 3310
xp += ni;
+#line 3310
tp += ni;
+#line 3310
*xpp = (void*)xp;
+#line 3310
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3310
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3310
+#line 3310
#else /* not SX */
+#line 3310
+#line 3310
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3310
+ int status = NC_NOERR;
+#line 3310
+#line 3310
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3310
{
+#line 3310
int lstatus = ncx_put_ulonglong_schar(xp, tp);
- if(lstatus != ENOERR)
+#line 3310
+ if(lstatus != NC_NOERR)
+#line 3310
status = lstatus;
+#line 3310
}
+#line 3310
+#line 3310
*xpp = (void *)xp;
+#line 3310
return status;
+#line 3310
#endif
+#line 3310
}
+#line 3310
int
+#line 3311
ncx_putn_ulonglong_short(void **xpp, size_t nelems, const short *tp)
+#line 3311
{
+#line 3311
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3311
+#line 3311
/* basic algorithm is:
+#line 3311
* - ensure sane alignment of output data
+#line 3311
* - copy (conversion happens automatically) input data
+#line 3311
* to output
+#line 3311
* - update tp to point at next unconverted input, and xpp to point
+#line 3311
* at next location for converted output
+#line 3311
*/
+#line 3311
long i, j, ni;
+#line 3311
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3311
ulonglong *xp;
+#line 3311
int nrange = 0; /* number of range errors */
+#line 3311
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3311
long cxp = (long) *((char**)xpp);
+#line 3311
+#line 3311
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3311
/* sjl: manually stripmine so we can limit amount of
+#line 3311
* vector work space reserved to LOOPCNT elements. Also
+#line 3311
* makes vectorisation easy */
+#line 3311
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3311
ni=Min(nelems-j,LOOPCNT);
+#line 3311
if (realign) {
+#line 3311
xp = tmp;
+#line 3311
} else {
+#line 3311
xp = (ulonglong *) *xpp;
+#line 3311
}
+#line 3311
/* copy the next block */
+#line 3311
#pragma cdir loopcnt=LOOPCNT
+#line 3311
#pragma cdir shortloop
+#line 3311
for (i=0; i<ni; i++) {
+#line 3311
/* the normal case: */
+#line 3311
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3311
/* test for range errors (not always needed but do it anyway) */
+#line 3311
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3311
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3311
nrange += tp[i] > X_ULONGLONG_MAX || tp[i] < 0;
+#line 3311
}
+#line 3311
/* copy workspace back if necessary */
+#line 3311
if (realign) {
+#line 3311
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3311
xp = (ulonglong *) *xpp;
+#line 3311
}
+#line 3311
/* update xpp and tp */
+#line 3311
xp += ni;
+#line 3311
tp += ni;
+#line 3311
*xpp = (void*)xp;
+#line 3311
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3311
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3311
+#line 3311
#else /* not SX */
+#line 3311
+#line 3311
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3311
+ int status = NC_NOERR;
+#line 3311
+#line 3311
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3311
{
+#line 3311
int lstatus = ncx_put_ulonglong_short(xp, tp);
- if(lstatus != ENOERR)
+#line 3311
+ if(lstatus != NC_NOERR)
+#line 3311
status = lstatus;
+#line 3311
}
+#line 3311
+#line 3311
*xpp = (void *)xp;
+#line 3311
return status;
+#line 3311
#endif
+#line 3311
}
+#line 3311
int
+#line 3312
ncx_putn_ulonglong_int(void **xpp, size_t nelems, const int *tp)
+#line 3312
{
+#line 3312
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3312
+#line 3312
/* basic algorithm is:
+#line 3312
* - ensure sane alignment of output data
+#line 3312
* - copy (conversion happens automatically) input data
+#line 3312
* to output
+#line 3312
* - update tp to point at next unconverted input, and xpp to point
+#line 3312
* at next location for converted output
+#line 3312
*/
+#line 3312
long i, j, ni;
+#line 3312
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3312
ulonglong *xp;
+#line 3312
int nrange = 0; /* number of range errors */
+#line 3312
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3312
long cxp = (long) *((char**)xpp);
+#line 3312
+#line 3312
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3312
/* sjl: manually stripmine so we can limit amount of
+#line 3312
* vector work space reserved to LOOPCNT elements. Also
+#line 3312
* makes vectorisation easy */
+#line 3312
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3312
ni=Min(nelems-j,LOOPCNT);
+#line 3312
if (realign) {
+#line 3312
xp = tmp;
+#line 3312
} else {
+#line 3312
xp = (ulonglong *) *xpp;
+#line 3312
}
+#line 3312
/* copy the next block */
+#line 3312
#pragma cdir loopcnt=LOOPCNT
+#line 3312
#pragma cdir shortloop
+#line 3312
for (i=0; i<ni; i++) {
+#line 3312
/* the normal case: */
+#line 3312
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3312
/* test for range errors (not always needed but do it anyway) */
+#line 3312
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3312
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3312
nrange += tp[i] > X_ULONGLONG_MAX || tp[i] < 0;
+#line 3312
}
+#line 3312
/* copy workspace back if necessary */
+#line 3312
if (realign) {
+#line 3312
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3312
xp = (ulonglong *) *xpp;
+#line 3312
}
+#line 3312
/* update xpp and tp */
+#line 3312
xp += ni;
+#line 3312
tp += ni;
+#line 3312
*xpp = (void*)xp;
+#line 3312
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3312
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3312
+#line 3312
#else /* not SX */
+#line 3312
+#line 3312
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3312
+ int status = NC_NOERR;
+#line 3312
+#line 3312
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3312
{
+#line 3312
int lstatus = ncx_put_ulonglong_int(xp, tp);
- if(lstatus != ENOERR)
+#line 3312
+ if(lstatus != NC_NOERR)
+#line 3312
status = lstatus;
+#line 3312
}
+#line 3312
+#line 3312
*xpp = (void *)xp;
+#line 3312
return status;
+#line 3312
#endif
+#line 3312
}
+#line 3312
int
+#line 3313
ncx_putn_ulonglong_float(void **xpp, size_t nelems, const float *tp)
+#line 3313
{
+#line 3313
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3313
+#line 3313
/* basic algorithm is:
+#line 3313
* - ensure sane alignment of output data
+#line 3313
* - copy (conversion happens automatically) input data
+#line 3313
* to output
+#line 3313
* - update tp to point at next unconverted input, and xpp to point
+#line 3313
* at next location for converted output
+#line 3313
*/
+#line 3313
long i, j, ni;
+#line 3313
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3313
ulonglong *xp;
+#line 3313
int nrange = 0; /* number of range errors */
+#line 3313
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3313
long cxp = (long) *((char**)xpp);
+#line 3313
+#line 3313
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3313
/* sjl: manually stripmine so we can limit amount of
+#line 3313
* vector work space reserved to LOOPCNT elements. Also
+#line 3313
* makes vectorisation easy */
+#line 3313
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3313
ni=Min(nelems-j,LOOPCNT);
+#line 3313
if (realign) {
+#line 3313
xp = tmp;
+#line 3313
} else {
+#line 3313
xp = (ulonglong *) *xpp;
+#line 3313
}
+#line 3313
/* copy the next block */
+#line 3313
#pragma cdir loopcnt=LOOPCNT
+#line 3313
#pragma cdir shortloop
+#line 3313
for (i=0; i<ni; i++) {
+#line 3313
/* the normal case: */
+#line 3313
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3313
/* test for range errors (not always needed but do it anyway) */
+#line 3313
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3313
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3313
nrange += tp[i] > X_ULONGLONG_MAX || tp[i] < 0;
+#line 3313
}
+#line 3313
/* copy workspace back if necessary */
+#line 3313
if (realign) {
+#line 3313
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3313
xp = (ulonglong *) *xpp;
+#line 3313
}
+#line 3313
/* update xpp and tp */
+#line 3313
xp += ni;
+#line 3313
tp += ni;
+#line 3313
*xpp = (void*)xp;
+#line 3313
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3313
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3313
+#line 3313
#else /* not SX */
+#line 3313
+#line 3313
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3313
+ int status = NC_NOERR;
+#line 3313
+#line 3313
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3313
{
+#line 3313
int lstatus = ncx_put_ulonglong_float(xp, tp);
- if(lstatus != ENOERR)
+#line 3313
+ if(lstatus != NC_NOERR)
+#line 3313
status = lstatus;
+#line 3313
}
+#line 3313
+#line 3313
*xpp = (void *)xp;
+#line 3313
return status;
+#line 3313
#endif
+#line 3313
}
+#line 3313
int
+#line 3314
ncx_putn_ulonglong_double(void **xpp, size_t nelems, const double *tp)
+#line 3314
{
+#line 3314
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3314
+#line 3314
/* basic algorithm is:
+#line 3314
* - ensure sane alignment of output data
+#line 3314
* - copy (conversion happens automatically) input data
+#line 3314
* to output
+#line 3314
* - update tp to point at next unconverted input, and xpp to point
+#line 3314
* at next location for converted output
+#line 3314
*/
+#line 3314
long i, j, ni;
+#line 3314
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3314
ulonglong *xp;
+#line 3314
int nrange = 0; /* number of range errors */
+#line 3314
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3314
long cxp = (long) *((char**)xpp);
+#line 3314
+#line 3314
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3314
/* sjl: manually stripmine so we can limit amount of
+#line 3314
* vector work space reserved to LOOPCNT elements. Also
+#line 3314
* makes vectorisation easy */
+#line 3314
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3314
ni=Min(nelems-j,LOOPCNT);
+#line 3314
if (realign) {
+#line 3314
xp = tmp;
+#line 3314
} else {
+#line 3314
xp = (ulonglong *) *xpp;
+#line 3314
}
+#line 3314
/* copy the next block */
+#line 3314
#pragma cdir loopcnt=LOOPCNT
+#line 3314
#pragma cdir shortloop
+#line 3314
for (i=0; i<ni; i++) {
+#line 3314
/* the normal case: */
+#line 3314
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3314
/* test for range errors (not always needed but do it anyway) */
+#line 3314
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3314
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3314
nrange += tp[i] > X_ULONGLONG_MAX || tp[i] < 0;
+#line 3314
}
+#line 3314
/* copy workspace back if necessary */
+#line 3314
if (realign) {
+#line 3314
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3314
xp = (ulonglong *) *xpp;
+#line 3314
}
+#line 3314
/* update xpp and tp */
+#line 3314
xp += ni;
+#line 3314
tp += ni;
+#line 3314
*xpp = (void*)xp;
+#line 3314
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3314
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3314
+#line 3314
#else /* not SX */
+#line 3314
+#line 3314
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3314
+ int status = NC_NOERR;
+#line 3314
+#line 3314
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3314
{
+#line 3314
int lstatus = ncx_put_ulonglong_double(xp, tp);
- if(lstatus != ENOERR)
+#line 3314
+ if(lstatus != NC_NOERR)
+#line 3314
status = lstatus;
+#line 3314
}
+#line 3314
+#line 3314
*xpp = (void *)xp;
+#line 3314
return status;
+#line 3314
#endif
+#line 3314
}
+#line 3314
int
+#line 3315
ncx_putn_ulonglong_longlong(void **xpp, size_t nelems, const longlong *tp)
+#line 3315
{
+#line 3315
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3315
+#line 3315
/* basic algorithm is:
+#line 3315
* - ensure sane alignment of output data
+#line 3315
* - copy (conversion happens automatically) input data
+#line 3315
* to output
+#line 3315
* - update tp to point at next unconverted input, and xpp to point
+#line 3315
* at next location for converted output
+#line 3315
*/
+#line 3315
long i, j, ni;
+#line 3315
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3315
ulonglong *xp;
+#line 3315
int nrange = 0; /* number of range errors */
+#line 3315
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3315
long cxp = (long) *((char**)xpp);
+#line 3315
+#line 3315
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3315
/* sjl: manually stripmine so we can limit amount of
+#line 3315
* vector work space reserved to LOOPCNT elements. Also
+#line 3315
* makes vectorisation easy */
+#line 3315
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3315
ni=Min(nelems-j,LOOPCNT);
+#line 3315
if (realign) {
+#line 3315
xp = tmp;
+#line 3315
} else {
+#line 3315
xp = (ulonglong *) *xpp;
+#line 3315
}
+#line 3315
/* copy the next block */
+#line 3315
#pragma cdir loopcnt=LOOPCNT
+#line 3315
#pragma cdir shortloop
+#line 3315
for (i=0; i<ni; i++) {
+#line 3315
/* the normal case: */
+#line 3315
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3315
/* test for range errors (not always needed but do it anyway) */
+#line 3315
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3315
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3315
nrange += tp[i] > X_ULONGLONG_MAX || tp[i] < 0;
+#line 3315
}
+#line 3315
/* copy workspace back if necessary */
+#line 3315
if (realign) {
+#line 3315
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3315
xp = (ulonglong *) *xpp;
+#line 3315
}
+#line 3315
/* update xpp and tp */
+#line 3315
xp += ni;
+#line 3315
tp += ni;
+#line 3315
*xpp = (void*)xp;
+#line 3315
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3315
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3315
+#line 3315
#else /* not SX */
+#line 3315
+#line 3315
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3315
+ int status = NC_NOERR;
+#line 3315
+#line 3315
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3315
{
+#line 3315
int lstatus = ncx_put_ulonglong_longlong(xp, tp);
- if(lstatus != ENOERR)
+#line 3315
+ if(lstatus != NC_NOERR)
+#line 3315
status = lstatus;
+#line 3315
}
+#line 3315
+#line 3315
*xpp = (void *)xp;
+#line 3315
return status;
+#line 3315
#endif
+#line 3315
}
+#line 3315
int
+#line 3316
ncx_putn_ulonglong_uchar(void **xpp, size_t nelems, const uchar *tp)
+#line 3316
{
+#line 3316
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3316
+#line 3316
/* basic algorithm is:
+#line 3316
* - ensure sane alignment of output data
+#line 3316
* - copy (conversion happens automatically) input data
+#line 3316
* to output
+#line 3316
* - update tp to point at next unconverted input, and xpp to point
+#line 3316
* at next location for converted output
+#line 3316
*/
+#line 3316
long i, j, ni;
+#line 3316
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3316
ulonglong *xp;
+#line 3316
int nrange = 0; /* number of range errors */
+#line 3316
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3316
long cxp = (long) *((char**)xpp);
+#line 3316
+#line 3316
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3316
/* sjl: manually stripmine so we can limit amount of
+#line 3316
* vector work space reserved to LOOPCNT elements. Also
+#line 3316
* makes vectorisation easy */
+#line 3316
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3316
ni=Min(nelems-j,LOOPCNT);
+#line 3316
if (realign) {
+#line 3316
xp = tmp;
+#line 3316
} else {
+#line 3316
xp = (ulonglong *) *xpp;
+#line 3316
}
+#line 3316
/* copy the next block */
+#line 3316
#pragma cdir loopcnt=LOOPCNT
+#line 3316
#pragma cdir shortloop
+#line 3316
for (i=0; i<ni; i++) {
+#line 3316
/* the normal case: */
+#line 3316
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3316
/* test for range errors (not always needed but do it anyway) */
+#line 3316
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3316
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3316
nrange += tp[i] > X_ULONGLONG_MAX ;
+#line 3316
}
+#line 3316
/* copy workspace back if necessary */
+#line 3316
if (realign) {
+#line 3316
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3316
xp = (ulonglong *) *xpp;
+#line 3316
}
+#line 3316
/* update xpp and tp */
+#line 3316
xp += ni;
+#line 3316
tp += ni;
+#line 3316
*xpp = (void*)xp;
+#line 3316
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3316
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3316
+#line 3316
#else /* not SX */
+#line 3316
+#line 3316
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3316
+ int status = NC_NOERR;
+#line 3316
+#line 3316
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3316
{
+#line 3316
int lstatus = ncx_put_ulonglong_uchar(xp, tp);
- if(lstatus != ENOERR)
+#line 3316
+ if(lstatus != NC_NOERR)
+#line 3316
status = lstatus;
+#line 3316
}
+#line 3316
+#line 3316
*xpp = (void *)xp;
+#line 3316
return status;
+#line 3316
#endif
+#line 3316
}
+#line 3316
int
+#line 3317
ncx_putn_ulonglong_ushort(void **xpp, size_t nelems, const ushort *tp)
+#line 3317
{
+#line 3317
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3317
+#line 3317
/* basic algorithm is:
+#line 3317
* - ensure sane alignment of output data
+#line 3317
* - copy (conversion happens automatically) input data
+#line 3317
* to output
+#line 3317
* - update tp to point at next unconverted input, and xpp to point
+#line 3317
* at next location for converted output
+#line 3317
*/
+#line 3317
long i, j, ni;
+#line 3317
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3317
ulonglong *xp;
+#line 3317
int nrange = 0; /* number of range errors */
+#line 3317
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3317
long cxp = (long) *((char**)xpp);
+#line 3317
+#line 3317
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3317
/* sjl: manually stripmine so we can limit amount of
+#line 3317
* vector work space reserved to LOOPCNT elements. Also
+#line 3317
* makes vectorisation easy */
+#line 3317
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3317
ni=Min(nelems-j,LOOPCNT);
+#line 3317
if (realign) {
+#line 3317
xp = tmp;
+#line 3317
} else {
+#line 3317
xp = (ulonglong *) *xpp;
+#line 3317
}
+#line 3317
/* copy the next block */
+#line 3317
#pragma cdir loopcnt=LOOPCNT
+#line 3317
#pragma cdir shortloop
+#line 3317
for (i=0; i<ni; i++) {
+#line 3317
/* the normal case: */
+#line 3317
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3317
/* test for range errors (not always needed but do it anyway) */
+#line 3317
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3317
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3317
nrange += tp[i] > X_ULONGLONG_MAX ;
+#line 3317
}
+#line 3317
/* copy workspace back if necessary */
+#line 3317
if (realign) {
+#line 3317
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3317
xp = (ulonglong *) *xpp;
+#line 3317
}
+#line 3317
/* update xpp and tp */
+#line 3317
xp += ni;
+#line 3317
tp += ni;
+#line 3317
*xpp = (void*)xp;
+#line 3317
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3317
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3317
+#line 3317
#else /* not SX */
+#line 3317
+#line 3317
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3317
+ int status = NC_NOERR;
+#line 3317
+#line 3317
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3317
{
+#line 3317
int lstatus = ncx_put_ulonglong_ushort(xp, tp);
- if(lstatus != ENOERR)
+#line 3317
+ if(lstatus != NC_NOERR)
+#line 3317
status = lstatus;
+#line 3317
}
+#line 3317
+#line 3317
*xpp = (void *)xp;
+#line 3317
return status;
+#line 3317
#endif
+#line 3317
}
+#line 3317
int
+#line 3318
ncx_putn_ulonglong_uint(void **xpp, size_t nelems, const uint *tp)
+#line 3318
{
+#line 3318
#if _SX && X_SIZEOF_ULONGLONG == SIZEOF_ULONGLONG
+#line 3318
+#line 3318
/* basic algorithm is:
+#line 3318
* - ensure sane alignment of output data
+#line 3318
* - copy (conversion happens automatically) input data
+#line 3318
* to output
+#line 3318
* - update tp to point at next unconverted input, and xpp to point
+#line 3318
* at next location for converted output
+#line 3318
*/
+#line 3318
long i, j, ni;
+#line 3318
ulonglong tmp[LOOPCNT]; /* in case input is misaligned */
+#line 3318
ulonglong *xp;
+#line 3318
int nrange = 0; /* number of range errors */
+#line 3318
int realign = 0; /* "do we need to fix input data alignment?" */
+#line 3318
long cxp = (long) *((char**)xpp);
+#line 3318
+#line 3318
realign = (cxp & 7) % SIZEOF_ULONGLONG;
+#line 3318
/* sjl: manually stripmine so we can limit amount of
+#line 3318
* vector work space reserved to LOOPCNT elements. Also
+#line 3318
* makes vectorisation easy */
+#line 3318
for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3318
ni=Min(nelems-j,LOOPCNT);
+#line 3318
if (realign) {
+#line 3318
xp = tmp;
+#line 3318
} else {
+#line 3318
xp = (ulonglong *) *xpp;
+#line 3318
}
+#line 3318
/* copy the next block */
+#line 3318
#pragma cdir loopcnt=LOOPCNT
+#line 3318
#pragma cdir shortloop
+#line 3318
for (i=0; i<ni; i++) {
+#line 3318
/* the normal case: */
+#line 3318
xp[i] = (ulonglong) Max( X_ULONGLONG_MIN, Min(X_ULONGLONG_MAX, (ulonglong) tp[i]));
+#line 3318
/* test for range errors (not always needed but do it anyway) */
+#line 3318
/* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3318
/* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3318
nrange += tp[i] > X_ULONGLONG_MAX ;
+#line 3318
}
+#line 3318
/* copy workspace back if necessary */
+#line 3318
if (realign) {
+#line 3318
memcpy(*xpp, tmp, ni*X_SIZEOF_ULONGLONG);
+#line 3318
xp = (ulonglong *) *xpp;
+#line 3318
}
+#line 3318
/* update xpp and tp */
+#line 3318
xp += ni;
+#line 3318
tp += ni;
+#line 3318
*xpp = (void*)xp;
+#line 3318
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+#line 3318
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3318
+#line 3318
#else /* not SX */
+#line 3318
+#line 3318
char *xp = (char *) *xpp;
- int status = ENOERR;
+#line 3318
+ int status = NC_NOERR;
+#line 3318
+#line 3318
for( ; nelems != 0; nelems--, xp += X_SIZEOF_ULONGLONG, tp++)
+#line 3318
{
+#line 3318
int lstatus = ncx_put_ulonglong_uint(xp, tp);
- if(lstatus != ENOERR)
+#line 3318
+ if(lstatus != NC_NOERR)
+#line 3318
status = lstatus;
+#line 3318
}
+#line 3318
+#line 3318
*xpp = (void *)xp;
+#line 3318
return status;
+#line 3318
#endif
+#line 3318
}
+#line 3318
@@ -17229,59 +32077,108 @@ ncx_putn_ulonglong_uint(void **xpp, size_t nelems, const uint *tp)
*/
/* text */
-
+#ifdef __arm__
+int
+ncx_getn_text(const void **xpp, size_t nelems, signed char *tp)
+#else
int
ncx_getn_text(const void **xpp, size_t nelems, char *tp)
+#endif
{
(void) memcpy(tp, *xpp, nelems);
- *xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+#line 3334
+ *xpp = (void *)((schar *)(*xpp) + nelems);
+#line 3334
+ return NC_NOERR;
+#line 3334
}
+#ifdef __arm__
+int
+ncx_pad_getn_text(const void **xpp, size_t nelems, signed char *tp)
+#else
int
ncx_pad_getn_text(const void **xpp, size_t nelems, char *tp)
+#endif
{
size_t rndup = nelems % X_ALIGN;
+#line 3345
+#line 3345
if(rndup)
+#line 3345
rndup = X_ALIGN - rndup;
+#line 3345
+#line 3345
(void) memcpy(tp, *xpp, nelems);
+#line 3345
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 3345
- return ENOERR;
+#line 3345
+ return NC_NOERR;
+#line 3345
}
+#ifdef __arm__
+int ncx_putn_text(void **xpp, size_t nelems, const signed char *tp)
+#else
int
ncx_putn_text(void **xpp, size_t nelems, const char *tp)
+#endif
{
(void) memcpy(*xpp, tp, nelems);
+#line 3355
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3355
- return ENOERR;
+#line 3355
+ return NC_NOERR;
+#line 3355
}
+#ifdef __arm__
+int
+ncx_pad_putn_text(void **xpp, size_t nelems, const signed char *tp)
+#else
int
ncx_pad_putn_text(void **xpp, size_t nelems, const char *tp)
+#endif
{
size_t rndup = nelems % X_ALIGN;
+#line 3366
+#line 3366
if(rndup)
+#line 3366
rndup = X_ALIGN - rndup;
+#line 3366
+#line 3366
(void) memcpy(*xpp, tp, nelems);
+#line 3366
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3366
+#line 3366
if(rndup)
+#line 3366
{
+#line 3366
(void) memcpy(*xpp, nada, rndup);
+#line 3366
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 3366
}
+#line 3366
- return ENOERR;
+#line 3366
+ return NC_NOERR;
+#line 3366
}
@@ -17292,8 +32189,11 @@ int
ncx_getn_void(const void **xpp, size_t nelems, void *tp)
{
(void) memcpy(tp, *xpp, nelems);
- *xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+#line 3375
+ *xpp = (void *)((schar *)(*xpp) + nelems);
+#line 3375
+ return NC_NOERR;
+#line 3375
}
@@ -17301,14 +32201,23 @@ int
ncx_pad_getn_void(const void **xpp, size_t nelems, void *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 3381
+#line 3381
if(rndup)
+#line 3381
rndup = X_ALIGN - rndup;
+#line 3381
+#line 3381
(void) memcpy(tp, *xpp, nelems);
+#line 3381
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 3381
- return ENOERR;
+#line 3381
+ return NC_NOERR;
+#line 3381
}
@@ -17316,9 +32225,13 @@ int
ncx_putn_void(void **xpp, size_t nelems, const void *tp)
{
(void) memcpy(*xpp, tp, nelems);
+#line 3387
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3387
- return ENOERR;
+#line 3387
+ return NC_NOERR;
+#line 3387
}
@@ -17326,19 +32239,34 @@ int
ncx_pad_putn_void(void **xpp, size_t nelems, const void *tp)
{
size_t rndup = nelems % X_ALIGN;
+#line 3393
+#line 3393
if(rndup)
+#line 3393
rndup = X_ALIGN - rndup;
+#line 3393
+#line 3393
(void) memcpy(*xpp, tp, nelems);
+#line 3393
*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3393
+#line 3393
if(rndup)
+#line 3393
{
+#line 3393
(void) memcpy(*xpp, nada, rndup);
+#line 3393
*xpp = (void *)((char *)(*xpp) + rndup);
+#line 3393
}
+#line 3393
- return ENOERR;
+#line 3393
+ return NC_NOERR;
+#line 3393
}
diff --git a/libsrc/ncx.h b/libsrc/ncx.h
index e414e3f..37923d1 100644
--- a/libsrc/ncx.h
+++ b/libsrc/ncx.h
@@ -39,21 +39,6 @@
#define CRAYFLOAT 1 /* CRAY Floating point */
#endif
-/*
- * The integer return code for the conversion routines
- * is 0 (ENOERR) when no error occurred, or NC_ERANGE as appropriate
- * for an overflow conversion.
- */
-#ifndef ENOERR
-#define ENOERR 0
-#endif
-#ifndef NC_ERANGE
-#define NC_ERANGE (-60) /* N.B. must match value in netcdf.h */
-#endif
-#ifndef NC_ENOMEM
-#define NC_ENOMEM (-61) /* N.B. must match value in netcdf.h */
-#endif
-
/*
* External sizes of the primitive elements.
@@ -214,7 +199,7 @@ typedef char schar;
*
* Storage for a single element of internal type is at `ip' argument.
*
- * These functions return 0 (ENOERR) when no error occurred,
+ * These functions return 0 (NC_NOERR) when no error occurred,
* or NC_ERANGE when the value being converted is too large.
* When NC_ERANGE occurs, an undefined (implementation dependent)
* conversion may have occurred.
diff --git a/libsrc/ncx.m4 b/libsrc/ncx.m4
index 31b785f..7f0e1e4 100644
--- a/libsrc/ncx.m4
+++ b/libsrc/ncx.m4
@@ -451,7 +451,7 @@ ncx_get_$1_$2(const void *xp, $2 *ip)
get_ix_$1(xp, &xx);
*ip = ($2) xx;
GETF_CheckBND($1, $2)
- return ENOERR;
+ return NC_NOERR;
}
')dnl
@@ -467,7 +467,7 @@ ncx_get_$1_$2(const void *xp, $2 *ip)
ifelse(`$3', `1',
``#'if IXsizeof($1) == Isizeof($2) && IXmax($1) == Upcase($2)_MAX
get_ix_$1(xp, (ix_$1 *)ip);
- return ENOERR;
+ return NC_NOERR;
`#'else
')dnl
ix_$1 xx;
@@ -477,7 +477,7 @@ GETI_CheckBND($1, $2)
GETI_CheckNeg($1, $2)
ifelse(`$3', `1', ``#'endif
')dnl
- return ENOERR;
+ return NC_NOERR;
}
')dnl
@@ -493,7 +493,7 @@ ncx_put_$1_$2(void *xp, const $2 *ip)
ix_$1 xx = (ix_$1)*ip;
put_ix_$1(xp, &xx);
PUTF_CheckBND($1, $2)
- return ENOERR;
+ return NC_NOERR;
}
')dnl
@@ -509,7 +509,7 @@ ncx_put_$1_$2(void *xp, const $2 *ip)
ifelse(`$3', `1',
``#'if IXsizeof($1) == Isizeof($2) && IXmax($1) == Upcase($2)_MAX
put_ix_$1(xp, (const ix_$1 *)ip);
- return ENOERR;
+ return NC_NOERR;
`#'else
')dnl
ix_$1 xx = (ix_$1)*ip;
@@ -518,7 +518,7 @@ PUTI_CheckBND($1, $2)
PUTI_CheckNeg($1, $2)
ifelse(`$3', `1', ``#'endif
')dnl
- return ENOERR;
+ return NC_NOERR;
}
')dnl
@@ -593,7 +593,7 @@ ncx_put_short_schar(void *xp, const schar *ip)
else
*cp++ = 0;
*cp = (uchar)(signed)*ip;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -602,7 +602,7 @@ ncx_put_short_uchar(void *xp, const uchar *ip)
uchar *cp = (uchar *) xp;
*cp++ = 0;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
static NCX_PUT1I(short, short, 1)
@@ -681,7 +681,7 @@ ncx_put_ushort_schar(void *xp, const schar *ip)
*cp = (uchar)(signed)*ip;
if (*ip < 0) return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -690,7 +690,7 @@ ncx_put_ushort_uchar(void *xp, const uchar *ip)
uchar *cp = (uchar *) xp;
*cp++ = 0;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
static NCX_PUT1I(ushort, short, 0)
@@ -778,7 +778,7 @@ ncx_put_int_schar(void *xp, const schar *ip)
*cp++ = 0x00;
}
*cp = (uchar)(signed)*ip;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -789,7 +789,7 @@ ncx_put_int_uchar(void *xp, const uchar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
static NCX_PUT1I(int, short, 1)
@@ -868,7 +868,7 @@ ncx_put_uint_schar(void *xp, const schar *ip)
if (*ip < 0) return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -879,7 +879,7 @@ ncx_put_uint_uchar(void *xp, const uchar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
#if X_SIZEOF_UINT != SIZEOF_UINT
@@ -1310,7 +1310,7 @@ ncx_get_float_float(const void *xp, float *ip)
{
/* TODO */
get_ix_float(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -1335,7 +1335,7 @@ ncx_put_float_float(void *xp, const float *ip)
if(*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
return NC_ERANGE;
#endif
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -1645,7 +1645,7 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip)
*ip = (unsigned long long) xx;
if(xx > ULONG_LONG_MAX || xx < 0)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -1664,7 +1664,7 @@ ncx_get_double_float(const void *xp, float *ip)
return NC_ERANGE;
}
*ip = (float) xx;
- return ENOERR;
+ return NC_NOERR;
}
#if X_SIZEOF_DOUBLE != SIZEOF_DOUBLE || defined(NO_IEEE_FLOAT)
@@ -1673,7 +1673,7 @@ ncx_get_double_double(const void *xp, double *ip)
{
/* TODO */
get_ix_double(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -1695,7 +1695,7 @@ ncx_put_double_float(void *xp, const float *ip)
if((double)(*ip) > X_DOUBLE_MAX || (double)(*ip) < X_DOUBLE_MIN)
return NC_ERANGE;
#endif
- return ENOERR;
+ return NC_NOERR;
}
#if X_SIZEOF_DOUBLE != SIZEOF_DOUBLE || defined(NO_IEEE_FLOAT)
@@ -1707,7 +1707,7 @@ ncx_put_double_double(void *xp, const double *ip)
if(*ip > X_DOUBLE_MAX || *ip < X_DOUBLE_MIN)
return NC_ERANGE;
#endif
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -1874,7 +1874,7 @@ ncx_put_size_t(void **xpp, const size_t *ulp)
*cp = (uchar)((*ulp) & 0x000000ff);
*xpp = (void *)((char *)(*xpp) + X_SIZEOF_SIZE_T);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1889,7 +1889,7 @@ ncx_get_size_t(const void **xpp, size_t *ulp)
*ulp |= *cp;
*xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_SIZE_T);
- return ENOERR;
+ return NC_NOERR;
}
/* x_off_t */
@@ -1936,7 +1936,7 @@ ncx_put_off_t(void **xpp, const off_t *lp, size_t sizeof_off_t)
#endif
}
*xpp = (void *)((char *)(*xpp) + sizeof_off_t);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1993,7 +1993,7 @@ ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t)
#endif
}
*xpp = (const void *)((const char *)(*xpp) + sizeof_off_t);
- return ENOERR;
+ return NC_NOERR;
}
/*----< ncx_get_int32() >--------------------------------------------------*/
@@ -2110,7 +2110,7 @@ define(`NCX_GETN_Byte_Body',dnl
`dnl
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((schar *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
')dnl
dnl dnl dnl
dnl
@@ -2126,7 +2126,7 @@ define(`NCX_PAD_GETN_Byte_Body',dnl
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
- return ENOERR;
+ return NC_NOERR;
')dnl
dnl dnl dnl
dnl
@@ -2137,7 +2137,7 @@ define(`NCX_GETN_CHAR',dnl
int
ncx_getn_$1_$2(const void **xpp, size_t nelems, $2 *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
$1 *xp = ($1 *)(*xpp);
while(nelems-- != 0)
@@ -2159,7 +2159,7 @@ define(`NCX_PAD_GETN_CHAR',dnl
int
ncx_pad_getn_$1_$2(const void **xpp, size_t nelems, $2 *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
$1 *xp = ($1 *) *xpp;
@@ -2186,14 +2186,14 @@ int
ncx_getn_$1_$2(const void **xpp, size_t nelems, $2 *tp)
{
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
$1 xx;
for( ; nelems != 0; nelems--, xp += Xsizeof($1), tp++)
{
const int lstatus = ncx_get_$1_$1(xp, &xx);
*tp = ($2)xx;
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2254,16 +2254,16 @@ ncx_getn_$1_$2(const void **xpp, size_t nelems, $2 *tp)
tp += ni;
*xpp = (void*)xp;
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
#else /* not SX */
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += Xsizeof($1), tp++)
{
const int lstatus = ncx_get_$1_$2(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2284,12 +2284,12 @@ ncx_pad_getn_$1_$2(const void **xpp, size_t nelems, $2 *tp)
const size_t rndup = nelems % 2;
const char *xp = (const char *) *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += Xsizeof($1), tp++)
{
const int lstatus = ncx_get_$1_$2(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2308,7 +2308,7 @@ define(`NCX_PUTN_Byte_Body',dnl
(void) memcpy(*xpp, tp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
')dnl
dnl dnl dnl
dnl
@@ -2329,7 +2329,7 @@ define(`NCX_PAD_PUTN_Byte_Body',dnl
*xpp = (void *)((char *)(*xpp) + rndup);
}
- return ENOERR;
+ return NC_NOERR;
`dnl
')dnl
dnl dnl dnl
@@ -2341,7 +2341,7 @@ define(`NCX_PUTN_CHAR',dnl
int
ncx_putn_$1_$2(void **xpp, size_t nelems, const $2 *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
$1 *xp = ($1 *) *xpp;
while(nelems-- != 0)
@@ -2364,7 +2364,7 @@ define(`NCX_PAD_PUTN_CHAR',dnl
int
ncx_pad_putn_$1_$2(void **xpp, size_t nelems, const $2 *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
$1 *xp = ($1 *) *xpp;
@@ -2399,7 +2399,7 @@ int
ncx_putn_$1_$2(void **xpp, size_t nelems, const $2 *tp)
{
char *xp = (char *) *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
$1 xx;
for( ; nelems != 0; nelems--, xp += Xsizeof($1), tp++)
@@ -2407,7 +2407,7 @@ ncx_putn_$1_$2(void **xpp, size_t nelems, const $2 *tp)
xx = ($1) *tp;
{
int lstatus = ncx_put_$1_$1(xp, &xx);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
}
@@ -2486,17 +2486,17 @@ ifelse( $1$2, intfloat,dnl
tp += ni;
*xpp = (void*)xp;
}
- return nrange == 0 ? ENOERR : NC_ERANGE;
+ return nrange == 0 ? NC_NOERR : NC_ERANGE;
#else /* not SX */
char *xp = (char *) *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += Xsizeof($1), tp++)
{
int lstatus = ncx_put_$1_$2(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2517,12 +2517,12 @@ ncx_pad_putn_$1_$2(void **xpp, size_t nelems, const $2 *tp)
const size_t rndup = nelems % 2;
char *xp = (char *) *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += Xsizeof($1), tp++)
{
int lstatus = ncx_put_$1_$2(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2729,7 +2729,7 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
swapn2b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_SHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_GETN(short, short)
@@ -2766,7 +2766,7 @@ ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
swapn2b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_SHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_PUTN(short, short)
@@ -2806,7 +2806,7 @@ ncx_getn_ushort_ushort(const void **xpp, size_t nelems, unsigned short *tp)
swapn2b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_USHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_GETN(ushort, ushort)
@@ -2843,7 +2843,7 @@ ncx_putn_ushort_ushort(void **xpp, size_t nelems, const unsigned short *tp)
swapn2b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_USHORT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_PUTN(ushort, ushort)
@@ -2883,7 +2883,7 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
swapn4b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_INT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_GETN(int, int)
@@ -2909,7 +2909,7 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
swapn4b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_INT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_PUTN(int, int)
@@ -2937,7 +2937,7 @@ ncx_getn_uint_uint(const void **xpp, size_t nelems, unsigned int *tp)
swapn4b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_UINT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_GETN(uint, uint)
@@ -2963,7 +2963,7 @@ ncx_putn_uint_uint(void **xpp, size_t nelems, const unsigned int *tp)
swapn4b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_UINT);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_PUTN(uint, uint)
@@ -2992,7 +2992,7 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
swapn4b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_FLOAT);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -3007,19 +3007,19 @@ GET_VAX_DFLOAT_Body(`(*xpp)')
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3049,7 +3049,7 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
swapn4b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_FLOAT);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -3064,19 +3064,19 @@ PUT_VAX_DFLOAT_Body(`(*xpp)')
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
int lstatus = ncx_put_float_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3107,7 +3107,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
swapn8b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -3121,7 +3121,7 @@ GET_VAX_DDOUBLE_Body(`(*xpp)')
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
}
- return ENOERR;
+ return NC_NOERR;
}
/* vax */
#else
@@ -3129,12 +3129,12 @@ int
ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3163,7 +3163,7 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
swapn8b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#elif vax
int
@@ -3177,7 +3177,7 @@ PUT_VAX_DDOUBLE_Body(`(*xpp)')
ip++;
*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
}
- return ENOERR;
+ return NC_NOERR;
}
/* vax */
#else
@@ -3185,12 +3185,12 @@ int
ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
int lstatus = ncx_put_double_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3222,7 +3222,7 @@ ncx_getn_longlong_longlong(const void **xpp, size_t nelems, long long *tp)
swapn8b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_LONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_GETN(longlong, longlong)
@@ -3248,7 +3248,7 @@ ncx_putn_longlong_longlong(void **xpp, size_t nelems, const long long *tp)
swapn8b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_LONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_PUTN(longlong, longlong)
@@ -3276,7 +3276,7 @@ ncx_getn_ulonglong_ulonglong(const void **xpp, size_t nelems, unsigned long long
swapn8b(tp, *xpp, nelems);
# endif
*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_ULONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_GETN(ulonglong, ulonglong)
@@ -3302,7 +3302,7 @@ ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const unsigned long long
swapn8b(*xpp, tp, nelems);
# endif
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_ULONGLONG);
- return ENOERR;
+ return NC_NOERR;
}
#else
NCX_PUTN(ulonglong, ulonglong)
diff --git a/libsrc/ncx_cray.c b/libsrc/ncx_cray.c
index 244d827..9fe3269 100644
--- a/libsrc/ncx_cray.c
+++ b/libsrc/ncx_cray.c
@@ -189,7 +189,7 @@ cput_short_short(void *xp, const short *ip, int which)
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -200,7 +200,7 @@ ncx_get_short_schar(const void *xp, schar *ip)
*ip = xx;
if(xx > SCHAR_MAX || xx < SCHAR_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -211,14 +211,14 @@ ncx_get_short_uchar(const void *xp, uchar *ip)
*ip = xx;
if(xx > UCHAR_MAX || xx < 0)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
ncx_get_short_short(const void *xp, short *ip)
{
get_ix_short(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -227,7 +227,7 @@ ncx_get_short_int(const void *xp, int *ip)
ix_short xx;
get_ix_short(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -236,7 +236,7 @@ ncx_get_short_long(const void *xp, long *ip)
ix_short xx;
get_ix_short(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -245,7 +245,7 @@ ncx_get_short_float(const void *xp, float *ip)
ix_short xx;
get_ix_short(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -254,7 +254,7 @@ ncx_get_short_double(const void *xp, double *ip)
ix_short xx;
get_ix_short(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -266,7 +266,7 @@ ncx_put_short_schar(void *xp, const schar *ip)
else
*cp++ = 0;
*cp = (uchar)*ip;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -275,7 +275,7 @@ ncx_put_short_uchar(void *xp, const uchar *ip)
uchar *cp = xp;
*cp++ = 0;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -303,11 +303,11 @@ ncx_put_short_float(void *xp, const float *ip)
{
ix_short xx = (ix_short)*ip;
const int status = cput_short_short(xp, &xx, byteoff(xp)/X_SIZEOF_SHORT);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -315,11 +315,11 @@ ncx_put_short_double(void *xp, const double *ip)
{
ix_short xx = (ix_short)*ip;
const int status = cput_short_short(xp, &xx, byteoff(xp)/X_SIZEOF_SHORT);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
/* x_int */
@@ -365,7 +365,7 @@ cput_int_int(void *xp, const int *ip, int which)
}
if(*ip > X_INT_MAX || *ip < X_INT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
#define put_ix_int(xp, ip) cput_int_int((xp), (ip), byteoff(xp))
@@ -377,7 +377,7 @@ ncx_get_int_schar(const void *xp, schar *ip)
*ip = xx;
if(xx > SCHAR_MAX || xx < SCHAR_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -388,7 +388,7 @@ ncx_get_int_uchar(const void *xp, uchar *ip)
*ip = xx;
if(xx > UCHAR_MAX || xx < 0)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -399,7 +399,7 @@ ncx_get_int_short(const void *xp, short *ip)
*ip = xx;
if(xx > SHORT_MAX || xx < SHORT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -408,7 +408,7 @@ ncx_get_int_int(const void *xp, int *ip)
ix_int xx;
get_ix_int(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
}
static void
@@ -436,7 +436,7 @@ int
ncx_get_int_long(const void *xp, long *ip)
{
cget_int_long(xp, ip, byteoff(xp));
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -447,7 +447,7 @@ ncx_get_int_float(const void *xp, float *ip)
*ip = xx;
if(xx > FLT_MAX || xx < (-FLT_MAX))
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -456,7 +456,7 @@ ncx_get_int_double(const void *xp, double *ip)
ix_int xx;
get_ix_int(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -476,7 +476,7 @@ ncx_put_int_schar(void *xp, const schar *ip)
*cp++ = 0x00;
}
*cp = (uchar)*ip;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -487,7 +487,7 @@ ncx_put_int_uchar(void *xp, const uchar *ip)
*cp++ = 0x00;
*cp++ = 0x00;
*cp = *ip;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -518,7 +518,7 @@ cput_int_long(void *xp, const long *ip, int which)
}
if(*ip > X_INT_MAX || *ip < X_INT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -532,11 +532,11 @@ ncx_put_int_float(void *xp, const float *ip)
{
ix_int xx = (ix_int)(*ip);
const int status = put_ix_int(xp, &xx);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(*ip > (double)X_INT_MAX || *ip < (double)X_INT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -544,11 +544,11 @@ ncx_put_int_double(void *xp, const double *ip)
{
ix_int xx = (ix_int)(*ip);
const int status = put_ix_int(xp, &xx);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(*ip > X_INT_MAX || *ip < X_INT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
@@ -613,7 +613,7 @@ put_ix_float(void *xp, const float *ip)
int status = CRAY2IEG(&Cray2_F32, &One, (word *)xp, &bo, ip, &UnitStride);
if(status != 0)
status = NC_ERANGE;
- /* else, status == 0 == ENOERR */
+ /* else, status == 0 == NC_NOERR */
return status;
}
@@ -679,7 +679,7 @@ cget_float_float(const void *xp, float *ip, int which)
static int
cput_float_float(void *xp, const float *ip, int which)
{
- int status = ENOERR;
+ int status = NC_NOERR;
if(which == 0)
{
ieee_single_hi *isp = (ieee_single_hi*)xp;
@@ -766,7 +766,7 @@ cput_float_float(void *xp, const float *ip, int which)
}
}
- return ENOERR;
+ return NC_NOERR;
}
#define get_ix_float(xp, ip) cget_float_float((xp), (ip), byteoff(xp))
@@ -838,7 +838,7 @@ cput_float_float(void *xp, const float *ip, int which)
}
if(*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
#define get_ix_float(xp, ip) cget_float_float((xp), (ip), byteoff(xp))
@@ -857,7 +857,7 @@ ncx_get_float_schar(const void *xp, schar *ip)
*ip = (schar) xx;
if(xx > SCHAR_MAX || xx < SCHAR_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -868,7 +868,7 @@ ncx_get_float_uchar(const void *xp, uchar *ip)
*ip = (uchar) xx;
if(xx > UCHAR_MAX || xx < 0)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -879,7 +879,7 @@ ncx_get_float_short(const void *xp, short *ip)
*ip = (short) xx;
if(xx > SHORT_MAX || xx < SHORT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -890,7 +890,7 @@ ncx_get_float_int(const void *xp, int *ip)
*ip = (int) xx;
if(xx > (double)INT_MAX || xx < (double)INT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -901,14 +901,14 @@ ncx_get_float_long(const void *xp, long *ip)
*ip = (long) xx;
if(xx > LONG_MAX || xx < LONG_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
ncx_get_float_float(const void *xp, float *ip)
{
get_ix_float(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -920,7 +920,7 @@ ncx_get_float_double(const void *xp, double *ip)
float xx;
get_ix_float(xp, &xx);
*ip = xx;
- return ENOERR;
+ return NC_NOERR;
#endif
}
@@ -995,7 +995,7 @@ static int
put_ix_double(void *xp, const double *ip)
{
(void) memcpy(xp, ip, X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#else
@@ -1073,7 +1073,7 @@ cput_double_double(void *xp, const double *ip)
idp->exp = 0;
idp->mant = 0;
}
- return ENOERR;
+ return NC_NOERR;
}
#define get_ix_double(xp, ip) cget_double_double((xp), (ip))
@@ -1089,7 +1089,7 @@ ncx_get_double_schar(const void *xp, schar *ip)
*ip = (schar) xx;
if(xx > SCHAR_MAX || xx < SCHAR_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1100,7 +1100,7 @@ ncx_get_double_uchar(const void *xp, uchar *ip)
*ip = (uchar) xx;
if(xx > UCHAR_MAX || xx < 0)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1111,7 +1111,7 @@ ncx_get_double_short(const void *xp, short *ip)
*ip = (short) xx;
if(xx > SHORT_MAX || xx < SHORT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1122,7 +1122,7 @@ ncx_get_double_int(const void *xp, int *ip)
*ip = (int) xx;
if(xx > INT_MAX || xx < INT_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1133,7 +1133,7 @@ ncx_get_double_long(const void *xp, long *ip)
*ip = (long) xx;
if(xx > LONG_MAX || xx < LONG_MIN)
return NC_ERANGE;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1141,7 +1141,7 @@ ncx_get_double_float(const void *xp, float *ip)
{
#if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
get_ix_double(xp, (double *)ip);
- return ENOERR;
+ return NC_NOERR;
#else
double xx;
get_ix_double(xp, &xx);
@@ -1156,7 +1156,7 @@ ncx_get_double_float(const void *xp, float *ip)
return NC_ERANGE;
}
*ip = (float) xx;
- return ENOERR;
+ return NC_NOERR;
#endif
}
@@ -1164,7 +1164,7 @@ int
ncx_get_double_double(const void *xp, double *ip)
{
get_ix_double(xp, ip);
- return ENOERR;
+ return NC_NOERR;
}
@@ -1173,7 +1173,7 @@ ncx_put_double_schar(void *xp, const schar *ip)
{
double xx = (double) *ip;
put_ix_double(xp, &xx);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1181,7 +1181,7 @@ ncx_put_double_uchar(void *xp, const uchar *ip)
{
double xx = (double) *ip;
put_ix_double(xp, &xx);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1189,7 +1189,7 @@ ncx_put_double_short(void *xp, const short *ip)
{
double xx = (double) *ip;
put_ix_double(xp, &xx);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1197,7 +1197,7 @@ ncx_put_double_int(void *xp, const int *ip)
{
double xx = (double) *ip;
put_ix_double(xp, &xx);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1206,7 +1206,7 @@ ncx_put_double_long(void *xp, const long *ip)
double xx = (double) *ip;
put_ix_double(xp, &xx);
/* TODO: Deal with big guys */
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1214,7 +1214,7 @@ ncx_put_double_float(void *xp, const float *ip)
{
#if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
put_ix_double(xp, (double *)ip);
- return ENOERR;
+ return NC_NOERR;
#else
double xx = (double) *ip;
return put_ix_double(xp, &xx);
@@ -1226,7 +1226,7 @@ ncx_put_double_double(void *xp, const double *ip)
{
#if !defined(NO_IEEE_FLOAT)
put_ix_double(xp, ip);
- return ENOERR;
+ return NC_NOERR;
#else
return put_ix_double(xp, ip);
#endif
@@ -1248,7 +1248,7 @@ ncx_put_size_t(void **xpp, const size_t *ulp)
*cp = (uchar)((*ulp) & 0x000000ff);
*xpp = (void *)((char *)(*xpp) + X_SIZEOF_SIZE_T);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1264,7 +1264,7 @@ ncx_get_size_t(const void **xpp, size_t *ulp)
*ulp |= *cp;
*xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_SIZE_T);
- return ENOERR;
+ return NC_NOERR;
}
/* x_off_t */
@@ -1283,7 +1283,7 @@ ncx_put_off_t(void **xpp, const off_t *lp)
*cp = (uchar)((*lp) & 0x000000ff);
*xpp = (void *)((char *)(*xpp) + X_SIZEOF_OFF_T);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1299,7 +1299,7 @@ ncx_get_off_t(const void **xpp, off_t *lp)
*lp |= *cp;
*xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_OFF_T);
- return ENOERR;
+ return NC_NOERR;
}
@@ -1316,7 +1316,7 @@ ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
{
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1324,7 +1324,7 @@ ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
{
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1338,7 +1338,7 @@ ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp)
}
*xpp = (const void *)xp;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1352,7 +1352,7 @@ ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp)
}
*xpp = (const void *)xp;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1366,7 +1366,7 @@ ncx_getn_schar_long(const void **xpp, size_t nelems, long *tp)
}
*xpp = (const void *)xp;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1380,7 +1380,7 @@ ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
}
*xpp = (const void *)xp;
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1394,7 +1394,7 @@ ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
}
*xpp = (const void *)xp;
- return ENOERR;
+ return NC_NOERR;
}
@@ -1409,7 +1409,7 @@ ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1423,7 +1423,7 @@ ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1441,7 +1441,7 @@ ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp)
}
*xpp = (void *)(xp + rndup);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1459,7 +1459,7 @@ ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp)
}
*xpp = (void *)(xp + rndup);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1477,7 +1477,7 @@ ncx_pad_getn_schar_long(const void **xpp, size_t nelems, long *tp)
}
*xpp = (void *)(xp + rndup);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1495,7 +1495,7 @@ ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
}
*xpp = (void *)(xp + rndup);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1513,7 +1513,7 @@ ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
}
*xpp = (void *)(xp + rndup);
- return ENOERR;
+ return NC_NOERR;
}
@@ -1523,7 +1523,7 @@ ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
(void) memcpy(*xpp, tp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1532,13 +1532,13 @@ ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
(void) memcpy(*xpp, tp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
int
ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
schar *xp = (schar *)(*xpp);
while(nelems-- != 0)
@@ -1555,7 +1555,7 @@ ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp)
int
ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
schar *xp = (schar *)(*xpp);
while(nelems-- != 0)
@@ -1572,7 +1572,7 @@ ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp)
int
ncx_putn_schar_long(void **xpp, size_t nelems, const long *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
schar *xp = (schar *)(*xpp);
while(nelems-- != 0)
@@ -1589,7 +1589,7 @@ ncx_putn_schar_long(void **xpp, size_t nelems, const long *tp)
int
ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
schar *xp = (schar *)(*xpp);
while(nelems-- != 0)
@@ -1606,7 +1606,7 @@ ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp)
int
ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
schar *xp = (schar *)(*xpp);
while(nelems-- != 0)
@@ -1638,7 +1638,7 @@ ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
*xpp = (void *)((char *)(*xpp) + rndup);
}
- return ENOERR;
+ return NC_NOERR;
}
int
@@ -1658,13 +1658,13 @@ ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
*xpp = (void *)((char *)(*xpp) + rndup);
}
- return ENOERR;
+ return NC_NOERR;
}
int
ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
schar *xp = (schar *)(*xpp);
@@ -1693,7 +1693,7 @@ ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp)
int
ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
schar *xp = (schar *)(*xpp);
@@ -1722,7 +1722,7 @@ ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp)
int
ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
schar *xp = (schar *)(*xpp);
@@ -1751,7 +1751,7 @@ ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *tp)
int
ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
schar *xp = (schar *)(*xpp);
@@ -1780,7 +1780,7 @@ ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp)
int
ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
size_t rndup = nelems % X_ALIGN;
schar *xp = (schar *)(*xpp);
@@ -1814,12 +1814,12 @@ int
ncx_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -1831,12 +1831,12 @@ int
ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -1860,7 +1860,7 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
if(ierr > 0)
return NC_ERANGE;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
@@ -1879,7 +1879,7 @@ ncx_getn_short_short(const void **xpp, const size_t nelems, short *tp)
if(*tp & 0x8000)
*tp |= (~(0xffff));
if(tp == last)
- return ENOERR;
+ return NC_NOERR;
tp++;
/*FALLTHRU*/
case 2:
@@ -1887,7 +1887,7 @@ ncx_getn_short_short(const void **xpp, const size_t nelems, short *tp)
if(*tp & 0x8000)
*tp |= (~(0xffff));
if(tp == last)
- return ENOERR;
+ return NC_NOERR;
tp++;
/*FALLTHRU*/
case 1:
@@ -1895,7 +1895,7 @@ ncx_getn_short_short(const void **xpp, const size_t nelems, short *tp)
if(*tp & 0x8000)
*tp |= (~(0xffff));
if(tp == last)
- return ENOERR;
+ return NC_NOERR;
tp++;
wp++; /* Note Bene */
/*FALLTHRU*/
@@ -1956,7 +1956,7 @@ ncx_getn_short_short(const void **xpp, const size_t nelems, short *tp)
}
}
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -1964,12 +1964,12 @@ int
ncx_getn_short_int(const void **xpp, size_t nelems, int *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -1981,12 +1981,12 @@ int
ncx_getn_short_long(const void **xpp, size_t nelems, long *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -1998,12 +1998,12 @@ int
ncx_getn_short_float(const void **xpp, size_t nelems, float *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2015,12 +2015,12 @@ int
ncx_getn_short_double(const void **xpp, size_t nelems, double *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2035,12 +2035,12 @@ ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
const size_t rndup = nelems % 2;
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2057,12 +2057,12 @@ ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
const size_t rndup = nelems % 2;
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2094,12 +2094,12 @@ ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp)
const size_t rndup = nelems % 2;
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2116,12 +2116,12 @@ ncx_pad_getn_short_long(const void **xpp, size_t nelems, long *tp)
const size_t rndup = nelems % 2;
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2138,12 +2138,12 @@ ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp)
const size_t rndup = nelems % 2;
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2160,12 +2160,12 @@ ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
const size_t rndup = nelems % 2;
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_get_short_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2181,12 +2181,12 @@ int
ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2198,12 +2198,12 @@ int
ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2229,13 +2229,13 @@ ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
if(ierr > 0)
return NC_ERANGE;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_putn_short_short(void **xpp, const size_t nelems, const short *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
if(nelems == 0)
return status;
{
@@ -2330,12 +2330,12 @@ int
ncx_putn_short_int(void **xpp, size_t nelems, const int *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2347,12 +2347,12 @@ int
ncx_putn_short_long(void **xpp, size_t nelems, const long *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2364,12 +2364,12 @@ int
ncx_putn_short_float(void **xpp, size_t nelems, const float *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2381,12 +2381,12 @@ int
ncx_putn_short_double(void **xpp, size_t nelems, const double *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2401,12 +2401,12 @@ ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
const size_t rndup = nelems % 2;
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2426,12 +2426,12 @@ ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
const size_t rndup = nelems % 2;
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2466,12 +2466,12 @@ ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp)
const size_t rndup = nelems % 2;
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2491,12 +2491,12 @@ ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp)
const size_t rndup = nelems % 2;
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2516,12 +2516,12 @@ ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp)
const size_t rndup = nelems % 2;
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2541,12 +2541,12 @@ ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp)
const size_t rndup = nelems % 2;
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
{
const int lstatus = ncx_put_short_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2568,12 +2568,12 @@ int
ncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_get_int_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2585,12 +2585,12 @@ int
ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_get_int_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2602,12 +2602,12 @@ int
ncx_getn_int_short(const void **xpp, size_t nelems, short *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_get_int_short(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2631,7 +2631,7 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
if(ierr > 0)
return NC_ERANGE;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
@@ -2640,7 +2640,7 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
const int bo = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(bo != 0)
{
@@ -2648,7 +2648,7 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
*xpp = ((char *) (*xpp) + X_SIZEOF_INT);
nelems--;
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
tp++;
}
@@ -2675,7 +2675,7 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
}
}
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -2685,7 +2685,7 @@ ncx_getn_int_long(const void **xpp, size_t nelems, long *tp)
const int bo = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(bo != 0)
{
@@ -2693,7 +2693,7 @@ ncx_getn_int_long(const void **xpp, size_t nelems, long *tp)
*xpp = ((char *) (*xpp) + X_SIZEOF_INT);
nelems--;
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
tp++;
}
@@ -2720,19 +2720,19 @@ ncx_getn_int_long(const void **xpp, size_t nelems, long *tp)
}
}
- return ENOERR;
+ return NC_NOERR;
}
int
ncx_getn_int_float(const void **xpp, size_t nelems, float *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_get_int_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2744,12 +2744,12 @@ int
ncx_getn_int_double(const void **xpp, size_t nelems, double *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_get_int_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2762,12 +2762,12 @@ int
ncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_put_int_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2779,12 +2779,12 @@ int
ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_put_int_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2796,12 +2796,12 @@ int
ncx_putn_int_short(void **xpp, size_t nelems, const short *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_put_int_short(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2827,17 +2827,17 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
if(ierr > 0)
return NC_ERANGE;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
const int bo = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(bo != 0)
{
@@ -2860,10 +2860,10 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
for( ; wp < end; wp++, tp += 2)
{
int lstatus = cput_int_int(wp, tp, 0);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
lstatus = cput_int_int(wp, tp + 1, 1);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2872,7 +2872,7 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
if(nelems != 0)
{
const int lstatus = cput_int_int(wp, tp, 0);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
*xpp = ((char *) (*xpp) + X_SIZEOF_INT);
}
@@ -2885,11 +2885,11 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
int
ncx_putn_int_long(void **xpp, size_t nelems, const long *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
const int bo = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(bo != 0)
{
@@ -2912,10 +2912,10 @@ ncx_putn_int_long(void **xpp, size_t nelems, const long *tp)
for( ; wp < end; wp++, tp += 2)
{
int lstatus = cput_int_long(wp, tp, 0);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
lstatus = cput_int_long(wp, tp + 1, 1);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2924,7 +2924,7 @@ ncx_putn_int_long(void **xpp, size_t nelems, const long *tp)
if(nelems != 0)
{
const int lstatus = cput_int_long(wp, tp, 0);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
*xpp = ((char *) (*xpp) + X_SIZEOF_INT);
}
@@ -2937,12 +2937,12 @@ int
ncx_putn_int_float(void **xpp, size_t nelems, const float *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_put_int_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2954,12 +2954,12 @@ int
ncx_putn_int_double(void **xpp, size_t nelems, const double *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
{
const int lstatus = ncx_put_int_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2975,12 +2975,12 @@ int
ncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -2992,12 +2992,12 @@ int
ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3009,12 +3009,12 @@ int
ncx_getn_float_short(const void **xpp, size_t nelems, short *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_short(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3026,12 +3026,12 @@ int
ncx_getn_float_int(const void **xpp, size_t nelems, int *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3043,12 +3043,12 @@ int
ncx_getn_float_long(const void **xpp, size_t nelems, long *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3072,7 +3072,7 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
if(ierr > 0)
return NC_ERANGE;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
@@ -3082,7 +3082,7 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
const int bo = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(bo != 0)
{
@@ -3090,7 +3090,7 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
*xpp = ((char *) (*xpp) + X_SIZEOF_FLOAT);
nelems--;
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
tp++;
}
@@ -3117,7 +3117,7 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
}
}
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -3125,12 +3125,12 @@ int
ncx_getn_float_double(const void **xpp, size_t nelems, double *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_get_float_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3143,12 +3143,12 @@ int
ncx_putn_float_schar(void **xpp, size_t nelems, const schar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_put_float_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3160,12 +3160,12 @@ int
ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_put_float_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3177,12 +3177,12 @@ int
ncx_putn_float_short(void **xpp, size_t nelems, const short *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_put_float_short(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3194,12 +3194,12 @@ int
ncx_putn_float_int(void **xpp, size_t nelems, const int *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_put_float_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3211,12 +3211,12 @@ int
ncx_putn_float_long(void **xpp, size_t nelems, const long *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_put_float_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3242,17 +3242,17 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
if(ierr > 0)
return NC_ERANGE;
}
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
const int bo = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(bo != 0)
{
@@ -3275,10 +3275,10 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
for( ; wp < end; wp++, tp += 2)
{
int lstatus = cput_float_float(wp, tp, 0);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
lstatus = cput_float_float(wp, tp + 1, 1);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3287,7 +3287,7 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
if(nelems != 0)
{
const int lstatus = cput_float_float(wp, tp, 0);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
*xpp = ((char *) (*xpp) + X_SIZEOF_FLOAT);
}
@@ -3301,12 +3301,12 @@ int
ncx_putn_float_double(void **xpp, size_t nelems, const double *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = ncx_put_float_double(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3322,12 +3322,12 @@ int
ncx_getn_double_schar(const void **xpp, size_t nelems, schar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3339,12 +3339,12 @@ int
ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3356,12 +3356,12 @@ int
ncx_getn_double_short(const void **xpp, size_t nelems, short *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_short(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3373,12 +3373,12 @@ int
ncx_getn_double_int(const void **xpp, size_t nelems, int *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3390,12 +3390,12 @@ int
ncx_getn_double_long(const void **xpp, size_t nelems, long *tp)
{
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3411,7 +3411,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
int ierr;
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(noff != 0)
{
@@ -3434,7 +3434,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
assert(ierr >= 0);
- return ierr > 0 ? NC_ERANGE : ENOERR;
+ return ierr > 0 ? NC_ERANGE : NC_NOERR;
}
#elif X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT)
int
@@ -3442,7 +3442,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
{
(void) memcpy(tp, *xpp, nelems * X_SIZEOF_DOUBLE);
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
@@ -3451,7 +3451,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
const size_t noff = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(noff != 0)
{
@@ -3491,7 +3491,7 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
}
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#endif
@@ -3502,12 +3502,12 @@ ncx_getn_double_float(const void **xpp, size_t nelems, float *tp)
return ncx_getn_double_double(xpp, nelems, (double *)tp);
#else
const char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_get_double_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3521,12 +3521,12 @@ int
ncx_putn_double_schar(void **xpp, size_t nelems, const schar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_put_double_schar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3538,12 +3538,12 @@ int
ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_put_double_uchar(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3555,12 +3555,12 @@ int
ncx_putn_double_short(void **xpp, size_t nelems, const short *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_put_double_short(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3572,12 +3572,12 @@ int
ncx_putn_double_int(void **xpp, size_t nelems, const int *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_put_double_int(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3589,12 +3589,12 @@ int
ncx_putn_double_long(void **xpp, size_t nelems, const long *tp)
{
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_put_double_long(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3610,7 +3610,7 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
int ierr;
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(noff != 0)
{
@@ -3633,7 +3633,7 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ierr > 0 ? NC_ERANGE : ENOERR;
+ return ierr > 0 ? NC_ERANGE : NC_NOERR;
}
#elif X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT)
int
@@ -3642,17 +3642,17 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
const size_t noff = byteoff(*xpp);
(void) memcpy(*xpp, tp, nelems * X_SIZEOF_DOUBLE);
*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
- return ENOERR;
+ return NC_NOERR;
}
#else
int
ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
const size_t noff = byteoff(*xpp);
if(nelems == 0)
- return ENOERR;
+ return NC_NOERR;
if(noff != 0)
{
@@ -3671,7 +3671,7 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
for( ; wp < end; wp++, tp++)
{
const int lstatus = cput_double_double(wp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3689,7 +3689,7 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
for( ; wp < end; wp++, tp++)
{
const int lstatus = cput_double_double(wp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3707,12 +3707,12 @@ ncx_putn_double_float(void **xpp, size_t nelems, const float *tp)
return ncx_putn_double_double(xpp, nelems, (double *)tp);
#else
char *xp = *xpp;
- int status = ENOERR;
+ int status = NC_NOERR;
for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = ncx_put_double_float(xp, tp);
- if(lstatus != ENOERR)
+ if(lstatus != NC_NOERR)
status = lstatus;
}
@@ -3734,7 +3734,7 @@ ncx_getn_text(const void **xpp, size_t nelems, char *tp)
{
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
@@ -3749,7 +3749,7 @@ ncx_pad_getn_text(const void **xpp, size_t nelems, char *tp)
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
- return ENOERR;
+ return NC_NOERR;
}
@@ -3759,7 +3759,7 @@ ncx_putn_text(void **xpp, size_t nelems, const char *tp)
(void) memcpy(*xpp, tp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
@@ -3780,7 +3780,7 @@ ncx_pad_putn_text(void **xpp, size_t nelems, const char *tp)
*xpp = (void *)((char *)(*xpp) + rndup);
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -3792,7 +3792,7 @@ ncx_getn_void(const void **xpp, size_t nelems, void *tp)
{
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
@@ -3807,7 +3807,7 @@ ncx_pad_getn_void(const void **xpp, size_t nelems, void *tp)
(void) memcpy(tp, *xpp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems + rndup);
- return ENOERR;
+ return NC_NOERR;
}
@@ -3817,7 +3817,7 @@ ncx_putn_void(void **xpp, size_t nelems, const void *tp)
(void) memcpy(*xpp, tp, nelems);
*xpp = (void *)((char *)(*xpp) + nelems);
- return ENOERR;
+ return NC_NOERR;
}
@@ -3838,6 +3838,6 @@ ncx_pad_putn_void(void **xpp, size_t nelems, const void *tp)
*xpp = (void *)((char *)(*xpp) + rndup);
}
- return ENOERR;
+ return NC_NOERR;
}
diff --git a/libsrc/netcdf.3 b/libsrc/netcdf.3
new file mode 100644
index 0000000..26cea37
--- /dev/null
+++ b/libsrc/netcdf.3
@@ -0,0 +1,1405 @@
+.nr yr \n(yr+1900
+.af mo 01
+.af dy 01
+.TH NETCDF 3 "1997-04-18" "Printed: \n(yr-\n(mo-\n(dy" "UNIDATA LIBRARY FUNCTIONS"
+.SH NAME
+netcdf \- Unidata's Network Common Data Form (netCDF) library interface
+.SH SYNOPSIS
+.ft B
+.na
+.nh
+#include "netcdf.h"
+.sp
+
+cc ... \-lnetcdf \-lhdf5_hl \-lhdf5 \-lz \-lm
+
+.ad
+.hy
+Complete documentation for the netCDF libraries can be found at the netCDF website: http://www.unidata.ucar.edu/software/netcdf/.
+.sp
+.SH "LIBRARY VERSION"
+.LP
+This document describes versions 3 and 4
+of Unidata netCDF data-access interface
+for the C programming language.
+.HP
+\fBconst char* nc_inq_libvers()\fR
+.sp
+Returns a string identifying the version of the netCDF library, and
+when it was built, like: "3.1a of Aug 22 1996 12:57:47 $".
+.LP
+The RCS \fBident(1)\fP command will find a string like
+"$\|Id: @\|(#) netcdf library version 3.1a of Sep 6 1996 15:56:26 $"
+in the library. The SCCS \fBwhat(1)\fP command will find a string like
+"netcdf library version 3.1a of Aug 23 1996 16:07:40 $".
+.SH "RETURN VALUES"
+.LP
+All netCDF functions (except
+\fBnc_inq_libvers(\|)\fR and \fBnc_strerror(\|)\fR) return an integer status.
+
+If this returned status value is not equal to
+\fBNC_NOERR\fR (zero), it
+indicates that an error occurred. The possible status values are defined in
+system include file <errno.h> and in "netcdf.h".
+.HP
+\fBconst char* nc_strerror(int \fIstatus\fP)\fR
+.sp
+Returns a string textual translation of the \fIstatus\fP
+value, like "Attribute or variable name contains illegal characters"
+or "No such file or directory".
+.sp
+.SH "FILE OPERATIONS"
+.LP
+.HP
+\fBint nc_create(const char \fIpath\fP[], int \fIcmode\fP, int* \fIncid\fP)\fR
+.sp
+Creates a new netCDF dataset at \fIpath\fP,
+returning a netCDF ID in \fIncid\fP.
+The argument \fIcmode\fP may include the bitwise-or
+of the following flags:
+\fBNC_NOCLOBBER\fR
+to protect existing datasets (default
+silently blows them away),
+\fBNC_SHARE\fR
+for synchronous dataset updates for classic format files
+(default is to buffer accesses),
+.sp
+When a netCDF dataset is created, is is opened
+\fBNC_WRITE\fR.
+The new netCDF dataset is in define mode.
+\fBNC_64BIT_OFFSET\fR.
+to create a file in the 64-bit offset format
+(as opposed to classic format, the default).
+\fBNC_TRUE\fR to create a netCDF-4/HDF5 file,
+and \fBNC_CLASSIC_MODEL\fR to guarantee that netCDF-4/HDF5 files maintain compatibility
+with the netCDF classic data model.
+.HP
+\fBint nc__create(const char \fIpath\fP[], int \fIcmode\fP, size_t \fIinitialsize\fP, size_t* \fIchunksize\fP, int* \fIncid\fP)\fR
+.sp
+Like \fBnc_create(\|)\fR but has additional performance tuning parameters.
+.sp
+The argument \fIinitialsize\fP sets the initial size of the file at
+creation time.
+.sp
+See \fBnc__open(\|)\fR below for an explanation of the \fIchunksize\fP
+parameter.
+.HP
+\fBint nc_open(const char \fIpath\fP[], int \fImode\fP, int* \fIncid\fP)\fR
+.sp
+(Corresponds to \fBncopen(\|)\fR in version 2)
+.sp
+Opens a existing netCDF dataset at \fIpath\fP
+returning a netCDF ID
+in \fIncid\fP.
+The type of access is described by the \fImode\fP parameter,
+which may include the bitwise-or
+of the following flags:
+\fBNC_WRITE\fR
+for read-write access (default
+read-only),
+\fBNC_SHARE\fR
+for synchronous dataset updates (default is
+to buffer accesses), and
+\fBNC_LOCK\fR
+(not yet implemented).
+.sp
+As of NetCDF version 4.1, and if TRUE support was enabled
+when the NetCDF library was built, the path parameter
+may specify a TRUE URL. In this case, the access mode is
+forced to be read-only.
+.HP
+\fBint nc__open(const char \fIpath\fP[], int \fImode\fP, size_t* \fIchunksize\fP, int* \fIncid\fP)\fR
+.sp
+Like \fBnc_open(\|)\fR but has an additional performance tuning parameter.
+.sp
+The argument referenced by \fIchunksize\fP controls a space versus time
+tradeoff, memory allocated in the netcdf library versus number of system
+calls.
+Because of internal requirements, the value may not be set to exactly
+the value requested.
+The actual value chosen is returned by reference.
+Using the value \fBNC_SIZEHINT_DEFAULT\fR causes the library to choose a
+default.
+How the system choses the default depends on the system.
+On many systems, the "preferred I/O block size" is available from the
+\fBstat()\fR system call, \fBstruct stat\fR member \fBst_blksize\fR.
+If this is available it is used. Lacking that, twice the system pagesize
+is used.
+Lacking a call to discover the system pagesize, we just set default
+chunksize to 8192.
+.sp
+The chunksize is a property of a given open netcdf descriptor
+\fIncid\fP, it is not a persistent property of the netcdf dataset.
+.sp
+As with \fBnc__open(\|)\fR, the path parameter
+may specify a TRUE URL, but the tuning parameters are ignored.
+.HP
+\fBint nc_redef(int \fIncid\fP)\fR
+.sp
+(Corresponds to \fBncredef(\|)\fR in version 2)
+.sp
+Puts an open netCDF dataset into define mode,
+so dimensions, variables, and attributes can be added or renamed and
+attributes can be deleted.
+.HP
+\fBint nc_enddef(int \fIncid\fP)\fR
+.sp
+(Corresponds to \fBncendef(\|)\fR in version 2)
+.sp
+Takes an open netCDF dataset out of define mode.
+The changes made to the netCDF dataset
+while it was in define mode are checked and committed to disk if no
+problems occurred. Some data values may be written as well,
+see "VARIABLE PREFILLING" below.
+After a successful call, variable data can be read or written to the dataset.
+.HP
+\fBint nc__enddef(int \fIncid\fP, size_t \fIh_minfree\fP, size_t \fIv_align\fP, size_t \fIv_minfree\fP, size_t \fIr_align\fP)\fR
+.sp
+Like \fBnc_enddef(\|)\fR but has additional performance tuning parameters.
+.sp
+Caution: this function exposes internals of the netcdf version 1 file
+format.
+It may not be available on future netcdf implementations.
+.sp
+The current netcdf file format has three sections,
+the "header" section, the data section for fixed size variables, and
+the data section for variables which have an unlimited dimension (record
+variables).
+The header begins at the beginning of the file. The index
+(offset) of the beginning of the other two sections is contained in the
+header. Typically, there is no space between the sections. This causes
+copying overhead to accrue if one wishes to change the size of the
+sections,
+as may happen when changing names of things, text attribute values,
+adding
+attributes or adding variables. Also, for buffered i/o, there may be
+advantages
+to aligning sections in certain ways.
+.sp
+The minfree parameters allow one to control costs of future calls
+to \fBnc_redef(\|)\fR, \fBnc_enddef(\|)\fR by requesting that \fIminfree\fP bytes be
+available at the end of the section.
+The \fIh_minfree\fP parameter sets the pad
+at the end of the "header" section. The \fIv_minfree\fP parameter sets
+the pad at the end of the data section for fixed size variables.
+.sp
+The align parameters allow one to set the alignment of the beginning of
+the corresponding sections. The beginning of the section is rounded up
+to an index which is a multiple of the align parameter. The flag value
+\fBNC_ALIGN_CHUNK\fR tells the library to use the chunksize (see above)
+as the align parameter.
+The \fIv_align\fP parameter controls the alignment of the beginning of
+the data section for fixed size variables.
+The \fIr_align\fP parameter controls the alignment of the beginning of
+the data section for variables which have an unlimited dimension (record
+variables).
+.sp
+The file format requires mod 4 alignment, so the align parameters
+are silently rounded up to multiples of 4. The usual call,
+\fBnc_enddef(\fIncid\fP)\fR
+is equivalent to
+\fBnc__enddef(\fIncid\fP, 0, 4, 0, 4)\fR.
+.sp
+The file format does not contain a "record size" value, this is
+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.
+.HP
+\fBint nc_sync(int \fIncid\fP)\fR
+.sp
+(Corresponds to \fBncsync(\|)\fR in version 2)
+.sp
+Unless the
+\fBNC_SHARE\fR
+bit is set in
+\fBnc_open(\|)\fR or \fBnc_create(\|)\fR,
+accesses to the underlying netCDF dataset are
+buffered by the library. This function synchronizes the state of
+the underlying dataset and the library.
+This is done automatically by
+\fBnc_close(\|)\fR and \fBnc_enddef(\|)\fR.
+.HP
+\fBint nc_abort(int \fIncid\fP)\fR
+.sp
+(Corresponds to \fBncabort(\|)\fR in version 2)
+.sp
+You don't need to call this function.
+This function is called automatically by
+\fBnc_close(\|)\fR
+if the netCDF was in define mode and something goes wrong with the commit.
+If the netCDF dataset isn't in define mode, then this function is equivalent to
+\fBnc_close(\|)\fR.
+If it is called after
+\fBnc_redef(\|)\fR,
+but before
+\fBnc_enddef(\|)\fR,
+the new definitions are not committed and the dataset is closed.
+If it is called after
+\fBnc_create(\|)\fR
+but before
+\fBnc_enddef(\|)\fR,
+the dataset disappears.
+.HP
+\fBint nc_close(int \fIncid\fP)\fR
+.sp
+(Corresponds to
+\fBncclose(\|)\fR in version 2)
+.sp
+Closes an open netCDF dataset.
+If the dataset is in define mode,
+\fBnc_enddef(\|)\fR
+will be called before closing.
+After a dataset is closed, its ID may be reassigned to another dataset.
+.HP
+\fBint nc_inq(int \fIncid\fP, int* \fIndims\fP, int* \fInvars\fP,
+int* \fInatts\fP, int* \fIunlimdimid\fP)\fR
+.HP
+\fBint nc_inq_ndims(int \fIncid\fP, int* \fIndims\fP)\fR
+.HP
+\fBint nc_inq_nvars(int \fIncid\fP, int* \fInvars\fP)\fR
+.HP
+\fBint nc_inq_natts(int \fIncid\fP, int* \fInatts\fP)\fR
+.HP
+\fBint nc_inq_unlimdim(int \fIncid\fP, int* \fIunlimdimid\fP)\fR
+.HP
+\fBint nc_inq_format(int \fIncid\fP, int* \fIformatn\fP)\fR
+.sp
+Use these functions to find out what is in a netCDF dataset.
+Upon successful return,
+\fIndims\fP will contain the
+number of dimensions defined for this netCDF dataset,
+\fInvars\fP will contain the number of variables,
+\fInatts\fP will contain the number of attributes, and
+\fIunlimdimid\fP will contain the
+dimension ID of the unlimited dimension if one exists, or
+\-1 otherwise.
+\fIformatn\fP will contain the version number of the dataset <format>, one of
+\fBNC_FORMAT_CLASSIC\fR, \fBNC_FORMAT_64BIT_OFFSET\fR, \fBNC_FORMAT_NETCDF4\fR, or
+\fBNC_FORMAT_NETCDF4_CLASSIC\fR.
+If any of the
+return parameters is a \fBNULL\fR pointer, then the corresponding information
+will not be returned; hence, no space need be allocated for it.
+.HP
+\fBint nc_def_dim(int \fIncid\fP, const char \fIname\fP[], size_t \fIlen\fP, int* \fIdimid\fP)\fR
+.sp
+(Corresponds to \fBncdimdef(\|)\fR in version 2)
+.sp
+Adds a new dimension to an open netCDF dataset, which must be
+in define mode.
+\fIname\fP is the dimension name.
+If \fIdimid\fP is not a \fBNULL\fR pointer then upon successful completion \fIdimid\fP will contain the dimension ID of the newly created dimension.
+
+.SH "USER DEFINED TYPES"
+.LP
+Users many define types for a netCDF-4/HDF5 file (unless the
+\fBNC_CLASSIC_MODEL\fR was used when the file was creates). Users may
+define compound types, variable length arrays, enumeration types, and
+opaque types.
+.sp
+
+.HP
+\fBint nc_def_compound(int \fIncid\fP, size_t \fIsize\fP, const char \fIname\fP[], int* \fItypeidp\fP)\fR
+.sp
+Define a compound type.
+.HP
+\fBint nc_insert_compound(int \fIncid\fP, nc_type \fI\fP, const char \fIname\fP[], size_t \fIoffset\fP, nc_type \fIfield_typeid\fP)\fR
+.sp
+Insert an element into a compound type. May not be done after type has been used, or after the type has been written by an enddef.
+.HP
+\fBint nc_insert_array_compound(int \fIncid\fP, nc_type \fI\fP, const char \fIname\fP[], size_t \fIoffset\fP, nc_type \fIfield_typeid\fP, int \fIndims\fP, const int \fIdim_sizes\fP[])\fR
+.sp
+Insert an array into a compound type.
+.HP
+\fBint nc_inq_type(int \fIncid\fP, nc_type \fI\fP, char \fIname\fP[], size_t* \fIsizep\fP)\fR
+.sp
+Learn about a type.
+.HP
+\fBint nc_inq_compound(int \fIncid\fP, nc_type \fI\fP, char \fIname\fP[], size_t* \fIsizep\fP, size_t* \fInfieldsp\fP)\fR
+.HP
+\fBint nc_inq_compound_name(int \fIncid\fP, nc_type \fI\fP, char \fIname\fP[])\fR
+.HP
+\fBint nc_inq_compound_size(int \fIncid\fP, nc_type \fI\fP, size_t* \fIsizep\fP)\fR
+.HP
+\fBint nc_inq_compound_nfields(int \fIncid\fP, nc_type \fI\fP, size_t* \fInfieldsp\fP)\fR
+.HP
+\fBint nc_inq_compound_fieldname(int \fIncid\fP, nc_type \fI\fP, int \fIfieldid\fP, char \fIname\fP[])\fR
+.HP
+\fBint nc_inq_compound_fieldindex(int \fIncid\fP, nc_type \fI\fP, const char \fIname\fP[], int* \fIfieldidp\fP)\fR
+.HP
+\fBint nc_inq_compound_fieldoffset(int \fIncid\fP, nc_type \fI\fP, int \fIfieldid\fP, size_t* \fIoffsetp\fP)\fR
+.HP
+\fBint nc_inq_compound_fieldtype(int \fIncid\fP, nc_type \fI\fP, int \fIfieldid\fP, nc_type* \fIfield_typeid\fP)\fR
+.HP
+\fBint nc_inq_compound_fieldndims(int \fIncid\fP, nc_type \fI\fP, int \fIfieldid\fP, int* \fIndims\fP)\fR
+.HP
+\fBint nc_inq_compound_fielddim_sizes(int \fIncid\fP, nc_type \fI\fP, int \fIfieldid\fP, int \fIdim_sizes\fP[])\fR
+.sp
+Learn about a compound type.
+.HP
+\fBint nc_def_vlen(int \fIncid\fP, const char \fIname\fP[], nc_type \fIbase_typeid\fP, nc_type* \fIxtypep\fP)\fR
+.sp
+Create a varaible length array type.
+.HP
+\fBint nc_inq_vlen(int \fIncid\fP, nc_type \fI\fP, char \fIname\fP[], size_t* \fIdatum_sizep\fP, nc_type* \fIbase_nc_typep\fP)\fR
+.sp
+Learn about a varaible length array type.
+.HP
+\fBint nc_free_vlen(nc_vlen_t *vl)\fR
+.sp
+Free memory comsumed by reading data of a varaible length array type.
+.HP
+\fBint nc_put_vlen_element(int \fIncid\fP, nc_type \fI\fP, void * \fIvlen_element\fP, size_t \fIlen\fP, void * \fIdata\fP)\fR
+.sp
+Write one VLEN.
+.HP
+\fBint nc_get_vlen_element(int \fIncid\fP, nc_type \fI\fP, void ** \fIvlen_element\fP, size_t \fIlen\fP, void ** \fIdata\fP)\fR
+.sp
+Read one VLEN.
+.HP
+\fBint nc_free_string(size_t \fIlen\fP, char **data)\fR
+.sp
+Free memory comsumed by reading data of a string type.
+.HP
+\fBint nc_inq_user_type(int \fIncid\fP, nc_type \fI\fP, char \fIname\fP[], size_t* \fI\fP, nc_type* \fI\fP, size_t* \fI\fP, int* \fI\fP)\fR
+.sp
+Learn about a user define type.
+.HP
+\fBint nc_def_enum(int \fIncid\fP, nc_type \fIbase_typeid\fP, const char \fIname\fP[], nc_type* \fItypeidp\fP)\fR
+.sp
+Define an enumeration type.
+.HP
+\fBint nc_insert_enum(int \fIncid\fP, nc_type \fIbase_typeid\fP, const char \fIname\fP[], const void *value)\fR
+.sp
+Insert a name-value pair into enumeration type.
+.HP
+\fBint nc_inq_enum_member(int \fIncid\fP, nc_type \fIxtype\fP, int \fIidx\fP, char \fIname\fP[], void *value)\fR
+.HP
+\fBint nc_inq_enum_ident(int \fIncid\fP, nc_type \fIxtype\fP, int \fIidx\fP, long long \fIvalue\fP, char \fIidentifier\fP[])\fR
+.sp
+Learn about a name-value pair into enumeration type.
+.HP
+\fBint nc_def_opaque(int \fIncid\fP, size_t \fIsize\fP, const char \fIname\fP[], nc_type* \fIxtypep\fP)\fR
+.sp
+Create an opaque type.
+.HP
+\fBint nc_inq_opaque(int \fIncid\fP, nc_type \fIxtype\fP, char \fIname\fP[], size_t* \fIsizep\fP)\fR
+.sp
+Learn about opaque type.
+.HP
+.SH "GROUPS"
+.sp
+Users may organize data into hierarchical groups in netCDF-4/HDF5 files (unless \fBNC_CLASSIC_MODEL\fR was used when creating the file).
+.HP
+\fBint nc_inq_grps(int \fIncid\fP, int* \fInumgrps\fP, int \fIncids\fP[])\fR
+.sp
+Learn how many groups (and their ncids) are available from the group represented by ncid.
+.HP
+\fBint nc_inq_grpname(int \fIncid\fP, char \fIname\fP[])\fR
+.HP
+\fBint nc_inq_grpname_full(int \fIncid\fP, size_t* \fIlen\fP, char \fIname\fP[])\fR
+.HP
+\fBint nc_inq_grpname_len(int \fIncid\fP, size_t* \fIlen\fP)\fR
+.HP
+\fBint nc_inq_grp_parent(int \fIncid\fP, int* \fIncid\fP)\fR
+.HP
+\fBint nc_inq_grp_ncid(int \fIncid\fP, char \fIname\fP[], int* \fIncid\fP)\fR
+.HP
+\fBint nc_inq_full_ncid(int \fIncid\fP, char \fIname\fP[], int* \fIncid\fP)\fR
+.sp
+Learn about a group.
+.HP
+\fBint nc_inq_varids(int \fIncid\fP, int* \fInvars\fP, int* \fI\fP)\fR
+.sp
+Get the varids in a group.
+.HP
+\fBint nc_inq_dimids(int \fIncid\fP, int* \fIndims\fP, int* \fIdimids\fP, int \fIinclude_parents\fP)\fR
+.sp
+Get the dimids in a group and (potentially) its parents.
+.HP
+\fBint nc_inq_typeids(int \fIncid\fP, int* \fIntypes\fP, int \fItypeids\fP[])\fR
+.sp
+Get the typeids of user-defined types in a group.
+.HP
+\fBint nc_def_grp(int \fIncid\fP, char \fIname\fP[], int* \fIncid\fP)\fR
+.sp
+Create a group.
+.LP
+
+.SH "DIMENSIONS"
+.LP
+.HP
+\fBint nc_inq_dimid(int \fIncid\fP, const char \fIname\fP[], int* \fIdimid\fP)\fR
+.sp
+(Corresponds to \fBncdimid(\|)\fR in version 2)
+.sp
+Given a dimension name, returns the ID of a netCDF dimension in \fIdimid\fP.
+.HP
+\fBint nc_inq_dim(int \fIncid\fP, int \fIdimid\fP, char \fIname\fP[], size_t* \fIlen\fP)\fR
+.HP
+\fBint nc_inq_dimname(int \fIncid\fP, int \fIdimid\fP, char \fIname\fP[])\fR
+.HP
+\fBint nc_inq_dimlen(int \fIncid\fP, int \fIdimid\fP, size_t* \fIlen\fP)\fR
+.sp
+Use these functions to find out about a dimension.
+If either the \fIname\fP
+argument or \fIlen\fP argument is a \fBNULL\fR pointer, then
+the associated information will not be returned. Otherwise,
+\fIname\fP should be big enough (\fBNC_MAX_NAME\fR)
+to hold the dimension name as the name will be copied into your storage.
+The length return parameter, \fIlen\fP
+will contain the size of the dimension.
+For the unlimited dimension, the returned length is the current
+maximum value used for writing into any of the variables which use
+the dimension.
+.HP
+\fBint nc_rename_dim(int \fIncid\fP, int \fIdimid\fP, const char \fIname\fP[])\fR
+.sp
+(Corresponds to \fBncdimrename(\|)\fR in version 2)
+.sp
+Renames an existing dimension in an open netCDF dataset.
+If the new name is longer than the old name, the netCDF dataset must be in
+define mode.
+You cannot rename a dimension to have the same name as another dimension.
+.SH "VARIABLES"
+.LP
+.HP
+\fBint nc_def_var(int \fIncid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, int \fIndims\fP, const int \fIdimids\fP[], int* \fIvarid\fP)\fR
+.sp
+(Corresponds to \fBncvardef(\|)\fR in version 2)
+.sp
+Adds a new variable to a netCDF dataset. The netCDF must be in define mode.
+If not \fBNULL\fR, then \fIvarid\fP will be set to the netCDF variable ID.
+.HP
+\fBint nc_inq_varid(int \fIncid\fP, const char \fIname\fP[], int* \fIvarid\fP)\fR
+.sp
+(Corresponds to \fBncvarid(\|)\fR in version 2)
+.sp
+Returns the ID of a netCDF variable in \fIvarid\fP given its name.
+.HP
+\fBint nc_inq_var(int \fIncid\fP, int \fIvarid\fP, char \fIname\fP[], nc_type* \fIxtype\fP, int* \fIndims\fP, int \fIdimids\fP[],
+int* \fInatts\fP)\fR
+.HP
+\fBint nc_inq_varname(int \fIncid\fP, int \fIvarid\fP, char \fIname\fP[])\fR
+.HP
+\fBint nc_inq_vartype(int \fIncid\fP, int \fIvarid\fP, nc_type* \fIxtype\fP)\fR
+.HP
+\fBint nc_inq_varndims(int \fIncid\fP, int \fIvarid\fP, int* \fIndims\fP)\fR
+.HP
+\fBint nc_inq_vardimid(int \fIncid\fP, int \fIvarid\fP, int \fIdimids\fP[])\fR
+.HP
+\fBint nc_inq_varnatts(int \fIncid\fP, int \fIvarid\fP, int* \fInatts\fP)\fR
+.sp
+Returns information about a netCDF variable, given its ID.
+If any of the
+return parameters (\fIname\fP, \fIxtype\fP, \fIndims\fP, \fIdimids\fP, or
+\fInatts\fP) is a \fBNULL\fR pointer, then the corresponding information
+will not be returned; hence, no space need be allocated for it.
+.HP
+\fBint nc_rename_var(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[])\fR
+.sp
+(Corresponds to \fBncvarrename(\|)\fR in version 2)
+.sp
+Changes the name of a netCDF variable.
+If the new name is longer than the old name, the netCDF must be in define mode.
+You cannot rename a variable to have the name of any existing variable.
+
+.SH "VARIABLES \fIin\fP NETCDF-4 FILES"
+.LP
+The following functions may only be used on variables in a
+netCDF-4/HDF5 data file. These functions must be called after the
+variable is defined, but before an enddef call.
+.sp
+\fBint nc_def_var_deflate(int \fIncid\fP, int \fIvarid\fP, int \fIshuffle\fP, int \fIdeflate\fP, int \fIdeflate_level\fP)\fR
+.sp
+Turn on compression and/or shuffle filter. (Shuffle filter is only useful for integer data.)
+.HP
+\fBint nc_inq_var_deflate(int \fIncid\fP, int \fIvarid\fP, int* \fIshufflep\fP, int* \fIdeflatep\fP, int* \fIdeflate_levelp\fP)\fR
+.sp
+Learn about a variable's deflate settings.
+.HP
+\fBint nc_def_var_fletcher32(int \fIncid\fP, int \fIvarid\fP, int \fIfletcher32\fP)\fR
+.sp
+Turn on checksumming for a variable.
+.HP
+\fBint nc_inq_var_fletcher32(int \fIncid\fP, int \fIvarid\fP, int* \fIfletcher32\fP)\fR
+.sp
+Learn about checksumming for a variable.
+.HP
+\fBint nc_def_var_chunking(int \fIncid\fP, int \fIvarid\fP, int \fIstorage\fP, const size_t \fIchunksizesp\fP[])\fR
+.sp
+Set chunksizes for a variable.
+.HP
+\fBint nc_inq_var_chunking(int \fIncid\fP, int \fIvarid\fP, int* \fIstoragep\fP, size_t \fIchunksizesp\fP[])\fR
+.sp
+Learn about chunksizes for a variable.
+.HP
+\fBint nc_def_var_fill(int \fIncid\fP, int \fIvarid\fP, int \fIno_fill\fP, const size_t \fIchunksizesp\fP[])\fR
+.sp
+Set a fill value for a variable.
+.HP
+\fBint nc_inq_var_fill(int \fIncid\fP, int \fIvarid\fP, int* \fIstoragep\fP, size_t \fIchunksizesp\fP[])\fR
+.sp
+Learn the fill value for a variable.
+.HP
+\fBint nc_def_var_endian(int \fIncid\fP, int \fIvarid\fP, int \fIendian\fP)\fR
+.sp
+Set endianness of variable.
+.HP
+\fBint nc_inq_var_endian(int \fIncid\fP, int \fIvarid\fP, int* \fIendianp\fP)\fR
+.sp
+Learn the endianness of a variable.
+.HP
+
+.SH "WRITING AND READING WHOLE VARIABLES"
+.LP
+.HP
+\fBint nc_put_var_text(int \fIncid\fP, int \fIvarid\fP, const char \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_uchar(int \fIncid\fP, int \fIvarid\fP, const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_schar(int \fIncid\fP, int \fIvarid\fP, const signed char \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_short(int \fIncid\fP, int \fIvarid\fP, const short \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_int(int \fIncid\fP, int \fIvarid\fP, const int \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_long(int \fIncid\fP, int \fIvarid\fP, const long \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_float(int \fIncid\fP, int \fIvarid\fP, const float \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_double(int \fIncid\fP, int \fIvarid\fP, const double \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_ubyte(int \fIncid\fP, int \fIvarid\fP, const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_ushort(int \fIncid\fP, int \fIvarid\fP, const unsigned short \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_uint(int \fIncid\fP, int \fIvarid\fP, const unsigned int \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_int64(int \fIncid\fP, int \fIvarid\fP, const long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_uint64(int \fIncid\fP, int \fIvarid\fP, const unsigned long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_var_string(int \fIncid\fP, int \fIvarid\fP, const char * \fIout\fP[])\fR
+
+
+.sp
+Writes an entire netCDF variable (i.e. all the values). The netCDF
+dataset must be open and in data mode. The type of the data is
+specified in the function name, and it is converted to the external
+type of the specified variable, if possible, otherwise an
+\fBNC_ERANGE\fR error is returned. Note that rounding is not performed
+during the conversion. Floating point numbers are truncated when
+converted to integers.
+.HP
+\fBint nc_get_var_text(int \fIncid\fP, int \fIvarid\fP, char \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_uchar(int \fIncid\fP, int \fIvarid\fP, unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_schar(int \fIncid\fP, int \fIvarid\fP, signed char \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_short(int \fIncid\fP, int \fIvarid\fP, short \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_int(int \fIncid\fP, int \fIvarid\fP, int \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_long(int \fIncid\fP, int \fIvarid\fP, long \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_float(int \fIncid\fP, int \fIvarid\fP, float \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_double(int \fIncid\fP, int \fIvarid\fP, double \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_ubyte(int \fIncid\fP, int \fIvarid\fP, unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_ushort(int \fIncid\fP, int \fIvarid\fP, unsigned short \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_uint(int \fIncid\fP, int \fIvarid\fP, unsigned int \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_int64(int \fIncid\fP, int \fIvarid\fP, long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_uint64(int \fIncid\fP, int \fIvarid\fP, unsigned long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_var_string(int \fIncid\fP, int \fIvarid\fP, char * \fIin\fP[])\fR
+
+
+.sp
+Reads an entire netCDF variable (i.e. all the values).
+The netCDF dataset must be open and in data mode.
+The data is converted from the external type of the specified variable,
+if necessary, to the type specified in the function name. If conversion is
+not possible, an \fBNC_ERANGE\fR error is returned.
+.SH "WRITING AND READING ONE DATUM"
+.LP
+.HP
+\fBint nc_put_var1_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], char \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned char \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], signed char \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], short \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], int \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], long \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], float \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], double \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned char \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned short \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned int \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], long long \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned long long \fI*out\fP)\fR
+.HP
+\fBint nc_put_var1_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], char * \fI*out\fP)\fR
+
+
+.sp
+Puts a single data value into a variable at the position \fIindex\fP of an
+open netCDF dataset that is in data mode. The type of the data is
+specified in the function name, and it is converted to the external type
+of the specified variable, if possible, otherwise an \fBNC_ERANGE\fR
+error is returned.
+.HP
+\fBint nc_get_var1_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], char* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned char* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], signed char* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], short* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], int* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], long* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], float* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], double* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned char* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned short* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned int* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], long long* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], unsigned long long* \fIin\fP)\fR
+.HP
+\fBint nc_get_var1_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIindex\fP[], char ** \fIin\fP)\fR
+
+
+.sp
+Gets a single data value from a variable at the position \fIindex\fP
+of an open netCDF dataset that is in data mode.
+The data is converted from the external type of the specified variable,
+if necessary, to the type specified in the function name. If conversion is
+not possible, an \fBNC_ERANGE\fR error is returned.
+.SH "WRITING AND READING AN ARRAY"
+.LP
+.HP
+\fBint nc_put_vara_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const signed char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const short \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const int \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const long \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const float \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const double \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const unsigned short \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const unsigned int \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const unsigned long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_vara_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const char * \fIout\fP[])\fR
+
+
+.sp
+Writes an array section of values into a netCDF variable of an open
+netCDF dataset, which must be in data mode. The array section is specified
+by the \fIstart\fP and \fIcount\fP vectors, which give the starting index
+and count of values along each dimension of the specified variable.
+The type of the data is
+specified in the function name and is converted to the external type
+of the specified variable, if possible, otherwise an \fBNC_ERANGE\fR
+error is returned.
+.HP
+\fBint nc_get_vara_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], signed char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], short \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], int \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], long \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], float \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], double \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], unsigned short \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], unsigned int \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], unsigned long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_vara_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], char * \fIin\fP[])\fR
+
+
+.sp
+Reads an array section of values from a netCDF variable of an open
+netCDF dataset, which must be in data mode. The array section is specified
+by the \fIstart\fP and \fIcount\fP vectors, which give the starting index
+and count of values along each dimension of the specified variable.
+The data is converted from the external type of the specified variable,
+if necessary, to the type specified in the function name. If conversion is
+not possible, an \fBNC_ERANGE\fR error is returned.
+.SH "WRITING AND READING A SLICED ARRAY"
+.LP
+.HP
+\fBint nc_put_vars_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const signed char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const short \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const int \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const long \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const float \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const double \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const unsigned short \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const unsigned int \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const unsigned long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_vars_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], const char * \fIout\fP[])\fR
+
+
+.sp
+These functions are used for \fIstrided output\fP, which is like the
+array section output described above, except that
+the sampling stride (the interval between accessed values) is
+specified for each dimension.
+For an explanation of the sampling stride
+vector, see COMMON ARGUMENTS DESCRIPTIONS below.
+.HP
+\fBint nc_get_vars_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], signed char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], short \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], int \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], long \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], float \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], double \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], unsigned short \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], unsigned int \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], unsigned long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_vars_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], char * \fIin\fP[])\fR
+
+
+.sp
+These functions are used for \fIstrided input\fP, which is like the
+array section input described above, except that
+the sampling stride (the interval between accessed values) is
+specified for each dimension.
+For an explanation of the sampling stride
+vector, see COMMON ARGUMENTS DESCRIPTIONS below.
+.SH "WRITING AND READING A MAPPED ARRAY"
+.LP
+.HP
+\fBint nc_put_varm_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const char \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const signed char \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const short \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const int \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const long \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const float \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const double \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const unsigned short \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const unsigned int \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const unsigned long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_varm_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, const char * \fIout\fP[])\fR
+
+
+.sp
+These functions are used for \fImapped output\fP, which is like
+strided output described above, except that an additional index mapping
+vector is provided to specify the in-memory arrangement of the data
+values.
+For an explanation of the index
+mapping vector, see COMMON ARGUMENTS DESCRIPTIONS below.
+.HP
+\fBint nc_get_varm_text(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, char \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_uchar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_schar(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, signed char \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_short(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, short \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_int(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, int \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_long(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, long \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_float(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, float \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_double(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, double \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_ubyte(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_ushort(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, unsigned short \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_uint(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, unsigned int \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_int64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_uint64(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, unsigned long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_varm_string(int \fIncid\fP, int \fIvarid\fP, const size_t \fIstart\fP[], const size_t \fIcount\fP[], const size_t \fIstride\fP[], \fIimap\fP, char * \fIin\fP[])\fR
+
+
+.sp
+These functions are used for \fImapped input\fP, which is like
+strided input described above, except that an additional index mapping
+vector is provided to specify the in-memory arrangement of the data
+values.
+For an explanation of the index
+mapping vector, see COMMON ARGUMENTS DESCRIPTIONS below.
+.SH "ATTRIBUTES"
+.LP
+.HP
+\fBint nc_put_att_text(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const char \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_uchar(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_schar(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const signed char \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_short(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const short \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_int(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const int \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_long(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const long \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_float(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const float \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_double(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const double \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_ubyte(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const unsigned char \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_ushort(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const unsigned short \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_uint(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const unsigned int \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_int64(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_uint64(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const unsigned long long \fIout\fP[])\fR
+.HP
+\fBint nc_put_att_string(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, const char * \fIout\fP[])\fR
+
+
+.HP
+\fBint nc_put_att(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type \fIxtype\fP, size_t \fIlen\fP, void * \fIip\fP)\fR
+.HP
+\fBint nc_get_att(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], void ** \fIip\fP)\fR
+.sp
+Unlike variables, attributes do not have
+separate functions for defining and writing values.
+This family of functions defines a new attribute with a value or changes
+the value of an existing attribute.
+If the attribute is new, or if the space required to
+store the attribute value is greater than before,
+the netCDF dataset must be in define mode.
+The parameter \fIlen\fP is the number of values from \fIout\fP to transfer.
+It is often one, except that for
+\fBnc_put_att_text(\|)\fR it will usually be
+\fBstrlen(\fIout\fP)\fR.
+.sp
+For these functions, the type component of the function name refers to
+the in-memory type of the value, whereas the \fIxtype\fP argument refers to the
+external type for storing the value. An \fBNC_ERANGE\fR
+error results if
+a conversion between these types is not possible. In this case the value
+is represented with the appropriate fill-value for the associated
+external type.
+.HP
+\fBint nc_inq_attname(int \fIncid\fP, int \fIvarid\fP, int \fIattnum\fP, char \fIname\fP[])\fR
+.sp
+Gets the
+name of an attribute, given its variable ID and attribute number.
+This function is useful in generic applications that
+need to get the names of all the attributes associated with a variable,
+since attributes are accessed by name rather than number in all other
+attribute functions. The number of an attribute is more volatile than
+the name, since it can change when other attributes of the same variable
+are deleted. The attributes for each variable are numbered
+from 0 (the first attribute) to
+\fInvatts\fP-1,
+where \fInvatts\fP is
+the number of attributes for the variable, as returned from a call to
+\fBnc_inq_varnatts(\|)\fR.
+If the \fIname\fP parameter is a \fBNULL\fR pointer, no name will be
+returned and no space need be allocated.
+.HP
+\fBint nc_inq_att(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type* \fIxtype\fP, size_t* \fIlen\fP)\fR
+.HP
+\fBint nc_inq_attid(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], int* \fIattnum\fP)\fR
+.HP
+\fBint nc_inq_atttype(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], nc_type* \fIxtype\fP)\fR
+.HP
+\fBint nc_inq_attlen(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], size_t* \fIlen\fP)\fR
+.sp
+These functions return information about a netCDF attribute,
+given its variable ID and name. The information returned is the
+external type in \fIxtype\fP
+and the number of elements in the attribute as \fIlen\fP.
+If any of the return arguments is a \fBNULL\fR pointer,
+the specified information will not be returned.
+.HP
+\fBint nc_copy_att(int \fIncid\fP, int \fIvarid_in\fP, const char \fIname\fP[], int \fIncid_out\fP, int \fIvarid_out\fP)\fR
+.sp
+Copies an
+attribute from one netCDF dataset to another. It can also be used to
+copy an attribute from one variable to another within the same netCDF.
+\fIncid_in\fP is the netCDF ID of an input netCDF dataset from which the
+attribute will be copied.
+\fIvarid_in\fP
+is the ID of the variable in the input netCDF dataset from which the
+attribute will be copied, or \fBNC_GLOBAL\fR
+for a global attribute.
+\fIname\fP
+is the name of the attribute in the input netCDF dataset to be copied.
+\fIncid_out\fP
+is the netCDF ID of the output netCDF dataset to which the attribute will be
+copied.
+It is permissible for the input and output netCDF ID's to be the same. The
+output netCDF dataset should be in define mode if the attribute to be
+copied does not already exist for the target variable, or if it would
+cause an existing target attribute to grow.
+\fIvarid_out\fP
+is the ID of the variable in the output netCDF dataset to which the attribute will
+be copied, or \fBNC_GLOBAL\fR to copy to a global attribute.
+.HP
+\fBint nc_rename_att(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], const char \fInewname\fP[])\fR
+.sp
+Changes the
+name of an attribute. If the new name is longer than the original name,
+the netCDF must be in define mode. You cannot rename an attribute to
+have the same name as another attribute of the same variable.
+\fIname\fP is the original attribute name.
+\fInewname\fP
+is the new name to be assigned to the specified attribute. If the new name
+is longer than the old name, the netCDF dataset must be in define mode.
+.HP
+\fBint nc_del_att(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[])\fR
+.sp
+Deletes an attribute from a netCDF dataset. The dataset must be in
+define mode.
+.HP
+\fBint nc_get_att_text(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], char \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_uchar(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_schar(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], signed char \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_short(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], short \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_int(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], int \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_long(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], long \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_float(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], float \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_double(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], double \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_ubyte(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], unsigned char \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_ushort(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], unsigned short \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_uint(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], unsigned int \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_int64(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_uint64(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], unsigned long long \fIin\fP[])\fR
+.HP
+\fBint nc_get_att_string(int \fIncid\fP, int \fIvarid\fP, const char \fIname\fP[], char * \fIin\fP[])\fR
+
+
+.sp
+Gets the value(s) of a netCDF attribute, given its
+variable ID and name. Converts from the external type to the type
+specified in
+the function name, if possible, otherwise returns an \fBNC_ERANGE\fR
+error.
+All elements of the vector of attribute
+values are returned, so you must allocate enough space to hold
+them. If you don't know how much space to reserve, call
+\fBnc_inq_attlen(\|)\fR
+first to find out the length of the attribute.
+.SH "COMMON ARGUMENT DESCRIPTIONS"
+.LP
+In this section we define some common arguments which are used in the
+"FUNCTION DESCRIPTIONS" section.
+.TP
+int \fIncid\fP
+is the netCDF ID returned from a previous, successful call to
+\fBnc_open(\|)\fR or \fBnc_create(\|)\fR
+.TP
+char \fIname\fP[]
+is the name of a dimension, variable, or attribute. The names of
+dimensions, variables and attributes consist of arbitrary
+sequences of alphanumeric characters (as well as underscore '_',
+period '.' and hyphen '-'), beginning with a letter or
+underscore. (However names commencing with underscore are reserved for
+system use.) Case is significant in netCDF names. A zero-length name
+is not allowed.
+As an input argument,
+it shall be a pointer to a 0-terminated string; as an output argument, it
+shall be the address of a buffer in which to hold such a string.
+The maximum allowable number of characters
+(excluding the terminating 0) is \fBNC_MAX_NAME\fR.
+.TP
+nc_type \fIxtype\fP
+specifies the external data type of a netCDF variable or attribute and
+is one of the following:
+\fBNC_BYTE\fR, \fBNC_CHAR\fR, \fBNC_SHORT\fR, \fBNC_INT\fR,
+\fBNC_FLOAT\fR, or \fBNC_DOUBLE\fR.
+These are used to specify 8-bit integers,
+characters, 16-bit integers, 32-bit integers, 32-bit IEEE floating point
+numbers, and 64-bit IEEE floating-point numbers, respectively.
+(\fBNC_INT\fR corresponds to \fBNC_LONG\fR in version 2, to specify a
+32-bit integer).
+.TP
+int \fIdimids\fP[]
+is a vector of dimension ID's and defines the shape of a netCDF variable.
+The size of the vector shall be greater than or equal to the
+rank (i.e. the number of dimensions) of the variable (\fIndims\fP).
+The vector shall be ordered by the speed with which a dimension varies:
+\fIdimids\fP[\fIndims\fP-1]
+shall be the dimension ID of the most rapidly
+varying dimension and
+\fIdimids\fP[0]
+shall be the dimension ID of the most slowly
+varying dimension.
+The maximum possible number of
+dimensions for a variable is given by the symbolic constant
+\fBNC_MAX_VAR_DIMS\fR.
+.TP
+int \fIdimid\fP
+is the ID of a netCDF dimension.
+netCDF dimension ID's are allocated sequentially from the
+non-negative
+integers beginning with 0.
+.TP
+int \fIndims\fP
+is either the total number of dimensions in a netCDF dataset or the rank
+(i.e. the number of dimensions) of a netCDF variable.
+The value shall not be negative or greater than the symbolic constant
+\fBNC_MAX_VAR_DIMS\fR.
+.TP
+int \fIvarid\fP
+is the ID of a netCDF variable or (for the attribute-access functions)
+the symbolic constant
+\fBNC_GLOBAL\fR,
+which is used to reference global attributes.
+netCDF variable ID's are allocated sequentially from the
+non-negative
+integers beginning with 0.
+.TP
+int* \fInatts\fP
+is the number of global attributes in a netCDF dataset for the
+\fBnc_inquire(\|)\fR
+function or the number
+of attributes associated with a netCDF variable for the
+\fBnc_varinq(\|)\fR
+function.
+.TP
+const size_t \fIindex\fP[]
+specifies the indicial coordinates of the netCDF data value to be accessed.
+The indices start at 0;
+thus, for example, the first data value of a
+two-dimensional variable is (0,0).
+The size of the vector shall be at least the rank of the associated
+netCDF variable and its elements shall correspond, in order, to the
+variable's dimensions.
+.TP
+const size_t \fIstart\fP[]
+specifies the starting point
+for accessing a netCDF variable's data values
+in terms of the indicial coordinates of
+the corner of the array section.
+The indices start at 0;
+thus, the first data
+value of a variable is (0, 0, ..., 0).
+The size of the vector shall be at least the rank of the associated
+netCDF variable and its elements shall correspond, in order, to the
+variable's dimensions.
+.TP
+const size_t \fIcount\fP[]
+specifies the number of indices selected along each dimension of the
+array section.
+Thus, to access a single value, for example, specify \fIcount\fP as
+(1, 1, ..., 1).
+Note that, for strided I/O, this argument must be adjusted
+to be compatible with the \fIstride\fP and \fIstart\fP arguments so that
+the interaction of the
+three does not attempt to access an invalid data co-ordinate.
+The elements of the
+\fIcount\fP vector correspond, in order, to the variable's dimensions.
+.TP
+const size_t \fIstride\fP[]
+specifies the sampling interval along each dimension of the netCDF
+variable. The elements of the stride vector correspond, in order,
+to the netCDF variable's dimensions (\fIstride\fP[0])
+gives the sampling interval along the most slowly
+varying dimension of the netCDF variable). Sampling intervals are
+specified in type-independent units of elements (a value of 1 selects
+consecutive elements of the netCDF variable along the corresponding
+dimension, a value of 2 selects every other element, etc.).
+A \fBNULL\fR stride argument is treated as (1, 1, ... , 1).
+.TP
+\fIimap\fP
+specifies the mapping between the dimensions of a netCDF variable and
+the in-memory structure of the internal data array. The elements of
+the index mapping vector correspond, in order, to the netCDF variable's
+dimensions (\fIimap\fP[0] gives the distance
+between elements of the internal array corresponding to the most
+slowly varying dimension of the netCDF variable).
+Distances between elements are specified in type-independent units of
+elements (the distance between internal elements that occupy adjacent
+memory locations is 1 and not the element's byte-length as in netCDF 2).
+A \fBNULL\fR pointer means the memory-resident values have
+the same structure as the associated netCDF variable.
+.SH "VARIABLE PREFILLING"
+.LP
+By default, the netCDF interface sets the values of
+all newly-defined variables of finite length (i.e. those that do not have
+an unlimited, dimension) to the type-dependent fill-value associated with each
+variable. This is done when \fBnc_enddef(\|)\fR
+is called. The
+fill-value for a variable may be changed from the default value by
+defining the attribute `\fB_FillValue\fR' for the variable. This
+attribute must have the same type as the variable and be of length one.
+.LP
+Variables with an unlimited dimension are also prefilled, but on
+an `as needed' basis. For example, if the first write of such a
+variable is to position 5, then
+positions
+0 through 4
+(and no others)
+would be set to the fill-value at the same time.
+.LP
+This default prefilling of data values may be disabled by
+or'ing the
+\fBNC_NOFILL\fR
+flag into the mode parameter of \fBnc_open(\|)\fR or \fBnc_create(\|)\fR,
+or, by calling the function \fBnc_set_fill(\|)\fR
+with the argument \fBNC_NOFILL\fR.
+For variables that do not use the unlimited dimension,
+this call must
+be made before
+\fBnc_enddef(\|)\fR.
+For variables that
+use the unlimited dimension, this call
+may be made at any time.
+.LP
+One can obtain increased performance of the netCDF interface by using
+this feature, but only at the expense of requiring the application to set
+every single data value. The performance
+enhancing behavior of this function is dependent on the particulars of
+the implementation and dataset format.
+The flag value controlled by \fBnc_set_fill(\|)\fR
+is per netCDF ID,
+not per variable or per write.
+Allowing this to change affects the degree to which
+a program can be effectively parallelized.
+Given all of this, we state that the use
+of this feature may not be available (or even needed) in future
+releases. Programmers are cautioned against heavy reliance upon this
+feature.
+.HP
+\fBint nc_setfill(int \fIncid\fP, int \fIfillmode\fP, int* \fIold_fillemode\fP)\fR
+.sp
+(Corresponds to \fBncsetfill(\|)\fR in version 2)
+.sp
+Determines whether or not variable prefilling will be done (see
+above).
+The netCDF dataset shall be writable.
+\fIfillmode\fP is either \fBNC_FILL\fR
+to enable prefilling (the
+default) or \fBNC_NOFILL\fR
+to disable prefilling.
+This function returns the previous setting in \fIold_fillmode\fP.
+
+.HP
+.SH "MPP FUNCTION DESCRIPTIONS"
+.LP
+Additional functions for use on SGI/Cray MPP machines (_CRAYMPP).
+These are used to set and inquire which PE is the base for MPP
+for a particular netCDF. These are only relevant when
+using the SGI/Cray ``global''
+Flexible File I/O layer and desire to have
+only a subset of PEs to open the specific netCDF file.
+For technical reasons, these functions are available on all platforms.
+On a platform other than SGI/Cray MPP, it is as if
+only processor available were processor 0.
+.LP
+To use this feature, you need to specify a communicator group and call
+\fBglio_group_mpi(\|)\fR or \fBglio_group_shmem(\|)\fR prior to the netCDF
+\fBnc_open(\|)\fR and \fBnc_create(\|)\fR calls.
+.HP
+\fBint nc__create_mp(const char \fIpath\fP[], int \fIcmode\fP, size_t \fIinitialsize\fP, int \fIpe\fP, size_t* \fIchunksize\fP, int* \fIncid\fP)\fR
+.sp
+Like \fBnc__create(\|)\fR but allows the base PE to be set.
+.sp
+The argument \fIpe\fP sets the base PE at creation time. In the MPP
+environment, \fBnc__create(\|)\fR and \fBnc_create(\|)\fR set the base PE to processor
+zero by default.
+.HP
+\fBint nc__open_mp(const char \fIpath\fP[], int \fImode\fP, int \fIpe\fP, size_t* \fIchunksize\fP, int* \fIncid\fP)\fR
+.sp
+Like \fBnc__open(\|)\fR but allows the base PE to be set.
+The argument \fIpe\fP sets the base PE at creation time. In the MPP
+environment, \fBnc__open(\|)\fR and \fBnc_open(\|)\fR set the base PE to processor
+zero by default.
+.HP
+\fBint nc_inq_base_pe(int \fIncid\fP, int* \fIpe\fP)\fR
+.sp
+Inquires of the netCDF dataset which PE is being used as the base for MPP use.
+This is safe to use at any time.
+.HP
+\fBint nc_set_base_pe(int \fIncid\fP, int \fIpe\fP)\fR
+.sp
+Resets the base PE for the netCDF dataset.
+Only perform this operation when the affected communicator group
+synchronizes before and after the call.
+This operation is very risky and should only be contemplated
+under only the most extreme cases.
+.SH "ENVIRONMENT VARIABLES"
+.TP 4
+.B NETCDF_FFIOSPEC
+Specifies the Flexible File I/O buffers for netCDF I/O when executing
+under the UNICOS operating system (the variable is ignored on other
+operating systems).
+An appropriate specification can greatly increase the efficiency of
+netCDF I/O -- to the extent that it can actually surpass FORTRAN binary
+I/O.
+This environment variable has been made a little more generalized,
+such that other FFIO option specifications can now be added.
+The default specification is \fBbufa:336:2\fP,
+unless a current FFIO specification is in operation,
+which will be honored.
+See UNICOS Flexible File I/O for more information.
+.SH "MAILING-LISTS"
+.LP
+Both a mailing list and a digest are available for
+discussion of the netCDF interface and announcements about netCDF bugs,
+fixes, and enhancements.
+To begin or change your subscription to either the mailing-list or the
+digest, send one of the following in the body (not
+the subject line) of an email message to "majordomo at unidata.ucar.edu".
+Use your email address in place of \fIjdoe at host.inst.domain\fP.
+.sp
+To subscribe to the netCDF mailing list:
+.RS
+\fBsubscribe netcdfgroup \fIjdoe at host.inst.domain\fR
+.RE
+To unsubscribe from the netCDF mailing list:
+.RS
+\fBunsubscribe netcdfgroup \fIjdoe at host.inst.domain\fR
+.RE
+To subscribe to the netCDF digest:
+.RS
+\fBsubscribe netcdfdigest \fIjdoe at host.inst.domain\fR
+.RE
+To unsubscribe from the netCDF digest:
+.RS
+\fBunsubscribe netcdfdigest \fIjdoe at host.inst.domain\fR
+.RE
+To retrieve the general introductory information for the mailing list:
+.RS
+\fBinfo netcdfgroup\fR
+.RE
+To get a synopsis of other majordomo commands:
+.RS
+\fBhelp\fR
+.RE
+.SH "SEE ALSO"
+.LP
+.BR ncdump (1),
+.BR ncgen (1),
+.BR netcdf (3).
+.LP
+\fInetCDF User's Guide\fP, published
+by the Unidata Program Center, University Corporation for Atmospheric
+Research, located in Boulder, Colorado.
+
+NetCDF home page at http:/www.unidata.ucar.edu/netcdf.
diff --git a/libsrc/posixio.c b/libsrc/posixio.c
index f64915e..93057b4 100644
--- a/libsrc/posixio.c
+++ b/libsrc/posixio.c
@@ -23,17 +23,18 @@
#include <stdlib.h>
#include <errno.h>
-#ifndef ENOERR
-#define ENOERR 0
+#ifndef NC_NOERR
+#define NC_NOERR 0
#endif
#include <sys/types.h>
#include <sys/stat.h>
+
#include <fcntl.h>
#include <string.h>
#ifndef HAVE_SSIZE_T
-#define ssize_t int
+typedef int ssize_t;
#endif
#ifndef SEEK_SET
@@ -99,6 +100,41 @@ static int ncio_spx_close(ncio *nciop, int doUnlink);
#ifndef POSIXIO_DEFAULT_PAGESIZE
#define POSIXIO_DEFAULT_PAGESIZE 4096
#endif
+
+/*! Cross-platform file length.
+ *
+ * Some versions of Visual Studio are throwing errno 132
+ * when fstat is used on large files. This function is
+ * an attempt to get around that.
+ *
+ * @par fd File Descriptor.
+ * @return -1 on error, length of file (in bytes) otherwise.
+ */
+static size_t nc_get_filelen(const int fd) {
+
+ size_t flen;
+
+#ifdef HAVE_FILE_LENGTH_I64
+ __int64 file_len = 0;
+ if ((file_len = _filelengthi64(fd)) < 0) {
+ return file_len;
+ }
+ flen = (size_t)file_len;
+
+#else
+ int res = 0;
+ struct stat sb;
+ if((res = fstat(fd,&sb)) <0)
+ return res;
+
+ flen = sb.st_size;
+#endif
+
+ return flen;
+
+}
+
+
/*
* What is the system pagesize?
*/
@@ -159,7 +195,7 @@ fgrow(const int fd, const off_t len)
if (fstat(fd, &sb) < 0)
return errno;
if (len < sb.st_size)
- return ENOERR;
+ return NC_NOERR;
{
const long dumb = 0;
/* we don't use ftruncate() due to problem with FAT32 file systems */
@@ -174,7 +210,7 @@ fgrow(const int fd, const off_t len)
if (lseek(fd, pos, SEEK_SET) < 0)
return errno;
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -186,13 +222,23 @@ fgrow(const int fd, const off_t len)
static int
fgrow2(const int fd, const off_t len)
{
- struct stat sb;
- if (fstat(fd, &sb) < 0)
- return errno;
- if (len <= sb.st_size)
- return ENOERR;
- {
- const char dumb = 0;
+
+
+ /* There is a problem with fstat on Windows based systems
+ which manifests (so far) when Config RELEASE is built.
+ Use _filelengthi64 isntead.
+
+ See https://github.com/Unidata/netcdf-c/issues/188
+
+ */
+
+
+ size_t file_len = nc_get_filelen(fd);
+ if(file_len < 0) return errno;
+ if(len <= file_len)
+ return NC_NOERR;
+ {
+ const char dumb = 0;
/* we don't use ftruncate() due to problem with FAT32 file systems */
/* cache current position */
const off_t pos = lseek(fd, 0, SEEK_CUR);
@@ -205,7 +251,7 @@ fgrow2(const int fd, const off_t len)
if (lseek(fd, pos, SEEK_SET) < 0)
return errno;
}
- return ENOERR;
+ return NC_NOERR;
}
/* End OS */
/* Begin px */
@@ -261,7 +307,7 @@ px_pgout(ncio *const nciop,
return errno;
*posp += extent;
- return ENOERR;
+ return NC_NOERR;
}
/*! Read in a page of data.
@@ -332,7 +378,7 @@ px_pgin(ncio *const nciop,
if(nread != (ssize_t)extent) {
status = errno;
- if( nread == -1 || (status != EINTR && status != ENOERR))
+ if( nread == -1 || (status != EINTR && status != NC_NOERR))
return status;
/* else it's okay we read less than asked for */
(void) memset((char *)vp + nread, 0, (ssize_t)extent - nread);
@@ -341,7 +387,7 @@ px_pgin(ncio *const nciop,
*nreadp = nread;
*posp += nread;
- return ENOERR;
+ return NC_NOERR;
}
/* This struct is for POSIX systems, with NC_SHARE not in effect. If
@@ -403,7 +449,7 @@ px_rel(ncio_px *const pxp, off_t offset, int rflags)
}
pxp->bf_refcount--;
- return ENOERR;
+ return NC_NOERR;
}
/* This function indicates the file region starting at offset may be
@@ -474,7 +520,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
int rflags,
void **const vpp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
const off_t blkoffset = _RNDDOWN(offset, (off_t)pxp->blksz);
off_t diff = (size_t)(offset - blkoffset);
@@ -517,7 +563,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
middle,
&pxp->bf_cnt,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_extent = 2 * pxp->blksz;
pxp->bf_cnt += pxp->blksz;
@@ -552,7 +598,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
pxp->blksz,
pxp->bf_base,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
}
pxp->bf_cnt -= pxp->blksz;
@@ -571,7 +617,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
pxp->blksz,
pxp->bf_base,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
}
}
@@ -589,7 +635,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
middle,
&pxp->bf_cnt,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_extent = 2 * pxp->blksz;
pxp->bf_cnt += pxp->blksz;
@@ -617,7 +663,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
pxp->bf_cnt - pxp->blksz,
middle,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
}
pxp->bf_cnt = pxp->blksz;
@@ -636,7 +682,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
pxp->bf_base,
&pxp->bf_cnt,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_offset = blkoffset;
if(upper_cnt != 0)
@@ -661,7 +707,7 @@ px_get(ncio *const nciop, ncio_px *const pxp,
pxp->bf_cnt,
pxp->bf_base,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_rflags = 0;
}
@@ -673,7 +719,7 @@ pgin:
pxp->bf_base,
&pxp->bf_cnt,
&pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_offset = blkoffset;
pxp->bf_extent = blkextent;
@@ -692,7 +738,7 @@ done:
#else
*vpp = (void *)((signed char*)pxp->bf_base + diff);
#endif
- return ENOERR;
+ return NC_NOERR;
}
/* Request that the region (offset, extent) be made available through
@@ -749,7 +795,7 @@ px_double_buffer(ncio *const nciop, off_t to, off_t from,
size_t nbytes, int rflags)
{
ncio_px *const pxp = (ncio_px *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
void *src;
void *dest;
@@ -759,7 +805,7 @@ fprintf(stderr, "\tdouble_buffr %ld %ld %ld\n",
#endif
status = px_get(nciop, pxp, to, nbytes, RGN_WRITE,
&dest);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(pxp->slave == NULL)
@@ -786,7 +832,7 @@ fprintf(stderr, "\tdouble_buffr %ld %ld %ld\n",
pxp->slave->pos = pxp->pos;
status = px_get(nciop, pxp->slave, from, nbytes, 0,
&src);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(pxp->pos != pxp->slave->pos)
{
@@ -821,7 +867,7 @@ ncio_px_move(ncio *const nciop, off_t to, off_t from,
size_t nbytes, int rflags)
{
ncio_px *const pxp = (ncio_px *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
off_t lower;
off_t upper;
char *base;
@@ -829,7 +875,7 @@ ncio_px_move(ncio *const nciop, off_t to, off_t from,
size_t extent;
if(to == from)
- return ENOERR; /* NOOP */
+ return NC_NOERR; /* NOOP */
if(fIsSet(rflags, RGN_WRITE) && !fIsSet(nciop->ioflags, NC_WRITE))
return EPERM; /* attempt to write readonly file */
@@ -871,7 +917,7 @@ if(to > from)
status = px_double_buffer(nciop, toh, frm,
loopextent, rflags) ;
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
remaining -= loopextent;
@@ -887,7 +933,7 @@ else
status = px_double_buffer(nciop, to, from,
loopextent, rflags) ;
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
remaining -= loopextent;
@@ -897,7 +943,7 @@ else
from += loopextent;
}
}
- return ENOERR;
+ return NC_NOERR;
}
#if INSTRUMENT
@@ -906,7 +952,7 @@ fprintf(stderr, "\tncio_px_move small\n");
status = px_get(nciop, pxp, lower, extent, RGN_WRITE|rflags,
(void **)&base);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(to > from)
@@ -927,14 +973,14 @@ static int
ncio_px_sync(ncio *const nciop)
{
ncio_px *const pxp = (ncio_px *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
if(fIsSet(pxp->bf_rflags, RGN_MODIFIED))
{
assert(pxp->bf_refcount <= 0);
status = px_pgout(nciop, pxp->bf_offset,
pxp->bf_cnt,
pxp->bf_base, &pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_rflags = 0;
}
@@ -1028,7 +1074,7 @@ ncio_px_init2(ncio *const nciop, size_t *sizehintp, int isNew)
pxp->bf_extent = bufsz;
(void) memset(pxp->bf_base, 0, pxp->bf_extent);
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -1098,7 +1144,7 @@ static int
ncio_spx_rel(ncio *const nciop, off_t offset, int rflags)
{
ncio_spx *const pxp = (ncio_spx *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
assert(pxp->bf_offset <= offset);
assert(pxp->bf_cnt != 0);
@@ -1147,7 +1193,7 @@ ncio_spx_get(ncio *const nciop,
void **const vpp)
{
ncio_spx *const pxp = (ncio_spx *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
#ifdef X_ALIGN
size_t rem;
#endif
@@ -1197,7 +1243,7 @@ ncio_spx_get(ncio *const nciop,
extent,
pxp->bf_base,
&pxp->bf_cnt, &pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_offset = offset;
@@ -1210,7 +1256,7 @@ ncio_spx_get(ncio *const nciop,
#else
*vpp = pxp->bf_base;
#endif
- return ENOERR;
+ return NC_NOERR;
}
@@ -1221,7 +1267,7 @@ strategy(ncio *const nciop, off_t to, off_t offset,
size_t extent, int rflags)
{
static ncio_spx pxp[1];
- int status = ENOERR;
+ int status = NC_NOERR;
#ifdef X_ALIGN
size_t rem;
#endif
@@ -1271,7 +1317,7 @@ fprintf(stderr, "strategy %ld at %ld to %ld\n",
extent,
pxp->bf_base,
&pxp->bf_cnt, &pxp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
pxp->bf_offset = to; /* TODO: XALIGN */
@@ -1304,7 +1350,7 @@ static int
ncio_spx_move(ncio *const nciop, off_t to, off_t from,
size_t nbytes, int rflags)
{
- int status = ENOERR;
+ int status = NC_NOERR;
off_t lower = from;
off_t upper = to;
char *base;
@@ -1314,7 +1360,7 @@ ncio_spx_move(ncio *const nciop, off_t to, off_t from,
rflags &= RGN_NOLOCK; /* filter unwanted flags */
if(to == from)
- return ENOERR; /* NOOP */
+ return NC_NOERR; /* NOOP */
if(to > from)
{
@@ -1335,7 +1381,7 @@ ncio_spx_move(ncio *const nciop, off_t to, off_t from,
status = ncio_spx_get(nciop, lower, extent, RGN_WRITE|rflags,
(void **)&base);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(to > from)
@@ -1356,7 +1402,7 @@ static int
ncio_spx_sync(ncio *const nciop)
{
/* NOOP */
- return ENOERR;
+ return NC_NOERR;
}
static void
@@ -1404,7 +1450,7 @@ ncio_spx_init2(ncio *const nciop, const size_t *const sizehintp)
return ENOMEM;
}
/* else */
- return ENOERR;
+ return NC_NOERR;
}
@@ -1604,13 +1650,13 @@ posixio_create(const char *path, int ioflags,
else
status = ncio_px_init2(nciop, sizehintp, 1);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
if(initialsz != 0)
{
status = fgrow(fd, (off_t)initialsz);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
@@ -1620,12 +1666,12 @@ posixio_create(const char *path, int ioflags,
igeto, igetsz,
RGN_WRITE,
igetvpp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
*nciopp = nciop;
- return ENOERR;
+ return NC_NOERR;
unwind_open:
(void) close(fd);
@@ -1736,7 +1782,7 @@ posixio_open(const char *path,
else
status = ncio_px_init2(nciop, sizehintp, 0);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
if(igetsz != 0)
@@ -1745,12 +1791,12 @@ posixio_open(const char *path,
igeto, igetsz,
0,
igetvpp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
*nciopp = nciop;
- return ENOERR;
+ return NC_NOERR;
unwind_open:
(void) close(fd); /* assert fd >= 0 */
@@ -1787,7 +1833,7 @@ ncio_px_filesize(ncio *nciop, off_t *filesizep)
return errno;
*filesizep = sb.st_size;
#endif
- return ENOERR;
+ return NC_NOERR;
}
/*
@@ -1801,7 +1847,7 @@ static int
ncio_px_pad_length(ncio *nciop, off_t length)
{
- int status = ENOERR;
+ int status = NC_NOERR;
if(nciop == NULL)
return EINVAL;
@@ -1810,13 +1856,13 @@ ncio_px_pad_length(ncio *nciop, off_t length)
return EPERM; /* attempt to write readonly file */
status = nciop->sync(nciop);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = fgrow2(nciop->fd, length);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
@@ -1833,7 +1879,7 @@ ncio_px_pad_length(ncio *nciop, off_t length)
static int
ncio_px_close(ncio *nciop, int doUnlink)
{
- int status = ENOERR;
+ int status = NC_NOERR;
if(nciop == NULL)
return EINVAL;
if(nciop->fd > 0) {
@@ -1849,7 +1895,7 @@ ncio_px_close(ncio *nciop, int doUnlink)
static int
ncio_spx_close(ncio *nciop, int doUnlink)
{
- int status = ENOERR;
+ int status = NC_NOERR;
if(nciop == NULL)
return EINVAL;
if(nciop->fd > 0) {
diff --git a/libsrc/putget.c b/libsrc/putget.c
index b2485b0..cab6eb3 100644
--- a/libsrc/putget.c
+++ b/libsrc/putget.c
@@ -1,4 +1,6 @@
+#line 9 "putget.m4"
/* Do not edit this file. It is produced from the corresponding .m4 source */
+#line 11
/*
* Copyright 1996, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
@@ -70,6 +72,7 @@ arrayp(const char *label, size_t count, const size_t *array)
#endif
+#line 107
/*
* Next 6 type specific functions
@@ -78,252 +81,480 @@ arrayp(const char *label, size_t count, const size_t *array)
NC_arrayfill()
*/
static int
+#line 114
NC_fill_schar(
+#line 114
void **xpp,
+#line 114
size_t nelems) /* how many */
+#line 114
{
+#line 114
schar fillp[NFILL * sizeof(double)/X_SIZEOF_CHAR];
+#line 114
+#line 114
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 114
+#line 114
{
+#line 114
schar *vp = fillp; /* lower bound of area to be filled */
+#line 114
const schar *const end = vp + nelems;
+#line 114
while(vp < end)
+#line 114
{
+#line 114
*vp++ = NC_FILL_BYTE;
+#line 114
}
+#line 114
}
+#line 114
return ncx_putn_schar_schar(xpp, nelems, fillp);
+#line 114
}
+#line 114
static int
+#line 115
NC_fill_char(
+#line 115
void **xpp,
+#line 115
size_t nelems) /* how many */
+#line 115
{
+#line 115
char fillp[NFILL * sizeof(double)/X_SIZEOF_CHAR];
+#line 115
+#line 115
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 115
+#line 115
{
+#line 115
char *vp = fillp; /* lower bound of area to be filled */
+#line 115
const char *const end = vp + nelems;
+#line 115
while(vp < end)
+#line 115
{
+#line 115
*vp++ = NC_FILL_CHAR;
+#line 115
}
+#line 115
}
+#line 115
return ncx_putn_char_char(xpp, nelems, fillp);
+#line 115
}
+#line 115
static int
+#line 116
NC_fill_short(
+#line 116
void **xpp,
+#line 116
size_t nelems) /* how many */
+#line 116
{
+#line 116
short fillp[NFILL * sizeof(double)/X_SIZEOF_SHORT];
+#line 116
+#line 116
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 116
+#line 116
{
+#line 116
short *vp = fillp; /* lower bound of area to be filled */
+#line 116
const short *const end = vp + nelems;
+#line 116
while(vp < end)
+#line 116
{
+#line 116
*vp++ = NC_FILL_SHORT;
+#line 116
}
+#line 116
}
+#line 116
return ncx_putn_short_short(xpp, nelems, fillp);
+#line 116
}
+#line 116
#if (SIZEOF_INT >= X_SIZEOF_INT)
static int
+#line 119
NC_fill_int(
+#line 119
void **xpp,
+#line 119
size_t nelems) /* how many */
+#line 119
{
+#line 119
int fillp[NFILL * sizeof(double)/X_SIZEOF_INT];
+#line 119
+#line 119
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 119
+#line 119
{
+#line 119
int *vp = fillp; /* lower bound of area to be filled */
+#line 119
const int *const end = vp + nelems;
+#line 119
while(vp < end)
+#line 119
{
+#line 119
*vp++ = NC_FILL_INT;
+#line 119
}
+#line 119
}
+#line 119
return ncx_putn_int_int(xpp, nelems, fillp);
+#line 119
}
+#line 119
#elif SIZEOF_LONG == X_SIZEOF_INT
static int
+#line 121
NC_fill_int(
+#line 121
void **xpp,
+#line 121
size_t nelems) /* how many */
+#line 121
{
+#line 121
long fillp[NFILL * sizeof(double)/X_SIZEOF_INT];
+#line 121
+#line 121
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 121
+#line 121
{
+#line 121
long *vp = fillp; /* lower bound of area to be filled */
+#line 121
const long *const end = vp + nelems;
+#line 121
while(vp < end)
+#line 121
{
+#line 121
*vp++ = NC_FILL_INT;
+#line 121
}
+#line 121
}
+#line 121
return ncx_putn_int_long(xpp, nelems, fillp);
+#line 121
}
+#line 121
#else
#error "NC_fill_int implementation"
#endif
static int
+#line 126
NC_fill_float(
+#line 126
void **xpp,
+#line 126
size_t nelems) /* how many */
+#line 126
{
+#line 126
float fillp[NFILL * sizeof(double)/X_SIZEOF_FLOAT];
+#line 126
+#line 126
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 126
+#line 126
{
+#line 126
float *vp = fillp; /* lower bound of area to be filled */
+#line 126
const float *const end = vp + nelems;
+#line 126
while(vp < end)
+#line 126
{
+#line 126
*vp++ = NC_FILL_FLOAT;
+#line 126
}
+#line 126
}
+#line 126
return ncx_putn_float_float(xpp, nelems, fillp);
+#line 126
}
+#line 126
static int
+#line 127
NC_fill_double(
+#line 127
void **xpp,
+#line 127
size_t nelems) /* how many */
+#line 127
{
+#line 127
double fillp[NFILL * sizeof(double)/X_SIZEOF_DOUBLE];
+#line 127
+#line 127
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 127
+#line 127
{
+#line 127
double *vp = fillp; /* lower bound of area to be filled */
+#line 127
const double *const end = vp + nelems;
+#line 127
while(vp < end)
+#line 127
{
+#line 127
*vp++ = NC_FILL_DOUBLE;
+#line 127
}
+#line 127
}
+#line 127
return ncx_putn_double_double(xpp, nelems, fillp);
+#line 127
}
+#line 127
static int
+#line 129
NC_fill_uchar(
+#line 129
void **xpp,
+#line 129
size_t nelems) /* how many */
+#line 129
{
+#line 129
uchar fillp[NFILL * sizeof(double)/X_SIZEOF_UBYTE];
+#line 129
+#line 129
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 129
+#line 129
{
+#line 129
uchar *vp = fillp; /* lower bound of area to be filled */
+#line 129
const uchar *const end = vp + nelems;
+#line 129
while(vp < end)
+#line 129
{
+#line 129
*vp++ = NC_FILL_UBYTE;
+#line 129
}
+#line 129
}
+#line 129
return ncx_putn_uchar_uchar(xpp, nelems, fillp);
+#line 129
}
+#line 129
static int
+#line 130
NC_fill_ushort(
+#line 130
void **xpp,
+#line 130
size_t nelems) /* how many */
+#line 130
{
+#line 130
ushort fillp[NFILL * sizeof(double)/X_SIZEOF_USHORT];
+#line 130
+#line 130
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 130
+#line 130
{
+#line 130
ushort *vp = fillp; /* lower bound of area to be filled */
+#line 130
const ushort *const end = vp + nelems;
+#line 130
while(vp < end)
+#line 130
{
+#line 130
*vp++ = NC_FILL_USHORT;
+#line 130
}
+#line 130
}
+#line 130
return ncx_putn_ushort_ushort(xpp, nelems, fillp);
+#line 130
}
+#line 130
static int
+#line 131
NC_fill_uint(
+#line 131
void **xpp,
+#line 131
size_t nelems) /* how many */
+#line 131
{
+#line 131
uint fillp[NFILL * sizeof(double)/X_SIZEOF_UINT];
+#line 131
+#line 131
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 131
+#line 131
{
+#line 131
uint *vp = fillp; /* lower bound of area to be filled */
+#line 131
const uint *const end = vp + nelems;
+#line 131
while(vp < end)
+#line 131
{
+#line 131
*vp++ = NC_FILL_UINT;
+#line 131
}
+#line 131
}
+#line 131
return ncx_putn_uint_uint(xpp, nelems, fillp);
+#line 131
}
+#line 131
static int
+#line 132
NC_fill_longlong(
+#line 132
void **xpp,
+#line 132
size_t nelems) /* how many */
+#line 132
{
+#line 132
longlong fillp[NFILL * sizeof(double)/X_SIZEOF_LONGLONG];
+#line 132
+#line 132
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 132
+#line 132
{
+#line 132
longlong *vp = fillp; /* lower bound of area to be filled */
+#line 132
const longlong *const end = vp + nelems;
+#line 132
while(vp < end)
+#line 132
{
+#line 132
*vp++ = NC_FILL_INT64;
+#line 132
}
+#line 132
}
+#line 132
return ncx_putn_longlong_longlong(xpp, nelems, fillp);
+#line 132
}
+#line 132
static int
+#line 133
NC_fill_ulonglong(
+#line 133
void **xpp,
+#line 133
size_t nelems) /* how many */
+#line 133
{
+#line 133
ulonglong fillp[NFILL * sizeof(double)/X_SIZEOF_ULONGLONG];
+#line 133
+#line 133
assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
+#line 133
+#line 133
{
+#line 133
ulonglong *vp = fillp; /* lower bound of area to be filled */
+#line 133
const ulonglong *const end = vp + nelems;
+#line 133
while(vp < end)
+#line 133
{
+#line 133
*vp++ = NC_FILL_UINT64;
+#line 133
}
+#line 133
}
+#line 133
return ncx_putn_ulonglong_ulonglong(xpp, nelems, fillp);
+#line 133
}
+#line 133
@@ -856,8655 +1087,17080 @@ NC_varoffset(const NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
}
+#line 720
static int
+#line 721
putNCvx_char_char(NC3_INFO* ncp, const NC_var *varp,
+#line 721
const size_t *start, size_t nelems, const char *value)
+#line 721
{
+#line 721
off_t offset = NC_varoffset(ncp, varp, start);
+#line 721
size_t remaining = varp->xsz * nelems;
+#line 721
int status = NC_NOERR;
+#line 721
void *xp;
+#line 721
+#line 721
if(nelems == 0)
+#line 721
return NC_NOERR;
+#line 721
+#line 721
assert(value != NULL);
+#line 721
+#line 721
for(;;)
+#line 721
{
+#line 721
size_t extent = MIN(remaining, ncp->chunk);
+#line 721
size_t nput = ncx_howmany(varp->type, extent);
+#line 721
+#line 721
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 721
RGN_WRITE, &xp);
+#line 721
if(lstatus != NC_NOERR)
+#line 721
return lstatus;
+#line 721
+#line 721
lstatus = ncx_putn_char_char(&xp, nput, value);
+#line 721
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 721
{
+#line 721
/* not fatal to the loop */
+#line 721
status = lstatus;
+#line 721
}
+#line 721
+#line 721
(void) ncio_rel(ncp->nciop, offset,
+#line 721
RGN_MODIFIED);
+#line 721
+#line 721
remaining -= extent;
+#line 721
if(remaining == 0)
+#line 721
break; /* normal loop exit */
+#line 721
offset += extent;
+#line 721
value += nput;
+#line 721
+#line 721
}
+#line 721
+#line 721
return status;
+#line 721
}
+#line 721
static int
+#line 723
putNCvx_schar_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 723
const size_t *start, size_t nelems, const schar *value)
+#line 723
{
+#line 723
off_t offset = NC_varoffset(ncp, varp, start);
+#line 723
size_t remaining = varp->xsz * nelems;
+#line 723
int status = NC_NOERR;
+#line 723
void *xp;
+#line 723
+#line 723
if(nelems == 0)
+#line 723
return NC_NOERR;
+#line 723
+#line 723
assert(value != NULL);
+#line 723
+#line 723
for(;;)
+#line 723
{
+#line 723
size_t extent = MIN(remaining, ncp->chunk);
+#line 723
size_t nput = ncx_howmany(varp->type, extent);
+#line 723
+#line 723
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 723
RGN_WRITE, &xp);
+#line 723
if(lstatus != NC_NOERR)
+#line 723
return lstatus;
+#line 723
+#line 723
lstatus = ncx_putn_schar_schar(&xp, nput, value);
+#line 723
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 723
{
+#line 723
/* not fatal to the loop */
+#line 723
status = lstatus;
+#line 723
}
+#line 723
+#line 723
(void) ncio_rel(ncp->nciop, offset,
+#line 723
RGN_MODIFIED);
+#line 723
+#line 723
remaining -= extent;
+#line 723
if(remaining == 0)
+#line 723
break; /* normal loop exit */
+#line 723
offset += extent;
+#line 723
value += nput;
+#line 723
+#line 723
}
+#line 723
+#line 723
return status;
+#line 723
}
+#line 723
static int
+#line 724
putNCvx_schar_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 724
const size_t *start, size_t nelems, const uchar *value)
+#line 724
{
+#line 724
off_t offset = NC_varoffset(ncp, varp, start);
+#line 724
size_t remaining = varp->xsz * nelems;
+#line 724
int status = NC_NOERR;
+#line 724
void *xp;
+#line 724
+#line 724
if(nelems == 0)
+#line 724
return NC_NOERR;
+#line 724
+#line 724
assert(value != NULL);
+#line 724
+#line 724
for(;;)
+#line 724
{
+#line 724
size_t extent = MIN(remaining, ncp->chunk);
+#line 724
size_t nput = ncx_howmany(varp->type, extent);
+#line 724
+#line 724
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 724
RGN_WRITE, &xp);
+#line 724
if(lstatus != NC_NOERR)
+#line 724
return lstatus;
+#line 724
+#line 724
lstatus = ncx_putn_schar_uchar(&xp, nput, value);
+#line 724
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 724
{
+#line 724
/* not fatal to the loop */
+#line 724
status = lstatus;
+#line 724
}
+#line 724
+#line 724
(void) ncio_rel(ncp->nciop, offset,
+#line 724
RGN_MODIFIED);
+#line 724
+#line 724
remaining -= extent;
+#line 724
if(remaining == 0)
+#line 724
break; /* normal loop exit */
+#line 724
offset += extent;
+#line 724
value += nput;
+#line 724
+#line 724
}
+#line 724
+#line 724
return status;
+#line 724
}
+#line 724
static int
+#line 725
putNCvx_schar_short(NC3_INFO* ncp, const NC_var *varp,
+#line 725
const size_t *start, size_t nelems, const short *value)
+#line 725
{
+#line 725
off_t offset = NC_varoffset(ncp, varp, start);
+#line 725
size_t remaining = varp->xsz * nelems;
+#line 725
int status = NC_NOERR;
+#line 725
void *xp;
+#line 725
+#line 725
if(nelems == 0)
+#line 725
return NC_NOERR;
+#line 725
+#line 725
assert(value != NULL);
+#line 725
+#line 725
for(;;)
+#line 725
{
+#line 725
size_t extent = MIN(remaining, ncp->chunk);
+#line 725
size_t nput = ncx_howmany(varp->type, extent);
+#line 725
+#line 725
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 725
RGN_WRITE, &xp);
+#line 725
if(lstatus != NC_NOERR)
+#line 725
return lstatus;
+#line 725
+#line 725
lstatus = ncx_putn_schar_short(&xp, nput, value);
+#line 725
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 725
{
+#line 725
/* not fatal to the loop */
+#line 725
status = lstatus;
+#line 725
}
+#line 725
+#line 725
(void) ncio_rel(ncp->nciop, offset,
+#line 725
RGN_MODIFIED);
+#line 725
+#line 725
remaining -= extent;
+#line 725
if(remaining == 0)
+#line 725
break; /* normal loop exit */
+#line 725
offset += extent;
+#line 725
value += nput;
+#line 725
+#line 725
}
+#line 725
+#line 725
return status;
+#line 725
}
+#line 725
static int
+#line 726
putNCvx_schar_int(NC3_INFO* ncp, const NC_var *varp,
+#line 726
const size_t *start, size_t nelems, const int *value)
+#line 726
{
+#line 726
off_t offset = NC_varoffset(ncp, varp, start);
+#line 726
size_t remaining = varp->xsz * nelems;
+#line 726
int status = NC_NOERR;
+#line 726
void *xp;
+#line 726
+#line 726
if(nelems == 0)
+#line 726
return NC_NOERR;
+#line 726
+#line 726
assert(value != NULL);
+#line 726
+#line 726
for(;;)
+#line 726
{
+#line 726
size_t extent = MIN(remaining, ncp->chunk);
+#line 726
size_t nput = ncx_howmany(varp->type, extent);
+#line 726
+#line 726
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 726
RGN_WRITE, &xp);
+#line 726
if(lstatus != NC_NOERR)
+#line 726
return lstatus;
+#line 726
+#line 726
lstatus = ncx_putn_schar_int(&xp, nput, value);
+#line 726
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 726
{
+#line 726
/* not fatal to the loop */
+#line 726
status = lstatus;
+#line 726
}
+#line 726
+#line 726
(void) ncio_rel(ncp->nciop, offset,
+#line 726
RGN_MODIFIED);
+#line 726
+#line 726
remaining -= extent;
+#line 726
if(remaining == 0)
+#line 726
break; /* normal loop exit */
+#line 726
offset += extent;
+#line 726
value += nput;
+#line 726
+#line 726
}
+#line 726
+#line 726
return status;
+#line 726
}
+#line 726
static int
+#line 727
putNCvx_schar_float(NC3_INFO* ncp, const NC_var *varp,
+#line 727
const size_t *start, size_t nelems, const float *value)
+#line 727
{
+#line 727
off_t offset = NC_varoffset(ncp, varp, start);
+#line 727
size_t remaining = varp->xsz * nelems;
+#line 727
int status = NC_NOERR;
+#line 727
void *xp;
+#line 727
+#line 727
if(nelems == 0)
+#line 727
return NC_NOERR;
+#line 727
+#line 727
assert(value != NULL);
+#line 727
+#line 727
for(;;)
+#line 727
{
+#line 727
size_t extent = MIN(remaining, ncp->chunk);
+#line 727
size_t nput = ncx_howmany(varp->type, extent);
+#line 727
+#line 727
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 727
RGN_WRITE, &xp);
+#line 727
if(lstatus != NC_NOERR)
+#line 727
return lstatus;
+#line 727
+#line 727
lstatus = ncx_putn_schar_float(&xp, nput, value);
+#line 727
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 727
{
+#line 727
/* not fatal to the loop */
+#line 727
status = lstatus;
+#line 727
}
+#line 727
+#line 727
(void) ncio_rel(ncp->nciop, offset,
+#line 727
RGN_MODIFIED);
+#line 727
+#line 727
remaining -= extent;
+#line 727
if(remaining == 0)
+#line 727
break; /* normal loop exit */
+#line 727
offset += extent;
+#line 727
value += nput;
+#line 727
+#line 727
}
+#line 727
+#line 727
return status;
+#line 727
}
+#line 727
static int
+#line 728
putNCvx_schar_double(NC3_INFO* ncp, const NC_var *varp,
+#line 728
const size_t *start, size_t nelems, const double *value)
+#line 728
{
+#line 728
off_t offset = NC_varoffset(ncp, varp, start);
+#line 728
size_t remaining = varp->xsz * nelems;
+#line 728
int status = NC_NOERR;
+#line 728
void *xp;
+#line 728
+#line 728
if(nelems == 0)
+#line 728
return NC_NOERR;
+#line 728
+#line 728
assert(value != NULL);
+#line 728
+#line 728
for(;;)
+#line 728
{
+#line 728
size_t extent = MIN(remaining, ncp->chunk);
+#line 728
size_t nput = ncx_howmany(varp->type, extent);
+#line 728
+#line 728
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 728
RGN_WRITE, &xp);
+#line 728
if(lstatus != NC_NOERR)
+#line 728
return lstatus;
+#line 728
+#line 728
lstatus = ncx_putn_schar_double(&xp, nput, value);
+#line 728
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 728
{
+#line 728
/* not fatal to the loop */
+#line 728
status = lstatus;
+#line 728
}
+#line 728
+#line 728
(void) ncio_rel(ncp->nciop, offset,
+#line 728
RGN_MODIFIED);
+#line 728
+#line 728
remaining -= extent;
+#line 728
if(remaining == 0)
+#line 728
break; /* normal loop exit */
+#line 728
offset += extent;
+#line 728
value += nput;
+#line 728
+#line 728
}
+#line 728
+#line 728
return status;
+#line 728
}
+#line 728
static int
+#line 729
putNCvx_schar_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 729
const size_t *start, size_t nelems, const longlong *value)
+#line 729
{
+#line 729
off_t offset = NC_varoffset(ncp, varp, start);
+#line 729
size_t remaining = varp->xsz * nelems;
+#line 729
int status = NC_NOERR;
+#line 729
void *xp;
+#line 729
+#line 729
if(nelems == 0)
+#line 729
return NC_NOERR;
+#line 729
+#line 729
assert(value != NULL);
+#line 729
+#line 729
for(;;)
+#line 729
{
+#line 729
size_t extent = MIN(remaining, ncp->chunk);
+#line 729
size_t nput = ncx_howmany(varp->type, extent);
+#line 729
+#line 729
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 729
RGN_WRITE, &xp);
+#line 729
if(lstatus != NC_NOERR)
+#line 729
return lstatus;
+#line 729
+#line 729
lstatus = ncx_putn_schar_longlong(&xp, nput, value);
+#line 729
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 729
{
+#line 729
/* not fatal to the loop */
+#line 729
status = lstatus;
+#line 729
}
+#line 729
+#line 729
(void) ncio_rel(ncp->nciop, offset,
+#line 729
RGN_MODIFIED);
+#line 729
+#line 729
remaining -= extent;
+#line 729
if(remaining == 0)
+#line 729
break; /* normal loop exit */
+#line 729
offset += extent;
+#line 729
value += nput;
+#line 729
+#line 729
}
+#line 729
+#line 729
return status;
+#line 729
}
+#line 729
static int
+#line 730
putNCvx_schar_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 730
const size_t *start, size_t nelems, const ushort *value)
+#line 730
{
+#line 730
off_t offset = NC_varoffset(ncp, varp, start);
+#line 730
size_t remaining = varp->xsz * nelems;
+#line 730
int status = NC_NOERR;
+#line 730
void *xp;
+#line 730
+#line 730
if(nelems == 0)
+#line 730
return NC_NOERR;
+#line 730
+#line 730
assert(value != NULL);
+#line 730
+#line 730
for(;;)
+#line 730
{
+#line 730
size_t extent = MIN(remaining, ncp->chunk);
+#line 730
size_t nput = ncx_howmany(varp->type, extent);
+#line 730
+#line 730
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 730
RGN_WRITE, &xp);
+#line 730
if(lstatus != NC_NOERR)
+#line 730
return lstatus;
+#line 730
+#line 730
lstatus = ncx_putn_schar_ushort(&xp, nput, value);
+#line 730
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 730
{
+#line 730
/* not fatal to the loop */
+#line 730
status = lstatus;
+#line 730
}
+#line 730
+#line 730
(void) ncio_rel(ncp->nciop, offset,
+#line 730
RGN_MODIFIED);
+#line 730
+#line 730
remaining -= extent;
+#line 730
if(remaining == 0)
+#line 730
break; /* normal loop exit */
+#line 730
offset += extent;
+#line 730
value += nput;
+#line 730
+#line 730
}
+#line 730
+#line 730
return status;
+#line 730
}
+#line 730
static int
+#line 731
putNCvx_schar_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 731
const size_t *start, size_t nelems, const uint *value)
+#line 731
{
+#line 731
off_t offset = NC_varoffset(ncp, varp, start);
+#line 731
size_t remaining = varp->xsz * nelems;
+#line 731
int status = NC_NOERR;
+#line 731
void *xp;
+#line 731
+#line 731
if(nelems == 0)
+#line 731
return NC_NOERR;
+#line 731
+#line 731
assert(value != NULL);
+#line 731
+#line 731
for(;;)
+#line 731
{
+#line 731
size_t extent = MIN(remaining, ncp->chunk);
+#line 731
size_t nput = ncx_howmany(varp->type, extent);
+#line 731
+#line 731
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 731
RGN_WRITE, &xp);
+#line 731
if(lstatus != NC_NOERR)
+#line 731
return lstatus;
+#line 731
+#line 731
lstatus = ncx_putn_schar_uint(&xp, nput, value);
+#line 731
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 731
{
+#line 731
/* not fatal to the loop */
+#line 731
status = lstatus;
+#line 731
}
+#line 731
+#line 731
(void) ncio_rel(ncp->nciop, offset,
+#line 731
RGN_MODIFIED);
+#line 731
+#line 731
remaining -= extent;
+#line 731
if(remaining == 0)
+#line 731
break; /* normal loop exit */
+#line 731
offset += extent;
+#line 731
value += nput;
+#line 731
+#line 731
}
+#line 731
+#line 731
return status;
+#line 731
}
+#line 731
static int
+#line 732
putNCvx_schar_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 732
const size_t *start, size_t nelems, const ulonglong *value)
+#line 732
{
+#line 732
off_t offset = NC_varoffset(ncp, varp, start);
+#line 732
size_t remaining = varp->xsz * nelems;
+#line 732
int status = NC_NOERR;
+#line 732
void *xp;
+#line 732
+#line 732
if(nelems == 0)
+#line 732
return NC_NOERR;
+#line 732
+#line 732
assert(value != NULL);
+#line 732
+#line 732
for(;;)
+#line 732
{
+#line 732
size_t extent = MIN(remaining, ncp->chunk);
+#line 732
size_t nput = ncx_howmany(varp->type, extent);
+#line 732
+#line 732
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 732
RGN_WRITE, &xp);
+#line 732
if(lstatus != NC_NOERR)
+#line 732
return lstatus;
+#line 732
+#line 732
lstatus = ncx_putn_schar_ulonglong(&xp, nput, value);
+#line 732
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 732
{
+#line 732
/* not fatal to the loop */
+#line 732
status = lstatus;
+#line 732
}
+#line 732
+#line 732
(void) ncio_rel(ncp->nciop, offset,
+#line 732
RGN_MODIFIED);
+#line 732
+#line 732
remaining -= extent;
+#line 732
if(remaining == 0)
+#line 732
break; /* normal loop exit */
+#line 732
offset += extent;
+#line 732
value += nput;
+#line 732
+#line 732
}
+#line 732
+#line 732
return status;
+#line 732
}
+#line 732
static int
+#line 734
putNCvx_short_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 734
const size_t *start, size_t nelems, const schar *value)
+#line 734
{
+#line 734
off_t offset = NC_varoffset(ncp, varp, start);
+#line 734
size_t remaining = varp->xsz * nelems;
+#line 734
int status = NC_NOERR;
+#line 734
void *xp;
+#line 734
+#line 734
if(nelems == 0)
+#line 734
return NC_NOERR;
+#line 734
+#line 734
assert(value != NULL);
+#line 734
+#line 734
for(;;)
+#line 734
{
+#line 734
size_t extent = MIN(remaining, ncp->chunk);
+#line 734
size_t nput = ncx_howmany(varp->type, extent);
+#line 734
+#line 734
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 734
RGN_WRITE, &xp);
+#line 734
if(lstatus != NC_NOERR)
+#line 734
return lstatus;
+#line 734
+#line 734
lstatus = ncx_putn_short_schar(&xp, nput, value);
+#line 734
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 734
{
+#line 734
/* not fatal to the loop */
+#line 734
status = lstatus;
+#line 734
}
+#line 734
+#line 734
(void) ncio_rel(ncp->nciop, offset,
+#line 734
RGN_MODIFIED);
+#line 734
+#line 734
remaining -= extent;
+#line 734
if(remaining == 0)
+#line 734
break; /* normal loop exit */
+#line 734
offset += extent;
+#line 734
value += nput;
+#line 734
+#line 734
}
+#line 734
+#line 734
return status;
+#line 734
}
+#line 734
static int
+#line 735
putNCvx_short_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 735
const size_t *start, size_t nelems, const uchar *value)
+#line 735
{
+#line 735
off_t offset = NC_varoffset(ncp, varp, start);
+#line 735
size_t remaining = varp->xsz * nelems;
+#line 735
int status = NC_NOERR;
+#line 735
void *xp;
+#line 735
+#line 735
if(nelems == 0)
+#line 735
return NC_NOERR;
+#line 735
+#line 735
assert(value != NULL);
+#line 735
+#line 735
for(;;)
+#line 735
{
+#line 735
size_t extent = MIN(remaining, ncp->chunk);
+#line 735
size_t nput = ncx_howmany(varp->type, extent);
+#line 735
+#line 735
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 735
RGN_WRITE, &xp);
+#line 735
if(lstatus != NC_NOERR)
+#line 735
return lstatus;
+#line 735
+#line 735
lstatus = ncx_putn_short_uchar(&xp, nput, value);
+#line 735
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 735
{
+#line 735
/* not fatal to the loop */
+#line 735
status = lstatus;
+#line 735
}
+#line 735
+#line 735
(void) ncio_rel(ncp->nciop, offset,
+#line 735
RGN_MODIFIED);
+#line 735
+#line 735
remaining -= extent;
+#line 735
if(remaining == 0)
+#line 735
break; /* normal loop exit */
+#line 735
offset += extent;
+#line 735
value += nput;
+#line 735
+#line 735
}
+#line 735
+#line 735
return status;
+#line 735
}
+#line 735
static int
+#line 736
putNCvx_short_short(NC3_INFO* ncp, const NC_var *varp,
+#line 736
const size_t *start, size_t nelems, const short *value)
+#line 736
{
+#line 736
off_t offset = NC_varoffset(ncp, varp, start);
+#line 736
size_t remaining = varp->xsz * nelems;
+#line 736
int status = NC_NOERR;
+#line 736
void *xp;
+#line 736
+#line 736
if(nelems == 0)
+#line 736
return NC_NOERR;
+#line 736
+#line 736
assert(value != NULL);
+#line 736
+#line 736
for(;;)
+#line 736
{
+#line 736
size_t extent = MIN(remaining, ncp->chunk);
+#line 736
size_t nput = ncx_howmany(varp->type, extent);
+#line 736
+#line 736
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 736
RGN_WRITE, &xp);
+#line 736
if(lstatus != NC_NOERR)
+#line 736
return lstatus;
+#line 736
+#line 736
lstatus = ncx_putn_short_short(&xp, nput, value);
+#line 736
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 736
{
+#line 736
/* not fatal to the loop */
+#line 736
status = lstatus;
+#line 736
}
+#line 736
+#line 736
(void) ncio_rel(ncp->nciop, offset,
+#line 736
RGN_MODIFIED);
+#line 736
+#line 736
remaining -= extent;
+#line 736
if(remaining == 0)
+#line 736
break; /* normal loop exit */
+#line 736
offset += extent;
+#line 736
value += nput;
+#line 736
+#line 736
}
+#line 736
+#line 736
return status;
+#line 736
}
+#line 736
static int
+#line 737
putNCvx_short_int(NC3_INFO* ncp, const NC_var *varp,
+#line 737
const size_t *start, size_t nelems, const int *value)
+#line 737
{
+#line 737
off_t offset = NC_varoffset(ncp, varp, start);
+#line 737
size_t remaining = varp->xsz * nelems;
+#line 737
int status = NC_NOERR;
+#line 737
void *xp;
+#line 737
+#line 737
if(nelems == 0)
+#line 737
return NC_NOERR;
+#line 737
+#line 737
assert(value != NULL);
+#line 737
+#line 737
for(;;)
+#line 737
{
+#line 737
size_t extent = MIN(remaining, ncp->chunk);
+#line 737
size_t nput = ncx_howmany(varp->type, extent);
+#line 737
+#line 737
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 737
RGN_WRITE, &xp);
+#line 737
if(lstatus != NC_NOERR)
+#line 737
return lstatus;
+#line 737
+#line 737
lstatus = ncx_putn_short_int(&xp, nput, value);
+#line 737
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 737
{
+#line 737
/* not fatal to the loop */
+#line 737
status = lstatus;
+#line 737
}
+#line 737
+#line 737
(void) ncio_rel(ncp->nciop, offset,
+#line 737
RGN_MODIFIED);
+#line 737
+#line 737
remaining -= extent;
+#line 737
if(remaining == 0)
+#line 737
break; /* normal loop exit */
+#line 737
offset += extent;
+#line 737
value += nput;
+#line 737
+#line 737
}
+#line 737
+#line 737
return status;
+#line 737
}
+#line 737
static int
+#line 738
putNCvx_short_float(NC3_INFO* ncp, const NC_var *varp,
+#line 738
const size_t *start, size_t nelems, const float *value)
+#line 738
{
+#line 738
off_t offset = NC_varoffset(ncp, varp, start);
+#line 738
size_t remaining = varp->xsz * nelems;
+#line 738
int status = NC_NOERR;
+#line 738
void *xp;
+#line 738
+#line 738
if(nelems == 0)
+#line 738
return NC_NOERR;
+#line 738
+#line 738
assert(value != NULL);
+#line 738
+#line 738
for(;;)
+#line 738
{
+#line 738
size_t extent = MIN(remaining, ncp->chunk);
+#line 738
size_t nput = ncx_howmany(varp->type, extent);
+#line 738
+#line 738
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 738
RGN_WRITE, &xp);
+#line 738
if(lstatus != NC_NOERR)
+#line 738
return lstatus;
+#line 738
+#line 738
lstatus = ncx_putn_short_float(&xp, nput, value);
+#line 738
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 738
{
+#line 738
/* not fatal to the loop */
+#line 738
status = lstatus;
+#line 738
}
+#line 738
+#line 738
(void) ncio_rel(ncp->nciop, offset,
+#line 738
RGN_MODIFIED);
+#line 738
+#line 738
remaining -= extent;
+#line 738
if(remaining == 0)
+#line 738
break; /* normal loop exit */
+#line 738
offset += extent;
+#line 738
value += nput;
+#line 738
+#line 738
}
+#line 738
+#line 738
return status;
+#line 738
}
+#line 738
static int
+#line 739
putNCvx_short_double(NC3_INFO* ncp, const NC_var *varp,
+#line 739
const size_t *start, size_t nelems, const double *value)
+#line 739
{
+#line 739
off_t offset = NC_varoffset(ncp, varp, start);
+#line 739
size_t remaining = varp->xsz * nelems;
+#line 739
int status = NC_NOERR;
+#line 739
void *xp;
+#line 739
+#line 739
if(nelems == 0)
+#line 739
return NC_NOERR;
+#line 739
+#line 739
assert(value != NULL);
+#line 739
+#line 739
for(;;)
+#line 739
{
+#line 739
size_t extent = MIN(remaining, ncp->chunk);
+#line 739
size_t nput = ncx_howmany(varp->type, extent);
+#line 739
+#line 739
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 739
RGN_WRITE, &xp);
+#line 739
if(lstatus != NC_NOERR)
+#line 739
return lstatus;
+#line 739
+#line 739
lstatus = ncx_putn_short_double(&xp, nput, value);
+#line 739
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 739
{
+#line 739
/* not fatal to the loop */
+#line 739
status = lstatus;
+#line 739
}
+#line 739
+#line 739
(void) ncio_rel(ncp->nciop, offset,
+#line 739
RGN_MODIFIED);
+#line 739
+#line 739
remaining -= extent;
+#line 739
if(remaining == 0)
+#line 739
break; /* normal loop exit */
+#line 739
offset += extent;
+#line 739
value += nput;
+#line 739
+#line 739
}
+#line 739
+#line 739
return status;
+#line 739
}
+#line 739
static int
+#line 740
putNCvx_short_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 740
const size_t *start, size_t nelems, const longlong *value)
+#line 740
{
+#line 740
off_t offset = NC_varoffset(ncp, varp, start);
+#line 740
size_t remaining = varp->xsz * nelems;
+#line 740
int status = NC_NOERR;
+#line 740
void *xp;
+#line 740
+#line 740
if(nelems == 0)
+#line 740
return NC_NOERR;
+#line 740
+#line 740
assert(value != NULL);
+#line 740
+#line 740
for(;;)
+#line 740
{
+#line 740
size_t extent = MIN(remaining, ncp->chunk);
+#line 740
size_t nput = ncx_howmany(varp->type, extent);
+#line 740
+#line 740
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 740
RGN_WRITE, &xp);
+#line 740
if(lstatus != NC_NOERR)
+#line 740
return lstatus;
+#line 740
+#line 740
lstatus = ncx_putn_short_longlong(&xp, nput, value);
+#line 740
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 740
{
+#line 740
/* not fatal to the loop */
+#line 740
status = lstatus;
+#line 740
}
+#line 740
+#line 740
(void) ncio_rel(ncp->nciop, offset,
+#line 740
RGN_MODIFIED);
+#line 740
+#line 740
remaining -= extent;
+#line 740
if(remaining == 0)
+#line 740
break; /* normal loop exit */
+#line 740
offset += extent;
+#line 740
value += nput;
+#line 740
+#line 740
}
+#line 740
+#line 740
return status;
+#line 740
}
+#line 740
static int
+#line 741
putNCvx_short_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 741
const size_t *start, size_t nelems, const ushort *value)
+#line 741
{
+#line 741
off_t offset = NC_varoffset(ncp, varp, start);
+#line 741
size_t remaining = varp->xsz * nelems;
+#line 741
int status = NC_NOERR;
+#line 741
void *xp;
+#line 741
+#line 741
if(nelems == 0)
+#line 741
return NC_NOERR;
+#line 741
+#line 741
assert(value != NULL);
+#line 741
+#line 741
for(;;)
+#line 741
{
+#line 741
size_t extent = MIN(remaining, ncp->chunk);
+#line 741
size_t nput = ncx_howmany(varp->type, extent);
+#line 741
+#line 741
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 741
RGN_WRITE, &xp);
+#line 741
if(lstatus != NC_NOERR)
+#line 741
return lstatus;
+#line 741
+#line 741
lstatus = ncx_putn_short_ushort(&xp, nput, value);
+#line 741
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 741
{
+#line 741
/* not fatal to the loop */
+#line 741
status = lstatus;
+#line 741
}
+#line 741
+#line 741
(void) ncio_rel(ncp->nciop, offset,
+#line 741
RGN_MODIFIED);
+#line 741
+#line 741
remaining -= extent;
+#line 741
if(remaining == 0)
+#line 741
break; /* normal loop exit */
+#line 741
offset += extent;
+#line 741
value += nput;
+#line 741
+#line 741
}
+#line 741
+#line 741
return status;
+#line 741
}
+#line 741
static int
+#line 742
putNCvx_short_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 742
const size_t *start, size_t nelems, const uint *value)
+#line 742
{
+#line 742
off_t offset = NC_varoffset(ncp, varp, start);
+#line 742
size_t remaining = varp->xsz * nelems;
+#line 742
int status = NC_NOERR;
+#line 742
void *xp;
+#line 742
+#line 742
if(nelems == 0)
+#line 742
return NC_NOERR;
+#line 742
+#line 742
assert(value != NULL);
+#line 742
+#line 742
for(;;)
+#line 742
{
+#line 742
size_t extent = MIN(remaining, ncp->chunk);
+#line 742
size_t nput = ncx_howmany(varp->type, extent);
+#line 742
+#line 742
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 742
RGN_WRITE, &xp);
+#line 742
if(lstatus != NC_NOERR)
+#line 742
return lstatus;
+#line 742
+#line 742
lstatus = ncx_putn_short_uint(&xp, nput, value);
+#line 742
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 742
{
+#line 742
/* not fatal to the loop */
+#line 742
status = lstatus;
+#line 742
}
+#line 742
+#line 742
(void) ncio_rel(ncp->nciop, offset,
+#line 742
RGN_MODIFIED);
+#line 742
+#line 742
remaining -= extent;
+#line 742
if(remaining == 0)
+#line 742
break; /* normal loop exit */
+#line 742
offset += extent;
+#line 742
value += nput;
+#line 742
+#line 742
}
+#line 742
+#line 742
return status;
+#line 742
}
+#line 742
static int
+#line 743
putNCvx_short_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 743
const size_t *start, size_t nelems, const ulonglong *value)
+#line 743
{
+#line 743
off_t offset = NC_varoffset(ncp, varp, start);
+#line 743
size_t remaining = varp->xsz * nelems;
+#line 743
int status = NC_NOERR;
+#line 743
void *xp;
+#line 743
+#line 743
if(nelems == 0)
+#line 743
return NC_NOERR;
+#line 743
+#line 743
assert(value != NULL);
+#line 743
+#line 743
for(;;)
+#line 743
{
+#line 743
size_t extent = MIN(remaining, ncp->chunk);
+#line 743
size_t nput = ncx_howmany(varp->type, extent);
+#line 743
+#line 743
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 743
RGN_WRITE, &xp);
+#line 743
if(lstatus != NC_NOERR)
+#line 743
return lstatus;
+#line 743
+#line 743
lstatus = ncx_putn_short_ulonglong(&xp, nput, value);
+#line 743
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 743
{
+#line 743
/* not fatal to the loop */
+#line 743
status = lstatus;
+#line 743
}
+#line 743
+#line 743
(void) ncio_rel(ncp->nciop, offset,
+#line 743
RGN_MODIFIED);
+#line 743
+#line 743
remaining -= extent;
+#line 743
if(remaining == 0)
+#line 743
break; /* normal loop exit */
+#line 743
offset += extent;
+#line 743
value += nput;
+#line 743
+#line 743
}
+#line 743
+#line 743
return status;
+#line 743
}
+#line 743
static int
+#line 745
putNCvx_int_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 745
const size_t *start, size_t nelems, const schar *value)
+#line 745
{
+#line 745
off_t offset = NC_varoffset(ncp, varp, start);
+#line 745
size_t remaining = varp->xsz * nelems;
+#line 745
int status = NC_NOERR;
+#line 745
void *xp;
+#line 745
+#line 745
if(nelems == 0)
+#line 745
return NC_NOERR;
+#line 745
+#line 745
assert(value != NULL);
+#line 745
+#line 745
for(;;)
+#line 745
{
+#line 745
size_t extent = MIN(remaining, ncp->chunk);
+#line 745
size_t nput = ncx_howmany(varp->type, extent);
+#line 745
+#line 745
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 745
RGN_WRITE, &xp);
+#line 745
if(lstatus != NC_NOERR)
+#line 745
return lstatus;
+#line 745
+#line 745
lstatus = ncx_putn_int_schar(&xp, nput, value);
+#line 745
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 745
{
+#line 745
/* not fatal to the loop */
+#line 745
status = lstatus;
+#line 745
}
+#line 745
+#line 745
(void) ncio_rel(ncp->nciop, offset,
+#line 745
RGN_MODIFIED);
+#line 745
+#line 745
remaining -= extent;
+#line 745
if(remaining == 0)
+#line 745
break; /* normal loop exit */
+#line 745
offset += extent;
+#line 745
value += nput;
+#line 745
+#line 745
}
+#line 745
+#line 745
return status;
+#line 745
}
+#line 745
static int
+#line 746
putNCvx_int_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 746
const size_t *start, size_t nelems, const uchar *value)
+#line 746
{
+#line 746
off_t offset = NC_varoffset(ncp, varp, start);
+#line 746
size_t remaining = varp->xsz * nelems;
+#line 746
int status = NC_NOERR;
+#line 746
void *xp;
+#line 746
+#line 746
if(nelems == 0)
+#line 746
return NC_NOERR;
+#line 746
+#line 746
assert(value != NULL);
+#line 746
+#line 746
for(;;)
+#line 746
{
+#line 746
size_t extent = MIN(remaining, ncp->chunk);
+#line 746
size_t nput = ncx_howmany(varp->type, extent);
+#line 746
+#line 746
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 746
RGN_WRITE, &xp);
+#line 746
if(lstatus != NC_NOERR)
+#line 746
return lstatus;
+#line 746
+#line 746
lstatus = ncx_putn_int_uchar(&xp, nput, value);
+#line 746
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 746
{
+#line 746
/* not fatal to the loop */
+#line 746
status = lstatus;
+#line 746
}
+#line 746
+#line 746
(void) ncio_rel(ncp->nciop, offset,
+#line 746
RGN_MODIFIED);
+#line 746
+#line 746
remaining -= extent;
+#line 746
if(remaining == 0)
+#line 746
break; /* normal loop exit */
+#line 746
offset += extent;
+#line 746
value += nput;
+#line 746
+#line 746
}
+#line 746
+#line 746
return status;
+#line 746
}
+#line 746
static int
+#line 747
putNCvx_int_short(NC3_INFO* ncp, const NC_var *varp,
+#line 747
const size_t *start, size_t nelems, const short *value)
+#line 747
{
+#line 747
off_t offset = NC_varoffset(ncp, varp, start);
+#line 747
size_t remaining = varp->xsz * nelems;
+#line 747
int status = NC_NOERR;
+#line 747
void *xp;
+#line 747
+#line 747
if(nelems == 0)
+#line 747
return NC_NOERR;
+#line 747
+#line 747
assert(value != NULL);
+#line 747
+#line 747
for(;;)
+#line 747
{
+#line 747
size_t extent = MIN(remaining, ncp->chunk);
+#line 747
size_t nput = ncx_howmany(varp->type, extent);
+#line 747
+#line 747
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 747
RGN_WRITE, &xp);
+#line 747
if(lstatus != NC_NOERR)
+#line 747
return lstatus;
+#line 747
+#line 747
lstatus = ncx_putn_int_short(&xp, nput, value);
+#line 747
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 747
{
+#line 747
/* not fatal to the loop */
+#line 747
status = lstatus;
+#line 747
}
+#line 747
+#line 747
(void) ncio_rel(ncp->nciop, offset,
+#line 747
RGN_MODIFIED);
+#line 747
+#line 747
remaining -= extent;
+#line 747
if(remaining == 0)
+#line 747
break; /* normal loop exit */
+#line 747
offset += extent;
+#line 747
value += nput;
+#line 747
+#line 747
}
+#line 747
+#line 747
return status;
+#line 747
}
+#line 747
static int
+#line 748
putNCvx_int_int(NC3_INFO* ncp, const NC_var *varp,
+#line 748
const size_t *start, size_t nelems, const int *value)
+#line 748
{
+#line 748
off_t offset = NC_varoffset(ncp, varp, start);
+#line 748
size_t remaining = varp->xsz * nelems;
+#line 748
int status = NC_NOERR;
+#line 748
void *xp;
+#line 748
+#line 748
if(nelems == 0)
+#line 748
return NC_NOERR;
+#line 748
+#line 748
assert(value != NULL);
+#line 748
+#line 748
for(;;)
+#line 748
{
+#line 748
size_t extent = MIN(remaining, ncp->chunk);
+#line 748
size_t nput = ncx_howmany(varp->type, extent);
+#line 748
+#line 748
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 748
RGN_WRITE, &xp);
+#line 748
if(lstatus != NC_NOERR)
+#line 748
return lstatus;
+#line 748
+#line 748
lstatus = ncx_putn_int_int(&xp, nput, value);
+#line 748
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 748
{
+#line 748
/* not fatal to the loop */
+#line 748
status = lstatus;
+#line 748
}
+#line 748
+#line 748
(void) ncio_rel(ncp->nciop, offset,
+#line 748
RGN_MODIFIED);
+#line 748
+#line 748
remaining -= extent;
+#line 748
if(remaining == 0)
+#line 748
break; /* normal loop exit */
+#line 748
offset += extent;
+#line 748
value += nput;
+#line 748
+#line 748
}
+#line 748
+#line 748
return status;
+#line 748
}
+#line 748
static int
+#line 749
putNCvx_int_float(NC3_INFO* ncp, const NC_var *varp,
+#line 749
const size_t *start, size_t nelems, const float *value)
+#line 749
{
+#line 749
off_t offset = NC_varoffset(ncp, varp, start);
+#line 749
size_t remaining = varp->xsz * nelems;
+#line 749
int status = NC_NOERR;
+#line 749
void *xp;
+#line 749
+#line 749
if(nelems == 0)
+#line 749
return NC_NOERR;
+#line 749
+#line 749
assert(value != NULL);
+#line 749
+#line 749
for(;;)
+#line 749
{
+#line 749
size_t extent = MIN(remaining, ncp->chunk);
+#line 749
size_t nput = ncx_howmany(varp->type, extent);
+#line 749
+#line 749
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 749
RGN_WRITE, &xp);
+#line 749
if(lstatus != NC_NOERR)
+#line 749
return lstatus;
+#line 749
+#line 749
lstatus = ncx_putn_int_float(&xp, nput, value);
+#line 749
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 749
{
+#line 749
/* not fatal to the loop */
+#line 749
status = lstatus;
+#line 749
}
+#line 749
+#line 749
(void) ncio_rel(ncp->nciop, offset,
+#line 749
RGN_MODIFIED);
+#line 749
+#line 749
remaining -= extent;
+#line 749
if(remaining == 0)
+#line 749
break; /* normal loop exit */
+#line 749
offset += extent;
+#line 749
value += nput;
+#line 749
+#line 749
}
+#line 749
+#line 749
return status;
+#line 749
}
+#line 749
static int
+#line 750
putNCvx_int_double(NC3_INFO* ncp, const NC_var *varp,
+#line 750
const size_t *start, size_t nelems, const double *value)
+#line 750
{
+#line 750
off_t offset = NC_varoffset(ncp, varp, start);
+#line 750
size_t remaining = varp->xsz * nelems;
+#line 750
int status = NC_NOERR;
+#line 750
void *xp;
+#line 750
+#line 750
if(nelems == 0)
+#line 750
return NC_NOERR;
+#line 750
+#line 750
assert(value != NULL);
+#line 750
+#line 750
for(;;)
+#line 750
{
+#line 750
size_t extent = MIN(remaining, ncp->chunk);
+#line 750
size_t nput = ncx_howmany(varp->type, extent);
+#line 750
+#line 750
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 750
RGN_WRITE, &xp);
+#line 750
if(lstatus != NC_NOERR)
+#line 750
return lstatus;
+#line 750
+#line 750
lstatus = ncx_putn_int_double(&xp, nput, value);
+#line 750
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 750
{
+#line 750
/* not fatal to the loop */
+#line 750
status = lstatus;
+#line 750
}
+#line 750
+#line 750
(void) ncio_rel(ncp->nciop, offset,
+#line 750
RGN_MODIFIED);
+#line 750
+#line 750
remaining -= extent;
+#line 750
if(remaining == 0)
+#line 750
break; /* normal loop exit */
+#line 750
offset += extent;
+#line 750
value += nput;
+#line 750
+#line 750
}
+#line 750
+#line 750
return status;
+#line 750
}
+#line 750
static int
+#line 751
putNCvx_int_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 751
const size_t *start, size_t nelems, const longlong *value)
+#line 751
{
+#line 751
off_t offset = NC_varoffset(ncp, varp, start);
+#line 751
size_t remaining = varp->xsz * nelems;
+#line 751
int status = NC_NOERR;
+#line 751
void *xp;
+#line 751
+#line 751
if(nelems == 0)
+#line 751
return NC_NOERR;
+#line 751
+#line 751
assert(value != NULL);
+#line 751
+#line 751
for(;;)
+#line 751
{
+#line 751
size_t extent = MIN(remaining, ncp->chunk);
+#line 751
size_t nput = ncx_howmany(varp->type, extent);
+#line 751
+#line 751
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 751
RGN_WRITE, &xp);
+#line 751
if(lstatus != NC_NOERR)
+#line 751
return lstatus;
+#line 751
+#line 751
lstatus = ncx_putn_int_longlong(&xp, nput, value);
+#line 751
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 751
{
+#line 751
/* not fatal to the loop */
+#line 751
status = lstatus;
+#line 751
}
+#line 751
+#line 751
(void) ncio_rel(ncp->nciop, offset,
+#line 751
RGN_MODIFIED);
+#line 751
+#line 751
remaining -= extent;
+#line 751
if(remaining == 0)
+#line 751
break; /* normal loop exit */
+#line 751
offset += extent;
+#line 751
value += nput;
+#line 751
+#line 751
}
+#line 751
+#line 751
return status;
+#line 751
}
+#line 751
static int
+#line 752
putNCvx_int_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 752
const size_t *start, size_t nelems, const ushort *value)
+#line 752
{
+#line 752
off_t offset = NC_varoffset(ncp, varp, start);
+#line 752
size_t remaining = varp->xsz * nelems;
+#line 752
int status = NC_NOERR;
+#line 752
void *xp;
+#line 752
+#line 752
if(nelems == 0)
+#line 752
return NC_NOERR;
+#line 752
+#line 752
assert(value != NULL);
+#line 752
+#line 752
for(;;)
+#line 752
{
+#line 752
size_t extent = MIN(remaining, ncp->chunk);
+#line 752
size_t nput = ncx_howmany(varp->type, extent);
+#line 752
+#line 752
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 752
RGN_WRITE, &xp);
+#line 752
if(lstatus != NC_NOERR)
+#line 752
return lstatus;
+#line 752
+#line 752
lstatus = ncx_putn_int_ushort(&xp, nput, value);
+#line 752
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 752
{
+#line 752
/* not fatal to the loop */
+#line 752
status = lstatus;
+#line 752
}
+#line 752
+#line 752
(void) ncio_rel(ncp->nciop, offset,
+#line 752
RGN_MODIFIED);
+#line 752
+#line 752
remaining -= extent;
+#line 752
if(remaining == 0)
+#line 752
break; /* normal loop exit */
+#line 752
offset += extent;
+#line 752
value += nput;
+#line 752
+#line 752
}
+#line 752
+#line 752
return status;
+#line 752
}
+#line 752
static int
+#line 753
putNCvx_int_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 753
const size_t *start, size_t nelems, const uint *value)
+#line 753
{
+#line 753
off_t offset = NC_varoffset(ncp, varp, start);
+#line 753
size_t remaining = varp->xsz * nelems;
+#line 753
int status = NC_NOERR;
+#line 753
void *xp;
+#line 753
+#line 753
if(nelems == 0)
+#line 753
return NC_NOERR;
+#line 753
+#line 753
assert(value != NULL);
+#line 753
+#line 753
for(;;)
+#line 753
{
+#line 753
size_t extent = MIN(remaining, ncp->chunk);
+#line 753
size_t nput = ncx_howmany(varp->type, extent);
+#line 753
+#line 753
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 753
RGN_WRITE, &xp);
+#line 753
if(lstatus != NC_NOERR)
+#line 753
return lstatus;
+#line 753
+#line 753
lstatus = ncx_putn_int_uint(&xp, nput, value);
+#line 753
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 753
{
+#line 753
/* not fatal to the loop */
+#line 753
status = lstatus;
+#line 753
}
+#line 753
+#line 753
(void) ncio_rel(ncp->nciop, offset,
+#line 753
RGN_MODIFIED);
+#line 753
+#line 753
remaining -= extent;
+#line 753
if(remaining == 0)
+#line 753
break; /* normal loop exit */
+#line 753
offset += extent;
+#line 753
value += nput;
+#line 753
+#line 753
}
+#line 753
+#line 753
return status;
+#line 753
}
+#line 753
static int
+#line 754
putNCvx_int_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 754
const size_t *start, size_t nelems, const ulonglong *value)
+#line 754
{
+#line 754
off_t offset = NC_varoffset(ncp, varp, start);
+#line 754
size_t remaining = varp->xsz * nelems;
+#line 754
int status = NC_NOERR;
+#line 754
void *xp;
+#line 754
+#line 754
if(nelems == 0)
+#line 754
return NC_NOERR;
+#line 754
+#line 754
assert(value != NULL);
+#line 754
+#line 754
for(;;)
+#line 754
{
+#line 754
size_t extent = MIN(remaining, ncp->chunk);
+#line 754
size_t nput = ncx_howmany(varp->type, extent);
+#line 754
+#line 754
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 754
RGN_WRITE, &xp);
+#line 754
if(lstatus != NC_NOERR)
+#line 754
return lstatus;
+#line 754
+#line 754
lstatus = ncx_putn_int_ulonglong(&xp, nput, value);
+#line 754
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 754
{
+#line 754
/* not fatal to the loop */
+#line 754
status = lstatus;
+#line 754
}
+#line 754
+#line 754
(void) ncio_rel(ncp->nciop, offset,
+#line 754
RGN_MODIFIED);
+#line 754
+#line 754
remaining -= extent;
+#line 754
if(remaining == 0)
+#line 754
break; /* normal loop exit */
+#line 754
offset += extent;
+#line 754
value += nput;
+#line 754
+#line 754
}
+#line 754
+#line 754
return status;
+#line 754
}
+#line 754
static int
+#line 756
putNCvx_float_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 756
const size_t *start, size_t nelems, const schar *value)
+#line 756
{
+#line 756
off_t offset = NC_varoffset(ncp, varp, start);
+#line 756
size_t remaining = varp->xsz * nelems;
+#line 756
int status = NC_NOERR;
+#line 756
void *xp;
+#line 756
+#line 756
if(nelems == 0)
+#line 756
return NC_NOERR;
+#line 756
+#line 756
assert(value != NULL);
+#line 756
+#line 756
for(;;)
+#line 756
{
+#line 756
size_t extent = MIN(remaining, ncp->chunk);
+#line 756
size_t nput = ncx_howmany(varp->type, extent);
+#line 756
+#line 756
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 756
RGN_WRITE, &xp);
+#line 756
if(lstatus != NC_NOERR)
+#line 756
return lstatus;
+#line 756
+#line 756
lstatus = ncx_putn_float_schar(&xp, nput, value);
+#line 756
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 756
{
+#line 756
/* not fatal to the loop */
+#line 756
status = lstatus;
+#line 756
}
+#line 756
+#line 756
(void) ncio_rel(ncp->nciop, offset,
+#line 756
RGN_MODIFIED);
+#line 756
+#line 756
remaining -= extent;
+#line 756
if(remaining == 0)
+#line 756
break; /* normal loop exit */
+#line 756
offset += extent;
+#line 756
value += nput;
+#line 756
+#line 756
}
+#line 756
+#line 756
return status;
+#line 756
}
+#line 756
static int
+#line 757
putNCvx_float_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 757
const size_t *start, size_t nelems, const uchar *value)
+#line 757
{
+#line 757
off_t offset = NC_varoffset(ncp, varp, start);
+#line 757
size_t remaining = varp->xsz * nelems;
+#line 757
int status = NC_NOERR;
+#line 757
void *xp;
+#line 757
+#line 757
if(nelems == 0)
+#line 757
return NC_NOERR;
+#line 757
+#line 757
assert(value != NULL);
+#line 757
+#line 757
for(;;)
+#line 757
{
+#line 757
size_t extent = MIN(remaining, ncp->chunk);
+#line 757
size_t nput = ncx_howmany(varp->type, extent);
+#line 757
+#line 757
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 757
RGN_WRITE, &xp);
+#line 757
if(lstatus != NC_NOERR)
+#line 757
return lstatus;
+#line 757
+#line 757
lstatus = ncx_putn_float_uchar(&xp, nput, value);
+#line 757
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 757
{
+#line 757
/* not fatal to the loop */
+#line 757
status = lstatus;
+#line 757
}
+#line 757
+#line 757
(void) ncio_rel(ncp->nciop, offset,
+#line 757
RGN_MODIFIED);
+#line 757
+#line 757
remaining -= extent;
+#line 757
if(remaining == 0)
+#line 757
break; /* normal loop exit */
+#line 757
offset += extent;
+#line 757
value += nput;
+#line 757
+#line 757
}
+#line 757
+#line 757
return status;
+#line 757
}
+#line 757
static int
+#line 758
putNCvx_float_short(NC3_INFO* ncp, const NC_var *varp,
+#line 758
const size_t *start, size_t nelems, const short *value)
+#line 758
{
+#line 758
off_t offset = NC_varoffset(ncp, varp, start);
+#line 758
size_t remaining = varp->xsz * nelems;
+#line 758
int status = NC_NOERR;
+#line 758
void *xp;
+#line 758
+#line 758
if(nelems == 0)
+#line 758
return NC_NOERR;
+#line 758
+#line 758
assert(value != NULL);
+#line 758
+#line 758
for(;;)
+#line 758
{
+#line 758
size_t extent = MIN(remaining, ncp->chunk);
+#line 758
size_t nput = ncx_howmany(varp->type, extent);
+#line 758
+#line 758
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 758
RGN_WRITE, &xp);
+#line 758
if(lstatus != NC_NOERR)
+#line 758
return lstatus;
+#line 758
+#line 758
lstatus = ncx_putn_float_short(&xp, nput, value);
+#line 758
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 758
{
+#line 758
/* not fatal to the loop */
+#line 758
status = lstatus;
+#line 758
}
+#line 758
+#line 758
(void) ncio_rel(ncp->nciop, offset,
+#line 758
RGN_MODIFIED);
+#line 758
+#line 758
remaining -= extent;
+#line 758
if(remaining == 0)
+#line 758
break; /* normal loop exit */
+#line 758
offset += extent;
+#line 758
value += nput;
+#line 758
+#line 758
}
+#line 758
+#line 758
return status;
+#line 758
}
+#line 758
static int
+#line 759
putNCvx_float_int(NC3_INFO* ncp, const NC_var *varp,
+#line 759
const size_t *start, size_t nelems, const int *value)
+#line 759
{
+#line 759
off_t offset = NC_varoffset(ncp, varp, start);
+#line 759
size_t remaining = varp->xsz * nelems;
+#line 759
int status = NC_NOERR;
+#line 759
void *xp;
+#line 759
+#line 759
if(nelems == 0)
+#line 759
return NC_NOERR;
+#line 759
+#line 759
assert(value != NULL);
+#line 759
+#line 759
for(;;)
+#line 759
{
+#line 759
size_t extent = MIN(remaining, ncp->chunk);
+#line 759
size_t nput = ncx_howmany(varp->type, extent);
+#line 759
+#line 759
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 759
RGN_WRITE, &xp);
+#line 759
if(lstatus != NC_NOERR)
+#line 759
return lstatus;
+#line 759
+#line 759
lstatus = ncx_putn_float_int(&xp, nput, value);
+#line 759
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 759
{
+#line 759
/* not fatal to the loop */
+#line 759
status = lstatus;
+#line 759
}
+#line 759
+#line 759
(void) ncio_rel(ncp->nciop, offset,
+#line 759
RGN_MODIFIED);
+#line 759
+#line 759
remaining -= extent;
+#line 759
if(remaining == 0)
+#line 759
break; /* normal loop exit */
+#line 759
offset += extent;
+#line 759
value += nput;
+#line 759
+#line 759
}
+#line 759
+#line 759
return status;
+#line 759
}
+#line 759
static int
+#line 760
putNCvx_float_float(NC3_INFO* ncp, const NC_var *varp,
+#line 760
const size_t *start, size_t nelems, const float *value)
+#line 760
{
+#line 760
off_t offset = NC_varoffset(ncp, varp, start);
+#line 760
size_t remaining = varp->xsz * nelems;
+#line 760
int status = NC_NOERR;
+#line 760
void *xp;
+#line 760
+#line 760
if(nelems == 0)
+#line 760
return NC_NOERR;
+#line 760
+#line 760
assert(value != NULL);
+#line 760
+#line 760
for(;;)
+#line 760
{
+#line 760
size_t extent = MIN(remaining, ncp->chunk);
+#line 760
size_t nput = ncx_howmany(varp->type, extent);
+#line 760
+#line 760
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 760
RGN_WRITE, &xp);
+#line 760
if(lstatus != NC_NOERR)
+#line 760
return lstatus;
+#line 760
+#line 760
lstatus = ncx_putn_float_float(&xp, nput, value);
+#line 760
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 760
{
+#line 760
/* not fatal to the loop */
+#line 760
status = lstatus;
+#line 760
}
+#line 760
+#line 760
(void) ncio_rel(ncp->nciop, offset,
+#line 760
RGN_MODIFIED);
+#line 760
+#line 760
remaining -= extent;
+#line 760
if(remaining == 0)
+#line 760
break; /* normal loop exit */
+#line 760
offset += extent;
+#line 760
value += nput;
+#line 760
+#line 760
}
+#line 760
+#line 760
return status;
+#line 760
}
+#line 760
static int
+#line 761
putNCvx_float_double(NC3_INFO* ncp, const NC_var *varp,
+#line 761
const size_t *start, size_t nelems, const double *value)
+#line 761
{
+#line 761
off_t offset = NC_varoffset(ncp, varp, start);
+#line 761
size_t remaining = varp->xsz * nelems;
+#line 761
int status = NC_NOERR;
+#line 761
void *xp;
+#line 761
+#line 761
if(nelems == 0)
+#line 761
return NC_NOERR;
+#line 761
+#line 761
assert(value != NULL);
+#line 761
+#line 761
for(;;)
+#line 761
{
+#line 761
size_t extent = MIN(remaining, ncp->chunk);
+#line 761
size_t nput = ncx_howmany(varp->type, extent);
+#line 761
+#line 761
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 761
RGN_WRITE, &xp);
+#line 761
if(lstatus != NC_NOERR)
+#line 761
return lstatus;
+#line 761
+#line 761
lstatus = ncx_putn_float_double(&xp, nput, value);
+#line 761
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 761
{
+#line 761
/* not fatal to the loop */
+#line 761
status = lstatus;
+#line 761
}
+#line 761
+#line 761
(void) ncio_rel(ncp->nciop, offset,
+#line 761
RGN_MODIFIED);
+#line 761
+#line 761
remaining -= extent;
+#line 761
if(remaining == 0)
+#line 761
break; /* normal loop exit */
+#line 761
offset += extent;
+#line 761
value += nput;
+#line 761
+#line 761
}
+#line 761
+#line 761
return status;
+#line 761
}
+#line 761
static int
+#line 762
putNCvx_float_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 762
const size_t *start, size_t nelems, const longlong *value)
+#line 762
{
+#line 762
off_t offset = NC_varoffset(ncp, varp, start);
+#line 762
size_t remaining = varp->xsz * nelems;
+#line 762
int status = NC_NOERR;
+#line 762
void *xp;
+#line 762
+#line 762
if(nelems == 0)
+#line 762
return NC_NOERR;
+#line 762
+#line 762
assert(value != NULL);
+#line 762
+#line 762
for(;;)
+#line 762
{
+#line 762
size_t extent = MIN(remaining, ncp->chunk);
+#line 762
size_t nput = ncx_howmany(varp->type, extent);
+#line 762
+#line 762
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 762
RGN_WRITE, &xp);
+#line 762
if(lstatus != NC_NOERR)
+#line 762
return lstatus;
+#line 762
+#line 762
lstatus = ncx_putn_float_longlong(&xp, nput, value);
+#line 762
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 762
{
+#line 762
/* not fatal to the loop */
+#line 762
status = lstatus;
+#line 762
}
+#line 762
+#line 762
(void) ncio_rel(ncp->nciop, offset,
+#line 762
RGN_MODIFIED);
+#line 762
+#line 762
remaining -= extent;
+#line 762
if(remaining == 0)
+#line 762
break; /* normal loop exit */
+#line 762
offset += extent;
+#line 762
value += nput;
+#line 762
+#line 762
}
+#line 762
+#line 762
return status;
+#line 762
}
+#line 762
static int
+#line 763
putNCvx_float_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 763
const size_t *start, size_t nelems, const ushort *value)
+#line 763
{
+#line 763
off_t offset = NC_varoffset(ncp, varp, start);
+#line 763
size_t remaining = varp->xsz * nelems;
+#line 763
int status = NC_NOERR;
+#line 763
void *xp;
+#line 763
+#line 763
if(nelems == 0)
+#line 763
return NC_NOERR;
+#line 763
+#line 763
assert(value != NULL);
+#line 763
+#line 763
for(;;)
+#line 763
{
+#line 763
size_t extent = MIN(remaining, ncp->chunk);
+#line 763
size_t nput = ncx_howmany(varp->type, extent);
+#line 763
+#line 763
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 763
RGN_WRITE, &xp);
+#line 763
if(lstatus != NC_NOERR)
+#line 763
return lstatus;
+#line 763
+#line 763
lstatus = ncx_putn_float_ushort(&xp, nput, value);
+#line 763
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 763
{
+#line 763
/* not fatal to the loop */
+#line 763
status = lstatus;
+#line 763
}
+#line 763
+#line 763
(void) ncio_rel(ncp->nciop, offset,
+#line 763
RGN_MODIFIED);
+#line 763
+#line 763
remaining -= extent;
+#line 763
if(remaining == 0)
+#line 763
break; /* normal loop exit */
+#line 763
offset += extent;
+#line 763
value += nput;
+#line 763
+#line 763
}
+#line 763
+#line 763
return status;
+#line 763
}
+#line 763
static int
+#line 764
putNCvx_float_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 764
const size_t *start, size_t nelems, const uint *value)
+#line 764
{
+#line 764
off_t offset = NC_varoffset(ncp, varp, start);
+#line 764
size_t remaining = varp->xsz * nelems;
+#line 764
int status = NC_NOERR;
+#line 764
void *xp;
+#line 764
+#line 764
if(nelems == 0)
+#line 764
return NC_NOERR;
+#line 764
+#line 764
assert(value != NULL);
+#line 764
+#line 764
for(;;)
+#line 764
{
+#line 764
size_t extent = MIN(remaining, ncp->chunk);
+#line 764
size_t nput = ncx_howmany(varp->type, extent);
+#line 764
+#line 764
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 764
RGN_WRITE, &xp);
+#line 764
if(lstatus != NC_NOERR)
+#line 764
return lstatus;
+#line 764
+#line 764
lstatus = ncx_putn_float_uint(&xp, nput, value);
+#line 764
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 764
{
+#line 764
/* not fatal to the loop */
+#line 764
status = lstatus;
+#line 764
}
+#line 764
+#line 764
(void) ncio_rel(ncp->nciop, offset,
+#line 764
RGN_MODIFIED);
+#line 764
+#line 764
remaining -= extent;
+#line 764
if(remaining == 0)
+#line 764
break; /* normal loop exit */
+#line 764
offset += extent;
+#line 764
value += nput;
+#line 764
+#line 764
}
+#line 764
+#line 764
return status;
+#line 764
}
+#line 764
static int
+#line 765
putNCvx_float_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 765
const size_t *start, size_t nelems, const ulonglong *value)
+#line 765
{
+#line 765
off_t offset = NC_varoffset(ncp, varp, start);
+#line 765
size_t remaining = varp->xsz * nelems;
+#line 765
int status = NC_NOERR;
+#line 765
void *xp;
+#line 765
+#line 765
if(nelems == 0)
+#line 765
return NC_NOERR;
+#line 765
+#line 765
assert(value != NULL);
+#line 765
+#line 765
for(;;)
+#line 765
{
+#line 765
size_t extent = MIN(remaining, ncp->chunk);
+#line 765
size_t nput = ncx_howmany(varp->type, extent);
+#line 765
+#line 765
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 765
RGN_WRITE, &xp);
+#line 765
if(lstatus != NC_NOERR)
+#line 765
return lstatus;
+#line 765
+#line 765
lstatus = ncx_putn_float_ulonglong(&xp, nput, value);
+#line 765
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 765
{
+#line 765
/* not fatal to the loop */
+#line 765
status = lstatus;
+#line 765
}
+#line 765
+#line 765
(void) ncio_rel(ncp->nciop, offset,
+#line 765
RGN_MODIFIED);
+#line 765
+#line 765
remaining -= extent;
+#line 765
if(remaining == 0)
+#line 765
break; /* normal loop exit */
+#line 765
offset += extent;
+#line 765
value += nput;
+#line 765
+#line 765
}
+#line 765
+#line 765
return status;
+#line 765
}
+#line 765
static int
+#line 767
putNCvx_double_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 767
const size_t *start, size_t nelems, const schar *value)
+#line 767
{
+#line 767
off_t offset = NC_varoffset(ncp, varp, start);
+#line 767
size_t remaining = varp->xsz * nelems;
+#line 767
int status = NC_NOERR;
+#line 767
void *xp;
+#line 767
+#line 767
if(nelems == 0)
+#line 767
return NC_NOERR;
+#line 767
+#line 767
assert(value != NULL);
+#line 767
+#line 767
for(;;)
+#line 767
{
+#line 767
size_t extent = MIN(remaining, ncp->chunk);
+#line 767
size_t nput = ncx_howmany(varp->type, extent);
+#line 767
+#line 767
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 767
RGN_WRITE, &xp);
+#line 767
if(lstatus != NC_NOERR)
+#line 767
return lstatus;
+#line 767
+#line 767
lstatus = ncx_putn_double_schar(&xp, nput, value);
+#line 767
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 767
{
+#line 767
/* not fatal to the loop */
+#line 767
status = lstatus;
+#line 767
}
+#line 767
+#line 767
(void) ncio_rel(ncp->nciop, offset,
+#line 767
RGN_MODIFIED);
+#line 767
+#line 767
remaining -= extent;
+#line 767
if(remaining == 0)
+#line 767
break; /* normal loop exit */
+#line 767
offset += extent;
+#line 767
value += nput;
+#line 767
+#line 767
}
+#line 767
+#line 767
return status;
+#line 767
}
+#line 767
static int
+#line 768
putNCvx_double_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 768
const size_t *start, size_t nelems, const uchar *value)
+#line 768
{
+#line 768
off_t offset = NC_varoffset(ncp, varp, start);
+#line 768
size_t remaining = varp->xsz * nelems;
+#line 768
int status = NC_NOERR;
+#line 768
void *xp;
+#line 768
+#line 768
if(nelems == 0)
+#line 768
return NC_NOERR;
+#line 768
+#line 768
assert(value != NULL);
+#line 768
+#line 768
for(;;)
+#line 768
{
+#line 768
size_t extent = MIN(remaining, ncp->chunk);
+#line 768
size_t nput = ncx_howmany(varp->type, extent);
+#line 768
+#line 768
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 768
RGN_WRITE, &xp);
+#line 768
if(lstatus != NC_NOERR)
+#line 768
return lstatus;
+#line 768
+#line 768
lstatus = ncx_putn_double_uchar(&xp, nput, value);
+#line 768
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 768
{
+#line 768
/* not fatal to the loop */
+#line 768
status = lstatus;
+#line 768
}
+#line 768
+#line 768
(void) ncio_rel(ncp->nciop, offset,
+#line 768
RGN_MODIFIED);
+#line 768
+#line 768
remaining -= extent;
+#line 768
if(remaining == 0)
+#line 768
break; /* normal loop exit */
+#line 768
offset += extent;
+#line 768
value += nput;
+#line 768
+#line 768
}
+#line 768
+#line 768
return status;
+#line 768
}
+#line 768
static int
+#line 769
putNCvx_double_short(NC3_INFO* ncp, const NC_var *varp,
+#line 769
const size_t *start, size_t nelems, const short *value)
+#line 769
{
+#line 769
off_t offset = NC_varoffset(ncp, varp, start);
+#line 769
size_t remaining = varp->xsz * nelems;
+#line 769
int status = NC_NOERR;
+#line 769
void *xp;
+#line 769
+#line 769
if(nelems == 0)
+#line 769
return NC_NOERR;
+#line 769
+#line 769
assert(value != NULL);
+#line 769
+#line 769
for(;;)
+#line 769
{
+#line 769
size_t extent = MIN(remaining, ncp->chunk);
+#line 769
size_t nput = ncx_howmany(varp->type, extent);
+#line 769
+#line 769
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 769
RGN_WRITE, &xp);
+#line 769
if(lstatus != NC_NOERR)
+#line 769
return lstatus;
+#line 769
+#line 769
lstatus = ncx_putn_double_short(&xp, nput, value);
+#line 769
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 769
{
+#line 769
/* not fatal to the loop */
+#line 769
status = lstatus;
+#line 769
}
+#line 769
+#line 769
(void) ncio_rel(ncp->nciop, offset,
+#line 769
RGN_MODIFIED);
+#line 769
+#line 769
remaining -= extent;
+#line 769
if(remaining == 0)
+#line 769
break; /* normal loop exit */
+#line 769
offset += extent;
+#line 769
value += nput;
+#line 769
+#line 769
}
+#line 769
+#line 769
return status;
+#line 769
}
+#line 769
static int
+#line 770
putNCvx_double_int(NC3_INFO* ncp, const NC_var *varp,
+#line 770
const size_t *start, size_t nelems, const int *value)
+#line 770
{
+#line 770
off_t offset = NC_varoffset(ncp, varp, start);
+#line 770
size_t remaining = varp->xsz * nelems;
+#line 770
int status = NC_NOERR;
+#line 770
void *xp;
+#line 770
+#line 770
if(nelems == 0)
+#line 770
return NC_NOERR;
+#line 770
+#line 770
assert(value != NULL);
+#line 770
+#line 770
for(;;)
+#line 770
{
+#line 770
size_t extent = MIN(remaining, ncp->chunk);
+#line 770
size_t nput = ncx_howmany(varp->type, extent);
+#line 770
+#line 770
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 770
RGN_WRITE, &xp);
+#line 770
if(lstatus != NC_NOERR)
+#line 770
return lstatus;
+#line 770
+#line 770
lstatus = ncx_putn_double_int(&xp, nput, value);
+#line 770
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 770
{
+#line 770
/* not fatal to the loop */
+#line 770
status = lstatus;
+#line 770
}
+#line 770
+#line 770
(void) ncio_rel(ncp->nciop, offset,
+#line 770
RGN_MODIFIED);
+#line 770
+#line 770
remaining -= extent;
+#line 770
if(remaining == 0)
+#line 770
break; /* normal loop exit */
+#line 770
offset += extent;
+#line 770
value += nput;
+#line 770
+#line 770
}
+#line 770
+#line 770
return status;
+#line 770
}
+#line 770
static int
+#line 771
putNCvx_double_float(NC3_INFO* ncp, const NC_var *varp,
+#line 771
const size_t *start, size_t nelems, const float *value)
+#line 771
{
+#line 771
off_t offset = NC_varoffset(ncp, varp, start);
+#line 771
size_t remaining = varp->xsz * nelems;
+#line 771
int status = NC_NOERR;
+#line 771
void *xp;
+#line 771
+#line 771
if(nelems == 0)
+#line 771
return NC_NOERR;
+#line 771
+#line 771
assert(value != NULL);
+#line 771
+#line 771
for(;;)
+#line 771
{
+#line 771
size_t extent = MIN(remaining, ncp->chunk);
+#line 771
size_t nput = ncx_howmany(varp->type, extent);
+#line 771
+#line 771
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 771
RGN_WRITE, &xp);
+#line 771
if(lstatus != NC_NOERR)
+#line 771
return lstatus;
+#line 771
+#line 771
lstatus = ncx_putn_double_float(&xp, nput, value);
+#line 771
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 771
{
+#line 771
/* not fatal to the loop */
+#line 771
status = lstatus;
+#line 771
}
+#line 771
+#line 771
(void) ncio_rel(ncp->nciop, offset,
+#line 771
RGN_MODIFIED);
+#line 771
+#line 771
remaining -= extent;
+#line 771
if(remaining == 0)
+#line 771
break; /* normal loop exit */
+#line 771
offset += extent;
+#line 771
value += nput;
+#line 771
+#line 771
}
+#line 771
+#line 771
return status;
+#line 771
}
+#line 771
static int
+#line 772
putNCvx_double_double(NC3_INFO* ncp, const NC_var *varp,
+#line 772
const size_t *start, size_t nelems, const double *value)
+#line 772
{
+#line 772
off_t offset = NC_varoffset(ncp, varp, start);
+#line 772
size_t remaining = varp->xsz * nelems;
+#line 772
int status = NC_NOERR;
+#line 772
void *xp;
+#line 772
+#line 772
if(nelems == 0)
+#line 772
return NC_NOERR;
+#line 772
+#line 772
assert(value != NULL);
+#line 772
+#line 772
for(;;)
+#line 772
{
+#line 772
size_t extent = MIN(remaining, ncp->chunk);
+#line 772
size_t nput = ncx_howmany(varp->type, extent);
+#line 772
+#line 772
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 772
RGN_WRITE, &xp);
+#line 772
if(lstatus != NC_NOERR)
+#line 772
return lstatus;
+#line 772
+#line 772
lstatus = ncx_putn_double_double(&xp, nput, value);
+#line 772
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 772
{
+#line 772
/* not fatal to the loop */
+#line 772
status = lstatus;
+#line 772
}
+#line 772
+#line 772
(void) ncio_rel(ncp->nciop, offset,
+#line 772
RGN_MODIFIED);
+#line 772
+#line 772
remaining -= extent;
+#line 772
if(remaining == 0)
+#line 772
break; /* normal loop exit */
+#line 772
offset += extent;
+#line 772
value += nput;
+#line 772
+#line 772
}
+#line 772
+#line 772
return status;
+#line 772
}
+#line 772
static int
+#line 773
putNCvx_double_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 773
const size_t *start, size_t nelems, const longlong *value)
+#line 773
{
+#line 773
off_t offset = NC_varoffset(ncp, varp, start);
+#line 773
size_t remaining = varp->xsz * nelems;
+#line 773
int status = NC_NOERR;
+#line 773
void *xp;
+#line 773
+#line 773
if(nelems == 0)
+#line 773
return NC_NOERR;
+#line 773
+#line 773
assert(value != NULL);
+#line 773
+#line 773
for(;;)
+#line 773
{
+#line 773
size_t extent = MIN(remaining, ncp->chunk);
+#line 773
size_t nput = ncx_howmany(varp->type, extent);
+#line 773
+#line 773
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 773
RGN_WRITE, &xp);
+#line 773
if(lstatus != NC_NOERR)
+#line 773
return lstatus;
+#line 773
+#line 773
lstatus = ncx_putn_double_longlong(&xp, nput, value);
+#line 773
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 773
{
+#line 773
/* not fatal to the loop */
+#line 773
status = lstatus;
+#line 773
}
+#line 773
+#line 773
(void) ncio_rel(ncp->nciop, offset,
+#line 773
RGN_MODIFIED);
+#line 773
+#line 773
remaining -= extent;
+#line 773
if(remaining == 0)
+#line 773
break; /* normal loop exit */
+#line 773
offset += extent;
+#line 773
value += nput;
+#line 773
+#line 773
}
+#line 773
+#line 773
return status;
+#line 773
}
+#line 773
static int
+#line 774
putNCvx_double_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 774
const size_t *start, size_t nelems, const ushort *value)
+#line 774
{
+#line 774
off_t offset = NC_varoffset(ncp, varp, start);
+#line 774
size_t remaining = varp->xsz * nelems;
+#line 774
int status = NC_NOERR;
+#line 774
void *xp;
+#line 774
+#line 774
if(nelems == 0)
+#line 774
return NC_NOERR;
+#line 774
+#line 774
assert(value != NULL);
+#line 774
+#line 774
for(;;)
+#line 774
{
+#line 774
size_t extent = MIN(remaining, ncp->chunk);
+#line 774
size_t nput = ncx_howmany(varp->type, extent);
+#line 774
+#line 774
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 774
RGN_WRITE, &xp);
+#line 774
if(lstatus != NC_NOERR)
+#line 774
return lstatus;
+#line 774
+#line 774
lstatus = ncx_putn_double_ushort(&xp, nput, value);
+#line 774
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 774
{
+#line 774
/* not fatal to the loop */
+#line 774
status = lstatus;
+#line 774
}
+#line 774
+#line 774
(void) ncio_rel(ncp->nciop, offset,
+#line 774
RGN_MODIFIED);
+#line 774
+#line 774
remaining -= extent;
+#line 774
if(remaining == 0)
+#line 774
break; /* normal loop exit */
+#line 774
offset += extent;
+#line 774
value += nput;
+#line 774
+#line 774
}
+#line 774
+#line 774
return status;
+#line 774
}
+#line 774
static int
+#line 775
putNCvx_double_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 775
const size_t *start, size_t nelems, const uint *value)
+#line 775
{
+#line 775
off_t offset = NC_varoffset(ncp, varp, start);
+#line 775
size_t remaining = varp->xsz * nelems;
+#line 775
int status = NC_NOERR;
+#line 775
void *xp;
+#line 775
+#line 775
if(nelems == 0)
+#line 775
return NC_NOERR;
+#line 775
+#line 775
assert(value != NULL);
+#line 775
+#line 775
for(;;)
+#line 775
{
+#line 775
size_t extent = MIN(remaining, ncp->chunk);
+#line 775
size_t nput = ncx_howmany(varp->type, extent);
+#line 775
+#line 775
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 775
RGN_WRITE, &xp);
+#line 775
if(lstatus != NC_NOERR)
+#line 775
return lstatus;
+#line 775
+#line 775
lstatus = ncx_putn_double_uint(&xp, nput, value);
+#line 775
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 775
{
+#line 775
/* not fatal to the loop */
+#line 775
status = lstatus;
+#line 775
}
+#line 775
+#line 775
(void) ncio_rel(ncp->nciop, offset,
+#line 775
RGN_MODIFIED);
+#line 775
+#line 775
remaining -= extent;
+#line 775
if(remaining == 0)
+#line 775
break; /* normal loop exit */
+#line 775
offset += extent;
+#line 775
value += nput;
+#line 775
+#line 775
}
+#line 775
+#line 775
return status;
+#line 775
}
+#line 775
static int
+#line 776
putNCvx_double_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 776
const size_t *start, size_t nelems, const ulonglong *value)
+#line 776
{
+#line 776
off_t offset = NC_varoffset(ncp, varp, start);
+#line 776
size_t remaining = varp->xsz * nelems;
+#line 776
int status = NC_NOERR;
+#line 776
void *xp;
+#line 776
+#line 776
if(nelems == 0)
+#line 776
return NC_NOERR;
+#line 776
+#line 776
assert(value != NULL);
+#line 776
+#line 776
for(;;)
+#line 776
{
+#line 776
size_t extent = MIN(remaining, ncp->chunk);
+#line 776
size_t nput = ncx_howmany(varp->type, extent);
+#line 776
+#line 776
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 776
RGN_WRITE, &xp);
+#line 776
if(lstatus != NC_NOERR)
+#line 776
return lstatus;
+#line 776
+#line 776
lstatus = ncx_putn_double_ulonglong(&xp, nput, value);
+#line 776
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 776
{
+#line 776
/* not fatal to the loop */
+#line 776
status = lstatus;
+#line 776
}
+#line 776
+#line 776
(void) ncio_rel(ncp->nciop, offset,
+#line 776
RGN_MODIFIED);
+#line 776
+#line 776
remaining -= extent;
+#line 776
if(remaining == 0)
+#line 776
break; /* normal loop exit */
+#line 776
offset += extent;
+#line 776
value += nput;
+#line 776
+#line 776
}
+#line 776
+#line 776
return status;
+#line 776
}
+#line 776
static int
+#line 778
putNCvx_uchar_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 778
const size_t *start, size_t nelems, const schar *value)
+#line 778
{
+#line 778
off_t offset = NC_varoffset(ncp, varp, start);
+#line 778
size_t remaining = varp->xsz * nelems;
+#line 778
int status = NC_NOERR;
+#line 778
void *xp;
+#line 778
+#line 778
if(nelems == 0)
+#line 778
return NC_NOERR;
+#line 778
+#line 778
assert(value != NULL);
+#line 778
+#line 778
for(;;)
+#line 778
{
+#line 778
size_t extent = MIN(remaining, ncp->chunk);
+#line 778
size_t nput = ncx_howmany(varp->type, extent);
+#line 778
+#line 778
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 778
RGN_WRITE, &xp);
+#line 778
if(lstatus != NC_NOERR)
+#line 778
return lstatus;
+#line 778
+#line 778
lstatus = ncx_putn_uchar_schar(&xp, nput, value);
+#line 778
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 778
{
+#line 778
/* not fatal to the loop */
+#line 778
status = lstatus;
+#line 778
}
+#line 778
+#line 778
(void) ncio_rel(ncp->nciop, offset,
+#line 778
RGN_MODIFIED);
+#line 778
+#line 778
remaining -= extent;
+#line 778
if(remaining == 0)
+#line 778
break; /* normal loop exit */
+#line 778
offset += extent;
+#line 778
value += nput;
+#line 778
+#line 778
}
+#line 778
+#line 778
return status;
+#line 778
}
+#line 778
static int
+#line 779
putNCvx_uchar_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 779
const size_t *start, size_t nelems, const uchar *value)
+#line 779
{
+#line 779
off_t offset = NC_varoffset(ncp, varp, start);
+#line 779
size_t remaining = varp->xsz * nelems;
+#line 779
int status = NC_NOERR;
+#line 779
void *xp;
+#line 779
+#line 779
if(nelems == 0)
+#line 779
return NC_NOERR;
+#line 779
+#line 779
assert(value != NULL);
+#line 779
+#line 779
for(;;)
+#line 779
{
+#line 779
size_t extent = MIN(remaining, ncp->chunk);
+#line 779
size_t nput = ncx_howmany(varp->type, extent);
+#line 779
+#line 779
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 779
RGN_WRITE, &xp);
+#line 779
if(lstatus != NC_NOERR)
+#line 779
return lstatus;
+#line 779
+#line 779
lstatus = ncx_putn_uchar_uchar(&xp, nput, value);
+#line 779
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 779
{
+#line 779
/* not fatal to the loop */
+#line 779
status = lstatus;
+#line 779
}
+#line 779
+#line 779
(void) ncio_rel(ncp->nciop, offset,
+#line 779
RGN_MODIFIED);
+#line 779
+#line 779
remaining -= extent;
+#line 779
if(remaining == 0)
+#line 779
break; /* normal loop exit */
+#line 779
offset += extent;
+#line 779
value += nput;
+#line 779
+#line 779
}
+#line 779
+#line 779
return status;
+#line 779
}
+#line 779
static int
+#line 780
putNCvx_uchar_short(NC3_INFO* ncp, const NC_var *varp,
+#line 780
const size_t *start, size_t nelems, const short *value)
+#line 780
{
+#line 780
off_t offset = NC_varoffset(ncp, varp, start);
+#line 780
size_t remaining = varp->xsz * nelems;
+#line 780
int status = NC_NOERR;
+#line 780
void *xp;
+#line 780
+#line 780
if(nelems == 0)
+#line 780
return NC_NOERR;
+#line 780
+#line 780
assert(value != NULL);
+#line 780
+#line 780
for(;;)
+#line 780
{
+#line 780
size_t extent = MIN(remaining, ncp->chunk);
+#line 780
size_t nput = ncx_howmany(varp->type, extent);
+#line 780
+#line 780
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 780
RGN_WRITE, &xp);
+#line 780
if(lstatus != NC_NOERR)
+#line 780
return lstatus;
+#line 780
+#line 780
lstatus = ncx_putn_uchar_short(&xp, nput, value);
+#line 780
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 780
{
+#line 780
/* not fatal to the loop */
+#line 780
status = lstatus;
+#line 780
}
+#line 780
+#line 780
(void) ncio_rel(ncp->nciop, offset,
+#line 780
RGN_MODIFIED);
+#line 780
+#line 780
remaining -= extent;
+#line 780
if(remaining == 0)
+#line 780
break; /* normal loop exit */
+#line 780
offset += extent;
+#line 780
value += nput;
+#line 780
+#line 780
}
+#line 780
+#line 780
return status;
+#line 780
}
+#line 780
static int
+#line 781
putNCvx_uchar_int(NC3_INFO* ncp, const NC_var *varp,
+#line 781
const size_t *start, size_t nelems, const int *value)
+#line 781
{
+#line 781
off_t offset = NC_varoffset(ncp, varp, start);
+#line 781
size_t remaining = varp->xsz * nelems;
+#line 781
int status = NC_NOERR;
+#line 781
void *xp;
+#line 781
+#line 781
if(nelems == 0)
+#line 781
return NC_NOERR;
+#line 781
+#line 781
assert(value != NULL);
+#line 781
+#line 781
for(;;)
+#line 781
{
+#line 781
size_t extent = MIN(remaining, ncp->chunk);
+#line 781
size_t nput = ncx_howmany(varp->type, extent);
+#line 781
+#line 781
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 781
RGN_WRITE, &xp);
+#line 781
if(lstatus != NC_NOERR)
+#line 781
return lstatus;
+#line 781
+#line 781
lstatus = ncx_putn_uchar_int(&xp, nput, value);
+#line 781
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 781
{
+#line 781
/* not fatal to the loop */
+#line 781
status = lstatus;
+#line 781
}
+#line 781
+#line 781
(void) ncio_rel(ncp->nciop, offset,
+#line 781
RGN_MODIFIED);
+#line 781
+#line 781
remaining -= extent;
+#line 781
if(remaining == 0)
+#line 781
break; /* normal loop exit */
+#line 781
offset += extent;
+#line 781
value += nput;
+#line 781
+#line 781
}
+#line 781
+#line 781
return status;
+#line 781
}
+#line 781
static int
+#line 782
putNCvx_uchar_float(NC3_INFO* ncp, const NC_var *varp,
+#line 782
const size_t *start, size_t nelems, const float *value)
+#line 782
{
+#line 782
off_t offset = NC_varoffset(ncp, varp, start);
+#line 782
size_t remaining = varp->xsz * nelems;
+#line 782
int status = NC_NOERR;
+#line 782
void *xp;
+#line 782
+#line 782
if(nelems == 0)
+#line 782
return NC_NOERR;
+#line 782
+#line 782
assert(value != NULL);
+#line 782
+#line 782
for(;;)
+#line 782
{
+#line 782
size_t extent = MIN(remaining, ncp->chunk);
+#line 782
size_t nput = ncx_howmany(varp->type, extent);
+#line 782
+#line 782
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 782
RGN_WRITE, &xp);
+#line 782
if(lstatus != NC_NOERR)
+#line 782
return lstatus;
+#line 782
+#line 782
lstatus = ncx_putn_uchar_float(&xp, nput, value);
+#line 782
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 782
{
+#line 782
/* not fatal to the loop */
+#line 782
status = lstatus;
+#line 782
}
+#line 782
+#line 782
(void) ncio_rel(ncp->nciop, offset,
+#line 782
RGN_MODIFIED);
+#line 782
+#line 782
remaining -= extent;
+#line 782
if(remaining == 0)
+#line 782
break; /* normal loop exit */
+#line 782
offset += extent;
+#line 782
value += nput;
+#line 782
+#line 782
}
+#line 782
+#line 782
return status;
+#line 782
}
+#line 782
static int
+#line 783
putNCvx_uchar_double(NC3_INFO* ncp, const NC_var *varp,
+#line 783
const size_t *start, size_t nelems, const double *value)
+#line 783
{
+#line 783
off_t offset = NC_varoffset(ncp, varp, start);
+#line 783
size_t remaining = varp->xsz * nelems;
+#line 783
int status = NC_NOERR;
+#line 783
void *xp;
+#line 783
+#line 783
if(nelems == 0)
+#line 783
return NC_NOERR;
+#line 783
+#line 783
assert(value != NULL);
+#line 783
+#line 783
for(;;)
+#line 783
{
+#line 783
size_t extent = MIN(remaining, ncp->chunk);
+#line 783
size_t nput = ncx_howmany(varp->type, extent);
+#line 783
+#line 783
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 783
RGN_WRITE, &xp);
+#line 783
if(lstatus != NC_NOERR)
+#line 783
return lstatus;
+#line 783
+#line 783
lstatus = ncx_putn_uchar_double(&xp, nput, value);
+#line 783
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 783
{
+#line 783
/* not fatal to the loop */
+#line 783
status = lstatus;
+#line 783
}
+#line 783
+#line 783
(void) ncio_rel(ncp->nciop, offset,
+#line 783
RGN_MODIFIED);
+#line 783
+#line 783
remaining -= extent;
+#line 783
if(remaining == 0)
+#line 783
break; /* normal loop exit */
+#line 783
offset += extent;
+#line 783
value += nput;
+#line 783
+#line 783
}
+#line 783
+#line 783
return status;
+#line 783
}
+#line 783
static int
+#line 784
putNCvx_uchar_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 784
const size_t *start, size_t nelems, const longlong *value)
+#line 784
{
+#line 784
off_t offset = NC_varoffset(ncp, varp, start);
+#line 784
size_t remaining = varp->xsz * nelems;
+#line 784
int status = NC_NOERR;
+#line 784
void *xp;
+#line 784
+#line 784
if(nelems == 0)
+#line 784
return NC_NOERR;
+#line 784
+#line 784
assert(value != NULL);
+#line 784
+#line 784
for(;;)
+#line 784
{
+#line 784
size_t extent = MIN(remaining, ncp->chunk);
+#line 784
size_t nput = ncx_howmany(varp->type, extent);
+#line 784
+#line 784
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 784
RGN_WRITE, &xp);
+#line 784
if(lstatus != NC_NOERR)
+#line 784
return lstatus;
+#line 784
+#line 784
lstatus = ncx_putn_uchar_longlong(&xp, nput, value);
+#line 784
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 784
{
+#line 784
/* not fatal to the loop */
+#line 784
status = lstatus;
+#line 784
}
+#line 784
+#line 784
(void) ncio_rel(ncp->nciop, offset,
+#line 784
RGN_MODIFIED);
+#line 784
+#line 784
remaining -= extent;
+#line 784
if(remaining == 0)
+#line 784
break; /* normal loop exit */
+#line 784
offset += extent;
+#line 784
value += nput;
+#line 784
+#line 784
}
+#line 784
+#line 784
return status;
+#line 784
}
+#line 784
static int
+#line 785
putNCvx_uchar_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 785
const size_t *start, size_t nelems, const ushort *value)
+#line 785
{
+#line 785
off_t offset = NC_varoffset(ncp, varp, start);
+#line 785
size_t remaining = varp->xsz * nelems;
+#line 785
int status = NC_NOERR;
+#line 785
void *xp;
+#line 785
+#line 785
if(nelems == 0)
+#line 785
return NC_NOERR;
+#line 785
+#line 785
assert(value != NULL);
+#line 785
+#line 785
for(;;)
+#line 785
{
+#line 785
size_t extent = MIN(remaining, ncp->chunk);
+#line 785
size_t nput = ncx_howmany(varp->type, extent);
+#line 785
+#line 785
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 785
RGN_WRITE, &xp);
+#line 785
if(lstatus != NC_NOERR)
+#line 785
return lstatus;
+#line 785
+#line 785
lstatus = ncx_putn_uchar_ushort(&xp, nput, value);
+#line 785
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 785
{
+#line 785
/* not fatal to the loop */
+#line 785
status = lstatus;
+#line 785
}
+#line 785
+#line 785
(void) ncio_rel(ncp->nciop, offset,
+#line 785
RGN_MODIFIED);
+#line 785
+#line 785
remaining -= extent;
+#line 785
if(remaining == 0)
+#line 785
break; /* normal loop exit */
+#line 785
offset += extent;
+#line 785
value += nput;
+#line 785
+#line 785
}
+#line 785
+#line 785
return status;
+#line 785
}
+#line 785
static int
+#line 786
putNCvx_uchar_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 786
const size_t *start, size_t nelems, const uint *value)
+#line 786
{
+#line 786
off_t offset = NC_varoffset(ncp, varp, start);
+#line 786
size_t remaining = varp->xsz * nelems;
+#line 786
int status = NC_NOERR;
+#line 786
void *xp;
+#line 786
+#line 786
if(nelems == 0)
+#line 786
return NC_NOERR;
+#line 786
+#line 786
assert(value != NULL);
+#line 786
+#line 786
for(;;)
+#line 786
{
+#line 786
size_t extent = MIN(remaining, ncp->chunk);
+#line 786
size_t nput = ncx_howmany(varp->type, extent);
+#line 786
+#line 786
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 786
RGN_WRITE, &xp);
+#line 786
if(lstatus != NC_NOERR)
+#line 786
return lstatus;
+#line 786
+#line 786
lstatus = ncx_putn_uchar_uint(&xp, nput, value);
+#line 786
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 786
{
+#line 786
/* not fatal to the loop */
+#line 786
status = lstatus;
+#line 786
}
+#line 786
+#line 786
(void) ncio_rel(ncp->nciop, offset,
+#line 786
RGN_MODIFIED);
+#line 786
+#line 786
remaining -= extent;
+#line 786
if(remaining == 0)
+#line 786
break; /* normal loop exit */
+#line 786
offset += extent;
+#line 786
value += nput;
+#line 786
+#line 786
}
+#line 786
+#line 786
return status;
+#line 786
}
+#line 786
static int
+#line 787
putNCvx_uchar_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 787
const size_t *start, size_t nelems, const ulonglong *value)
+#line 787
{
+#line 787
off_t offset = NC_varoffset(ncp, varp, start);
+#line 787
size_t remaining = varp->xsz * nelems;
+#line 787
int status = NC_NOERR;
+#line 787
void *xp;
+#line 787
+#line 787
if(nelems == 0)
+#line 787
return NC_NOERR;
+#line 787
+#line 787
assert(value != NULL);
+#line 787
+#line 787
for(;;)
+#line 787
{
+#line 787
size_t extent = MIN(remaining, ncp->chunk);
+#line 787
size_t nput = ncx_howmany(varp->type, extent);
+#line 787
+#line 787
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 787
RGN_WRITE, &xp);
+#line 787
if(lstatus != NC_NOERR)
+#line 787
return lstatus;
+#line 787
+#line 787
lstatus = ncx_putn_uchar_ulonglong(&xp, nput, value);
+#line 787
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 787
{
+#line 787
/* not fatal to the loop */
+#line 787
status = lstatus;
+#line 787
}
+#line 787
+#line 787
(void) ncio_rel(ncp->nciop, offset,
+#line 787
RGN_MODIFIED);
+#line 787
+#line 787
remaining -= extent;
+#line 787
if(remaining == 0)
+#line 787
break; /* normal loop exit */
+#line 787
offset += extent;
+#line 787
value += nput;
+#line 787
+#line 787
}
+#line 787
+#line 787
return status;
+#line 787
}
+#line 787
static int
+#line 789
putNCvx_ushort_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 789
const size_t *start, size_t nelems, const schar *value)
+#line 789
{
+#line 789
off_t offset = NC_varoffset(ncp, varp, start);
+#line 789
size_t remaining = varp->xsz * nelems;
+#line 789
int status = NC_NOERR;
+#line 789
void *xp;
+#line 789
+#line 789
if(nelems == 0)
+#line 789
return NC_NOERR;
+#line 789
+#line 789
assert(value != NULL);
+#line 789
+#line 789
for(;;)
+#line 789
{
+#line 789
size_t extent = MIN(remaining, ncp->chunk);
+#line 789
size_t nput = ncx_howmany(varp->type, extent);
+#line 789
+#line 789
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 789
RGN_WRITE, &xp);
+#line 789
if(lstatus != NC_NOERR)
+#line 789
return lstatus;
+#line 789
+#line 789
lstatus = ncx_putn_ushort_schar(&xp, nput, value);
+#line 789
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 789
{
+#line 789
/* not fatal to the loop */
+#line 789
status = lstatus;
+#line 789
}
+#line 789
+#line 789
(void) ncio_rel(ncp->nciop, offset,
+#line 789
RGN_MODIFIED);
+#line 789
+#line 789
remaining -= extent;
+#line 789
if(remaining == 0)
+#line 789
break; /* normal loop exit */
+#line 789
offset += extent;
+#line 789
value += nput;
+#line 789
+#line 789
}
+#line 789
+#line 789
return status;
+#line 789
}
+#line 789
static int
+#line 790
putNCvx_ushort_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 790
const size_t *start, size_t nelems, const uchar *value)
+#line 790
{
+#line 790
off_t offset = NC_varoffset(ncp, varp, start);
+#line 790
size_t remaining = varp->xsz * nelems;
+#line 790
int status = NC_NOERR;
+#line 790
void *xp;
+#line 790
+#line 790
if(nelems == 0)
+#line 790
return NC_NOERR;
+#line 790
+#line 790
assert(value != NULL);
+#line 790
+#line 790
for(;;)
+#line 790
{
+#line 790
size_t extent = MIN(remaining, ncp->chunk);
+#line 790
size_t nput = ncx_howmany(varp->type, extent);
+#line 790
+#line 790
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 790
RGN_WRITE, &xp);
+#line 790
if(lstatus != NC_NOERR)
+#line 790
return lstatus;
+#line 790
+#line 790
lstatus = ncx_putn_ushort_uchar(&xp, nput, value);
+#line 790
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 790
{
+#line 790
/* not fatal to the loop */
+#line 790
status = lstatus;
+#line 790
}
+#line 790
+#line 790
(void) ncio_rel(ncp->nciop, offset,
+#line 790
RGN_MODIFIED);
+#line 790
+#line 790
remaining -= extent;
+#line 790
if(remaining == 0)
+#line 790
break; /* normal loop exit */
+#line 790
offset += extent;
+#line 790
value += nput;
+#line 790
+#line 790
}
+#line 790
+#line 790
return status;
+#line 790
}
+#line 790
static int
+#line 791
putNCvx_ushort_short(NC3_INFO* ncp, const NC_var *varp,
+#line 791
const size_t *start, size_t nelems, const short *value)
+#line 791
{
+#line 791
off_t offset = NC_varoffset(ncp, varp, start);
+#line 791
size_t remaining = varp->xsz * nelems;
+#line 791
int status = NC_NOERR;
+#line 791
void *xp;
+#line 791
+#line 791
if(nelems == 0)
+#line 791
return NC_NOERR;
+#line 791
+#line 791
assert(value != NULL);
+#line 791
+#line 791
for(;;)
+#line 791
{
+#line 791
size_t extent = MIN(remaining, ncp->chunk);
+#line 791
size_t nput = ncx_howmany(varp->type, extent);
+#line 791
+#line 791
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 791
RGN_WRITE, &xp);
+#line 791
if(lstatus != NC_NOERR)
+#line 791
return lstatus;
+#line 791
+#line 791
lstatus = ncx_putn_ushort_short(&xp, nput, value);
+#line 791
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 791
{
+#line 791
/* not fatal to the loop */
+#line 791
status = lstatus;
+#line 791
}
+#line 791
+#line 791
(void) ncio_rel(ncp->nciop, offset,
+#line 791
RGN_MODIFIED);
+#line 791
+#line 791
remaining -= extent;
+#line 791
if(remaining == 0)
+#line 791
break; /* normal loop exit */
+#line 791
offset += extent;
+#line 791
value += nput;
+#line 791
+#line 791
}
+#line 791
+#line 791
return status;
+#line 791
}
+#line 791
static int
+#line 792
putNCvx_ushort_int(NC3_INFO* ncp, const NC_var *varp,
+#line 792
const size_t *start, size_t nelems, const int *value)
+#line 792
{
+#line 792
off_t offset = NC_varoffset(ncp, varp, start);
+#line 792
size_t remaining = varp->xsz * nelems;
+#line 792
int status = NC_NOERR;
+#line 792
void *xp;
+#line 792
+#line 792
if(nelems == 0)
+#line 792
return NC_NOERR;
+#line 792
+#line 792
assert(value != NULL);
+#line 792
+#line 792
for(;;)
+#line 792
{
+#line 792
size_t extent = MIN(remaining, ncp->chunk);
+#line 792
size_t nput = ncx_howmany(varp->type, extent);
+#line 792
+#line 792
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 792
RGN_WRITE, &xp);
+#line 792
if(lstatus != NC_NOERR)
+#line 792
return lstatus;
+#line 792
+#line 792
lstatus = ncx_putn_ushort_int(&xp, nput, value);
+#line 792
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 792
{
+#line 792
/* not fatal to the loop */
+#line 792
status = lstatus;
+#line 792
}
+#line 792
+#line 792
(void) ncio_rel(ncp->nciop, offset,
+#line 792
RGN_MODIFIED);
+#line 792
+#line 792
remaining -= extent;
+#line 792
if(remaining == 0)
+#line 792
break; /* normal loop exit */
+#line 792
offset += extent;
+#line 792
value += nput;
+#line 792
+#line 792
}
+#line 792
+#line 792
return status;
+#line 792
}
+#line 792
static int
+#line 793
putNCvx_ushort_float(NC3_INFO* ncp, const NC_var *varp,
+#line 793
const size_t *start, size_t nelems, const float *value)
+#line 793
{
+#line 793
off_t offset = NC_varoffset(ncp, varp, start);
+#line 793
size_t remaining = varp->xsz * nelems;
+#line 793
int status = NC_NOERR;
+#line 793
void *xp;
+#line 793
+#line 793
if(nelems == 0)
+#line 793
return NC_NOERR;
+#line 793
+#line 793
assert(value != NULL);
+#line 793
+#line 793
for(;;)
+#line 793
{
+#line 793
size_t extent = MIN(remaining, ncp->chunk);
+#line 793
size_t nput = ncx_howmany(varp->type, extent);
+#line 793
+#line 793
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 793
RGN_WRITE, &xp);
+#line 793
if(lstatus != NC_NOERR)
+#line 793
return lstatus;
+#line 793
+#line 793
lstatus = ncx_putn_ushort_float(&xp, nput, value);
+#line 793
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 793
{
+#line 793
/* not fatal to the loop */
+#line 793
status = lstatus;
+#line 793
}
+#line 793
+#line 793
(void) ncio_rel(ncp->nciop, offset,
+#line 793
RGN_MODIFIED);
+#line 793
+#line 793
remaining -= extent;
+#line 793
if(remaining == 0)
+#line 793
break; /* normal loop exit */
+#line 793
offset += extent;
+#line 793
value += nput;
+#line 793
+#line 793
}
+#line 793
+#line 793
return status;
+#line 793
}
+#line 793
static int
+#line 794
putNCvx_ushort_double(NC3_INFO* ncp, const NC_var *varp,
+#line 794
const size_t *start, size_t nelems, const double *value)
+#line 794
{
+#line 794
off_t offset = NC_varoffset(ncp, varp, start);
+#line 794
size_t remaining = varp->xsz * nelems;
+#line 794
int status = NC_NOERR;
+#line 794
void *xp;
+#line 794
+#line 794
if(nelems == 0)
+#line 794
return NC_NOERR;
+#line 794
+#line 794
assert(value != NULL);
+#line 794
+#line 794
for(;;)
+#line 794
{
+#line 794
size_t extent = MIN(remaining, ncp->chunk);
+#line 794
size_t nput = ncx_howmany(varp->type, extent);
+#line 794
+#line 794
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 794
RGN_WRITE, &xp);
+#line 794
if(lstatus != NC_NOERR)
+#line 794
return lstatus;
+#line 794
+#line 794
lstatus = ncx_putn_ushort_double(&xp, nput, value);
+#line 794
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 794
{
+#line 794
/* not fatal to the loop */
+#line 794
status = lstatus;
+#line 794
}
+#line 794
+#line 794
(void) ncio_rel(ncp->nciop, offset,
+#line 794
RGN_MODIFIED);
+#line 794
+#line 794
remaining -= extent;
+#line 794
if(remaining == 0)
+#line 794
break; /* normal loop exit */
+#line 794
offset += extent;
+#line 794
value += nput;
+#line 794
+#line 794
}
+#line 794
+#line 794
return status;
+#line 794
}
+#line 794
static int
+#line 795
putNCvx_ushort_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 795
const size_t *start, size_t nelems, const longlong *value)
+#line 795
{
+#line 795
off_t offset = NC_varoffset(ncp, varp, start);
+#line 795
size_t remaining = varp->xsz * nelems;
+#line 795
int status = NC_NOERR;
+#line 795
void *xp;
+#line 795
+#line 795
if(nelems == 0)
+#line 795
return NC_NOERR;
+#line 795
+#line 795
assert(value != NULL);
+#line 795
+#line 795
for(;;)
+#line 795
{
+#line 795
size_t extent = MIN(remaining, ncp->chunk);
+#line 795
size_t nput = ncx_howmany(varp->type, extent);
+#line 795
+#line 795
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 795
RGN_WRITE, &xp);
+#line 795
if(lstatus != NC_NOERR)
+#line 795
return lstatus;
+#line 795
+#line 795
lstatus = ncx_putn_ushort_longlong(&xp, nput, value);
+#line 795
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 795
{
+#line 795
/* not fatal to the loop */
+#line 795
status = lstatus;
+#line 795
}
+#line 795
+#line 795
(void) ncio_rel(ncp->nciop, offset,
+#line 795
RGN_MODIFIED);
+#line 795
+#line 795
remaining -= extent;
+#line 795
if(remaining == 0)
+#line 795
break; /* normal loop exit */
+#line 795
offset += extent;
+#line 795
value += nput;
+#line 795
+#line 795
}
+#line 795
+#line 795
return status;
+#line 795
}
+#line 795
static int
+#line 796
putNCvx_ushort_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 796
const size_t *start, size_t nelems, const ushort *value)
+#line 796
{
+#line 796
off_t offset = NC_varoffset(ncp, varp, start);
+#line 796
size_t remaining = varp->xsz * nelems;
+#line 796
int status = NC_NOERR;
+#line 796
void *xp;
+#line 796
+#line 796
if(nelems == 0)
+#line 796
return NC_NOERR;
+#line 796
+#line 796
assert(value != NULL);
+#line 796
+#line 796
for(;;)
+#line 796
{
+#line 796
size_t extent = MIN(remaining, ncp->chunk);
+#line 796
size_t nput = ncx_howmany(varp->type, extent);
+#line 796
+#line 796
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 796
RGN_WRITE, &xp);
+#line 796
if(lstatus != NC_NOERR)
+#line 796
return lstatus;
+#line 796
+#line 796
lstatus = ncx_putn_ushort_ushort(&xp, nput, value);
+#line 796
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 796
{
+#line 796
/* not fatal to the loop */
+#line 796
status = lstatus;
+#line 796
}
+#line 796
+#line 796
(void) ncio_rel(ncp->nciop, offset,
+#line 796
RGN_MODIFIED);
+#line 796
+#line 796
remaining -= extent;
+#line 796
if(remaining == 0)
+#line 796
break; /* normal loop exit */
+#line 796
offset += extent;
+#line 796
value += nput;
+#line 796
+#line 796
}
+#line 796
+#line 796
return status;
+#line 796
}
+#line 796
static int
+#line 797
putNCvx_ushort_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 797
const size_t *start, size_t nelems, const uint *value)
+#line 797
{
+#line 797
off_t offset = NC_varoffset(ncp, varp, start);
+#line 797
size_t remaining = varp->xsz * nelems;
+#line 797
int status = NC_NOERR;
+#line 797
void *xp;
+#line 797
+#line 797
if(nelems == 0)
+#line 797
return NC_NOERR;
+#line 797
+#line 797
assert(value != NULL);
+#line 797
+#line 797
for(;;)
+#line 797
{
+#line 797
size_t extent = MIN(remaining, ncp->chunk);
+#line 797
size_t nput = ncx_howmany(varp->type, extent);
+#line 797
+#line 797
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 797
RGN_WRITE, &xp);
+#line 797
if(lstatus != NC_NOERR)
+#line 797
return lstatus;
+#line 797
+#line 797
lstatus = ncx_putn_ushort_uint(&xp, nput, value);
+#line 797
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 797
{
+#line 797
/* not fatal to the loop */
+#line 797
status = lstatus;
+#line 797
}
+#line 797
+#line 797
(void) ncio_rel(ncp->nciop, offset,
+#line 797
RGN_MODIFIED);
+#line 797
+#line 797
remaining -= extent;
+#line 797
if(remaining == 0)
+#line 797
break; /* normal loop exit */
+#line 797
offset += extent;
+#line 797
value += nput;
+#line 797
+#line 797
}
+#line 797
+#line 797
return status;
+#line 797
}
+#line 797
static int
+#line 798
putNCvx_ushort_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 798
const size_t *start, size_t nelems, const ulonglong *value)
+#line 798
{
+#line 798
off_t offset = NC_varoffset(ncp, varp, start);
+#line 798
size_t remaining = varp->xsz * nelems;
+#line 798
int status = NC_NOERR;
+#line 798
void *xp;
+#line 798
+#line 798
if(nelems == 0)
+#line 798
return NC_NOERR;
+#line 798
+#line 798
assert(value != NULL);
+#line 798
+#line 798
for(;;)
+#line 798
{
+#line 798
size_t extent = MIN(remaining, ncp->chunk);
+#line 798
size_t nput = ncx_howmany(varp->type, extent);
+#line 798
+#line 798
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 798
RGN_WRITE, &xp);
+#line 798
if(lstatus != NC_NOERR)
+#line 798
return lstatus;
+#line 798
+#line 798
lstatus = ncx_putn_ushort_ulonglong(&xp, nput, value);
+#line 798
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 798
{
+#line 798
/* not fatal to the loop */
+#line 798
status = lstatus;
+#line 798
}
+#line 798
+#line 798
(void) ncio_rel(ncp->nciop, offset,
+#line 798
RGN_MODIFIED);
+#line 798
+#line 798
remaining -= extent;
+#line 798
if(remaining == 0)
+#line 798
break; /* normal loop exit */
+#line 798
offset += extent;
+#line 798
value += nput;
+#line 798
+#line 798
}
+#line 798
+#line 798
return status;
+#line 798
}
+#line 798
static int
+#line 800
putNCvx_uint_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 800
const size_t *start, size_t nelems, const schar *value)
+#line 800
{
+#line 800
off_t offset = NC_varoffset(ncp, varp, start);
+#line 800
size_t remaining = varp->xsz * nelems;
+#line 800
int status = NC_NOERR;
+#line 800
void *xp;
+#line 800
+#line 800
if(nelems == 0)
+#line 800
return NC_NOERR;
+#line 800
+#line 800
assert(value != NULL);
+#line 800
+#line 800
for(;;)
+#line 800
{
+#line 800
size_t extent = MIN(remaining, ncp->chunk);
+#line 800
size_t nput = ncx_howmany(varp->type, extent);
+#line 800
+#line 800
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 800
RGN_WRITE, &xp);
+#line 800
if(lstatus != NC_NOERR)
+#line 800
return lstatus;
+#line 800
+#line 800
lstatus = ncx_putn_uint_schar(&xp, nput, value);
+#line 800
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 800
{
+#line 800
/* not fatal to the loop */
+#line 800
status = lstatus;
+#line 800
}
+#line 800
+#line 800
(void) ncio_rel(ncp->nciop, offset,
+#line 800
RGN_MODIFIED);
+#line 800
+#line 800
remaining -= extent;
+#line 800
if(remaining == 0)
+#line 800
break; /* normal loop exit */
+#line 800
offset += extent;
+#line 800
value += nput;
+#line 800
+#line 800
}
+#line 800
+#line 800
return status;
+#line 800
}
+#line 800
static int
+#line 801
putNCvx_uint_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 801
const size_t *start, size_t nelems, const uchar *value)
+#line 801
{
+#line 801
off_t offset = NC_varoffset(ncp, varp, start);
+#line 801
size_t remaining = varp->xsz * nelems;
+#line 801
int status = NC_NOERR;
+#line 801
void *xp;
+#line 801
+#line 801
if(nelems == 0)
+#line 801
return NC_NOERR;
+#line 801
+#line 801
assert(value != NULL);
+#line 801
+#line 801
for(;;)
+#line 801
{
+#line 801
size_t extent = MIN(remaining, ncp->chunk);
+#line 801
size_t nput = ncx_howmany(varp->type, extent);
+#line 801
+#line 801
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 801
RGN_WRITE, &xp);
+#line 801
if(lstatus != NC_NOERR)
+#line 801
return lstatus;
+#line 801
+#line 801
lstatus = ncx_putn_uint_uchar(&xp, nput, value);
+#line 801
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 801
{
+#line 801
/* not fatal to the loop */
+#line 801
status = lstatus;
+#line 801
}
+#line 801
+#line 801
(void) ncio_rel(ncp->nciop, offset,
+#line 801
RGN_MODIFIED);
+#line 801
+#line 801
remaining -= extent;
+#line 801
if(remaining == 0)
+#line 801
break; /* normal loop exit */
+#line 801
offset += extent;
+#line 801
value += nput;
+#line 801
+#line 801
}
+#line 801
+#line 801
return status;
+#line 801
}
+#line 801
static int
+#line 802
putNCvx_uint_short(NC3_INFO* ncp, const NC_var *varp,
+#line 802
const size_t *start, size_t nelems, const short *value)
+#line 802
{
+#line 802
off_t offset = NC_varoffset(ncp, varp, start);
+#line 802
size_t remaining = varp->xsz * nelems;
+#line 802
int status = NC_NOERR;
+#line 802
void *xp;
+#line 802
+#line 802
if(nelems == 0)
+#line 802
return NC_NOERR;
+#line 802
+#line 802
assert(value != NULL);
+#line 802
+#line 802
for(;;)
+#line 802
{
+#line 802
size_t extent = MIN(remaining, ncp->chunk);
+#line 802
size_t nput = ncx_howmany(varp->type, extent);
+#line 802
+#line 802
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 802
RGN_WRITE, &xp);
+#line 802
if(lstatus != NC_NOERR)
+#line 802
return lstatus;
+#line 802
+#line 802
lstatus = ncx_putn_uint_short(&xp, nput, value);
+#line 802
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 802
{
+#line 802
/* not fatal to the loop */
+#line 802
status = lstatus;
+#line 802
}
+#line 802
+#line 802
(void) ncio_rel(ncp->nciop, offset,
+#line 802
RGN_MODIFIED);
+#line 802
+#line 802
remaining -= extent;
+#line 802
if(remaining == 0)
+#line 802
break; /* normal loop exit */
+#line 802
offset += extent;
+#line 802
value += nput;
+#line 802
+#line 802
}
+#line 802
+#line 802
return status;
+#line 802
}
+#line 802
static int
+#line 803
putNCvx_uint_int(NC3_INFO* ncp, const NC_var *varp,
+#line 803
const size_t *start, size_t nelems, const int *value)
+#line 803
{
+#line 803
off_t offset = NC_varoffset(ncp, varp, start);
+#line 803
size_t remaining = varp->xsz * nelems;
+#line 803
int status = NC_NOERR;
+#line 803
void *xp;
+#line 803
+#line 803
if(nelems == 0)
+#line 803
return NC_NOERR;
+#line 803
+#line 803
assert(value != NULL);
+#line 803
+#line 803
for(;;)
+#line 803
{
+#line 803
size_t extent = MIN(remaining, ncp->chunk);
+#line 803
size_t nput = ncx_howmany(varp->type, extent);
+#line 803
+#line 803
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 803
RGN_WRITE, &xp);
+#line 803
if(lstatus != NC_NOERR)
+#line 803
return lstatus;
+#line 803
+#line 803
lstatus = ncx_putn_uint_int(&xp, nput, value);
+#line 803
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 803
{
+#line 803
/* not fatal to the loop */
+#line 803
status = lstatus;
+#line 803
}
+#line 803
+#line 803
(void) ncio_rel(ncp->nciop, offset,
+#line 803
RGN_MODIFIED);
+#line 803
+#line 803
remaining -= extent;
+#line 803
if(remaining == 0)
+#line 803
break; /* normal loop exit */
+#line 803
offset += extent;
+#line 803
value += nput;
+#line 803
+#line 803
}
+#line 803
+#line 803
return status;
+#line 803
}
+#line 803
static int
+#line 804
putNCvx_uint_float(NC3_INFO* ncp, const NC_var *varp,
+#line 804
const size_t *start, size_t nelems, const float *value)
+#line 804
{
+#line 804
off_t offset = NC_varoffset(ncp, varp, start);
+#line 804
size_t remaining = varp->xsz * nelems;
+#line 804
int status = NC_NOERR;
+#line 804
void *xp;
+#line 804
+#line 804
if(nelems == 0)
+#line 804
return NC_NOERR;
+#line 804
+#line 804
assert(value != NULL);
+#line 804
+#line 804
for(;;)
+#line 804
{
+#line 804
size_t extent = MIN(remaining, ncp->chunk);
+#line 804
size_t nput = ncx_howmany(varp->type, extent);
+#line 804
+#line 804
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 804
RGN_WRITE, &xp);
+#line 804
if(lstatus != NC_NOERR)
+#line 804
return lstatus;
+#line 804
+#line 804
lstatus = ncx_putn_uint_float(&xp, nput, value);
+#line 804
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 804
{
+#line 804
/* not fatal to the loop */
+#line 804
status = lstatus;
+#line 804
}
+#line 804
+#line 804
(void) ncio_rel(ncp->nciop, offset,
+#line 804
RGN_MODIFIED);
+#line 804
+#line 804
remaining -= extent;
+#line 804
if(remaining == 0)
+#line 804
break; /* normal loop exit */
+#line 804
offset += extent;
+#line 804
value += nput;
+#line 804
+#line 804
}
+#line 804
+#line 804
return status;
+#line 804
}
+#line 804
static int
+#line 805
putNCvx_uint_double(NC3_INFO* ncp, const NC_var *varp,
+#line 805
const size_t *start, size_t nelems, const double *value)
+#line 805
{
+#line 805
off_t offset = NC_varoffset(ncp, varp, start);
+#line 805
size_t remaining = varp->xsz * nelems;
+#line 805
int status = NC_NOERR;
+#line 805
void *xp;
+#line 805
+#line 805
if(nelems == 0)
+#line 805
return NC_NOERR;
+#line 805
+#line 805
assert(value != NULL);
+#line 805
+#line 805
for(;;)
+#line 805
{
+#line 805
size_t extent = MIN(remaining, ncp->chunk);
+#line 805
size_t nput = ncx_howmany(varp->type, extent);
+#line 805
+#line 805
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 805
RGN_WRITE, &xp);
+#line 805
if(lstatus != NC_NOERR)
+#line 805
return lstatus;
+#line 805
+#line 805
lstatus = ncx_putn_uint_double(&xp, nput, value);
+#line 805
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 805
{
+#line 805
/* not fatal to the loop */
+#line 805
status = lstatus;
+#line 805
}
+#line 805
+#line 805
(void) ncio_rel(ncp->nciop, offset,
+#line 805
RGN_MODIFIED);
+#line 805
+#line 805
remaining -= extent;
+#line 805
if(remaining == 0)
+#line 805
break; /* normal loop exit */
+#line 805
offset += extent;
+#line 805
value += nput;
+#line 805
+#line 805
}
+#line 805
+#line 805
return status;
+#line 805
}
+#line 805
static int
+#line 806
putNCvx_uint_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 806
const size_t *start, size_t nelems, const longlong *value)
+#line 806
{
+#line 806
off_t offset = NC_varoffset(ncp, varp, start);
+#line 806
size_t remaining = varp->xsz * nelems;
+#line 806
int status = NC_NOERR;
+#line 806
void *xp;
+#line 806
+#line 806
if(nelems == 0)
+#line 806
return NC_NOERR;
+#line 806
+#line 806
assert(value != NULL);
+#line 806
+#line 806
for(;;)
+#line 806
{
+#line 806
size_t extent = MIN(remaining, ncp->chunk);
+#line 806
size_t nput = ncx_howmany(varp->type, extent);
+#line 806
+#line 806
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 806
RGN_WRITE, &xp);
+#line 806
if(lstatus != NC_NOERR)
+#line 806
return lstatus;
+#line 806
+#line 806
lstatus = ncx_putn_uint_longlong(&xp, nput, value);
+#line 806
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 806
{
+#line 806
/* not fatal to the loop */
+#line 806
status = lstatus;
+#line 806
}
+#line 806
+#line 806
(void) ncio_rel(ncp->nciop, offset,
+#line 806
RGN_MODIFIED);
+#line 806
+#line 806
remaining -= extent;
+#line 806
if(remaining == 0)
+#line 806
break; /* normal loop exit */
+#line 806
offset += extent;
+#line 806
value += nput;
+#line 806
+#line 806
}
+#line 806
+#line 806
return status;
+#line 806
}
+#line 806
static int
+#line 807
putNCvx_uint_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 807
const size_t *start, size_t nelems, const ushort *value)
+#line 807
{
+#line 807
off_t offset = NC_varoffset(ncp, varp, start);
+#line 807
size_t remaining = varp->xsz * nelems;
+#line 807
int status = NC_NOERR;
+#line 807
void *xp;
+#line 807
+#line 807
if(nelems == 0)
+#line 807
return NC_NOERR;
+#line 807
+#line 807
assert(value != NULL);
+#line 807
+#line 807
for(;;)
+#line 807
{
+#line 807
size_t extent = MIN(remaining, ncp->chunk);
+#line 807
size_t nput = ncx_howmany(varp->type, extent);
+#line 807
+#line 807
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 807
RGN_WRITE, &xp);
+#line 807
if(lstatus != NC_NOERR)
+#line 807
return lstatus;
+#line 807
+#line 807
lstatus = ncx_putn_uint_ushort(&xp, nput, value);
+#line 807
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 807
{
+#line 807
/* not fatal to the loop */
+#line 807
status = lstatus;
+#line 807
}
+#line 807
+#line 807
(void) ncio_rel(ncp->nciop, offset,
+#line 807
RGN_MODIFIED);
+#line 807
+#line 807
remaining -= extent;
+#line 807
if(remaining == 0)
+#line 807
break; /* normal loop exit */
+#line 807
offset += extent;
+#line 807
value += nput;
+#line 807
+#line 807
}
+#line 807
+#line 807
return status;
+#line 807
}
+#line 807
static int
+#line 808
putNCvx_uint_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 808
const size_t *start, size_t nelems, const uint *value)
+#line 808
{
+#line 808
off_t offset = NC_varoffset(ncp, varp, start);
+#line 808
size_t remaining = varp->xsz * nelems;
+#line 808
int status = NC_NOERR;
+#line 808
void *xp;
+#line 808
+#line 808
if(nelems == 0)
+#line 808
return NC_NOERR;
+#line 808
+#line 808
assert(value != NULL);
+#line 808
+#line 808
for(;;)
+#line 808
{
+#line 808
size_t extent = MIN(remaining, ncp->chunk);
+#line 808
size_t nput = ncx_howmany(varp->type, extent);
+#line 808
+#line 808
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 808
RGN_WRITE, &xp);
+#line 808
if(lstatus != NC_NOERR)
+#line 808
return lstatus;
+#line 808
+#line 808
lstatus = ncx_putn_uint_uint(&xp, nput, value);
+#line 808
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 808
{
+#line 808
/* not fatal to the loop */
+#line 808
status = lstatus;
+#line 808
}
+#line 808
+#line 808
(void) ncio_rel(ncp->nciop, offset,
+#line 808
RGN_MODIFIED);
+#line 808
+#line 808
remaining -= extent;
+#line 808
if(remaining == 0)
+#line 808
break; /* normal loop exit */
+#line 808
offset += extent;
+#line 808
value += nput;
+#line 808
+#line 808
}
+#line 808
+#line 808
return status;
+#line 808
}
+#line 808
static int
+#line 809
putNCvx_uint_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 809
const size_t *start, size_t nelems, const ulonglong *value)
+#line 809
{
+#line 809
off_t offset = NC_varoffset(ncp, varp, start);
+#line 809
size_t remaining = varp->xsz * nelems;
+#line 809
int status = NC_NOERR;
+#line 809
void *xp;
+#line 809
+#line 809
if(nelems == 0)
+#line 809
return NC_NOERR;
+#line 809
+#line 809
assert(value != NULL);
+#line 809
+#line 809
for(;;)
+#line 809
{
+#line 809
size_t extent = MIN(remaining, ncp->chunk);
+#line 809
size_t nput = ncx_howmany(varp->type, extent);
+#line 809
+#line 809
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 809
RGN_WRITE, &xp);
+#line 809
if(lstatus != NC_NOERR)
+#line 809
return lstatus;
+#line 809
+#line 809
lstatus = ncx_putn_uint_ulonglong(&xp, nput, value);
+#line 809
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 809
{
+#line 809
/* not fatal to the loop */
+#line 809
status = lstatus;
+#line 809
}
+#line 809
+#line 809
(void) ncio_rel(ncp->nciop, offset,
+#line 809
RGN_MODIFIED);
+#line 809
+#line 809
remaining -= extent;
+#line 809
if(remaining == 0)
+#line 809
break; /* normal loop exit */
+#line 809
offset += extent;
+#line 809
value += nput;
+#line 809
+#line 809
}
+#line 809
+#line 809
return status;
+#line 809
}
+#line 809
static int
+#line 811
putNCvx_longlong_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 811
const size_t *start, size_t nelems, const schar *value)
+#line 811
{
+#line 811
off_t offset = NC_varoffset(ncp, varp, start);
+#line 811
size_t remaining = varp->xsz * nelems;
+#line 811
int status = NC_NOERR;
+#line 811
void *xp;
+#line 811
+#line 811
if(nelems == 0)
+#line 811
return NC_NOERR;
+#line 811
+#line 811
assert(value != NULL);
+#line 811
+#line 811
for(;;)
+#line 811
{
+#line 811
size_t extent = MIN(remaining, ncp->chunk);
+#line 811
size_t nput = ncx_howmany(varp->type, extent);
+#line 811
+#line 811
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 811
RGN_WRITE, &xp);
+#line 811
if(lstatus != NC_NOERR)
+#line 811
return lstatus;
+#line 811
+#line 811
lstatus = ncx_putn_longlong_schar(&xp, nput, value);
+#line 811
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 811
{
+#line 811
/* not fatal to the loop */
+#line 811
status = lstatus;
+#line 811
}
+#line 811
+#line 811
(void) ncio_rel(ncp->nciop, offset,
+#line 811
RGN_MODIFIED);
+#line 811
+#line 811
remaining -= extent;
+#line 811
if(remaining == 0)
+#line 811
break; /* normal loop exit */
+#line 811
offset += extent;
+#line 811
value += nput;
+#line 811
+#line 811
}
+#line 811
+#line 811
return status;
+#line 811
}
+#line 811
static int
+#line 812
putNCvx_longlong_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 812
const size_t *start, size_t nelems, const uchar *value)
+#line 812
{
+#line 812
off_t offset = NC_varoffset(ncp, varp, start);
+#line 812
size_t remaining = varp->xsz * nelems;
+#line 812
int status = NC_NOERR;
+#line 812
void *xp;
+#line 812
+#line 812
if(nelems == 0)
+#line 812
return NC_NOERR;
+#line 812
+#line 812
assert(value != NULL);
+#line 812
+#line 812
for(;;)
+#line 812
{
+#line 812
size_t extent = MIN(remaining, ncp->chunk);
+#line 812
size_t nput = ncx_howmany(varp->type, extent);
+#line 812
+#line 812
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 812
RGN_WRITE, &xp);
+#line 812
if(lstatus != NC_NOERR)
+#line 812
return lstatus;
+#line 812
+#line 812
lstatus = ncx_putn_longlong_uchar(&xp, nput, value);
+#line 812
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 812
{
+#line 812
/* not fatal to the loop */
+#line 812
status = lstatus;
+#line 812
}
+#line 812
+#line 812
(void) ncio_rel(ncp->nciop, offset,
+#line 812
RGN_MODIFIED);
+#line 812
+#line 812
remaining -= extent;
+#line 812
if(remaining == 0)
+#line 812
break; /* normal loop exit */
+#line 812
offset += extent;
+#line 812
value += nput;
+#line 812
+#line 812
}
+#line 812
+#line 812
return status;
+#line 812
}
+#line 812
static int
+#line 813
putNCvx_longlong_short(NC3_INFO* ncp, const NC_var *varp,
+#line 813
const size_t *start, size_t nelems, const short *value)
+#line 813
{
+#line 813
off_t offset = NC_varoffset(ncp, varp, start);
+#line 813
size_t remaining = varp->xsz * nelems;
+#line 813
int status = NC_NOERR;
+#line 813
void *xp;
+#line 813
+#line 813
if(nelems == 0)
+#line 813
return NC_NOERR;
+#line 813
+#line 813
assert(value != NULL);
+#line 813
+#line 813
for(;;)
+#line 813
{
+#line 813
size_t extent = MIN(remaining, ncp->chunk);
+#line 813
size_t nput = ncx_howmany(varp->type, extent);
+#line 813
+#line 813
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 813
RGN_WRITE, &xp);
+#line 813
if(lstatus != NC_NOERR)
+#line 813
return lstatus;
+#line 813
+#line 813
lstatus = ncx_putn_longlong_short(&xp, nput, value);
+#line 813
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 813
{
+#line 813
/* not fatal to the loop */
+#line 813
status = lstatus;
+#line 813
}
+#line 813
+#line 813
(void) ncio_rel(ncp->nciop, offset,
+#line 813
RGN_MODIFIED);
+#line 813
+#line 813
remaining -= extent;
+#line 813
if(remaining == 0)
+#line 813
break; /* normal loop exit */
+#line 813
offset += extent;
+#line 813
value += nput;
+#line 813
+#line 813
}
+#line 813
+#line 813
return status;
+#line 813
}
+#line 813
static int
+#line 814
putNCvx_longlong_int(NC3_INFO* ncp, const NC_var *varp,
+#line 814
const size_t *start, size_t nelems, const int *value)
+#line 814
{
+#line 814
off_t offset = NC_varoffset(ncp, varp, start);
+#line 814
size_t remaining = varp->xsz * nelems;
+#line 814
int status = NC_NOERR;
+#line 814
void *xp;
+#line 814
+#line 814
if(nelems == 0)
+#line 814
return NC_NOERR;
+#line 814
+#line 814
assert(value != NULL);
+#line 814
+#line 814
for(;;)
+#line 814
{
+#line 814
size_t extent = MIN(remaining, ncp->chunk);
+#line 814
size_t nput = ncx_howmany(varp->type, extent);
+#line 814
+#line 814
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 814
RGN_WRITE, &xp);
+#line 814
if(lstatus != NC_NOERR)
+#line 814
return lstatus;
+#line 814
+#line 814
lstatus = ncx_putn_longlong_int(&xp, nput, value);
+#line 814
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 814
{
+#line 814
/* not fatal to the loop */
+#line 814
status = lstatus;
+#line 814
}
+#line 814
+#line 814
(void) ncio_rel(ncp->nciop, offset,
+#line 814
RGN_MODIFIED);
+#line 814
+#line 814
remaining -= extent;
+#line 814
if(remaining == 0)
+#line 814
break; /* normal loop exit */
+#line 814
offset += extent;
+#line 814
value += nput;
+#line 814
+#line 814
}
+#line 814
+#line 814
return status;
+#line 814
}
+#line 814
static int
+#line 815
putNCvx_longlong_float(NC3_INFO* ncp, const NC_var *varp,
+#line 815
const size_t *start, size_t nelems, const float *value)
+#line 815
{
+#line 815
off_t offset = NC_varoffset(ncp, varp, start);
+#line 815
size_t remaining = varp->xsz * nelems;
+#line 815
int status = NC_NOERR;
+#line 815
void *xp;
+#line 815
+#line 815
if(nelems == 0)
+#line 815
return NC_NOERR;
+#line 815
+#line 815
assert(value != NULL);
+#line 815
+#line 815
for(;;)
+#line 815
{
+#line 815
size_t extent = MIN(remaining, ncp->chunk);
+#line 815
size_t nput = ncx_howmany(varp->type, extent);
+#line 815
+#line 815
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 815
RGN_WRITE, &xp);
+#line 815
if(lstatus != NC_NOERR)
+#line 815
return lstatus;
+#line 815
+#line 815
lstatus = ncx_putn_longlong_float(&xp, nput, value);
+#line 815
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 815
{
+#line 815
/* not fatal to the loop */
+#line 815
status = lstatus;
+#line 815
}
+#line 815
+#line 815
(void) ncio_rel(ncp->nciop, offset,
+#line 815
RGN_MODIFIED);
+#line 815
+#line 815
remaining -= extent;
+#line 815
if(remaining == 0)
+#line 815
break; /* normal loop exit */
+#line 815
offset += extent;
+#line 815
value += nput;
+#line 815
+#line 815
}
+#line 815
+#line 815
return status;
+#line 815
}
+#line 815
static int
+#line 816
putNCvx_longlong_double(NC3_INFO* ncp, const NC_var *varp,
+#line 816
const size_t *start, size_t nelems, const double *value)
+#line 816
{
+#line 816
off_t offset = NC_varoffset(ncp, varp, start);
+#line 816
size_t remaining = varp->xsz * nelems;
+#line 816
int status = NC_NOERR;
+#line 816
void *xp;
+#line 816
+#line 816
if(nelems == 0)
+#line 816
return NC_NOERR;
+#line 816
+#line 816
assert(value != NULL);
+#line 816
+#line 816
for(;;)
+#line 816
{
+#line 816
size_t extent = MIN(remaining, ncp->chunk);
+#line 816
size_t nput = ncx_howmany(varp->type, extent);
+#line 816
+#line 816
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 816
RGN_WRITE, &xp);
+#line 816
if(lstatus != NC_NOERR)
+#line 816
return lstatus;
+#line 816
+#line 816
lstatus = ncx_putn_longlong_double(&xp, nput, value);
+#line 816
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 816
{
+#line 816
/* not fatal to the loop */
+#line 816
status = lstatus;
+#line 816
}
+#line 816
+#line 816
(void) ncio_rel(ncp->nciop, offset,
+#line 816
RGN_MODIFIED);
+#line 816
+#line 816
remaining -= extent;
+#line 816
if(remaining == 0)
+#line 816
break; /* normal loop exit */
+#line 816
offset += extent;
+#line 816
value += nput;
+#line 816
+#line 816
}
+#line 816
+#line 816
return status;
+#line 816
}
+#line 816
static int
+#line 817
putNCvx_longlong_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 817
const size_t *start, size_t nelems, const longlong *value)
+#line 817
{
+#line 817
off_t offset = NC_varoffset(ncp, varp, start);
+#line 817
size_t remaining = varp->xsz * nelems;
+#line 817
int status = NC_NOERR;
+#line 817
void *xp;
+#line 817
+#line 817
if(nelems == 0)
+#line 817
return NC_NOERR;
+#line 817
+#line 817
assert(value != NULL);
+#line 817
+#line 817
for(;;)
+#line 817
{
+#line 817
size_t extent = MIN(remaining, ncp->chunk);
+#line 817
size_t nput = ncx_howmany(varp->type, extent);
+#line 817
+#line 817
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 817
RGN_WRITE, &xp);
+#line 817
if(lstatus != NC_NOERR)
+#line 817
return lstatus;
+#line 817
+#line 817
lstatus = ncx_putn_longlong_longlong(&xp, nput, value);
+#line 817
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 817
{
+#line 817
/* not fatal to the loop */
+#line 817
status = lstatus;
+#line 817
}
+#line 817
+#line 817
(void) ncio_rel(ncp->nciop, offset,
+#line 817
RGN_MODIFIED);
+#line 817
+#line 817
remaining -= extent;
+#line 817
if(remaining == 0)
+#line 817
break; /* normal loop exit */
+#line 817
offset += extent;
+#line 817
value += nput;
+#line 817
+#line 817
}
+#line 817
+#line 817
return status;
+#line 817
}
+#line 817
static int
+#line 818
putNCvx_longlong_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 818
const size_t *start, size_t nelems, const ushort *value)
+#line 818
{
+#line 818
off_t offset = NC_varoffset(ncp, varp, start);
+#line 818
size_t remaining = varp->xsz * nelems;
+#line 818
int status = NC_NOERR;
+#line 818
void *xp;
+#line 818
+#line 818
if(nelems == 0)
+#line 818
return NC_NOERR;
+#line 818
+#line 818
assert(value != NULL);
+#line 818
+#line 818
for(;;)
+#line 818
{
+#line 818
size_t extent = MIN(remaining, ncp->chunk);
+#line 818
size_t nput = ncx_howmany(varp->type, extent);
+#line 818
+#line 818
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 818
RGN_WRITE, &xp);
+#line 818
if(lstatus != NC_NOERR)
+#line 818
return lstatus;
+#line 818
+#line 818
lstatus = ncx_putn_longlong_ushort(&xp, nput, value);
+#line 818
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 818
{
+#line 818
/* not fatal to the loop */
+#line 818
status = lstatus;
+#line 818
}
+#line 818
+#line 818
(void) ncio_rel(ncp->nciop, offset,
+#line 818
RGN_MODIFIED);
+#line 818
+#line 818
remaining -= extent;
+#line 818
if(remaining == 0)
+#line 818
break; /* normal loop exit */
+#line 818
offset += extent;
+#line 818
value += nput;
+#line 818
+#line 818
}
+#line 818
+#line 818
return status;
+#line 818
}
+#line 818
static int
+#line 819
putNCvx_longlong_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 819
const size_t *start, size_t nelems, const uint *value)
+#line 819
{
+#line 819
off_t offset = NC_varoffset(ncp, varp, start);
+#line 819
size_t remaining = varp->xsz * nelems;
+#line 819
int status = NC_NOERR;
+#line 819
void *xp;
+#line 819
+#line 819
if(nelems == 0)
+#line 819
return NC_NOERR;
+#line 819
+#line 819
assert(value != NULL);
+#line 819
+#line 819
for(;;)
+#line 819
{
+#line 819
size_t extent = MIN(remaining, ncp->chunk);
+#line 819
size_t nput = ncx_howmany(varp->type, extent);
+#line 819
+#line 819
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 819
RGN_WRITE, &xp);
+#line 819
if(lstatus != NC_NOERR)
+#line 819
return lstatus;
+#line 819
+#line 819
lstatus = ncx_putn_longlong_uint(&xp, nput, value);
+#line 819
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 819
{
+#line 819
/* not fatal to the loop */
+#line 819
status = lstatus;
+#line 819
}
+#line 819
+#line 819
(void) ncio_rel(ncp->nciop, offset,
+#line 819
RGN_MODIFIED);
+#line 819
+#line 819
remaining -= extent;
+#line 819
if(remaining == 0)
+#line 819
break; /* normal loop exit */
+#line 819
offset += extent;
+#line 819
value += nput;
+#line 819
+#line 819
}
+#line 819
+#line 819
return status;
+#line 819
}
+#line 819
static int
+#line 820
putNCvx_longlong_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 820
const size_t *start, size_t nelems, const ulonglong *value)
+#line 820
{
+#line 820
off_t offset = NC_varoffset(ncp, varp, start);
+#line 820
size_t remaining = varp->xsz * nelems;
+#line 820
int status = NC_NOERR;
+#line 820
void *xp;
+#line 820
+#line 820
if(nelems == 0)
+#line 820
return NC_NOERR;
+#line 820
+#line 820
assert(value != NULL);
+#line 820
+#line 820
for(;;)
+#line 820
{
+#line 820
size_t extent = MIN(remaining, ncp->chunk);
+#line 820
size_t nput = ncx_howmany(varp->type, extent);
+#line 820
+#line 820
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 820
RGN_WRITE, &xp);
+#line 820
if(lstatus != NC_NOERR)
+#line 820
return lstatus;
+#line 820
+#line 820
lstatus = ncx_putn_longlong_ulonglong(&xp, nput, value);
+#line 820
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 820
{
+#line 820
/* not fatal to the loop */
+#line 820
status = lstatus;
+#line 820
}
+#line 820
+#line 820
(void) ncio_rel(ncp->nciop, offset,
+#line 820
RGN_MODIFIED);
+#line 820
+#line 820
remaining -= extent;
+#line 820
if(remaining == 0)
+#line 820
break; /* normal loop exit */
+#line 820
offset += extent;
+#line 820
value += nput;
+#line 820
+#line 820
}
+#line 820
+#line 820
return status;
+#line 820
}
+#line 820
static int
+#line 822
putNCvx_ulonglong_schar(NC3_INFO* ncp, const NC_var *varp,
+#line 822
const size_t *start, size_t nelems, const schar *value)
+#line 822
{
+#line 822
off_t offset = NC_varoffset(ncp, varp, start);
+#line 822
size_t remaining = varp->xsz * nelems;
+#line 822
int status = NC_NOERR;
+#line 822
void *xp;
+#line 822
+#line 822
if(nelems == 0)
+#line 822
return NC_NOERR;
+#line 822
+#line 822
assert(value != NULL);
+#line 822
+#line 822
for(;;)
+#line 822
{
+#line 822
size_t extent = MIN(remaining, ncp->chunk);
+#line 822
size_t nput = ncx_howmany(varp->type, extent);
+#line 822
+#line 822
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 822
RGN_WRITE, &xp);
+#line 822
if(lstatus != NC_NOERR)
+#line 822
return lstatus;
+#line 822
+#line 822
lstatus = ncx_putn_ulonglong_schar(&xp, nput, value);
+#line 822
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 822
{
+#line 822
/* not fatal to the loop */
+#line 822
status = lstatus;
+#line 822
}
+#line 822
+#line 822
(void) ncio_rel(ncp->nciop, offset,
+#line 822
RGN_MODIFIED);
+#line 822
+#line 822
remaining -= extent;
+#line 822
if(remaining == 0)
+#line 822
break; /* normal loop exit */
+#line 822
offset += extent;
+#line 822
value += nput;
+#line 822
+#line 822
}
+#line 822
+#line 822
return status;
+#line 822
}
+#line 822
static int
+#line 823
putNCvx_ulonglong_uchar(NC3_INFO* ncp, const NC_var *varp,
+#line 823
const size_t *start, size_t nelems, const uchar *value)
+#line 823
{
+#line 823
off_t offset = NC_varoffset(ncp, varp, start);
+#line 823
size_t remaining = varp->xsz * nelems;
+#line 823
int status = NC_NOERR;
+#line 823
void *xp;
+#line 823
+#line 823
if(nelems == 0)
+#line 823
return NC_NOERR;
+#line 823
+#line 823
assert(value != NULL);
+#line 823
+#line 823
for(;;)
+#line 823
{
+#line 823
size_t extent = MIN(remaining, ncp->chunk);
+#line 823
size_t nput = ncx_howmany(varp->type, extent);
+#line 823
+#line 823
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 823
RGN_WRITE, &xp);
+#line 823
if(lstatus != NC_NOERR)
+#line 823
return lstatus;
+#line 823
+#line 823
lstatus = ncx_putn_ulonglong_uchar(&xp, nput, value);
+#line 823
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 823
{
+#line 823
/* not fatal to the loop */
+#line 823
status = lstatus;
+#line 823
}
+#line 823
+#line 823
(void) ncio_rel(ncp->nciop, offset,
+#line 823
RGN_MODIFIED);
+#line 823
+#line 823
remaining -= extent;
+#line 823
if(remaining == 0)
+#line 823
break; /* normal loop exit */
+#line 823
offset += extent;
+#line 823
value += nput;
+#line 823
+#line 823
}
+#line 823
+#line 823
return status;
+#line 823
}
+#line 823
static int
+#line 824
putNCvx_ulonglong_short(NC3_INFO* ncp, const NC_var *varp,
+#line 824
const size_t *start, size_t nelems, const short *value)
+#line 824
{
+#line 824
off_t offset = NC_varoffset(ncp, varp, start);
+#line 824
size_t remaining = varp->xsz * nelems;
+#line 824
int status = NC_NOERR;
+#line 824
void *xp;
+#line 824
+#line 824
if(nelems == 0)
+#line 824
return NC_NOERR;
+#line 824
+#line 824
assert(value != NULL);
+#line 824
+#line 824
for(;;)
+#line 824
{
+#line 824
size_t extent = MIN(remaining, ncp->chunk);
+#line 824
size_t nput = ncx_howmany(varp->type, extent);
+#line 824
+#line 824
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 824
RGN_WRITE, &xp);
+#line 824
if(lstatus != NC_NOERR)
+#line 824
return lstatus;
+#line 824
+#line 824
lstatus = ncx_putn_ulonglong_short(&xp, nput, value);
+#line 824
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 824
{
+#line 824
/* not fatal to the loop */
+#line 824
status = lstatus;
+#line 824
}
+#line 824
+#line 824
(void) ncio_rel(ncp->nciop, offset,
+#line 824
RGN_MODIFIED);
+#line 824
+#line 824
remaining -= extent;
+#line 824
if(remaining == 0)
+#line 824
break; /* normal loop exit */
+#line 824
offset += extent;
+#line 824
value += nput;
+#line 824
+#line 824
}
+#line 824
+#line 824
return status;
+#line 824
}
+#line 824
static int
+#line 825
putNCvx_ulonglong_int(NC3_INFO* ncp, const NC_var *varp,
+#line 825
const size_t *start, size_t nelems, const int *value)
+#line 825
{
+#line 825
off_t offset = NC_varoffset(ncp, varp, start);
+#line 825
size_t remaining = varp->xsz * nelems;
+#line 825
int status = NC_NOERR;
+#line 825
void *xp;
+#line 825
+#line 825
if(nelems == 0)
+#line 825
return NC_NOERR;
+#line 825
+#line 825
assert(value != NULL);
+#line 825
+#line 825
for(;;)
+#line 825
{
+#line 825
size_t extent = MIN(remaining, ncp->chunk);
+#line 825
size_t nput = ncx_howmany(varp->type, extent);
+#line 825
+#line 825
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 825
RGN_WRITE, &xp);
+#line 825
if(lstatus != NC_NOERR)
+#line 825
return lstatus;
+#line 825
+#line 825
lstatus = ncx_putn_ulonglong_int(&xp, nput, value);
+#line 825
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 825
{
+#line 825
/* not fatal to the loop */
+#line 825
status = lstatus;
+#line 825
}
+#line 825
+#line 825
(void) ncio_rel(ncp->nciop, offset,
+#line 825
RGN_MODIFIED);
+#line 825
+#line 825
remaining -= extent;
+#line 825
if(remaining == 0)
+#line 825
break; /* normal loop exit */
+#line 825
offset += extent;
+#line 825
value += nput;
+#line 825
+#line 825
}
+#line 825
+#line 825
return status;
+#line 825
}
+#line 825
static int
+#line 826
putNCvx_ulonglong_float(NC3_INFO* ncp, const NC_var *varp,
+#line 826
const size_t *start, size_t nelems, const float *value)
+#line 826
{
+#line 826
off_t offset = NC_varoffset(ncp, varp, start);
+#line 826
size_t remaining = varp->xsz * nelems;
+#line 826
int status = NC_NOERR;
+#line 826
void *xp;
+#line 826
+#line 826
if(nelems == 0)
+#line 826
return NC_NOERR;
+#line 826
+#line 826
assert(value != NULL);
+#line 826
+#line 826
for(;;)
+#line 826
{
+#line 826
size_t extent = MIN(remaining, ncp->chunk);
+#line 826
size_t nput = ncx_howmany(varp->type, extent);
+#line 826
+#line 826
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 826
RGN_WRITE, &xp);
+#line 826
if(lstatus != NC_NOERR)
+#line 826
return lstatus;
+#line 826
+#line 826
lstatus = ncx_putn_ulonglong_float(&xp, nput, value);
+#line 826
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 826
{
+#line 826
/* not fatal to the loop */
+#line 826
status = lstatus;
+#line 826
}
+#line 826
+#line 826
(void) ncio_rel(ncp->nciop, offset,
+#line 826
RGN_MODIFIED);
+#line 826
+#line 826
remaining -= extent;
+#line 826
if(remaining == 0)
+#line 826
break; /* normal loop exit */
+#line 826
offset += extent;
+#line 826
value += nput;
+#line 826
+#line 826
}
+#line 826
+#line 826
return status;
+#line 826
}
+#line 826
static int
+#line 827
putNCvx_ulonglong_double(NC3_INFO* ncp, const NC_var *varp,
+#line 827
const size_t *start, size_t nelems, const double *value)
+#line 827
{
+#line 827
off_t offset = NC_varoffset(ncp, varp, start);
+#line 827
size_t remaining = varp->xsz * nelems;
+#line 827
int status = NC_NOERR;
+#line 827
void *xp;
+#line 827
+#line 827
if(nelems == 0)
+#line 827
return NC_NOERR;
+#line 827
+#line 827
assert(value != NULL);
+#line 827
+#line 827
for(;;)
+#line 827
{
+#line 827
size_t extent = MIN(remaining, ncp->chunk);
+#line 827
size_t nput = ncx_howmany(varp->type, extent);
+#line 827
+#line 827
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 827
RGN_WRITE, &xp);
+#line 827
if(lstatus != NC_NOERR)
+#line 827
return lstatus;
+#line 827
+#line 827
lstatus = ncx_putn_ulonglong_double(&xp, nput, value);
+#line 827
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 827
{
+#line 827
/* not fatal to the loop */
+#line 827
status = lstatus;
+#line 827
}
+#line 827
+#line 827
(void) ncio_rel(ncp->nciop, offset,
+#line 827
RGN_MODIFIED);
+#line 827
+#line 827
remaining -= extent;
+#line 827
if(remaining == 0)
+#line 827
break; /* normal loop exit */
+#line 827
offset += extent;
+#line 827
value += nput;
+#line 827
+#line 827
}
+#line 827
+#line 827
return status;
+#line 827
}
+#line 827
static int
+#line 828
putNCvx_ulonglong_longlong(NC3_INFO* ncp, const NC_var *varp,
+#line 828
const size_t *start, size_t nelems, const longlong *value)
+#line 828
{
+#line 828
off_t offset = NC_varoffset(ncp, varp, start);
+#line 828
size_t remaining = varp->xsz * nelems;
+#line 828
int status = NC_NOERR;
+#line 828
void *xp;
+#line 828
+#line 828
if(nelems == 0)
+#line 828
return NC_NOERR;
+#line 828
+#line 828
assert(value != NULL);
+#line 828
+#line 828
for(;;)
+#line 828
{
+#line 828
size_t extent = MIN(remaining, ncp->chunk);
+#line 828
size_t nput = ncx_howmany(varp->type, extent);
+#line 828
+#line 828
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 828
RGN_WRITE, &xp);
+#line 828
if(lstatus != NC_NOERR)
+#line 828
return lstatus;
+#line 828
+#line 828
lstatus = ncx_putn_ulonglong_longlong(&xp, nput, value);
+#line 828
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 828
{
+#line 828
/* not fatal to the loop */
+#line 828
status = lstatus;
+#line 828
}
+#line 828
+#line 828
(void) ncio_rel(ncp->nciop, offset,
+#line 828
RGN_MODIFIED);
+#line 828
+#line 828
remaining -= extent;
+#line 828
if(remaining == 0)
+#line 828
break; /* normal loop exit */
+#line 828
offset += extent;
+#line 828
value += nput;
+#line 828
+#line 828
}
+#line 828
+#line 828
return status;
+#line 828
}
+#line 828
static int
+#line 829
putNCvx_ulonglong_ushort(NC3_INFO* ncp, const NC_var *varp,
+#line 829
const size_t *start, size_t nelems, const ushort *value)
+#line 829
{
+#line 829
off_t offset = NC_varoffset(ncp, varp, start);
+#line 829
size_t remaining = varp->xsz * nelems;
+#line 829
int status = NC_NOERR;
+#line 829
void *xp;
+#line 829
+#line 829
if(nelems == 0)
+#line 829
return NC_NOERR;
+#line 829
+#line 829
assert(value != NULL);
+#line 829
+#line 829
for(;;)
+#line 829
{
+#line 829
size_t extent = MIN(remaining, ncp->chunk);
+#line 829
size_t nput = ncx_howmany(varp->type, extent);
+#line 829
+#line 829
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 829
RGN_WRITE, &xp);
+#line 829
if(lstatus != NC_NOERR)
+#line 829
return lstatus;
+#line 829
+#line 829
lstatus = ncx_putn_ulonglong_ushort(&xp, nput, value);
+#line 829
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 829
{
+#line 829
/* not fatal to the loop */
+#line 829
status = lstatus;
+#line 829
}
+#line 829
+#line 829
(void) ncio_rel(ncp->nciop, offset,
+#line 829
RGN_MODIFIED);
+#line 829
+#line 829
remaining -= extent;
+#line 829
if(remaining == 0)
+#line 829
break; /* normal loop exit */
+#line 829
offset += extent;
+#line 829
value += nput;
+#line 829
+#line 829
}
+#line 829
+#line 829
return status;
+#line 829
}
+#line 829
static int
+#line 830
putNCvx_ulonglong_uint(NC3_INFO* ncp, const NC_var *varp,
+#line 830
const size_t *start, size_t nelems, const uint *value)
+#line 830
{
+#line 830
off_t offset = NC_varoffset(ncp, varp, start);
+#line 830
size_t remaining = varp->xsz * nelems;
+#line 830
int status = NC_NOERR;
+#line 830
void *xp;
+#line 830
+#line 830
if(nelems == 0)
+#line 830
return NC_NOERR;
+#line 830
+#line 830
assert(value != NULL);
+#line 830
+#line 830
for(;;)
+#line 830
{
+#line 830
size_t extent = MIN(remaining, ncp->chunk);
+#line 830
size_t nput = ncx_howmany(varp->type, extent);
+#line 830
+#line 830
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 830
RGN_WRITE, &xp);
+#line 830
if(lstatus != NC_NOERR)
+#line 830
return lstatus;
+#line 830
+#line 830
lstatus = ncx_putn_ulonglong_uint(&xp, nput, value);
+#line 830
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 830
{
+#line 830
/* not fatal to the loop */
+#line 830
status = lstatus;
+#line 830
}
+#line 830
+#line 830
(void) ncio_rel(ncp->nciop, offset,
+#line 830
RGN_MODIFIED);
+#line 830
+#line 830
remaining -= extent;
+#line 830
if(remaining == 0)
+#line 830
break; /* normal loop exit */
+#line 830
offset += extent;
+#line 830
value += nput;
+#line 830
+#line 830
}
+#line 830
+#line 830
return status;
+#line 830
}
+#line 830
static int
+#line 831
putNCvx_ulonglong_ulonglong(NC3_INFO* ncp, const NC_var *varp,
+#line 831
const size_t *start, size_t nelems, const ulonglong *value)
+#line 831
{
+#line 831
off_t offset = NC_varoffset(ncp, varp, start);
+#line 831
size_t remaining = varp->xsz * nelems;
+#line 831
int status = NC_NOERR;
+#line 831
void *xp;
+#line 831
+#line 831
if(nelems == 0)
+#line 831
return NC_NOERR;
+#line 831
+#line 831
assert(value != NULL);
+#line 831
+#line 831
for(;;)
+#line 831
{
+#line 831
size_t extent = MIN(remaining, ncp->chunk);
+#line 831
size_t nput = ncx_howmany(varp->type, extent);
+#line 831
+#line 831
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 831
RGN_WRITE, &xp);
+#line 831
if(lstatus != NC_NOERR)
+#line 831
return lstatus;
+#line 831
+#line 831
lstatus = ncx_putn_ulonglong_ulonglong(&xp, nput, value);
+#line 831
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 831
{
+#line 831
/* not fatal to the loop */
+#line 831
status = lstatus;
+#line 831
}
+#line 831
+#line 831
(void) ncio_rel(ncp->nciop, offset,
+#line 831
RGN_MODIFIED);
+#line 831
+#line 831
remaining -= extent;
+#line 831
if(remaining == 0)
+#line 831
break; /* normal loop exit */
+#line 831
offset += extent;
+#line 831
value += nput;
+#line 831
+#line 831
}
+#line 831
+#line 831
return status;
+#line 831
}
+#line 831
+#line 878
static int
+#line 879
getNCvx_char_char(const NC3_INFO* ncp, const NC_var *varp,
+#line 879
const size_t *start, size_t nelems, char *value)
+#line 879
{
+#line 879
off_t offset = NC_varoffset(ncp, varp, start);
+#line 879
size_t remaining = varp->xsz * nelems;
+#line 879
int status = NC_NOERR;
+#line 879
const void *xp;
+#line 879
+#line 879
if(nelems == 0)
+#line 879
return NC_NOERR;
+#line 879
+#line 879
assert(value != NULL);
+#line 879
+#line 879
for(;;)
+#line 879
{
+#line 879
size_t extent = MIN(remaining, ncp->chunk);
+#line 879
size_t nget = ncx_howmany(varp->type, extent);
+#line 879
+#line 879
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 879
0, (void **)&xp); /* cast away const */
+#line 879
if(lstatus != NC_NOERR)
+#line 879
return lstatus;
+#line 879
+#line 879
lstatus = ncx_getn_char_char(&xp, nget, value);
+#line 879
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 879
status = lstatus;
+#line 879
+#line 879
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 879
+#line 879
remaining -= extent;
+#line 879
if(remaining == 0)
+#line 879
break; /* normal loop exit */
+#line 879
offset += extent;
+#line 879
value += nget;
+#line 879
}
+#line 879
+#line 879
return status;
+#line 879
}
+#line 879
static int
+#line 881
getNCvx_schar_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 881
const size_t *start, size_t nelems, schar *value)
+#line 881
{
+#line 881
off_t offset = NC_varoffset(ncp, varp, start);
+#line 881
size_t remaining = varp->xsz * nelems;
+#line 881
int status = NC_NOERR;
+#line 881
const void *xp;
+#line 881
+#line 881
if(nelems == 0)
+#line 881
return NC_NOERR;
+#line 881
+#line 881
assert(value != NULL);
+#line 881
+#line 881
for(;;)
+#line 881
{
+#line 881
size_t extent = MIN(remaining, ncp->chunk);
+#line 881
size_t nget = ncx_howmany(varp->type, extent);
+#line 881
+#line 881
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 881
0, (void **)&xp); /* cast away const */
+#line 881
if(lstatus != NC_NOERR)
+#line 881
return lstatus;
+#line 881
+#line 881
lstatus = ncx_getn_schar_schar(&xp, nget, value);
+#line 881
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 881
status = lstatus;
+#line 881
+#line 881
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 881
+#line 881
remaining -= extent;
+#line 881
if(remaining == 0)
+#line 881
break; /* normal loop exit */
+#line 881
offset += extent;
+#line 881
value += nget;
+#line 881
}
+#line 881
+#line 881
return status;
+#line 881
}
+#line 881
static int
+#line 882
getNCvx_schar_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 882
const size_t *start, size_t nelems, short *value)
+#line 882
{
+#line 882
off_t offset = NC_varoffset(ncp, varp, start);
+#line 882
size_t remaining = varp->xsz * nelems;
+#line 882
int status = NC_NOERR;
+#line 882
const void *xp;
+#line 882
+#line 882
if(nelems == 0)
+#line 882
return NC_NOERR;
+#line 882
+#line 882
assert(value != NULL);
+#line 882
+#line 882
for(;;)
+#line 882
{
+#line 882
size_t extent = MIN(remaining, ncp->chunk);
+#line 882
size_t nget = ncx_howmany(varp->type, extent);
+#line 882
+#line 882
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 882
0, (void **)&xp); /* cast away const */
+#line 882
if(lstatus != NC_NOERR)
+#line 882
return lstatus;
+#line 882
+#line 882
lstatus = ncx_getn_schar_short(&xp, nget, value);
+#line 882
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 882
status = lstatus;
+#line 882
+#line 882
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 882
+#line 882
remaining -= extent;
+#line 882
if(remaining == 0)
+#line 882
break; /* normal loop exit */
+#line 882
offset += extent;
+#line 882
value += nget;
+#line 882
}
+#line 882
+#line 882
return status;
+#line 882
}
+#line 882
static int
+#line 883
getNCvx_schar_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 883
const size_t *start, size_t nelems, int *value)
+#line 883
{
+#line 883
off_t offset = NC_varoffset(ncp, varp, start);
+#line 883
size_t remaining = varp->xsz * nelems;
+#line 883
int status = NC_NOERR;
+#line 883
const void *xp;
+#line 883
+#line 883
if(nelems == 0)
+#line 883
return NC_NOERR;
+#line 883
+#line 883
assert(value != NULL);
+#line 883
+#line 883
for(;;)
+#line 883
{
+#line 883
size_t extent = MIN(remaining, ncp->chunk);
+#line 883
size_t nget = ncx_howmany(varp->type, extent);
+#line 883
+#line 883
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 883
0, (void **)&xp); /* cast away const */
+#line 883
if(lstatus != NC_NOERR)
+#line 883
return lstatus;
+#line 883
+#line 883
lstatus = ncx_getn_schar_int(&xp, nget, value);
+#line 883
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 883
status = lstatus;
+#line 883
+#line 883
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 883
+#line 883
remaining -= extent;
+#line 883
if(remaining == 0)
+#line 883
break; /* normal loop exit */
+#line 883
offset += extent;
+#line 883
value += nget;
+#line 883
}
+#line 883
+#line 883
return status;
+#line 883
}
+#line 883
static int
+#line 884
getNCvx_schar_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 884
const size_t *start, size_t nelems, float *value)
+#line 884
{
+#line 884
off_t offset = NC_varoffset(ncp, varp, start);
+#line 884
size_t remaining = varp->xsz * nelems;
+#line 884
int status = NC_NOERR;
+#line 884
const void *xp;
+#line 884
+#line 884
if(nelems == 0)
+#line 884
return NC_NOERR;
+#line 884
+#line 884
assert(value != NULL);
+#line 884
+#line 884
for(;;)
+#line 884
{
+#line 884
size_t extent = MIN(remaining, ncp->chunk);
+#line 884
size_t nget = ncx_howmany(varp->type, extent);
+#line 884
+#line 884
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 884
0, (void **)&xp); /* cast away const */
+#line 884
if(lstatus != NC_NOERR)
+#line 884
return lstatus;
+#line 884
+#line 884
lstatus = ncx_getn_schar_float(&xp, nget, value);
+#line 884
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 884
status = lstatus;
+#line 884
+#line 884
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 884
+#line 884
remaining -= extent;
+#line 884
if(remaining == 0)
+#line 884
break; /* normal loop exit */
+#line 884
offset += extent;
+#line 884
value += nget;
+#line 884
}
+#line 884
+#line 884
return status;
+#line 884
}
+#line 884
static int
+#line 885
getNCvx_schar_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 885
const size_t *start, size_t nelems, double *value)
+#line 885
{
+#line 885
off_t offset = NC_varoffset(ncp, varp, start);
+#line 885
size_t remaining = varp->xsz * nelems;
+#line 885
int status = NC_NOERR;
+#line 885
const void *xp;
+#line 885
+#line 885
if(nelems == 0)
+#line 885
return NC_NOERR;
+#line 885
+#line 885
assert(value != NULL);
+#line 885
+#line 885
for(;;)
+#line 885
{
+#line 885
size_t extent = MIN(remaining, ncp->chunk);
+#line 885
size_t nget = ncx_howmany(varp->type, extent);
+#line 885
+#line 885
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 885
0, (void **)&xp); /* cast away const */
+#line 885
if(lstatus != NC_NOERR)
+#line 885
return lstatus;
+#line 885
+#line 885
lstatus = ncx_getn_schar_double(&xp, nget, value);
+#line 885
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 885
status = lstatus;
+#line 885
+#line 885
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 885
+#line 885
remaining -= extent;
+#line 885
if(remaining == 0)
+#line 885
break; /* normal loop exit */
+#line 885
offset += extent;
+#line 885
value += nget;
+#line 885
}
+#line 885
+#line 885
return status;
+#line 885
}
+#line 885
static int
+#line 886
getNCvx_schar_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 886
const size_t *start, size_t nelems, longlong *value)
+#line 886
{
+#line 886
off_t offset = NC_varoffset(ncp, varp, start);
+#line 886
size_t remaining = varp->xsz * nelems;
+#line 886
int status = NC_NOERR;
+#line 886
const void *xp;
+#line 886
+#line 886
if(nelems == 0)
+#line 886
return NC_NOERR;
+#line 886
+#line 886
assert(value != NULL);
+#line 886
+#line 886
for(;;)
+#line 886
{
+#line 886
size_t extent = MIN(remaining, ncp->chunk);
+#line 886
size_t nget = ncx_howmany(varp->type, extent);
+#line 886
+#line 886
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 886
0, (void **)&xp); /* cast away const */
+#line 886
if(lstatus != NC_NOERR)
+#line 886
return lstatus;
+#line 886
+#line 886
lstatus = ncx_getn_schar_longlong(&xp, nget, value);
+#line 886
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 886
status = lstatus;
+#line 886
+#line 886
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 886
+#line 886
remaining -= extent;
+#line 886
if(remaining == 0)
+#line 886
break; /* normal loop exit */
+#line 886
offset += extent;
+#line 886
value += nget;
+#line 886
}
+#line 886
+#line 886
return status;
+#line 886
}
+#line 886
static int
+#line 887
getNCvx_schar_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 887
const size_t *start, size_t nelems, uint *value)
+#line 887
{
+#line 887
off_t offset = NC_varoffset(ncp, varp, start);
+#line 887
size_t remaining = varp->xsz * nelems;
+#line 887
int status = NC_NOERR;
+#line 887
const void *xp;
+#line 887
+#line 887
if(nelems == 0)
+#line 887
return NC_NOERR;
+#line 887
+#line 887
assert(value != NULL);
+#line 887
+#line 887
for(;;)
+#line 887
{
+#line 887
size_t extent = MIN(remaining, ncp->chunk);
+#line 887
size_t nget = ncx_howmany(varp->type, extent);
+#line 887
+#line 887
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 887
0, (void **)&xp); /* cast away const */
+#line 887
if(lstatus != NC_NOERR)
+#line 887
return lstatus;
+#line 887
+#line 887
lstatus = ncx_getn_schar_uint(&xp, nget, value);
+#line 887
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 887
status = lstatus;
+#line 887
+#line 887
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 887
+#line 887
remaining -= extent;
+#line 887
if(remaining == 0)
+#line 887
break; /* normal loop exit */
+#line 887
offset += extent;
+#line 887
value += nget;
+#line 887
}
+#line 887
+#line 887
return status;
+#line 887
}
+#line 887
static int
+#line 888
getNCvx_schar_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 888
const size_t *start, size_t nelems, ulonglong *value)
+#line 888
{
+#line 888
off_t offset = NC_varoffset(ncp, varp, start);
+#line 888
size_t remaining = varp->xsz * nelems;
+#line 888
int status = NC_NOERR;
+#line 888
const void *xp;
+#line 888
+#line 888
if(nelems == 0)
+#line 888
return NC_NOERR;
+#line 888
+#line 888
assert(value != NULL);
+#line 888
+#line 888
for(;;)
+#line 888
{
+#line 888
size_t extent = MIN(remaining, ncp->chunk);
+#line 888
size_t nget = ncx_howmany(varp->type, extent);
+#line 888
+#line 888
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 888
0, (void **)&xp); /* cast away const */
+#line 888
if(lstatus != NC_NOERR)
+#line 888
return lstatus;
+#line 888
+#line 888
lstatus = ncx_getn_schar_ulonglong(&xp, nget, value);
+#line 888
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 888
status = lstatus;
+#line 888
+#line 888
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 888
+#line 888
remaining -= extent;
+#line 888
if(remaining == 0)
+#line 888
break; /* normal loop exit */
+#line 888
offset += extent;
+#line 888
value += nget;
+#line 888
}
+#line 888
+#line 888
return status;
+#line 888
}
+#line 888
static int
+#line 889
getNCvx_schar_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 889
const size_t *start, size_t nelems, uchar *value)
+#line 889
{
+#line 889
off_t offset = NC_varoffset(ncp, varp, start);
+#line 889
size_t remaining = varp->xsz * nelems;
+#line 889
int status = NC_NOERR;
+#line 889
const void *xp;
+#line 889
+#line 889
if(nelems == 0)
+#line 889
return NC_NOERR;
+#line 889
+#line 889
assert(value != NULL);
+#line 889
+#line 889
for(;;)
+#line 889
{
+#line 889
size_t extent = MIN(remaining, ncp->chunk);
+#line 889
size_t nget = ncx_howmany(varp->type, extent);
+#line 889
+#line 889
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 889
0, (void **)&xp); /* cast away const */
+#line 889
if(lstatus != NC_NOERR)
+#line 889
return lstatus;
+#line 889
+#line 889
lstatus = ncx_getn_schar_uchar(&xp, nget, value);
+#line 889
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 889
status = lstatus;
+#line 889
+#line 889
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 889
+#line 889
remaining -= extent;
+#line 889
if(remaining == 0)
+#line 889
break; /* normal loop exit */
+#line 889
offset += extent;
+#line 889
value += nget;
+#line 889
}
+#line 889
+#line 889
return status;
+#line 889
}
+#line 889
static int
+#line 890
getNCvx_schar_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 890
const size_t *start, size_t nelems, ushort *value)
+#line 890
{
+#line 890
off_t offset = NC_varoffset(ncp, varp, start);
+#line 890
size_t remaining = varp->xsz * nelems;
+#line 890
int status = NC_NOERR;
+#line 890
const void *xp;
+#line 890
+#line 890
if(nelems == 0)
+#line 890
return NC_NOERR;
+#line 890
+#line 890
assert(value != NULL);
+#line 890
+#line 890
for(;;)
+#line 890
{
+#line 890
size_t extent = MIN(remaining, ncp->chunk);
+#line 890
size_t nget = ncx_howmany(varp->type, extent);
+#line 890
+#line 890
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 890
0, (void **)&xp); /* cast away const */
+#line 890
if(lstatus != NC_NOERR)
+#line 890
return lstatus;
+#line 890
+#line 890
lstatus = ncx_getn_schar_ushort(&xp, nget, value);
+#line 890
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 890
status = lstatus;
+#line 890
+#line 890
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 890
+#line 890
remaining -= extent;
+#line 890
if(remaining == 0)
+#line 890
break; /* normal loop exit */
+#line 890
offset += extent;
+#line 890
value += nget;
+#line 890
}
+#line 890
+#line 890
return status;
+#line 890
}
+#line 890
static int
+#line 892
getNCvx_short_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 892
const size_t *start, size_t nelems, schar *value)
+#line 892
{
+#line 892
off_t offset = NC_varoffset(ncp, varp, start);
+#line 892
size_t remaining = varp->xsz * nelems;
+#line 892
int status = NC_NOERR;
+#line 892
const void *xp;
+#line 892
+#line 892
if(nelems == 0)
+#line 892
return NC_NOERR;
+#line 892
+#line 892
assert(value != NULL);
+#line 892
+#line 892
for(;;)
+#line 892
{
+#line 892
size_t extent = MIN(remaining, ncp->chunk);
+#line 892
size_t nget = ncx_howmany(varp->type, extent);
+#line 892
+#line 892
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 892
0, (void **)&xp); /* cast away const */
+#line 892
if(lstatus != NC_NOERR)
+#line 892
return lstatus;
+#line 892
+#line 892
lstatus = ncx_getn_short_schar(&xp, nget, value);
+#line 892
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 892
status = lstatus;
+#line 892
+#line 892
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 892
+#line 892
remaining -= extent;
+#line 892
if(remaining == 0)
+#line 892
break; /* normal loop exit */
+#line 892
offset += extent;
+#line 892
value += nget;
+#line 892
}
+#line 892
+#line 892
return status;
+#line 892
}
+#line 892
static int
+#line 893
getNCvx_short_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 893
const size_t *start, size_t nelems, uchar *value)
+#line 893
{
+#line 893
off_t offset = NC_varoffset(ncp, varp, start);
+#line 893
size_t remaining = varp->xsz * nelems;
+#line 893
int status = NC_NOERR;
+#line 893
const void *xp;
+#line 893
+#line 893
if(nelems == 0)
+#line 893
return NC_NOERR;
+#line 893
+#line 893
assert(value != NULL);
+#line 893
+#line 893
for(;;)
+#line 893
{
+#line 893
size_t extent = MIN(remaining, ncp->chunk);
+#line 893
size_t nget = ncx_howmany(varp->type, extent);
+#line 893
+#line 893
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 893
0, (void **)&xp); /* cast away const */
+#line 893
if(lstatus != NC_NOERR)
+#line 893
return lstatus;
+#line 893
+#line 893
lstatus = ncx_getn_short_uchar(&xp, nget, value);
+#line 893
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 893
status = lstatus;
+#line 893
+#line 893
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 893
+#line 893
remaining -= extent;
+#line 893
if(remaining == 0)
+#line 893
break; /* normal loop exit */
+#line 893
offset += extent;
+#line 893
value += nget;
+#line 893
}
+#line 893
+#line 893
return status;
+#line 893
}
+#line 893
static int
+#line 894
getNCvx_short_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 894
const size_t *start, size_t nelems, short *value)
+#line 894
{
+#line 894
off_t offset = NC_varoffset(ncp, varp, start);
+#line 894
size_t remaining = varp->xsz * nelems;
+#line 894
int status = NC_NOERR;
+#line 894
const void *xp;
+#line 894
+#line 894
if(nelems == 0)
+#line 894
return NC_NOERR;
+#line 894
+#line 894
assert(value != NULL);
+#line 894
+#line 894
for(;;)
+#line 894
{
+#line 894
size_t extent = MIN(remaining, ncp->chunk);
+#line 894
size_t nget = ncx_howmany(varp->type, extent);
+#line 894
+#line 894
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 894
0, (void **)&xp); /* cast away const */
+#line 894
if(lstatus != NC_NOERR)
+#line 894
return lstatus;
+#line 894
+#line 894
lstatus = ncx_getn_short_short(&xp, nget, value);
+#line 894
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 894
status = lstatus;
+#line 894
+#line 894
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 894
+#line 894
remaining -= extent;
+#line 894
if(remaining == 0)
+#line 894
break; /* normal loop exit */
+#line 894
offset += extent;
+#line 894
value += nget;
+#line 894
}
+#line 894
+#line 894
return status;
+#line 894
}
+#line 894
static int
+#line 895
getNCvx_short_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 895
const size_t *start, size_t nelems, int *value)
+#line 895
{
+#line 895
off_t offset = NC_varoffset(ncp, varp, start);
+#line 895
size_t remaining = varp->xsz * nelems;
+#line 895
int status = NC_NOERR;
+#line 895
const void *xp;
+#line 895
+#line 895
if(nelems == 0)
+#line 895
return NC_NOERR;
+#line 895
+#line 895
assert(value != NULL);
+#line 895
+#line 895
for(;;)
+#line 895
{
+#line 895
size_t extent = MIN(remaining, ncp->chunk);
+#line 895
size_t nget = ncx_howmany(varp->type, extent);
+#line 895
+#line 895
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 895
0, (void **)&xp); /* cast away const */
+#line 895
if(lstatus != NC_NOERR)
+#line 895
return lstatus;
+#line 895
+#line 895
lstatus = ncx_getn_short_int(&xp, nget, value);
+#line 895
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 895
status = lstatus;
+#line 895
+#line 895
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 895
+#line 895
remaining -= extent;
+#line 895
if(remaining == 0)
+#line 895
break; /* normal loop exit */
+#line 895
offset += extent;
+#line 895
value += nget;
+#line 895
}
+#line 895
+#line 895
return status;
+#line 895
}
+#line 895
static int
+#line 896
getNCvx_short_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 896
const size_t *start, size_t nelems, float *value)
+#line 896
{
+#line 896
off_t offset = NC_varoffset(ncp, varp, start);
+#line 896
size_t remaining = varp->xsz * nelems;
+#line 896
int status = NC_NOERR;
+#line 896
const void *xp;
+#line 896
+#line 896
if(nelems == 0)
+#line 896
return NC_NOERR;
+#line 896
+#line 896
assert(value != NULL);
+#line 896
+#line 896
for(;;)
+#line 896
{
+#line 896
size_t extent = MIN(remaining, ncp->chunk);
+#line 896
size_t nget = ncx_howmany(varp->type, extent);
+#line 896
+#line 896
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 896
0, (void **)&xp); /* cast away const */
+#line 896
if(lstatus != NC_NOERR)
+#line 896
return lstatus;
+#line 896
+#line 896
lstatus = ncx_getn_short_float(&xp, nget, value);
+#line 896
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 896
status = lstatus;
+#line 896
+#line 896
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 896
+#line 896
remaining -= extent;
+#line 896
if(remaining == 0)
+#line 896
break; /* normal loop exit */
+#line 896
offset += extent;
+#line 896
value += nget;
+#line 896
}
+#line 896
+#line 896
return status;
+#line 896
}
+#line 896
static int
+#line 897
getNCvx_short_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 897
const size_t *start, size_t nelems, double *value)
+#line 897
{
+#line 897
off_t offset = NC_varoffset(ncp, varp, start);
+#line 897
size_t remaining = varp->xsz * nelems;
+#line 897
int status = NC_NOERR;
+#line 897
const void *xp;
+#line 897
+#line 897
if(nelems == 0)
+#line 897
return NC_NOERR;
+#line 897
+#line 897
assert(value != NULL);
+#line 897
+#line 897
for(;;)
+#line 897
{
+#line 897
size_t extent = MIN(remaining, ncp->chunk);
+#line 897
size_t nget = ncx_howmany(varp->type, extent);
+#line 897
+#line 897
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 897
0, (void **)&xp); /* cast away const */
+#line 897
if(lstatus != NC_NOERR)
+#line 897
return lstatus;
+#line 897
+#line 897
lstatus = ncx_getn_short_double(&xp, nget, value);
+#line 897
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 897
status = lstatus;
+#line 897
+#line 897
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 897
+#line 897
remaining -= extent;
+#line 897
if(remaining == 0)
+#line 897
break; /* normal loop exit */
+#line 897
offset += extent;
+#line 897
value += nget;
+#line 897
}
+#line 897
+#line 897
return status;
+#line 897
}
+#line 897
static int
+#line 898
getNCvx_short_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 898
const size_t *start, size_t nelems, longlong *value)
+#line 898
{
+#line 898
off_t offset = NC_varoffset(ncp, varp, start);
+#line 898
size_t remaining = varp->xsz * nelems;
+#line 898
int status = NC_NOERR;
+#line 898
const void *xp;
+#line 898
+#line 898
if(nelems == 0)
+#line 898
return NC_NOERR;
+#line 898
+#line 898
assert(value != NULL);
+#line 898
+#line 898
for(;;)
+#line 898
{
+#line 898
size_t extent = MIN(remaining, ncp->chunk);
+#line 898
size_t nget = ncx_howmany(varp->type, extent);
+#line 898
+#line 898
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 898
0, (void **)&xp); /* cast away const */
+#line 898
if(lstatus != NC_NOERR)
+#line 898
return lstatus;
+#line 898
+#line 898
lstatus = ncx_getn_short_longlong(&xp, nget, value);
+#line 898
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 898
status = lstatus;
+#line 898
+#line 898
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 898
+#line 898
remaining -= extent;
+#line 898
if(remaining == 0)
+#line 898
break; /* normal loop exit */
+#line 898
offset += extent;
+#line 898
value += nget;
+#line 898
}
+#line 898
+#line 898
return status;
+#line 898
}
+#line 898
static int
+#line 899
getNCvx_short_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 899
const size_t *start, size_t nelems, uint *value)
+#line 899
{
+#line 899
off_t offset = NC_varoffset(ncp, varp, start);
+#line 899
size_t remaining = varp->xsz * nelems;
+#line 899
int status = NC_NOERR;
+#line 899
const void *xp;
+#line 899
+#line 899
if(nelems == 0)
+#line 899
return NC_NOERR;
+#line 899
+#line 899
assert(value != NULL);
+#line 899
+#line 899
for(;;)
+#line 899
{
+#line 899
size_t extent = MIN(remaining, ncp->chunk);
+#line 899
size_t nget = ncx_howmany(varp->type, extent);
+#line 899
+#line 899
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 899
0, (void **)&xp); /* cast away const */
+#line 899
if(lstatus != NC_NOERR)
+#line 899
return lstatus;
+#line 899
+#line 899
lstatus = ncx_getn_short_uint(&xp, nget, value);
+#line 899
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 899
status = lstatus;
+#line 899
+#line 899
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 899
+#line 899
remaining -= extent;
+#line 899
if(remaining == 0)
+#line 899
break; /* normal loop exit */
+#line 899
offset += extent;
+#line 899
value += nget;
+#line 899
}
+#line 899
+#line 899
return status;
+#line 899
}
+#line 899
static int
+#line 900
getNCvx_short_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 900
const size_t *start, size_t nelems, ulonglong *value)
+#line 900
{
+#line 900
off_t offset = NC_varoffset(ncp, varp, start);
+#line 900
size_t remaining = varp->xsz * nelems;
+#line 900
int status = NC_NOERR;
+#line 900
const void *xp;
+#line 900
+#line 900
if(nelems == 0)
+#line 900
return NC_NOERR;
+#line 900
+#line 900
assert(value != NULL);
+#line 900
+#line 900
for(;;)
+#line 900
{
+#line 900
size_t extent = MIN(remaining, ncp->chunk);
+#line 900
size_t nget = ncx_howmany(varp->type, extent);
+#line 900
+#line 900
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 900
0, (void **)&xp); /* cast away const */
+#line 900
if(lstatus != NC_NOERR)
+#line 900
return lstatus;
+#line 900
+#line 900
lstatus = ncx_getn_short_ulonglong(&xp, nget, value);
+#line 900
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 900
status = lstatus;
+#line 900
+#line 900
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 900
+#line 900
remaining -= extent;
+#line 900
if(remaining == 0)
+#line 900
break; /* normal loop exit */
+#line 900
offset += extent;
+#line 900
value += nget;
+#line 900
}
+#line 900
+#line 900
return status;
+#line 900
}
+#line 900
static int
+#line 901
getNCvx_short_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 901
const size_t *start, size_t nelems, ushort *value)
+#line 901
{
+#line 901
off_t offset = NC_varoffset(ncp, varp, start);
+#line 901
size_t remaining = varp->xsz * nelems;
+#line 901
int status = NC_NOERR;
+#line 901
const void *xp;
+#line 901
+#line 901
if(nelems == 0)
+#line 901
return NC_NOERR;
+#line 901
+#line 901
assert(value != NULL);
+#line 901
+#line 901
for(;;)
+#line 901
{
+#line 901
size_t extent = MIN(remaining, ncp->chunk);
+#line 901
size_t nget = ncx_howmany(varp->type, extent);
+#line 901
+#line 901
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 901
0, (void **)&xp); /* cast away const */
+#line 901
if(lstatus != NC_NOERR)
+#line 901
return lstatus;
+#line 901
+#line 901
lstatus = ncx_getn_short_ushort(&xp, nget, value);
+#line 901
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 901
status = lstatus;
+#line 901
+#line 901
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 901
+#line 901
remaining -= extent;
+#line 901
if(remaining == 0)
+#line 901
break; /* normal loop exit */
+#line 901
offset += extent;
+#line 901
value += nget;
+#line 901
}
+#line 901
+#line 901
return status;
+#line 901
}
+#line 901
static int
+#line 903
getNCvx_int_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 903
const size_t *start, size_t nelems, schar *value)
+#line 903
{
+#line 903
off_t offset = NC_varoffset(ncp, varp, start);
+#line 903
size_t remaining = varp->xsz * nelems;
+#line 903
int status = NC_NOERR;
+#line 903
const void *xp;
+#line 903
+#line 903
if(nelems == 0)
+#line 903
return NC_NOERR;
+#line 903
+#line 903
assert(value != NULL);
+#line 903
+#line 903
for(;;)
+#line 903
{
+#line 903
size_t extent = MIN(remaining, ncp->chunk);
+#line 903
size_t nget = ncx_howmany(varp->type, extent);
+#line 903
+#line 903
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 903
0, (void **)&xp); /* cast away const */
+#line 903
if(lstatus != NC_NOERR)
+#line 903
return lstatus;
+#line 903
+#line 903
lstatus = ncx_getn_int_schar(&xp, nget, value);
+#line 903
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 903
status = lstatus;
+#line 903
+#line 903
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 903
+#line 903
remaining -= extent;
+#line 903
if(remaining == 0)
+#line 903
break; /* normal loop exit */
+#line 903
offset += extent;
+#line 903
value += nget;
+#line 903
}
+#line 903
+#line 903
return status;
+#line 903
}
+#line 903
static int
+#line 904
getNCvx_int_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 904
const size_t *start, size_t nelems, uchar *value)
+#line 904
{
+#line 904
off_t offset = NC_varoffset(ncp, varp, start);
+#line 904
size_t remaining = varp->xsz * nelems;
+#line 904
int status = NC_NOERR;
+#line 904
const void *xp;
+#line 904
+#line 904
if(nelems == 0)
+#line 904
return NC_NOERR;
+#line 904
+#line 904
assert(value != NULL);
+#line 904
+#line 904
for(;;)
+#line 904
{
+#line 904
size_t extent = MIN(remaining, ncp->chunk);
+#line 904
size_t nget = ncx_howmany(varp->type, extent);
+#line 904
+#line 904
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 904
0, (void **)&xp); /* cast away const */
+#line 904
if(lstatus != NC_NOERR)
+#line 904
return lstatus;
+#line 904
+#line 904
lstatus = ncx_getn_int_uchar(&xp, nget, value);
+#line 904
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 904
status = lstatus;
+#line 904
+#line 904
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 904
+#line 904
remaining -= extent;
+#line 904
if(remaining == 0)
+#line 904
break; /* normal loop exit */
+#line 904
offset += extent;
+#line 904
value += nget;
+#line 904
}
+#line 904
+#line 904
return status;
+#line 904
}
+#line 904
static int
+#line 905
getNCvx_int_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 905
const size_t *start, size_t nelems, short *value)
+#line 905
{
+#line 905
off_t offset = NC_varoffset(ncp, varp, start);
+#line 905
size_t remaining = varp->xsz * nelems;
+#line 905
int status = NC_NOERR;
+#line 905
const void *xp;
+#line 905
+#line 905
if(nelems == 0)
+#line 905
return NC_NOERR;
+#line 905
+#line 905
assert(value != NULL);
+#line 905
+#line 905
for(;;)
+#line 905
{
+#line 905
size_t extent = MIN(remaining, ncp->chunk);
+#line 905
size_t nget = ncx_howmany(varp->type, extent);
+#line 905
+#line 905
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 905
0, (void **)&xp); /* cast away const */
+#line 905
if(lstatus != NC_NOERR)
+#line 905
return lstatus;
+#line 905
+#line 905
lstatus = ncx_getn_int_short(&xp, nget, value);
+#line 905
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 905
status = lstatus;
+#line 905
+#line 905
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 905
+#line 905
remaining -= extent;
+#line 905
if(remaining == 0)
+#line 905
break; /* normal loop exit */
+#line 905
offset += extent;
+#line 905
value += nget;
+#line 905
}
+#line 905
+#line 905
return status;
+#line 905
}
+#line 905
static int
+#line 906
getNCvx_int_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 906
const size_t *start, size_t nelems, int *value)
+#line 906
{
+#line 906
off_t offset = NC_varoffset(ncp, varp, start);
+#line 906
size_t remaining = varp->xsz * nelems;
+#line 906
int status = NC_NOERR;
+#line 906
const void *xp;
+#line 906
+#line 906
if(nelems == 0)
+#line 906
return NC_NOERR;
+#line 906
+#line 906
assert(value != NULL);
+#line 906
+#line 906
for(;;)
+#line 906
{
+#line 906
size_t extent = MIN(remaining, ncp->chunk);
+#line 906
size_t nget = ncx_howmany(varp->type, extent);
+#line 906
+#line 906
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 906
0, (void **)&xp); /* cast away const */
+#line 906
if(lstatus != NC_NOERR)
+#line 906
return lstatus;
+#line 906
+#line 906
lstatus = ncx_getn_int_int(&xp, nget, value);
+#line 906
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 906
status = lstatus;
+#line 906
+#line 906
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 906
+#line 906
remaining -= extent;
+#line 906
if(remaining == 0)
+#line 906
break; /* normal loop exit */
+#line 906
offset += extent;
+#line 906
value += nget;
+#line 906
}
+#line 906
+#line 906
return status;
+#line 906
}
+#line 906
static int
+#line 907
getNCvx_int_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 907
const size_t *start, size_t nelems, float *value)
+#line 907
{
+#line 907
off_t offset = NC_varoffset(ncp, varp, start);
+#line 907
size_t remaining = varp->xsz * nelems;
+#line 907
int status = NC_NOERR;
+#line 907
const void *xp;
+#line 907
+#line 907
if(nelems == 0)
+#line 907
return NC_NOERR;
+#line 907
+#line 907
assert(value != NULL);
+#line 907
+#line 907
for(;;)
+#line 907
{
+#line 907
size_t extent = MIN(remaining, ncp->chunk);
+#line 907
size_t nget = ncx_howmany(varp->type, extent);
+#line 907
+#line 907
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 907
0, (void **)&xp); /* cast away const */
+#line 907
if(lstatus != NC_NOERR)
+#line 907
return lstatus;
+#line 907
+#line 907
lstatus = ncx_getn_int_float(&xp, nget, value);
+#line 907
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 907
status = lstatus;
+#line 907
+#line 907
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 907
+#line 907
remaining -= extent;
+#line 907
if(remaining == 0)
+#line 907
break; /* normal loop exit */
+#line 907
offset += extent;
+#line 907
value += nget;
+#line 907
}
+#line 907
+#line 907
return status;
+#line 907
}
+#line 907
static int
+#line 908
getNCvx_int_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 908
const size_t *start, size_t nelems, double *value)
+#line 908
{
+#line 908
off_t offset = NC_varoffset(ncp, varp, start);
+#line 908
size_t remaining = varp->xsz * nelems;
+#line 908
int status = NC_NOERR;
+#line 908
const void *xp;
+#line 908
+#line 908
if(nelems == 0)
+#line 908
return NC_NOERR;
+#line 908
+#line 908
assert(value != NULL);
+#line 908
+#line 908
for(;;)
+#line 908
{
+#line 908
size_t extent = MIN(remaining, ncp->chunk);
+#line 908
size_t nget = ncx_howmany(varp->type, extent);
+#line 908
+#line 908
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 908
0, (void **)&xp); /* cast away const */
+#line 908
if(lstatus != NC_NOERR)
+#line 908
return lstatus;
+#line 908
+#line 908
lstatus = ncx_getn_int_double(&xp, nget, value);
+#line 908
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 908
status = lstatus;
+#line 908
+#line 908
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 908
+#line 908
remaining -= extent;
+#line 908
if(remaining == 0)
+#line 908
break; /* normal loop exit */
+#line 908
offset += extent;
+#line 908
value += nget;
+#line 908
}
+#line 908
+#line 908
return status;
+#line 908
}
+#line 908
static int
+#line 909
getNCvx_int_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 909
const size_t *start, size_t nelems, longlong *value)
+#line 909
{
+#line 909
off_t offset = NC_varoffset(ncp, varp, start);
+#line 909
size_t remaining = varp->xsz * nelems;
+#line 909
int status = NC_NOERR;
+#line 909
const void *xp;
+#line 909
+#line 909
if(nelems == 0)
+#line 909
return NC_NOERR;
+#line 909
+#line 909
assert(value != NULL);
+#line 909
+#line 909
for(;;)
+#line 909
{
+#line 909
size_t extent = MIN(remaining, ncp->chunk);
+#line 909
size_t nget = ncx_howmany(varp->type, extent);
+#line 909
+#line 909
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 909
0, (void **)&xp); /* cast away const */
+#line 909
if(lstatus != NC_NOERR)
+#line 909
return lstatus;
+#line 909
+#line 909
lstatus = ncx_getn_int_longlong(&xp, nget, value);
+#line 909
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 909
status = lstatus;
+#line 909
+#line 909
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 909
+#line 909
remaining -= extent;
+#line 909
if(remaining == 0)
+#line 909
break; /* normal loop exit */
+#line 909
offset += extent;
+#line 909
value += nget;
+#line 909
}
+#line 909
+#line 909
return status;
+#line 909
}
+#line 909
static int
+#line 910
getNCvx_int_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 910
const size_t *start, size_t nelems, uint *value)
+#line 910
{
+#line 910
off_t offset = NC_varoffset(ncp, varp, start);
+#line 910
size_t remaining = varp->xsz * nelems;
+#line 910
int status = NC_NOERR;
+#line 910
const void *xp;
+#line 910
+#line 910
if(nelems == 0)
+#line 910
return NC_NOERR;
+#line 910
+#line 910
assert(value != NULL);
+#line 910
+#line 910
for(;;)
+#line 910
{
+#line 910
size_t extent = MIN(remaining, ncp->chunk);
+#line 910
size_t nget = ncx_howmany(varp->type, extent);
+#line 910
+#line 910
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 910
0, (void **)&xp); /* cast away const */
+#line 910
if(lstatus != NC_NOERR)
+#line 910
return lstatus;
+#line 910
+#line 910
lstatus = ncx_getn_int_uint(&xp, nget, value);
+#line 910
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 910
status = lstatus;
+#line 910
+#line 910
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 910
+#line 910
remaining -= extent;
+#line 910
if(remaining == 0)
+#line 910
break; /* normal loop exit */
+#line 910
offset += extent;
+#line 910
value += nget;
+#line 910
}
+#line 910
+#line 910
return status;
+#line 910
}
+#line 910
static int
+#line 911
getNCvx_int_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 911
const size_t *start, size_t nelems, ulonglong *value)
+#line 911
{
+#line 911
off_t offset = NC_varoffset(ncp, varp, start);
+#line 911
size_t remaining = varp->xsz * nelems;
+#line 911
int status = NC_NOERR;
+#line 911
const void *xp;
+#line 911
+#line 911
if(nelems == 0)
+#line 911
return NC_NOERR;
+#line 911
+#line 911
assert(value != NULL);
+#line 911
+#line 911
for(;;)
+#line 911
{
+#line 911
size_t extent = MIN(remaining, ncp->chunk);
+#line 911
size_t nget = ncx_howmany(varp->type, extent);
+#line 911
+#line 911
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 911
0, (void **)&xp); /* cast away const */
+#line 911
if(lstatus != NC_NOERR)
+#line 911
return lstatus;
+#line 911
+#line 911
lstatus = ncx_getn_int_ulonglong(&xp, nget, value);
+#line 911
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 911
status = lstatus;
+#line 911
+#line 911
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 911
+#line 911
remaining -= extent;
+#line 911
if(remaining == 0)
+#line 911
break; /* normal loop exit */
+#line 911
offset += extent;
+#line 911
value += nget;
+#line 911
}
+#line 911
+#line 911
return status;
+#line 911
}
+#line 911
static int
+#line 912
getNCvx_int_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 912
const size_t *start, size_t nelems, ushort *value)
+#line 912
{
+#line 912
off_t offset = NC_varoffset(ncp, varp, start);
+#line 912
size_t remaining = varp->xsz * nelems;
+#line 912
int status = NC_NOERR;
+#line 912
const void *xp;
+#line 912
+#line 912
if(nelems == 0)
+#line 912
return NC_NOERR;
+#line 912
+#line 912
assert(value != NULL);
+#line 912
+#line 912
for(;;)
+#line 912
{
+#line 912
size_t extent = MIN(remaining, ncp->chunk);
+#line 912
size_t nget = ncx_howmany(varp->type, extent);
+#line 912
+#line 912
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 912
0, (void **)&xp); /* cast away const */
+#line 912
if(lstatus != NC_NOERR)
+#line 912
return lstatus;
+#line 912
+#line 912
lstatus = ncx_getn_int_ushort(&xp, nget, value);
+#line 912
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 912
status = lstatus;
+#line 912
+#line 912
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 912
+#line 912
remaining -= extent;
+#line 912
if(remaining == 0)
+#line 912
break; /* normal loop exit */
+#line 912
offset += extent;
+#line 912
value += nget;
+#line 912
}
+#line 912
+#line 912
return status;
+#line 912
}
+#line 912
static int
+#line 914
getNCvx_float_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 914
const size_t *start, size_t nelems, schar *value)
+#line 914
{
+#line 914
off_t offset = NC_varoffset(ncp, varp, start);
+#line 914
size_t remaining = varp->xsz * nelems;
+#line 914
int status = NC_NOERR;
+#line 914
const void *xp;
+#line 914
+#line 914
if(nelems == 0)
+#line 914
return NC_NOERR;
+#line 914
+#line 914
assert(value != NULL);
+#line 914
+#line 914
for(;;)
+#line 914
{
+#line 914
size_t extent = MIN(remaining, ncp->chunk);
+#line 914
size_t nget = ncx_howmany(varp->type, extent);
+#line 914
+#line 914
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 914
0, (void **)&xp); /* cast away const */
+#line 914
if(lstatus != NC_NOERR)
+#line 914
return lstatus;
+#line 914
+#line 914
lstatus = ncx_getn_float_schar(&xp, nget, value);
+#line 914
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 914
status = lstatus;
+#line 914
+#line 914
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 914
+#line 914
remaining -= extent;
+#line 914
if(remaining == 0)
+#line 914
break; /* normal loop exit */
+#line 914
offset += extent;
+#line 914
value += nget;
+#line 914
}
+#line 914
+#line 914
return status;
+#line 914
}
+#line 914
static int
+#line 915
getNCvx_float_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 915
const size_t *start, size_t nelems, uchar *value)
+#line 915
{
+#line 915
off_t offset = NC_varoffset(ncp, varp, start);
+#line 915
size_t remaining = varp->xsz * nelems;
+#line 915
int status = NC_NOERR;
+#line 915
const void *xp;
+#line 915
+#line 915
if(nelems == 0)
+#line 915
return NC_NOERR;
+#line 915
+#line 915
assert(value != NULL);
+#line 915
+#line 915
for(;;)
+#line 915
{
+#line 915
size_t extent = MIN(remaining, ncp->chunk);
+#line 915
size_t nget = ncx_howmany(varp->type, extent);
+#line 915
+#line 915
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 915
0, (void **)&xp); /* cast away const */
+#line 915
if(lstatus != NC_NOERR)
+#line 915
return lstatus;
+#line 915
+#line 915
lstatus = ncx_getn_float_uchar(&xp, nget, value);
+#line 915
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 915
status = lstatus;
+#line 915
+#line 915
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 915
+#line 915
remaining -= extent;
+#line 915
if(remaining == 0)
+#line 915
break; /* normal loop exit */
+#line 915
offset += extent;
+#line 915
value += nget;
+#line 915
}
+#line 915
+#line 915
return status;
+#line 915
}
+#line 915
static int
+#line 916
getNCvx_float_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 916
const size_t *start, size_t nelems, short *value)
+#line 916
{
+#line 916
off_t offset = NC_varoffset(ncp, varp, start);
+#line 916
size_t remaining = varp->xsz * nelems;
+#line 916
int status = NC_NOERR;
+#line 916
const void *xp;
+#line 916
+#line 916
if(nelems == 0)
+#line 916
return NC_NOERR;
+#line 916
+#line 916
assert(value != NULL);
+#line 916
+#line 916
for(;;)
+#line 916
{
+#line 916
size_t extent = MIN(remaining, ncp->chunk);
+#line 916
size_t nget = ncx_howmany(varp->type, extent);
+#line 916
+#line 916
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 916
0, (void **)&xp); /* cast away const */
+#line 916
if(lstatus != NC_NOERR)
+#line 916
return lstatus;
+#line 916
+#line 916
lstatus = ncx_getn_float_short(&xp, nget, value);
+#line 916
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 916
status = lstatus;
+#line 916
+#line 916
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 916
+#line 916
remaining -= extent;
+#line 916
if(remaining == 0)
+#line 916
break; /* normal loop exit */
+#line 916
offset += extent;
+#line 916
value += nget;
+#line 916
}
+#line 916
+#line 916
return status;
+#line 916
}
+#line 916
static int
+#line 917
getNCvx_float_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 917
const size_t *start, size_t nelems, int *value)
+#line 917
{
+#line 917
off_t offset = NC_varoffset(ncp, varp, start);
+#line 917
size_t remaining = varp->xsz * nelems;
+#line 917
int status = NC_NOERR;
+#line 917
const void *xp;
+#line 917
+#line 917
if(nelems == 0)
+#line 917
return NC_NOERR;
+#line 917
+#line 917
assert(value != NULL);
+#line 917
+#line 917
for(;;)
+#line 917
{
+#line 917
size_t extent = MIN(remaining, ncp->chunk);
+#line 917
size_t nget = ncx_howmany(varp->type, extent);
+#line 917
+#line 917
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 917
0, (void **)&xp); /* cast away const */
+#line 917
if(lstatus != NC_NOERR)
+#line 917
return lstatus;
+#line 917
+#line 917
lstatus = ncx_getn_float_int(&xp, nget, value);
+#line 917
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 917
status = lstatus;
+#line 917
+#line 917
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 917
+#line 917
remaining -= extent;
+#line 917
if(remaining == 0)
+#line 917
break; /* normal loop exit */
+#line 917
offset += extent;
+#line 917
value += nget;
+#line 917
}
+#line 917
+#line 917
return status;
+#line 917
}
+#line 917
static int
+#line 918
getNCvx_float_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 918
const size_t *start, size_t nelems, float *value)
+#line 918
{
+#line 918
off_t offset = NC_varoffset(ncp, varp, start);
+#line 918
size_t remaining = varp->xsz * nelems;
+#line 918
int status = NC_NOERR;
+#line 918
const void *xp;
+#line 918
+#line 918
if(nelems == 0)
+#line 918
return NC_NOERR;
+#line 918
+#line 918
assert(value != NULL);
+#line 918
+#line 918
for(;;)
+#line 918
{
+#line 918
size_t extent = MIN(remaining, ncp->chunk);
+#line 918
size_t nget = ncx_howmany(varp->type, extent);
+#line 918
+#line 918
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 918
0, (void **)&xp); /* cast away const */
+#line 918
if(lstatus != NC_NOERR)
+#line 918
return lstatus;
+#line 918
+#line 918
lstatus = ncx_getn_float_float(&xp, nget, value);
+#line 918
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 918
status = lstatus;
+#line 918
+#line 918
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 918
+#line 918
remaining -= extent;
+#line 918
if(remaining == 0)
+#line 918
break; /* normal loop exit */
+#line 918
offset += extent;
+#line 918
value += nget;
+#line 918
}
+#line 918
+#line 918
return status;
+#line 918
}
+#line 918
static int
+#line 919
getNCvx_float_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 919
const size_t *start, size_t nelems, double *value)
+#line 919
{
+#line 919
off_t offset = NC_varoffset(ncp, varp, start);
+#line 919
size_t remaining = varp->xsz * nelems;
+#line 919
int status = NC_NOERR;
+#line 919
const void *xp;
+#line 919
+#line 919
if(nelems == 0)
+#line 919
return NC_NOERR;
+#line 919
+#line 919
assert(value != NULL);
+#line 919
+#line 919
for(;;)
+#line 919
{
+#line 919
size_t extent = MIN(remaining, ncp->chunk);
+#line 919
size_t nget = ncx_howmany(varp->type, extent);
+#line 919
+#line 919
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 919
0, (void **)&xp); /* cast away const */
+#line 919
if(lstatus != NC_NOERR)
+#line 919
return lstatus;
+#line 919
+#line 919
lstatus = ncx_getn_float_double(&xp, nget, value);
+#line 919
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 919
status = lstatus;
+#line 919
+#line 919
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 919
+#line 919
remaining -= extent;
+#line 919
if(remaining == 0)
+#line 919
break; /* normal loop exit */
+#line 919
offset += extent;
+#line 919
value += nget;
+#line 919
}
+#line 919
+#line 919
return status;
+#line 919
}
+#line 919
static int
+#line 920
getNCvx_float_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 920
const size_t *start, size_t nelems, longlong *value)
+#line 920
{
+#line 920
off_t offset = NC_varoffset(ncp, varp, start);
+#line 920
size_t remaining = varp->xsz * nelems;
+#line 920
int status = NC_NOERR;
+#line 920
const void *xp;
+#line 920
+#line 920
if(nelems == 0)
+#line 920
return NC_NOERR;
+#line 920
+#line 920
assert(value != NULL);
+#line 920
+#line 920
for(;;)
+#line 920
{
+#line 920
size_t extent = MIN(remaining, ncp->chunk);
+#line 920
size_t nget = ncx_howmany(varp->type, extent);
+#line 920
+#line 920
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 920
0, (void **)&xp); /* cast away const */
+#line 920
if(lstatus != NC_NOERR)
+#line 920
return lstatus;
+#line 920
+#line 920
lstatus = ncx_getn_float_longlong(&xp, nget, value);
+#line 920
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 920
status = lstatus;
+#line 920
+#line 920
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 920
+#line 920
remaining -= extent;
+#line 920
if(remaining == 0)
+#line 920
break; /* normal loop exit */
+#line 920
offset += extent;
+#line 920
value += nget;
+#line 920
}
+#line 920
+#line 920
return status;
+#line 920
}
+#line 920
static int
+#line 921
getNCvx_float_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 921
const size_t *start, size_t nelems, uint *value)
+#line 921
{
+#line 921
off_t offset = NC_varoffset(ncp, varp, start);
+#line 921
size_t remaining = varp->xsz * nelems;
+#line 921
int status = NC_NOERR;
+#line 921
const void *xp;
+#line 921
+#line 921
if(nelems == 0)
+#line 921
return NC_NOERR;
+#line 921
+#line 921
assert(value != NULL);
+#line 921
+#line 921
for(;;)
+#line 921
{
+#line 921
size_t extent = MIN(remaining, ncp->chunk);
+#line 921
size_t nget = ncx_howmany(varp->type, extent);
+#line 921
+#line 921
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 921
0, (void **)&xp); /* cast away const */
+#line 921
if(lstatus != NC_NOERR)
+#line 921
return lstatus;
+#line 921
+#line 921
lstatus = ncx_getn_float_uint(&xp, nget, value);
+#line 921
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 921
status = lstatus;
+#line 921
+#line 921
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 921
+#line 921
remaining -= extent;
+#line 921
if(remaining == 0)
+#line 921
break; /* normal loop exit */
+#line 921
offset += extent;
+#line 921
value += nget;
+#line 921
}
+#line 921
+#line 921
return status;
+#line 921
}
+#line 921
static int
+#line 922
getNCvx_float_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 922
const size_t *start, size_t nelems, ulonglong *value)
+#line 922
{
+#line 922
off_t offset = NC_varoffset(ncp, varp, start);
+#line 922
size_t remaining = varp->xsz * nelems;
+#line 922
int status = NC_NOERR;
+#line 922
const void *xp;
+#line 922
+#line 922
if(nelems == 0)
+#line 922
return NC_NOERR;
+#line 922
+#line 922
assert(value != NULL);
+#line 922
+#line 922
for(;;)
+#line 922
{
+#line 922
size_t extent = MIN(remaining, ncp->chunk);
+#line 922
size_t nget = ncx_howmany(varp->type, extent);
+#line 922
+#line 922
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 922
0, (void **)&xp); /* cast away const */
+#line 922
if(lstatus != NC_NOERR)
+#line 922
return lstatus;
+#line 922
+#line 922
lstatus = ncx_getn_float_ulonglong(&xp, nget, value);
+#line 922
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 922
status = lstatus;
+#line 922
+#line 922
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 922
+#line 922
remaining -= extent;
+#line 922
if(remaining == 0)
+#line 922
break; /* normal loop exit */
+#line 922
offset += extent;
+#line 922
value += nget;
+#line 922
}
+#line 922
+#line 922
return status;
+#line 922
}
+#line 922
static int
+#line 923
getNCvx_float_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 923
const size_t *start, size_t nelems, ushort *value)
+#line 923
{
+#line 923
off_t offset = NC_varoffset(ncp, varp, start);
+#line 923
size_t remaining = varp->xsz * nelems;
+#line 923
int status = NC_NOERR;
+#line 923
const void *xp;
+#line 923
+#line 923
if(nelems == 0)
+#line 923
return NC_NOERR;
+#line 923
+#line 923
assert(value != NULL);
+#line 923
+#line 923
for(;;)
+#line 923
{
+#line 923
size_t extent = MIN(remaining, ncp->chunk);
+#line 923
size_t nget = ncx_howmany(varp->type, extent);
+#line 923
+#line 923
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 923
0, (void **)&xp); /* cast away const */
+#line 923
if(lstatus != NC_NOERR)
+#line 923
return lstatus;
+#line 923
+#line 923
lstatus = ncx_getn_float_ushort(&xp, nget, value);
+#line 923
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 923
status = lstatus;
+#line 923
+#line 923
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 923
+#line 923
remaining -= extent;
+#line 923
if(remaining == 0)
+#line 923
break; /* normal loop exit */
+#line 923
offset += extent;
+#line 923
value += nget;
+#line 923
}
+#line 923
+#line 923
return status;
+#line 923
}
+#line 923
static int
+#line 925
getNCvx_double_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 925
const size_t *start, size_t nelems, schar *value)
+#line 925
{
+#line 925
off_t offset = NC_varoffset(ncp, varp, start);
+#line 925
size_t remaining = varp->xsz * nelems;
+#line 925
int status = NC_NOERR;
+#line 925
const void *xp;
+#line 925
+#line 925
if(nelems == 0)
+#line 925
return NC_NOERR;
+#line 925
+#line 925
assert(value != NULL);
+#line 925
+#line 925
for(;;)
+#line 925
{
+#line 925
size_t extent = MIN(remaining, ncp->chunk);
+#line 925
size_t nget = ncx_howmany(varp->type, extent);
+#line 925
+#line 925
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 925
0, (void **)&xp); /* cast away const */
+#line 925
if(lstatus != NC_NOERR)
+#line 925
return lstatus;
+#line 925
+#line 925
lstatus = ncx_getn_double_schar(&xp, nget, value);
+#line 925
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 925
status = lstatus;
+#line 925
+#line 925
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 925
+#line 925
remaining -= extent;
+#line 925
if(remaining == 0)
+#line 925
break; /* normal loop exit */
+#line 925
offset += extent;
+#line 925
value += nget;
+#line 925
}
+#line 925
+#line 925
return status;
+#line 925
}
+#line 925
static int
+#line 926
getNCvx_double_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 926
const size_t *start, size_t nelems, uchar *value)
+#line 926
{
+#line 926
off_t offset = NC_varoffset(ncp, varp, start);
+#line 926
size_t remaining = varp->xsz * nelems;
+#line 926
int status = NC_NOERR;
+#line 926
const void *xp;
+#line 926
+#line 926
if(nelems == 0)
+#line 926
return NC_NOERR;
+#line 926
+#line 926
assert(value != NULL);
+#line 926
+#line 926
for(;;)
+#line 926
{
+#line 926
size_t extent = MIN(remaining, ncp->chunk);
+#line 926
size_t nget = ncx_howmany(varp->type, extent);
+#line 926
+#line 926
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 926
0, (void **)&xp); /* cast away const */
+#line 926
if(lstatus != NC_NOERR)
+#line 926
return lstatus;
+#line 926
+#line 926
lstatus = ncx_getn_double_uchar(&xp, nget, value);
+#line 926
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 926
status = lstatus;
+#line 926
+#line 926
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 926
+#line 926
remaining -= extent;
+#line 926
if(remaining == 0)
+#line 926
break; /* normal loop exit */
+#line 926
offset += extent;
+#line 926
value += nget;
+#line 926
}
+#line 926
+#line 926
return status;
+#line 926
}
+#line 926
static int
+#line 927
getNCvx_double_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 927
const size_t *start, size_t nelems, short *value)
+#line 927
{
+#line 927
off_t offset = NC_varoffset(ncp, varp, start);
+#line 927
size_t remaining = varp->xsz * nelems;
+#line 927
int status = NC_NOERR;
+#line 927
const void *xp;
+#line 927
+#line 927
if(nelems == 0)
+#line 927
return NC_NOERR;
+#line 927
+#line 927
assert(value != NULL);
+#line 927
+#line 927
for(;;)
+#line 927
{
+#line 927
size_t extent = MIN(remaining, ncp->chunk);
+#line 927
size_t nget = ncx_howmany(varp->type, extent);
+#line 927
+#line 927
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 927
0, (void **)&xp); /* cast away const */
+#line 927
if(lstatus != NC_NOERR)
+#line 927
return lstatus;
+#line 927
+#line 927
lstatus = ncx_getn_double_short(&xp, nget, value);
+#line 927
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 927
status = lstatus;
+#line 927
+#line 927
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 927
+#line 927
remaining -= extent;
+#line 927
if(remaining == 0)
+#line 927
break; /* normal loop exit */
+#line 927
offset += extent;
+#line 927
value += nget;
+#line 927
}
+#line 927
+#line 927
return status;
+#line 927
}
+#line 927
static int
+#line 928
getNCvx_double_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 928
const size_t *start, size_t nelems, int *value)
+#line 928
{
+#line 928
off_t offset = NC_varoffset(ncp, varp, start);
+#line 928
size_t remaining = varp->xsz * nelems;
+#line 928
int status = NC_NOERR;
+#line 928
const void *xp;
+#line 928
+#line 928
if(nelems == 0)
+#line 928
return NC_NOERR;
+#line 928
+#line 928
assert(value != NULL);
+#line 928
+#line 928
for(;;)
+#line 928
{
+#line 928
size_t extent = MIN(remaining, ncp->chunk);
+#line 928
size_t nget = ncx_howmany(varp->type, extent);
+#line 928
+#line 928
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 928
0, (void **)&xp); /* cast away const */
+#line 928
if(lstatus != NC_NOERR)
+#line 928
return lstatus;
+#line 928
+#line 928
lstatus = ncx_getn_double_int(&xp, nget, value);
+#line 928
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 928
status = lstatus;
+#line 928
+#line 928
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 928
+#line 928
remaining -= extent;
+#line 928
if(remaining == 0)
+#line 928
break; /* normal loop exit */
+#line 928
offset += extent;
+#line 928
value += nget;
+#line 928
}
+#line 928
+#line 928
return status;
+#line 928
}
+#line 928
static int
+#line 929
getNCvx_double_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 929
const size_t *start, size_t nelems, float *value)
+#line 929
{
+#line 929
off_t offset = NC_varoffset(ncp, varp, start);
+#line 929
size_t remaining = varp->xsz * nelems;
+#line 929
int status = NC_NOERR;
+#line 929
const void *xp;
+#line 929
+#line 929
if(nelems == 0)
+#line 929
return NC_NOERR;
+#line 929
+#line 929
assert(value != NULL);
+#line 929
+#line 929
for(;;)
+#line 929
{
+#line 929
size_t extent = MIN(remaining, ncp->chunk);
+#line 929
size_t nget = ncx_howmany(varp->type, extent);
+#line 929
+#line 929
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 929
0, (void **)&xp); /* cast away const */
+#line 929
if(lstatus != NC_NOERR)
+#line 929
return lstatus;
+#line 929
+#line 929
lstatus = ncx_getn_double_float(&xp, nget, value);
+#line 929
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 929
status = lstatus;
+#line 929
+#line 929
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 929
+#line 929
remaining -= extent;
+#line 929
if(remaining == 0)
+#line 929
break; /* normal loop exit */
+#line 929
offset += extent;
+#line 929
value += nget;
+#line 929
}
+#line 929
+#line 929
return status;
+#line 929
}
+#line 929
static int
+#line 930
getNCvx_double_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 930
const size_t *start, size_t nelems, double *value)
+#line 930
{
+#line 930
off_t offset = NC_varoffset(ncp, varp, start);
+#line 930
size_t remaining = varp->xsz * nelems;
+#line 930
int status = NC_NOERR;
+#line 930
const void *xp;
+#line 930
+#line 930
if(nelems == 0)
+#line 930
return NC_NOERR;
+#line 930
+#line 930
assert(value != NULL);
+#line 930
+#line 930
for(;;)
+#line 930
{
+#line 930
size_t extent = MIN(remaining, ncp->chunk);
+#line 930
size_t nget = ncx_howmany(varp->type, extent);
+#line 930
+#line 930
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 930
0, (void **)&xp); /* cast away const */
+#line 930
if(lstatus != NC_NOERR)
+#line 930
return lstatus;
+#line 930
+#line 930
lstatus = ncx_getn_double_double(&xp, nget, value);
+#line 930
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 930
status = lstatus;
+#line 930
+#line 930
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 930
+#line 930
remaining -= extent;
+#line 930
if(remaining == 0)
+#line 930
break; /* normal loop exit */
+#line 930
offset += extent;
+#line 930
value += nget;
+#line 930
}
+#line 930
+#line 930
return status;
+#line 930
}
+#line 930
static int
+#line 931
getNCvx_double_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 931
const size_t *start, size_t nelems, longlong *value)
+#line 931
{
+#line 931
off_t offset = NC_varoffset(ncp, varp, start);
+#line 931
size_t remaining = varp->xsz * nelems;
+#line 931
int status = NC_NOERR;
+#line 931
const void *xp;
+#line 931
+#line 931
if(nelems == 0)
+#line 931
return NC_NOERR;
+#line 931
+#line 931
assert(value != NULL);
+#line 931
+#line 931
for(;;)
+#line 931
{
+#line 931
size_t extent = MIN(remaining, ncp->chunk);
+#line 931
size_t nget = ncx_howmany(varp->type, extent);
+#line 931
+#line 931
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 931
0, (void **)&xp); /* cast away const */
+#line 931
if(lstatus != NC_NOERR)
+#line 931
return lstatus;
+#line 931
+#line 931
lstatus = ncx_getn_double_longlong(&xp, nget, value);
+#line 931
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 931
status = lstatus;
+#line 931
+#line 931
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 931
+#line 931
remaining -= extent;
+#line 931
if(remaining == 0)
+#line 931
break; /* normal loop exit */
+#line 931
offset += extent;
+#line 931
value += nget;
+#line 931
}
+#line 931
+#line 931
return status;
+#line 931
}
+#line 931
static int
+#line 932
getNCvx_double_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 932
const size_t *start, size_t nelems, uint *value)
+#line 932
{
+#line 932
off_t offset = NC_varoffset(ncp, varp, start);
+#line 932
size_t remaining = varp->xsz * nelems;
+#line 932
int status = NC_NOERR;
+#line 932
const void *xp;
+#line 932
+#line 932
if(nelems == 0)
+#line 932
return NC_NOERR;
+#line 932
+#line 932
assert(value != NULL);
+#line 932
+#line 932
for(;;)
+#line 932
{
+#line 932
size_t extent = MIN(remaining, ncp->chunk);
+#line 932
size_t nget = ncx_howmany(varp->type, extent);
+#line 932
+#line 932
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 932
0, (void **)&xp); /* cast away const */
+#line 932
if(lstatus != NC_NOERR)
+#line 932
return lstatus;
+#line 932
+#line 932
lstatus = ncx_getn_double_uint(&xp, nget, value);
+#line 932
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 932
status = lstatus;
+#line 932
+#line 932
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 932
+#line 932
remaining -= extent;
+#line 932
if(remaining == 0)
+#line 932
break; /* normal loop exit */
+#line 932
offset += extent;
+#line 932
value += nget;
+#line 932
}
+#line 932
+#line 932
return status;
+#line 932
}
+#line 932
static int
+#line 933
getNCvx_double_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 933
const size_t *start, size_t nelems, ulonglong *value)
+#line 933
{
+#line 933
off_t offset = NC_varoffset(ncp, varp, start);
+#line 933
size_t remaining = varp->xsz * nelems;
+#line 933
int status = NC_NOERR;
+#line 933
const void *xp;
+#line 933
+#line 933
if(nelems == 0)
+#line 933
return NC_NOERR;
+#line 933
+#line 933
assert(value != NULL);
+#line 933
+#line 933
for(;;)
+#line 933
{
+#line 933
size_t extent = MIN(remaining, ncp->chunk);
+#line 933
size_t nget = ncx_howmany(varp->type, extent);
+#line 933
+#line 933
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 933
0, (void **)&xp); /* cast away const */
+#line 933
if(lstatus != NC_NOERR)
+#line 933
return lstatus;
+#line 933
+#line 933
lstatus = ncx_getn_double_ulonglong(&xp, nget, value);
+#line 933
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 933
status = lstatus;
+#line 933
+#line 933
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 933
+#line 933
remaining -= extent;
+#line 933
if(remaining == 0)
+#line 933
break; /* normal loop exit */
+#line 933
offset += extent;
+#line 933
value += nget;
+#line 933
}
+#line 933
+#line 933
return status;
+#line 933
}
+#line 933
static int
+#line 934
getNCvx_double_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 934
const size_t *start, size_t nelems, ushort *value)
+#line 934
{
+#line 934
off_t offset = NC_varoffset(ncp, varp, start);
+#line 934
size_t remaining = varp->xsz * nelems;
+#line 934
int status = NC_NOERR;
+#line 934
const void *xp;
+#line 934
+#line 934
if(nelems == 0)
+#line 934
return NC_NOERR;
+#line 934
+#line 934
assert(value != NULL);
+#line 934
+#line 934
for(;;)
+#line 934
{
+#line 934
size_t extent = MIN(remaining, ncp->chunk);
+#line 934
size_t nget = ncx_howmany(varp->type, extent);
+#line 934
+#line 934
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 934
0, (void **)&xp); /* cast away const */
+#line 934
if(lstatus != NC_NOERR)
+#line 934
return lstatus;
+#line 934
+#line 934
lstatus = ncx_getn_double_ushort(&xp, nget, value);
+#line 934
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 934
status = lstatus;
+#line 934
+#line 934
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 934
+#line 934
remaining -= extent;
+#line 934
if(remaining == 0)
+#line 934
break; /* normal loop exit */
+#line 934
offset += extent;
+#line 934
value += nget;
+#line 934
}
+#line 934
+#line 934
return status;
+#line 934
}
+#line 934
static int
+#line 936
getNCvx_uchar_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 936
const size_t *start, size_t nelems, schar *value)
+#line 936
{
+#line 936
off_t offset = NC_varoffset(ncp, varp, start);
+#line 936
size_t remaining = varp->xsz * nelems;
+#line 936
int status = NC_NOERR;
+#line 936
const void *xp;
+#line 936
+#line 936
if(nelems == 0)
+#line 936
return NC_NOERR;
+#line 936
+#line 936
assert(value != NULL);
+#line 936
+#line 936
for(;;)
+#line 936
{
+#line 936
size_t extent = MIN(remaining, ncp->chunk);
+#line 936
size_t nget = ncx_howmany(varp->type, extent);
+#line 936
+#line 936
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 936
0, (void **)&xp); /* cast away const */
+#line 936
if(lstatus != NC_NOERR)
+#line 936
return lstatus;
+#line 936
+#line 936
lstatus = ncx_getn_uchar_schar(&xp, nget, value);
+#line 936
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 936
status = lstatus;
+#line 936
+#line 936
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 936
+#line 936
remaining -= extent;
+#line 936
if(remaining == 0)
+#line 936
break; /* normal loop exit */
+#line 936
offset += extent;
+#line 936
value += nget;
+#line 936
}
+#line 936
+#line 936
return status;
+#line 936
}
+#line 936
static int
+#line 937
getNCvx_uchar_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 937
const size_t *start, size_t nelems, uchar *value)
+#line 937
{
+#line 937
off_t offset = NC_varoffset(ncp, varp, start);
+#line 937
size_t remaining = varp->xsz * nelems;
+#line 937
int status = NC_NOERR;
+#line 937
const void *xp;
+#line 937
+#line 937
if(nelems == 0)
+#line 937
return NC_NOERR;
+#line 937
+#line 937
assert(value != NULL);
+#line 937
+#line 937
for(;;)
+#line 937
{
+#line 937
size_t extent = MIN(remaining, ncp->chunk);
+#line 937
size_t nget = ncx_howmany(varp->type, extent);
+#line 937
+#line 937
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 937
0, (void **)&xp); /* cast away const */
+#line 937
if(lstatus != NC_NOERR)
+#line 937
return lstatus;
+#line 937
+#line 937
lstatus = ncx_getn_uchar_uchar(&xp, nget, value);
+#line 937
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 937
status = lstatus;
+#line 937
+#line 937
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 937
+#line 937
remaining -= extent;
+#line 937
if(remaining == 0)
+#line 937
break; /* normal loop exit */
+#line 937
offset += extent;
+#line 937
value += nget;
+#line 937
}
+#line 937
+#line 937
return status;
+#line 937
}
+#line 937
static int
+#line 938
getNCvx_uchar_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 938
const size_t *start, size_t nelems, short *value)
+#line 938
{
+#line 938
off_t offset = NC_varoffset(ncp, varp, start);
+#line 938
size_t remaining = varp->xsz * nelems;
+#line 938
int status = NC_NOERR;
+#line 938
const void *xp;
+#line 938
+#line 938
if(nelems == 0)
+#line 938
return NC_NOERR;
+#line 938
+#line 938
assert(value != NULL);
+#line 938
+#line 938
for(;;)
+#line 938
{
+#line 938
size_t extent = MIN(remaining, ncp->chunk);
+#line 938
size_t nget = ncx_howmany(varp->type, extent);
+#line 938
+#line 938
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 938
0, (void **)&xp); /* cast away const */
+#line 938
if(lstatus != NC_NOERR)
+#line 938
return lstatus;
+#line 938
+#line 938
lstatus = ncx_getn_uchar_short(&xp, nget, value);
+#line 938
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 938
status = lstatus;
+#line 938
+#line 938
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 938
+#line 938
remaining -= extent;
+#line 938
if(remaining == 0)
+#line 938
break; /* normal loop exit */
+#line 938
offset += extent;
+#line 938
value += nget;
+#line 938
}
+#line 938
+#line 938
return status;
+#line 938
}
+#line 938
static int
+#line 939
getNCvx_uchar_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 939
const size_t *start, size_t nelems, int *value)
+#line 939
{
+#line 939
off_t offset = NC_varoffset(ncp, varp, start);
+#line 939
size_t remaining = varp->xsz * nelems;
+#line 939
int status = NC_NOERR;
+#line 939
const void *xp;
+#line 939
+#line 939
if(nelems == 0)
+#line 939
return NC_NOERR;
+#line 939
+#line 939
assert(value != NULL);
+#line 939
+#line 939
for(;;)
+#line 939
{
+#line 939
size_t extent = MIN(remaining, ncp->chunk);
+#line 939
size_t nget = ncx_howmany(varp->type, extent);
+#line 939
+#line 939
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 939
0, (void **)&xp); /* cast away const */
+#line 939
if(lstatus != NC_NOERR)
+#line 939
return lstatus;
+#line 939
+#line 939
lstatus = ncx_getn_uchar_int(&xp, nget, value);
+#line 939
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 939
status = lstatus;
+#line 939
+#line 939
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 939
+#line 939
remaining -= extent;
+#line 939
if(remaining == 0)
+#line 939
break; /* normal loop exit */
+#line 939
offset += extent;
+#line 939
value += nget;
+#line 939
}
+#line 939
+#line 939
return status;
+#line 939
}
+#line 939
static int
+#line 940
getNCvx_uchar_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 940
const size_t *start, size_t nelems, float *value)
+#line 940
{
+#line 940
off_t offset = NC_varoffset(ncp, varp, start);
+#line 940
size_t remaining = varp->xsz * nelems;
+#line 940
int status = NC_NOERR;
+#line 940
const void *xp;
+#line 940
+#line 940
if(nelems == 0)
+#line 940
return NC_NOERR;
+#line 940
+#line 940
assert(value != NULL);
+#line 940
+#line 940
for(;;)
+#line 940
{
+#line 940
size_t extent = MIN(remaining, ncp->chunk);
+#line 940
size_t nget = ncx_howmany(varp->type, extent);
+#line 940
+#line 940
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 940
0, (void **)&xp); /* cast away const */
+#line 940
if(lstatus != NC_NOERR)
+#line 940
return lstatus;
+#line 940
+#line 940
lstatus = ncx_getn_uchar_float(&xp, nget, value);
+#line 940
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 940
status = lstatus;
+#line 940
+#line 940
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 940
+#line 940
remaining -= extent;
+#line 940
if(remaining == 0)
+#line 940
break; /* normal loop exit */
+#line 940
offset += extent;
+#line 940
value += nget;
+#line 940
}
+#line 940
+#line 940
return status;
+#line 940
}
+#line 940
static int
+#line 941
getNCvx_uchar_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 941
const size_t *start, size_t nelems, double *value)
+#line 941
{
+#line 941
off_t offset = NC_varoffset(ncp, varp, start);
+#line 941
size_t remaining = varp->xsz * nelems;
+#line 941
int status = NC_NOERR;
+#line 941
const void *xp;
+#line 941
+#line 941
if(nelems == 0)
+#line 941
return NC_NOERR;
+#line 941
+#line 941
assert(value != NULL);
+#line 941
+#line 941
for(;;)
+#line 941
{
+#line 941
size_t extent = MIN(remaining, ncp->chunk);
+#line 941
size_t nget = ncx_howmany(varp->type, extent);
+#line 941
+#line 941
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 941
0, (void **)&xp); /* cast away const */
+#line 941
if(lstatus != NC_NOERR)
+#line 941
return lstatus;
+#line 941
+#line 941
lstatus = ncx_getn_uchar_double(&xp, nget, value);
+#line 941
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 941
status = lstatus;
+#line 941
+#line 941
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 941
+#line 941
remaining -= extent;
+#line 941
if(remaining == 0)
+#line 941
break; /* normal loop exit */
+#line 941
offset += extent;
+#line 941
value += nget;
+#line 941
}
+#line 941
+#line 941
return status;
+#line 941
}
+#line 941
static int
+#line 942
getNCvx_uchar_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 942
const size_t *start, size_t nelems, longlong *value)
+#line 942
{
+#line 942
off_t offset = NC_varoffset(ncp, varp, start);
+#line 942
size_t remaining = varp->xsz * nelems;
+#line 942
int status = NC_NOERR;
+#line 942
const void *xp;
+#line 942
+#line 942
if(nelems == 0)
+#line 942
return NC_NOERR;
+#line 942
+#line 942
assert(value != NULL);
+#line 942
+#line 942
for(;;)
+#line 942
{
+#line 942
size_t extent = MIN(remaining, ncp->chunk);
+#line 942
size_t nget = ncx_howmany(varp->type, extent);
+#line 942
+#line 942
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 942
0, (void **)&xp); /* cast away const */
+#line 942
if(lstatus != NC_NOERR)
+#line 942
return lstatus;
+#line 942
+#line 942
lstatus = ncx_getn_uchar_longlong(&xp, nget, value);
+#line 942
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 942
status = lstatus;
+#line 942
+#line 942
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 942
+#line 942
remaining -= extent;
+#line 942
if(remaining == 0)
+#line 942
break; /* normal loop exit */
+#line 942
offset += extent;
+#line 942
value += nget;
+#line 942
}
+#line 942
+#line 942
return status;
+#line 942
}
+#line 942
static int
+#line 943
getNCvx_uchar_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 943
const size_t *start, size_t nelems, uint *value)
+#line 943
{
+#line 943
off_t offset = NC_varoffset(ncp, varp, start);
+#line 943
size_t remaining = varp->xsz * nelems;
+#line 943
int status = NC_NOERR;
+#line 943
const void *xp;
+#line 943
+#line 943
if(nelems == 0)
+#line 943
return NC_NOERR;
+#line 943
+#line 943
assert(value != NULL);
+#line 943
+#line 943
for(;;)
+#line 943
{
+#line 943
size_t extent = MIN(remaining, ncp->chunk);
+#line 943
size_t nget = ncx_howmany(varp->type, extent);
+#line 943
+#line 943
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 943
0, (void **)&xp); /* cast away const */
+#line 943
if(lstatus != NC_NOERR)
+#line 943
return lstatus;
+#line 943
+#line 943
lstatus = ncx_getn_uchar_uint(&xp, nget, value);
+#line 943
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 943
status = lstatus;
+#line 943
+#line 943
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 943
+#line 943
remaining -= extent;
+#line 943
if(remaining == 0)
+#line 943
break; /* normal loop exit */
+#line 943
offset += extent;
+#line 943
value += nget;
+#line 943
}
+#line 943
+#line 943
return status;
+#line 943
}
+#line 943
static int
+#line 944
getNCvx_uchar_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 944
const size_t *start, size_t nelems, ulonglong *value)
+#line 944
{
+#line 944
off_t offset = NC_varoffset(ncp, varp, start);
+#line 944
size_t remaining = varp->xsz * nelems;
+#line 944
int status = NC_NOERR;
+#line 944
const void *xp;
+#line 944
+#line 944
if(nelems == 0)
+#line 944
return NC_NOERR;
+#line 944
+#line 944
assert(value != NULL);
+#line 944
+#line 944
for(;;)
+#line 944
{
+#line 944
size_t extent = MIN(remaining, ncp->chunk);
+#line 944
size_t nget = ncx_howmany(varp->type, extent);
+#line 944
+#line 944
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 944
0, (void **)&xp); /* cast away const */
+#line 944
if(lstatus != NC_NOERR)
+#line 944
return lstatus;
+#line 944
+#line 944
lstatus = ncx_getn_uchar_ulonglong(&xp, nget, value);
+#line 944
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 944
status = lstatus;
+#line 944
+#line 944
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 944
+#line 944
remaining -= extent;
+#line 944
if(remaining == 0)
+#line 944
break; /* normal loop exit */
+#line 944
offset += extent;
+#line 944
value += nget;
+#line 944
}
+#line 944
+#line 944
return status;
+#line 944
}
+#line 944
static int
+#line 945
getNCvx_uchar_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 945
const size_t *start, size_t nelems, ushort *value)
+#line 945
{
+#line 945
off_t offset = NC_varoffset(ncp, varp, start);
+#line 945
size_t remaining = varp->xsz * nelems;
+#line 945
int status = NC_NOERR;
+#line 945
const void *xp;
+#line 945
+#line 945
if(nelems == 0)
+#line 945
return NC_NOERR;
+#line 945
+#line 945
assert(value != NULL);
+#line 945
+#line 945
for(;;)
+#line 945
{
+#line 945
size_t extent = MIN(remaining, ncp->chunk);
+#line 945
size_t nget = ncx_howmany(varp->type, extent);
+#line 945
+#line 945
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 945
0, (void **)&xp); /* cast away const */
+#line 945
if(lstatus != NC_NOERR)
+#line 945
return lstatus;
+#line 945
+#line 945
lstatus = ncx_getn_uchar_ushort(&xp, nget, value);
+#line 945
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 945
status = lstatus;
+#line 945
+#line 945
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 945
+#line 945
remaining -= extent;
+#line 945
if(remaining == 0)
+#line 945
break; /* normal loop exit */
+#line 945
offset += extent;
+#line 945
value += nget;
+#line 945
}
+#line 945
+#line 945
return status;
+#line 945
}
+#line 945
static int
+#line 947
getNCvx_ushort_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 947
const size_t *start, size_t nelems, schar *value)
+#line 947
{
+#line 947
off_t offset = NC_varoffset(ncp, varp, start);
+#line 947
size_t remaining = varp->xsz * nelems;
+#line 947
int status = NC_NOERR;
+#line 947
const void *xp;
+#line 947
+#line 947
if(nelems == 0)
+#line 947
return NC_NOERR;
+#line 947
+#line 947
assert(value != NULL);
+#line 947
+#line 947
for(;;)
+#line 947
{
+#line 947
size_t extent = MIN(remaining, ncp->chunk);
+#line 947
size_t nget = ncx_howmany(varp->type, extent);
+#line 947
+#line 947
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 947
0, (void **)&xp); /* cast away const */
+#line 947
if(lstatus != NC_NOERR)
+#line 947
return lstatus;
+#line 947
+#line 947
lstatus = ncx_getn_ushort_schar(&xp, nget, value);
+#line 947
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 947
status = lstatus;
+#line 947
+#line 947
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 947
+#line 947
remaining -= extent;
+#line 947
if(remaining == 0)
+#line 947
break; /* normal loop exit */
+#line 947
offset += extent;
+#line 947
value += nget;
+#line 947
}
+#line 947
+#line 947
return status;
+#line 947
}
+#line 947
static int
+#line 948
getNCvx_ushort_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 948
const size_t *start, size_t nelems, uchar *value)
+#line 948
{
+#line 948
off_t offset = NC_varoffset(ncp, varp, start);
+#line 948
size_t remaining = varp->xsz * nelems;
+#line 948
int status = NC_NOERR;
+#line 948
const void *xp;
+#line 948
+#line 948
if(nelems == 0)
+#line 948
return NC_NOERR;
+#line 948
+#line 948
assert(value != NULL);
+#line 948
+#line 948
for(;;)
+#line 948
{
+#line 948
size_t extent = MIN(remaining, ncp->chunk);
+#line 948
size_t nget = ncx_howmany(varp->type, extent);
+#line 948
+#line 948
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 948
0, (void **)&xp); /* cast away const */
+#line 948
if(lstatus != NC_NOERR)
+#line 948
return lstatus;
+#line 948
+#line 948
lstatus = ncx_getn_ushort_uchar(&xp, nget, value);
+#line 948
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 948
status = lstatus;
+#line 948
+#line 948
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 948
+#line 948
remaining -= extent;
+#line 948
if(remaining == 0)
+#line 948
break; /* normal loop exit */
+#line 948
offset += extent;
+#line 948
value += nget;
+#line 948
}
+#line 948
+#line 948
return status;
+#line 948
}
+#line 948
static int
+#line 949
getNCvx_ushort_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 949
const size_t *start, size_t nelems, short *value)
+#line 949
{
+#line 949
off_t offset = NC_varoffset(ncp, varp, start);
+#line 949
size_t remaining = varp->xsz * nelems;
+#line 949
int status = NC_NOERR;
+#line 949
const void *xp;
+#line 949
+#line 949
if(nelems == 0)
+#line 949
return NC_NOERR;
+#line 949
+#line 949
assert(value != NULL);
+#line 949
+#line 949
for(;;)
+#line 949
{
+#line 949
size_t extent = MIN(remaining, ncp->chunk);
+#line 949
size_t nget = ncx_howmany(varp->type, extent);
+#line 949
+#line 949
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 949
0, (void **)&xp); /* cast away const */
+#line 949
if(lstatus != NC_NOERR)
+#line 949
return lstatus;
+#line 949
+#line 949
lstatus = ncx_getn_ushort_short(&xp, nget, value);
+#line 949
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 949
status = lstatus;
+#line 949
+#line 949
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 949
+#line 949
remaining -= extent;
+#line 949
if(remaining == 0)
+#line 949
break; /* normal loop exit */
+#line 949
offset += extent;
+#line 949
value += nget;
+#line 949
}
+#line 949
+#line 949
return status;
+#line 949
}
+#line 949
static int
+#line 950
getNCvx_ushort_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 950
const size_t *start, size_t nelems, int *value)
+#line 950
{
+#line 950
off_t offset = NC_varoffset(ncp, varp, start);
+#line 950
size_t remaining = varp->xsz * nelems;
+#line 950
int status = NC_NOERR;
+#line 950
const void *xp;
+#line 950
+#line 950
if(nelems == 0)
+#line 950
return NC_NOERR;
+#line 950
+#line 950
assert(value != NULL);
+#line 950
+#line 950
for(;;)
+#line 950
{
+#line 950
size_t extent = MIN(remaining, ncp->chunk);
+#line 950
size_t nget = ncx_howmany(varp->type, extent);
+#line 950
+#line 950
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 950
0, (void **)&xp); /* cast away const */
+#line 950
if(lstatus != NC_NOERR)
+#line 950
return lstatus;
+#line 950
+#line 950
lstatus = ncx_getn_ushort_int(&xp, nget, value);
+#line 950
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 950
status = lstatus;
+#line 950
+#line 950
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 950
+#line 950
remaining -= extent;
+#line 950
if(remaining == 0)
+#line 950
break; /* normal loop exit */
+#line 950
offset += extent;
+#line 950
value += nget;
+#line 950
}
+#line 950
+#line 950
return status;
+#line 950
}
+#line 950
static int
+#line 951
getNCvx_ushort_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 951
const size_t *start, size_t nelems, float *value)
+#line 951
{
+#line 951
off_t offset = NC_varoffset(ncp, varp, start);
+#line 951
size_t remaining = varp->xsz * nelems;
+#line 951
int status = NC_NOERR;
+#line 951
const void *xp;
+#line 951
+#line 951
if(nelems == 0)
+#line 951
return NC_NOERR;
+#line 951
+#line 951
assert(value != NULL);
+#line 951
+#line 951
for(;;)
+#line 951
{
+#line 951
size_t extent = MIN(remaining, ncp->chunk);
+#line 951
size_t nget = ncx_howmany(varp->type, extent);
+#line 951
+#line 951
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 951
0, (void **)&xp); /* cast away const */
+#line 951
if(lstatus != NC_NOERR)
+#line 951
return lstatus;
+#line 951
+#line 951
lstatus = ncx_getn_ushort_float(&xp, nget, value);
+#line 951
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 951
status = lstatus;
+#line 951
+#line 951
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 951
+#line 951
remaining -= extent;
+#line 951
if(remaining == 0)
+#line 951
break; /* normal loop exit */
+#line 951
offset += extent;
+#line 951
value += nget;
+#line 951
}
+#line 951
+#line 951
return status;
+#line 951
}
+#line 951
static int
+#line 952
getNCvx_ushort_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 952
const size_t *start, size_t nelems, double *value)
+#line 952
{
+#line 952
off_t offset = NC_varoffset(ncp, varp, start);
+#line 952
size_t remaining = varp->xsz * nelems;
+#line 952
int status = NC_NOERR;
+#line 952
const void *xp;
+#line 952
+#line 952
if(nelems == 0)
+#line 952
return NC_NOERR;
+#line 952
+#line 952
assert(value != NULL);
+#line 952
+#line 952
for(;;)
+#line 952
{
+#line 952
size_t extent = MIN(remaining, ncp->chunk);
+#line 952
size_t nget = ncx_howmany(varp->type, extent);
+#line 952
+#line 952
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 952
0, (void **)&xp); /* cast away const */
+#line 952
if(lstatus != NC_NOERR)
+#line 952
return lstatus;
+#line 952
+#line 952
lstatus = ncx_getn_ushort_double(&xp, nget, value);
+#line 952
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 952
status = lstatus;
+#line 952
+#line 952
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 952
+#line 952
remaining -= extent;
+#line 952
if(remaining == 0)
+#line 952
break; /* normal loop exit */
+#line 952
offset += extent;
+#line 952
value += nget;
+#line 952
}
+#line 952
+#line 952
return status;
+#line 952
}
+#line 952
static int
+#line 953
getNCvx_ushort_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 953
const size_t *start, size_t nelems, longlong *value)
+#line 953
{
+#line 953
off_t offset = NC_varoffset(ncp, varp, start);
+#line 953
size_t remaining = varp->xsz * nelems;
+#line 953
int status = NC_NOERR;
+#line 953
const void *xp;
+#line 953
+#line 953
if(nelems == 0)
+#line 953
return NC_NOERR;
+#line 953
+#line 953
assert(value != NULL);
+#line 953
+#line 953
for(;;)
+#line 953
{
+#line 953
size_t extent = MIN(remaining, ncp->chunk);
+#line 953
size_t nget = ncx_howmany(varp->type, extent);
+#line 953
+#line 953
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 953
0, (void **)&xp); /* cast away const */
+#line 953
if(lstatus != NC_NOERR)
+#line 953
return lstatus;
+#line 953
+#line 953
lstatus = ncx_getn_ushort_longlong(&xp, nget, value);
+#line 953
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 953
status = lstatus;
+#line 953
+#line 953
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 953
+#line 953
remaining -= extent;
+#line 953
if(remaining == 0)
+#line 953
break; /* normal loop exit */
+#line 953
offset += extent;
+#line 953
value += nget;
+#line 953
}
+#line 953
+#line 953
return status;
+#line 953
}
+#line 953
static int
+#line 954
getNCvx_ushort_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 954
const size_t *start, size_t nelems, uint *value)
+#line 954
{
+#line 954
off_t offset = NC_varoffset(ncp, varp, start);
+#line 954
size_t remaining = varp->xsz * nelems;
+#line 954
int status = NC_NOERR;
+#line 954
const void *xp;
+#line 954
+#line 954
if(nelems == 0)
+#line 954
return NC_NOERR;
+#line 954
+#line 954
assert(value != NULL);
+#line 954
+#line 954
for(;;)
+#line 954
{
+#line 954
size_t extent = MIN(remaining, ncp->chunk);
+#line 954
size_t nget = ncx_howmany(varp->type, extent);
+#line 954
+#line 954
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 954
0, (void **)&xp); /* cast away const */
+#line 954
if(lstatus != NC_NOERR)
+#line 954
return lstatus;
+#line 954
+#line 954
lstatus = ncx_getn_ushort_uint(&xp, nget, value);
+#line 954
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 954
status = lstatus;
+#line 954
+#line 954
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 954
+#line 954
remaining -= extent;
+#line 954
if(remaining == 0)
+#line 954
break; /* normal loop exit */
+#line 954
offset += extent;
+#line 954
value += nget;
+#line 954
}
+#line 954
+#line 954
return status;
+#line 954
}
+#line 954
static int
+#line 955
getNCvx_ushort_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 955
const size_t *start, size_t nelems, ulonglong *value)
+#line 955
{
+#line 955
off_t offset = NC_varoffset(ncp, varp, start);
+#line 955
size_t remaining = varp->xsz * nelems;
+#line 955
int status = NC_NOERR;
+#line 955
const void *xp;
+#line 955
+#line 955
if(nelems == 0)
+#line 955
return NC_NOERR;
+#line 955
+#line 955
assert(value != NULL);
+#line 955
+#line 955
for(;;)
+#line 955
{
+#line 955
size_t extent = MIN(remaining, ncp->chunk);
+#line 955
size_t nget = ncx_howmany(varp->type, extent);
+#line 955
+#line 955
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 955
0, (void **)&xp); /* cast away const */
+#line 955
if(lstatus != NC_NOERR)
+#line 955
return lstatus;
+#line 955
+#line 955
lstatus = ncx_getn_ushort_ulonglong(&xp, nget, value);
+#line 955
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 955
status = lstatus;
+#line 955
+#line 955
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 955
+#line 955
remaining -= extent;
+#line 955
if(remaining == 0)
+#line 955
break; /* normal loop exit */
+#line 955
offset += extent;
+#line 955
value += nget;
+#line 955
}
+#line 955
+#line 955
return status;
+#line 955
}
+#line 955
static int
+#line 956
getNCvx_ushort_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 956
const size_t *start, size_t nelems, ushort *value)
+#line 956
{
+#line 956
off_t offset = NC_varoffset(ncp, varp, start);
+#line 956
size_t remaining = varp->xsz * nelems;
+#line 956
int status = NC_NOERR;
+#line 956
const void *xp;
+#line 956
+#line 956
if(nelems == 0)
+#line 956
return NC_NOERR;
+#line 956
+#line 956
assert(value != NULL);
+#line 956
+#line 956
for(;;)
+#line 956
{
+#line 956
size_t extent = MIN(remaining, ncp->chunk);
+#line 956
size_t nget = ncx_howmany(varp->type, extent);
+#line 956
+#line 956
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 956
0, (void **)&xp); /* cast away const */
+#line 956
if(lstatus != NC_NOERR)
+#line 956
return lstatus;
+#line 956
+#line 956
lstatus = ncx_getn_ushort_ushort(&xp, nget, value);
+#line 956
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 956
status = lstatus;
+#line 956
+#line 956
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 956
+#line 956
remaining -= extent;
+#line 956
if(remaining == 0)
+#line 956
break; /* normal loop exit */
+#line 956
offset += extent;
+#line 956
value += nget;
+#line 956
}
+#line 956
+#line 956
return status;
+#line 956
}
+#line 956
static int
+#line 958
getNCvx_uint_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 958
const size_t *start, size_t nelems, schar *value)
+#line 958
{
+#line 958
off_t offset = NC_varoffset(ncp, varp, start);
+#line 958
size_t remaining = varp->xsz * nelems;
+#line 958
int status = NC_NOERR;
+#line 958
const void *xp;
+#line 958
+#line 958
if(nelems == 0)
+#line 958
return NC_NOERR;
+#line 958
+#line 958
assert(value != NULL);
+#line 958
+#line 958
for(;;)
+#line 958
{
+#line 958
size_t extent = MIN(remaining, ncp->chunk);
+#line 958
size_t nget = ncx_howmany(varp->type, extent);
+#line 958
+#line 958
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 958
0, (void **)&xp); /* cast away const */
+#line 958
if(lstatus != NC_NOERR)
+#line 958
return lstatus;
+#line 958
+#line 958
lstatus = ncx_getn_uint_schar(&xp, nget, value);
+#line 958
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 958
status = lstatus;
+#line 958
+#line 958
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 958
+#line 958
remaining -= extent;
+#line 958
if(remaining == 0)
+#line 958
break; /* normal loop exit */
+#line 958
offset += extent;
+#line 958
value += nget;
+#line 958
}
+#line 958
+#line 958
return status;
+#line 958
}
+#line 958
static int
+#line 959
getNCvx_uint_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 959
const size_t *start, size_t nelems, uchar *value)
+#line 959
{
+#line 959
off_t offset = NC_varoffset(ncp, varp, start);
+#line 959
size_t remaining = varp->xsz * nelems;
+#line 959
int status = NC_NOERR;
+#line 959
const void *xp;
+#line 959
+#line 959
if(nelems == 0)
+#line 959
return NC_NOERR;
+#line 959
+#line 959
assert(value != NULL);
+#line 959
+#line 959
for(;;)
+#line 959
{
+#line 959
size_t extent = MIN(remaining, ncp->chunk);
+#line 959
size_t nget = ncx_howmany(varp->type, extent);
+#line 959
+#line 959
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 959
0, (void **)&xp); /* cast away const */
+#line 959
if(lstatus != NC_NOERR)
+#line 959
return lstatus;
+#line 959
+#line 959
lstatus = ncx_getn_uint_uchar(&xp, nget, value);
+#line 959
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 959
status = lstatus;
+#line 959
+#line 959
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 959
+#line 959
remaining -= extent;
+#line 959
if(remaining == 0)
+#line 959
break; /* normal loop exit */
+#line 959
offset += extent;
+#line 959
value += nget;
+#line 959
}
+#line 959
+#line 959
return status;
+#line 959
}
+#line 959
static int
+#line 960
getNCvx_uint_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 960
const size_t *start, size_t nelems, short *value)
+#line 960
{
+#line 960
off_t offset = NC_varoffset(ncp, varp, start);
+#line 960
size_t remaining = varp->xsz * nelems;
+#line 960
int status = NC_NOERR;
+#line 960
const void *xp;
+#line 960
+#line 960
if(nelems == 0)
+#line 960
return NC_NOERR;
+#line 960
+#line 960
assert(value != NULL);
+#line 960
+#line 960
for(;;)
+#line 960
{
+#line 960
size_t extent = MIN(remaining, ncp->chunk);
+#line 960
size_t nget = ncx_howmany(varp->type, extent);
+#line 960
+#line 960
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 960
0, (void **)&xp); /* cast away const */
+#line 960
if(lstatus != NC_NOERR)
+#line 960
return lstatus;
+#line 960
+#line 960
lstatus = ncx_getn_uint_short(&xp, nget, value);
+#line 960
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 960
status = lstatus;
+#line 960
+#line 960
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 960
+#line 960
remaining -= extent;
+#line 960
if(remaining == 0)
+#line 960
break; /* normal loop exit */
+#line 960
offset += extent;
+#line 960
value += nget;
+#line 960
}
+#line 960
+#line 960
return status;
+#line 960
}
+#line 960
static int
+#line 961
getNCvx_uint_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 961
const size_t *start, size_t nelems, int *value)
+#line 961
{
+#line 961
off_t offset = NC_varoffset(ncp, varp, start);
+#line 961
size_t remaining = varp->xsz * nelems;
+#line 961
int status = NC_NOERR;
+#line 961
const void *xp;
+#line 961
+#line 961
if(nelems == 0)
+#line 961
return NC_NOERR;
+#line 961
+#line 961
assert(value != NULL);
+#line 961
+#line 961
for(;;)
+#line 961
{
+#line 961
size_t extent = MIN(remaining, ncp->chunk);
+#line 961
size_t nget = ncx_howmany(varp->type, extent);
+#line 961
+#line 961
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 961
0, (void **)&xp); /* cast away const */
+#line 961
if(lstatus != NC_NOERR)
+#line 961
return lstatus;
+#line 961
+#line 961
lstatus = ncx_getn_uint_int(&xp, nget, value);
+#line 961
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 961
status = lstatus;
+#line 961
+#line 961
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 961
+#line 961
remaining -= extent;
+#line 961
if(remaining == 0)
+#line 961
break; /* normal loop exit */
+#line 961
offset += extent;
+#line 961
value += nget;
+#line 961
}
+#line 961
+#line 961
return status;
+#line 961
}
+#line 961
static int
+#line 962
getNCvx_uint_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 962
const size_t *start, size_t nelems, float *value)
+#line 962
{
+#line 962
off_t offset = NC_varoffset(ncp, varp, start);
+#line 962
size_t remaining = varp->xsz * nelems;
+#line 962
int status = NC_NOERR;
+#line 962
const void *xp;
+#line 962
+#line 962
if(nelems == 0)
+#line 962
return NC_NOERR;
+#line 962
+#line 962
assert(value != NULL);
+#line 962
+#line 962
for(;;)
+#line 962
{
+#line 962
size_t extent = MIN(remaining, ncp->chunk);
+#line 962
size_t nget = ncx_howmany(varp->type, extent);
+#line 962
+#line 962
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 962
0, (void **)&xp); /* cast away const */
+#line 962
if(lstatus != NC_NOERR)
+#line 962
return lstatus;
+#line 962
+#line 962
lstatus = ncx_getn_uint_float(&xp, nget, value);
+#line 962
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 962
status = lstatus;
+#line 962
+#line 962
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 962
+#line 962
remaining -= extent;
+#line 962
if(remaining == 0)
+#line 962
break; /* normal loop exit */
+#line 962
offset += extent;
+#line 962
value += nget;
+#line 962
}
+#line 962
+#line 962
return status;
+#line 962
}
+#line 962
static int
+#line 963
getNCvx_uint_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 963
const size_t *start, size_t nelems, double *value)
+#line 963
{
+#line 963
off_t offset = NC_varoffset(ncp, varp, start);
+#line 963
size_t remaining = varp->xsz * nelems;
+#line 963
int status = NC_NOERR;
+#line 963
const void *xp;
+#line 963
+#line 963
if(nelems == 0)
+#line 963
return NC_NOERR;
+#line 963
+#line 963
assert(value != NULL);
+#line 963
+#line 963
for(;;)
+#line 963
{
+#line 963
size_t extent = MIN(remaining, ncp->chunk);
+#line 963
size_t nget = ncx_howmany(varp->type, extent);
+#line 963
+#line 963
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 963
0, (void **)&xp); /* cast away const */
+#line 963
if(lstatus != NC_NOERR)
+#line 963
return lstatus;
+#line 963
+#line 963
lstatus = ncx_getn_uint_double(&xp, nget, value);
+#line 963
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 963
status = lstatus;
+#line 963
+#line 963
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 963
+#line 963
remaining -= extent;
+#line 963
if(remaining == 0)
+#line 963
break; /* normal loop exit */
+#line 963
offset += extent;
+#line 963
value += nget;
+#line 963
}
+#line 963
+#line 963
return status;
+#line 963
}
+#line 963
static int
+#line 964
getNCvx_uint_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 964
const size_t *start, size_t nelems, longlong *value)
+#line 964
{
+#line 964
off_t offset = NC_varoffset(ncp, varp, start);
+#line 964
size_t remaining = varp->xsz * nelems;
+#line 964
int status = NC_NOERR;
+#line 964
const void *xp;
+#line 964
+#line 964
if(nelems == 0)
+#line 964
return NC_NOERR;
+#line 964
+#line 964
assert(value != NULL);
+#line 964
+#line 964
for(;;)
+#line 964
{
+#line 964
size_t extent = MIN(remaining, ncp->chunk);
+#line 964
size_t nget = ncx_howmany(varp->type, extent);
+#line 964
+#line 964
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 964
0, (void **)&xp); /* cast away const */
+#line 964
if(lstatus != NC_NOERR)
+#line 964
return lstatus;
+#line 964
+#line 964
lstatus = ncx_getn_uint_longlong(&xp, nget, value);
+#line 964
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 964
status = lstatus;
+#line 964
+#line 964
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 964
+#line 964
remaining -= extent;
+#line 964
if(remaining == 0)
+#line 964
break; /* normal loop exit */
+#line 964
offset += extent;
+#line 964
value += nget;
+#line 964
}
+#line 964
+#line 964
return status;
+#line 964
}
+#line 964
static int
+#line 965
getNCvx_uint_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 965
const size_t *start, size_t nelems, uint *value)
+#line 965
{
+#line 965
off_t offset = NC_varoffset(ncp, varp, start);
+#line 965
size_t remaining = varp->xsz * nelems;
+#line 965
int status = NC_NOERR;
+#line 965
const void *xp;
+#line 965
+#line 965
if(nelems == 0)
+#line 965
return NC_NOERR;
+#line 965
+#line 965
assert(value != NULL);
+#line 965
+#line 965
for(;;)
+#line 965
{
+#line 965
size_t extent = MIN(remaining, ncp->chunk);
+#line 965
size_t nget = ncx_howmany(varp->type, extent);
+#line 965
+#line 965
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 965
0, (void **)&xp); /* cast away const */
+#line 965
if(lstatus != NC_NOERR)
+#line 965
return lstatus;
+#line 965
+#line 965
lstatus = ncx_getn_uint_uint(&xp, nget, value);
+#line 965
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 965
status = lstatus;
+#line 965
+#line 965
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 965
+#line 965
remaining -= extent;
+#line 965
if(remaining == 0)
+#line 965
break; /* normal loop exit */
+#line 965
offset += extent;
+#line 965
value += nget;
+#line 965
}
+#line 965
+#line 965
return status;
+#line 965
}
+#line 965
static int
+#line 966
getNCvx_uint_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 966
const size_t *start, size_t nelems, ulonglong *value)
+#line 966
{
+#line 966
off_t offset = NC_varoffset(ncp, varp, start);
+#line 966
size_t remaining = varp->xsz * nelems;
+#line 966
int status = NC_NOERR;
+#line 966
const void *xp;
+#line 966
+#line 966
if(nelems == 0)
+#line 966
return NC_NOERR;
+#line 966
+#line 966
assert(value != NULL);
+#line 966
+#line 966
for(;;)
+#line 966
{
+#line 966
size_t extent = MIN(remaining, ncp->chunk);
+#line 966
size_t nget = ncx_howmany(varp->type, extent);
+#line 966
+#line 966
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 966
0, (void **)&xp); /* cast away const */
+#line 966
if(lstatus != NC_NOERR)
+#line 966
return lstatus;
+#line 966
+#line 966
lstatus = ncx_getn_uint_ulonglong(&xp, nget, value);
+#line 966
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 966
status = lstatus;
+#line 966
+#line 966
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 966
+#line 966
remaining -= extent;
+#line 966
if(remaining == 0)
+#line 966
break; /* normal loop exit */
+#line 966
offset += extent;
+#line 966
value += nget;
+#line 966
}
+#line 966
+#line 966
return status;
+#line 966
}
+#line 966
static int
+#line 967
getNCvx_uint_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 967
const size_t *start, size_t nelems, ushort *value)
+#line 967
{
+#line 967
off_t offset = NC_varoffset(ncp, varp, start);
+#line 967
size_t remaining = varp->xsz * nelems;
+#line 967
int status = NC_NOERR;
+#line 967
const void *xp;
+#line 967
+#line 967
if(nelems == 0)
+#line 967
return NC_NOERR;
+#line 967
+#line 967
assert(value != NULL);
+#line 967
+#line 967
for(;;)
+#line 967
{
+#line 967
size_t extent = MIN(remaining, ncp->chunk);
+#line 967
size_t nget = ncx_howmany(varp->type, extent);
+#line 967
+#line 967
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 967
0, (void **)&xp); /* cast away const */
+#line 967
if(lstatus != NC_NOERR)
+#line 967
return lstatus;
+#line 967
+#line 967
lstatus = ncx_getn_uint_ushort(&xp, nget, value);
+#line 967
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 967
status = lstatus;
+#line 967
+#line 967
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 967
+#line 967
remaining -= extent;
+#line 967
if(remaining == 0)
+#line 967
break; /* normal loop exit */
+#line 967
offset += extent;
+#line 967
value += nget;
+#line 967
}
+#line 967
+#line 967
return status;
+#line 967
}
+#line 967
static int
+#line 969
getNCvx_longlong_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 969
const size_t *start, size_t nelems, schar *value)
+#line 969
{
+#line 969
off_t offset = NC_varoffset(ncp, varp, start);
+#line 969
size_t remaining = varp->xsz * nelems;
+#line 969
int status = NC_NOERR;
+#line 969
const void *xp;
+#line 969
+#line 969
if(nelems == 0)
+#line 969
return NC_NOERR;
+#line 969
+#line 969
assert(value != NULL);
+#line 969
+#line 969
for(;;)
+#line 969
{
+#line 969
size_t extent = MIN(remaining, ncp->chunk);
+#line 969
size_t nget = ncx_howmany(varp->type, extent);
+#line 969
+#line 969
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 969
0, (void **)&xp); /* cast away const */
+#line 969
if(lstatus != NC_NOERR)
+#line 969
return lstatus;
+#line 969
+#line 969
lstatus = ncx_getn_longlong_schar(&xp, nget, value);
+#line 969
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 969
status = lstatus;
+#line 969
+#line 969
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 969
+#line 969
remaining -= extent;
+#line 969
if(remaining == 0)
+#line 969
break; /* normal loop exit */
+#line 969
offset += extent;
+#line 969
value += nget;
+#line 969
}
+#line 969
+#line 969
return status;
+#line 969
}
+#line 969
static int
+#line 970
getNCvx_longlong_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 970
const size_t *start, size_t nelems, uchar *value)
+#line 970
{
+#line 970
off_t offset = NC_varoffset(ncp, varp, start);
+#line 970
size_t remaining = varp->xsz * nelems;
+#line 970
int status = NC_NOERR;
+#line 970
const void *xp;
+#line 970
+#line 970
if(nelems == 0)
+#line 970
return NC_NOERR;
+#line 970
+#line 970
assert(value != NULL);
+#line 970
+#line 970
for(;;)
+#line 970
{
+#line 970
size_t extent = MIN(remaining, ncp->chunk);
+#line 970
size_t nget = ncx_howmany(varp->type, extent);
+#line 970
+#line 970
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 970
0, (void **)&xp); /* cast away const */
+#line 970
if(lstatus != NC_NOERR)
+#line 970
return lstatus;
+#line 970
+#line 970
lstatus = ncx_getn_longlong_uchar(&xp, nget, value);
+#line 970
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 970
status = lstatus;
+#line 970
+#line 970
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 970
+#line 970
remaining -= extent;
+#line 970
if(remaining == 0)
+#line 970
break; /* normal loop exit */
+#line 970
offset += extent;
+#line 970
value += nget;
+#line 970
}
+#line 970
+#line 970
return status;
+#line 970
}
+#line 970
static int
+#line 971
getNCvx_longlong_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 971
const size_t *start, size_t nelems, short *value)
+#line 971
{
+#line 971
off_t offset = NC_varoffset(ncp, varp, start);
+#line 971
size_t remaining = varp->xsz * nelems;
+#line 971
int status = NC_NOERR;
+#line 971
const void *xp;
+#line 971
+#line 971
if(nelems == 0)
+#line 971
return NC_NOERR;
+#line 971
+#line 971
assert(value != NULL);
+#line 971
+#line 971
for(;;)
+#line 971
{
+#line 971
size_t extent = MIN(remaining, ncp->chunk);
+#line 971
size_t nget = ncx_howmany(varp->type, extent);
+#line 971
+#line 971
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 971
0, (void **)&xp); /* cast away const */
+#line 971
if(lstatus != NC_NOERR)
+#line 971
return lstatus;
+#line 971
+#line 971
lstatus = ncx_getn_longlong_short(&xp, nget, value);
+#line 971
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 971
status = lstatus;
+#line 971
+#line 971
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 971
+#line 971
remaining -= extent;
+#line 971
if(remaining == 0)
+#line 971
break; /* normal loop exit */
+#line 971
offset += extent;
+#line 971
value += nget;
+#line 971
}
+#line 971
+#line 971
return status;
+#line 971
}
+#line 971
static int
+#line 972
getNCvx_longlong_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 972
const size_t *start, size_t nelems, int *value)
+#line 972
{
+#line 972
off_t offset = NC_varoffset(ncp, varp, start);
+#line 972
size_t remaining = varp->xsz * nelems;
+#line 972
int status = NC_NOERR;
+#line 972
const void *xp;
+#line 972
+#line 972
if(nelems == 0)
+#line 972
return NC_NOERR;
+#line 972
+#line 972
assert(value != NULL);
+#line 972
+#line 972
for(;;)
+#line 972
{
+#line 972
size_t extent = MIN(remaining, ncp->chunk);
+#line 972
size_t nget = ncx_howmany(varp->type, extent);
+#line 972
+#line 972
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 972
0, (void **)&xp); /* cast away const */
+#line 972
if(lstatus != NC_NOERR)
+#line 972
return lstatus;
+#line 972
+#line 972
lstatus = ncx_getn_longlong_int(&xp, nget, value);
+#line 972
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 972
status = lstatus;
+#line 972
+#line 972
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 972
+#line 972
remaining -= extent;
+#line 972
if(remaining == 0)
+#line 972
break; /* normal loop exit */
+#line 972
offset += extent;
+#line 972
value += nget;
+#line 972
}
+#line 972
+#line 972
return status;
+#line 972
}
+#line 972
static int
+#line 973
getNCvx_longlong_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 973
const size_t *start, size_t nelems, float *value)
+#line 973
{
+#line 973
off_t offset = NC_varoffset(ncp, varp, start);
+#line 973
size_t remaining = varp->xsz * nelems;
+#line 973
int status = NC_NOERR;
+#line 973
const void *xp;
+#line 973
+#line 973
if(nelems == 0)
+#line 973
return NC_NOERR;
+#line 973
+#line 973
assert(value != NULL);
+#line 973
+#line 973
for(;;)
+#line 973
{
+#line 973
size_t extent = MIN(remaining, ncp->chunk);
+#line 973
size_t nget = ncx_howmany(varp->type, extent);
+#line 973
+#line 973
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 973
0, (void **)&xp); /* cast away const */
+#line 973
if(lstatus != NC_NOERR)
+#line 973
return lstatus;
+#line 973
+#line 973
lstatus = ncx_getn_longlong_float(&xp, nget, value);
+#line 973
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 973
status = lstatus;
+#line 973
+#line 973
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 973
+#line 973
remaining -= extent;
+#line 973
if(remaining == 0)
+#line 973
break; /* normal loop exit */
+#line 973
offset += extent;
+#line 973
value += nget;
+#line 973
}
+#line 973
+#line 973
return status;
+#line 973
}
+#line 973
static int
+#line 974
getNCvx_longlong_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 974
const size_t *start, size_t nelems, double *value)
+#line 974
{
+#line 974
off_t offset = NC_varoffset(ncp, varp, start);
+#line 974
size_t remaining = varp->xsz * nelems;
+#line 974
int status = NC_NOERR;
+#line 974
const void *xp;
+#line 974
+#line 974
if(nelems == 0)
+#line 974
return NC_NOERR;
+#line 974
+#line 974
assert(value != NULL);
+#line 974
+#line 974
for(;;)
+#line 974
{
+#line 974
size_t extent = MIN(remaining, ncp->chunk);
+#line 974
size_t nget = ncx_howmany(varp->type, extent);
+#line 974
+#line 974
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 974
0, (void **)&xp); /* cast away const */
+#line 974
if(lstatus != NC_NOERR)
+#line 974
return lstatus;
+#line 974
+#line 974
lstatus = ncx_getn_longlong_double(&xp, nget, value);
+#line 974
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 974
status = lstatus;
+#line 974
+#line 974
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 974
+#line 974
remaining -= extent;
+#line 974
if(remaining == 0)
+#line 974
break; /* normal loop exit */
+#line 974
offset += extent;
+#line 974
value += nget;
+#line 974
}
+#line 974
+#line 974
return status;
+#line 974
}
+#line 974
static int
+#line 975
getNCvx_longlong_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 975
const size_t *start, size_t nelems, longlong *value)
+#line 975
{
+#line 975
off_t offset = NC_varoffset(ncp, varp, start);
+#line 975
size_t remaining = varp->xsz * nelems;
+#line 975
int status = NC_NOERR;
+#line 975
const void *xp;
+#line 975
+#line 975
if(nelems == 0)
+#line 975
return NC_NOERR;
+#line 975
+#line 975
assert(value != NULL);
+#line 975
+#line 975
for(;;)
+#line 975
{
+#line 975
size_t extent = MIN(remaining, ncp->chunk);
+#line 975
size_t nget = ncx_howmany(varp->type, extent);
+#line 975
+#line 975
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 975
0, (void **)&xp); /* cast away const */
+#line 975
if(lstatus != NC_NOERR)
+#line 975
return lstatus;
+#line 975
+#line 975
lstatus = ncx_getn_longlong_longlong(&xp, nget, value);
+#line 975
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 975
status = lstatus;
+#line 975
+#line 975
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 975
+#line 975
remaining -= extent;
+#line 975
if(remaining == 0)
+#line 975
break; /* normal loop exit */
+#line 975
offset += extent;
+#line 975
value += nget;
+#line 975
}
+#line 975
+#line 975
return status;
+#line 975
}
+#line 975
static int
+#line 976
getNCvx_longlong_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 976
const size_t *start, size_t nelems, uint *value)
+#line 976
{
+#line 976
off_t offset = NC_varoffset(ncp, varp, start);
+#line 976
size_t remaining = varp->xsz * nelems;
+#line 976
int status = NC_NOERR;
+#line 976
const void *xp;
+#line 976
+#line 976
if(nelems == 0)
+#line 976
return NC_NOERR;
+#line 976
+#line 976
assert(value != NULL);
+#line 976
+#line 976
for(;;)
+#line 976
{
+#line 976
size_t extent = MIN(remaining, ncp->chunk);
+#line 976
size_t nget = ncx_howmany(varp->type, extent);
+#line 976
+#line 976
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 976
0, (void **)&xp); /* cast away const */
+#line 976
if(lstatus != NC_NOERR)
+#line 976
return lstatus;
+#line 976
+#line 976
lstatus = ncx_getn_longlong_uint(&xp, nget, value);
+#line 976
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 976
status = lstatus;
+#line 976
+#line 976
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 976
+#line 976
remaining -= extent;
+#line 976
if(remaining == 0)
+#line 976
break; /* normal loop exit */
+#line 976
offset += extent;
+#line 976
value += nget;
+#line 976
}
+#line 976
+#line 976
return status;
+#line 976
}
+#line 976
static int
+#line 977
getNCvx_longlong_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 977
const size_t *start, size_t nelems, ulonglong *value)
+#line 977
{
+#line 977
off_t offset = NC_varoffset(ncp, varp, start);
+#line 977
size_t remaining = varp->xsz * nelems;
+#line 977
int status = NC_NOERR;
+#line 977
const void *xp;
+#line 977
+#line 977
if(nelems == 0)
+#line 977
return NC_NOERR;
+#line 977
+#line 977
assert(value != NULL);
+#line 977
+#line 977
for(;;)
+#line 977
{
+#line 977
size_t extent = MIN(remaining, ncp->chunk);
+#line 977
size_t nget = ncx_howmany(varp->type, extent);
+#line 977
+#line 977
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 977
0, (void **)&xp); /* cast away const */
+#line 977
if(lstatus != NC_NOERR)
+#line 977
return lstatus;
+#line 977
+#line 977
lstatus = ncx_getn_longlong_ulonglong(&xp, nget, value);
+#line 977
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 977
status = lstatus;
+#line 977
+#line 977
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 977
+#line 977
remaining -= extent;
+#line 977
if(remaining == 0)
+#line 977
break; /* normal loop exit */
+#line 977
offset += extent;
+#line 977
value += nget;
+#line 977
}
+#line 977
+#line 977
return status;
+#line 977
}
+#line 977
static int
+#line 978
getNCvx_longlong_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 978
const size_t *start, size_t nelems, ushort *value)
+#line 978
{
+#line 978
off_t offset = NC_varoffset(ncp, varp, start);
+#line 978
size_t remaining = varp->xsz * nelems;
+#line 978
int status = NC_NOERR;
+#line 978
const void *xp;
+#line 978
+#line 978
if(nelems == 0)
+#line 978
return NC_NOERR;
+#line 978
+#line 978
assert(value != NULL);
+#line 978
+#line 978
for(;;)
+#line 978
{
+#line 978
size_t extent = MIN(remaining, ncp->chunk);
+#line 978
size_t nget = ncx_howmany(varp->type, extent);
+#line 978
+#line 978
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 978
0, (void **)&xp); /* cast away const */
+#line 978
if(lstatus != NC_NOERR)
+#line 978
return lstatus;
+#line 978
+#line 978
lstatus = ncx_getn_longlong_ushort(&xp, nget, value);
+#line 978
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 978
status = lstatus;
+#line 978
+#line 978
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 978
+#line 978
remaining -= extent;
+#line 978
if(remaining == 0)
+#line 978
break; /* normal loop exit */
+#line 978
offset += extent;
+#line 978
value += nget;
+#line 978
}
+#line 978
+#line 978
return status;
+#line 978
}
+#line 978
static int
+#line 980
getNCvx_ulonglong_schar(const NC3_INFO* ncp, const NC_var *varp,
+#line 980
const size_t *start, size_t nelems, schar *value)
+#line 980
{
+#line 980
off_t offset = NC_varoffset(ncp, varp, start);
+#line 980
size_t remaining = varp->xsz * nelems;
+#line 980
int status = NC_NOERR;
+#line 980
const void *xp;
+#line 980
+#line 980
if(nelems == 0)
+#line 980
return NC_NOERR;
+#line 980
+#line 980
assert(value != NULL);
+#line 980
+#line 980
for(;;)
+#line 980
{
+#line 980
size_t extent = MIN(remaining, ncp->chunk);
+#line 980
size_t nget = ncx_howmany(varp->type, extent);
+#line 980
+#line 980
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 980
0, (void **)&xp); /* cast away const */
+#line 980
if(lstatus != NC_NOERR)
+#line 980
return lstatus;
+#line 980
+#line 980
lstatus = ncx_getn_ulonglong_schar(&xp, nget, value);
+#line 980
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 980
status = lstatus;
+#line 980
+#line 980
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 980
+#line 980
remaining -= extent;
+#line 980
if(remaining == 0)
+#line 980
break; /* normal loop exit */
+#line 980
offset += extent;
+#line 980
value += nget;
+#line 980
}
+#line 980
+#line 980
return status;
+#line 980
}
+#line 980
static int
+#line 981
getNCvx_ulonglong_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 981
const size_t *start, size_t nelems, uchar *value)
+#line 981
{
+#line 981
off_t offset = NC_varoffset(ncp, varp, start);
+#line 981
size_t remaining = varp->xsz * nelems;
+#line 981
int status = NC_NOERR;
+#line 981
const void *xp;
+#line 981
+#line 981
if(nelems == 0)
+#line 981
return NC_NOERR;
+#line 981
+#line 981
assert(value != NULL);
+#line 981
+#line 981
for(;;)
+#line 981
{
+#line 981
size_t extent = MIN(remaining, ncp->chunk);
+#line 981
size_t nget = ncx_howmany(varp->type, extent);
+#line 981
+#line 981
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 981
0, (void **)&xp); /* cast away const */
+#line 981
if(lstatus != NC_NOERR)
+#line 981
return lstatus;
+#line 981
+#line 981
lstatus = ncx_getn_ulonglong_uchar(&xp, nget, value);
+#line 981
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 981
status = lstatus;
+#line 981
+#line 981
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 981
+#line 981
remaining -= extent;
+#line 981
if(remaining == 0)
+#line 981
break; /* normal loop exit */
+#line 981
offset += extent;
+#line 981
value += nget;
+#line 981
}
+#line 981
+#line 981
return status;
+#line 981
}
+#line 981
static int
+#line 982
getNCvx_ulonglong_short(const NC3_INFO* ncp, const NC_var *varp,
+#line 982
const size_t *start, size_t nelems, short *value)
+#line 982
{
+#line 982
off_t offset = NC_varoffset(ncp, varp, start);
+#line 982
size_t remaining = varp->xsz * nelems;
+#line 982
int status = NC_NOERR;
+#line 982
const void *xp;
+#line 982
+#line 982
if(nelems == 0)
+#line 982
return NC_NOERR;
+#line 982
+#line 982
assert(value != NULL);
+#line 982
+#line 982
for(;;)
+#line 982
{
+#line 982
size_t extent = MIN(remaining, ncp->chunk);
+#line 982
size_t nget = ncx_howmany(varp->type, extent);
+#line 982
+#line 982
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 982
0, (void **)&xp); /* cast away const */
+#line 982
if(lstatus != NC_NOERR)
+#line 982
return lstatus;
+#line 982
+#line 982
lstatus = ncx_getn_ulonglong_short(&xp, nget, value);
+#line 982
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 982
status = lstatus;
+#line 982
+#line 982
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 982
+#line 982
remaining -= extent;
+#line 982
if(remaining == 0)
+#line 982
break; /* normal loop exit */
+#line 982
offset += extent;
+#line 982
value += nget;
+#line 982
}
+#line 982
+#line 982
return status;
+#line 982
}
+#line 982
static int
+#line 983
getNCvx_ulonglong_int(const NC3_INFO* ncp, const NC_var *varp,
+#line 983
const size_t *start, size_t nelems, int *value)
+#line 983
{
+#line 983
off_t offset = NC_varoffset(ncp, varp, start);
+#line 983
size_t remaining = varp->xsz * nelems;
+#line 983
int status = NC_NOERR;
+#line 983
const void *xp;
+#line 983
+#line 983
if(nelems == 0)
+#line 983
return NC_NOERR;
+#line 983
+#line 983
assert(value != NULL);
+#line 983
+#line 983
for(;;)
+#line 983
{
+#line 983
size_t extent = MIN(remaining, ncp->chunk);
+#line 983
size_t nget = ncx_howmany(varp->type, extent);
+#line 983
+#line 983
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 983
0, (void **)&xp); /* cast away const */
+#line 983
if(lstatus != NC_NOERR)
+#line 983
return lstatus;
+#line 983
+#line 983
lstatus = ncx_getn_ulonglong_int(&xp, nget, value);
+#line 983
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 983
status = lstatus;
+#line 983
+#line 983
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 983
+#line 983
remaining -= extent;
+#line 983
if(remaining == 0)
+#line 983
break; /* normal loop exit */
+#line 983
offset += extent;
+#line 983
value += nget;
+#line 983
}
+#line 983
+#line 983
return status;
+#line 983
}
+#line 983
static int
+#line 984
getNCvx_ulonglong_float(const NC3_INFO* ncp, const NC_var *varp,
+#line 984
const size_t *start, size_t nelems, float *value)
+#line 984
{
+#line 984
off_t offset = NC_varoffset(ncp, varp, start);
+#line 984
size_t remaining = varp->xsz * nelems;
+#line 984
int status = NC_NOERR;
+#line 984
const void *xp;
+#line 984
+#line 984
if(nelems == 0)
+#line 984
return NC_NOERR;
+#line 984
+#line 984
assert(value != NULL);
+#line 984
+#line 984
for(;;)
+#line 984
{
+#line 984
size_t extent = MIN(remaining, ncp->chunk);
+#line 984
size_t nget = ncx_howmany(varp->type, extent);
+#line 984
+#line 984
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 984
0, (void **)&xp); /* cast away const */
+#line 984
if(lstatus != NC_NOERR)
+#line 984
return lstatus;
+#line 984
+#line 984
lstatus = ncx_getn_ulonglong_float(&xp, nget, value);
+#line 984
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 984
status = lstatus;
+#line 984
+#line 984
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 984
+#line 984
remaining -= extent;
+#line 984
if(remaining == 0)
+#line 984
break; /* normal loop exit */
+#line 984
offset += extent;
+#line 984
value += nget;
+#line 984
}
+#line 984
+#line 984
return status;
+#line 984
}
+#line 984
static int
+#line 985
getNCvx_ulonglong_double(const NC3_INFO* ncp, const NC_var *varp,
+#line 985
const size_t *start, size_t nelems, double *value)
+#line 985
{
+#line 985
off_t offset = NC_varoffset(ncp, varp, start);
+#line 985
size_t remaining = varp->xsz * nelems;
+#line 985
int status = NC_NOERR;
+#line 985
const void *xp;
+#line 985
+#line 985
if(nelems == 0)
+#line 985
return NC_NOERR;
+#line 985
+#line 985
assert(value != NULL);
+#line 985
+#line 985
for(;;)
+#line 985
{
+#line 985
size_t extent = MIN(remaining, ncp->chunk);
+#line 985
size_t nget = ncx_howmany(varp->type, extent);
+#line 985
+#line 985
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 985
0, (void **)&xp); /* cast away const */
+#line 985
if(lstatus != NC_NOERR)
+#line 985
return lstatus;
+#line 985
+#line 985
lstatus = ncx_getn_ulonglong_double(&xp, nget, value);
+#line 985
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 985
status = lstatus;
+#line 985
+#line 985
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 985
+#line 985
remaining -= extent;
+#line 985
if(remaining == 0)
+#line 985
break; /* normal loop exit */
+#line 985
offset += extent;
+#line 985
value += nget;
+#line 985
}
+#line 985
+#line 985
return status;
+#line 985
}
+#line 985
static int
+#line 986
getNCvx_ulonglong_longlong(const NC3_INFO* ncp, const NC_var *varp,
+#line 986
const size_t *start, size_t nelems, longlong *value)
+#line 986
{
+#line 986
off_t offset = NC_varoffset(ncp, varp, start);
+#line 986
size_t remaining = varp->xsz * nelems;
+#line 986
int status = NC_NOERR;
+#line 986
const void *xp;
+#line 986
+#line 986
if(nelems == 0)
+#line 986
return NC_NOERR;
+#line 986
+#line 986
assert(value != NULL);
+#line 986
+#line 986
for(;;)
+#line 986
{
+#line 986
size_t extent = MIN(remaining, ncp->chunk);
+#line 986
size_t nget = ncx_howmany(varp->type, extent);
+#line 986
+#line 986
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 986
0, (void **)&xp); /* cast away const */
+#line 986
if(lstatus != NC_NOERR)
+#line 986
return lstatus;
+#line 986
+#line 986
lstatus = ncx_getn_ulonglong_longlong(&xp, nget, value);
+#line 986
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 986
status = lstatus;
+#line 986
+#line 986
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 986
+#line 986
remaining -= extent;
+#line 986
if(remaining == 0)
+#line 986
break; /* normal loop exit */
+#line 986
offset += extent;
+#line 986
value += nget;
+#line 986
}
+#line 986
+#line 986
return status;
+#line 986
}
+#line 986
static int
+#line 987
getNCvx_ulonglong_uint(const NC3_INFO* ncp, const NC_var *varp,
+#line 987
const size_t *start, size_t nelems, uint *value)
+#line 987
{
+#line 987
off_t offset = NC_varoffset(ncp, varp, start);
+#line 987
size_t remaining = varp->xsz * nelems;
+#line 987
int status = NC_NOERR;
+#line 987
const void *xp;
+#line 987
+#line 987
if(nelems == 0)
+#line 987
return NC_NOERR;
+#line 987
+#line 987
assert(value != NULL);
+#line 987
+#line 987
for(;;)
+#line 987
{
+#line 987
size_t extent = MIN(remaining, ncp->chunk);
+#line 987
size_t nget = ncx_howmany(varp->type, extent);
+#line 987
+#line 987
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 987
0, (void **)&xp); /* cast away const */
+#line 987
if(lstatus != NC_NOERR)
+#line 987
return lstatus;
+#line 987
+#line 987
lstatus = ncx_getn_ulonglong_uint(&xp, nget, value);
+#line 987
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 987
status = lstatus;
+#line 987
+#line 987
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 987
+#line 987
remaining -= extent;
+#line 987
if(remaining == 0)
+#line 987
break; /* normal loop exit */
+#line 987
offset += extent;
+#line 987
value += nget;
+#line 987
}
+#line 987
+#line 987
return status;
+#line 987
}
+#line 987
static int
+#line 988
getNCvx_ulonglong_ulonglong(const NC3_INFO* ncp, const NC_var *varp,
+#line 988
const size_t *start, size_t nelems, ulonglong *value)
+#line 988
{
+#line 988
off_t offset = NC_varoffset(ncp, varp, start);
+#line 988
size_t remaining = varp->xsz * nelems;
+#line 988
int status = NC_NOERR;
+#line 988
const void *xp;
+#line 988
+#line 988
if(nelems == 0)
+#line 988
return NC_NOERR;
+#line 988
+#line 988
assert(value != NULL);
+#line 988
+#line 988
for(;;)
+#line 988
{
+#line 988
size_t extent = MIN(remaining, ncp->chunk);
+#line 988
size_t nget = ncx_howmany(varp->type, extent);
+#line 988
+#line 988
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 988
0, (void **)&xp); /* cast away const */
+#line 988
if(lstatus != NC_NOERR)
+#line 988
return lstatus;
+#line 988
+#line 988
lstatus = ncx_getn_ulonglong_ulonglong(&xp, nget, value);
+#line 988
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 988
status = lstatus;
+#line 988
+#line 988
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 988
+#line 988
remaining -= extent;
+#line 988
if(remaining == 0)
+#line 988
break; /* normal loop exit */
+#line 988
offset += extent;
+#line 988
value += nget;
+#line 988
}
+#line 988
+#line 988
return status;
+#line 988
}
+#line 988
static int
+#line 989
getNCvx_ulonglong_ushort(const NC3_INFO* ncp, const NC_var *varp,
+#line 989
const size_t *start, size_t nelems, ushort *value)
+#line 989
{
+#line 989
off_t offset = NC_varoffset(ncp, varp, start);
+#line 989
size_t remaining = varp->xsz * nelems;
+#line 989
int status = NC_NOERR;
+#line 989
const void *xp;
+#line 989
+#line 989
if(nelems == 0)
+#line 989
return NC_NOERR;
+#line 989
+#line 989
assert(value != NULL);
+#line 989
+#line 989
for(;;)
+#line 989
{
+#line 989
size_t extent = MIN(remaining, ncp->chunk);
+#line 989
size_t nget = ncx_howmany(varp->type, extent);
+#line 989
+#line 989
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 989
0, (void **)&xp); /* cast away const */
+#line 989
if(lstatus != NC_NOERR)
+#line 989
return lstatus;
+#line 989
+#line 989
lstatus = ncx_getn_ulonglong_ushort(&xp, nget, value);
+#line 989
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 989
status = lstatus;
+#line 989
+#line 989
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 989
+#line 989
remaining -= extent;
+#line 989
if(remaining == 0)
+#line 989
break; /* normal loop exit */
+#line 989
offset += extent;
+#line 989
value += nget;
+#line 989
}
+#line 989
+#line 989
return status;
+#line 989
}
+#line 989
+#line 992
#ifdef NOTUSED
static int
+#line 993
getNCvx_schar_uchar(const NC3_INFO* ncp, const NC_var *varp,
+#line 993
const size_t *start, size_t nelems, uchar *value)
+#line 993
{
+#line 993
off_t offset = NC_varoffset(ncp, varp, start);
+#line 993
size_t remaining = varp->xsz * nelems;
+#line 993
int status = NC_NOERR;
+#line 993
const void *xp;
+#line 993
+#line 993
if(nelems == 0)
+#line 993
return NC_NOERR;
+#line 993
+#line 993
assert(value != NULL);
+#line 993
+#line 993
for(;;)
+#line 993
{
+#line 993
size_t extent = MIN(remaining, ncp->chunk);
+#line 993
size_t nget = ncx_howmany(varp->type, extent);
+#line 993
+#line 993
int lstatus = ncio_get(ncp->nciop, offset, extent,
+#line 993
0, (void **)&xp); /* cast away const */
+#line 993
if(lstatus != NC_NOERR)
+#line 993
return lstatus;
+#line 993
+#line 993
lstatus = ncx_getn_schar_uchar(&xp, nget, value);
+#line 993
if(lstatus != NC_NOERR && status == NC_NOERR)
+#line 993
status = lstatus;
+#line 993
+#line 993
(void) ncio_rel(ncp->nciop, offset, 0);
+#line 993
+#line 993
remaining -= extent;
+#line 993
if(remaining == 0)
+#line 993
break; /* normal loop exit */
+#line 993
offset += extent;
+#line 993
value += nget;
+#line 993
}
+#line 993
+#line 993
return status;
+#line 993
}
+#line 993
#endif /*NOTUSED*/
@@ -9651,6 +18307,7 @@ odo1(const size_t *const start, const size_t *const upper,
#endif
+#line 1155
/* Define a macro to allow hash on two type values */
#define CASE(nc1,nc2) (nc1*256+nc2)
@@ -9664,8 +18321,12 @@ readNCv(const NC3_INFO* ncp, const NC_var* varp, const size_t* start,
case CASE(NC_CHAR,NC_CHAR):
case CASE(NC_CHAR,NC_UBYTE):
- return getNCvx_char_char(ncp,varp,start,nelems,(char*)value);
- break;
+#ifndef __CHAR_UNSIGNED__
+ return getNCvx_char_char(ncp,varp,start,nelems,(char*)value);
+#else
+ return getNCvx_schar_schar(ncp,varp,start,nelems,(signed char*)value);
+#endif
+ break;
case CASE(NC_BYTE,NC_BYTE):
return getNCvx_schar_schar(ncp,varp,start,nelems,(signed char*)value);
break;
@@ -9707,13 +18368,13 @@ readNCv(const NC3_INFO* ncp, const NC_var* varp, const size_t* start,
break;
case CASE(NC_SHORT,NC_INT):
return getNCvx_short_int(ncp,varp,start,nelems,(int*)value);
- break;
+ break;
case CASE(NC_SHORT,NC_FLOAT):
return getNCvx_short_float(ncp,varp,start,nelems,(float*)value);
break;
case CASE(NC_SHORT,NC_DOUBLE):
return getNCvx_short_double(ncp,varp,start,nelems,(double*)value);
- break;
+ break;
case CASE(NC_SHORT,NC_INT64):
return getNCvx_short_longlong(ncp,varp,start,nelems,(long long*)value);
break;
@@ -10317,7 +18978,7 @@ NC3_get_vara(int ncid, int varid,
int ii;
size_t iocount;
size_t memtypelen;
- char* value = (char*) value0; /* legally allow ptr arithmetic */
+ signed char* value = (signed char*) value0; /* legally allow ptr arithmetic */
const size_t* edges = edges0; /* so we can modify for special cases */
size_t modedges[NC_MAX_VAR_DIMS];
@@ -10444,7 +19105,7 @@ NC3_put_vara(int ncid, int varid,
int ii;
size_t iocount;
size_t memtypelen;
- char* value = (char*) value0; /* legally allow ptr arithmetic */
+ signed char* value = (signed char*) value0; /* legally allow ptr arithmetic */
const size_t* edges = edges0; /* so we can modify for special cases */
size_t modedges[NC_MAX_VAR_DIMS];
diff --git a/libsrc/t_ncio.c b/libsrc/t_ncio.c
index b4903a3..4e37900 100644
--- a/libsrc/t_ncio.c
+++ b/libsrc/t_ncio.c
@@ -11,8 +11,8 @@
#include <ctype.h>
#include <assert.h>
#include "ncio.h"
-#ifndef ENOERR
-#define ENOERR 0
+#ifndef NC_NOERR
+#define NC_NOERR 0
#endif
@@ -199,7 +199,7 @@ main(int ac, char *av[])
off_t offset;
size_t extent;
void *vp;
- int status = ENOERR;
+ int status = NC_NOERR;
int verbose = 0;
int flags = 0;
int create = 0;
@@ -271,7 +271,7 @@ main(int ac, char *av[])
status = ncio_open(path, flags,
igeto, igetsz, &sizehint,
&nciop, &vp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
{
fprintf(stderr, "ncio_open: %s: %s\n",
path, strerror(status));
@@ -281,7 +281,7 @@ main(int ac, char *av[])
status = ncio_create(path, flags, initialsz,
igeto, igetsz, &sizehint,
&nciop, &vp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
{
fprintf(stderr, "ncio_create: %s: %s\n",
path, strerror(status));
@@ -361,7 +361,7 @@ main(int ac, char *av[])
}
status = ncio_close(nciop, doUnlink);
- if(status != ENOERR)
+ if(status != NC_NOERR)
{
fprintf(stderr, "ncio_close(%s): %s: %s\n",
doUnlink ? "doUnlink" : "",
diff --git a/libsrc/v1hpg.c b/libsrc/v1hpg.c
index b4f186b..afdeb51 100644
--- a/libsrc/v1hpg.c
+++ b/libsrc/v1hpg.c
@@ -64,7 +64,7 @@ rel_v1hs(v1hs *gsp)
{
int status;
if(gsp->offset == OFF_NONE || gsp->base == NULL)
- return ENOERR;
+ return NC_NOERR;
status = ncio_rel(gsp->nciop, gsp->offset,
gsp->flags == RGN_WRITE ? RGN_MODIFIED : 0);
gsp->end = NULL;
@@ -112,7 +112,7 @@ fault_v1hs(v1hs *gsp, size_t extent)
#else
gsp->end = (char *)gsp->base + gsp->extent;
#endif
- return ENOERR;
+ return NC_NOERR;
}
@@ -130,10 +130,10 @@ fprintf(stderr, "nextread %lu, remaining %lu\n",
#endif
#ifdef __arm__
if((signed char *)gsp->pos + nextread <= (signed char *)gsp->end)
- return ENOERR;
+ return NC_NOERR;
#else
if((char *)gsp->pos + nextread <= (char *)gsp->end)
- return ENOERR;
+ return NC_NOERR;
#endif
return fault_v1hs(gsp, nextread);
@@ -150,7 +150,7 @@ v1h_put_size_t(v1hs *psp, const size_t *sp)
status = check_v1hs(psp, X_SIZEOF_INT64);
else
status = check_v1hs(psp, X_SIZEOF_SIZE_T);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if (psp->version == 5)
return ncx_put_int64(&psp->pos, *sp);
@@ -167,7 +167,7 @@ v1h_get_size_t(v1hs *gsp, size_t *sp)
status = check_v1hs(gsp, X_SIZEOF_INT64);
else
status = check_v1hs(gsp, X_SIZEOF_SIZE_T);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if (gsp->version == 5) {
long long tmp=0;
@@ -189,7 +189,7 @@ v1h_put_nc_type(v1hs *psp, const nc_type *typep)
{
const int itype = (int) *typep;
int status = check_v1hs(psp, X_SIZEOF_INT);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_put_int_int(psp->pos, &itype);
@@ -209,7 +209,7 @@ v1h_get_nc_type(v1hs *gsp, nc_type *typep)
{
int type = 0;
int status = check_v1hs(gsp, X_SIZEOF_INT);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_get_int_int(gsp->pos, &type);
#ifdef __arm__
@@ -217,7 +217,7 @@ v1h_get_nc_type(v1hs *gsp, nc_type *typep)
#else
gsp->pos = (void *)((char *)gsp->pos + X_SIZEOF_INT);
#endif
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
assert(type == NC_BYTE
@@ -236,7 +236,7 @@ v1h_get_nc_type(v1hs *gsp, nc_type *typep)
/* else */
*typep = (nc_type) type;
- return ENOERR;
+ return NC_NOERR;
}
/* End nc_type */
@@ -250,7 +250,7 @@ v1h_put_NCtype(v1hs *psp, NCtype type)
{
const int itype = (int) type;
int status = check_v1hs(psp, X_SIZEOF_INT);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_put_int_int(psp->pos, &itype);
#ifdef __arm__
@@ -267,7 +267,7 @@ v1h_get_NCtype(v1hs *gsp, NCtype *typep)
{
int type = 0;
int status = check_v1hs(gsp, X_SIZEOF_INT);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_get_int_int(gsp->pos, &type);
@@ -276,11 +276,11 @@ v1h_get_NCtype(v1hs *gsp, NCtype *typep)
#else
gsp->pos = (void *)((char *)gsp->pos + X_SIZEOF_INT);
#endif
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
/* else */
*typep = (NCtype) type;
- return ENOERR;
+ return NC_NOERR;
}
/* End NCtype */
@@ -322,16 +322,16 @@ v1h_put_NC_string(v1hs *psp, const NC_string *ncstrp)
#endif
status = v1h_put_size_t(psp, &ncstrp->nchars);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = check_v1hs(psp, _RNDUP(ncstrp->nchars, X_ALIGN));
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_pad_putn_text(&psp->pos, ncstrp->nchars, ncstrp->cp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
@@ -344,7 +344,7 @@ v1h_get_NC_string(v1hs *gsp, NC_string **ncstrpp)
NC_string *ncstrp;
status = v1h_get_size_t(gsp, &nchars);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
ncstrp = new_NC_string(nchars, NULL);
@@ -362,17 +362,17 @@ v1h_get_NC_string(v1hs *gsp, NC_string **ncstrpp)
status = check_v1hs(gsp, _RNDUP(ncstrp->nchars, X_ALIGN));
#endif
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = ncx_pad_getn_text((const void **)(&gsp->pos),
nchars, ncstrp->cp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
*ncstrpp = ncstrp;
- return ENOERR;
+ return NC_NOERR;
unwind_alloc:
free_NC_string(ncstrp);
@@ -409,14 +409,14 @@ v1h_put_NC_dim(v1hs *psp, const NC_dim *dimp)
int status;
status = v1h_put_NC_string(psp, dimp->name);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &dimp->size);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
/* Read a NC_dim from the header */
@@ -428,7 +428,7 @@ v1h_get_NC_dim(v1hs *gsp, NC_dim **dimpp)
NC_dim *dimp;
status = v1h_get_NC_string(gsp, &ncstrp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
dimp = new_x_NC_dim(ncstrp);
@@ -439,7 +439,7 @@ v1h_get_NC_dim(v1hs *gsp, NC_dim **dimpp)
}
status = v1h_get_size_t(gsp, &dimp->size);
- if(status != ENOERR)
+ if(status != NC_NOERR)
{
free_NC_dim(dimp); /* frees name */
return status;
@@ -447,7 +447,7 @@ v1h_get_NC_dim(v1hs *gsp, NC_dim **dimpp)
*dimpp = dimp;
- return ENOERR;
+ return NC_NOERR;
unwind_name:
free_NC_string(ncstrp);
@@ -501,20 +501,20 @@ v1h_put_NC_dimarray(v1hs *psp, const NC_dimarray *ncap)
const size_t nosz = 0;
status = v1h_put_NCtype(psp, NC_UNSPECIFIED);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &nosz);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
/* else */
status = v1h_put_NCtype(psp, NC_DIMENSION);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &ncap->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
{
@@ -527,7 +527,7 @@ v1h_put_NC_dimarray(v1hs *psp, const NC_dimarray *ncap)
return status;
}
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -543,15 +543,15 @@ v1h_get_NC_dimarray(v1hs *gsp, NC_dimarray *ncap)
assert(ncap->value == NULL);
status = v1h_get_NCtype(gsp, &type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_get_size_t(gsp, &ncap->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(ncap->nelems == 0)
- return ENOERR;
+ return NC_NOERR;
/* else */
if(type != NC_DIMENSION)
return EINVAL;
@@ -561,6 +561,8 @@ v1h_get_NC_dimarray(v1hs *gsp, NC_dimarray *ncap)
return NC_ENOMEM;
ncap->nalloc = ncap->nelems;
+ ncap->hashmap = NC_hashmapCreate(ncap->nelems);
+
{
NC_dim **dpp = ncap->value;
NC_dim *const *const end = &dpp[ncap->nelems];
@@ -573,10 +575,14 @@ v1h_get_NC_dimarray(v1hs *gsp, NC_dimarray *ncap)
free_NC_dimarrayV(ncap);
return status;
}
+ {
+ int dimid = (size_t)(dpp - ncap->value);
+ NC_hashmapAddDim(ncap, dimid, (*dpp)->name->cp);
+ }
}
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -628,7 +634,7 @@ v1h_put_NC_attrV(v1hs *psp, const NC_attr *attrp)
nbytes = MIN(perchunk, remaining);
status = check_v1hs(psp, nbytes);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
(void) memcpy(psp->pos, value, nbytes);
@@ -644,7 +650,7 @@ v1h_put_NC_attrV(v1hs *psp, const NC_attr *attrp)
} while(remaining != 0);
- return ENOERR;
+ return NC_NOERR;
}
/* Write a NC_attr to the header */
@@ -654,22 +660,22 @@ v1h_put_NC_attr(v1hs *psp, const NC_attr *attrp)
int status;
status = v1h_put_NC_string(psp, attrp->name);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_nc_type(psp, &attrp->type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &attrp->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_NC_attrV(psp, attrp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
@@ -691,7 +697,7 @@ v1h_get_NC_attrV(v1hs *gsp, NC_attr *attrp)
nget = MIN(perchunk, remaining);
status = check_v1hs(gsp, nget);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
(void) memcpy(value, gsp->pos, nget);
@@ -707,7 +713,7 @@ v1h_get_NC_attrV(v1hs *gsp, NC_attr *attrp)
} while(remaining != 0);
- return ENOERR;
+ return NC_NOERR;
}
@@ -722,15 +728,15 @@ v1h_get_NC_attr(v1hs *gsp, NC_attr **attrpp)
NC_attr *attrp;
status = v1h_get_NC_string(gsp, &strp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_get_nc_type(gsp, &type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_name;
status = v1h_get_size_t(gsp, &nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_name;
attrp = new_x_NC_attr(strp, type, nelems);
@@ -741,7 +747,7 @@ v1h_get_NC_attr(v1hs *gsp, NC_attr **attrpp)
}
status = v1h_get_NC_attrV(gsp, attrp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
{
free_NC_attr(attrp); /* frees strp */
return status;
@@ -749,7 +755,7 @@ v1h_get_NC_attr(v1hs *gsp, NC_attr **attrpp)
*attrpp = attrp;
- return ENOERR;
+ return NC_NOERR;
unwind_name:
free_NC_string(strp);
@@ -803,20 +809,20 @@ v1h_put_NC_attrarray(v1hs *psp, const NC_attrarray *ncap)
const size_t nosz = 0;
status = v1h_put_NCtype(psp, NC_UNSPECIFIED);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &nosz);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
/* else */
status = v1h_put_NCtype(psp, NC_ATTRIBUTE);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &ncap->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
{
@@ -829,7 +835,7 @@ v1h_put_NC_attrarray(v1hs *psp, const NC_attrarray *ncap)
return status;
}
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -845,14 +851,14 @@ v1h_get_NC_attrarray(v1hs *gsp, NC_attrarray *ncap)
assert(ncap->value == NULL);
status = v1h_get_NCtype(gsp, &type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_get_size_t(gsp, &ncap->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(ncap->nelems == 0)
- return ENOERR;
+ return NC_NOERR;
/* else */
if(type != NC_ATTRIBUTE)
return EINVAL;
@@ -877,7 +883,7 @@ v1h_get_NC_attrarray(v1hs *gsp, NC_attrarray *ncap)
}
}
- return ENOERR;
+ return NC_NOERR;
}
/* End NC_attr */
@@ -921,52 +927,52 @@ v1h_put_NC_var(v1hs *psp, const NC_var *varp)
int status;
status = v1h_put_NC_string(psp, varp->name);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &varp->ndims);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if (psp->version == 5) {
status = check_v1hs(psp, ncx_len_int64(varp->ndims));
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_putn_longlong_int(&psp->pos,
varp->ndims, varp->dimids);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
}
else {
status = check_v1hs(psp, ncx_len_int(varp->ndims));
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_putn_int_int(&psp->pos,
varp->ndims, varp->dimids);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
}
status = v1h_put_NC_attrarray(psp, &varp->attrs);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_nc_type(psp, &varp->type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &varp->len);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = check_v1hs(psp, psp->version == 1 ? 4 : 8); /*begin*/
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = ncx_put_off_t(&psp->pos, &varp->begin, psp->version == 1 ? 4 : 8);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
@@ -980,11 +986,11 @@ v1h_get_NC_var(v1hs *gsp, NC_var **varpp)
NC_var *varp;
status = v1h_get_NC_string(gsp, &strp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_get_size_t(gsp, &ndims);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_name;
varp = new_x_NC_var(strp, ndims);
@@ -996,43 +1002,43 @@ v1h_get_NC_var(v1hs *gsp, NC_var **varpp)
if (gsp->version == 5) {
status = check_v1hs(gsp, ncx_len_int64(ndims));
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = ncx_getn_longlong_int((const void **)(&gsp->pos),
ndims, varp->dimids);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
}
else {
status = check_v1hs(gsp, ncx_len_int(ndims));
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = ncx_getn_int_int((const void **)(&gsp->pos),
ndims, varp->dimids);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
}
status = v1h_get_NC_attrarray(gsp, &varp->attrs);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = v1h_get_nc_type(gsp, &varp->type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = v1h_get_size_t(gsp, &varp->len);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = check_v1hs(gsp, gsp->version == 1 ? 4 : 8);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
status = ncx_get_off_t((const void **)&gsp->pos,
&varp->begin, gsp->version == 1 ? 4 : 8);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_alloc;
*varpp = varp;
- return ENOERR;
+ return NC_NOERR;
unwind_alloc:
free_NC_var(varp); /* frees name */
@@ -1090,20 +1096,20 @@ v1h_put_NC_vararray(v1hs *psp, const NC_vararray *ncap)
const size_t nosz = 0;
status = v1h_put_NCtype(psp, NC_UNSPECIFIED);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &nosz);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
- return ENOERR;
+ return NC_NOERR;
}
/* else */
status = v1h_put_NCtype(psp, NC_VARIABLE);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_put_size_t(psp, &ncap->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
{
@@ -1116,7 +1122,7 @@ v1h_put_NC_vararray(v1hs *psp, const NC_vararray *ncap)
return status;
}
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -1132,15 +1138,15 @@ v1h_get_NC_vararray(v1hs *gsp, NC_vararray *ncap)
assert(ncap->value == NULL);
status = v1h_get_NCtype(gsp, &type);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = v1h_get_size_t(gsp, &ncap->nelems);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(ncap->nelems == 0)
- return ENOERR;
+ return NC_NOERR;
/* else */
if(type != NC_VARIABLE)
return EINVAL;
@@ -1150,6 +1156,7 @@ v1h_get_NC_vararray(v1hs *gsp, NC_vararray *ncap)
return NC_ENOMEM;
ncap->nalloc = ncap->nelems;
+ ncap->hashmap = NC_hashmapCreate(ncap->nelems);
{
NC_var **vpp = ncap->value;
NC_var *const *const end = &vpp[ncap->nelems];
@@ -1162,10 +1169,14 @@ v1h_get_NC_vararray(v1hs *gsp, NC_vararray *ncap)
free_NC_vararrayV(ncap);
return status;
}
+ {
+ int varid = (size_t)(vpp - ncap->value);
+ NC_hashmapAddVar(ncap, varid, (*vpp)->name->cp);
+ }
}
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -1199,7 +1210,7 @@ NC_computeshapes(NC3_INFO* ncp)
for( /*NADA*/; vpp < end; vpp++)
{
status = NC_var_shape(*vpp, &ncp->dims);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return(status);
if(IS_RECVAR(*vpp))
@@ -1251,7 +1262,7 @@ NC_computeshapes(NC3_INFO* ncp)
ncp->begin_var > ncp->begin_rec)
return(NC_ENOTNC); /* not a netCDF file or corrupted */
- return(ENOERR);
+ return(NC_NOERR);
}
/* How much space in the header is required for the NC data structure? */
@@ -1280,7 +1291,7 @@ ncx_len_NC(const NC3_INFO* ncp, size_t sizeof_off_t)
int
ncx_put_NC(const NC3_INFO* ncp, void **xpp, off_t offset, size_t extent)
{
- int status = ENOERR;
+ int status = NC_NOERR;
v1hs ps; /* the get stream */
assert(ncp != NULL);
@@ -1339,7 +1350,7 @@ ncx_put_NC(const NC3_INFO* ncp, void **xpp, off_t offset, size_t extent)
status = ncx_putn_schar_schar(&ps.pos, sizeof(ncmagic), ncmagic);
else
status = ncx_putn_schar_schar(&ps.pos, sizeof(ncmagic1), ncmagic1);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto release;
{
@@ -1348,22 +1359,22 @@ ncx_put_NC(const NC3_INFO* ncp, void **xpp, off_t offset, size_t extent)
status = ncx_put_int64(&ps.pos, nrecs);
else
status = ncx_put_size_t(&ps.pos, &nrecs);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto release;
}
assert((char *)ps.pos < (char *)ps.end);
status = v1h_put_NC_dimarray(&ps, &ncp->dims);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto release;
status = v1h_put_NC_attrarray(&ps, &ncp->attrs);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto release;
status = v1h_put_NC_vararray(&ps, &ncp->vars);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto release;
release:
@@ -1443,7 +1454,7 @@ nc_get_NC(NC3_INFO* ncp)
status = ncx_getn_schar_schar(
(const void **)(&gs.pos), sizeof(magic), magic);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_get;
if(memcmp(magic, ncmagic, sizeof(ncmagic)-1) != 0)
@@ -1481,7 +1492,7 @@ nc_get_NC(NC3_INFO* ncp)
}
else
status = ncx_get_size_t((const void **)(&gs.pos), &nrecs);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_get;
NC_set_numrecs(ncp, nrecs);
}
@@ -1492,21 +1503,21 @@ nc_get_NC(NC3_INFO* ncp)
assert((char *)gs.pos < (char *)gs.end);
#endif
status = v1h_get_NC_dimarray(&gs, &ncp->dims);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_get;
status = v1h_get_NC_attrarray(&gs, &ncp->attrs);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_get;
status = v1h_get_NC_vararray(&gs, &ncp->vars);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_get;
ncp->xsz = ncx_len_NC(ncp, (gs.version == 1) ? 4 : 8);
status = NC_computeshapes(ncp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_get;
unwind_get:
diff --git a/libsrc/var.c b/libsrc/var.c
index d6a49db..88623c2 100644
--- a/libsrc/var.c
+++ b/libsrc/var.c
@@ -65,7 +65,6 @@ new_x_NC_var(
(void) memset(varp, 0, sz);
varp->name = strp;
varp->ndims = ndims;
- varp->hash = hash_fast(strp->cp, strlen(strp->cp));
if(ndims != 0)
{
@@ -94,7 +93,7 @@ new_x_NC_var(
varp->len = 0;
varp->begin = 0;
- return varp;
+ return varp;
}
@@ -206,6 +205,9 @@ free_NC_vararrayV(NC_vararray *ncap)
if(ncap->nalloc == 0)
return;
+ NC_hashmapDelete(ncap->hashmap);
+ ncap->hashmap = NULL;
+
assert(ncap->value != NULL);
free_NC_vararrayV0(ncap);
@@ -282,6 +284,8 @@ incr_NC_vararray(NC_vararray *ncap, NC_var *newelemp)
return NC_ENOMEM;
ncap->value = vp;
ncap->nalloc = NC_ARRAY_GROWBY;
+
+ ncap->hashmap = NC_hashmapCreate(0);
}
else if(ncap->nelems +1 > ncap->nalloc)
{
@@ -295,6 +299,7 @@ incr_NC_vararray(NC_vararray *ncap, NC_var *newelemp)
if(newelemp != NULL)
{
+ NC_hashmapAddVar(ncap, (long)ncap->nelems, newelemp->name->cp);
ncap->value[ncap->nelems] = newelemp;
ncap->nelems++;
}
@@ -329,9 +334,7 @@ NC_hvarid
int
NC_findvar(const NC_vararray *ncap, const char *uname, NC_var **varpp)
{
- NC_var **loc;
- uint32_t shash;
- int varid;
+ int hash_var_id;
char *name;
assert(ncap != NULL);
@@ -339,26 +342,19 @@ NC_findvar(const NC_vararray *ncap, const char *uname, NC_var **varpp)
if(ncap->nelems == 0)
return -1;
- loc = (NC_var **) ncap->value;
/* normalized version of uname */
name = (char *)utf8proc_NFC((const unsigned char *)uname);
if(name == NULL)
return NC_ENOMEM;
- shash = hash_fast(name, strlen(name));
- for(varid = 0; (size_t) varid < ncap->nelems; varid++, loc++)
- {
- if((*loc)->hash == shash &&
- strncmp((*loc)->name->cp, name, strlen(name)) == 0)
- {
- if(varpp != NULL)
- *varpp = *loc;
- free(name);
- return(varid); /* Normal return */
- }
- }
+ hash_var_id = (int)NC_hashmapGetVar(ncap, name);
free(name);
+ if (hash_var_id >= 0) {
+ if (varpp != NULL)
+ *varpp = ncap->value[hash_var_id];
+ return(hash_var_id); /* Normal return */
+ }
return(-1); /* not found */
}
@@ -734,9 +730,10 @@ NC3_rename_var(int ncid, int varid, const char *unewname)
if(status != NC_NOERR)
{
/* invalid varid */
- return status;
+ return status;
}
+
old = varp->name;
newname = (char *)utf8proc_NFC((const unsigned char *)unewname);
if(newname == NULL)
@@ -748,18 +745,25 @@ NC3_rename_var(int ncid, int varid, const char *unewname)
if(newStr == NULL)
return(-1);
varp->name = newStr;
- varp->hash = hash_fast(newStr->cp, strlen(newStr->cp));
+
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveVar(&ncp->vars, old->cp);
+ NC_hashmapAddVar(&ncp->vars, varid, newStr->cp);
free_NC_string(old);
+
return NC_NOERR;
}
/* else, not in define mode */
status = set_NC_string(varp->name, newname);
- varp->hash = hash_fast(newname, strlen(newname));
free(newname);
if(status != NC_NOERR)
return status;
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveVar(&ncp->vars, old->cp);
+ NC_hashmapAddVar(&ncp->vars, varid, varp->name->cp);
+
set_NC_hdirty(ncp);
if(NC_doHsync(ncp))
diff --git a/libsrc/winceio.c b/libsrc/winceio.c
index 274dbd4..4e01e0c 100644
--- a/libsrc/winceio.c
+++ b/libsrc/winceio.c
@@ -20,8 +20,8 @@
#define EEXIST NC_EEXIST
#endif
-#ifndef ENOERR
-#define ENOERR 0
+#ifndef NC_NOERR
+#define NC_NOERR 0
#endif
#include <string.h>
@@ -65,7 +65,7 @@ blksize(int fd)
static int
fgrow(FILE* f, const off_t len)
{
- int status = ENOERR;
+ int status = NC_NOERR;
long pos = ftell(f);
long size;
pos = ftell(f);
@@ -74,7 +74,7 @@ fgrow(FILE* f, const off_t len)
size = ftell(f);
status = fseek(f,pos,SEEK_SET);
if(ferror(f)) return EIO;
- if(len < size) return ENOERR;
+ if(len < size) return NC_NOERR;
else {
const long dumb = 0;
status = fseek(f, len-sizeof(dumb), SEEK_SET);
@@ -84,7 +84,7 @@ fgrow(FILE* f, const off_t len)
status = fseek(f, pos, SEEK_SET);
if(ferror(f)) return EIO;
}
- return ENOERR;
+ return NC_NOERR;
}
@@ -96,7 +96,7 @@ fgrow(FILE* f, const off_t len)
static int
fgrow2(FILE* f, const off_t len)
{
- int status = ENOERR;
+ int status = NC_NOERR;
long pos = ftell(f);
long size;
pos = ftell(f);
@@ -105,7 +105,7 @@ fgrow2(FILE* f, const off_t len)
size = ftell(f);
status = fseek(f,pos,SEEK_SET);
if(ferror(f)) return EIO;
- if(len < size) return ENOERR;
+ if(len < size) return NC_NOERR;
else {
const char dumb = 0;
status = fseek(f, len-sizeof(dumb), SEEK_SET);
@@ -115,7 +115,7 @@ fgrow2(FILE* f, const off_t len)
status = fseek(f, pos, SEEK_SET);
if(ferror(f)) return EIO;
}
- return ENOERR;
+ return NC_NOERR;
}
/* End OS */
/* Begin ffio */
@@ -125,7 +125,7 @@ fileio_pgout(ncio *const nciop,
off_t const offset, const size_t extent,
const void *const vp, off_t *posp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
FILE* f = descriptors[nciop->fd];
#ifdef X_ALIGN
@@ -142,7 +142,7 @@ fileio_pgout(ncio *const nciop,
fwrite(vp,1,extent,f);
if(ferror(f)) return EIO;
*posp += extent;
- return ENOERR;
+ return NC_NOERR;
}
static int
@@ -150,7 +150,7 @@ fileio_pgin(ncio *const nciop,
off_t const offset, const size_t extent,
void *const vp, size_t *nreadp, off_t *posp)
{
- int status = ENOERR;
+ int status = NC_NOERR;
ssize_t nread;
int count;
@@ -172,7 +172,7 @@ fileio_pgin(ncio *const nciop,
if(ferror(f)) return EIO;
*nreadp = nread;
*posp += nread;
- return ENOERR;
+ return NC_NOERR;
}
/* */
@@ -189,7 +189,7 @@ typedef struct ncio_ffio {
static int
ncio_fileio_rel(ncio *const nciop, off_t offset, int rflags)
{
- int status = ENOERR;
+ int status = NC_NOERR;
FILE* f = descriptors[nciop->fd];
ncio_ffio *ffp = (ncio_ffio *)nciop->pvt;
@@ -225,7 +225,7 @@ ncio_fileio_get(ncio *const nciop,
void **const vpp)
{
ncio_ffio *ffp = (ncio_ffio *)nciop->pvt;
- int status = ENOERR;
+ int status = NC_NOERR;
FILE* f = descriptors[nciop->fd];
#ifdef X_ALIGN
size_t rem;
@@ -277,7 +277,7 @@ ncio_fileio_get(ncio *const nciop,
extent,
ffp->bf_base,
&ffp->bf_cnt, &ffp->pos);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
ffp->bf_offset = offset;
@@ -295,7 +295,7 @@ ncio_fileio_get(ncio *const nciop,
#else
*vpp = (char *)ffp->bf_base;
#endif
- return ENOERR;
+ return NC_NOERR;
}
@@ -303,7 +303,7 @@ static int
ncio_fileio_move(ncio *const nciop, off_t to, off_t from,
size_t nbytes, int rflags)
{
- int status = ENOERR;
+ int status = NC_NOERR;
off_t lower = from;
off_t upper = to;
char *base;
@@ -314,7 +314,7 @@ ncio_fileio_move(ncio *const nciop, off_t to, off_t from,
rflags &= RGN_NOLOCK; /* filter unwanted flags */
if(to == from)
- return ENOERR; /* NOOP */
+ return NC_NOERR; /* NOOP */
if(to > from)
{
@@ -335,7 +335,7 @@ ncio_fileio_move(ncio *const nciop, off_t to, off_t from,
status = ncio_fileio_get(nciop, lower, extent, RGN_WRITE|rflags,
(void **)&base);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
if(to > from)
@@ -353,7 +353,7 @@ ncio_fileio_sync(ncio *const nciop)
{
FILE* f = descriptors[nciop->fd];
fflush(f);
- return ENOERR;
+ return NC_NOERR;
}
static void
@@ -394,7 +394,7 @@ ncio_fileio_init2(ncio *const nciop, size_t *sizehintp)
return ENOMEM;
}
/* else */
- return ENOERR;
+ return NC_NOERR;
}
@@ -486,7 +486,7 @@ ncio_create(const char *path, int ioflags,
#endif
FILE* f;
int i,fd;
- int status = ENOERR;
+ int status = NC_NOERR;
if(initialsz < (size_t)igeto + igetsz)
initialsz = (size_t)igeto + igetsz;
@@ -539,13 +539,13 @@ ncio_create(const char *path, int ioflags,
}
status = ncio_fileio_init2(nciop, sizehintp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
if(initialsz != 0)
{
status = fgrow(f, (off_t)initialsz);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
@@ -555,12 +555,12 @@ ncio_create(const char *path, int ioflags,
igeto, igetsz,
RGN_WRITE,
igetvpp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
*nciopp = nciop;
- return ENOERR;
+ return NC_NOERR;
unwind_open:
(void) fclose(descriptors[fd]);
@@ -589,7 +589,7 @@ ncio_open(const char *path,
#endif
FILE* f;
int i,fd;
- int status = ENOERR;
+ int status = NC_NOERR;
if(path == NULL || *path == 0)
return EINVAL;
@@ -625,7 +625,7 @@ ncio_open(const char *path,
}
status = ncio_fileio_init2(nciop, sizehintp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
if(igetsz != 0)
@@ -634,12 +634,12 @@ ncio_open(const char *path,
igeto, igetsz,
0,
igetvpp);
- if(status != ENOERR)
+ if(status != NC_NOERR)
goto unwind_open;
}
*nciopp = nciop;
- return ENOERR;
+ return NC_NOERR;
unwind_open:
(void) fclose(descriptors[fd]);
@@ -659,7 +659,7 @@ unwind_new:
int
ncio_filesize(ncio *nciop, off_t *filesizep)
{
- int status = ENOERR;
+ int status = NC_NOERR;
off_t filesize, current, reset;
FILE* f;
@@ -674,7 +674,7 @@ ncio_filesize(ncio *nciop, off_t *filesizep)
*filesizep = ftell(f);
status = fseek(f, current, SEEK_SET); /* reset */
if(ferror(f)) return EIO;
- return ENOERR;
+ return NC_NOERR;
}
@@ -688,7 +688,7 @@ ncio_filesize(ncio *nciop, off_t *filesizep)
int
ncio_pad_length(ncio *nciop, off_t length)
{
- int status = ENOERR;
+ int status = NC_NOERR;
FILE* f;
if(nciop == NULL)
@@ -700,20 +700,20 @@ ncio_pad_length(ncio *nciop, off_t length)
return EPERM; /* attempt to write readonly file */
status = nciop->sync(nciop);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return status;
status = fgrow2(f, length);
- if(status != ENOERR)
+ if(status != NC_NOERR)
return errno;
- return ENOERR;
+ return NC_NOERR;
}
int
ncio_close(ncio *nciop, int doUnlink)
{
- int status = ENOERR;
+ int status = NC_NOERR;
FILE* f;
if(nciop == NULL)
diff --git a/libsrc4/Makefile.in b/libsrc4/Makefile.in
index cfafb38..a607e2e 100644
--- a/libsrc4/Makefile.in
+++ b/libsrc4/Makefile.in
@@ -243,6 +243,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/libsrc4/nc4dim.c b/libsrc4/nc4dim.c
index 111392b..23e068c 100644
--- a/libsrc4/nc4dim.c
+++ b/libsrc4/nc4dim.c
@@ -73,6 +73,7 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
NC_DIM_INFO_T *dim;
char norm_name[NC_MAX_NAME + 1];
int retval = NC_NOERR;
+ uint32_t nn_hash;
LOG((2, "%s: ncid 0x%x name %s len %d", __func__, ncid, name,
(int)len));
@@ -122,9 +123,11 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
if(len > X_UINT_MAX) /* Backward compat */
return NC_EDIMSIZE;
+ nn_hash = hash_fast(norm_name, strlen(norm_name));
+
/* Make sure the name is not already in use. */
for (dim = grp->dim; dim; dim = dim->l.next)
- if (!strncmp(dim->name, norm_name, NC_MAX_NAME))
+ if (nn_hash == dim->hash && !strncmp(dim->name, norm_name, NC_MAX_NAME))
return NC_ENAMEINUSE;
/* Add a dimension to the list. The ID must come from the file
@@ -139,6 +142,8 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
if (len == NC_UNLIMITED)
dim->unlimited = NC_TRUE;
+ dim->hash = nn_hash;
+
/* Pass back the dimid. */
if (idp)
*idp = dim->dimid;
@@ -157,7 +162,8 @@ NC4_inq_dimid(int ncid, const char *name, int *idp)
char norm_name[NC_MAX_NAME + 1];
int finished = 0;
int retval;
-
+ uint32_t shash;
+
LOG((2, "%s: ncid 0x%x name %s", __func__, ncid, name));
/* Find metadata for this file. */
@@ -177,10 +183,12 @@ NC4_inq_dimid(int ncid, const char *name, int *idp)
if ((retval = nc4_normalize_name(name, norm_name)))
return retval;
+ shash = hash_fast(norm_name, strlen(norm_name));
+
/* Go through each dim and check for a name match. */
for (g = grp; g && !finished; g = g->parent)
for (dim = g->dim; dim; dim = dim->l.next)
- if (!strncmp(dim->name, norm_name, NC_MAX_NAME))
+ if (dim->hash == shash && !strncmp(dim->name, norm_name, NC_MAX_NAME))
{
if (idp)
*idp = dim->dimid;
@@ -336,6 +344,8 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
return NC_ENOMEM;
strcpy(dim->name, norm_name);
+ dim->hash = hash_fast(norm_name, strlen(norm_name));
+
/* Check if dimension was a coordinate variable, but names are different now */
if (dim->coord_var && strcmp(dim->name, dim->coord_var->name))
{
diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c
index dc294fb..b191d47 100644
--- a/libsrc4/nc4file.c
+++ b/libsrc4/nc4file.c
@@ -19,7 +19,7 @@ COPYRIGHT file for copying and redistribution conditions.
/* must be after nc4internal.h */
#include <H5DSpublic.h>
-
+#include <H5Fpublic.h>
#ifdef USE_HDF4
#include <mfhdf.h>
#endif
@@ -86,10 +86,6 @@ size_t nc4_chunk_cache_size = CHUNK_CACHE_SIZE;
size_t nc4_chunk_cache_nelems = CHUNK_CACHE_NELEMS;
float nc4_chunk_cache_preemption = CHUNK_CACHE_PREEMPTION;
-/* To turn off HDF5 error messages, I have to catch an early
- invocation of a netcdf function. */
-static int virgin = 1;
-
/* For performance, fill this array only the first time, and keep it
* in global memory for each further use. */
#define NUM_TYPES 12
@@ -390,8 +386,10 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
__func__, nc4_chunk_cache_size, nc4_chunk_cache_nelems, nc4_chunk_cache_preemption));
#endif /* USE_PARALLEL4 */
- if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+#ifdef HDF5_HAS_LIBVER_BOUNDS
+ if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
BAIL(NC_EHDFERR);
+#endif
/* Create the property list. */
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
@@ -491,13 +489,8 @@ NC4_create(const char* path, int cmode, size_t initialsz, int basepe,
#endif /* USE_PARALLEL4 */
/* If this is our first file, turn off HDF5 error messages. */
- if (virgin)
- {
- if (H5Eset_auto(NULL, NULL) < 0)
- LOG((0, "Couldn't turn off HDF5 error messages!"));
- LOG((1, "HDF5 error messages have been turned off."));
- virgin = 0;
- }
+ if (!nc4_hdf5_initialized)
+ nc4_hdf5_initialize();
/* Check the cmode for validity. */
if((cmode & ILLEGAL_CREATE_FLAGS) != 0)
@@ -615,6 +608,7 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
new_dim->hdf5_objid.fileno[1] = statbuf->fileno[1];
new_dim->hdf5_objid.objno[0] = statbuf->objno[0];
new_dim->hdf5_objid.objno[1] = statbuf->objno[1];
+ new_dim->hash = hash_fast(obj_name, strlen(obj_name));
/* If the dimscale has an unlimited dimension, then this dimension
* is unlimited. */
@@ -670,11 +664,12 @@ exit:
/* This function reads the hacked in coordinates attribute I use for
* multi-dimensional coordinates. */
static int
-read_coord_dimids(NC_VAR_INFO_T *var)
+read_coord_dimids(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
{
hid_t coord_att_typeid = -1, coord_attid = -1, spaceid = -1;
hssize_t npoints;
int ret = 0;
+ int d;
/* There is a hidden attribute telling us the ids of the
* dimensions that apply to this multi-dimensional coordinate
@@ -696,6 +691,12 @@ read_coord_dimids(NC_VAR_INFO_T *var)
if (!ret && H5Aread(coord_attid, coord_att_typeid, var->dimids) < 0) ret++;
LOG((4, "dimscale %s is multidimensional and has coords", var->name));
+ /* Update var->dim field based on the var->dimids */
+ for (d = 0; d < var->ndims; d++) {
+ /* Ok if does not find a dim at this time, but if found set it */
+ nc4_find_dim(grp, var->dimids[d], &var->dim[d], NULL);
+ }
+
/* Set my HDF5 IDs free! */
if (spaceid >= 0 && H5Sclose(spaceid) < 0) ret++;
#ifdef EXTRA_TESTS
@@ -1573,6 +1574,7 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
strcpy(var->name, obj_name);
}
+ var->hash = hash_fast(var->name, strlen(var->name));
/* Find out what filters are applied to this HDF5 dataset,
* fletcher32, deflate, and/or shuffle. All other filters are
* ignored. */
@@ -1688,7 +1690,7 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
var->dimscale = NC_TRUE;
if (var->ndims > 1)
{
- if ((retval = read_coord_dimids(var)))
+ if ((retval = read_coord_dimids(grp, var)))
BAIL(retval);
}
else
@@ -2215,6 +2217,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
* fail if there are any open objects in the file. */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
BAIL(NC_EHDFERR);
+
#ifdef EXTRA_TESTS
num_plists++;
#endif
@@ -2226,6 +2229,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
BAIL(NC_EHDFERR);
#endif
+
#ifdef USE_PARALLEL4
/* If this is a parallel file create, set up the file creation
property list. */
@@ -2681,10 +2685,12 @@ nc4_open_hdf4_file(const char *path, int mode, NC *nc)
dim->len = dim_len;
else
dim->len = *dimsize;
+ dim->hash = hash_fast(dim_name, strlen(dim_name));
}
/* Tell the variable the id of this dimension. */
var->dimids[d] = dim->dimid;
+ var->dim[d] = dim;
}
/* Read the atts. */
@@ -2789,15 +2795,9 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
parameters = &mpidfalt;
#endif /* USE_PARALLEL4 */
- /* If this is our first file, turn off HDF5 error messages. */
- if (virgin)
- {
- if (H5Eset_auto(NULL, NULL) < 0)
- LOG((0, "Couldn't turn off HDF5 error messages!"));
- LOG((1, "HDF5 error messages turned off!"));
- virgin = 0;
- }
-
+ /* If this is our first file, initialize HDF5. */
+ if (!nc4_hdf5_initialized)
+ nc4_hdf5_initialize();
/* Check the mode for validity */
if((mode & ILLEGAL_OPEN_FLAGS) != 0)
@@ -3290,7 +3290,7 @@ NC4_set_content(int ncid, size_t size, void* memory)
BAIL(NC_EHDFERR);
#else
retval = NC_EDISKLESS;
-#endif
+#endif
done:
return retval;
diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c
index f90401a..445a2f8 100644
--- a/libsrc4/nc4hdf.c
+++ b/libsrc4/nc4hdf.c
@@ -595,21 +595,17 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
* put data beyond their current length. */
for (d2 = 0; d2 < var->ndims; d2++)
{
- for (dim = grp->dim; dim; dim = dim->l.next)
+ dim = var->dim[d2];
+ assert(dim && dim->dimid == var->dimids[d2]);
+ if (!dim->unlimited)
{
- if (dim->dimid == var->dimids[d2])
- {
- if (!dim->unlimited)
- {
- if (start[d2] >= (hssize_t)fdims[d2])
- BAIL_QUIET(NC_EINVALCOORDS);
- if (start[d2] + count[d2] > fdims[d2])
- BAIL_QUIET(NC_EEDGE);
- }
- }
+ if (start[d2] >= (hssize_t)fdims[d2])
+ BAIL_QUIET(NC_EINVALCOORDS);
+ if (start[d2] + count[d2] > fdims[d2])
+ BAIL_QUIET(NC_EEDGE);
}
}
-
+
/* Now you would think that no one would be crazy enough to write
a scalar dataspace with one of the array function calls, but you
would be wrong. So let's check to see if the dataset is
@@ -705,8 +701,8 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
{
for (d2 = 0; d2 < var->ndims; d2++)
{
- if ((retval = nc4_find_dim(grp, var->dimids[d2], &dim, NULL)))
- BAIL(retval);
+ dim = var->dim[d2];
+ assert(dim && dim->dimid == var->dimids[d2]);
if (dim->unlimited)
{
if (start[d2] + count[d2] > fdims[d2])
@@ -921,53 +917,51 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
/* Check dimension bounds. Remember that unlimited dimensions can
* put data beyond their current length. */
- for (d2 = 0; d2 < var->ndims; d2++)
- for (g = grp; g; g = g->parent)
- for (dim = g->dim; dim; dim = dim->l.next)
- if (dim->dimid == var->dimids[d2])
- {
- if (dim->unlimited)
- {
- size_t ulen;
-
- /* We can't go beyond the largest current extent of
- the unlimited dim. */
- if ((retval = NC4_inq_dim(ncid, dim->dimid, NULL, &ulen)))
- BAIL(retval);
-
- /* Check for out of bound requests. */
- if (start[d2] >= (hssize_t)ulen && count[d2])
- BAIL_QUIET(NC_EINVALCOORDS);
- if (start[d2] + count[d2] > ulen)
- BAIL_QUIET(NC_EEDGE);
-
- /* Things get a little tricky here. If we're getting
- a GET request beyond the end of this var's
- current length in an unlimited dimension, we'll
- later need to return the fill value for the
- variable. */
- if (start[d2] >= (hssize_t)fdims[d2])
- fill_value_size[d2] = count[d2];
- else if (start[d2] + count[d2] > fdims[d2])
- fill_value_size[d2] = count[d2] - (fdims[d2] - start[d2]);
- else
- fill_value_size[d2] = 0;
- count[d2] -= fill_value_size[d2];
- if (fill_value_size[d2])
- provide_fill++;
- }
- else
- {
- /* Check for out of bound requests. */
- if (start[d2] >= (hssize_t)fdims[d2])
- BAIL_QUIET(NC_EINVALCOORDS);
- if (start[d2] + count[d2] > fdims[d2])
- BAIL_QUIET(NC_EEDGE);
-
- /* Set the fill value boundary */
- fill_value_size[d2] = count[d2];
- }
- }
+ for (d2 = 0; d2 < var->ndims; d2++) {
+ dim = var->dim[d2];
+ assert(dim && dim->dimid == var->dimids[d2]);
+ if (dim->unlimited)
+ {
+ size_t ulen;
+
+ /* We can't go beyond the largest current extent of
+ the unlimited dim. */
+ if ((retval = NC4_inq_dim(ncid, dim->dimid, NULL, &ulen)))
+ BAIL(retval);
+
+ /* Check for out of bound requests. */
+ if (start[d2] >= (hssize_t)ulen && count[d2])
+ BAIL_QUIET(NC_EINVALCOORDS);
+ if (start[d2] + count[d2] > ulen)
+ BAIL_QUIET(NC_EEDGE);
+
+ /* Things get a little tricky here. If we're getting
+ a GET request beyond the end of this var's
+ current length in an unlimited dimension, we'll
+ later need to return the fill value for the
+ variable. */
+ if (start[d2] >= (hssize_t)fdims[d2])
+ fill_value_size[d2] = count[d2];
+ else if (start[d2] + count[d2] > fdims[d2])
+ fill_value_size[d2] = count[d2] - (fdims[d2] - start[d2]);
+ else
+ fill_value_size[d2] = 0;
+ count[d2] -= fill_value_size[d2];
+ if (fill_value_size[d2])
+ provide_fill++;
+ }
+ else
+ {
+ /* Check for out of bound requests. */
+ if (start[d2] >= (hssize_t)fdims[d2])
+ BAIL_QUIET(NC_EINVALCOORDS);
+ if (start[d2] + count[d2] > fdims[d2])
+ BAIL_QUIET(NC_EEDGE);
+
+ /* Set the fill value boundary */
+ fill_value_size[d2] = count[d2];
+ }
+ }
/* A little quirk: if any of the count values are zero, don't
* read. */
@@ -1147,6 +1141,7 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
filldata = (char *)data + real_data_size;
for (i = 0; i < fill_len; i++)
{
+
if (var->type_info->nc_type_class == NC_STRING)
{
if (*(char **)fillvalue)
@@ -1157,7 +1152,13 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
else
*(char **)filldata = NULL;
}
- else
+ else if(var->type_info->nc_type_class == NC_VLEN) {
+ if(fillvalue) {
+ memcpy(filldata,fillvalue,file_type_size);
+ } else {
+ *(char **)filldata = NULL;
+ }
+ } else
memcpy(filldata, fillvalue, file_type_size);
filldata = (char *)filldata + file_type_size;
}
@@ -1560,11 +1561,10 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
/* Check to see if any unlimited dimensions are used in this var. */
for (d = 0; d < var->ndims; d++) {
- for (g = grp; g; g = g->parent)
- for (dim = g->dim; dim; dim = dim->l.next)
- if (dim->dimid == var->dimids[d])
- if (dim->unlimited)
- unlimdim++;
+ dim = var->dim[d];
+ assert(dim && dim->dimid == var->dimids[d]);
+ if (dim->unlimited)
+ unlimdim++;
}
/* If there are no unlimited dims, and no filters, and the user
@@ -1585,47 +1585,37 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
/* Gather current & maximum dimension sizes, along with chunk sizes */
for (d = 0; d < var->ndims; d++)
{
- for (g = grp; g && (dims_found < var->ndims); g = g->parent)
- {
- for (dim = g->dim; dim; dim = dim->l.next)
- {
- if (dim->dimid == var->dimids[d])
- {
- dimsize[d] = dim->unlimited ? NC_HDF5_UNLIMITED_DIMSIZE : dim->len;
- maxdimsize[d] = dim->unlimited ? H5S_UNLIMITED : (hsize_t)dim->len;
- if (!var->contiguous) {
- if (var->chunksizes[d])
- chunksize[d] = var->chunksizes[d];
- else
- {
- size_t type_size;
- if (var->type_info->nc_type_class == NC_STRING)
- type_size = sizeof(char *);
- else
- type_size = var->type_info->size;
-
- /* Unlimited dim always gets chunksize of 1. */
- if (dim->unlimited)
- chunksize[d] = 1;
- else
- chunksize[d] = pow((double)DEFAULT_CHUNK_SIZE/type_size,
- 1/(double)(var->ndims - unlimdim));
-
- /* If the chunksize is greater than the dim
- * length, make it the dim length. */
- if (!dim->unlimited && chunksize[d] > dim->len)
- chunksize[d] = dim->len;
-
- /* Remember the computed chunksize */
- var->chunksizes[d] = chunksize[d];
- }
- }
+ dim = var->dim[d];
+ assert(dim && dim->dimid == var->dimids[d]);
+ dimsize[d] = dim->unlimited ? NC_HDF5_UNLIMITED_DIMSIZE : dim->len;
+ maxdimsize[d] = dim->unlimited ? H5S_UNLIMITED : (hsize_t)dim->len;
+ if (!var->contiguous) {
+ if (var->chunksizes[d])
+ chunksize[d] = var->chunksizes[d];
+ else
+ {
+ size_t type_size;
+ if (var->type_info->nc_type_class == NC_STRING)
+ type_size = sizeof(char *);
+ else
+ type_size = var->type_info->size;
- dims_found++;
- break;
- }
- }
- }
+ /* Unlimited dim always gets chunksize of 1. */
+ if (dim->unlimited)
+ chunksize[d] = 1;
+ else
+ chunksize[d] = pow((double)DEFAULT_CHUNK_SIZE/type_size,
+ 1/(double)(var->ndims - unlimdim));
+
+ /* If the chunksize is greater than the dim
+ * length, make it the dim length. */
+ if (!dim->unlimited && chunksize[d] > dim->len)
+ chunksize[d] = dim->len;
+
+ /* Remember the computed chunksize */
+ var->chunksizes[d] = chunksize[d];
+ }
+ }
}
if (var->contiguous)
@@ -2032,42 +2022,33 @@ attach_dimscales(NC_GRP_INFO_T *grp)
{
if (!var->dimscale_attached[d])
{
- for (g = grp; g && !var->dimscale_attached[d]; g = g->parent)
- for (dim1 = g->dim; dim1; dim1 = dim1->l.next)
- if (var->dimids[d] == dim1->dimid)
- {
- hid_t dim_datasetid; /* Dataset ID for dimension */
-
- LOG((2, "%s: attaching scale for dimid %d to var %s",
- __func__, var->dimids[d], var->name));
-
- /* Find dataset ID for dimension */
- if (dim1->coord_var)
- dim_datasetid = dim1->coord_var->hdf_datasetid;
- else
- dim_datasetid = dim1->hdf_dimscaleid;
- assert(dim_datasetid > 0);
- if (H5DSattach_scale(var->hdf_datasetid, dim_datasetid, d) < 0)
- BAIL(NC_EHDFERR);
- var->dimscale_attached[d] = NC_TRUE;
- break;
- }
- }
-
- /* If we didn't find a dimscale to attach, that's a problem! */
- if (!var->dimscale_attached[d])
- {
- LOG((0, "no dimscale found!"));
- return NC_EDIMSCALE;
+ hid_t dim_datasetid; /* Dataset ID for dimension */
+ dim1 = var->dim[d];
+ assert(dim1 && dim1->dimid == var->dimids[d]);
+
+ LOG((2, "%s: attaching scale for dimid %d to var %s",
+ __func__, var->dimids[d], var->name));
+
+ /* Find dataset ID for dimension */
+ if (dim1->coord_var)
+ dim_datasetid = dim1->coord_var->hdf_datasetid;
+ else
+ dim_datasetid = dim1->hdf_dimscaleid;
+ assert(dim_datasetid > 0);
+ if (H5DSattach_scale(var->hdf_datasetid, dim_datasetid, d) < 0)
+ BAIL(NC_EHDFERR);
+ var->dimscale_attached[d] = NC_TRUE;
}
- }
- else
- {
- /* Create a phoney dimension! */
+ /* If we didn't find a dimscale to attach, that's a problem! */
+ if (!var->dimscale_attached[d])
+ {
+ LOG((0, "no dimscale found!"));
+ return NC_EDIMSCALE;
+ }
}
}
- } /* next d */
+ }
}
exit:
@@ -2216,39 +2197,26 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
if (var->dimscale_attached)
{
- int dims_detached = 0;
- nc_bool_t finished = NC_FALSE;
int d;
/* If this is a regular var, detach all its dim scales. */
for (d = 0; d < var->ndims; d++)
if (var->dimscale_attached[d])
{
- NC_GRP_INFO_T *g;
+ hid_t dim_datasetid; /* Dataset ID for dimension */
+ NC_DIM_INFO_T *dim1 = var->dim[d];
+ assert(dim1 && dim1->dimid == var->dimids[d]);
- for (g = grp; g && !finished; g = g->parent)
- {
- NC_DIM_INFO_T *dim1;
+ /* Find dataset ID for dimension */
+ if (dim1->coord_var)
+ dim_datasetid = dim1->coord_var->hdf_datasetid;
+ else
+ dim_datasetid = dim1->hdf_dimscaleid;
+ assert(dim_datasetid > 0);
- for (dim1 = g->dim; dim1; dim1 = dim1->l.next)
- if (var->dimids[d] == dim1->dimid)
- {
- hid_t dim_datasetid; /* Dataset ID for dimension */
-
- /* Find dataset ID for dimension */
- if (dim1->coord_var)
- dim_datasetid = dim1->coord_var->hdf_datasetid;
- else
- dim_datasetid = dim1->hdf_dimscaleid;
- assert(dim_datasetid > 0);
-
- if (H5DSdetach_scale(var->hdf_datasetid, dim_datasetid, d) < 0)
- BAIL(NC_EHDFERR);
- var->dimscale_attached[d] = NC_FALSE;
- if (dims_detached++ == var->ndims)
- finished = NC_TRUE;
- }
- }
+ if (H5DSdetach_scale(var->hdf_datasetid, dim_datasetid, d) < 0)
+ BAIL(NC_EHDFERR);
+ var->dimscale_attached[d] = NC_FALSE;
}
}
}
@@ -2411,7 +2379,6 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
if (v1)
{
hsize_t *new_size = NULL;
- NC_GRP_INFO_T *g;
NC_DIM_INFO_T *dim1;
int d1;
@@ -2421,21 +2388,8 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
BAIL(NC_ENOMEM);
for (d1 = 0; d1 < v1->ndims; d1++)
{
- if (v1->dimids[d1] == dim->dimid)
- new_size[d1] = dim->len;
- else
- {
- int break_it = 0;
-
- for (g = grp; g && !break_it; g = g->parent)
- for (dim1 = g->dim; dim1; dim1 = dim1->l.next)
- if (dim1->dimid == v1->dimids[d1])
- {
- new_size[d1] = dim1->len;
- break_it++;
- break;
- }
- }
+ assert(v1->dim[d1] && v1->dim[d1]->dimid == v1->dimids[d1]);
+ new_size[d1] = v1->dim[d1]->len;
}
if (H5Dset_extent(v1->hdf_datasetid, new_size) < 0) {
free(new_size);
@@ -3624,6 +3578,17 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
* try and find a dimension for them. */
for (var = grp->var; var; var = var->l.next)
{
+ /* Check all vars and see if dim[i] != NULL if dimids[i] valid. */
+ int ndims = var->ndims;
+ int d;
+ for (d = 0; d < ndims; d++)
+ {
+ if (var->dim[d] == NULL) {
+ nc4_find_dim(grp, var->dimids[d], &var->dim[d], NULL);
+ }
+ /* assert(var->dim[d] && var->dim[d]->dimid == var->dimids[d]); */
+ }
+
/* Skip dimension scale variables */
if (!var->dimscale)
{
@@ -3651,6 +3616,7 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
LOG((4, "%s: for dimension %d, found dim %s",
__func__, d, dim->name));
var->dimids[d] = dim->dimid;
+ var->dim[d] = dim;
finished = NC_TRUE;
break;
}
@@ -3750,6 +3716,7 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
/* The variable must remember the dimid. */
var->dimids[d] = dim->dimid;
+ var->dim[d] = dim;
} /* next dim */
/* Free the memory we malloced. */
diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c
index a078a80..a7a1a0b 100644
--- a/libsrc4/nc4internal.c
+++ b/libsrc4/nc4internal.c
@@ -45,6 +45,21 @@ int nc_log_level = -1;
#endif /* LOGGING */
+static int nc4_hdf5_initialized = 0;
+
+/*
+Provide a function to do any necessary initialization
+of the HDF5 library.
+*/
+void
+nc4_hdf5_initialize(void)
+{
+ if (H5Eset_auto(NULL, NULL) < 0)
+ LOG((0, "Couldn't turn off HDF5 error messages!"));
+ LOG((1, "HDF5 error messages have been turned off."));
+ nc4_hdf5_initialized = 1;
+}
+
/* Check and normalize and name. */
int
nc4_check_name(const char *name, char *norm_name)
@@ -529,10 +544,12 @@ nc4_find_grp_att(NC_GRP_INFO_T *grp, int varid, const char *name, int attnum,
/* Now find the attribute by name or number. If a name is provided,
* ignore the attnum. */
- for (*att = attlist; *att; *att = (*att)->l.next)
- if ((name && !strcmp((*att)->name, name)) ||
- (!name && (*att)->attnum == attnum))
- return NC_NOERR;
+ for (*att = attlist; *att; *att = (*att)->l.next) {
+ if (name && (*att)->name && !strcmp((*att)->name, name))
+ return NC_NOERR;
+ if (!name && (*att)->attnum == attnum)
+ return NC_NOERR;
+ }
/* If we get here, we couldn't find the attribute. */
return NC_ENOTATT;
@@ -747,7 +764,8 @@ nc4_check_dup_name(NC_GRP_INFO_T *grp, char *name)
NC_TYPE_INFO_T *type;
NC_GRP_INFO_T *g;
NC_VAR_INFO_T *var;
-
+ uint32_t hash;
+
/* Any types of this name? */
for (type = grp->type; type; type = type->l.next)
if (!strcmp(type->name, name))
@@ -759,8 +777,9 @@ nc4_check_dup_name(NC_GRP_INFO_T *grp, char *name)
return NC_ENAMEINUSE;
/* Any variables of this name? */
+ hash = hash_fast(name, strlen(name));
for (var = grp->var; var; var = var->l.next)
- if (!strcmp(var->name, name))
+ if (var->hash == hash && !strcmp(var->name, name))
return NC_ENAMEINUSE;
return NC_NOERR;
@@ -1387,6 +1406,9 @@ nc4_normalize_name(const char *name, char *norm_name)
int
nc_set_log_level(int new_level)
{
+ if(!nc4_hdf5_initialized)
+ nc4_hdf5_initialize();
+
/* If the user wants to completely turn off logging, turn off HDF5
logging too. Now I truely can't think of what to do if this
fails, so just ignore the return code. */
diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c
index ac216b9..eb0cb95 100644
--- a/libsrc4/nc4var.c
+++ b/libsrc4/nc4var.c
@@ -425,6 +425,7 @@ nc_def_var_nc4(int ncid, const char *name, nc_type xtype,
if (!(var->name = malloc((strlen(norm_name) + 1) * sizeof(char))))
BAIL(NC_ENOMEM);
strcpy(var->name, norm_name);
+ var->hash = hash_fast(norm_name, strlen(norm_name));
var->varid = grp->nvars++;
var->ndims = ndims;
var->is_new_var = NC_TRUE;
@@ -513,7 +514,7 @@ nc_def_var_nc4(int ncid, const char *name, nc_type xtype,
BAIL(retval);
/* Check for dim index 0 having the same name, in the same group */
- if (d == 0 && dim_grp == grp && strcmp(dim->name, norm_name) == 0)
+ if (d == 0 && dim_grp == grp && dim->hash == var->hash && strcmp(dim->name, norm_name) == 0)
{
var->dimscale = NC_TRUE;
dim->coord_var = var;
@@ -571,7 +572,7 @@ nc_def_var_nc4(int ncid, const char *name, nc_type xtype,
* because the dimension will cause a HDF5 dataset to be created,
* and this var has the same name. */
for (dim = grp->dim; dim; dim = dim->l.next)
- if (!strcmp(dim->name, norm_name) &&
+ if (dim->hash == var->hash && !strcmp(dim->name, norm_name) &&
(!var->ndims || dimidsp[0] != dim->dimid))
{
/* Set a different hdf5 name for this variable to avoid name
@@ -858,6 +859,12 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
(*contiguous != NC_CHUNKED && fletcher32))
return NC_EINVAL;
+ /* Can't turn on parallel and deflate/fletcher32/szip/shuffle. */
+ if (nc->mode & (NC_MPIIO | NC_MPIPOSIX)) {
+ if (deflate || fletcher32 || shuffle)
+ return NC_EINVAL;
+ }
+
/* If the HDF5 dataset has already been created, then it is too
* late to set all the extra stuff. */
if (var->created)
@@ -913,8 +920,7 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
if (!ishdf4) {
for (d = 0; d < var->ndims; d++)
{
- if ((retval = nc4_find_dim(grp, var->dimids[d], &dim, NULL)))
- return retval;
+ dim = var->dim[d];
if (dim->unlimited)
return NC_EINVAL;
}
@@ -1146,6 +1152,8 @@ NC4_inq_varid(int ncid, const char *name, int *varidp)
NC_VAR_INFO_T *var;
char norm_name[NC_MAX_NAME + 1];
int retval;
+ uint32_t nn_hash;
+
#if 0 /*def USE_PNETCDF*/
NC_HDF5_FILE_INFO_T *h5;
#endif
@@ -1175,9 +1183,11 @@ NC4_inq_varid(int ncid, const char *name, int *varidp)
if ((retval = nc4_normalize_name(name, norm_name)))
return retval;
+ nn_hash = hash_fast(norm_name, strlen(norm_name));
+
/* Find var of this name. */
for (var = grp->var; var; var = var->l.next)
- if (!(strcmp(var->name, norm_name)))
+ if (nn_hash == var->hash && !(strcmp(var->name, norm_name)))
{
*varidp = var->varid;
return NC_NOERR;
@@ -1197,6 +1207,7 @@ NC4_rename_var(int ncid, int varid, const char *name)
NC_GRP_INFO_T *grp;
NC_HDF5_FILE_INFO_T *h5;
NC_VAR_INFO_T *var, *tmp_var;
+ uint32_t nn_hash;
int retval = NC_NOERR;
LOG((2, "%s: ncid 0x%x varid %d name %s",
@@ -1228,10 +1239,11 @@ NC4_rename_var(int ncid, int varid, const char *name)
return retval;
/* Check if name is in use, and retain a pointer to the correct variable */
+ nn_hash = hash_fast(name, strlen(name));
tmp_var = NULL;
for (var = grp->var; var; var = var->l.next)
{
- if (!strncmp(var->name, name, NC_MAX_NAME))
+ if (nn_hash == var->hash && !strncmp(var->name, name, NC_MAX_NAME))
return NC_ENAMEINUSE;
if (var->varid == varid)
tmp_var = var;
@@ -1259,6 +1271,7 @@ NC4_rename_var(int ncid, int varid, const char *name)
if (!(var->name = malloc((strlen(name) + 1) * sizeof(char))))
return NC_ENOMEM;
strcpy(var->name, name);
+ var->hash = nn_hash;
/* Check if this was a coordinate variable previously, but names are different now */
if (var->dimscale && strcmp(var->name, var->dim[0]->name))
diff --git a/libsrcp/Makefile.in b/libsrcp/Makefile.in
index 2682b23..2dbfa36 100644
--- a/libsrcp/Makefile.in
+++ b/libsrcp/Makefile.in
@@ -241,6 +241,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/nc-config.cmake.in b/nc-config.cmake.in
old mode 100644
new mode 100755
index b9adec3..2ef0706
--- a/nc-config.cmake.in
+++ b/nc-config.cmake.in
@@ -6,12 +6,12 @@
prefix="@CMAKE_INSTALL_PREFIX@"
exec_prefix="@CMAKE_INSTALL_PREFIX@"
-libdir="@CMAKE_INSTALL_PREFIX@/lib"
-includedir="@CMAKE_INSTALL_PREFIX@/include"
+libdir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@"
+includedir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@"
cc="@CMAKE_C_COMPILER@"
-cflags="-I at CMAKE_INSTALL_PREFIX@/include"
-libs="-L at CMAKE_INSTALL_PREFIX@/lib @NC_LIBS@"
+cflags="-I at CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@"
+libs="-L at CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ @NC_LIBS@"
has_dap="@USE_DAP@"
if [ -z $has_dap ]; then
@@ -22,7 +22,7 @@ fi
has_nc2="@BUILD_V2@"
-if [ -z $has_nc2 ]; then
+if [ -z $has_nc2 -o "$has_nc2" = "OFF" ]; then
has_nc2="no"
else
has_nc2="yes"
@@ -35,6 +35,13 @@ else
has_nc4="yes"
fi
+has_logging="@ENABLE_LOGGING@"
+if [ -z $has_logging ]; then
+ has_logging="no"
+else
+ has_logging="yes"
+fi
+
has_hdf4="@USE_HDF4@"
if [ -z $has_hdf4 ]; then
has_hdf4="no"
@@ -50,7 +57,7 @@ else
fi
has_hdf5="@USE_HDF5@"
-if [ -z $has_hdf5 ]; then
+if [ -z $has_hdf5 -o "$has_hdf5" = "OFF" ]; then
has_hdf5="no"
else
has_hdf5="yes"
@@ -67,11 +74,13 @@ fi
version="@PACKAGE@ @VERSION@"
has_f90="no"
+has_f03="no"
if type -p nf-config > /dev/null 2>&1; then
fc=`nf-config --fc`
fflags=`nf-config --fflags`
flibs=`nf-config --flibs`
has_f90=`nf-config --has-f90`
+ has_f03=`nf-config --has-f03`
fi
has_cxx="no"
@@ -100,6 +109,7 @@ Available values for OPTION include:
--has-nc4 whether NetCDF-4/HDF-5 is enabled in this build
--has-hdf5 whether HDF5 is used in build (always the same as --has-nc4)
--has-hdf4 whether HDF4 was used in build
+ --has-logging whether logging is enabled with --enable-logging.
--has-pnetcdf whether parallel-netcdf (a.k.a. pnetcdf) was used in build
--has-szlib whether szlib is included in build
--libs library linking information for netcdf
@@ -129,7 +139,7 @@ if type -p nf-config > /dev/null 2>&1; then
--fflags flags needed to compile a Fortran program
--flibs libraries needed to link a Fortran program
--has-f90 whether Fortran 90 API is installed
-
+ --has-f03 whether Fortran 03 API is installed (implies F90).
EOF
fi
exit $1
@@ -153,12 +163,14 @@ all()
echo " --fflags -> $fflags"
echo " --flibs -> $flibs"
echo " --has-f90 -> $has_f90"
+ echo " --has-f03 -> $has_f03"
echo
echo " --has-dap -> $has_dap"
echo " --has-nc2 -> $has_nc2"
echo " --has-nc4 -> $has_nc4"
echo " --has-hdf5 -> $has_hdf5"
echo " --has-hdf4 -> $has_hdf4"
+ echo " --has-logging-> $has_logging"
echo " --has-pnetcdf-> $has_pnetcdf"
echo " --has-szlib -> $has_szlib"
echo
@@ -219,6 +231,10 @@ while test $# -gt 0; do
echo $has_hdf4
;;
+ --has-logging)
+ echo $has_logging
+ ;;
+
--has-pnetcdf)
echo $has_pnetcdf
;;
@@ -283,6 +299,10 @@ while test $# -gt 0; do
echo $has_f90
;;
+ --has-f03)
+ echo $has_f03
+ ;;
+
*)
echo "unknown option: $1"
usage
diff --git a/nc-config.in b/nc-config.in
index 0d536e4..f6c07d3 100644
--- a/nc-config.in
+++ b/nc-config.in
@@ -8,35 +8,35 @@ prefix=@prefix@
exec_prefix=${prefix}
includedir=${prefix}/include
+
cc="@CC@"
-cflags=" -I${includedir} @CPPFLAGS@"
+cflags=" -I${includedir} @CPPFLAGS@"
has_dap="@HAS_DAP@"
has_nc2="@HAS_NC2@"
has_nc4="@HAS_NC4@"
has_hdf4="@HAS_HDF4@"
has_pnetcdf="@HAS_PNETCDF@"
has_hdf5="@HAS_HDF5@"
+has_logging="@HAS_LOGGING@"
version="@PACKAGE_NAME@ @PACKAGE_VERSION@"
has_f90="no"
+has_f03="no"
if type -p nf-config > /dev/null 2>&1; then
fc=`nf-config --fc`
fflags=`nf-config --fflags`
flibs=`nf-config --flibs`
has_f90=`nf-config --has-f90`
+ has_f03=`nf-config --has-f03`
fi
has_cxx="no"
has_cxx4="no"
if type -p ncxx4-config > /dev/null 2>&1; then
cxx4=`ncxx4-config --cxx`
-# cxxflags=`ncxx4-config --cxxflags`
-# cxxlibs=`ncxx4-config --cxxlibs`
has_cxx4="yes"
elif type -p ncxx-config > /dev/null 2>&1; then
cxx=`ncxx-config --cxx`
-# cxxflags=`ncxx-config --cxxflags`
-# cxxlibs=`ncxx-config --cxxlibs`
has_cxx="yes"
fi
@@ -56,7 +56,9 @@ Available values for OPTION include:
--has-nc4 whether NetCDF-4/HDF-5 is enabled in this build
--has-hdf5 whether HDF5 is used in build (always the same as --has-nc4)
--has-hdf4 whether HDF4 was used in build
+ --has-logging whether logging is enabled with --enable-logging.
--has-pnetcdf whether parallel-netcdf (a.k.a. pnetcdf) was used in build
+ --has-szlib whether szlib is included in build
--libs library linking information for netcdf
--prefix Install prefix
--includedir Include directory
@@ -84,7 +86,7 @@ if type -p nf-config > /dev/null 2>&1; then
--fflags flags needed to compile a Fortran program
--flibs libraries needed to link a Fortran program
--has-f90 whether Fortran 90 API is installed
-
+ --has-f03 whether Fortran 03 API is installed (implies F90).
EOF
fi
exit $1
@@ -101,6 +103,7 @@ all()
echo
echo " --has-c++ -> $has_cxx"
echo " --cxx -> $cxx"
+
# echo " --cxxflags -> $cxxflags"
# echo " --cxxlibs -> $cxxlibs"
echo " --has-c++4 -> $has_cxx4"
@@ -110,13 +113,16 @@ all()
echo " --fflags -> $fflags"
echo " --flibs -> $flibs"
echo " --has-f90 -> $has_f90"
+ echo " --has-f03 -> $has_f03"
echo
echo " --has-dap -> $has_dap"
echo " --has-nc2 -> $has_nc2"
echo " --has-nc4 -> $has_nc4"
echo " --has-hdf5 -> $has_hdf5"
echo " --has-hdf4 -> $has_hdf4"
+ echo " --has-logging-> $has_logging"
echo " --has-pnetcdf-> $has_pnetcdf"
+ echo " --has-szlib -> $has_szlib"
echo
echo " --prefix -> $prefix"
echo " --includedir-> $includedir"
@@ -175,10 +181,18 @@ while test $# -gt 0; do
echo $has_hdf4
;;
+ --has-logging)
+ echo $has_logging
+ ;;
+
--has-pnetcdf)
echo $has_pnetcdf
;;
+ --has-szlib)
+ echo $has_szlib
+ ;;
+
--libs)
PKG_CONFIG_PATH=${prefix}/lib/pkgconfig pkg-config netcdf --libs
;;
@@ -211,14 +225,6 @@ while test $# -gt 0; do
echo $cxx4
;;
-# --cxxflags)
-# echo $cxxflags
-# ;;
-#
-# --cxxlibs)
-# echo $cxxlibs
-# ;;
-
--fc)
echo $fc
;;
@@ -235,6 +241,10 @@ while test $# -gt 0; do
echo $has_f90
;;
+ --has-f03)
+ echo $has_f03
+ ;;
+
*)
echo "unknown option: $1"
usage
diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt
index 2d7a7c1..23430f9 100644
--- a/nc_test/CMakeLists.txt
+++ b/nc_test/CMakeLists.txt
@@ -22,7 +22,7 @@ TARGET_LINK_LIBRARIES(nc_test
)
# 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)
+SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta tst_inq_type)
IF(NOT HAVE_BASH)
SET(TESTS ${TESTS} tst_atts3)
diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am
index 5532ac7..17df263 100644
--- a/nc_test/Makefile.am
+++ b/nc_test/Makefile.am
@@ -14,12 +14,12 @@ 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 nc_test_cdf5.nc \
-unlim.nc
+unlim.nc tst_inq_type.nc
# 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
+ tst_meta tst_inq_type
if USE_NETCDF4
TESTPROGRAMS += tst_atts tst_put_vars
diff --git a/nc_test/Makefile.in b/nc_test/Makefile.in
index 1fbc22b..37357aa 100644
--- a/nc_test/Makefile.in
+++ b/nc_test/Makefile.in
@@ -154,8 +154,9 @@ CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_5 = t_nc$(EXEEXT) tst_small$(EXEEXT) nc_test$(EXEEXT) \
tst_misc$(EXEEXT) tst_norm$(EXEEXT) tst_names$(EXEEXT) \
tst_nofill$(EXEEXT) tst_nofill2$(EXEEXT) tst_nofill3$(EXEEXT) \
- tst_atts3$(EXEEXT) tst_meta$(EXEEXT) $(am__EXEEXT_1) \
- $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4)
+ tst_atts3$(EXEEXT) tst_meta$(EXEEXT) tst_inq_type$(EXEEXT) \
+ $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ $(am__EXEEXT_4)
@BUILD_DISKLESS_TRUE at am__EXEEXT_6 = tst_diskless$(EXEEXT) \
@BUILD_DISKLESS_TRUE@ tst_diskless3$(EXEEXT) \
@BUILD_DISKLESS_TRUE@ tst_diskless4$(EXEEXT)
@@ -237,6 +238,10 @@ tst_formatx_pnetcdf_OBJECTS = tst_formatx_pnetcdf.$(OBJEXT)
tst_formatx_pnetcdf_LDADD = $(LDADD)
tst_formatx_pnetcdf_DEPENDENCIES = \
${top_builddir}/liblib/libnetcdf.la
+tst_inq_type_SOURCES = tst_inq_type.c
+tst_inq_type_OBJECTS = tst_inq_type.$(OBJEXT)
+tst_inq_type_LDADD = $(LDADD)
+tst_inq_type_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
tst_large_SOURCES = tst_large.c
tst_large_OBJECTS = tst_large.$(OBJEXT)
tst_large_LDADD = $(LDADD)
@@ -323,18 +328,18 @@ SOURCES = large_files.c $(nc_test_SOURCES) quick_large_files.c t_nc.c \
$(testnc3perf_SOURCES) tst_addvar.c tst_atts.c tst_atts3.c \
tst_big_rvar.c tst_big_var.c tst_big_var2.c tst_big_var6.c \
tst_diskless.c tst_diskless2.c tst_diskless3.c tst_diskless4.c \
- tst_formatx_pnetcdf.c tst_large.c tst_meta.c tst_misc.c \
- tst_names.c tst_nofill.c tst_nofill2.c tst_nofill3.c \
- tst_norm.c tst_parallel2.c tst_pnetcdf.c tst_put_vars.c \
- tst_small.c
+ tst_formatx_pnetcdf.c tst_inq_type.c tst_large.c tst_meta.c \
+ tst_misc.c tst_names.c tst_nofill.c tst_nofill2.c \
+ tst_nofill3.c tst_norm.c tst_parallel2.c tst_pnetcdf.c \
+ tst_put_vars.c tst_small.c
DIST_SOURCES = large_files.c $(nc_test_SOURCES) quick_large_files.c \
t_nc.c $(am__testnc3perf_SOURCES_DIST) tst_addvar.c tst_atts.c \
tst_atts3.c tst_big_rvar.c tst_big_var.c tst_big_var2.c \
tst_big_var6.c tst_diskless.c tst_diskless2.c tst_diskless3.c \
- tst_diskless4.c tst_formatx_pnetcdf.c tst_large.c tst_meta.c \
- tst_misc.c tst_names.c tst_nofill.c tst_nofill2.c \
- tst_nofill3.c tst_norm.c tst_parallel2.c tst_pnetcdf.c \
- tst_put_vars.c tst_small.c
+ tst_diskless4.c tst_formatx_pnetcdf.c tst_inq_type.c \
+ tst_large.c tst_meta.c tst_misc.c tst_names.c tst_nofill.c \
+ tst_nofill2.c tst_nofill3.c tst_norm.c tst_parallel2.c \
+ tst_pnetcdf.c tst_put_vars.c tst_small.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -615,6 +620,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -748,12 +754,12 @@ 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 \
- nc_test_cdf5.nc unlim.nc $(am__append_7) ncx.c
+ nc_test_cdf5.nc unlim.nc tst_inq_type.nc $(am__append_7) 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 \
- $(am__append_3) $(am__append_4) $(am__append_5) \
+ tst_inq_type $(am__append_3) $(am__append_4) $(am__append_5) \
$(am__append_6)
# These are the source files for the main workhorse test program,
@@ -888,6 +894,10 @@ tst_formatx_pnetcdf$(EXEEXT): $(tst_formatx_pnetcdf_OBJECTS) $(tst_formatx_pnetc
@rm -f tst_formatx_pnetcdf$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_formatx_pnetcdf_OBJECTS) $(tst_formatx_pnetcdf_LDADD) $(LIBS)
+tst_inq_type$(EXEEXT): $(tst_inq_type_OBJECTS) $(tst_inq_type_DEPENDENCIES) $(EXTRA_tst_inq_type_DEPENDENCIES)
+ @rm -f tst_inq_type$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tst_inq_type_OBJECTS) $(tst_inq_type_LDADD) $(LIBS)
+
tst_large$(EXEEXT): $(tst_large_OBJECTS) $(tst_large_DEPENDENCIES) $(EXTRA_tst_large_DEPENDENCIES)
@rm -f tst_large$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_large_OBJECTS) $(tst_large_LDADD) $(LIBS)
@@ -964,6 +974,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless3.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless4.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_formatx_pnetcdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_inq_type.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_meta.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_misc.Po at am__quote@
@@ -1278,6 +1289,13 @@ tst_meta.log: tst_meta$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+tst_inq_type.log: tst_inq_type$(EXEEXT)
+ @p='tst_inq_type$(EXEEXT)'; \
+ b='tst_inq_type'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
tst_atts.log: tst_atts$(EXEEXT)
@p='tst_atts$(EXEEXT)'; \
b='tst_atts'; \
diff --git a/nc_test/error.c b/nc_test/error.c
index c4fbc4a..e9668de 100644
--- a/nc_test/error.c
+++ b/nc_test/error.c
@@ -47,7 +47,7 @@ print(const char *fmt, ...)
int
ifFail(const int expr, const int line, const char *file)
{
- if (expr) {
+ if (expr != 0) {
++nfails;
error("\n\tFAILURE at line %d of %s: ", line, file);
}
@@ -55,7 +55,7 @@ ifFail(const int expr, const int line, const char *file)
}
/* TODO:
- * This diagnostic doesn't fit very well with the diagnostic message
+ * This diagnostic doesn't fit very well with the diagnostic message
* "architecture" of this program.
*/
void
diff --git a/nc_test/test_get.c b/nc_test/test_get.c
deleted file mode 100644
index 3429213..0000000
--- a/nc_test/test_get.c
+++ /dev/null
@@ -1,9331 +0,0 @@
-/* Do not edit this file. It is produced from the corresponding .m4 source */
-/*********************************************************************
- * Copyright 1996, UCAR/Unidata
- * See netcdf/COPYRIGHT file for copying and redistribution conditions.
- * $Id: test_get.m4 2785 2014-10-26 05:21:20Z wkliao $
- *********************************************************************/
-
-#ifdef USE_PARALLEL
-#include <mpi.h>
-#endif
-
-
-#include "tests.h"
-
-
-void
-test_nc_get_var1_text(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- text value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_text(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_text(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_text(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_TEXT );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_text(ncid, i, NULL, &value);
- else
- err = nc_get_var1_text(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_TEXT)) {
- if (expect >= text_min && expect <= text_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_TEXT)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_uchar(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- uchar value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_uchar(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_uchar(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_uchar(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_UCHAR );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_uchar(ncid, i, NULL, &value);
- else
- err = nc_get_var1_uchar(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_UCHAR)) {
- if (expect >= uchar_min && expect <= uchar_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_UCHAR)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_schar(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- schar value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_schar(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_schar(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_schar(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_SCHAR );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_schar(ncid, i, NULL, &value);
- else
- err = nc_get_var1_schar(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_SCHAR)) {
- if (expect >= schar_min && expect <= schar_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_SCHAR)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_short(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- short value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_short(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_short(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_short(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_SHORT );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_short(ncid, i, NULL, &value);
- else
- err = nc_get_var1_short(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_SHORT)) {
- if (expect >= short_min && expect <= short_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_SHORT)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_int(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- int value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_int(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_int(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_int(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_INT );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_int(ncid, i, NULL, &value);
- else
- err = nc_get_var1_int(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_INT)) {
- if (expect >= int_min && expect <= int_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_INT)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_long(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- long value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_long(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_long(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_long(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_LONG );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_long(ncid, i, NULL, &value);
- else
- err = nc_get_var1_long(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_LONG)) {
- if (expect >= long_min && expect <= long_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_LONG)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_float(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- float value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_float(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_float(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_float(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_FLOAT );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_float(ncid, i, NULL, &value);
- else
- err = nc_get_var1_float(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_FLOAT)) {
- if (expect >= float_min && expect <= float_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_FLOAT)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_double(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- double value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_double(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_double(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_double(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_DOUBLE );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_double(ncid, i, NULL, &value);
- else
- err = nc_get_var1_double(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_DOUBLE)) {
- if (expect >= double_min && expect <= double_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_DOUBLE)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_ushort(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- ushort value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_ushort(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_ushort(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_ushort(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_USHORT );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_ushort(ncid, i, NULL, &value);
- else
- err = nc_get_var1_ushort(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_USHORT)) {
- if (expect >= ushort_min && expect <= ushort_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_USHORT)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_uint(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- uint value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_uint(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_uint(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_uint(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_UINT );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_uint(ncid, i, NULL, &value);
- else
- err = nc_get_var1_uint(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_UINT)) {
- if (expect >= uint_min && expect <= uint_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_UINT)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_longlong(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- longlong value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_longlong(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_longlong(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_longlong(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_LONGLONG );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_longlong(ncid, i, NULL, &value);
- else
- err = nc_get_var1_longlong(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_LONGLONG)) {
- if (expect >= longlong_min && expect <= longlong_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_LONGLONG)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var1_ulonglong(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- double expect;
- int canConvert; /* Both text or both numeric */
- ulonglong value;
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_get_var1_ulonglong(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var1_ulonglong(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- index[j] = var_shape[i][j];
- err = nc_get_var1_ulonglong(ncid, i, index, &value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect = hash4( var_type[i], var_rank[i], index, NCT_ULONGLONG );
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_var1_ulonglong(ncid, i, NULL, &value);
- else
- err = nc_get_var1_ulonglong(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(expect,var_type[i], NCT_ULONGLONG)) {
- if (expect >= ulonglong_min && expect <= ulonglong_max) {
- IF (err) {
- error("%s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_ULONGLONG)) {
- error("expected: %G, got: %G", expect,
- (double) value);
- } else {
- nok++;
- }
- }
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
-
-
-void
-test_nc_get_var_text(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- text value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_text(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_text(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_TEXT);
- if (inRange3(expect[j],var_type[i], NCT_TEXT)) {
- allInIntRange = allInIntRange && expect[j] >= text_min
- && expect[j] <= text_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_text(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_TEXT)
- && expect[j] >= text_min && expect[j] <= text_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_TEXT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_uchar(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uchar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_uchar(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_uchar(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UCHAR);
- if (inRange3(expect[j],var_type[i], NCT_UCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= uchar_min
- && expect[j] <= uchar_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_uchar(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UCHAR)
- && expect[j] >= uchar_min && expect[j] <= uchar_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_UCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_schar(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- schar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_schar(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_schar(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SCHAR);
- if (inRange3(expect[j],var_type[i], NCT_SCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= schar_min
- && expect[j] <= schar_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_schar(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SCHAR)
- && expect[j] >= schar_min && expect[j] <= schar_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_SCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_short(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- short value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_short(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_short(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SHORT);
- if (inRange3(expect[j],var_type[i], NCT_SHORT)) {
- allInIntRange = allInIntRange && expect[j] >= short_min
- && expect[j] <= short_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_short(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SHORT)
- && expect[j] >= short_min && expect[j] <= short_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_SHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_int(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_int(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_int(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_INT);
- if (inRange3(expect[j],var_type[i], NCT_INT)) {
- allInIntRange = allInIntRange && expect[j] >= int_min
- && expect[j] <= int_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_int(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_INT)
- && expect[j] >= int_min && expect[j] <= int_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_INT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_long(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- long value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_long(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_long(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONG);
- if (inRange3(expect[j],var_type[i], NCT_LONG)) {
- allInIntRange = allInIntRange && expect[j] >= long_min
- && expect[j] <= long_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_long(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONG)
- && expect[j] >= long_min && expect[j] <= long_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_LONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_float(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- float value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_float(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_float(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_FLOAT);
- if (inRange3(expect[j],var_type[i], NCT_FLOAT)) {
- allInIntRange = allInIntRange && expect[j] >= float_min
- && expect[j] <= float_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_float(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_FLOAT)
- && expect[j] >= float_min && expect[j] <= float_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_FLOAT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_double(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- double value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_double(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_double(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_DOUBLE);
- if (inRange3(expect[j],var_type[i], NCT_DOUBLE)) {
- allInIntRange = allInIntRange && expect[j] >= double_min
- && expect[j] <= double_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_double(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
- && expect[j] >= double_min && expect[j] <= double_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_DOUBLE)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_ushort(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ushort value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_ushort(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_ushort(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_USHORT);
- if (inRange3(expect[j],var_type[i], NCT_USHORT)) {
- allInIntRange = allInIntRange && expect[j] >= ushort_min
- && expect[j] <= ushort_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_ushort(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_USHORT)
- && expect[j] >= ushort_min && expect[j] <= ushort_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_USHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_uint(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uint value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_uint(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_uint(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UINT);
- if (inRange3(expect[j],var_type[i], NCT_UINT)) {
- allInIntRange = allInIntRange && expect[j] >= uint_min
- && expect[j] <= uint_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_uint(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UINT)
- && expect[j] >= uint_min && expect[j] <= uint_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_UINT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_longlong(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- longlong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_longlong(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_longlong(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONGLONG);
- if (inRange3(expect[j],var_type[i], NCT_LONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= longlong_min
- && expect[j] <= longlong_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_longlong(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONGLONG)
- && expect[j] >= longlong_min && expect[j] <= longlong_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_LONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_var_ulonglong(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nok = 0; /* count of valid comparisons */
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ulonglong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_get_var_ulonglong(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_var_ulonglong(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_ULONGLONG);
- if (inRange3(expect[j],var_type[i], NCT_ULONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= ulonglong_min
- && expect[j] <= ulonglong_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_var_ulonglong(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_ULONGLONG)
- && expect[j] >= ulonglong_min && expect[j] <= ulonglong_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_ULONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
-
-
-void
-test_nc_get_vara_text(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- text value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_text(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_text(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_text(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_text(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_text(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_text(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_text(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_text(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_TEXT);
- if (inRange3(expect[j],var_type[i], NCT_TEXT)) {
- allInIntRange = allInIntRange && expect[j] >= text_min
- && expect[j] <= text_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_text(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_text(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_TEXT)
- && expect[j] >= text_min && expect[j] <= text_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_TEXT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_uchar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uchar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_uchar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_uchar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_uchar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_uchar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_uchar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_uchar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_uchar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_uchar(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UCHAR);
- if (inRange3(expect[j],var_type[i], NCT_UCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= uchar_min
- && expect[j] <= uchar_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_uchar(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_uchar(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UCHAR)
- && expect[j] >= uchar_min && expect[j] <= uchar_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_UCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_schar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- schar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_schar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_schar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_schar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_schar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_schar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_schar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_schar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_schar(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SCHAR);
- if (inRange3(expect[j],var_type[i], NCT_SCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= schar_min
- && expect[j] <= schar_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_schar(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_schar(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SCHAR)
- && expect[j] >= schar_min && expect[j] <= schar_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_SCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_short(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- short value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_short(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_short(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_short(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_short(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_short(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_short(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_short(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_short(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SHORT);
- if (inRange3(expect[j],var_type[i], NCT_SHORT)) {
- allInIntRange = allInIntRange && expect[j] >= short_min
- && expect[j] <= short_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_short(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_short(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SHORT)
- && expect[j] >= short_min && expect[j] <= short_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_SHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_int(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_int(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_int(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_int(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_int(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_int(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_int(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_int(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_int(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_INT);
- if (inRange3(expect[j],var_type[i], NCT_INT)) {
- allInIntRange = allInIntRange && expect[j] >= int_min
- && expect[j] <= int_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_int(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_int(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_INT)
- && expect[j] >= int_min && expect[j] <= int_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_INT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_long(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- long value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_long(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_long(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_long(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_long(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_long(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_long(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_long(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_long(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONG);
- if (inRange3(expect[j],var_type[i], NCT_LONG)) {
- allInIntRange = allInIntRange && expect[j] >= long_min
- && expect[j] <= long_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_long(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_long(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONG)
- && expect[j] >= long_min && expect[j] <= long_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_LONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_float(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- float value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_float(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_float(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_float(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_float(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_float(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_float(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_float(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_float(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_FLOAT);
- if (inRange3(expect[j],var_type[i], NCT_FLOAT)) {
- allInIntRange = allInIntRange && expect[j] >= float_min
- && expect[j] <= float_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_float(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_float(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_FLOAT)
- && expect[j] >= float_min && expect[j] <= float_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_FLOAT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_double(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- double value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_double(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_double(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_double(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_double(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_double(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_double(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_double(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_double(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_DOUBLE);
- if (inRange3(expect[j],var_type[i], NCT_DOUBLE)) {
- allInIntRange = allInIntRange && expect[j] >= double_min
- && expect[j] <= double_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_double(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_double(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
- && expect[j] >= double_min && expect[j] <= double_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_DOUBLE)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_ushort(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ushort value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_ushort(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_ushort(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_ushort(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_ushort(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_ushort(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_ushort(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_ushort(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_ushort(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_USHORT);
- if (inRange3(expect[j],var_type[i], NCT_USHORT)) {
- allInIntRange = allInIntRange && expect[j] >= ushort_min
- && expect[j] <= ushort_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_ushort(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_ushort(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_USHORT)
- && expect[j] >= ushort_min && expect[j] <= ushort_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_USHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_uint(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uint value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_uint(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_uint(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_uint(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_uint(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_uint(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_uint(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_uint(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_uint(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UINT);
- if (inRange3(expect[j],var_type[i], NCT_UINT)) {
- allInIntRange = allInIntRange && expect[j] >= uint_min
- && expect[j] <= uint_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_uint(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_uint(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UINT)
- && expect[j] >= uint_min && expect[j] <= uint_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_UINT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_longlong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- longlong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_longlong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_longlong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_longlong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_longlong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_longlong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_longlong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_longlong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_longlong(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONGLONG);
- if (inRange3(expect[j],var_type[i], NCT_LONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= longlong_min
- && expect[j] <= longlong_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_longlong(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_longlong(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONGLONG)
- && expect[j] >= longlong_min && expect[j] <= longlong_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_LONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vara_ulonglong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t mid[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ulonglong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_get_vara_ulonglong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_ulonglong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- /* Check non-scalars for correct error returned even when */
- /* there is nothing to get (edge[j]==0) */
- if(var_rank[i] > 0) {
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_get_vara_ulonglong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vara_ulonglong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
- err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
- } /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- expect[j] = hash4(var_type[i], var_rank[i], index, NCT_ULONGLONG);
- if (inRange3(expect[j],var_type[i], NCT_ULONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= ulonglong_min
- && expect[j] <= ulonglong_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2)
- err = nc_get_vara_ulonglong(ncid, i, NULL, NULL, value);
- else
- err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_ULONGLONG)
- && expect[j] >= ulonglong_min && expect[j] <= ulonglong_max) {
- IF (!equal(value[j],expect[j],var_type[i],NCT_ULONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
-
-
-void
-test_nc_get_vars_text(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- text value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_text(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_text(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_text(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_text(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_text(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_TEXT);
- if (inRange3(expect[j],var_type[i],NCT_TEXT)) {
- allInIntRange = allInIntRange && expect[j] >= text_min
- && expect[j] <= text_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_text(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_text(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_TEXT)
- && expect[j] >= text_min && expect[j] <= text_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_TEXT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_uchar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uchar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_uchar(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_uchar(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_UCHAR);
- if (inRange3(expect[j],var_type[i],NCT_UCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= uchar_min
- && expect[j] <= uchar_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_uchar(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_uchar(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UCHAR)
- && expect[j] >= uchar_min && expect[j] <= uchar_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_UCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_schar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- schar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_schar(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_schar(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_SCHAR);
- if (inRange3(expect[j],var_type[i],NCT_SCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= schar_min
- && expect[j] <= schar_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_schar(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_schar(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SCHAR)
- && expect[j] >= schar_min && expect[j] <= schar_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_SCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_short(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- short value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_short(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_short(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_short(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_short(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_short(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_SHORT);
- if (inRange3(expect[j],var_type[i],NCT_SHORT)) {
- allInIntRange = allInIntRange && expect[j] >= short_min
- && expect[j] <= short_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_short(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_short(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SHORT)
- && expect[j] >= short_min && expect[j] <= short_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_SHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_int(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_int(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_int(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_int(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_int(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_int(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_INT);
- if (inRange3(expect[j],var_type[i],NCT_INT)) {
- allInIntRange = allInIntRange && expect[j] >= int_min
- && expect[j] <= int_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_int(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_int(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_INT)
- && expect[j] >= int_min && expect[j] <= int_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_INT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_long(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- long value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_long(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_long(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_long(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_long(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_long(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_LONG);
- if (inRange3(expect[j],var_type[i],NCT_LONG)) {
- allInIntRange = allInIntRange && expect[j] >= long_min
- && expect[j] <= long_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_long(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_long(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONG)
- && expect[j] >= long_min && expect[j] <= long_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_LONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_float(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- float value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_float(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_float(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_float(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_float(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_float(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_FLOAT);
- if (inRange3(expect[j],var_type[i],NCT_FLOAT)) {
- allInIntRange = allInIntRange && expect[j] >= float_min
- && expect[j] <= float_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_float(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_float(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_FLOAT)
- && expect[j] >= float_min && expect[j] <= float_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_FLOAT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_double(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- double value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_double(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_double(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_double(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_double(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_double(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_DOUBLE);
- if (inRange3(expect[j],var_type[i],NCT_DOUBLE)) {
- allInIntRange = allInIntRange && expect[j] >= double_min
- && expect[j] <= double_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_double(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_double(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
- && expect[j] >= double_min && expect[j] <= double_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_DOUBLE)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_ushort(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ushort value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_ushort(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_ushort(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_USHORT);
- if (inRange3(expect[j],var_type[i],NCT_USHORT)) {
- allInIntRange = allInIntRange && expect[j] >= ushort_min
- && expect[j] <= ushort_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_ushort(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_ushort(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_USHORT)
- && expect[j] >= ushort_min && expect[j] <= ushort_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_USHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_uint(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uint value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_uint(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_uint(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_UINT);
- if (inRange3(expect[j],var_type[i],NCT_UINT)) {
- allInIntRange = allInIntRange && expect[j] >= uint_min
- && expect[j] <= uint_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_uint(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_uint(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UINT)
- && expect[j] >= uint_min && expect[j] <= uint_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_UINT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_longlong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- longlong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_longlong(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_longlong(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_LONGLONG);
- if (inRange3(expect[j],var_type[i],NCT_LONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= longlong_min
- && expect[j] <= longlong_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_longlong(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_longlong(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONGLONG)
- && expect[j] >= longlong_min && expect[j] <= longlong_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_LONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_vars_ulonglong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ulonglong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_get_vars_ulonglong(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_vars_ulonglong(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_ULONGLONG);
- if (inRange3(expect[j],var_type[i],NCT_ULONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= ulonglong_min
- && expect[j] <= ulonglong_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_vars_ulonglong(ncid, i, NULL, NULL, NULL, value);
- else
- err = nc_get_vars_ulonglong(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_ULONGLONG)
- && expect[j] >= ulonglong_min && expect[j] <= ulonglong_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_ULONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
-
-
-void
-test_nc_get_varm_text(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- text value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_text(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_text(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_TEXT);
- if (inRange3(expect[j],var_type[i],NCT_TEXT)) {
- allInIntRange = allInIntRange && expect[j] >= text_min
- && expect[j] <= text_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_text(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_text(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_TEXT)
- && expect[j] >= text_min
- && expect[j] <= text_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_TEXT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_uchar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uchar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_uchar(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_uchar(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_UCHAR);
- if (inRange3(expect[j],var_type[i],NCT_UCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= uchar_min
- && expect[j] <= uchar_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_uchar(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_uchar(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UCHAR)
- && expect[j] >= uchar_min
- && expect[j] <= uchar_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_UCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_schar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- schar value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_schar(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_schar(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_SCHAR);
- if (inRange3(expect[j],var_type[i],NCT_SCHAR)) {
- allInIntRange = allInIntRange && expect[j] >= schar_min
- && expect[j] <= schar_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_schar(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_schar(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SCHAR)
- && expect[j] >= schar_min
- && expect[j] <= schar_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_SCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_short(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- short value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_short(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_short(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_SHORT);
- if (inRange3(expect[j],var_type[i],NCT_SHORT)) {
- allInIntRange = allInIntRange && expect[j] >= short_min
- && expect[j] <= short_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_short(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_short(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_SHORT)
- && expect[j] >= short_min
- && expect[j] <= short_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_SHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_int(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_int(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_int(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_INT);
- if (inRange3(expect[j],var_type[i],NCT_INT)) {
- allInIntRange = allInIntRange && expect[j] >= int_min
- && expect[j] <= int_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_int(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_int(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_INT)
- && expect[j] >= int_min
- && expect[j] <= int_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_INT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_long(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- long value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_long(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_long(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_LONG);
- if (inRange3(expect[j],var_type[i],NCT_LONG)) {
- allInIntRange = allInIntRange && expect[j] >= long_min
- && expect[j] <= long_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_long(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_long(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONG)
- && expect[j] >= long_min
- && expect[j] <= long_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_LONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_float(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- float value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_float(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_float(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_FLOAT);
- if (inRange3(expect[j],var_type[i],NCT_FLOAT)) {
- allInIntRange = allInIntRange && expect[j] >= float_min
- && expect[j] <= float_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_float(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_float(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_FLOAT)
- && expect[j] >= float_min
- && expect[j] <= float_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_FLOAT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_double(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- double value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_double(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_double(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_DOUBLE);
- if (inRange3(expect[j],var_type[i],NCT_DOUBLE)) {
- allInIntRange = allInIntRange && expect[j] >= double_min
- && expect[j] <= double_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_double(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_double(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_DOUBLE)
- && expect[j] >= double_min
- && expect[j] <= double_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_DOUBLE)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_ushort(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ushort value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_ushort(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_ushort(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_USHORT);
- if (inRange3(expect[j],var_type[i],NCT_USHORT)) {
- allInIntRange = allInIntRange && expect[j] >= ushort_min
- && expect[j] <= ushort_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_ushort(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_ushort(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_USHORT)
- && expect[j] >= ushort_min
- && expect[j] <= ushort_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_USHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_uint(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uint value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_uint(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_uint(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_UINT);
- if (inRange3(expect[j],var_type[i],NCT_UINT)) {
- allInIntRange = allInIntRange && expect[j] >= uint_min
- && expect[j] <= uint_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_uint(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_uint(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_UINT)
- && expect[j] >= uint_min
- && expect[j] <= uint_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_UINT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_longlong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- longlong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_longlong(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_longlong(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_LONGLONG);
- if (inRange3(expect[j],var_type[i],NCT_LONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= longlong_min
- && expect[j] <= longlong_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_longlong(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_longlong(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_LONGLONG)
- && expect[j] >= longlong_min
- && expect[j] <= longlong_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_LONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_varm_ulonglong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int allInExtRange; /* all values within external range? */
- int allInIntRange; /* all values within internal range? */
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- int nok = 0; /* count of valid comparisons */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ulonglong value[MAX_NELS];
- double expect[MAX_NELS];
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_get_varm_ulonglong(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_varm_ulonglong(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = var_shape[i][j];
- err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
- if(!canConvert) {
- IF (err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* get 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to get lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
- */
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- allInExtRange = allInIntRange = 1;
- for (j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- expect[j] = hash4(var_type[i], var_rank[i], index2,
- NCT_ULONGLONG);
- if (inRange3(expect[j],var_type[i],NCT_ULONGLONG)) {
- allInIntRange = allInIntRange && expect[j] >= ulonglong_min
- && expect[j] <= ulonglong_max;
- } else {
- allInExtRange = 0;
- }
- }
- if (var_rank[i] == 0 && i%2 )
- err = nc_get_varm_ulonglong(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_get_varm_ulonglong(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (j = 0; j < nels; j++) {
- if (inRange3(expect[j],var_type[i],NCT_ULONGLONG)
- && expect[j] >= ulonglong_min
- && expect[j] <= ulonglong_max) {
- IF (!equal(value[j],expect[j],var_type[i], NCT_ULONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("element number: %d ", j);
- error("expect: %g, ", expect[j]);
- error("got: %g", (double) value[j]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
-
-
-void
-test_nc_get_att_text(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- text value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- err = nc_get_att_text(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_text(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_text(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_TEXT);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_TEXT)) {
- allInIntRange = allInIntRange && expect[k] >= text_min
- && expect[k] <= text_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_text(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_TEXT)
- && expect[k] >= text_min && expect[k] <= text_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_TEXT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_uchar(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- uchar value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- err = nc_get_att_uchar(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_uchar(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_uchar(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_UCHAR);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UCHAR)) {
- allInIntRange = allInIntRange && expect[k] >= uchar_min
- && expect[k] <= uchar_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_uchar(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UCHAR)
- && expect[k] >= uchar_min && expect[k] <= uchar_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_UCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_schar(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- schar value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- err = nc_get_att_schar(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_schar(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_schar(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_SCHAR);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SCHAR)) {
- allInIntRange = allInIntRange && expect[k] >= schar_min
- && expect[k] <= schar_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_schar(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SCHAR)
- && expect[k] >= schar_min && expect[k] <= schar_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_SCHAR)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_short(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- short value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- err = nc_get_att_short(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_short(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_short(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_SHORT);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SHORT)) {
- allInIntRange = allInIntRange && expect[k] >= short_min
- && expect[k] <= short_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_short(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SHORT)
- && expect[k] >= short_min && expect[k] <= short_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_SHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_int(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- int value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_INT == NCT_TEXT);
- err = nc_get_att_int(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_int(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_int(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_INT);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_INT)) {
- allInIntRange = allInIntRange && expect[k] >= int_min
- && expect[k] <= int_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_int(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_INT)
- && expect[k] >= int_min && expect[k] <= int_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_INT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_long(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- long value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- err = nc_get_att_long(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_long(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_long(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_LONG);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONG)) {
- allInIntRange = allInIntRange && expect[k] >= long_min
- && expect[k] <= long_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_long(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONG)
- && expect[k] >= long_min && expect[k] <= long_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_LONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_float(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- float value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- err = nc_get_att_float(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_float(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_float(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_FLOAT);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_FLOAT)) {
- allInIntRange = allInIntRange && expect[k] >= float_min
- && expect[k] <= float_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_float(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_FLOAT)
- && expect[k] >= float_min && expect[k] <= float_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_FLOAT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_double(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- double value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- err = nc_get_att_double(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_double(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_double(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_DOUBLE);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_DOUBLE)) {
- allInIntRange = allInIntRange && expect[k] >= double_min
- && expect[k] <= double_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_double(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_DOUBLE)
- && expect[k] >= double_min && expect[k] <= double_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_DOUBLE)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_ushort(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- ushort value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- err = nc_get_att_ushort(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_ushort(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_ushort(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_USHORT);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_USHORT)) {
- allInIntRange = allInIntRange && expect[k] >= ushort_min
- && expect[k] <= ushort_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_ushort(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_USHORT)
- && expect[k] >= ushort_min && expect[k] <= ushort_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_USHORT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_uint(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- uint value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- err = nc_get_att_uint(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_uint(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_uint(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_UINT);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UINT)) {
- allInIntRange = allInIntRange && expect[k] >= uint_min
- && expect[k] <= uint_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_uint(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UINT)
- && expect[k] >= uint_min && expect[k] <= uint_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_UINT)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_longlong(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- longlong value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- err = nc_get_att_longlong(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_longlong(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_longlong(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_LONGLONG);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONGLONG)) {
- allInIntRange = allInIntRange && expect[k] >= longlong_min
- && expect[k] <= longlong_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_longlong(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONGLONG)
- && expect[k] >= longlong_min && expect[k] <= longlong_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_LONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-void
-test_nc_get_att_ulonglong(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int allInExtRange;
- int allInIntRange;
- int canConvert; /* Both text or both numeric */
- ulonglong value[MAX_NELS];
- double expect[MAX_NELS];
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(testfile, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- err = nc_get_att_ulonglong(BAD_ID, i, ATT_NAME(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_get_att_ulonglong(ncid, BAD_VARID, ATT_NAME(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_get_att_ulonglong(ncid, i, "noSuch", value);
- IF (err != NC_ENOTATT)
- error("Bad attribute name: status = %d", err);
- allInExtRange = allInIntRange = 1;
- for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_ULONGLONG);
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_ULONGLONG)) {
- allInIntRange = allInIntRange && expect[k] >= ulonglong_min
- && expect[k] <= ulonglong_max;
- } else {
- allInExtRange = 0;
- }
- }
- err = nc_get_att_ulonglong(ncid, i, ATT_NAME(i,j), value);
- if (canConvert || ATT_LEN(i,j) == 0) {
- if (allInExtRange) {
- if (allInIntRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("Range error: status = %d", err);
- }
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < ATT_LEN(i,j); k++) {
- if (inRange3(expect[k],ATT_TYPE(i,j),NCT_ULONGLONG)
- && expect[k] >= ulonglong_min && expect[k] <= ulonglong_max) {
- IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_ULONGLONG)){
- error("value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
diff --git a/nc_test/test_put.c b/nc_test/test_put.c
deleted file mode 100644
index f08a063..0000000
--- a/nc_test/test_put.c
+++ /dev/null
@@ -1,11942 +0,0 @@
-/* Do not edit this file. It is produced from the corresponding .m4 source */
-/*********************************************************************
- * Copyright 1996, UCAR/Unidata
- * See netcdf/COPYRIGHT file for copying and redistribution conditions.
- * $Id: test_put.m4 2785 2014-10-26 05:21:20Z wkliao $
- *********************************************************************/
-
-#ifdef USE_PARALLEL
-#include <mpi.h>
-#endif
-
-
-#include "tests.h"
-
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_text(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = text_min;
- const double max = text_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_uchar(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = uchar_min;
- const double max = uchar_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_schar(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = schar_min;
- const double max = schar_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_short(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = short_min;
- const double max = short_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_int(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = int_min;
- const double max = int_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_long(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = long_min;
- const double max = long_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_float(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = float_min;
- const double max = float_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_double(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = double_min;
- const double max = double_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_ushort(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = ushort_min;
- const double max = ushort_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_uint(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = uint_min;
- const double max = uint_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_longlong(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = longlong_min;
- const double max = longlong_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-/*
- * ensure hash value within range for internal TYPE
- */
-static
-double
-hash_ulonglong(
- const nc_type type,
- const int rank,
- const size_t *index,
- const nct_itype itype)
-{
- const double min = ulonglong_min;
- const double max = ulonglong_max;
-
- return MAX(min, MIN(max, hash4( type, rank, index, itype)));
-}
-
-
-
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_text(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- text value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_TEXT);
- err = nc_get_var1_text(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_TEXT)) {
- if (expect >= text_min && expect <= text_max) {
- IF (err) {
- error("nc_get_var1_text: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_TEXT)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_uchar(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- uchar value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_UCHAR);
- err = nc_get_var1_uchar(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_UCHAR)) {
- if (expect >= uchar_min && expect <= uchar_max) {
- IF (err) {
- error("nc_get_var1_uchar: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_UCHAR)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_schar(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- schar value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_SCHAR);
- err = nc_get_var1_schar(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_SCHAR)) {
- if (expect >= schar_min && expect <= schar_max) {
- IF (err) {
- error("nc_get_var1_schar: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_SCHAR)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_short(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- short value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_SHORT);
- err = nc_get_var1_short(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_SHORT)) {
- if (expect >= short_min && expect <= short_max) {
- IF (err) {
- error("nc_get_var1_short: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_SHORT)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_int(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- int value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_INT);
- err = nc_get_var1_int(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_INT)) {
- if (expect >= int_min && expect <= int_max) {
- IF (err) {
- error("nc_get_var1_int: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_INT)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_long(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- long value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_LONG);
- err = nc_get_var1_long(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_LONG)) {
- if (expect >= long_min && expect <= long_max) {
- IF (err) {
- error("nc_get_var1_long: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_LONG)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_float(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- float value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_FLOAT);
- err = nc_get_var1_float(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_FLOAT)) {
- if (expect >= float_min && expect <= float_max) {
- IF (err) {
- error("nc_get_var1_float: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_FLOAT)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_double(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- double value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_DOUBLE);
- err = nc_get_var1_double(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_DOUBLE)) {
- if (expect >= double_min && expect <= double_max) {
- IF (err) {
- error("nc_get_var1_double: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_DOUBLE)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_ushort(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- ushort value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_USHORT);
- err = nc_get_var1_ushort(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_USHORT)) {
- if (expect >= ushort_min && expect <= ushort_max) {
- IF (err) {
- error("nc_get_var1_ushort: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_USHORT)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_uint(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- uint value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_UINT);
- err = nc_get_var1_uint(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_UINT)) {
- if (expect >= uint_min && expect <= uint_max) {
- IF (err) {
- error("nc_get_var1_uint: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_UINT)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_longlong(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- longlong value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_LONGLONG);
- err = nc_get_var1_longlong(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_LONGLONG)) {
- if (expect >= longlong_min && expect <= longlong_max) {
- IF (err) {
- error("nc_get_var1_longlong: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_LONGLONG)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-/*
- * check all vars in file which are (text/numeric) compatible with TYPE
- */
-static
-void
-check_vars_ulonglong(const char *filename)
-{
- int ncid; /* netCDF id */
- size_t index[MAX_RANK];
- int err; /* status */
- int d;
- int i;
- size_t j;
- ulonglong value;
- nc_type datatype;
- int ndims;
- int dimids[MAX_RANK];
- double expect;
- char name[NC_MAX_NAME];
- size_t length;
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- err = file_open(filename, NC_NOWRITE, &ncid);
- IF (err)
- error("nc_open: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
- IF (err)
- error("nc_inq_var: %s", nc_strerror(err));
- IF (strcmp(name, var_name[i]) != 0)
- error("Unexpected var_name");
- IF (datatype != var_type[i])
- error("Unexpected type");
- IF (ndims != var_rank[i])
- error("Unexpected rank");
- for (j = 0; j < ndims; j++) {
- err = nc_inq_dim(ncid, dimids[j], 0, &length);
- IF (err)
- error("nc_inq_dim: %s", nc_strerror(err));
- IF (length != var_shape[i][j])
- error("Unexpected shape");
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 2");
- expect = hash4( var_type[i], var_rank[i], index, NCT_ULONGLONG);
- err = nc_get_var1_ulonglong(ncid, i, index, &value);
- if (inRange3(expect,datatype,NCT_ULONGLONG)) {
- if (expect >= ulonglong_min && expect <= ulonglong_max) {
- IF (err) {
- error("nc_get_var1_ulonglong: %s", nc_strerror(err));
- } else {
- IF (!equal(value,expect,var_type[i],NCT_ULONGLONG)) {
- error("Var value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("var_name: %s, ", var_name[i]);
- error("index:");
- for (d = 0; d < var_rank[i]; d++)
- error(" %d", index[d]);
- error(", expect: %g, ", expect);
- error("got: %g", (double) value);
- }
- } else {
- ++nok;
- }
- }
- }
- }
- }
- }
- }
- err = nc_close (ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
- print_nok(nok);
-}
-
-
-
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_text(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- text value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_TEXT);
- if (inRange3(expect[k], datatype, NCT_TEXT)) {
- ++nInExtRange;
- if (expect[k] >= text_min && expect[k] <= text_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_text(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_TEXT)
- && expect[k] >= text_min && expect[k] <= text_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_TEXT)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_uchar(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- uchar value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_UCHAR);
- if (inRange3(expect[k], datatype, NCT_UCHAR)) {
- ++nInExtRange;
- if (expect[k] >= uchar_min && expect[k] <= uchar_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_uchar(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_UCHAR)
- && expect[k] >= uchar_min && expect[k] <= uchar_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_UCHAR)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_schar(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- schar value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_SCHAR);
- if (inRange3(expect[k], datatype, NCT_SCHAR)) {
- ++nInExtRange;
- if (expect[k] >= schar_min && expect[k] <= schar_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_schar(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_SCHAR)
- && expect[k] >= schar_min && expect[k] <= schar_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_SCHAR)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_short(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- short value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_SHORT);
- if (inRange3(expect[k], datatype, NCT_SHORT)) {
- ++nInExtRange;
- if (expect[k] >= short_min && expect[k] <= short_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_short(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_SHORT)
- && expect[k] >= short_min && expect[k] <= short_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_SHORT)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_int(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- int value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_INT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_INT);
- if (inRange3(expect[k], datatype, NCT_INT)) {
- ++nInExtRange;
- if (expect[k] >= int_min && expect[k] <= int_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_int(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_INT)
- && expect[k] >= int_min && expect[k] <= int_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_INT)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_long(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- long value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_LONG);
- if (inRange3(expect[k], datatype, NCT_LONG)) {
- ++nInExtRange;
- if (expect[k] >= long_min && expect[k] <= long_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_long(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_LONG)
- && expect[k] >= long_min && expect[k] <= long_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_LONG)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_float(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- float value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_FLOAT);
- if (inRange3(expect[k], datatype, NCT_FLOAT)) {
- ++nInExtRange;
- if (expect[k] >= float_min && expect[k] <= float_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_float(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_FLOAT)
- && expect[k] >= float_min && expect[k] <= float_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_FLOAT)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_double(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- double value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_DOUBLE);
- if (inRange3(expect[k], datatype, NCT_DOUBLE)) {
- ++nInExtRange;
- if (expect[k] >= double_min && expect[k] <= double_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_double(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_DOUBLE)
- && expect[k] >= double_min && expect[k] <= double_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_DOUBLE)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_ushort(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- ushort value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_USHORT);
- if (inRange3(expect[k], datatype, NCT_USHORT)) {
- ++nInExtRange;
- if (expect[k] >= ushort_min && expect[k] <= ushort_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_ushort(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_USHORT)
- && expect[k] >= ushort_min && expect[k] <= ushort_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_USHORT)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_uint(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- uint value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_UINT);
- if (inRange3(expect[k], datatype, NCT_UINT)) {
- ++nInExtRange;
- if (expect[k] >= uint_min && expect[k] <= uint_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_uint(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_UINT)
- && expect[k] >= uint_min && expect[k] <= uint_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_UINT)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_longlong(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- longlong value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_LONGLONG);
- if (inRange3(expect[k], datatype, NCT_LONGLONG)) {
- ++nInExtRange;
- if (expect[k] >= longlong_min && expect[k] <= longlong_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_longlong(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_LONGLONG)
- && expect[k] >= longlong_min && expect[k] <= longlong_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_LONGLONG)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-/*
- * check all attributes in file which are (text/numeric) compatible with TYPE
- * ignore any attributes containing values outside range of TYPE
- */
-static
-void
-check_atts_ulonglong(int ncid)
-{
- int err; /* status */
- int i;
- int j;
- size_t k;
- ulonglong value[MAX_NELS];
- nc_type datatype;
- double expect[MAX_NELS];
- size_t length;
- size_t nInExtRange; /* number values within external range */
- size_t nInIntRange; /* number values within internal range */
- int canConvert; /* Both text or both numeric */
- int nok = 0; /* count of valid comparisons */
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- if (canConvert) {
- err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
- IF (err)
- error("nc_inq_att: %s", nc_strerror(err));
- IF (datatype != ATT_TYPE(i,j))
- error("nc_inq_att: unexpected type");
- IF (length != ATT_LEN(i,j))
- error("nc_inq_att: unexpected length");
- assert(length <= MAX_NELS);
- nInIntRange = nInExtRange = 0;
- for (k = 0; k < length; k++) {
- expect[k] = hash4( datatype, -1, &k, NCT_ULONGLONG);
- if (inRange3(expect[k], datatype, NCT_ULONGLONG)) {
- ++nInExtRange;
- if (expect[k] >= ulonglong_min && expect[k] <= ulonglong_max)
- ++nInIntRange;
- }
- }
- err = nc_get_att_ulonglong(ncid, i, ATT_NAME(i,j), value);
- if (nInExtRange == length && nInIntRange == length) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != 0 && err != NC_ERANGE)
- error("OK or Range error: status = %d", err);
- }
- for (k = 0; k < length; k++) {
- if (inRange3(expect[k],datatype,NCT_ULONGLONG)
- && expect[k] >= ulonglong_min && expect[k] <= ulonglong_max) {
- IF (!equal(value[k],expect[k],datatype,NCT_ULONGLONG)) {
- error("att. value read not that expected");
- if (verbose) {
- error("\n");
- error("varid: %d, ", i);
- error("att_name: %s, ", ATT_NAME(i,j));
- error("element number: %d ", k);
- error("expect: %g, ", expect[k]);
- error("got: %g", (double) value[k]);
- }
- } else {
- nok++;
- }
- }
- }
- }
- }
- }
-
- print_nok(nok);
-}
-
-
-
-
-void
-test_nc_put_var1_text(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- text value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_text(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_text(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_text(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_text( var_type[i], var_rank[i], index, NCT_TEXT);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_text(ncid, i, NULL, &value);
- else
- err = nc_put_var1_text(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_TEXT)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_text(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_uchar(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uchar value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_uchar(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_uchar(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_uchar(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_uchar( var_type[i], var_rank[i], index, NCT_UCHAR);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_uchar(ncid, i, NULL, &value);
- else
- err = nc_put_var1_uchar(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_UCHAR)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uchar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_schar(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- schar value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_schar(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_schar(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_schar(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_schar( var_type[i], var_rank[i], index, NCT_SCHAR);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_schar(ncid, i, NULL, &value);
- else
- err = nc_put_var1_schar(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_SCHAR)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_schar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_short(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- short value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_short(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_short(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_short(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_short( var_type[i], var_rank[i], index, NCT_SHORT);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_short(ncid, i, NULL, &value);
- else
- err = nc_put_var1_short(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_SHORT)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_short(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_int(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_int(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_int(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_int(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_int( var_type[i], var_rank[i], index, NCT_INT);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_int(ncid, i, NULL, &value);
- else
- err = nc_put_var1_int(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_INT)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_int(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_long(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- long value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_long(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_long(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_long(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_long( var_type[i], var_rank[i], index, NCT_LONG);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_long(ncid, i, NULL, &value);
- else
- err = nc_put_var1_long(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_LONG)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_long(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_float(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- float value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_float(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_float(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_float(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_float( var_type[i], var_rank[i], index, NCT_FLOAT);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_float(ncid, i, NULL, &value);
- else
- err = nc_put_var1_float(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_FLOAT)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_float(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_double(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- double value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_double(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_double(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_double(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_double( var_type[i], var_rank[i], index, NCT_DOUBLE);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_double(ncid, i, NULL, &value);
- else
- err = nc_put_var1_double(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_DOUBLE)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_double(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_ushort(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ushort value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_ushort(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_ushort(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_ushort(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_ushort( var_type[i], var_rank[i], index, NCT_USHORT);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_ushort(ncid, i, NULL, &value);
- else
- err = nc_put_var1_ushort(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_USHORT)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ushort(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_uint(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- uint value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_uint(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_uint(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_uint(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_uint( var_type[i], var_rank[i], index, NCT_UINT);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_uint(ncid, i, NULL, &value);
- else
- err = nc_put_var1_uint(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_UINT)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uint(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_longlong(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- longlong value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_longlong(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_longlong(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_longlong(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_longlong( var_type[i], var_rank[i], index, NCT_LONGLONG);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_longlong(ncid, i, NULL, &value);
- else
- err = nc_put_var1_longlong(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_LONGLONG)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_longlong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var1_ulonglong(void)
-{
- int ncid;
- int i;
- int j;
- int err;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- ulonglong value = 5; /* any value would do - only for error cases */
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- for (j = 0; j < var_rank[i]; j++)
- index[j] = 0;
- err = nc_put_var1_ulonglong(BAD_ID, i, index, &value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var1_ulonglong(ncid, BAD_VARID, index, &value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- index[j] = var_shape[i][j];
- err = nc_put_var1_ulonglong(ncid, i, index, &value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad index: status = %d", err);
- index[j] = 0;
- }
- }
- for (j = 0; j < var_nels[i]; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value = hash_ulonglong( var_type[i], var_rank[i], index, NCT_ULONGLONG);
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_var1_ulonglong(ncid, i, NULL, &value);
- else
- err = nc_put_var1_ulonglong(ncid, i, index, &value);
- if (canConvert) {
- if (inRange3(value, var_type[i],NCT_ULONGLONG)) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE) {
- error("Range error: status = %d", err);
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value, (long)value);
- }
- }
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ulonglong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
-
-
-void
-test_nc_put_var_text(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- text value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_text(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_text(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_TEXT);
- }
- err = nc_put_var_text(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_text(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_TEXT);
- }
- err = nc_put_var_text(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_text(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_uchar(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uchar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_uchar(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_uchar(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UCHAR);
- }
- err = nc_put_var_uchar(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_uchar(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UCHAR);
- }
- err = nc_put_var_uchar(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uchar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_schar(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- schar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_schar(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_schar(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SCHAR);
- }
- err = nc_put_var_schar(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_schar(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SCHAR);
- }
- err = nc_put_var_schar(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_schar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_short(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- short value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_short(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_short(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SHORT);
- }
- err = nc_put_var_short(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_short(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SHORT);
- }
- err = nc_put_var_short(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_short(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_int(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- int value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_int(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_int(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_INT);
- }
- err = nc_put_var_int(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_int(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_INT);
- }
- err = nc_put_var_int(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_int(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_long(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- long value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_long(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_long(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONG);
- }
- err = nc_put_var_long(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_long(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONG);
- }
- err = nc_put_var_long(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_long(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_float(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- float value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_float(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_float(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_FLOAT);
- }
- err = nc_put_var_float(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_float(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_FLOAT);
- }
- err = nc_put_var_float(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_float(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_double(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- double value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_double(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_double(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_DOUBLE);
- }
- err = nc_put_var_double(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_double(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_DOUBLE);
- }
- err = nc_put_var_double(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_double(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_ushort(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ushort value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_ushort(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_ushort(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_ushort(var_type[i], var_rank[i], index, NCT_USHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_USHORT);
- }
- err = nc_put_var_ushort(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_ushort(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_ushort(var_type[i], var_rank[i], index, NCT_USHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_USHORT);
- }
- err = nc_put_var_ushort(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ushort(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_uint(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uint value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_uint(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_uint(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_uint(var_type[i], var_rank[i], index, NCT_UINT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UINT);
- }
- err = nc_put_var_uint(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_uint(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_uint(var_type[i], var_rank[i], index, NCT_UINT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UINT);
- }
- err = nc_put_var_uint(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uint(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_longlong(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- longlong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_longlong(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_longlong(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_longlong(var_type[i], var_rank[i], index, NCT_LONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONGLONG);
- }
- err = nc_put_var_longlong(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_longlong(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_longlong(var_type[i], var_rank[i], index, NCT_LONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONGLONG);
- }
- err = nc_put_var_longlong(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_longlong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_var_ulonglong(void)
-{
- int ncid;
- int varid;
- int i;
- int j;
- int err;
- int nels;
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ulonglong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_ulonglong(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_var_ulonglong(ncid, BAD_VARID, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
-
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_ulonglong(var_type[i], var_rank[i], index, NCT_ULONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_ULONGLONG);
- }
- err = nc_put_var_ulonglong(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM)
- error("range error: status = %d", err);
- }
- } else { /* should flag wrong type even if nothing to write */
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
-
- /* Preceding has written nothing for record variables, now try */
- /* again with more than 0 records */
-
- /* Write record number NRECS to force writing of preceding records */
- /* Assumes variable cr is char vector with UNLIMITED dimension */
- err = nc_inq_varid(ncid, "cr", &varid);
- IF (err)
- error("nc_inq_varid: %s", nc_strerror(err));
- index[0] = NRECS-1;
- err = nc_put_var1_text(ncid, varid, index, "x");
- IF (err)
- error("nc_put_var1_text: %s", nc_strerror(err));
-
- for (i = 0; i < numVars; i++) {
- if (var_dimid[i][0] == RECDIM) { /* only test record variables here */
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- err = nc_put_var_ulonglong(BAD_ID, i, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- nels *= var_shape[i][j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], var_shape[i], index);
- IF (err)
- error("error in toMixedBase 1");
- value[j]= hash_ulonglong(var_type[i], var_rank[i], index, NCT_ULONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_ULONGLONG);
- }
- err = nc_put_var_ulonglong(ncid, i, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ulonglong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
-
-
-void
-test_nc_put_vara_text(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- text value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_text(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_text(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_text(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_text(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_text(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_text(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_text(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_text(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_TEXT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_text(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_text(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_text(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_uchar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uchar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_uchar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_uchar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_uchar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_uchar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_uchar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_uchar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_uchar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_uchar(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UCHAR);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_uchar(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_uchar(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uchar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_schar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- schar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_schar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_schar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_schar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_schar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_schar(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_schar(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_schar(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_schar(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SCHAR);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_schar(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_schar(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_schar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_short(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- short value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_short(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_short(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_short(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_short(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_short(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_short(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_short(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_short(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SHORT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_short(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_short(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_short(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_int(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- int value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_int(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_int(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_int(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_int(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_int(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_int(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_int(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_int(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_INT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_int(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_int(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_int(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_long(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- long value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_long(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_long(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_long(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_long(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_long(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_long(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_long(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_long(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_long(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_long(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_long(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_float(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- float value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_float(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_float(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_float(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_float(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_float(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_float(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_float(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_float(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_FLOAT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_float(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_float(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_float(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_double(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- double value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_double(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_double(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_double(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_double(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_double(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_double(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_double(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_double(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_DOUBLE);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_double(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_double(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_double(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_ushort(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ushort value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_ushort(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_ushort(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_ushort(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_ushort(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_ushort(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_ushort(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_ushort(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_ushort(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_ushort(var_type[i], var_rank[i], index, NCT_USHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_USHORT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_ushort(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_ushort(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ushort(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_uint(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uint value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_uint(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_uint(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_uint(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_uint(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_uint(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_uint(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_uint(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_uint(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_uint(var_type[i], var_rank[i], index, NCT_UINT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UINT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_uint(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_uint(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uint(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_longlong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- longlong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_longlong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_longlong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_longlong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_longlong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_longlong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_longlong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_longlong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_longlong(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_longlong(var_type[i], var_rank[i], index, NCT_LONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONGLONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_longlong(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_longlong(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_longlong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vara_ulonglong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int err;
- int nslabs;
- int nels;
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t index[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ulonglong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- value[0] = 0;
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- }
- err = nc_put_vara_ulonglong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_ulonglong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- }
- }
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_ulonglong(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_ulonglong(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
-
-/* wkliao: this test below of put_vara is redundant and incorrectly uses the
- value[] set from the previously iteration. There is no such test
- in put_vars and put_varm.
-
- err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
- if (canConvert) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
-*/
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 1;
- }
-
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- for (k = 0; k < nslabs; k++) {
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- nels *= edge[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], edge, index);
- IF (err)
- error("error in toMixedBase 1");
- for (d = 0; d < var_rank[i]; d++)
- index[d] += start[d];
- value[j]= hash_ulonglong(var_type[i], var_rank[i], index, NCT_ULONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_ULONGLONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vara_ulonglong(ncid, i, NULL, NULL, value);
- else
- err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ulonglong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
-
-
-void
-test_nc_put_vars_text(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- text value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_text(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_text(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_text(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_text(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_text(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_text(var_type[i], var_rank[i], index2,
- NCT_TEXT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_TEXT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_text(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_text(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_text(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_uchar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uchar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_uchar(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_uchar(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_uchar(var_type[i], var_rank[i], index2,
- NCT_UCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UCHAR);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_uchar(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_uchar(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uchar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_schar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- schar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_schar(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_schar(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_schar(var_type[i], var_rank[i], index2,
- NCT_SCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SCHAR);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_schar(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_schar(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_schar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_short(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- short value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_short(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_short(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_short(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_short(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_short(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_short(var_type[i], var_rank[i], index2,
- NCT_SHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SHORT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_short(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_short(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_short(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_int(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- int value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_int(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_int(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_int(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_int(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_int(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_int(var_type[i], var_rank[i], index2,
- NCT_INT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_INT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_int(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_int(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_int(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_long(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- long value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_long(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_long(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_long(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_long(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_long(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_long(var_type[i], var_rank[i], index2,
- NCT_LONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_long(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_long(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_long(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_float(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- float value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_float(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_float(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_float(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_float(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_float(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_float(var_type[i], var_rank[i], index2,
- NCT_FLOAT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_FLOAT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_float(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_float(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_float(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_double(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- double value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_double(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_double(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_double(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_double(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_double(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_double(var_type[i], var_rank[i], index2,
- NCT_DOUBLE);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_DOUBLE);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_double(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_double(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_double(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_ushort(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ushort value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_ushort(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_ushort(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_ushort(var_type[i], var_rank[i], index2,
- NCT_USHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_USHORT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_ushort(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_ushort(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ushort(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_uint(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uint value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_uint(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_uint(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_uint(var_type[i], var_rank[i], index2,
- NCT_UINT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UINT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_uint(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_uint(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uint(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_longlong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- longlong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_longlong(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_longlong(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_longlong(var_type[i], var_rank[i], index2,
- NCT_LONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONGLONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_longlong(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_longlong(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_longlong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_vars_ulonglong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ulonglong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- }
- err = nc_put_vars_ulonglong(BAD_ID, i, start, edge, stride, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vars_ulonglong(ncid, BAD_VARID, start, edge, stride, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
- if(!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF(err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_ulonglong(var_type[i], var_rank[i], index2,
- NCT_ULONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_ULONGLONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_vars_ulonglong(ncid, i, NULL, NULL, stride, value);
- else
- err = nc_put_vars_ulonglong(ncid, i, index, count, stride, value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ulonglong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
-
-
-void
-test_nc_put_varm_text(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- text value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_text(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_text(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_text(var_type[i], var_rank[i], index2,
- NCT_TEXT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_TEXT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_text(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_text(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_text(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_uchar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uchar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_uchar(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_uchar(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_uchar(var_type[i], var_rank[i], index2,
- NCT_UCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UCHAR);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_uchar(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_uchar(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uchar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_schar(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- schar value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_schar(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_schar(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_schar(var_type[i], var_rank[i], index2,
- NCT_SCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SCHAR);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_schar(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_schar(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_schar(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_short(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- short value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_short(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_short(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_short(var_type[i], var_rank[i], index2,
- NCT_SHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_SHORT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_short(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_short(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_short(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_int(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- int value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_int(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_int(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_int(var_type[i], var_rank[i], index2,
- NCT_INT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_INT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_int(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_int(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_int(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_long(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- long value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_long(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_long(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_long(var_type[i], var_rank[i], index2,
- NCT_LONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_long(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_long(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_long(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_float(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- float value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_float(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_float(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_float(var_type[i], var_rank[i], index2,
- NCT_FLOAT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_FLOAT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_float(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_float(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_float(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_double(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- double value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_double(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_double(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_double(var_type[i], var_rank[i], index2,
- NCT_DOUBLE);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_DOUBLE);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_double(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_double(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_double(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_ushort(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ushort value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_ushort(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_ushort(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_ushort(var_type[i], var_rank[i], index2,
- NCT_USHORT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_USHORT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_ushort(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_ushort(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ushort(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_uint(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- uint value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_uint(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_uint(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_uint(var_type[i], var_rank[i], index2,
- NCT_UINT);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_UINT);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_uint(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_uint(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_uint(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_longlong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- longlong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_longlong(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_longlong(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_longlong(var_type[i], var_rank[i], index2,
- NCT_LONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_LONGLONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_longlong(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_longlong(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_longlong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_varm_ulonglong(void)
-{
- int ncid;
- int d;
- int i;
- int j;
- int k;
- int m;
- int err;
- int nels;
- int nslabs;
- int nstarts; /* number of different starts */
- size_t start[MAX_RANK];
- size_t edge[MAX_RANK];
- size_t index[MAX_RANK];
- size_t index2[MAX_RANK];
- size_t mid[MAX_RANK];
- size_t count[MAX_RANK];
- size_t sstride[MAX_RANK];
- ptrdiff_t stride[MAX_RANK];
- ptrdiff_t imap[MAX_RANK];
- int canConvert; /* Both text or both numeric */
- int allInExtRange; /* all values within external range? */
- ulonglong value[MAX_NELS];
-
- err = file_create(scratch, NC_CLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
- err = nc_enddef(ncid);
- IF (err)
- error("nc_enddef: %s", nc_strerror(err));
-
-#ifdef USE_PNETCDF
- {
- int format;
- nc_inq_format_extended(ncid, &format, NULL);
- if (format == NC_FORMATX_PNETCDF) {
- for (i = 0; i < numVars; i++) {
- err = nc_var_par_access(ncid, i, NC_COLLECTIVE);
- IF (err)
- error("nc_var_par_access: %s", nc_strerror(err));
- }
- }
- }
-#endif
-
- for (i = 0; i < numVars; i++) {
- canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
- assert(var_rank[i] <= MAX_RANK);
- assert(var_nels[i] <= MAX_NELS);
- for (j = 0; j < var_rank[i]; j++) {
- start[j] = 0;
- edge[j] = 1;
- stride[j] = 1;
- imap[j] = 1;
- }
- err = nc_put_varm_ulonglong(BAD_ID, i, start, edge, stride, imap, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_varm_ulonglong(ncid, BAD_VARID, start, edge, stride, imap, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j] + 1;
- err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
- if (!canConvert) {
- IF(err != NC_ECHAR)
- error("conversion: status = %d", err);
- } else {
- IF (err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- edge[j] = var_shape[i][j] + 1;
- err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_EEDGE)
- error("bad edge: status = %d", err);
- edge[j] = 1;
- stride[j] = 0;
- err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
- IF (err != NC_ESTRIDE)
- error("bad stride: status = %d", err);
- stride[j] = 1;
- }
- }
- }
- /* Choose a random point dividing each dim into 2 parts */
- /* Put 2^rank (nslabs) slabs so defined */
- nslabs = 1;
- for (j = 0; j < var_rank[i]; j++) {
- mid[j] = roll( var_shape[i][j] );
- nslabs *= 2;
- }
- /* bits of k determine whether to put lower or upper part of dim */
- /* choose random stride from 1 to edge */
- for (k = 0; k < nslabs; k++) {
- nstarts = 1;
- for (j = 0; j < var_rank[i]; j++) {
- if ((k >> j) & 1) {
- start[j] = 0;
- edge[j] = mid[j];
- }else{
- start[j] = mid[j];
- edge[j] = var_shape[i][j] - mid[j];
- }
- sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
- nstarts *= stride[j];
- }
- for (m = 0; m < nstarts; m++) {
- err = toMixedBase(m, var_rank[i], sstride, index);
- IF (err)
- error("error in toMixedBase");
- nels = 1;
- for (j = 0; j < var_rank[i]; j++) {
- count[j] = 1 + (edge[j] - index[j] - 1) / stride[j];
- nels *= count[j];
- index[j] += start[j];
- }
- /* Random choice of forward or backward */
-/* TODO
- if ( roll(2) ) {
- for (j = 0; j < var_rank[i]; j++) {
- index[j] += (count[j] - 1) * stride[j];
- stride[j] = -stride[j];
- }
- }
-*/
- if (var_rank[i] > 0) {
- j = var_rank[i] - 1;
- imap[j] = 1;
- for (; j > 0; j--)
- imap[j-1] = imap[j] * count[j];
- }
- for (allInExtRange = 1, j = 0; j < nels; j++) {
- err = toMixedBase(j, var_rank[i], count, index2);
- IF (err)
- error("error in toMixedBase");
- for (d = 0; d < var_rank[i]; d++)
- index2[d] = index[d] + index2[d] * stride[d];
- value[j] = hash_ulonglong(var_type[i], var_rank[i], index2,
- NCT_ULONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[j], var_type[i], NCT_ULONGLONG);
- }
- if (var_rank[i] == 0 && i%2 == 0)
- err = nc_put_varm_ulonglong(ncid,i,NULL,NULL,NULL,NULL,value);
- else
- err = nc_put_varm_ulonglong(ncid,i,index,count,stride,imap,value);
- if (canConvert) {
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- } else {
- IF (nels > 0 && err != NC_ECHAR)
- error("wrong type: status = %d", err);
- }
- }
- }
- }
-
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- check_vars_ulonglong(scratch);
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
-
-void
-test_nc_put_att_text(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- text value[MAX_NELS];
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- {
- const char *const tval = "value for bad name";
- const size_t tval_len = strlen(tval);
-
- err = nc_put_att_text(ncid, 0, "", tval_len, tval);
- IF (err != NC_EBADNAME)
- error("should be NC_EBADNAME: status = %d", err);
- }
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (ATT_TYPE(i,j) == NC_CHAR) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_text(BAD_ID, i, ATT_NAME(i,j), ATT_LEN(i,j),
- value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_text(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash(ATT_TYPE(i,j), -1, &k);
- }
- err = nc_put_att_text(ncid, i, ATT_NAME(i,j),
- ATT_LEN(i,j), value);
- IF (err) {
- error("%s", nc_strerror(err));
- }
- }
- }
- }
-
- check_atts_text(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
-
-void
-test_nc_put_att_uchar(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- uchar value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_uchar(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_uchar(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_uchar(ATT_TYPE(i,j), -1, &k, NCT_UCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_UCHAR);
- }
- err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_uchar(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_schar(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- schar value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_schar(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_schar(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_schar(ATT_TYPE(i,j), -1, &k, NCT_SCHAR);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_SCHAR);
- }
- err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_schar(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_short(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- short value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_short(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_short(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_short(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_short(ATT_TYPE(i,j), -1, &k, NCT_SHORT);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_SHORT);
- }
- err = nc_put_att_short(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_short(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_int(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- int value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_int(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_int(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_int(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_int(ATT_TYPE(i,j), -1, &k, NCT_INT);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_INT);
- }
- err = nc_put_att_int(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_int(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_long(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- long value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_long(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_long(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_long(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_long(ATT_TYPE(i,j), -1, &k, NCT_LONG);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_LONG);
- }
- err = nc_put_att_long(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_long(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_float(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- float value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_float(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_float(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_float(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_float(ATT_TYPE(i,j), -1, &k, NCT_FLOAT);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_FLOAT);
- }
- err = nc_put_att_float(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_float(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_double(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- double value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_double(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_double(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_double(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_double(ATT_TYPE(i,j), -1, &k, NCT_DOUBLE);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_DOUBLE);
- }
- err = nc_put_att_double(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_double(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_ushort(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- ushort value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_ushort(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_ushort(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_ushort(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_ushort(ATT_TYPE(i,j), -1, &k, NCT_USHORT);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_USHORT);
- }
- err = nc_put_att_ushort(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_ushort(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_uint(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- uint value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_uint(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_uint(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_uint(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_uint(ATT_TYPE(i,j), -1, &k, NCT_UINT);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_UINT);
- }
- err = nc_put_att_uint(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_uint(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_longlong(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- longlong value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_longlong(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_longlong(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_longlong(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_longlong(ATT_TYPE(i,j), -1, &k, NCT_LONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_LONGLONG);
- }
- err = nc_put_att_longlong(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_longlong(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-void
-test_nc_put_att_ulonglong(void)
-{
- int ncid;
- int i;
- int j;
- size_t k;
- int err;
- ulonglong value[MAX_NELS];
- int allInExtRange; /* all values within external range? */
-
- err = file_create(scratch, NC_NOCLOBBER, &ncid);
- IF (err) {
- error("nc_create: %s", nc_strerror(err));
- return;
- }
- def_dims(ncid);
- def_vars(ncid);
-
- for (i = -1; i < numVars; i++) {
- for (j = 0; j < NATTS(i); j++) {
- if (!(ATT_TYPE(i,j) == NC_CHAR)) {
- assert(ATT_LEN(i,j) <= MAX_NELS);
- err = nc_put_att_ulonglong(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_att_ulonglong(ncid, BAD_VARID, ATT_NAME(i,j),
- ATT_TYPE(i,j), ATT_LEN(i,j), value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- err = nc_put_att_ulonglong(ncid, i, ATT_NAME(i,j), BAD_TYPE,
- ATT_LEN(i,j), value);
- IF (err != NC_EBADTYPE)
- error("bad type: status = %d", err);
- for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_ulonglong(ATT_TYPE(i,j), -1, &k, NCT_ULONGLONG);
- allInExtRange = allInExtRange
- && inRange3(value[k], ATT_TYPE(i,j), NCT_ULONGLONG);
- }
- err = nc_put_att_ulonglong(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j),
- ATT_LEN(i,j), value);
- if (allInExtRange) {
- IF (err)
- error("%s", nc_strerror(err));
- } else {
- IF (err != NC_ERANGE)
- error("range error: status = %d", err);
- }
- }
- }
- }
-
- check_atts_ulonglong(ncid);
- err = nc_close(ncid);
- IF (err)
- error("nc_close: %s", nc_strerror(err));
-
- err = remove(scratch);
- IF (err)
- error("remove of %s failed", scratch);
-}
-
-
diff --git a/nc_test/tst_inq_type.c b/nc_test/tst_inq_type.c
new file mode 100644
index 0000000..08542b1
--- /dev/null
+++ b/nc_test/tst_inq_type.c
@@ -0,0 +1,164 @@
+/* This is part of the netCDF package. Copyright 2016 University
+ Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
+ conditions of use. See www.unidata.ucar.edu for more info.
+
+ Test nc_inq_type
+
+ Added in support of https://github.com/Unidata/netcdf/issues/240
+
+*/
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include <nc_tests.h>
+#include <netcdf.h>
+
+#ifdef USE_PNETCDF
+#include <netcdf_par.h>
+#endif
+
+#define FILE_NAME "tst_inq_type.nc"
+
+void
+check_err(const int stat, const int line, const char *file) {
+ if (stat != NC_NOERR) {
+ (void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
+ fflush(stderr);
+ exit(1);
+ }
+}
+
+
+int test_type_should_fail(int ncid, int type, char* tstring) {
+
+ printf("\t* Testing Type (Should Fail) %s:\t",tstring);
+ if(!nc_inq_type(ncid,type,NULL,NULL)) ERR;
+ else printf("expected failure.\n");
+
+ return 0;
+}
+
+int test_type(int ncid, int type, char* tstring) {
+
+ printf("\t* Testing Type %s:\t",tstring);
+ if(nc_inq_type(ncid,type,NULL,NULL)) ERR;
+ else printf("success.\n");
+
+ return 0;
+}
+
+
+
+int main(int argc, char **argv) {
+
+ int ncid=0;
+
+ {
+ printf("\n* Testing nc_inq_type with netcdf-3\n");
+
+ if(nc_create(FILE_NAME,NC_CLOBBER,&ncid)) ERR;
+
+ test_type(ncid, NC_BYTE,"NC_BYTE");
+ test_type(ncid, NC_CHAR,"NC_CHAR");
+ test_type(ncid, NC_SHORT,"NC_SHORT");
+ test_type(ncid, NC_INT,"NC_INT");
+ test_type(ncid, NC_LONG,"NC_LONG");
+ test_type(ncid, NC_FLOAT,"NC_FLOAT");
+ test_type(ncid, NC_DOUBLE,"NC_DOUBLE");
+
+ /* Not Valid for Classic */
+ /* Valid now, see https://github.com/Unidata/netcdf-c/issues/240 for more
+ information. The types are not valid for use in Classic,
+ but nc_inq_type should return valid info. */
+ test_type(ncid, NC_UBYTE,"NC_UBYTE");
+ test_type(ncid, NC_USHORT,"NC_USHORT");
+ test_type(ncid, NC_UINT,"NC_UINT");
+ test_type(ncid, NC_INT64,"NC_INT64");
+ test_type(ncid, NC_UINT64,"NC_UINT64");
+ test_type(ncid, NC_STRING,"NC_STRING");
+
+ /* Invoke a true negative */
+ test_type_should_fail(ncid, 9999, "NC_GARBAGE");
+ test_type_should_fail(ncid, -1, "NC_GARBAGE_NEGATIVE");
+
+
+ if(nc_close(ncid)) ERR;
+ }
+
+ {
+ printf("\n* Testing nc_inq_type with CDF5\n");
+
+ if(nc_create(FILE_NAME,NC_CLOBBER|NC_CDF5,&ncid)) ERR;
+
+ test_type(ncid, NC_BYTE,"NC_BYTE");
+ test_type(ncid, NC_CHAR,"NC_CHAR");
+ test_type(ncid, NC_SHORT,"NC_SHORT");
+ test_type(ncid, NC_INT,"NC_INT");
+ test_type(ncid, NC_LONG,"NC_LONG");
+ test_type(ncid, NC_FLOAT,"NC_FLOAT");
+ test_type(ncid, NC_DOUBLE,"NC_DOUBLE");
+ test_type(ncid, NC_UBYTE,"NC_UBYTE");
+ test_type(ncid, NC_USHORT,"NC_USHORT");
+ test_type(ncid, NC_UINT,"NC_UINT");
+ test_type(ncid, NC_INT64,"NC_INT64");
+ test_type(ncid, NC_UINT64,"NC_UINT64");
+ test_type(ncid, NC_STRING,"NC_STRING");
+
+ if(nc_close(ncid)) ERR;
+ }
+
+#ifdef USE_NETCDF4
+
+ {
+ printf("\n* Testing nc_inq_type with netcdf-4 + Classic Model\n");
+
+ if(nc_create(FILE_NAME,NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL,&ncid)) ERR;
+
+ test_type(ncid, NC_BYTE,"NC_BYTE");
+ test_type(ncid, NC_CHAR,"NC_CHAR");
+ test_type(ncid, NC_SHORT,"NC_SHORT");
+ test_type(ncid, NC_INT,"NC_INT");
+ test_type(ncid, NC_LONG,"NC_LONG");
+ test_type(ncid, NC_FLOAT,"NC_FLOAT");
+ test_type(ncid, NC_DOUBLE,"NC_DOUBLE");
+ test_type(ncid, NC_UBYTE,"NC_UBYTE");
+ test_type(ncid, NC_USHORT,"NC_USHORT");
+ test_type(ncid, NC_UINT,"NC_UINT");
+ test_type(ncid, NC_INT64,"NC_INT64");
+ test_type(ncid, NC_UINT64,"NC_UINT64");
+ test_type(ncid, NC_STRING,"NC_STRING");
+
+
+ if(nc_close(ncid)) ERR;
+ }
+
+ {
+ printf("\n* Testing nc_inq_type with netcdf-4\n");
+
+ if(nc_create(FILE_NAME,NC_CLOBBER|NC_NETCDF4,&ncid)) ERR;
+
+ test_type(ncid, NC_BYTE,"NC_BYTE");
+ test_type(ncid, NC_CHAR,"NC_CHAR");
+ test_type(ncid, NC_SHORT,"NC_SHORT");
+ test_type(ncid, NC_INT,"NC_INT");
+ test_type(ncid, NC_LONG,"NC_LONG");
+ test_type(ncid, NC_FLOAT,"NC_FLOAT");
+ test_type(ncid, NC_DOUBLE,"NC_DOUBLE");
+ test_type(ncid, NC_UBYTE,"NC_UBYTE");
+ test_type(ncid, NC_USHORT,"NC_USHORT");
+ test_type(ncid, NC_UINT,"NC_UINT");
+ test_type(ncid, NC_INT64,"NC_INT64");
+ test_type(ncid, NC_UINT64,"NC_UINT64");
+ test_type(ncid, NC_STRING,"NC_STRING");
+ if(nc_close(ncid)) ERR;
+ }
+
+#endif // USE_NETCDF4
+
+ printf("* Finished.\n");
+
+ SUMMARIZE_ERR;
+ FINAL_RESULTS;
+}
diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt
index 18eb4c9..cff120f 100644
--- a/nc_test4/CMakeLists.txt
+++ b/nc_test4/CMakeLists.txt
@@ -9,19 +9,26 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars
t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
- tst_put_vars_two_unlim_dim)
+ tst_put_vars_two_unlim_dim tst_hdf5_file_compat)
# Note, renamegroup needs to be compiled before run_grp_rename
build_bin_test(renamegroup)
add_sh_test(nc_test4 run_grp_rename)
+##
+# The shell script, run_empty_vlen_test.sh,
+# depends on the 'tst_empty_vlen_unlim' binary.
+##
+BUILD_BIN_TEST(tst_empty_vlen_unlim)
+ADD_SH_TEST(nc_test4 run_empty_vlen_test)
+
+
IF(NOT MSVC)
SET(NC4_TESTS ${NC4_TESTS} tst_interops5 tst_camrun)
ENDIF()
# If the v2 API was built, add the test program.
IF(ENABLE_V2_API)
-
build_bin_test(tst_v2)
ENDIF()
@@ -79,10 +86,6 @@ IF(TEST_PARALLEL)
build_bin_test(tst_parallel3)
build_bin_test(tst_parallel4)
build_bin_test(tst_nc4perf)
+ build_bin_test(tst_mode)
add_sh_test(nc_test4 run_par_test)
ENDIF()
-
-## Specify files to be distributed by 'make dist'
-FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ref_chunks1.cdl ref_chunks2.cdl ref_tst_compounds.nc ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc ref_tst_interops4.nc ref_grp_rename.cdl ref_tst_nvars.nc contig.hdf4 chunked.hdf4)
diff --git a/nc_test4/Make0 b/nc_test4/Make0
new file mode 100644
index 0000000..7f4732b
--- /dev/null
+++ b/nc_test4/Make0
@@ -0,0 +1,31 @@
+# Test c output
+T=tst_mode
+#CMD=valgrind --leak-check=full
+CMD=gdb --args
+
+PAR=1
+
+CFLAGS=-g -O0 -I.. -I../include
+
+ifdef PAR
+CC=mpicc
+#CC=/usr/local/bin/mpicc
+LDFLAGS=-L/usr/local/lib -lhdf5_hl -lhdf5 -lz ../liblib/.libs/libnetcdf.a -ldl -lcurl -lpnetcdf -lmpich -lm
+else
+CC=gcc
+#LDFLAGS=../liblib/.libs/libnetcdf.a -L/usr/local/lib -lhdf5_hl -lhdf5 -lz -lm -lcurl
+LDFLAGS=-L/usr/local/lib -lhdf5_hl -lhdf5 -lz ../liblib/.libs/libnetcdf.a -ldl -lm -lcurl
+endif
+
+# cd .. ; ${MAKE} all
+
+LLP=/usr/local/lib:${LD_LIBRARY_PATH}
+
+all::
+ echo ${LD_RUN_PATH}
+ export LD_LIBRARY_PATH=${LLP}; export CFLAGS; export LDFLAGS; \
+ ${CC} -o t ${CFLAGS} ${T}.c ${LDFLAGS}; \
+ ${CMD} ./t
+
+cpp::
+ ${CC} -E ${CFLAGS} ${T}.c > ${T}.txt
diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am
index 8245b86..e1fbceb 100644
--- a/nc_test4/Makefile.am
+++ b/nc_test4/Makefile.am
@@ -21,9 +21,10 @@ tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 tst_fillbug \
tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts \
t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \
-tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
+tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
+tst_hdf5_file_compat
-check_PROGRAMS = $(NC4_TESTS) renamegroup
+check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim
# Add these if large file tests are turned on.
if LARGE_FILE_TESTS
@@ -32,7 +33,7 @@ endif
TESTS = $(NC4_TESTS)
-TESTS += run_grp_rename.sh
+TESTS += run_grp_rename.sh run_empty_vlen_test.sh
# If the v2 API was built, add its test program.
if BUILD_V2
@@ -108,7 +109,7 @@ endif # USE_VALGRIND_TESTS
# with --enable-parallel-tests.
if TEST_PARALLEL4
check_PROGRAMS += tst_mpi_parallel tst_parallel tst_parallel3 \
-tst_parallel4 tst_nc4perf
+tst_parallel4 tst_nc4perf tst_mode
TESTS += run_par_test.sh
endif
@@ -123,7 +124,8 @@ ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt \
run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
-tst_put_vars_two_unlim_dim.c
+tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \
+ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
@@ -134,7 +136,7 @@ tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* \
usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
-tst_atts_string_rewrite.nc
+tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc
if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \
diff --git a/nc_test4/Makefile.in b/nc_test4/Makefile.in
index df3055e..c227f06 100644
--- a/nc_test4/Makefile.in
+++ b/nc_test4/Makefile.in
@@ -107,16 +107,17 @@ target_triplet = @target@
# This turns on declspec magic in netcdf.h for windows DLLs.
@BUILD_DLL_TRUE at am__append_2 = -DDLL_NETCDF
-check_PROGRAMS = $(am__EXEEXT_1) renamegroup$(EXEEXT) $(am__EXEEXT_2) \
- $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5) \
- $(am__EXEEXT_6) $(am__EXEEXT_7) $(am__EXEEXT_8)
+check_PROGRAMS = $(am__EXEEXT_1) renamegroup$(EXEEXT) \
+ tst_empty_vlen_unlim$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
+ $(am__EXEEXT_7) $(am__EXEEXT_8)
# Add these if large file tests are turned on.
@LARGE_FILE_TESTS_TRUE at am__append_3 = tst_large tst_large2
-TESTS = $(am__EXEEXT_1) run_grp_rename.sh $(am__EXEEXT_3) \
- $(am__EXEEXT_4) $(am__EXEEXT_9) $(am__append_10) \
- $(am__EXEEXT_10) $(am__EXEEXT_11) $(am__append_15) \
- $(am__append_16) $(am__append_18)
+TESTS = $(am__EXEEXT_1) run_grp_rename.sh run_empty_vlen_test.sh \
+ $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_9) \
+ $(am__append_10) $(am__EXEEXT_10) $(am__EXEEXT_11) \
+ $(am__append_15) $(am__append_16) $(am__append_18)
# If the v2 API was built, add its test program.
@BUILD_V2_TRUE at am__append_4 = tst_v2
@@ -158,7 +159,7 @@ TESTS = $(am__EXEEXT_1) run_grp_rename.sh $(am__EXEEXT_3) \
# This are extra tests that will only be run if netcdf-4 is configured
# with --enable-parallel-tests.
@TEST_PARALLEL4_TRUE at am__append_17 = tst_mpi_parallel tst_parallel tst_parallel3 \
- at TEST_PARALLEL4_TRUE@tst_parallel4 tst_nc4perf
+ at TEST_PARALLEL4_TRUE@tst_parallel4 tst_nc4perf tst_mode
@TEST_PARALLEL4_TRUE at am__append_18 = run_par_test.sh
subdir = nc_test4
@@ -173,7 +174,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
+CONFIG_CLEAN_VPATH_FILES = ref_hdf5_compat1.nc ref_hdf5_compat2.nc \
+ ref_hdf5_compat3.nc
am__EXEEXT_1 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
tst_files$(EXEEXT) tst_files4$(EXEEXT) tst_vars$(EXEEXT) \
tst_varms$(EXEEXT) tst_unlim_vars$(EXEEXT) \
@@ -195,7 +197,8 @@ am__EXEEXT_1 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
tst_files5$(EXEEXT) tst_files6$(EXEEXT) tst_sync$(EXEEXT) \
tst_h_strbug$(EXEEXT) tst_h_refs$(EXEEXT) \
tst_h_scalar$(EXEEXT) tst_rename$(EXEEXT) \
- tst_h5_endians$(EXEEXT) tst_atts_string_rewrite$(EXEEXT)
+ tst_h5_endians$(EXEEXT) tst_atts_string_rewrite$(EXEEXT) \
+ tst_hdf5_file_compat$(EXEEXT)
@LARGE_FILE_TESTS_TRUE at am__EXEEXT_2 = tst_large$(EXEEXT) \
@LARGE_FILE_TESTS_TRUE@ tst_large2$(EXEEXT)
@BUILD_V2_TRUE at am__EXEEXT_3 = tst_v2$(EXEEXT)
@@ -218,7 +221,7 @@ am__EXEEXT_1 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
@TEST_PARALLEL4_TRUE@ tst_parallel$(EXEEXT) \
@TEST_PARALLEL4_TRUE@ tst_parallel3$(EXEEXT) \
@TEST_PARALLEL4_TRUE@ tst_parallel4$(EXEEXT) \
- at TEST_PARALLEL4_TRUE@ tst_nc4perf$(EXEEXT)
+ at TEST_PARALLEL4_TRUE@ tst_nc4perf$(EXEEXT) tst_mode$(EXEEXT)
am__bm_file_SOURCES_DIST = bm_file.c tst_utils.c
@BUILD_BENCHMARKS_TRUE at am_bm_file_OBJECTS = bm_file.$(OBJEXT) \
@BUILD_BENCHMARKS_TRUE@ tst_utils.$(OBJEXT)
@@ -336,6 +339,9 @@ tst_dims2_LDADD = $(LDADD)
tst_dims3_SOURCES = tst_dims3.c
tst_dims3_OBJECTS = tst_dims3.$(OBJEXT)
tst_dims3_LDADD = $(LDADD)
+tst_empty_vlen_unlim_SOURCES = tst_empty_vlen_unlim.c
+tst_empty_vlen_unlim_OBJECTS = tst_empty_vlen_unlim.$(OBJEXT)
+tst_empty_vlen_unlim_LDADD = $(LDADD)
tst_endian_fill_SOURCES = tst_endian_fill.c
tst_endian_fill_OBJECTS = tst_endian_fill.$(OBJEXT)
tst_endian_fill_LDADD = $(LDADD)
@@ -404,6 +410,9 @@ tst_h_scalar_LDADD = $(LDADD)
tst_h_strbug_SOURCES = tst_h_strbug.c
tst_h_strbug_OBJECTS = tst_h_strbug.$(OBJEXT)
tst_h_strbug_LDADD = $(LDADD)
+tst_hdf5_file_compat_SOURCES = tst_hdf5_file_compat.c
+tst_hdf5_file_compat_OBJECTS = tst_hdf5_file_compat.$(OBJEXT)
+tst_hdf5_file_compat_LDADD = $(LDADD)
tst_interops_SOURCES = tst_interops.c
tst_interops_OBJECTS = tst_interops.$(OBJEXT)
tst_interops_LDADD = $(LDADD)
@@ -436,6 +445,9 @@ tst_large2_LDADD = $(LDADD)
tst_mem_SOURCES = tst_mem.c
tst_mem_OBJECTS = tst_mem.$(OBJEXT)
tst_mem_LDADD = $(LDADD)
+tst_mode_SOURCES = tst_mode.c
+tst_mode_OBJECTS = tst_mode.$(OBJEXT)
+tst_mode_LDADD = $(LDADD)
tst_mpi_parallel_SOURCES = tst_mpi_parallel.c
tst_mpi_parallel_OBJECTS = tst_mpi_parallel.$(OBJEXT)
tst_mpi_parallel_LDADD = $(LDADD)
@@ -542,15 +554,16 @@ SOURCES = $(bm_file_SOURCES) $(bm_many_atts_SOURCES) \
tst_chunks3.c tst_compounds.c tst_compounds2.c \
tst_compounds3.c tst_converts.c tst_converts2.c tst_coords.c \
tst_coords2.c tst_coords3.c tst_create_files.c tst_dims.c \
- tst_dims2.c tst_dims3.c tst_endian_fill.c tst_enums.c \
- tst_files.c $(tst_files2_SOURCES) tst_files3.c tst_files4.c \
- tst_files5.c tst_files6.c tst_fillbug.c tst_fills.c \
- tst_fills2.c tst_grps.c tst_grps2.c tst_h4_lendian.c \
- tst_h5_endians.c tst_h_atts2.c tst_h_files3.c \
- $(tst_h_many_atts_SOURCES) tst_h_refs.c tst_h_scalar.c \
- tst_h_strbug.c tst_interops.c tst_interops2.c tst_interops3.c \
- tst_interops4.c tst_interops5.c tst_interops6.c \
- $(tst_knmi_SOURCES) tst_large.c tst_large2.c tst_mem.c \
+ tst_dims2.c tst_dims3.c tst_empty_vlen_unlim.c \
+ tst_endian_fill.c tst_enums.c tst_files.c \
+ $(tst_files2_SOURCES) tst_files3.c tst_files4.c tst_files5.c \
+ tst_files6.c tst_fillbug.c tst_fills.c tst_fills2.c tst_grps.c \
+ tst_grps2.c tst_h4_lendian.c tst_h5_endians.c tst_h_atts2.c \
+ tst_h_files3.c $(tst_h_many_atts_SOURCES) tst_h_refs.c \
+ tst_h_scalar.c tst_h_strbug.c tst_hdf5_file_compat.c \
+ tst_interops.c tst_interops2.c tst_interops3.c tst_interops4.c \
+ tst_interops5.c tst_interops6.c $(tst_knmi_SOURCES) \
+ tst_large.c tst_large2.c tst_mem.c tst_mode.c \
tst_mpi_parallel.c tst_nc4perf.c tst_opaques.c tst_parallel.c \
tst_parallel3.c tst_parallel4.c tst_rename.c tst_strings.c \
tst_strings2.c tst_sync.c tst_unlim_vars.c tst_utf8.c tst_v2.c \
@@ -568,21 +581,21 @@ DIST_SOURCES = $(am__bm_file_SOURCES_DIST) \
tst_compounds2.c tst_compounds3.c tst_converts.c \
tst_converts2.c tst_coords.c tst_coords2.c tst_coords3.c \
tst_create_files.c tst_dims.c tst_dims2.c tst_dims3.c \
- tst_endian_fill.c tst_enums.c tst_files.c \
- $(am__tst_files2_SOURCES_DIST) tst_files3.c tst_files4.c \
- tst_files5.c tst_files6.c tst_fillbug.c tst_fills.c \
- tst_fills2.c tst_grps.c tst_grps2.c tst_h4_lendian.c \
- tst_h5_endians.c tst_h_atts2.c tst_h_files3.c \
+ tst_empty_vlen_unlim.c tst_endian_fill.c tst_enums.c \
+ tst_files.c $(am__tst_files2_SOURCES_DIST) tst_files3.c \
+ tst_files4.c tst_files5.c tst_files6.c tst_fillbug.c \
+ tst_fills.c tst_fills2.c tst_grps.c tst_grps2.c \
+ tst_h4_lendian.c tst_h5_endians.c tst_h_atts2.c tst_h_files3.c \
$(am__tst_h_many_atts_SOURCES_DIST) tst_h_refs.c \
- tst_h_scalar.c tst_h_strbug.c tst_interops.c tst_interops2.c \
- tst_interops3.c tst_interops4.c tst_interops5.c \
- tst_interops6.c $(am__tst_knmi_SOURCES_DIST) tst_large.c \
- tst_large2.c tst_mem.c tst_mpi_parallel.c tst_nc4perf.c \
- tst_opaques.c tst_parallel.c tst_parallel3.c tst_parallel4.c \
- tst_rename.c tst_strings.c tst_strings2.c tst_sync.c \
- tst_unlim_vars.c tst_utf8.c tst_v2.c tst_varms.c tst_vars.c \
- tst_vars2.c tst_vars3.c tst_vars4.c tst_vl.c tst_xplatform.c \
- tst_xplatform2.c
+ tst_h_scalar.c tst_h_strbug.c tst_hdf5_file_compat.c \
+ tst_interops.c tst_interops2.c tst_interops3.c tst_interops4.c \
+ tst_interops5.c tst_interops6.c $(am__tst_knmi_SOURCES_DIST) \
+ tst_large.c tst_large2.c tst_mem.c tst_mode.c \
+ tst_mpi_parallel.c tst_nc4perf.c tst_opaques.c tst_parallel.c \
+ tst_parallel3.c tst_parallel4.c tst_rename.c tst_strings.c \
+ tst_strings2.c tst_sync.c tst_unlim_vars.c tst_utf8.c tst_v2.c \
+ tst_varms.c tst_vars.c tst_vars2.c tst_vars3.c tst_vars4.c \
+ tst_vl.c tst_xplatform.c tst_xplatform2.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -824,8 +837,10 @@ TEST_LOGS = $(am__test_logs2:.test.log=.log)
TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
$(TEST_LOG_FLAGS)
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
- $(top_srcdir)/lib_flags.am $(top_srcdir)/test-driver
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ref_hdf5_compat1.nc \
+ $(srcdir)/ref_hdf5_compat2.nc $(srcdir)/ref_hdf5_compat3.nc \
+ $(top_srcdir)/depcomp $(top_srcdir)/lib_flags.am \
+ $(top_srcdir)/test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
@@ -876,6 +891,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
@@ -1013,7 +1029,8 @@ tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 tst_fillbug \
tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts \
t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \
-tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
+tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
+tst_hdf5_file_compat
@BUILD_BENCHMARKS_TRUE at bm_netcdf4_recs_SOURCES = bm_netcdf4_recs.c tst_utils.c
@BUILD_BENCHMARKS_TRUE at bm_many_atts_SOURCES = bm_many_atts.c tst_utils.c
@@ -1036,7 +1053,8 @@ ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt \
run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
-tst_put_vars_two_unlim_dim.c
+tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \
+ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
@@ -1047,7 +1065,7 @@ tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* \
usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
-tst_atts_string_rewrite.nc
+tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc
@USE_HDF4_FILE_TESTS_TRUE at DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \
@USE_HDF4_FILE_TESTS_TRUE at AMSR_E_L3_DailyLand_V06_20020619.hdf \
@@ -1227,6 +1245,10 @@ tst_dims3$(EXEEXT): $(tst_dims3_OBJECTS) $(tst_dims3_DEPENDENCIES) $(EXTRA_tst_d
@rm -f tst_dims3$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_dims3_OBJECTS) $(tst_dims3_LDADD) $(LIBS)
+tst_empty_vlen_unlim$(EXEEXT): $(tst_empty_vlen_unlim_OBJECTS) $(tst_empty_vlen_unlim_DEPENDENCIES) $(EXTRA_tst_empty_vlen_unlim_DEPENDENCIES)
+ @rm -f tst_empty_vlen_unlim$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tst_empty_vlen_unlim_OBJECTS) $(tst_empty_vlen_unlim_LDADD) $(LIBS)
+
tst_endian_fill$(EXEEXT): $(tst_endian_fill_OBJECTS) $(tst_endian_fill_DEPENDENCIES) $(EXTRA_tst_endian_fill_DEPENDENCIES)
@rm -f tst_endian_fill$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_endian_fill_OBJECTS) $(tst_endian_fill_LDADD) $(LIBS)
@@ -1311,6 +1333,10 @@ tst_h_strbug$(EXEEXT): $(tst_h_strbug_OBJECTS) $(tst_h_strbug_DEPENDENCIES) $(EX
@rm -f tst_h_strbug$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_h_strbug_OBJECTS) $(tst_h_strbug_LDADD) $(LIBS)
+tst_hdf5_file_compat$(EXEEXT): $(tst_hdf5_file_compat_OBJECTS) $(tst_hdf5_file_compat_DEPENDENCIES) $(EXTRA_tst_hdf5_file_compat_DEPENDENCIES)
+ @rm -f tst_hdf5_file_compat$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tst_hdf5_file_compat_OBJECTS) $(tst_hdf5_file_compat_LDADD) $(LIBS)
+
tst_interops$(EXEEXT): $(tst_interops_OBJECTS) $(tst_interops_DEPENDENCIES) $(EXTRA_tst_interops_DEPENDENCIES)
@rm -f tst_interops$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_interops_OBJECTS) $(tst_interops_LDADD) $(LIBS)
@@ -1351,6 +1377,10 @@ tst_mem$(EXEEXT): $(tst_mem_OBJECTS) $(tst_mem_DEPENDENCIES) $(EXTRA_tst_mem_DEP
@rm -f tst_mem$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_mem_OBJECTS) $(tst_mem_LDADD) $(LIBS)
+tst_mode$(EXEEXT): $(tst_mode_OBJECTS) $(tst_mode_DEPENDENCIES) $(EXTRA_tst_mode_DEPENDENCIES)
+ @rm -f tst_mode$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tst_mode_OBJECTS) $(tst_mode_LDADD) $(LIBS)
+
tst_mpi_parallel$(EXEEXT): $(tst_mpi_parallel_OBJECTS) $(tst_mpi_parallel_DEPENDENCIES) $(EXTRA_tst_mpi_parallel_DEPENDENCIES)
@rm -f tst_mpi_parallel$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_mpi_parallel_OBJECTS) $(tst_mpi_parallel_LDADD) $(LIBS)
@@ -1473,6 +1503,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims2.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims3.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_empty_vlen_unlim.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_endian_fill.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_enums.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@
@@ -1494,6 +1525,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_refs.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_scalar.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strbug.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_hdf5_file_compat.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops2.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops3.Po at am__quote@
@@ -1504,6 +1536,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large2.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mode.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mpi_parallel.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nc4perf.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_opaques.Po at am__quote@
@@ -2135,6 +2168,13 @@ tst_atts_string_rewrite.log: tst_atts_string_rewrite$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+tst_hdf5_file_compat.log: tst_hdf5_file_compat$(EXEEXT)
+ @p='tst_hdf5_file_compat$(EXEEXT)'; \
+ b='tst_hdf5_file_compat'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
run_grp_rename.sh.log: run_grp_rename.sh
@p='run_grp_rename.sh'; \
b='run_grp_rename.sh'; \
@@ -2142,6 +2182,13 @@ run_grp_rename.sh.log: run_grp_rename.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+run_empty_vlen_test.sh.log: run_empty_vlen_test.sh
+ @p='run_empty_vlen_test.sh'; \
+ b='run_empty_vlen_test.sh'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
tst_v2.log: tst_v2$(EXEEXT)
@p='tst_v2$(EXEEXT)'; \
b='tst_v2'; \
diff --git a/nc_test4/bm_file.c b/nc_test4/bm_file.c
index daa8f81..b12351e 100644
--- a/nc_test4/bm_file.c
+++ b/nc_test4/bm_file.c
@@ -77,7 +77,7 @@ get_starts_counts(int ndims, size_t *dimlen, int p, int my_rank,
size_t *last_count, size_t *start, size_t *count)
{
int extra_step = 0;
- int total[NC_MAX_DIMS];
+ int total[NC_MAX_VAR_DIMS];
int total_len;
int s, d;
@@ -263,8 +263,8 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
void *data = NULL, *data2 = NULL;
int a, v, d;
nc_type xtype, xtype2;
- int nvars, ndims, dimids[NC_MAX_DIMS], natts, real_ndims;
- int nvars2, ndims2, dimids2[NC_MAX_DIMS], natts2;
+ int nvars, ndims, dimids[NC_MAX_VAR_DIMS], natts, real_ndims;
+ int nvars2, ndims2, dimids2[NC_MAX_VAR_DIMS], natts2;
size_t *count = NULL, *start = NULL;
int slice_len = 1;
size_t *dimlen = NULL, type_size = 0;
@@ -567,7 +567,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
char name[NC_MAX_NAME + 1];
char att_name[NC_MAX_NAME + 1];
nc_type xtype;
- int ndims, dimids[NC_MAX_DIMS], natts;
+ int ndims, dimids[NC_MAX_VAR_DIMS], natts;
int varid_out;
int a, o1;
int ret = NC_NOERR;
@@ -636,7 +636,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
{
char name[NC_MAX_NAME + 1];
nc_type xtype;
- int ndims, dimids[NC_MAX_DIMS], natts, real_ndims;
+ int ndims, dimids[NC_MAX_VAR_DIMS], natts, real_ndims;
int d;
void *data = NULL;
size_t *count = NULL, *start = NULL;
diff --git a/nc_test4/bm_radar.c b/nc_test4/bm_radar.c
index ef06316..3bf8934 100644
--- a/nc_test4/bm_radar.c
+++ b/nc_test4/bm_radar.c
@@ -69,7 +69,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
char name[NC_MAX_NAME + 1];
char att_name[NC_MAX_NAME + 1];
nc_type xtype;
- int ndims, dimids[NC_MAX_DIMS], natts;
+ int ndims, dimids[NC_MAX_VAR_DIMS], natts;
int varid_out;
int a;
int retval = NC_NOERR;
@@ -103,7 +103,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
{
char name[NC_MAX_NAME + 1];
nc_type xtype;
- int ndims, dimids[NC_MAX_DIMS], natts, real_ndims;
+ int ndims, dimids[NC_MAX_VAR_DIMS], natts, real_ndims;
int d;
void *data = NULL;
size_t *count = NULL, *start = NULL;
diff --git a/nc_test4/ref_hdf5_compat1.nc b/nc_test4/ref_hdf5_compat1.nc
new file mode 100644
index 0000000..f8c8a40
Binary files /dev/null and b/nc_test4/ref_hdf5_compat1.nc differ
diff --git a/nc_test4/ref_hdf5_compat2.nc b/nc_test4/ref_hdf5_compat2.nc
new file mode 100644
index 0000000..1838f72
Binary files /dev/null and b/nc_test4/ref_hdf5_compat2.nc differ
diff --git a/nc_test4/ref_hdf5_compat3.nc b/nc_test4/ref_hdf5_compat3.nc
new file mode 100644
index 0000000..ca00fdc
Binary files /dev/null and b/nc_test4/ref_hdf5_compat3.nc differ
diff --git a/nc_test4/run_empty_vlen_test.sh b/nc_test4/run_empty_vlen_test.sh
new file mode 100755
index 0000000..adddd29
--- /dev/null
+++ b/nc_test4/run_empty_vlen_test.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Front-end for tst_empty_vlen_unlim.c. This test
+# ensures that valid netcdf files are generated when
+# a ragged VLEN array is defined but not populated.
+#
+# This script runs tst_empty_vlen_unlim and then
+# runs `ncdump` against the two generated files.
+#
+# See https://github.com/Unidata/netcdf-c/issues/221 for
+# full details.
+#
+
+set -e
+
+if test "x$srcdir" = x ; then
+srcdir=`pwd`
+fi
+
+echo ""
+echo "* Testing Empty Ragged Arrays (VLEN)"
+
+echo "Generating test netcdf files."
+./tst_empty_vlen_unlim
+
+echo "Validating Files with ncdump."
+echo "======================================"
+../ncdump/ncdump -s tst_empty_vlen_unlim.nc
+echo "---------------------------------------"
+../ncdump/ncdump -s tst_empty_vlen_lim.nc
+echo "======================================"
+
+echo "* Tests Passed."
+exit 0
diff --git a/nc_test4/run_par_test.sh b/nc_test4/run_par_test.sh
index a730a94..ec92032 100755
--- a/nc_test4/run_par_test.sh
+++ b/nc_test4/run_par_test.sh
@@ -4,6 +4,9 @@
set -e
echo
+echo "Testing MPI parallel I/O with various other mode flags..."
+mpiexec -n 1 ./tst_mode
+echo
echo "Testing MPI parallel I/O without netCDF..."
mpiexec -n 4 ./tst_mpi_parallel
echo
@@ -18,6 +21,7 @@ mpiexec -n 1 ./tst_parallel4
mpiexec -n 2 ./tst_parallel4
mpiexec -n 4 ./tst_parallel4
mpiexec -n 8 ./tst_parallel4
+
#mpiexec -n 16 ./tst_parallel4
#mpiexec -n 32 ./tst_parallel4
#mpiexec -n 64 ./tst_parallel4
diff --git a/nc_test4/tst_compounds.c b/nc_test4/tst_compounds.c
index 001e20a..ec0291a 100644
--- a/nc_test4/tst_compounds.c
+++ b/nc_test4/tst_compounds.c
@@ -2,7 +2,7 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 compound type feature.
+ Test netcdf-4 compound type feature.
$Id: tst_compounds.c,v 1.45 2010/05/25 13:53:03 ed Exp $
*/
@@ -33,16 +33,16 @@ main(int argc, char **argv)
size_t size;
nc_type xtype, field_xtype;
int dimids[] = {0}, fieldid;
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
- struct s1
+ struct s1
{
int i1;
int i2;
};
struct s1 data, data_in;
- /* Create some phony data. */
+ /* Create some phony data. */
data.i1 = 5;
data.i2 = 10;
@@ -51,9 +51,9 @@ main(int argc, char **argv)
if (nc_def_compound(ncid, sizeof(struct s1), SVC_REC, &typeid)) ERR;
if (nc_inq_compound(ncid, typeid, name, &size, &nfields)) ERR;
if (size != sizeof(struct s1) || strcmp(name, SVC_REC) || nfields) ERR;
- if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
+ if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
NC_COMPOUND_OFFSET(struct s1, i1), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
+ if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
NC_COMPOUND_OFFSET(struct s1, i2), NC_INT)) ERR;
if (nc_def_var(ncid, SERVICE_RECORD, typeid, 0, NULL, &varid)) ERR;
if (nc_put_var(ncid, varid, &data)) ERR;
@@ -106,10 +106,10 @@ main(int argc, char **argv)
size_t size;
nc_type xtype, field_xtype;
int dimids[] = {0}, fieldid;
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
int i;
- struct s1
+ struct s1
{
int i1;
int i2;
@@ -119,12 +119,12 @@ main(int argc, char **argv)
/* REALLY initialize the data (even the gaps in the structs). This
* is only needed to pass valgrind. */
- if (!(dummy = calloc(sizeof(struct s1), DIM_LEN)))
- return NC_ENOMEM;
- memcpy((void *)data, (void *)dummy, sizeof(struct s1) * DIM_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct s1), DIM_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)data, (void *)dummy, sizeof(struct s1) * DIM_LEN);
+ free(dummy);
- /* Create some phony data. */
+ /* Create some phony data. */
for (i = 0; i < DIM_LEN; i++)
{
data[i].i1 = 5;
@@ -136,9 +136,9 @@ main(int argc, char **argv)
if (nc_def_compound(ncid, sizeof(struct s1), SVC_REC, &typeid)) ERR;
if (nc_inq_compound(ncid, typeid, name, &size, &nfields)) ERR;
if (size != sizeof(struct s1) || strcmp(name, SVC_REC) || nfields) ERR;
- if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
+ if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
NC_COMPOUND_OFFSET(struct s1, i1), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
+ if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
NC_COMPOUND_OFFSET(struct s1, i2), NC_INT)) ERR;
if (nc_def_dim(ncid, STARDATE, DIM_LEN, &dimid)) ERR;
if (nc_def_var(ncid, SERVICE_RECORD, typeid, 1, dimids, &varid)) ERR;
@@ -204,7 +204,7 @@ main(int argc, char **argv)
if (nc_get_vars(ncid, varid, start, edges, stride, data)) ERR;
for (i=0; i<DIM_LEN_S; i++) {
if(data[i].i1 != datas[i].i1 || data[i].i2 != datas[i].i2) ERR;
- }
+ }
}
if (nc_close(ncid)) ERR;
@@ -217,7 +217,7 @@ main(int argc, char **argv)
nc_type xtype;
size_t size_in, nfields_in;
char name_in[NC_MAX_NAME + 1];
-
+
/* Create a file with a compound type. Write a little data. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_compound(ncid, sizeof(int), SVC_REC, &typeid)) ERR;
@@ -227,8 +227,8 @@ main(int argc, char **argv)
/* Open the file and take a peek. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
- if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
- if (ndims != 0 || nvars != 1 || natts != 0 || unlimdimid != -1) ERR;
+ if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
+ if (ndims != 0 || nvars != 1 || natts != 0 || unlimdimid != -1) ERR;
if (nc_inq_vartype(ncid, 0, &xtype)) ERR;
if (nc_inq_compound(ncid, xtype, name_in, &size_in, &nfields_in)) ERR;
if (strcmp(name_in, SVC_REC) || size_in != sizeof(int) || nfields_in != 1) ERR;
@@ -244,10 +244,10 @@ main(int argc, char **argv)
size_t size, len;
nc_type xtype, field_xtype;
int fieldid;
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
int i;
- struct s1
+ struct s1
{
int i1;
int i2;
@@ -257,12 +257,12 @@ main(int argc, char **argv)
/* REALLY initialize the data (even the gaps in the structs). This
* is only needed to pass valgrind. */
- if (!(dummy = calloc(sizeof(struct s1), DIM_LEN)))
- return NC_ENOMEM;
- memcpy((void *)data, (void *)dummy, sizeof(struct s1) * DIM_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct s1), DIM_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)data, (void *)dummy, sizeof(struct s1) * DIM_LEN);
+ free(dummy);
- /* Create some phony data. */
+ /* Create some phony data. */
for (i=0; i<DIM_LEN; i++)
{
data[i].i1 = 5;
@@ -272,9 +272,9 @@ main(int argc, char **argv)
/* Create a file with a global attribute of compound type. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_compound(ncid, sizeof(struct s1), SVC_REC, &typeid)) ERR;
- if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
+ if (nc_insert_compound(ncid, typeid, BATTLES_WITH_KLINGONS,
NC_COMPOUND_OFFSET(struct s1, i1), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
+ if (nc_insert_compound(ncid, typeid, DATES_WITH_ALIENS,
NC_COMPOUND_OFFSET(struct s1, i2), NC_INT)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, SERVICE_RECORD, typeid, 3, data)) ERR;
if (nc_close(ncid)) ERR;
@@ -320,7 +320,7 @@ main(int argc, char **argv)
size_t size;
nc_type xtype, field_xtype;
int dimids[] = {0};
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
int i;
@@ -338,12 +338,12 @@ main(int argc, char **argv)
/* REALLY initialize the data (even the gaps in the structs). This
* is only needed to pass valgrind. */
- if (!(dummy = calloc(sizeof(struct sf_med_rec), DIM_LEN)))
- return NC_ENOMEM;
- memcpy((void *)med_data_out, (void *)dummy, sizeof(struct sf_med_rec) * DIM_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct sf_med_rec), DIM_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)med_data_out, (void *)dummy, sizeof(struct sf_med_rec) * DIM_LEN);
+ free(dummy);
- /* Create some phony data. */
+ /* Create some phony data. */
for (i=0; i<DIM_LEN; i++)
{
/* medical data */
@@ -357,15 +357,15 @@ main(int argc, char **argv)
/* Create a file with a compound type. Write a little data. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_compound(ncid, sizeof(struct sf_med_rec), "SFMedRec", &typeid)) ERR;
- if (nc_insert_compound(ncid, typeid, "num_heads",
+ if (nc_insert_compound(ncid, typeid, "num_heads",
NC_COMPOUND_OFFSET(struct sf_med_rec, num_heads), NC_UBYTE)) ERR;
- if (nc_insert_compound(ncid, typeid, "num_arms",
+ if (nc_insert_compound(ncid, typeid, "num_arms",
NC_COMPOUND_OFFSET(struct sf_med_rec, num_arms), NC_USHORT)) ERR;
- if (nc_insert_compound(ncid, typeid, "num_toes",
+ if (nc_insert_compound(ncid, typeid, "num_toes",
NC_COMPOUND_OFFSET(struct sf_med_rec, num_toes), NC_UINT)) ERR;
- if (nc_insert_compound(ncid, typeid, "ago",
+ if (nc_insert_compound(ncid, typeid, "ago",
NC_COMPOUND_OFFSET(struct sf_med_rec, ago), NC_INT64)) ERR;
- if (nc_insert_compound(ncid, typeid, "num_hairs",
+ if (nc_insert_compound(ncid, typeid, "num_hairs",
NC_COMPOUND_OFFSET(struct sf_med_rec, num_hairs), NC_UINT64)) ERR;
if (nc_def_dim(ncid, STARDATE, DIM_LEN, &dimid)) ERR;
if (nc_def_var(ncid, "starbase_13", typeid, 1, dimids, &varid)) ERR;
@@ -382,20 +382,20 @@ main(int argc, char **argv)
if (nc_inq_compound_field(ncid, xtype, 0, name, &offset, &field_xtype, &field_ndims, field_sizes)) ERR;
if (strcmp(name, "num_heads") || offset != 0 || field_xtype != NC_UBYTE) ERR;
if (nc_inq_compound_field(ncid, xtype, 1, name, &offset, &field_xtype, &field_ndims, field_sizes)) ERR;
- if (strcmp(name, "num_arms") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, num_arms) ||
+ if (strcmp(name, "num_arms") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, num_arms) ||
field_xtype != NC_USHORT) ERR;
if (nc_inq_compound_field(ncid, xtype, 2, name, &offset, &field_xtype, &field_ndims, field_sizes)) ERR;
- if (strcmp(name, "num_toes") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, num_toes) ||
+ if (strcmp(name, "num_toes") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, num_toes) ||
field_xtype != NC_UINT) ERR;
if (nc_inq_compound_field(ncid, xtype, 3, name, &offset, &field_xtype, &field_ndims, field_sizes)) ERR;
- if (strcmp(name, "ago") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, ago) ||
+ if (strcmp(name, "ago") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, ago) ||
field_xtype != NC_INT64) ERR;
if (nc_inq_compound_field(ncid, xtype, 4, name, &offset, &field_xtype, &field_ndims, field_sizes)) ERR;
- if (strcmp(name, "num_hairs") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, num_hairs) ||
+ if (strcmp(name, "num_hairs") || offset != NC_COMPOUND_OFFSET(struct sf_med_rec, num_hairs) ||
field_xtype != NC_UINT64) ERR;
if (nc_get_var(ncid, varid, med_data_in)) ERR;
for (i=0; i<DIM_LEN; i++)
- if (med_data_in[i].num_heads != med_data_out[i].num_heads ||
+ if (med_data_in[i].num_heads != med_data_out[i].num_heads ||
med_data_in[i].num_arms != med_data_out[i].num_arms ||
med_data_in[i].num_toes != med_data_out[i].num_toes ||
med_data_in[i].ago != med_data_out[i].ago ||
@@ -417,7 +417,7 @@ main(int argc, char **argv)
size_t size;
nc_type xtype;
int dimids[] = {0};
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
nc_type field_typeid;
int dim_sizes[] = {NUM_DIMENSIONS};
@@ -495,7 +495,7 @@ main(int argc, char **argv)
char name[NC_MAX_NAME + 1];
size_t size, len;
nc_type xtype, field_xtype;
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
nc_type svc_recid, hr_recid;
int dim_sizes[] = {NC_MAX_NAME + 1};
@@ -589,7 +589,7 @@ main(int argc, char **argv)
hr_data_in[i].percent_transporter_errosion !=
hr_data_out[i].percent_transporter_errosion) ERR;
}
-
+
/* Use the inq functions to learn about nested compound type. */
if (nc_inq_att(ncid, NC_GLOBAL, "HR_Records", &xtype, &len)) ERR;
if (len != DIM_LEN) ERR;
@@ -600,7 +600,7 @@ main(int argc, char **argv)
if (nc_inq_compound_field(ncid, xtype, 1, name, &offset, &field_xtype, &field_ndims, field_sizes)) ERR;
if (strcmp(name, "Service_Record") || offset != NC_COMPOUND_OFFSET(struct hr_rec, svc_rec)) ERR;
/* Check the internal compound type. */
-
+
/* Finish checking the containing compound type. */
if (nc_close(ncid)) ERR;
}
@@ -697,7 +697,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
@@ -737,7 +737,7 @@ main(int argc, char **argv)
if (val_in.relhum != obsdata[i].relhum) ERR;
if (val_in.time != obsdata[i].time) ERR;
}
-
+
if (nc_close(ncid)) ERR;
}
@@ -772,7 +772,7 @@ main(int argc, char **argv)
nc_type class_in;
int ntypes;
char file_in[NC_MAX_NAME * 2];
-
+
if (getenv("srcdir"))
{
strcpy(file_in, getenv("srcdir"));
@@ -820,7 +820,7 @@ main(int argc, char **argv)
if (val_in.relhum != obsdata[i].relhum) ERR;
if (val_in.time != obsdata[i].time) ERR;
}
-
+
if (nc_close(ncid)) ERR;
}
@@ -847,10 +847,10 @@ main(int argc, char **argv)
/* REALLY initialize the data (even the gaps in the structs). This
* is only needed to pass valgrind. */
- if (!(dummy = calloc(sizeof(struct hr_rec), DIM1_LEN)))
- return NC_ENOMEM;
- memcpy((void *)hr_data_out, (void *)dummy, sizeof(struct hr_rec) * DIM1_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct hr_rec), DIM1_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)hr_data_out, (void *)dummy, sizeof(struct hr_rec) * DIM1_LEN);
+ free(dummy);
/* Create some phony data. */
for (i = 0; i < DIM1_LEN; i++)
@@ -880,11 +880,11 @@ main(int argc, char **argv)
for (i=0; i<DIM1_LEN; i++)
if (strcmp(hr_data_in[i].name, hr_data_out[i].name) ||
hr_data_in[i].max_temp != hr_data_out[i].max_temp) ERR;
-
+
/* Use the inq functions to learn about the compound type. */
if (nc_inq_att(ncid, NC_GLOBAL, "HR_Records", &xtype, &len)) ERR;
if (len != DIM1_LEN) ERR;
-
+
/* Finish checking the containing compound type. */
if (nc_close(ncid)) ERR;
}
@@ -912,10 +912,10 @@ main(int argc, char **argv)
/* REALLY initialize the data (even the gaps in the structs). This
* is only needed to pass valgrind. */
- if (!(dummy = calloc(sizeof(struct hr_rec), DIM1_LEN)))
- return NC_ENOMEM;
- memcpy((void *)hr_data_out, (void *)dummy, sizeof(struct hr_rec) * DIM1_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct hr_rec), DIM1_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)hr_data_out, (void *)dummy, sizeof(struct hr_rec) * DIM1_LEN);
+ free(dummy);
/* Create some phony data. */
for (i = 0; i < DIM1_LEN; i++)
@@ -949,11 +949,11 @@ main(int argc, char **argv)
for (j = 0; j < ARRAY_LEN; j++)
if (hr_data_in[i].name[j] != hr_data_out[i].name[j]) ERR;
}
-
+
/* Use the inq functions to learn about the compound type. */
if (nc_inq_att(ncid, NC_GLOBAL, "HR_Records", &xtype, &len)) ERR;
if (len != DIM1_LEN) ERR;
-
+
/* Finish checking the containing compound type. */
if (nc_close(ncid)) ERR;
}
@@ -974,10 +974,10 @@ main(int argc, char **argv)
/* REALLY initialize the data (even the gaps in the structs). This
* is only needed to pass valgrind. */
- if (!(dummy = calloc(sizeof(struct s1), DATA_LEN)))
- return NC_ENOMEM;
- memcpy((void *)data_out, (void *)dummy, sizeof(struct s1) * DATA_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct s1), DATA_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)data_out, (void *)dummy, sizeof(struct s1) * DATA_LEN);
+ free(dummy);
/* Create some phony data. */
for (idx = 0; idx < DATA_LEN; idx++)
@@ -1011,5 +1011,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_compounds3.c b/nc_test4/tst_compounds3.c
index fe4dd40..3d50b3d 100644
--- a/nc_test4/tst_compounds3.c
+++ b/nc_test4/tst_compounds3.c
@@ -42,7 +42,7 @@ main(int argc, char **argv)
size_t size;
nc_type xtype, field_xtype;
int dimids[] = {0};
- int field_ndims, field_sizes[NC_MAX_DIMS];
+ int field_ndims, field_sizes[NC_TESTS_MAX_DIMS];
size_t offset;
int i;
diff --git a/nc_test4/tst_empty_vlen_unlim.c b/nc_test4/tst_empty_vlen_unlim.c
new file mode 100644
index 0000000..78eadbf
--- /dev/null
+++ b/nc_test4/tst_empty_vlen_unlim.c
@@ -0,0 +1,224 @@
+/* This is part of the netCDF package. Copyright 2005 University
+ Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
+ conditions of use.
+
+ This program excersizes HDF5 variable length array code.
+
+ $Id: tst_h_vl2.c,v 1.5 2010/06/01 15:34:52 ed Exp $
+*/
+
+/* This test was added to help diagnose the issue described at:
+ * * https://github.com/Unidata/netcdf-c/issues/221
+ * This issue was originally reported by the python group at:
+ * * https://github.com/Unidata/netcdf4-python/issues/527
+ */
+
+
+#include <nc_tests.h>
+#include <hdf5.h>
+#include <nc_logging.h>
+
+#define FILE_NAME_UNLIM "tst_empty_vlen_unlim.nc"
+#define FILE_NAME_LIM "tst_empty_vlen_lim.nc"
+#define DIM_LEN_UNLIM NC_UNLIMITED
+#define DIM_LEN_LIM 5
+#define DIM_NAME "x"
+#define VLEN_NAME "vltest"
+#define VAR_NAME1 "v"
+#define VAR_NAME2 "w"
+#define ROW_COUNT 3
+#define VLEN0 2
+#define VLEN1 3
+#define VLEN2 3
+
+int main() {
+
+ printf("Testing access to unset entries in VLEN variable, unlimited dimension\n");
+ {
+ int ncid, typeid, dimid, varid, varid2;
+ nc_vlen_t data[ROW_COUNT];
+ int stat;
+ float *dat0, *dat1, *dat2;
+ float *data2;
+ size_t startp[3] = {0,0,0};
+ size_t countp[3] = {VLEN0,VLEN1,VLEN2};
+ size_t startp2[1] = {0};
+ size_t countp2[1] = {VLEN2};
+ int i = 0;
+ /* Create File */
+ printf("\t* Creating File:\tnc_create()\n");
+ if (nc_create(FILE_NAME_UNLIM, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR;
+
+ /* Set fill mode */
+ //printf("\t* Setting fill mode:\tnc_set_fill()\n");
+ //if(nc_set_fill(ncid,NC_FILL,NULL)) ERR;
+
+ /* Create Dimension */
+ printf("\t* Defining Unlimited Dimension:\tnc_def_dim()\n");
+ if (nc_def_dim(ncid, DIM_NAME, DIM_LEN_UNLIM, &dimid)) ERR;
+
+ /* Create ragged array type. */
+ printf("\t* Creating Ragged Array type:\tnc_def_vlen().\n");
+ if (nc_def_vlen(ncid, VLEN_NAME, NC_FLOAT, &typeid)) ERR;
+
+ /* Create a variable of typeid. */
+ printf("\t* Creating Variable using Ragged Arrayt Type:\tnc_def_var().\n");
+ if (nc_def_var(ncid, VAR_NAME1, typeid, 1, &dimid, &varid)) ERR;
+
+ /* Create a variable of type float. */
+ printf("\t* Creating secondary Variable using NC_FLOAT:\tnc_def_var().\n");
+ if (nc_def_var(ncid, VAR_NAME2, NC_FLOAT, 1, &dimid, &varid2)) ERR;
+
+ /* End define mode. */
+ printf("\t* Ending define mode:\tnc_enddef().\n");
+
+ /* Write out data for w */
+ printf("\t* Creating float data for secondary variable.\n");
+ data2 = (float*)malloc(sizeof(float) * VLEN2);
+ for(i = 0; i < VLEN2; i++) {
+ data2[i] = (float)i;
+ }
+
+ printf("\t* Puting data in secondary variable:\tnc_put_vara().\n");
+ if (nc_put_vara(ncid,varid2,startp2,countp2,data2)) ERR;
+
+ /***********/
+ /* Actually unnecessary to recreate the issue. */
+ /***********/
+
+
+ /* Write out varying-length data for v[0] and v[1]. Leave v[2] empty. */
+
+ dat0 = (float*)malloc(VLEN0 * sizeof(float));
+ for(i = 0; i < VLEN0; i++) {
+ dat0[i] = (float)i;
+ }
+ dat1 = (float*)malloc(VLEN1 * sizeof(float));
+ for(i = 0; i < VLEN1; i++) {
+ dat1[i] = (float)i;
+ }
+ dat2 = (float*)malloc(VLEN2 * sizeof(float));
+ for(i = 0; i < VLEN2; i++) {
+ dat2[i] = (float)i;
+ }
+
+ data[0].p = dat0;
+ data[0].len = VLEN0;
+
+ data[1].p = dat1;
+ data[1].len = VLEN1;
+
+ data[2].p = dat2;
+ data[2].len = VLEN2;
+
+ //printf("\t* Puting data in VLEN variable:\tnc_put_vara().\n");
+ //stat = nc_put_vara(ncid,varid,&startp,&countp,data);
+ //stat = nc_put_var(ncid,varid,&data);
+ //if(stat) ERR;
+
+
+
+ /* Close File. */
+ printf("\t* Closing file:\tnc_close().\n");
+ if (stat = nc_close(ncid)) ERR;
+
+
+ }
+
+ printf("Testing access to unset entries in VLEN variable, unlimit dimension\n");
+ {
+ int ncid, typeid, dimid, varid, varid2;
+ nc_vlen_t data[ROW_COUNT];
+ int stat;
+ float *dat0, *dat1, *dat2;
+ float *data2;
+ size_t startp[3] = {0,0,0};
+ size_t countp[3] = {VLEN0,VLEN1,VLEN2};
+ size_t startp2[1] = {0};
+ size_t countp2[1] = {VLEN2};
+ int i = 0;
+ /* Create File */
+ printf("\t* Creating File:\tnc_create()\n");
+ if (nc_create(FILE_NAME_LIM, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR;
+
+ /* Set fill mode */
+ //printf("\t* Setting fill mode:\tnc_set_fill()\n");
+ //if(nc_set_fill(ncid,NC_FILL,NULL)) ERR;
+
+ /* Create Dimension */
+ printf("\t* Defining Unlimited Dimension:\tnc_def_dim()\n");
+ if (nc_def_dim(ncid, DIM_NAME, DIM_LEN_LIM, &dimid)) ERR;
+
+ /* Create ragged array type. */
+ printf("\t* Creating Ragged Array type:\tnc_def_vlen().\n");
+ if (nc_def_vlen(ncid, VLEN_NAME, NC_FLOAT, &typeid)) ERR;
+
+ /* Create a variable of typeid. */
+ printf("\t* Creating Variable using Ragged Arrayt Type:\tnc_def_var().\n");
+ if (nc_def_var(ncid, VAR_NAME1, typeid, 1, &dimid, &varid)) ERR;
+
+ /* Create a variable of type float. */
+ printf("\t* Creating secondary Variable using NC_FLOAT:\tnc_def_var().\n");
+ if (nc_def_var(ncid, VAR_NAME2, NC_FLOAT, 1, &dimid, &varid2)) ERR;
+
+ /* End define mode. */
+ printf("\t* Ending define mode:\tnc_enddef().\n");
+
+ /* Write out data for w */
+ printf("\t* Creating float data for secondary variable.\n");
+ data2 = (float*)malloc(sizeof(float) * VLEN2);
+ for(i = 0; i < VLEN2; i++) {
+ data2[i] = (float)i;
+ }
+
+ printf("\t* Puting data in secondary variable:\tnc_put_vara().\n");
+ if (nc_put_vara(ncid,varid2,startp2,countp2,data2)) ERR;
+
+ /***********/
+ /* Actually unnecessary to recreate the issue. */
+ /***********/
+
+
+ /* Write out varying-length data for v[0] and v[1]. Leave v[2] empty. */
+
+ dat0 = (float*)malloc(VLEN0 * sizeof(float));
+ for(i = 0; i < VLEN0; i++) {
+ dat0[i] = (float)i;
+ }
+ dat1 = (float*)malloc(VLEN1 * sizeof(float));
+ for(i = 0; i < VLEN1; i++) {
+ dat1[i] = (float)i;
+ }
+ dat2 = (float*)malloc(VLEN2 * sizeof(float));
+ for(i = 0; i < VLEN2; i++) {
+ dat2[i] = (float)i;
+ }
+
+ data[0].p = dat0;
+ data[0].len = VLEN0;
+
+ data[1].p = dat1;
+ data[1].len = VLEN1;
+
+ data[2].p = dat2;
+ data[2].len = VLEN2;
+
+ //printf("\t* Puting data in VLEN variable:\tnc_put_vara().\n");
+ //stat = nc_put_vara(ncid,varid,&startp,&countp,data);
+ //stat = nc_put_var(ncid,varid,&data);
+ //if(stat) ERR;
+
+
+
+ /* Close File. */
+ printf("\t* Closing file:\tnc_close().\n");
+ if (stat = nc_close(ncid)) ERR;
+
+
+ }
+
+
+ SUMMARIZE_ERR;
+ FINAL_RESULTS;
+
+}
diff --git a/nc_test4/tst_files3.c b/nc_test4/tst_files3.c
index 263a713..6f60cad 100644
--- a/nc_test4/tst_files3.c
+++ b/nc_test4/tst_files3.c
@@ -99,8 +99,8 @@ int dump_hdf_file(const float *data, int docompression)
hid_t file_spaceid, mem_spaceid, access_plistid, xfer_plistid;
herr_t status;
hsize_t dims[NDIMS] = {X_LEN, Y_LEN, Z_LEN};
- hsize_t start[NC_MAX_DIMS] = {0, 0, 0};
- hsize_t count[NC_MAX_DIMS] = {1, 1, Z_LEN};
+ hsize_t start[NDIMS] = {0, 0, 0};
+ hsize_t count[NDIMS] = {1, 1, Z_LEN};
/* create file */
file_id = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC,
diff --git a/nc_test4/tst_hdf5_file_compat.c b/nc_test4/tst_hdf5_file_compat.c
new file mode 100644
index 0000000..ff9e915
--- /dev/null
+++ b/nc_test4/tst_hdf5_file_compat.c
@@ -0,0 +1,63 @@
+/* This is part of the netCDF package.
+ Copyright 2016 University Corporation for Atmospheric Research/Unidata
+ See COPYRIGHT file for conditions of use.
+
+ Tests library ability to open files generated by a netcdf
+ instance linked against libhdf5 1.10.0. This is an issue at this point
+ because, without specifying libver bounds, netcdf linked against
+ libhdf5 1.8 cannot read those generated by libhdf5 1.10.0.
+
+ This test will undoubtedly not age well, but right now it is
+ fairly critical, and will help test if we've corrected the
+ issue.
+
+ Details: https://github.com/Unidata/netcdf-c/issues/250
+
+ Files testing against (copied from nc_test4):
+
+ * ref_hdf5_compat1.nc <- tst_vars.nc
+ * ref_hdf5_compat2.nc <- tst_vars4.nc
+ * ref_hdf5_compat3.nc <- tst_compounds.nc
+
+ */
+
+#include <nc_tests.h>
+#include "netcdf.h"
+
+
+#define FILE_NAME1 "ref_hdf5_compat1.nc"
+#define FILE_NAME2 "ref_hdf5_compat2.nc"
+#define FILE_NAME3 "ref_hdf5_compat3.nc"
+
+
+int main(int argc, char **argv) {
+
+ int res = 0;
+ int ncid = 0;
+
+ printf("\n*** Testing libhdf5 file compatibility (open files generated by hdf5 1.10).\n");
+
+ {
+ printf("Testing %s\n",FILE_NAME1);
+ if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR;
+ if (nc_close(ncid)) ERR;
+ }
+
+ {
+ printf("Testing %s\n",FILE_NAME2);
+ if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR;
+ if (nc_close(ncid)) ERR;
+ }
+
+ {
+ printf("Testing %s\n",FILE_NAME3);
+ if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR;
+ if (nc_close(ncid)) ERR;
+ }
+
+
+
+ SUMMARIZE_ERR;
+ FINAL_RESULTS;
+
+}
diff --git a/nc_test4/tst_mode.c b/nc_test4/tst_mode.c
new file mode 100644
index 0000000..24594c8
--- /dev/null
+++ b/nc_test4/tst_mode.c
@@ -0,0 +1,41 @@
+/**
+ * @file
+ * Test some illegal mode combinations
+ *
+ */
+
+#include "nc_tests.h"
+#include "netcdf_par.h"
+
+#define FILE_NAME "tst_mode.nc"
+
+int
+main(int argc, char** argv)
+{
+ int ncid,varid;
+ int retval;
+
+ printf("\n*** Testing illegal mode combinations\n");
+
+ MPI_Init(&argc,&argv);
+
+ printf("*** Testing create + MPIO + fletcher32\n");
+ if ((retval = nc_create_par(FILE_NAME, NC_CLOBBER|NC_NETCDF4|NC_MPIIO, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid))) ERR;
+ if ((retval = nc_def_var(ncid,"whatever",NC_INT,0,NULL,&varid))) ERR;
+ retval = nc_def_var_fletcher32(ncid,varid,NC_FLETCHER32);
+ if(retval != NC_EINVAL) ERR;
+ if ((retval = nc_abort(ncid))) ERR;
+
+ printf("*** Testing create + MPIO + deflation\n");
+ if ((retval = nc_create_par(FILE_NAME, NC_CLOBBER|NC_NETCDF4|NC_MPIIO, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid))) ERR;
+ if ((retval = nc_def_var(ncid,"whatever",NC_INT,0,NULL,&varid))) ERR;
+ retval = nc_def_var_deflate(ncid,varid, NC_NOSHUFFLE, 1, 1);
+ if(retval != NC_EINVAL) ERR;
+ if ((retval = nc_abort(ncid))) ERR;
+
+ MPI_Finalize();
+
+ SUMMARIZE_ERR;
+ FINAL_RESULTS;
+}
+
diff --git a/ncdap_test/Makefile.in b/ncdap_test/Makefile.in
index 4e4c226..a7b412c 100644
--- a/ncdap_test/Makefile.in
+++ b/ncdap_test/Makefile.in
@@ -561,6 +561,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdap_test/expected3/Makefile.in b/ncdap_test/expected3/Makefile.in
index 14d0f47..fedad9e 100644
--- a/ncdap_test/expected3/Makefile.in
+++ b/ncdap_test/expected3/Makefile.in
@@ -174,6 +174,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdap_test/expected4/Makefile.in b/ncdap_test/expected4/Makefile.in
index 929a2fa..8cadbb3 100644
--- a/ncdap_test/expected4/Makefile.in
+++ b/ncdap_test/expected4/Makefile.in
@@ -172,6 +172,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdap_test/expectremote3/Makefile.in b/ncdap_test/expectremote3/Makefile.in
index a67f79b..08382c0 100644
--- a/ncdap_test/expectremote3/Makefile.in
+++ b/ncdap_test/expectremote3/Makefile.in
@@ -174,6 +174,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdap_test/expectremote4/Makefile.in b/ncdap_test/expectremote4/Makefile.in
index 2d353a7..9952db3 100644
--- a/ncdap_test/expectremote4/Makefile.in
+++ b/ncdap_test/expectremote4/Makefile.in
@@ -174,6 +174,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdap_test/test_partvar.c b/ncdap_test/test_partvar.c
index 16a06b4..d738150 100644
--- a/ncdap_test/test_partvar.c
+++ b/ncdap_test/test_partvar.c
@@ -179,7 +179,7 @@ check(float* target, size_t* start, size_t* count)
int eq = floateq(result[offset],expected[offset]);
if(eq == 0) {
fprintf(stderr,"fail: result[%lu] = %f ; expected[%lu] = %f\n",
- offset,result[offset],offset,expected[offset]);
+ (unsigned long)offset,result[offset],(unsigned long)offset,expected[offset]);
ok=0;
}
odom_incr(odom);
diff --git a/ncdap_test/testdata3/Makefile.in b/ncdap_test/testdata3/Makefile.in
index 55cf646..c7b6d04 100644
--- a/ncdap_test/testdata3/Makefile.in
+++ b/ncdap_test/testdata3/Makefile.in
@@ -174,6 +174,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdap_test/tst_remote.sh b/ncdap_test/tst_remote.sh
index 7034bf6..3c240ce 100755
--- a/ncdap_test/tst_remote.sh
+++ b/ncdap_test/tst_remote.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-
+set -x
set -e
quiet=0
@@ -249,6 +249,7 @@ rm -f ./.dodsrc ./.ocrc ./.daprc
cd ${RESULTSDIR}
for t in ${TESTSET} ; do
+
# see if we are using constraints
#index=`expr index "${t}" ";"`
@@ -302,6 +303,7 @@ for t in ${TESTSET} ; do
status=0
+ echo "command = ${TIMECMD} ${VALGRIND} ${NCDUMP} ${url} \> ${name}.dmp"
if ${TIMECMD} ${VALGRIND} ${NCDUMP} "${url}" > ${name}.dmp ; then status=$status; else status=1; fi
# compare with expected
if diff -w ${EXPECTED}/${name}.dmp ${name}.dmp
diff --git a/ncdump/Makefile.in b/ncdump/Makefile.in
index e41bbf2..4329d51 100644
--- a/ncdump/Makefile.in
+++ b/ncdump/Makefile.in
@@ -674,6 +674,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdump/cdl/Makefile.in b/ncdump/cdl/Makefile.in
index e33daec..3c81393 100644
--- a/ncdump/cdl/Makefile.in
+++ b/ncdump/cdl/Makefile.in
@@ -174,6 +174,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdump/ctest.c b/ncdump/ctest.c
new file mode 100644
index 0000000..8b9905e
--- /dev/null
+++ b/ncdump/ctest.c
@@ -0,0 +1,1456 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <netcdf.h>
+
+
+void
+check_err(const int stat, const int line, const char *file) {
+ if (stat != NC_NOERR) {
+ (void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
+ fflush(stderr);
+ exit(1);
+ }
+}
+
+int
+main() {/* create ctest0.nc */
+
+ int stat; /* return status */
+ int ncid; /* netCDF id */
+
+ /* dimension ids */
+ int Dr_dim;
+ int D1_dim;
+ int D2_dim;
+ int D3_dim;
+ int dim_MINUS_name_MINUS_dashes_dim;
+ int dim_PERIOD_name_PERIOD_dots_dim;
+ int dim_PLUS_name_PLUS_plusses_dim;
+ int dim_ATSIGN_name_ATSIGN_ats_dim;
+
+ /* dimension lengths */
+ size_t Dr_len = NC_UNLIMITED;
+ size_t D1_len = 1;
+ size_t D2_len = 2;
+ size_t D3_len = 3;
+ size_t dim_MINUS_name_MINUS_dashes_len = 4;
+ size_t dim_PERIOD_name_PERIOD_dots_len = 5;
+ size_t dim_PLUS_name_PLUS_plusses_len = 6;
+ size_t dim_ATSIGN_name_ATSIGN_ats_len = 7;
+
+ /* variable ids */
+ int c_id;
+ int b_id;
+ int s_id;
+ int i_id;
+ int f_id;
+ int d_id;
+ int cr_id;
+ int br_id;
+ int sr_id;
+ int ir_id;
+ int fr_id;
+ int dr_id;
+ int c1_id;
+ int b1_id;
+ int s1_id;
+ int i1_id;
+ int f1_id;
+ int d1_id;
+ int c2_id;
+ int b2_id;
+ int s2_id;
+ int i2_id;
+ int f2_id;
+ int d2_id;
+ int c3_id;
+ int b3_id;
+ int s3_id;
+ int i3_id;
+ int f3_id;
+ int d3_id;
+ int cr1_id;
+ int br2_id;
+ int sr3_id;
+ int f11_id;
+ int d12_id;
+ int c13_id;
+ int s21_id;
+ int i22_id;
+ int f23_id;
+ int c31_id;
+ int b32_id;
+ int s33_id;
+ int sr11_id;
+ int ir12_id;
+ int fr13_id;
+ int cr21_id;
+ int br22_id;
+ int sr23_id;
+ int fr31_id;
+ int dr32_id;
+ int cr33_id;
+ int c111_id;
+ int b112_id;
+ int s113_id;
+ int f121_id;
+ int d122_id;
+ int c123_id;
+ int s131_id;
+ int i132_id;
+ int f133_id;
+ int f211_id;
+ int d212_id;
+ int c213_id;
+ int s221_id;
+ int i222_id;
+ int f223_id;
+ int c231_id;
+ int b232_id;
+ int s233_id;
+ int s311_id;
+ int i312_id;
+ int f313_id;
+ int var_MINUS_name_MINUS_dashes_id;
+ int var_PERIOD_name_PERIOD_dots_id;
+ int var_PLUS_name_PLUS_plusses_id;
+ int var_ATSIGN_name_ATSIGN_ats_id;
+
+ /* rank (number of dimensions) for each variable */
+# define RANK_c 0
+# define RANK_b 0
+# define RANK_s 0
+# define RANK_i 0
+# define RANK_f 0
+# define RANK_d 0
+# define RANK_cr 1
+# define RANK_br 1
+# define RANK_sr 1
+# define RANK_ir 1
+# define RANK_fr 1
+# define RANK_dr 1
+# define RANK_c1 1
+# define RANK_b1 1
+# define RANK_s1 1
+# define RANK_i1 1
+# define RANK_f1 1
+# define RANK_d1 1
+# define RANK_c2 1
+# define RANK_b2 1
+# define RANK_s2 1
+# define RANK_i2 1
+# define RANK_f2 1
+# define RANK_d2 1
+# define RANK_c3 1
+# define RANK_b3 1
+# define RANK_s3 1
+# define RANK_i3 1
+# define RANK_f3 1
+# define RANK_d3 1
+# define RANK_cr1 2
+# define RANK_br2 2
+# define RANK_sr3 2
+# define RANK_f11 2
+# define RANK_d12 2
+# define RANK_c13 2
+# define RANK_s21 2
+# define RANK_i22 2
+# define RANK_f23 2
+# define RANK_c31 2
+# define RANK_b32 2
+# define RANK_s33 2
+# define RANK_sr11 3
+# define RANK_ir12 3
+# define RANK_fr13 3
+# define RANK_cr21 3
+# define RANK_br22 3
+# define RANK_sr23 3
+# define RANK_fr31 3
+# define RANK_dr32 3
+# define RANK_cr33 3
+# define RANK_c111 3
+# define RANK_b112 3
+# define RANK_s113 3
+# define RANK_f121 3
+# define RANK_d122 3
+# define RANK_c123 3
+# define RANK_s131 3
+# define RANK_i132 3
+# define RANK_f133 3
+# define RANK_f211 3
+# define RANK_d212 3
+# define RANK_c213 3
+# define RANK_s221 3
+# define RANK_i222 3
+# define RANK_f223 3
+# define RANK_c231 3
+# define RANK_b232 3
+# define RANK_s233 3
+# define RANK_s311 3
+# define RANK_i312 3
+# define RANK_f313 3
+# define RANK_var_MINUS_name_MINUS_dashes 0
+# define RANK_var_PERIOD_name_PERIOD_dots 0
+# define RANK_var_PLUS_name_PLUS_plusses 0
+# define RANK_var_ATSIGN_name_ATSIGN_ats 0
+
+ /* variable shapes */
+ int cr_dims[RANK_cr];
+ int br_dims[RANK_br];
+ int sr_dims[RANK_sr];
+ int ir_dims[RANK_ir];
+ int fr_dims[RANK_fr];
+ int dr_dims[RANK_dr];
+ int c1_dims[RANK_c1];
+ int b1_dims[RANK_b1];
+ int s1_dims[RANK_s1];
+ int i1_dims[RANK_i1];
+ int f1_dims[RANK_f1];
+ int d1_dims[RANK_d1];
+ int c2_dims[RANK_c2];
+ int b2_dims[RANK_b2];
+ int s2_dims[RANK_s2];
+ int i2_dims[RANK_i2];
+ int f2_dims[RANK_f2];
+ int d2_dims[RANK_d2];
+ int c3_dims[RANK_c3];
+ int b3_dims[RANK_b3];
+ int s3_dims[RANK_s3];
+ int i3_dims[RANK_i3];
+ int f3_dims[RANK_f3];
+ int d3_dims[RANK_d3];
+ int cr1_dims[RANK_cr1];
+ int br2_dims[RANK_br2];
+ int sr3_dims[RANK_sr3];
+ int f11_dims[RANK_f11];
+ int d12_dims[RANK_d12];
+ int c13_dims[RANK_c13];
+ int s21_dims[RANK_s21];
+ int i22_dims[RANK_i22];
+ int f23_dims[RANK_f23];
+ int c31_dims[RANK_c31];
+ int b32_dims[RANK_b32];
+ int s33_dims[RANK_s33];
+ int sr11_dims[RANK_sr11];
+ int ir12_dims[RANK_ir12];
+ int fr13_dims[RANK_fr13];
+ int cr21_dims[RANK_cr21];
+ int br22_dims[RANK_br22];
+ int sr23_dims[RANK_sr23];
+ int fr31_dims[RANK_fr31];
+ int dr32_dims[RANK_dr32];
+ int cr33_dims[RANK_cr33];
+ int c111_dims[RANK_c111];
+ int b112_dims[RANK_b112];
+ int s113_dims[RANK_s113];
+ int f121_dims[RANK_f121];
+ int d122_dims[RANK_d122];
+ int c123_dims[RANK_c123];
+ int s131_dims[RANK_s131];
+ int i132_dims[RANK_i132];
+ int f133_dims[RANK_f133];
+ int f211_dims[RANK_f211];
+ int d212_dims[RANK_d212];
+ int c213_dims[RANK_c213];
+ int s221_dims[RANK_s221];
+ int i222_dims[RANK_i222];
+ int f223_dims[RANK_f223];
+ int c231_dims[RANK_c231];
+ int b232_dims[RANK_b232];
+ int s233_dims[RANK_s233];
+ int s311_dims[RANK_s311];
+ int i312_dims[RANK_i312];
+ int f313_dims[RANK_f313];
+
+ /* enter define mode */
+ stat = nc_create("ctest0.nc", NC_CLOBBER, &ncid);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* define dimensions */
+ stat = nc_def_dim(ncid, "Dr", Dr_len, &Dr_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "D1", D1_len, &D1_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "D2", D2_len, &D2_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "D3", D3_len, &D3_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim-name-dashes", dim_MINUS_name_MINUS_dashes_len, &dim_MINUS_name_MINUS_dashes_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim.name.dots", dim_PERIOD_name_PERIOD_dots_len, &dim_PERIOD_name_PERIOD_dots_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim+name+plusses", dim_PLUS_name_PLUS_plusses_len, &dim_PLUS_name_PLUS_plusses_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim at name@ats", dim_ATSIGN_name_ATSIGN_ats_len, &dim_ATSIGN_name_ATSIGN_ats_dim);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* define variables */
+
+ stat = nc_def_var(ncid, "c", NC_CHAR, RANK_c, 0, &c_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "b", NC_BYTE, RANK_b, 0, &b_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "s", NC_SHORT, RANK_s, 0, &s_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "i", NC_INT, RANK_i, 0, &i_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "f", NC_FLOAT, RANK_f, 0, &f_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "d", NC_DOUBLE, RANK_d, 0, &d_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "cr", NC_CHAR, RANK_cr, cr_dims, &cr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ br_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "br", NC_BYTE, RANK_br, br_dims, &br_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "sr", NC_SHORT, RANK_sr, sr_dims, &sr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ ir_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "ir", NC_INT, RANK_ir, ir_dims, &ir_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ fr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "fr", NC_FLOAT, RANK_fr, fr_dims, &fr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ dr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "dr", NC_DOUBLE, RANK_dr, dr_dims, &dr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "c1", NC_CHAR, RANK_c1, c1_dims, &c1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "b1", NC_BYTE, RANK_b1, b1_dims, &b1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "s1", NC_SHORT, RANK_s1, s1_dims, &s1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "i1", NC_INT, RANK_i1, i1_dims, &i1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "f1", NC_FLOAT, RANK_f1, f1_dims, &f1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "d1", NC_DOUBLE, RANK_d1, d1_dims, &d1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "c2", NC_CHAR, RANK_c2, c2_dims, &c2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "b2", NC_BYTE, RANK_b2, b2_dims, &b2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "s2", NC_SHORT, RANK_s2, s2_dims, &s2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "i2", NC_INT, RANK_i2, i2_dims, &i2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "f2", NC_FLOAT, RANK_f2, f2_dims, &f2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "d2", NC_DOUBLE, RANK_d2, d2_dims, &d2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "c3", NC_CHAR, RANK_c3, c3_dims, &c3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "b3", NC_BYTE, RANK_b3, b3_dims, &b3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "s3", NC_SHORT, RANK_s3, s3_dims, &s3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "i3", NC_INT, RANK_i3, i3_dims, &i3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "f3", NC_FLOAT, RANK_f3, f3_dims, &f3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "d3", NC_DOUBLE, RANK_d3, d3_dims, &d3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr1_dims[0] = Dr_dim;
+ cr1_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "cr1", NC_CHAR, RANK_cr1, cr1_dims, &cr1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ br2_dims[0] = Dr_dim;
+ br2_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "br2", NC_BYTE, RANK_br2, br2_dims, &br2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr3_dims[0] = Dr_dim;
+ sr3_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "sr3", NC_SHORT, RANK_sr3, sr3_dims, &sr3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f11_dims[0] = D1_dim;
+ f11_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "f11", NC_FLOAT, RANK_f11, f11_dims, &f11_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d12_dims[0] = D1_dim;
+ d12_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "d12", NC_DOUBLE, RANK_d12, d12_dims, &d12_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c13_dims[0] = D1_dim;
+ c13_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "c13", NC_CHAR, RANK_c13, c13_dims, &c13_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s21_dims[0] = D2_dim;
+ s21_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "s21", NC_SHORT, RANK_s21, s21_dims, &s21_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i22_dims[0] = D2_dim;
+ i22_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "i22", NC_INT, RANK_i22, i22_dims, &i22_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f23_dims[0] = D2_dim;
+ f23_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "f23", NC_FLOAT, RANK_f23, f23_dims, &f23_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c31_dims[0] = D3_dim;
+ c31_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "c31", NC_CHAR, RANK_c31, c31_dims, &c31_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b32_dims[0] = D3_dim;
+ b32_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "b32", NC_BYTE, RANK_b32, b32_dims, &b32_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s33_dims[0] = D3_dim;
+ s33_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "s33", NC_SHORT, RANK_s33, s33_dims, &s33_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr11_dims[0] = Dr_dim;
+ sr11_dims[1] = D1_dim;
+ sr11_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "sr11", NC_SHORT, RANK_sr11, sr11_dims, &sr11_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ ir12_dims[0] = Dr_dim;
+ ir12_dims[1] = D1_dim;
+ ir12_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "ir12", NC_INT, RANK_ir12, ir12_dims, &ir12_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ fr13_dims[0] = Dr_dim;
+ fr13_dims[1] = D1_dim;
+ fr13_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "fr13", NC_FLOAT, RANK_fr13, fr13_dims, &fr13_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr21_dims[0] = Dr_dim;
+ cr21_dims[1] = D2_dim;
+ cr21_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "cr21", NC_CHAR, RANK_cr21, cr21_dims, &cr21_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ br22_dims[0] = Dr_dim;
+ br22_dims[1] = D2_dim;
+ br22_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "br22", NC_BYTE, RANK_br22, br22_dims, &br22_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr23_dims[0] = Dr_dim;
+ sr23_dims[1] = D2_dim;
+ sr23_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "sr23", NC_SHORT, RANK_sr23, sr23_dims, &sr23_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ fr31_dims[0] = Dr_dim;
+ fr31_dims[1] = D3_dim;
+ fr31_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "fr31", NC_FLOAT, RANK_fr31, fr31_dims, &fr31_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ dr32_dims[0] = Dr_dim;
+ dr32_dims[1] = D3_dim;
+ dr32_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "dr32", NC_DOUBLE, RANK_dr32, dr32_dims, &dr32_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr33_dims[0] = Dr_dim;
+ cr33_dims[1] = D3_dim;
+ cr33_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "cr33", NC_CHAR, RANK_cr33, cr33_dims, &cr33_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c111_dims[0] = D1_dim;
+ c111_dims[1] = D1_dim;
+ c111_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "c111", NC_CHAR, RANK_c111, c111_dims, &c111_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b112_dims[0] = D1_dim;
+ b112_dims[1] = D1_dim;
+ b112_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "b112", NC_BYTE, RANK_b112, b112_dims, &b112_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s113_dims[0] = D1_dim;
+ s113_dims[1] = D1_dim;
+ s113_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "s113", NC_SHORT, RANK_s113, s113_dims, &s113_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f121_dims[0] = D1_dim;
+ f121_dims[1] = D2_dim;
+ f121_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "f121", NC_FLOAT, RANK_f121, f121_dims, &f121_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d122_dims[0] = D1_dim;
+ d122_dims[1] = D2_dim;
+ d122_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "d122", NC_DOUBLE, RANK_d122, d122_dims, &d122_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c123_dims[0] = D1_dim;
+ c123_dims[1] = D2_dim;
+ c123_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "c123", NC_CHAR, RANK_c123, c123_dims, &c123_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s131_dims[0] = D1_dim;
+ s131_dims[1] = D3_dim;
+ s131_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "s131", NC_SHORT, RANK_s131, s131_dims, &s131_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i132_dims[0] = D1_dim;
+ i132_dims[1] = D3_dim;
+ i132_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "i132", NC_INT, RANK_i132, i132_dims, &i132_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f133_dims[0] = D1_dim;
+ f133_dims[1] = D3_dim;
+ f133_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "f133", NC_FLOAT, RANK_f133, f133_dims, &f133_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f211_dims[0] = D2_dim;
+ f211_dims[1] = D1_dim;
+ f211_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "f211", NC_FLOAT, RANK_f211, f211_dims, &f211_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d212_dims[0] = D2_dim;
+ d212_dims[1] = D1_dim;
+ d212_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "d212", NC_DOUBLE, RANK_d212, d212_dims, &d212_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c213_dims[0] = D2_dim;
+ c213_dims[1] = D1_dim;
+ c213_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "c213", NC_CHAR, RANK_c213, c213_dims, &c213_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s221_dims[0] = D2_dim;
+ s221_dims[1] = D2_dim;
+ s221_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "s221", NC_SHORT, RANK_s221, s221_dims, &s221_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i222_dims[0] = D2_dim;
+ i222_dims[1] = D2_dim;
+ i222_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "i222", NC_INT, RANK_i222, i222_dims, &i222_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f223_dims[0] = D2_dim;
+ f223_dims[1] = D2_dim;
+ f223_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "f223", NC_FLOAT, RANK_f223, f223_dims, &f223_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c231_dims[0] = D2_dim;
+ c231_dims[1] = D3_dim;
+ c231_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "c231", NC_CHAR, RANK_c231, c231_dims, &c231_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b232_dims[0] = D2_dim;
+ b232_dims[1] = D3_dim;
+ b232_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "b232", NC_BYTE, RANK_b232, b232_dims, &b232_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s233_dims[0] = D2_dim;
+ s233_dims[1] = D3_dim;
+ s233_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "s233", NC_SHORT, RANK_s233, s233_dims, &s233_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s311_dims[0] = D3_dim;
+ s311_dims[1] = D1_dim;
+ s311_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "s311", NC_SHORT, RANK_s311, s311_dims, &s311_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i312_dims[0] = D3_dim;
+ i312_dims[1] = D1_dim;
+ i312_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "i312", NC_INT, RANK_i312, i312_dims, &i312_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f313_dims[0] = D3_dim;
+ f313_dims[1] = D1_dim;
+ f313_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "f313", NC_FLOAT, RANK_f313, f313_dims, &f313_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var-name-dashes", NC_DOUBLE, RANK_var_MINUS_name_MINUS_dashes, 0, &var_MINUS_name_MINUS_dashes_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var.name.dots", NC_DOUBLE, RANK_var_PERIOD_name_PERIOD_dots, 0, &var_PERIOD_name_PERIOD_dots_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var+name+plusses", NC_DOUBLE, RANK_var_PLUS_name_PLUS_plusses, 0, &var_PLUS_name_PLUS_plusses_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var at name@ats", NC_DOUBLE, RANK_var_ATSIGN_name_ATSIGN_ats, 0, &var_ATSIGN_name_ATSIGN_ats_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* assign global attributes */
+
+ {
+ stat = nc_put_att_text(ncid, NC_GLOBAL, "Gc", 1, "");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const signed char c0_Gb_att[2] = {-128, 127} ;
+ stat = nc_put_att_schar(ncid, NC_GLOBAL, "Gb", NC_BYTE, 2, c0_Gb_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const short c0_Gs_att[3] = {-32768, 0, 32767} ;
+ stat = nc_put_att_short(ncid, NC_GLOBAL, "Gs", NC_SHORT, 3, c0_Gs_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gi_att[3] = {-2147483647, 0, 2147483647} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gi", NC_INT, 3, c0_Gi_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const float c0_Gf_att[3] = {((float)-9.9999996e+35), ((float)0), ((float)9.9999996e+35)} ;
+ stat = nc_put_att_float(ncid, NC_GLOBAL, "Gf", NC_FLOAT, 3, c0_Gf_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const double c0_Gd_att[3] = {((double)-1e+308), ((double)0), ((double)1e+308)} ;
+ stat = nc_put_att_double(ncid, NC_GLOBAL, "Gd", NC_DOUBLE, 3, c0_Gd_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_MINUS_name_MINUS_dashes_att[1] = {-1} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt-name-dashes", NC_INT, 1, c0_Gatt_MINUS_name_MINUS_dashes_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_DOT_name_DOT_dots_att[1] = {-2} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt.name.dots", NC_INT, 1, c0_Gatt_DOT_name_DOT_dots_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_PLUS_name_PLUS_plusses_att[1] = {-3} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt+name+plusses", NC_INT, 1, c0_Gatt_PLUS_name_PLUS_plusses_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_ATSIGN_name_ATSIGN_ats_att[1] = {-4} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt at name@ats", NC_INT, 1, c0_Gatt_ATSIGN_name_ATSIGN_ats_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ /* assign per-variable attributes */
+
+ {
+ static const int c0_att_MINUS_name_MINUS_dashes_att[1] = {4} ;
+ stat = nc_put_att_int(ncid, c_id, "att-name-dashes", NC_INT, 1, c0_att_MINUS_name_MINUS_dashes_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_att_DOT_name_DOT_dots_att[1] = {5} ;
+ stat = nc_put_att_int(ncid, c_id, "att.name.dots", NC_INT, 1, c0_att_DOT_name_DOT_dots_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_att_PLUS_name_PLUS_plusses_att[1] = {6} ;
+ stat = nc_put_att_int(ncid, c_id, "att+name+plusses", NC_INT, 1, c0_att_PLUS_name_PLUS_plusses_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_att_ATSIGN_name_ATSIGN_ats_att[1] = {7} ;
+ stat = nc_put_att_int(ncid, c_id, "att at name@ats", NC_INT, 1, c0_att_ATSIGN_name_ATSIGN_ats_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ stat = nc_put_att_text(ncid, b_id, "c", 1, "");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const signed char c0_b_att[4] = {0, 127, -128, -1} ;
+ stat = nc_put_att_schar(ncid, s_id, "b", NC_BYTE, 4, c0_b_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const short c0_s_att[3] = {-32768, 0, 32767} ;
+ stat = nc_put_att_short(ncid, s_id, "s", NC_SHORT, 3, c0_s_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_i_att[3] = {-2147483647, 0, 2147483647} ;
+ stat = nc_put_att_int(ncid, i_id, "i", NC_INT, 3, c0_i_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const float c0_f_att[3] = {((float)-9.9999996e+35), ((float)0), ((float)9.9999996e+35)} ;
+ stat = nc_put_att_float(ncid, i_id, "f", NC_FLOAT, 3, c0_f_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const double c0_d_att[3] = {((double)-1e+308), ((double)0), ((double)1e+308)} ;
+ stat = nc_put_att_double(ncid, i_id, "d", NC_DOUBLE, 3, c0_d_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ stat = nc_put_att_text(ncid, f_id, "c", 1, "x");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ stat = nc_put_att_text(ncid, d_id, "c", 8, "abcd\tZ$&");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ /* leave define mode */
+ stat = nc_enddef (ncid);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* assign variable data */
+
+ {
+ size_t count = 0;
+ static char c_data[1] = {'2'};
+ stat = nc_put_var1(ncid, c_id, &count, c_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static signed char b_data[1] = {-2};
+ stat = nc_put_var1(ncid, b_id, &count, b_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static short s_data[1] = {-5};
+ stat = nc_put_var1(ncid, s_id, &count, s_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static int i_data[1] = {-20};
+ stat = nc_put_var1(ncid, i_id, &count, i_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static float f_data[1] = {((float)-9)};
+ stat = nc_put_var1(ncid, f_id, &count, f_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static double d_data[1] = {((double)-10)};
+ stat = nc_put_var1(ncid, d_id, &count, d_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr_data = "ab" ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char br_data[2] = {-128, 127} ;
+ size_t br_startset[1] = {0} ;
+ size_t br_countset[1] = {2};
+ stat = nc_put_vara(ncid, br_id, br_startset, br_countset, br_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr_data[2] = {-32768, 32767} ;
+ size_t sr_startset[1] = {0} ;
+ size_t sr_countset[1] = {2};
+ stat = nc_put_vara(ncid, sr_id, sr_startset, sr_countset, sr_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int ir_data[2] = {-2147483646, 2147483647} ;
+ size_t ir_startset[1] = {0} ;
+ size_t ir_countset[1] = {2};
+ stat = nc_put_vara(ncid, ir_id, ir_startset, ir_countset, ir_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float fr_data[2] = {((float)-9.9999996e+35), ((float)9.9999996e+35)} ;
+ size_t fr_startset[1] = {0} ;
+ size_t fr_countset[1] = {2};
+ stat = nc_put_vara(ncid, fr_id, fr_startset, fr_countset, fr_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double dr_data[2] = {((double)-1e+308), ((double)1e+308)} ;
+ size_t dr_startset[1] = {0} ;
+ size_t dr_countset[1] = {2};
+ stat = nc_put_vara(ncid, dr_id, dr_startset, dr_countset, dr_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c1_data = "\000" ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b1_data[1] = {-128} ;
+ size_t b1_startset[1] = {0} ;
+ size_t b1_countset[1] = {1};
+ stat = nc_put_vara(ncid, b1_id, b1_startset, b1_countset, b1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s1_data[1] = {-32768} ;
+ size_t s1_startset[1] = {0} ;
+ size_t s1_countset[1] = {1};
+ stat = nc_put_vara(ncid, s1_id, s1_startset, s1_countset, s1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i1_data[1] = {-2147483646} ;
+ size_t i1_startset[1] = {0} ;
+ size_t i1_countset[1] = {1};
+ stat = nc_put_vara(ncid, i1_id, i1_startset, i1_countset, i1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f1_data[1] = {((float)-9.9999996e+35)} ;
+ size_t f1_startset[1] = {0} ;
+ size_t f1_countset[1] = {1};
+ stat = nc_put_vara(ncid, f1_id, f1_startset, f1_countset, f1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d1_data[1] = {((double)-1e+308)} ;
+ size_t d1_startset[1] = {0} ;
+ size_t d1_countset[1] = {1};
+ stat = nc_put_vara(ncid, d1_id, d1_startset, d1_countset, d1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c2_data = "ab" ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b2_data[2] = {-128, 127} ;
+ size_t b2_startset[1] = {0} ;
+ size_t b2_countset[1] = {2};
+ stat = nc_put_vara(ncid, b2_id, b2_startset, b2_countset, b2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s2_data[2] = {-32768, 32767} ;
+ size_t s2_startset[1] = {0} ;
+ size_t s2_countset[1] = {2};
+ stat = nc_put_vara(ncid, s2_id, s2_startset, s2_countset, s2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i2_data[2] = {-2147483646, 2147483647} ;
+ size_t i2_startset[1] = {0} ;
+ size_t i2_countset[1] = {2};
+ stat = nc_put_vara(ncid, i2_id, i2_startset, i2_countset, i2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f2_data[2] = {((float)-9.9999996e+35), ((float)9.9999996e+35)} ;
+ size_t f2_startset[1] = {0} ;
+ size_t f2_countset[1] = {2};
+ stat = nc_put_vara(ncid, f2_id, f2_startset, f2_countset, f2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d2_data[2] = {((double)-1e+308), ((double)1e+308)} ;
+ size_t d2_startset[1] = {0} ;
+ size_t d2_countset[1] = {2};
+ stat = nc_put_vara(ncid, d2_id, d2_startset, d2_countset, d2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c3_data = "\001\177." ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b3_data[3] = {-128, 127, -1} ;
+ size_t b3_startset[1] = {0} ;
+ size_t b3_countset[1] = {3};
+ stat = nc_put_vara(ncid, b3_id, b3_startset, b3_countset, b3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s3_data[3] = {-32768, 0, 32767} ;
+ size_t s3_startset[1] = {0} ;
+ size_t s3_countset[1] = {3};
+ stat = nc_put_vara(ncid, s3_id, s3_startset, s3_countset, s3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i3_data[3] = {-2147483646, 0, 2147483647} ;
+ size_t i3_startset[1] = {0} ;
+ size_t i3_countset[1] = {3};
+ stat = nc_put_vara(ncid, i3_id, i3_startset, i3_countset, i3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f3_data[3] = {((float)-9.9999996e+35), ((float)0), ((float)9.9999996e+35)} ;
+ size_t f3_startset[1] = {0} ;
+ size_t f3_countset[1] = {3};
+ stat = nc_put_vara(ncid, f3_id, f3_startset, f3_countset, f3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d3_data[3] = {((double)-1e+308), ((double)0), ((double)1e+308)} ;
+ size_t d3_startset[1] = {0} ;
+ size_t d3_countset[1] = {3};
+ stat = nc_put_vara(ncid, d3_id, d3_startset, d3_countset, d3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr1_data = "xy" ;
+ size_t cr1_startset[2] = {0, 0} ;
+ size_t cr1_countset[2] = {2, 1};
+ stat = nc_put_vara(ncid, cr1_id, cr1_startset, cr1_countset, cr1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char br2_data[4] = {-24, -26, -20, -22} ;
+ size_t br2_startset[2] = {0, 0} ;
+ size_t br2_countset[2] = {2, 2};
+ stat = nc_put_vara(ncid, br2_id, br2_startset, br2_countset, br2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr3_data[6] = {-375, -380, -385, -350, -355, -360} ;
+ size_t sr3_startset[2] = {0, 0} ;
+ size_t sr3_countset[2] = {2, 3};
+ stat = nc_put_vara(ncid, sr3_id, sr3_startset, sr3_countset, sr3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f11_data[1] = {((float)-2187)} ;
+ size_t f11_startset[2] = {0, 0} ;
+ size_t f11_countset[2] = {1, 1};
+ stat = nc_put_vara(ncid, f11_id, f11_startset, f11_countset, f11_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d12_data[2] = {((double)-3000), ((double)-3010)} ;
+ size_t d12_startset[2] = {0, 0} ;
+ size_t d12_countset[2] = {1, 2};
+ stat = nc_put_vara(ncid, d12_id, d12_startset, d12_countset, d12_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c13_data = "\tb\177" ;
+ size_t c13_startset[2] = {0, 0} ;
+ size_t c13_countset[2] = {1, 3};
+ stat = nc_put_vara(ncid, c13_id, c13_startset, c13_countset, c13_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s21_data[2] = {-375, -350} ;
+ size_t s21_startset[2] = {0, 0} ;
+ size_t s21_countset[2] = {2, 1};
+ stat = nc_put_vara(ncid, s21_id, s21_startset, s21_countset, s21_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i22_data[4] = {-24000, -24020, -23600, -23620} ;
+ size_t i22_startset[2] = {0, 0} ;
+ size_t i22_countset[2] = {2, 2};
+ stat = nc_put_vara(ncid, i22_id, i22_startset, i22_countset, i22_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f23_data[6] = {((float)-2187), ((float)-2196), ((float)-2205), ((float)-2106), ((float)-2115), ((float)-2124)} ;
+ size_t f23_startset[2] = {0, 0} ;
+ size_t f23_countset[2] = {2, 3};
+ stat = nc_put_vara(ncid, f23_id, f23_startset, f23_countset, f23_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c31_data = "+- " ;
+ size_t c31_startset[2] = {0, 0} ;
+ size_t c31_countset[2] = {3, 1};
+ stat = nc_put_vara(ncid, c31_id, c31_startset, c31_countset, c31_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b32_data[6] = {-24, -26, -20, -22, -16, -18} ;
+ size_t b32_startset[2] = {0, 0} ;
+ size_t b32_countset[2] = {3, 2};
+ stat = nc_put_vara(ncid, b32_id, b32_startset, b32_countset, b32_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s33_data[9] = {-375, -380, -385, -350, -355, -360, -325, -330, -335} ;
+ size_t s33_startset[2] = {0, 0} ;
+ size_t s33_countset[2] = {3, 3};
+ stat = nc_put_vara(ncid, s33_id, s33_startset, s33_countset, s33_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr11_data[2] = {2500, 2375} ;
+ size_t sr11_startset[3] = {0, 0, 0} ;
+ size_t sr11_countset[3] = {2, 1, 1};
+ stat = nc_put_vara(ncid, sr11_id, sr11_startset, sr11_countset, sr11_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int ir12_data[4] = {640000, 639980, 632000, 631980} ;
+ size_t ir12_startset[3] = {0, 0, 0} ;
+ size_t ir12_countset[3] = {2, 1, 2};
+ stat = nc_put_vara(ncid, ir12_id, ir12_startset, ir12_countset, ir12_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float fr13_data[6] = {((float)26244), ((float)26235), ((float)26226), ((float)25515), ((float)25506), ((float)25497)} ;
+ size_t fr13_startset[3] = {0, 0, 0} ;
+ size_t fr13_countset[3] = {2, 1, 3};
+ stat = nc_put_vara(ncid, fr13_id, fr13_startset, fr13_countset, fr13_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr21_data = "@DHL" ;
+ size_t cr21_startset[3] = {0, 0, 0} ;
+ size_t cr21_countset[3] = {2, 2, 1};
+ stat = nc_put_vara(ncid, cr21_id, cr21_startset, cr21_countset, cr21_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char br22_data[8] = {64, 62, 68, 66, 56, 54, 60, 58} ;
+ size_t br22_startset[3] = {0, 0, 0} ;
+ size_t br22_countset[3] = {2, 2, 2};
+ stat = nc_put_vara(ncid, br22_id, br22_startset, br22_countset, br22_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr23_data[12] = {2500, 2495, 2490, 2525, 2520, 2515, 2375, 2370, 2365, 2400, 2395, 2390} ;
+ size_t sr23_startset[3] = {0, 0, 0} ;
+ size_t sr23_countset[3] = {2, 2, 3};
+ stat = nc_put_vara(ncid, sr23_id, sr23_startset, sr23_countset, sr23_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float fr31_data[6] = {((float)26244), ((float)26325), ((float)26406), ((float)25515), ((float)25596), ((float)25677)} ;
+ size_t fr31_startset[3] = {0, 0, 0} ;
+ size_t fr31_countset[3] = {2, 3, 1};
+ stat = nc_put_vara(ncid, fr31_id, fr31_startset, fr31_countset, fr31_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double dr32_data[12] = {((double)40000), ((double)39990), ((double)40100), ((double)40090), ((double)40200), ((double)40190), ((double)39000), ((double)38990), ((double)39100), ((double)39090), ((double)39200), ((double)39190)} ;
+ size_t dr32_startset[3] = {0, 0, 0} ;
+ size_t dr32_countset[3] = {2, 3, 2};
+ stat = nc_put_vara(ncid, dr32_id, dr32_startset, dr32_countset, dr32_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr33_data = "1\000\000two3\000\0004\000\0005\000\000six" ;
+ size_t cr33_startset[3] = {0, 0, 0} ;
+ size_t cr33_countset[3] = {2, 3, 3};
+ stat = nc_put_vara(ncid, cr33_id, cr33_startset, cr33_countset, cr33_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c111_data = "@" ;
+ size_t c111_startset[3] = {0, 0, 0} ;
+ size_t c111_countset[3] = {1, 1, 1};
+ stat = nc_put_vara(ncid, c111_id, c111_startset, c111_countset, c111_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b112_data[2] = {64, 62} ;
+ size_t b112_startset[3] = {0, 0, 0} ;
+ size_t b112_countset[3] = {1, 1, 2};
+ stat = nc_put_vara(ncid, b112_id, b112_startset, b112_countset, b112_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s113_data[3] = {2500, 2495, 2490} ;
+ size_t s113_startset[3] = {0, 0, 0} ;
+ size_t s113_countset[3] = {1, 1, 3};
+ stat = nc_put_vara(ncid, s113_id, s113_startset, s113_countset, s113_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f121_data[2] = {((float)26244), ((float)26325)} ;
+ size_t f121_startset[3] = {0, 0, 0} ;
+ size_t f121_countset[3] = {1, 2, 1};
+ stat = nc_put_vara(ncid, f121_id, f121_startset, f121_countset, f121_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d122_data[4] = {((double)40000), ((double)39990), ((double)40100), ((double)40090)} ;
+ size_t d122_startset[3] = {0, 0, 0} ;
+ size_t d122_countset[3] = {1, 2, 2};
+ stat = nc_put_vara(ncid, d122_id, d122_startset, d122_countset, d122_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c123_data = "one2\000\000" ;
+ size_t c123_startset[3] = {0, 0, 0} ;
+ size_t c123_countset[3] = {1, 2, 3};
+ stat = nc_put_vara(ncid, c123_id, c123_startset, c123_countset, c123_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s131_data[3] = {2500, 2525, 2550} ;
+ size_t s131_startset[3] = {0, 0, 0} ;
+ size_t s131_countset[3] = {1, 3, 1};
+ stat = nc_put_vara(ncid, s131_id, s131_startset, s131_countset, s131_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i132_data[6] = {640000, 639980, 640400, 640380, 640800, 640780} ;
+ size_t i132_startset[3] = {0, 0, 0} ;
+ size_t i132_countset[3] = {1, 3, 2};
+ stat = nc_put_vara(ncid, i132_id, i132_startset, i132_countset, i132_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f133_data[9] = {((float)26244), ((float)26235), ((float)26226), ((float)26325), ((float)26316), ((float)26307), ((float)26406), ((float)26397), ((float)26388)} ;
+ size_t f133_startset[3] = {0, 0, 0} ;
+ size_t f133_countset[3] = {1, 3, 3};
+ stat = nc_put_vara(ncid, f133_id, f133_startset, f133_countset, f133_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f211_data[2] = {((float)26244), ((float)25515)} ;
+ size_t f211_startset[3] = {0, 0, 0} ;
+ size_t f211_countset[3] = {2, 1, 1};
+ stat = nc_put_vara(ncid, f211_id, f211_startset, f211_countset, f211_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d212_data[4] = {((double)40000), ((double)39990), ((double)39000), ((double)38990)} ;
+ size_t d212_startset[3] = {0, 0, 0} ;
+ size_t d212_countset[3] = {2, 1, 2};
+ stat = nc_put_vara(ncid, d212_id, d212_startset, d212_countset, d212_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c213_data = "\000\000\000\000\000\000" ;
+ size_t c213_startset[3] = {0, 0, 0} ;
+ size_t c213_countset[3] = {2, 1, 3};
+ stat = nc_put_vara(ncid, c213_id, c213_startset, c213_countset, c213_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s221_data[4] = {2500, 2525, 2375, 2400} ;
+ size_t s221_startset[3] = {0, 0, 0} ;
+ size_t s221_countset[3] = {2, 2, 1};
+ stat = nc_put_vara(ncid, s221_id, s221_startset, s221_countset, s221_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i222_data[8] = {640000, 639980, 640400, 640380, 632000, 631980, 632400, 632380} ;
+ size_t i222_startset[3] = {0, 0, 0} ;
+ size_t i222_countset[3] = {2, 2, 2};
+ stat = nc_put_vara(ncid, i222_id, i222_startset, i222_countset, i222_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f223_data[12] = {((float)26244), ((float)26235), ((float)26226), ((float)26325), ((float)26316), ((float)26307), ((float)25515), ((float)25506), ((float)25497), ((float)25596), ((float)25587), ((float)25578)} ;
+ size_t f223_startset[3] = {0, 0, 0} ;
+ size_t f223_countset[3] = {2, 2, 3};
+ stat = nc_put_vara(ncid, f223_id, f223_startset, f223_countset, f223_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c231_data = "@DHHLP" ;
+ size_t c231_startset[3] = {0, 0, 0} ;
+ size_t c231_countset[3] = {2, 3, 1};
+ stat = nc_put_vara(ncid, c231_id, c231_startset, c231_countset, c231_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b232_data[12] = {64, 62, 68, 66, 72, 70, 56, 54, 60, 58, 64, 62} ;
+ size_t b232_startset[3] = {0, 0, 0} ;
+ size_t b232_countset[3] = {2, 3, 2};
+ stat = nc_put_vara(ncid, b232_id, b232_startset, b232_countset, b232_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s233_data[18] = {2500, 2495, 2490, 2525, 2520, 2515, 2550, 2545, 2540, 2375, 2370, 2365, 2400, 2395, 2390, 2425, 2420, 2415} ;
+ size_t s233_startset[3] = {0, 0, 0} ;
+ size_t s233_countset[3] = {2, 3, 3};
+ stat = nc_put_vara(ncid, s233_id, s233_startset, s233_countset, s233_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s311_data[3] = {2500, 2375, 2250} ;
+ size_t s311_startset[3] = {0, 0, 0} ;
+ size_t s311_countset[3] = {3, 1, 1};
+ stat = nc_put_vara(ncid, s311_id, s311_startset, s311_countset, s311_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i312_data[6] = {640000, 639980, 632000, 631980, 624000, 623980} ;
+ size_t i312_startset[3] = {0, 0, 0} ;
+ size_t i312_countset[3] = {3, 1, 2};
+ stat = nc_put_vara(ncid, i312_id, i312_startset, i312_countset, i312_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f313_data[9] = {((float)26244), ((float)26235), ((float)26226), ((float)25515), ((float)25506), ((float)25497), ((float)24786), ((float)24777), ((float)24768)} ;
+ size_t f313_startset[3] = {0, 0, 0} ;
+ size_t f313_countset[3] = {3, 1, 3};
+ stat = nc_put_vara(ncid, f313_id, f313_startset, f313_countset, f313_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static double var_MINUS_name_MINUS_dashes_data[1] = {((double)-1)};
+ stat = nc_put_var1(ncid, var_MINUS_name_MINUS_dashes_id, &count, var_MINUS_name_MINUS_dashes_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static double var_PERIOD_name_PERIOD_dots_data[1] = {((double)-2)};
+ stat = nc_put_var1(ncid, var_PERIOD_name_PERIOD_dots_id, &count, var_PERIOD_name_PERIOD_dots_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ stat = nc_close(ncid);
+ check_err(stat,__LINE__,__FILE__);
+ return 0;
+}
diff --git a/ncdump/ctest64.c b/ncdump/ctest64.c
new file mode 100644
index 0000000..a19838f
--- /dev/null
+++ b/ncdump/ctest64.c
@@ -0,0 +1,1456 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <netcdf.h>
+
+
+void
+check_err(const int stat, const int line, const char *file) {
+ if (stat != NC_NOERR) {
+ (void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
+ fflush(stderr);
+ exit(1);
+ }
+}
+
+int
+main() {/* create ctest0_64.nc */
+
+ int stat; /* return status */
+ int ncid; /* netCDF id */
+
+ /* dimension ids */
+ int Dr_dim;
+ int D1_dim;
+ int D2_dim;
+ int D3_dim;
+ int dim_MINUS_name_MINUS_dashes_dim;
+ int dim_PERIOD_name_PERIOD_dots_dim;
+ int dim_PLUS_name_PLUS_plusses_dim;
+ int dim_ATSIGN_name_ATSIGN_ats_dim;
+
+ /* dimension lengths */
+ size_t Dr_len = NC_UNLIMITED;
+ size_t D1_len = 1;
+ size_t D2_len = 2;
+ size_t D3_len = 3;
+ size_t dim_MINUS_name_MINUS_dashes_len = 4;
+ size_t dim_PERIOD_name_PERIOD_dots_len = 5;
+ size_t dim_PLUS_name_PLUS_plusses_len = 6;
+ size_t dim_ATSIGN_name_ATSIGN_ats_len = 7;
+
+ /* variable ids */
+ int c_id;
+ int b_id;
+ int s_id;
+ int i_id;
+ int f_id;
+ int d_id;
+ int cr_id;
+ int br_id;
+ int sr_id;
+ int ir_id;
+ int fr_id;
+ int dr_id;
+ int c1_id;
+ int b1_id;
+ int s1_id;
+ int i1_id;
+ int f1_id;
+ int d1_id;
+ int c2_id;
+ int b2_id;
+ int s2_id;
+ int i2_id;
+ int f2_id;
+ int d2_id;
+ int c3_id;
+ int b3_id;
+ int s3_id;
+ int i3_id;
+ int f3_id;
+ int d3_id;
+ int cr1_id;
+ int br2_id;
+ int sr3_id;
+ int f11_id;
+ int d12_id;
+ int c13_id;
+ int s21_id;
+ int i22_id;
+ int f23_id;
+ int c31_id;
+ int b32_id;
+ int s33_id;
+ int sr11_id;
+ int ir12_id;
+ int fr13_id;
+ int cr21_id;
+ int br22_id;
+ int sr23_id;
+ int fr31_id;
+ int dr32_id;
+ int cr33_id;
+ int c111_id;
+ int b112_id;
+ int s113_id;
+ int f121_id;
+ int d122_id;
+ int c123_id;
+ int s131_id;
+ int i132_id;
+ int f133_id;
+ int f211_id;
+ int d212_id;
+ int c213_id;
+ int s221_id;
+ int i222_id;
+ int f223_id;
+ int c231_id;
+ int b232_id;
+ int s233_id;
+ int s311_id;
+ int i312_id;
+ int f313_id;
+ int var_MINUS_name_MINUS_dashes_id;
+ int var_PERIOD_name_PERIOD_dots_id;
+ int var_PLUS_name_PLUS_plusses_id;
+ int var_ATSIGN_name_ATSIGN_ats_id;
+
+ /* rank (number of dimensions) for each variable */
+# define RANK_c 0
+# define RANK_b 0
+# define RANK_s 0
+# define RANK_i 0
+# define RANK_f 0
+# define RANK_d 0
+# define RANK_cr 1
+# define RANK_br 1
+# define RANK_sr 1
+# define RANK_ir 1
+# define RANK_fr 1
+# define RANK_dr 1
+# define RANK_c1 1
+# define RANK_b1 1
+# define RANK_s1 1
+# define RANK_i1 1
+# define RANK_f1 1
+# define RANK_d1 1
+# define RANK_c2 1
+# define RANK_b2 1
+# define RANK_s2 1
+# define RANK_i2 1
+# define RANK_f2 1
+# define RANK_d2 1
+# define RANK_c3 1
+# define RANK_b3 1
+# define RANK_s3 1
+# define RANK_i3 1
+# define RANK_f3 1
+# define RANK_d3 1
+# define RANK_cr1 2
+# define RANK_br2 2
+# define RANK_sr3 2
+# define RANK_f11 2
+# define RANK_d12 2
+# define RANK_c13 2
+# define RANK_s21 2
+# define RANK_i22 2
+# define RANK_f23 2
+# define RANK_c31 2
+# define RANK_b32 2
+# define RANK_s33 2
+# define RANK_sr11 3
+# define RANK_ir12 3
+# define RANK_fr13 3
+# define RANK_cr21 3
+# define RANK_br22 3
+# define RANK_sr23 3
+# define RANK_fr31 3
+# define RANK_dr32 3
+# define RANK_cr33 3
+# define RANK_c111 3
+# define RANK_b112 3
+# define RANK_s113 3
+# define RANK_f121 3
+# define RANK_d122 3
+# define RANK_c123 3
+# define RANK_s131 3
+# define RANK_i132 3
+# define RANK_f133 3
+# define RANK_f211 3
+# define RANK_d212 3
+# define RANK_c213 3
+# define RANK_s221 3
+# define RANK_i222 3
+# define RANK_f223 3
+# define RANK_c231 3
+# define RANK_b232 3
+# define RANK_s233 3
+# define RANK_s311 3
+# define RANK_i312 3
+# define RANK_f313 3
+# define RANK_var_MINUS_name_MINUS_dashes 0
+# define RANK_var_PERIOD_name_PERIOD_dots 0
+# define RANK_var_PLUS_name_PLUS_plusses 0
+# define RANK_var_ATSIGN_name_ATSIGN_ats 0
+
+ /* variable shapes */
+ int cr_dims[RANK_cr];
+ int br_dims[RANK_br];
+ int sr_dims[RANK_sr];
+ int ir_dims[RANK_ir];
+ int fr_dims[RANK_fr];
+ int dr_dims[RANK_dr];
+ int c1_dims[RANK_c1];
+ int b1_dims[RANK_b1];
+ int s1_dims[RANK_s1];
+ int i1_dims[RANK_i1];
+ int f1_dims[RANK_f1];
+ int d1_dims[RANK_d1];
+ int c2_dims[RANK_c2];
+ int b2_dims[RANK_b2];
+ int s2_dims[RANK_s2];
+ int i2_dims[RANK_i2];
+ int f2_dims[RANK_f2];
+ int d2_dims[RANK_d2];
+ int c3_dims[RANK_c3];
+ int b3_dims[RANK_b3];
+ int s3_dims[RANK_s3];
+ int i3_dims[RANK_i3];
+ int f3_dims[RANK_f3];
+ int d3_dims[RANK_d3];
+ int cr1_dims[RANK_cr1];
+ int br2_dims[RANK_br2];
+ int sr3_dims[RANK_sr3];
+ int f11_dims[RANK_f11];
+ int d12_dims[RANK_d12];
+ int c13_dims[RANK_c13];
+ int s21_dims[RANK_s21];
+ int i22_dims[RANK_i22];
+ int f23_dims[RANK_f23];
+ int c31_dims[RANK_c31];
+ int b32_dims[RANK_b32];
+ int s33_dims[RANK_s33];
+ int sr11_dims[RANK_sr11];
+ int ir12_dims[RANK_ir12];
+ int fr13_dims[RANK_fr13];
+ int cr21_dims[RANK_cr21];
+ int br22_dims[RANK_br22];
+ int sr23_dims[RANK_sr23];
+ int fr31_dims[RANK_fr31];
+ int dr32_dims[RANK_dr32];
+ int cr33_dims[RANK_cr33];
+ int c111_dims[RANK_c111];
+ int b112_dims[RANK_b112];
+ int s113_dims[RANK_s113];
+ int f121_dims[RANK_f121];
+ int d122_dims[RANK_d122];
+ int c123_dims[RANK_c123];
+ int s131_dims[RANK_s131];
+ int i132_dims[RANK_i132];
+ int f133_dims[RANK_f133];
+ int f211_dims[RANK_f211];
+ int d212_dims[RANK_d212];
+ int c213_dims[RANK_c213];
+ int s221_dims[RANK_s221];
+ int i222_dims[RANK_i222];
+ int f223_dims[RANK_f223];
+ int c231_dims[RANK_c231];
+ int b232_dims[RANK_b232];
+ int s233_dims[RANK_s233];
+ int s311_dims[RANK_s311];
+ int i312_dims[RANK_i312];
+ int f313_dims[RANK_f313];
+
+ /* enter define mode */
+ stat = nc_create("ctest0_64.nc", NC_CLOBBER|NC_64BIT_OFFSET, &ncid);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* define dimensions */
+ stat = nc_def_dim(ncid, "Dr", Dr_len, &Dr_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "D1", D1_len, &D1_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "D2", D2_len, &D2_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "D3", D3_len, &D3_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim-name-dashes", dim_MINUS_name_MINUS_dashes_len, &dim_MINUS_name_MINUS_dashes_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim.name.dots", dim_PERIOD_name_PERIOD_dots_len, &dim_PERIOD_name_PERIOD_dots_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim+name+plusses", dim_PLUS_name_PLUS_plusses_len, &dim_PLUS_name_PLUS_plusses_dim);
+ check_err(stat,__LINE__,__FILE__);
+ stat = nc_def_dim(ncid, "dim at name@ats", dim_ATSIGN_name_ATSIGN_ats_len, &dim_ATSIGN_name_ATSIGN_ats_dim);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* define variables */
+
+ stat = nc_def_var(ncid, "c", NC_CHAR, RANK_c, 0, &c_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "b", NC_BYTE, RANK_b, 0, &b_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "s", NC_SHORT, RANK_s, 0, &s_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "i", NC_INT, RANK_i, 0, &i_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "f", NC_FLOAT, RANK_f, 0, &f_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "d", NC_DOUBLE, RANK_d, 0, &d_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "cr", NC_CHAR, RANK_cr, cr_dims, &cr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ br_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "br", NC_BYTE, RANK_br, br_dims, &br_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "sr", NC_SHORT, RANK_sr, sr_dims, &sr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ ir_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "ir", NC_INT, RANK_ir, ir_dims, &ir_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ fr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "fr", NC_FLOAT, RANK_fr, fr_dims, &fr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ dr_dims[0] = Dr_dim;
+ stat = nc_def_var(ncid, "dr", NC_DOUBLE, RANK_dr, dr_dims, &dr_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "c1", NC_CHAR, RANK_c1, c1_dims, &c1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "b1", NC_BYTE, RANK_b1, b1_dims, &b1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "s1", NC_SHORT, RANK_s1, s1_dims, &s1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "i1", NC_INT, RANK_i1, i1_dims, &i1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "f1", NC_FLOAT, RANK_f1, f1_dims, &f1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d1_dims[0] = D1_dim;
+ stat = nc_def_var(ncid, "d1", NC_DOUBLE, RANK_d1, d1_dims, &d1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "c2", NC_CHAR, RANK_c2, c2_dims, &c2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "b2", NC_BYTE, RANK_b2, b2_dims, &b2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "s2", NC_SHORT, RANK_s2, s2_dims, &s2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "i2", NC_INT, RANK_i2, i2_dims, &i2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "f2", NC_FLOAT, RANK_f2, f2_dims, &f2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d2_dims[0] = D2_dim;
+ stat = nc_def_var(ncid, "d2", NC_DOUBLE, RANK_d2, d2_dims, &d2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "c3", NC_CHAR, RANK_c3, c3_dims, &c3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "b3", NC_BYTE, RANK_b3, b3_dims, &b3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "s3", NC_SHORT, RANK_s3, s3_dims, &s3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "i3", NC_INT, RANK_i3, i3_dims, &i3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "f3", NC_FLOAT, RANK_f3, f3_dims, &f3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d3_dims[0] = D3_dim;
+ stat = nc_def_var(ncid, "d3", NC_DOUBLE, RANK_d3, d3_dims, &d3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr1_dims[0] = Dr_dim;
+ cr1_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "cr1", NC_CHAR, RANK_cr1, cr1_dims, &cr1_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ br2_dims[0] = Dr_dim;
+ br2_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "br2", NC_BYTE, RANK_br2, br2_dims, &br2_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr3_dims[0] = Dr_dim;
+ sr3_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "sr3", NC_SHORT, RANK_sr3, sr3_dims, &sr3_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f11_dims[0] = D1_dim;
+ f11_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "f11", NC_FLOAT, RANK_f11, f11_dims, &f11_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d12_dims[0] = D1_dim;
+ d12_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "d12", NC_DOUBLE, RANK_d12, d12_dims, &d12_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c13_dims[0] = D1_dim;
+ c13_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "c13", NC_CHAR, RANK_c13, c13_dims, &c13_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s21_dims[0] = D2_dim;
+ s21_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "s21", NC_SHORT, RANK_s21, s21_dims, &s21_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i22_dims[0] = D2_dim;
+ i22_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "i22", NC_INT, RANK_i22, i22_dims, &i22_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f23_dims[0] = D2_dim;
+ f23_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "f23", NC_FLOAT, RANK_f23, f23_dims, &f23_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c31_dims[0] = D3_dim;
+ c31_dims[1] = D1_dim;
+ stat = nc_def_var(ncid, "c31", NC_CHAR, RANK_c31, c31_dims, &c31_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b32_dims[0] = D3_dim;
+ b32_dims[1] = D2_dim;
+ stat = nc_def_var(ncid, "b32", NC_BYTE, RANK_b32, b32_dims, &b32_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s33_dims[0] = D3_dim;
+ s33_dims[1] = D3_dim;
+ stat = nc_def_var(ncid, "s33", NC_SHORT, RANK_s33, s33_dims, &s33_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr11_dims[0] = Dr_dim;
+ sr11_dims[1] = D1_dim;
+ sr11_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "sr11", NC_SHORT, RANK_sr11, sr11_dims, &sr11_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ ir12_dims[0] = Dr_dim;
+ ir12_dims[1] = D1_dim;
+ ir12_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "ir12", NC_INT, RANK_ir12, ir12_dims, &ir12_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ fr13_dims[0] = Dr_dim;
+ fr13_dims[1] = D1_dim;
+ fr13_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "fr13", NC_FLOAT, RANK_fr13, fr13_dims, &fr13_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr21_dims[0] = Dr_dim;
+ cr21_dims[1] = D2_dim;
+ cr21_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "cr21", NC_CHAR, RANK_cr21, cr21_dims, &cr21_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ br22_dims[0] = Dr_dim;
+ br22_dims[1] = D2_dim;
+ br22_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "br22", NC_BYTE, RANK_br22, br22_dims, &br22_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ sr23_dims[0] = Dr_dim;
+ sr23_dims[1] = D2_dim;
+ sr23_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "sr23", NC_SHORT, RANK_sr23, sr23_dims, &sr23_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ fr31_dims[0] = Dr_dim;
+ fr31_dims[1] = D3_dim;
+ fr31_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "fr31", NC_FLOAT, RANK_fr31, fr31_dims, &fr31_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ dr32_dims[0] = Dr_dim;
+ dr32_dims[1] = D3_dim;
+ dr32_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "dr32", NC_DOUBLE, RANK_dr32, dr32_dims, &dr32_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ cr33_dims[0] = Dr_dim;
+ cr33_dims[1] = D3_dim;
+ cr33_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "cr33", NC_CHAR, RANK_cr33, cr33_dims, &cr33_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c111_dims[0] = D1_dim;
+ c111_dims[1] = D1_dim;
+ c111_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "c111", NC_CHAR, RANK_c111, c111_dims, &c111_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b112_dims[0] = D1_dim;
+ b112_dims[1] = D1_dim;
+ b112_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "b112", NC_BYTE, RANK_b112, b112_dims, &b112_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s113_dims[0] = D1_dim;
+ s113_dims[1] = D1_dim;
+ s113_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "s113", NC_SHORT, RANK_s113, s113_dims, &s113_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f121_dims[0] = D1_dim;
+ f121_dims[1] = D2_dim;
+ f121_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "f121", NC_FLOAT, RANK_f121, f121_dims, &f121_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d122_dims[0] = D1_dim;
+ d122_dims[1] = D2_dim;
+ d122_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "d122", NC_DOUBLE, RANK_d122, d122_dims, &d122_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c123_dims[0] = D1_dim;
+ c123_dims[1] = D2_dim;
+ c123_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "c123", NC_CHAR, RANK_c123, c123_dims, &c123_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s131_dims[0] = D1_dim;
+ s131_dims[1] = D3_dim;
+ s131_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "s131", NC_SHORT, RANK_s131, s131_dims, &s131_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i132_dims[0] = D1_dim;
+ i132_dims[1] = D3_dim;
+ i132_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "i132", NC_INT, RANK_i132, i132_dims, &i132_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f133_dims[0] = D1_dim;
+ f133_dims[1] = D3_dim;
+ f133_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "f133", NC_FLOAT, RANK_f133, f133_dims, &f133_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f211_dims[0] = D2_dim;
+ f211_dims[1] = D1_dim;
+ f211_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "f211", NC_FLOAT, RANK_f211, f211_dims, &f211_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ d212_dims[0] = D2_dim;
+ d212_dims[1] = D1_dim;
+ d212_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "d212", NC_DOUBLE, RANK_d212, d212_dims, &d212_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c213_dims[0] = D2_dim;
+ c213_dims[1] = D1_dim;
+ c213_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "c213", NC_CHAR, RANK_c213, c213_dims, &c213_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s221_dims[0] = D2_dim;
+ s221_dims[1] = D2_dim;
+ s221_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "s221", NC_SHORT, RANK_s221, s221_dims, &s221_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i222_dims[0] = D2_dim;
+ i222_dims[1] = D2_dim;
+ i222_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "i222", NC_INT, RANK_i222, i222_dims, &i222_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f223_dims[0] = D2_dim;
+ f223_dims[1] = D2_dim;
+ f223_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "f223", NC_FLOAT, RANK_f223, f223_dims, &f223_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ c231_dims[0] = D2_dim;
+ c231_dims[1] = D3_dim;
+ c231_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "c231", NC_CHAR, RANK_c231, c231_dims, &c231_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ b232_dims[0] = D2_dim;
+ b232_dims[1] = D3_dim;
+ b232_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "b232", NC_BYTE, RANK_b232, b232_dims, &b232_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s233_dims[0] = D2_dim;
+ s233_dims[1] = D3_dim;
+ s233_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "s233", NC_SHORT, RANK_s233, s233_dims, &s233_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ s311_dims[0] = D3_dim;
+ s311_dims[1] = D1_dim;
+ s311_dims[2] = D1_dim;
+ stat = nc_def_var(ncid, "s311", NC_SHORT, RANK_s311, s311_dims, &s311_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ i312_dims[0] = D3_dim;
+ i312_dims[1] = D1_dim;
+ i312_dims[2] = D2_dim;
+ stat = nc_def_var(ncid, "i312", NC_INT, RANK_i312, i312_dims, &i312_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ f313_dims[0] = D3_dim;
+ f313_dims[1] = D1_dim;
+ f313_dims[2] = D3_dim;
+ stat = nc_def_var(ncid, "f313", NC_FLOAT, RANK_f313, f313_dims, &f313_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var-name-dashes", NC_DOUBLE, RANK_var_MINUS_name_MINUS_dashes, 0, &var_MINUS_name_MINUS_dashes_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var.name.dots", NC_DOUBLE, RANK_var_PERIOD_name_PERIOD_dots, 0, &var_PERIOD_name_PERIOD_dots_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var+name+plusses", NC_DOUBLE, RANK_var_PLUS_name_PLUS_plusses, 0, &var_PLUS_name_PLUS_plusses_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ stat = nc_def_var(ncid, "var at name@ats", NC_DOUBLE, RANK_var_ATSIGN_name_ATSIGN_ats, 0, &var_ATSIGN_name_ATSIGN_ats_id);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* assign global attributes */
+
+ {
+ stat = nc_put_att_text(ncid, NC_GLOBAL, "Gc", 1, "");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const signed char c0_Gb_att[2] = {-128, 127} ;
+ stat = nc_put_att_schar(ncid, NC_GLOBAL, "Gb", NC_BYTE, 2, c0_Gb_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const short c0_Gs_att[3] = {-32768, 0, 32767} ;
+ stat = nc_put_att_short(ncid, NC_GLOBAL, "Gs", NC_SHORT, 3, c0_Gs_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gi_att[3] = {-2147483647, 0, 2147483647} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gi", NC_INT, 3, c0_Gi_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const float c0_Gf_att[3] = {((float)-9.9999996e+35), ((float)0), ((float)9.9999996e+35)} ;
+ stat = nc_put_att_float(ncid, NC_GLOBAL, "Gf", NC_FLOAT, 3, c0_Gf_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const double c0_Gd_att[3] = {((double)-1e+308), ((double)0), ((double)1e+308)} ;
+ stat = nc_put_att_double(ncid, NC_GLOBAL, "Gd", NC_DOUBLE, 3, c0_Gd_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_MINUS_name_MINUS_dashes_att[1] = {-1} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt-name-dashes", NC_INT, 1, c0_Gatt_MINUS_name_MINUS_dashes_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_DOT_name_DOT_dots_att[1] = {-2} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt.name.dots", NC_INT, 1, c0_Gatt_DOT_name_DOT_dots_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_PLUS_name_PLUS_plusses_att[1] = {-3} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt+name+plusses", NC_INT, 1, c0_Gatt_PLUS_name_PLUS_plusses_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_Gatt_ATSIGN_name_ATSIGN_ats_att[1] = {-4} ;
+ stat = nc_put_att_int(ncid, NC_GLOBAL, "Gatt at name@ats", NC_INT, 1, c0_Gatt_ATSIGN_name_ATSIGN_ats_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ /* assign per-variable attributes */
+
+ {
+ static const int c0_att_MINUS_name_MINUS_dashes_att[1] = {4} ;
+ stat = nc_put_att_int(ncid, c_id, "att-name-dashes", NC_INT, 1, c0_att_MINUS_name_MINUS_dashes_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_att_DOT_name_DOT_dots_att[1] = {5} ;
+ stat = nc_put_att_int(ncid, c_id, "att.name.dots", NC_INT, 1, c0_att_DOT_name_DOT_dots_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_att_PLUS_name_PLUS_plusses_att[1] = {6} ;
+ stat = nc_put_att_int(ncid, c_id, "att+name+plusses", NC_INT, 1, c0_att_PLUS_name_PLUS_plusses_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_att_ATSIGN_name_ATSIGN_ats_att[1] = {7} ;
+ stat = nc_put_att_int(ncid, c_id, "att at name@ats", NC_INT, 1, c0_att_ATSIGN_name_ATSIGN_ats_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ stat = nc_put_att_text(ncid, b_id, "c", 1, "");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const signed char c0_b_att[4] = {0, 127, -128, -1} ;
+ stat = nc_put_att_schar(ncid, s_id, "b", NC_BYTE, 4, c0_b_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const short c0_s_att[3] = {-32768, 0, 32767} ;
+ stat = nc_put_att_short(ncid, s_id, "s", NC_SHORT, 3, c0_s_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const int c0_i_att[3] = {-2147483647, 0, 2147483647} ;
+ stat = nc_put_att_int(ncid, i_id, "i", NC_INT, 3, c0_i_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const float c0_f_att[3] = {((float)-9.9999996e+35), ((float)0), ((float)9.9999996e+35)} ;
+ stat = nc_put_att_float(ncid, i_id, "f", NC_FLOAT, 3, c0_f_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ static const double c0_d_att[3] = {((double)-1e+308), ((double)0), ((double)1e+308)} ;
+ stat = nc_put_att_double(ncid, i_id, "d", NC_DOUBLE, 3, c0_d_att);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ stat = nc_put_att_text(ncid, f_id, "c", 1, "x");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+ {
+ stat = nc_put_att_text(ncid, d_id, "c", 8, "abcd\tZ$&");
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ /* leave define mode */
+ stat = nc_enddef (ncid);
+ check_err(stat,__LINE__,__FILE__);
+
+ /* assign variable data */
+
+ {
+ size_t count = 0;
+ static char c_data[1] = {'2'};
+ stat = nc_put_var1(ncid, c_id, &count, c_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static signed char b_data[1] = {-2};
+ stat = nc_put_var1(ncid, b_id, &count, b_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static short s_data[1] = {-5};
+ stat = nc_put_var1(ncid, s_id, &count, s_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static int i_data[1] = {-20};
+ stat = nc_put_var1(ncid, i_id, &count, i_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static float f_data[1] = {((float)-9)};
+ stat = nc_put_var1(ncid, f_id, &count, f_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static double d_data[1] = {((double)-10)};
+ stat = nc_put_var1(ncid, d_id, &count, d_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr_data = "ab" ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char br_data[2] = {-128, 127} ;
+ size_t br_startset[1] = {0} ;
+ size_t br_countset[1] = {2};
+ stat = nc_put_vara(ncid, br_id, br_startset, br_countset, br_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr_data[2] = {-32768, 32767} ;
+ size_t sr_startset[1] = {0} ;
+ size_t sr_countset[1] = {2};
+ stat = nc_put_vara(ncid, sr_id, sr_startset, sr_countset, sr_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int ir_data[2] = {-2147483646, 2147483647} ;
+ size_t ir_startset[1] = {0} ;
+ size_t ir_countset[1] = {2};
+ stat = nc_put_vara(ncid, ir_id, ir_startset, ir_countset, ir_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float fr_data[2] = {((float)-9.9999996e+35), ((float)9.9999996e+35)} ;
+ size_t fr_startset[1] = {0} ;
+ size_t fr_countset[1] = {2};
+ stat = nc_put_vara(ncid, fr_id, fr_startset, fr_countset, fr_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double dr_data[2] = {((double)-1e+308), ((double)1e+308)} ;
+ size_t dr_startset[1] = {0} ;
+ size_t dr_countset[1] = {2};
+ stat = nc_put_vara(ncid, dr_id, dr_startset, dr_countset, dr_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c1_data = "\000" ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b1_data[1] = {-128} ;
+ size_t b1_startset[1] = {0} ;
+ size_t b1_countset[1] = {1};
+ stat = nc_put_vara(ncid, b1_id, b1_startset, b1_countset, b1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s1_data[1] = {-32768} ;
+ size_t s1_startset[1] = {0} ;
+ size_t s1_countset[1] = {1};
+ stat = nc_put_vara(ncid, s1_id, s1_startset, s1_countset, s1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i1_data[1] = {-2147483646} ;
+ size_t i1_startset[1] = {0} ;
+ size_t i1_countset[1] = {1};
+ stat = nc_put_vara(ncid, i1_id, i1_startset, i1_countset, i1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f1_data[1] = {((float)-9.9999996e+35)} ;
+ size_t f1_startset[1] = {0} ;
+ size_t f1_countset[1] = {1};
+ stat = nc_put_vara(ncid, f1_id, f1_startset, f1_countset, f1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d1_data[1] = {((double)-1e+308)} ;
+ size_t d1_startset[1] = {0} ;
+ size_t d1_countset[1] = {1};
+ stat = nc_put_vara(ncid, d1_id, d1_startset, d1_countset, d1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c2_data = "ab" ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b2_data[2] = {-128, 127} ;
+ size_t b2_startset[1] = {0} ;
+ size_t b2_countset[1] = {2};
+ stat = nc_put_vara(ncid, b2_id, b2_startset, b2_countset, b2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s2_data[2] = {-32768, 32767} ;
+ size_t s2_startset[1] = {0} ;
+ size_t s2_countset[1] = {2};
+ stat = nc_put_vara(ncid, s2_id, s2_startset, s2_countset, s2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i2_data[2] = {-2147483646, 2147483647} ;
+ size_t i2_startset[1] = {0} ;
+ size_t i2_countset[1] = {2};
+ stat = nc_put_vara(ncid, i2_id, i2_startset, i2_countset, i2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f2_data[2] = {((float)-9.9999996e+35), ((float)9.9999996e+35)} ;
+ size_t f2_startset[1] = {0} ;
+ size_t f2_countset[1] = {2};
+ stat = nc_put_vara(ncid, f2_id, f2_startset, f2_countset, f2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d2_data[2] = {((double)-1e+308), ((double)1e+308)} ;
+ size_t d2_startset[1] = {0} ;
+ size_t d2_countset[1] = {2};
+ stat = nc_put_vara(ncid, d2_id, d2_startset, d2_countset, d2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c3_data = "\001\177." ;
+ 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);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b3_data[3] = {-128, 127, -1} ;
+ size_t b3_startset[1] = {0} ;
+ size_t b3_countset[1] = {3};
+ stat = nc_put_vara(ncid, b3_id, b3_startset, b3_countset, b3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s3_data[3] = {-32768, 0, 32767} ;
+ size_t s3_startset[1] = {0} ;
+ size_t s3_countset[1] = {3};
+ stat = nc_put_vara(ncid, s3_id, s3_startset, s3_countset, s3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i3_data[3] = {-2147483646, 0, 2147483647} ;
+ size_t i3_startset[1] = {0} ;
+ size_t i3_countset[1] = {3};
+ stat = nc_put_vara(ncid, i3_id, i3_startset, i3_countset, i3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f3_data[3] = {((float)-9.9999996e+35), ((float)0), ((float)9.9999996e+35)} ;
+ size_t f3_startset[1] = {0} ;
+ size_t f3_countset[1] = {3};
+ stat = nc_put_vara(ncid, f3_id, f3_startset, f3_countset, f3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d3_data[3] = {((double)-1e+308), ((double)0), ((double)1e+308)} ;
+ size_t d3_startset[1] = {0} ;
+ size_t d3_countset[1] = {3};
+ stat = nc_put_vara(ncid, d3_id, d3_startset, d3_countset, d3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr1_data = "xy" ;
+ size_t cr1_startset[2] = {0, 0} ;
+ size_t cr1_countset[2] = {2, 1};
+ stat = nc_put_vara(ncid, cr1_id, cr1_startset, cr1_countset, cr1_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char br2_data[4] = {-24, -26, -20, -22} ;
+ size_t br2_startset[2] = {0, 0} ;
+ size_t br2_countset[2] = {2, 2};
+ stat = nc_put_vara(ncid, br2_id, br2_startset, br2_countset, br2_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr3_data[6] = {-375, -380, -385, -350, -355, -360} ;
+ size_t sr3_startset[2] = {0, 0} ;
+ size_t sr3_countset[2] = {2, 3};
+ stat = nc_put_vara(ncid, sr3_id, sr3_startset, sr3_countset, sr3_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f11_data[1] = {((float)-2187)} ;
+ size_t f11_startset[2] = {0, 0} ;
+ size_t f11_countset[2] = {1, 1};
+ stat = nc_put_vara(ncid, f11_id, f11_startset, f11_countset, f11_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d12_data[2] = {((double)-3000), ((double)-3010)} ;
+ size_t d12_startset[2] = {0, 0} ;
+ size_t d12_countset[2] = {1, 2};
+ stat = nc_put_vara(ncid, d12_id, d12_startset, d12_countset, d12_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c13_data = "\tb\177" ;
+ size_t c13_startset[2] = {0, 0} ;
+ size_t c13_countset[2] = {1, 3};
+ stat = nc_put_vara(ncid, c13_id, c13_startset, c13_countset, c13_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s21_data[2] = {-375, -350} ;
+ size_t s21_startset[2] = {0, 0} ;
+ size_t s21_countset[2] = {2, 1};
+ stat = nc_put_vara(ncid, s21_id, s21_startset, s21_countset, s21_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i22_data[4] = {-24000, -24020, -23600, -23620} ;
+ size_t i22_startset[2] = {0, 0} ;
+ size_t i22_countset[2] = {2, 2};
+ stat = nc_put_vara(ncid, i22_id, i22_startset, i22_countset, i22_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f23_data[6] = {((float)-2187), ((float)-2196), ((float)-2205), ((float)-2106), ((float)-2115), ((float)-2124)} ;
+ size_t f23_startset[2] = {0, 0} ;
+ size_t f23_countset[2] = {2, 3};
+ stat = nc_put_vara(ncid, f23_id, f23_startset, f23_countset, f23_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c31_data = "+- " ;
+ size_t c31_startset[2] = {0, 0} ;
+ size_t c31_countset[2] = {3, 1};
+ stat = nc_put_vara(ncid, c31_id, c31_startset, c31_countset, c31_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b32_data[6] = {-24, -26, -20, -22, -16, -18} ;
+ size_t b32_startset[2] = {0, 0} ;
+ size_t b32_countset[2] = {3, 2};
+ stat = nc_put_vara(ncid, b32_id, b32_startset, b32_countset, b32_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s33_data[9] = {-375, -380, -385, -350, -355, -360, -325, -330, -335} ;
+ size_t s33_startset[2] = {0, 0} ;
+ size_t s33_countset[2] = {3, 3};
+ stat = nc_put_vara(ncid, s33_id, s33_startset, s33_countset, s33_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr11_data[2] = {2500, 2375} ;
+ size_t sr11_startset[3] = {0, 0, 0} ;
+ size_t sr11_countset[3] = {2, 1, 1};
+ stat = nc_put_vara(ncid, sr11_id, sr11_startset, sr11_countset, sr11_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int ir12_data[4] = {640000, 639980, 632000, 631980} ;
+ size_t ir12_startset[3] = {0, 0, 0} ;
+ size_t ir12_countset[3] = {2, 1, 2};
+ stat = nc_put_vara(ncid, ir12_id, ir12_startset, ir12_countset, ir12_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float fr13_data[6] = {((float)26244), ((float)26235), ((float)26226), ((float)25515), ((float)25506), ((float)25497)} ;
+ size_t fr13_startset[3] = {0, 0, 0} ;
+ size_t fr13_countset[3] = {2, 1, 3};
+ stat = nc_put_vara(ncid, fr13_id, fr13_startset, fr13_countset, fr13_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr21_data = "@DHL" ;
+ size_t cr21_startset[3] = {0, 0, 0} ;
+ size_t cr21_countset[3] = {2, 2, 1};
+ stat = nc_put_vara(ncid, cr21_id, cr21_startset, cr21_countset, cr21_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char br22_data[8] = {64, 62, 68, 66, 56, 54, 60, 58} ;
+ size_t br22_startset[3] = {0, 0, 0} ;
+ size_t br22_countset[3] = {2, 2, 2};
+ stat = nc_put_vara(ncid, br22_id, br22_startset, br22_countset, br22_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short sr23_data[12] = {2500, 2495, 2490, 2525, 2520, 2515, 2375, 2370, 2365, 2400, 2395, 2390} ;
+ size_t sr23_startset[3] = {0, 0, 0} ;
+ size_t sr23_countset[3] = {2, 2, 3};
+ stat = nc_put_vara(ncid, sr23_id, sr23_startset, sr23_countset, sr23_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float fr31_data[6] = {((float)26244), ((float)26325), ((float)26406), ((float)25515), ((float)25596), ((float)25677)} ;
+ size_t fr31_startset[3] = {0, 0, 0} ;
+ size_t fr31_countset[3] = {2, 3, 1};
+ stat = nc_put_vara(ncid, fr31_id, fr31_startset, fr31_countset, fr31_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double dr32_data[12] = {((double)40000), ((double)39990), ((double)40100), ((double)40090), ((double)40200), ((double)40190), ((double)39000), ((double)38990), ((double)39100), ((double)39090), ((double)39200), ((double)39190)} ;
+ size_t dr32_startset[3] = {0, 0, 0} ;
+ size_t dr32_countset[3] = {2, 3, 2};
+ stat = nc_put_vara(ncid, dr32_id, dr32_startset, dr32_countset, dr32_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* cr33_data = "1\000\000two3\000\0004\000\0005\000\000six" ;
+ size_t cr33_startset[3] = {0, 0, 0} ;
+ size_t cr33_countset[3] = {2, 3, 3};
+ stat = nc_put_vara(ncid, cr33_id, cr33_startset, cr33_countset, cr33_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c111_data = "@" ;
+ size_t c111_startset[3] = {0, 0, 0} ;
+ size_t c111_countset[3] = {1, 1, 1};
+ stat = nc_put_vara(ncid, c111_id, c111_startset, c111_countset, c111_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b112_data[2] = {64, 62} ;
+ size_t b112_startset[3] = {0, 0, 0} ;
+ size_t b112_countset[3] = {1, 1, 2};
+ stat = nc_put_vara(ncid, b112_id, b112_startset, b112_countset, b112_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s113_data[3] = {2500, 2495, 2490} ;
+ size_t s113_startset[3] = {0, 0, 0} ;
+ size_t s113_countset[3] = {1, 1, 3};
+ stat = nc_put_vara(ncid, s113_id, s113_startset, s113_countset, s113_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f121_data[2] = {((float)26244), ((float)26325)} ;
+ size_t f121_startset[3] = {0, 0, 0} ;
+ size_t f121_countset[3] = {1, 2, 1};
+ stat = nc_put_vara(ncid, f121_id, f121_startset, f121_countset, f121_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d122_data[4] = {((double)40000), ((double)39990), ((double)40100), ((double)40090)} ;
+ size_t d122_startset[3] = {0, 0, 0} ;
+ size_t d122_countset[3] = {1, 2, 2};
+ stat = nc_put_vara(ncid, d122_id, d122_startset, d122_countset, d122_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c123_data = "one2\000\000" ;
+ size_t c123_startset[3] = {0, 0, 0} ;
+ size_t c123_countset[3] = {1, 2, 3};
+ stat = nc_put_vara(ncid, c123_id, c123_startset, c123_countset, c123_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s131_data[3] = {2500, 2525, 2550} ;
+ size_t s131_startset[3] = {0, 0, 0} ;
+ size_t s131_countset[3] = {1, 3, 1};
+ stat = nc_put_vara(ncid, s131_id, s131_startset, s131_countset, s131_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i132_data[6] = {640000, 639980, 640400, 640380, 640800, 640780} ;
+ size_t i132_startset[3] = {0, 0, 0} ;
+ size_t i132_countset[3] = {1, 3, 2};
+ stat = nc_put_vara(ncid, i132_id, i132_startset, i132_countset, i132_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f133_data[9] = {((float)26244), ((float)26235), ((float)26226), ((float)26325), ((float)26316), ((float)26307), ((float)26406), ((float)26397), ((float)26388)} ;
+ size_t f133_startset[3] = {0, 0, 0} ;
+ size_t f133_countset[3] = {1, 3, 3};
+ stat = nc_put_vara(ncid, f133_id, f133_startset, f133_countset, f133_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f211_data[2] = {((float)26244), ((float)25515)} ;
+ size_t f211_startset[3] = {0, 0, 0} ;
+ size_t f211_countset[3] = {2, 1, 1};
+ stat = nc_put_vara(ncid, f211_id, f211_startset, f211_countset, f211_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ double d212_data[4] = {((double)40000), ((double)39990), ((double)39000), ((double)38990)} ;
+ size_t d212_startset[3] = {0, 0, 0} ;
+ size_t d212_countset[3] = {2, 1, 2};
+ stat = nc_put_vara(ncid, d212_id, d212_startset, d212_countset, d212_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c213_data = "\000\000\000\000\000\000" ;
+ size_t c213_startset[3] = {0, 0, 0} ;
+ size_t c213_countset[3] = {2, 1, 3};
+ stat = nc_put_vara(ncid, c213_id, c213_startset, c213_countset, c213_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s221_data[4] = {2500, 2525, 2375, 2400} ;
+ size_t s221_startset[3] = {0, 0, 0} ;
+ size_t s221_countset[3] = {2, 2, 1};
+ stat = nc_put_vara(ncid, s221_id, s221_startset, s221_countset, s221_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i222_data[8] = {640000, 639980, 640400, 640380, 632000, 631980, 632400, 632380} ;
+ size_t i222_startset[3] = {0, 0, 0} ;
+ size_t i222_countset[3] = {2, 2, 2};
+ stat = nc_put_vara(ncid, i222_id, i222_startset, i222_countset, i222_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f223_data[12] = {((float)26244), ((float)26235), ((float)26226), ((float)26325), ((float)26316), ((float)26307), ((float)25515), ((float)25506), ((float)25497), ((float)25596), ((float)25587), ((float)25578)} ;
+ size_t f223_startset[3] = {0, 0, 0} ;
+ size_t f223_countset[3] = {2, 2, 3};
+ stat = nc_put_vara(ncid, f223_id, f223_startset, f223_countset, f223_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ char* c231_data = "@DHHLP" ;
+ size_t c231_startset[3] = {0, 0, 0} ;
+ size_t c231_countset[3] = {2, 3, 1};
+ stat = nc_put_vara(ncid, c231_id, c231_startset, c231_countset, c231_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ signed char b232_data[12] = {64, 62, 68, 66, 72, 70, 56, 54, 60, 58, 64, 62} ;
+ size_t b232_startset[3] = {0, 0, 0} ;
+ size_t b232_countset[3] = {2, 3, 2};
+ stat = nc_put_vara(ncid, b232_id, b232_startset, b232_countset, b232_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s233_data[18] = {2500, 2495, 2490, 2525, 2520, 2515, 2550, 2545, 2540, 2375, 2370, 2365, 2400, 2395, 2390, 2425, 2420, 2415} ;
+ size_t s233_startset[3] = {0, 0, 0} ;
+ size_t s233_countset[3] = {2, 3, 3};
+ stat = nc_put_vara(ncid, s233_id, s233_startset, s233_countset, s233_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ short s311_data[3] = {2500, 2375, 2250} ;
+ size_t s311_startset[3] = {0, 0, 0} ;
+ size_t s311_countset[3] = {3, 1, 1};
+ stat = nc_put_vara(ncid, s311_id, s311_startset, s311_countset, s311_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ int i312_data[6] = {640000, 639980, 632000, 631980, 624000, 623980} ;
+ size_t i312_startset[3] = {0, 0, 0} ;
+ size_t i312_countset[3] = {3, 1, 2};
+ stat = nc_put_vara(ncid, i312_id, i312_startset, i312_countset, i312_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ float f313_data[9] = {((float)26244), ((float)26235), ((float)26226), ((float)25515), ((float)25506), ((float)25497), ((float)24786), ((float)24777), ((float)24768)} ;
+ size_t f313_startset[3] = {0, 0, 0} ;
+ size_t f313_countset[3] = {3, 1, 3};
+ stat = nc_put_vara(ncid, f313_id, f313_startset, f313_countset, f313_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static double var_MINUS_name_MINUS_dashes_data[1] = {((double)-1)};
+ stat = nc_put_var1(ncid, var_MINUS_name_MINUS_dashes_id, &count, var_MINUS_name_MINUS_dashes_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ {
+ size_t count = 0;
+ static double var_PERIOD_name_PERIOD_dots_data[1] = {((double)-2)};
+ stat = nc_put_var1(ncid, var_PERIOD_name_PERIOD_dots_id, &count, var_PERIOD_name_PERIOD_dots_data);
+ check_err(stat,__LINE__,__FILE__);
+ }
+
+
+ stat = nc_close(ncid);
+ check_err(stat,__LINE__,__FILE__);
+ return 0;
+}
diff --git a/ncdump/expected/Makefile.in b/ncdump/expected/Makefile.in
index 8e4cbea..f582419 100644
--- a/ncdump/expected/Makefile.in
+++ b/ncdump/expected/Makefile.in
@@ -172,6 +172,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncdump/ncdump.c b/ncdump/ncdump.c
index e84d1e0..f285f0e 100644
--- a/ncdump/ncdump.c
+++ b/ncdump/ncdump.c
@@ -49,6 +49,7 @@ typedef int ssize_t;
#include "isnan.h"
#include "cdl.h"
+#define XML_VERSION "1.0"
#define int64_t long long
#define uint64_t unsigned long long
@@ -393,8 +394,8 @@ done:
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",
- path);
+ printf("<?xml version=\"%s\" encoding=\"UTF-8\"?>\n<netcdf xmlns=\"http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2\" location=\"%s\">\n",
+ XML_VERSION, path);
}
/*
@@ -472,6 +473,7 @@ pr_att_string(
*/
static void
pr_attx_string(
+ const char* attname,
size_t len,
const char *string
)
@@ -480,6 +482,7 @@ pr_attx_string(
const char *cp;
const char *sp;
unsigned char uc;
+ int nulcount = 0;
cp = string;
printf ("\"");
@@ -510,6 +513,11 @@ pr_attx_string(
case '\t':
printf ("	");
break;
+ case '\0':
+ printf ("");
+ if(nulcount++ == 0)
+ fprintf(stderr,"Attribute: '%s'; value contains nul characters; producing illegal xml\n",attname);
+ break;
default:
if (iscntrl(uc))
printf ("&#%d;",uc);
@@ -1120,7 +1128,7 @@ pr_attx(
varid != NC_GLOBAL ? " " : "",
att.name);
/* print attvals as a string with XML escapes */
- pr_attx_string(attvalslen, attvals);
+ pr_attx_string(att.name, attvalslen, attvals);
} else { /* non-string attribute */
char att_type_name[NC_MAX_NAME + 1];
get_type_name(ncid, att.type, att_type_name);
diff --git a/ncdump/ref1.ncml b/ncdump/ref1.ncml
index 37c245a..618d47c 100644
--- a/ncdump/ref1.ncml
+++ b/ncdump/ref1.ncml
@@ -5,6 +5,7 @@
<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" />
+ <attribute name="gnul" value="abcdhello" />
<variable name="var" shape="t m" type="float">
<attribute name="tatt" value="text attribute value" />
<attribute name="natt" type="int" value="1 2" />
diff --git a/ncdump/tst_ncml.cdl b/ncdump/tst_ncml.cdl
index 822646c..16d6d8a 100644
--- a/ncdump/tst_ncml.cdl
+++ b/ncdump/tst_ncml.cdl
@@ -10,4 +10,5 @@ variables:
:gtatt = "<, >, \', \", and &" ;
:gnatt = 3, 4;
:gdatt = -7.02788826649782e-09, 7.02788826649782e-09 ;
+ char :gnul = "\000abcd\000\000hello\000" ;
}
diff --git a/ncgen/Makefile.in b/ncgen/Makefile.in
index 5af6bad..e19e7e1 100644
--- a/ncgen/Makefile.in
+++ b/ncgen/Makefile.in
@@ -453,6 +453,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/ncgen/ncgen.1 b/ncgen/ncgen.1
index e29dbcb..1582ee3 100644
--- a/ncgen/ncgen.1
+++ b/ncgen/ncgen.1
@@ -751,7 +751,7 @@ matching one of `classic', `64-bit offset', `64-bit data', `netCDF-4', or
The rest of the special attributes are all variable attributes.
Essentially all of then map to some corresponding `nc_def_var_XXX'
function as defined in the netCDF-4 API.
-For the atttributes that are essentially boolean (_Fletcher32, _Shuffle,
+For the attributes that are essentially boolean (_Fletcher32, _Shuffle,
and _NOFILL), the value true can be specified by using the strings
`true' or `1', or by using the integer 1.
The value false expects either `false', `0', or the integer 0.
diff --git a/ncgen3/Makefile.in b/ncgen3/Makefile.in
index 2b6a290..f442b4c 100644
--- a/ncgen3/Makefile.in
+++ b/ncgen3/Makefile.in
@@ -446,6 +446,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/nctest/Makefile.in b/nctest/Makefile.in
index 4fbb31e..c455d08 100644
--- a/nctest/Makefile.in
+++ b/nctest/Makefile.in
@@ -455,6 +455,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/oc2/Makefile.in b/oc2/Makefile.in
index eefcc5c..7172477 100644
--- a/oc2/Makefile.in
+++ b/oc2/Makefile.in
@@ -247,6 +247,7 @@ HAS_DISKLESS = @HAS_DISKLESS@
HAS_HDF4 = @HAS_HDF4@
HAS_HDF5 = @HAS_HDF5@
HAS_JNA = @HAS_JNA@
+HAS_LOGGING = @HAS_LOGGING@
HAS_MMAP = @HAS_MMAP@
HAS_NC2 = @HAS_NC2@
HAS_NC4 = @HAS_NC4@
diff --git a/oc2/ocdump.c b/oc2/ocdump.c
index d34d969..a5eca30 100644
--- a/oc2/ocdump.c
+++ b/oc2/ocdump.c
@@ -429,6 +429,12 @@ ocreadfile(FILE* file, off_t datastart, char** memp, size_t* lenp)
OCerror stat = OC_NOERR;
pos = ftell(file);
+ if(pos < 0) {
+ fprintf(stderr,"ocreadfile: ftell error.\n");
+ stat = OC_ERCFILE;
+ goto done;
+ }
+
fseek(file,0,SEEK_SET);
if(fseek(file,(long)datastart,SEEK_SET) < 0) {
fprintf(stderr,"ocreadfile: fseek error.\n");
@@ -443,7 +449,7 @@ ocreadfile(FILE* file, off_t datastart, char** memp, size_t* lenp)
}
len = stats.st_size;
len -= datastart;
-
+
mem = (char*)calloc(len+1,1);
if(mem == NULL) {stat = OC_ENOMEM; goto done;}
@@ -453,18 +459,19 @@ ocreadfile(FILE* file, off_t datastart, char** memp, size_t* lenp)
fprintf(stderr,"ocreadfile: short file\n");
stat = OC_ERCFILE;
goto done;
- }
+ }
+
if(fseek(file,pos,SEEK_SET) < 0) {; /* leave it as we found it*/
- fprintf(stderr,"ocreadfile: fseek error.\n");
- stat = OC_ERCFILE;
- goto done;
+ fprintf(stderr,"ocreadfile: fseek error.\n");
+ stat = OC_ERCFILE;
+ goto done;
}
if(memp) {*memp = mem; mem = NULL;}
- if(lenp) *lenp = len;
+ if(lenp) *lenp = len;
-done:
+ done:
if(mem != NULL)
- free(mem);
+ free(mem);
return OCTHROW(stat);
}
@@ -478,9 +485,11 @@ ocdd(OCstate* state, OCnode* root, int xdrencoded, int level)
root->tree->data.bod,
&mem,
&len)) {
- fprintf(stderr,"ocdd could not read data file\n");
- return;
- }
+ /* ocreadfile allocates memory that must be freed. */
+ if(mem != NULL) free(mem);
+ fprintf(stderr,"ocdd could not read data file\n");
+ return;
+ }
ocdumpmemory(mem,len,xdrencoded,level);
free(mem);
} else {
@@ -574,12 +583,12 @@ ocdumpdatatree(OCstate* state, OCdata* data, OCbytes* buffer, int depth)
snprintf(tmp,sizeof(tmp),"%04lu ",(unsigned long)data->index);
ocbytescat(buffer,tmp);
}
-
+
tabto(tabstops[++tabstop],buffer);
/* Dump the mode flags in compact form */
ocbytescat(buffer,ocdtmodestring(data->datamode,1));
-
+
tabto(tabstops[++tabstop],buffer);
/* Dump the size or ninstances */
@@ -634,7 +643,7 @@ ocdumpdatapath(OCstate* state, OCdata* data, OCbytes* buffer)
OCdata* next = path[i-1];
if(next->container == NULL) break;
path[i] = next->container;
- }
+ }
/* Path is in reverse order */
for(i=i-1;i>=0;i--) {
pathdata = path[i];
@@ -678,5 +687,5 @@ ocdumpdatapath(OCstate* state, OCdata* data, OCbytes* buffer)
ocbytescat(buffer,octypetoddsstring(pattern->etype));
}
snprintf(tmp,sizeof(tmp),"->0x%0lx",(unsigned long)pathdata);
- ocbytescat(buffer,tmp);
+ ocbytescat(buffer,tmp);
}
diff --git a/update_hdf5_compat_files.sh b/update_hdf5_compat_files.sh
new file mode 100755
index 0000000..30d2dfb
--- /dev/null
+++ b/update_hdf5_compat_files.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# Temporary utility script.
+
+cp ./tst_vars.nc ../../nc_test4/ref_hdf5_compat1.nc
+cp ./tst_vars4.nc ../../nc_test4/ref_hdf5_compat2.nc
+cp ./tst_compounds.nc ../../nc_test4/ref_hdf5_compat3.nc
--
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