[netcdf] 01/06: Imported Upstream version 4.4.1.1
Bas Couwenberg
sebastic at debian.org
Tue Nov 22 06:54:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository netcdf.
commit eb5a62209fde08afb709c5743899a09223b0ac5c
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Tue Nov 22 07:15:29 2016 +0100
Imported Upstream version 4.4.1.1
---
.travis.yml | 34 +-
CMakeLists.txt | 104 +-
RELEASE_NOTES.md | 10 +
config.h.cmake.in | 2 +-
config.h.in | 3 -
configure | 60 +-
configure.ac | 21 +-
docs/Doxyfile.developer | 2 +-
docs/FAQ.md | 4 +-
docs/OPeNDAP.dox | 33 +-
docs/attribute_conventions.md | 10 +-
docs/guide.dox | 2 +
docs/install.md | 160 +-
docs/netcdf.m4 | 6 +-
docs/old/netcdf-f90.texi | 2 +-
docs/release_header.html | 1 +
docs/windows-binaries.md | 28 +-
h5_test/tst_h_mem.c | 1 +
include/CMakeLists.txt | 2 +-
include/nc4internal.h | 11 +-
include/nc_tests.h | 2 +-
include/netcdf.h | 2 +-
libdap2/dceparselex.h | 4 +-
libdap2/env | 2 +-
libdispatch/dfile.c | 8 +-
libdispatch/dgroup.c | 155 +-
libdispatch/dvar.c | 140 +-
libdispatch/dvarinq.c | 68 +-
liblib/CMakeLists.txt | 2 +-
liblib/Makefile.am | 2 +-
liblib/Makefile.in | 2 +-
liblib/nc_initialize.c | 5 +-
libsrc/attr.c | 685 --
libsrc/dim.c | 10 +-
libsrc/ncx.c | 14910 -----------------------------------
libsrc/netcdf.3 | 1405 ----
libsrc/putget.c | 8657 --------------------
libsrc/var.c | 30 +-
libsrc4/Makefile.am | 6 +-
libsrc4/Makefile.in | 16 +-
libsrc4/nc4attr.c | 19 +-
libsrc4/nc4file.c | 10 -
libsrc4/nc4hdf.c | 63 +-
libsrc4/nc4info.c | 176 +-
nc-config.cmake.in | 81 +-
nc-config.in | 86 +-
nc_test/CMakeLists.txt | 23 +-
nc_test/Makefile.am | 18 +-
nc_test/Makefile.in | 41 +-
nc_test/quick_large_files.c | 213 +-
nc_test/test_get.c | 9223 ++++++++++++++++++++++
nc_test/test_get.m4 | 9 -
nc_test/test_put.c | 11714 +++++++++++++++++++++++++++
nc_test/test_put.m4 | 19 -
nc_test/tst_atts.c | 7 +-
nc_test/tst_atts3.c | 125 +-
nc_test/tst_big_rvar.c | 15 +-
nc_test/tst_big_var.c | 7 +-
nc_test/tst_big_var2.c | 11 +-
nc_test/tst_big_var6.c | 11 +-
nc_test/tst_diskless.c | 70 +-
nc_test/tst_diskless3.c | 12 +-
nc_test/tst_diskless4.c | 5 +-
nc_test/tst_formatx_pnetcdf.c | 1 +
nc_test/tst_inq_type.c | 1 +
nc_test/tst_large.c | 13 +-
nc_test/tst_misc.c | 11 +-
nc_test/tst_names.c | 37 +-
nc_test/tst_nofill.c | 47 +-
nc_test/tst_nofill2.c | 7 +-
nc_test/tst_nofill3.c | 5 +-
nc_test/tst_norm.c | 1 +
nc_test/tst_parallel2.c | 1 +
nc_test/tst_pnetcdf.c | 1 +
nc_test/tst_small.c | 64 +-
nc_test4/CMakeLists.txt | 16 +-
nc_test4/Makefile.am | 15 +-
nc_test4/Makefile.in | 90 +-
nc_test4/bm_file.c | 139 +-
nc_test4/bm_many_atts.c | 5 +-
nc_test4/bm_many_objs.c | 11 +-
nc_test4/bm_netcdf4_recs.c | 9 +-
nc_test4/cdm_sea_soundings.c | 9 +-
nc_test4/ref_chunks1.cdl | 6 +
nc_test4/ref_chunks2.cdl | 6 +
nc_test4/run_tst_chunks.sh | 2 +-
nc_test4/t_type.c | 3 +-
nc_test4/tst_ar4.c | 28 +-
nc_test4/tst_ar4_3d.c | 28 +-
nc_test4/tst_ar4_4d.c | 36 +-
nc_test4/tst_ar5.c | 5 +-
nc_test4/tst_atts.c | 23 +-
nc_test4/tst_atts1.c | 219 +-
nc_test4/tst_atts2.c | 55 +-
nc_test4/tst_atts_string_rewrite.c | 1 +
nc_test4/tst_camrun.c | 19 +-
nc_test4/tst_chunk_hdf4.c | 12 +-
nc_test4/tst_chunks.c | 39 +-
nc_test4/tst_chunks2.c | 41 +-
nc_test4/tst_compounds.c | 1 +
nc_test4/tst_compounds2.c | 35 +-
nc_test4/tst_compounds3.c | 7 +-
nc_test4/tst_converts.c | 11 +-
nc_test4/tst_converts2.c | 28 +-
nc_test4/tst_coords.c | 23 +-
nc_test4/tst_coords2.c | 23 +-
nc_test4/tst_coords3.c | 105 +-
nc_test4/tst_create_files.c | 29 +-
nc_test4/tst_dims.c | 34 +-
nc_test4/tst_dims2.c | 9 +-
nc_test4/tst_dims3.c | 13 +-
nc_test4/tst_empty_vlen_unlim.c | 1 +
nc_test4/tst_endian_fill.c | 19 +-
nc_test4/tst_enums.c | 64 +-
nc_test4/tst_files.c | 49 +-
nc_test4/tst_files2.c | 29 +-
nc_test4/tst_files3.c | 27 +-
nc_test4/tst_files4.c | 19 +-
nc_test4/tst_files5.c | 5 +-
nc_test4/tst_files6.c | 23 +-
nc_test4/tst_fill_attr_vanish.c | 1 +
nc_test4/tst_fillbug.c | 5 +-
nc_test4/tst_fills.c | 5 +-
nc_test4/tst_fills2.c | 18 +-
nc_test4/tst_grps.c | 112 +-
nc_test4/tst_grps2.c | 4 +-
nc_test4/tst_h4_lendian.c | 1 +
nc_test4/tst_h_atts2.c | 3 +-
nc_test4/tst_h_files3.c | 13 +-
nc_test4/tst_h_many_atts.c | 5 +-
nc_test4/tst_h_scalar.c | 12 +-
nc_test4/tst_hdf5_file_compat.c | 5 +-
nc_test4/tst_interops.c | 30 +-
nc_test4/tst_interops2.c | 28 +-
nc_test4/tst_interops3.c | 6 +-
nc_test4/tst_interops4.c | 26 +-
nc_test4/tst_interops5.c | 50 +-
nc_test4/tst_interops6.c | 38 +-
nc_test4/tst_knmi.c | 12 +-
nc_test4/tst_large.c | 7 +-
nc_test4/tst_large2.c | 11 +-
nc_test4/tst_mem.c | 11 +-
nc_test4/tst_mode.c | 6 +-
nc_test4/tst_mpi_parallel.c | 7 +-
nc_test4/tst_nc4perf.c | 78 +-
nc_test4/tst_opaques.c | 14 +-
nc_test4/tst_parallel.c | 31 +-
nc_test4/tst_parallel3.c | 64 +-
nc_test4/tst_parallel4.c | 41 +-
nc_test4/tst_rehash.c | 43 +
nc_test4/tst_strings.c | 30 +-
nc_test4/tst_strings2.c | 8 +-
nc_test4/tst_sync.c | 13 +-
nc_test4/tst_unlim_vars.c | 7 +-
nc_test4/tst_utf8.c | 71 +-
nc_test4/tst_v2.c | 3 +-
nc_test4/tst_varms.c | 54 +-
nc_test4/tst_vars.c | 217 +-
nc_test4/tst_vars2.c | 67 +-
nc_test4/tst_vars3.c | 23 +-
nc_test4/tst_vars4.c | 9 +-
nc_test4/tst_vl.c | 20 +-
nc_test4/tst_xplatform.c | 28 +-
nc_test4/tst_xplatform2.c | 36 +-
ncdap_test/CMakeLists.txt | 6 +-
ncdap_test/Makefile.am | 6 +-
ncdap_test/Makefile.in | 22 +-
ncdump/CMakeLists.txt | 2 +-
ncdump/Makefile.am | 2 +-
ncdump/Makefile.in | 47 +-
ncdump/ncdump.c | 19 +-
ncdump/ref_ctest1_nc4.cdl | 4 +-
ncdump/tst_bug324.c | 7 +-
ncdump/tst_chunking.c | 1 +
ncdump/tst_comp.c | 52 +-
ncdump/tst_comp2.c | 34 +-
ncdump/tst_compress.c | 1 +
ncdump/tst_create_files.c | 58 +-
ncdump/tst_dimsizes.c | 5 +-
ncdump/tst_enum_data.c | 52 +-
ncdump/tst_fileinfo.c | 23 +-
ncdump/tst_fillbug.c | 17 +-
ncdump/tst_group_data.c | 19 +-
ncdump/tst_h_rdc0.c | 3 +-
ncdump/tst_h_scalar.c | 12 +-
ncdump/tst_nans.c | 21 +-
ncdump/tst_opaque_data.c | 16 +-
ncdump/tst_special_atts.c | 52 +-
ncdump/tst_string_data.c | 22 +-
ncdump/tst_unicode.c | 11 +-
ncdump/tst_utf8.c | 9 +-
ncdump/tst_vlen_data.c | 20 +-
ncdump/utils.c | 4 +-
ncdump/vardata.c | 2 +-
ncgen/CMakeLists.txt | 2 +-
ncgen/Make0 | 23 +-
ncgen/Makefile.am | 9 +-
ncgen/Makefile.in | 7 +-
ncgen/bindata.c | 44 +-
ncgen/c0.cdl | 7 +-
ncgen/c0_4.cdl | 16 +-
ncgen/cdata.c | 16 +-
ncgen/cdfdata.c | 64 +-
ncgen/compound_datasize_test.cdl | 17 +
ncgen/compound_datasize_test2.cdl | 30 +
ncgen/data.h | 16 +-
ncgen/f77data.c | 14 +-
ncgen/genc.c | 12 +-
ncgen/generate.c | 54 +-
ncgen/generr.c | 11 +-
ncgen/generr.h | 6 +
ncgen/jdata.c | 14 +-
ncgen/ncf199.cdl | 10 +-
ncgen/ncgen.1 | 2 +-
ncgen/ncgen.h | 1 +
ncgen/ncgen.y | 1 +
ncgen/ncgenl.c | 21 +-
ncgen/ncgeny.c | 7 +-
ncgen/ncgeny.h | 2 +-
ncgen/offsets.c | 114 +-
ncgen/run_nc4_tests.sh | 41 +-
ncgen/run_tests.sh | 32 +-
ncgen/semantics.c | 88 +-
nctest/tst_rename.c | 2 +-
oc2/dap.y | 2 +-
oc2/dapy.c | 1669 ++--
oc2/dapy.h | 88 +-
oc2/ocrc.c | 16 +-
228 files changed, 25025 insertions(+), 29380 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 43d6fbb..2a08450 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,29 +5,29 @@ services:
env:
matrix:
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-signed
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-signed
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-unsigned
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-unsigned
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-unsigned
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-netcdf-4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-unsigned
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-signed
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-signed
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-signed
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-fsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-signed
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned
- - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned
- - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x64-unsigned
+ - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x64-unsigned
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-gcc-x86-unsigned
+ - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=clang AC_COPTS='CFLAGS=-funsigned-char --disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF' CURHOST=docker-clang-x86-unsigned
before_install:
- docker pull $DOCKIMG > /dev/null
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 DISTCHECK=$DISTCHECK -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 AC_OPTS="$AC_OPTS" -e CTEST_OUTPUT_ON_FAILURE=1 -v $(pwd):/netcdf-c $DOCKIMG
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 72b4eb8..e87f3de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,11 +27,11 @@ set(PACKAGE "netCDF" CACHE STRING "")
SET(NC_VERSION_MAJOR 4)
SET(NC_VERSION_MINOR 4)
SET(NC_VERSION_PATCH 1)
-SET(NC_VERSION_NOTE "")
+SET(NC_VERSION_NOTE ".1")
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.3.0)
+SET(netCDF_LIB_VERSION 11.4.0)
SET(netCDF_SO_VERSION 11)
SET(PACKAGE_VERSION ${VERSION})
@@ -393,6 +393,33 @@ IF(NOT MSVC)
ENDIF(BUILD_FORTRAN)
ENDIF()
+
+###
+# Allow the user to specify libraries
+# to link against, similar to automakes 'LIBS' variable.
+###
+SET(NC_EXTRA_DEPS "" CACHE STRING "Additional libraries to link against.")
+IF(NC_EXTRA_DEPS)
+ STRING(REPLACE " " ";" DEPS_LIST ${NC_EXTRA_DEPS})
+ FOREACH(_DEP ${DEPS_LIST})
+ STRING(REGEX REPLACE "^-l" "" _LIB ${_DEP})
+ FIND_LIBRARY("${_LIB}_DEP" NAMES "${_LIB}" "lib${_LIB}")
+ MESSAGE(${${_LIB}_DEP})
+ IF(NOT "${_LIB}_DEP")
+ MESSAGE(FATAL_ERROR "Error finding ${_LIB}.")
+ ELSE()
+ MESSAGE(STATUS "Found ${_LIB}: ${${_LIB}_DEP}")
+ ENDIF()
+ SET(EXTRA_DEPS ${EXTRA_DEPS} "${${_LIB}_DEP}")
+ ENDFOREACH()
+ MESSAGE("Extra deps: ${EXTRA_DEPS}")
+ LIST(REMOVE_DUPLICATES EXTRA_DEPS)
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${EXTRA_DEPS})
+ENDIF()
+###
+# End user-specified dependent libraries.
+###
+
# Option to use HDF4
OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF5 read capability(HDF4, HDF5 and Zlib required)." OFF)
IF(ENABLE_HDF4)
@@ -572,6 +599,10 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
##
# Include the HDF5 include directory.
##
+ IF(HDF5_INCLUDE_DIRS AND NOT HDF5_INCLUDE_DIR)
+ SET(HDF5_INCLUDE_DIR ${HDF5_INCLUDE_DIRS})
+ ENDIF()
+ MESSAGE(STATUS "Using HDF5 include dir: ${HDF5_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
###
@@ -636,6 +667,18 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
SET(HDF5_C_LIBRARY hdf5)
ENDIF(NOT MSVC)
+ #Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
+ CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5P_SZIP "" USE_SZIP)
+ IF(USE_SZIP)
+ FIND_LIBRARY(SZIP NAMES szip sz)
+ IF(SZIP)
+ SET(SZIP_LIBRARY ${SZIP})
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SZIP})
+ ELSE()
+ MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
+ ENDIF()
+ ENDIF()
+
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5free_memory "" HDF5_HAS_H5FREE)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS)
@@ -645,15 +688,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
SET(HDF5_CC h5cc)
ENDIF()
- # execute_process(COMMAND sh -c "${HDF5_CC} -showconfig | grep -i 'HDF5 version' | cut -d: -f2 | tr -d ' '"
- # OUTPUT_VARIABLE HDF5_VERSION
- # ERROR_QUIET)
-
- # It cannot be assumed that libhdf5.settings exists. If it doesn't,
- # the call to h5cc will have failed. At this point we will have to
- # trust the user that they have configured their system properly.
-
-
# Starting with hdf5 1.8.11, dynamic loading is an option.
# In case hdf5 has a dependency on libdl, the user must specify
# -DENABLE_DYNAMIC_LOADING=ON when configuring netcdf.
@@ -671,19 +705,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
INCLUDE_DIRECTORIES(${LIBDL_INCLUDE_DIR})
ENDIF()
- #Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
- CHECK_LIBRARY_EXISTS(hdf5 H5Z_SZIP "" USE_SZIP)
- IF(USE_SZIP)
- FIND_LIBRARY(SZIP NAMES szip sz)
- IF(SZIP)
- SET(SZIP_LIBRARY ${SZIP})
- ELSE()
- MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
- ENDIF()
- #FIND_PACKAGE(SZIP NO_MODULE REQUIRED)
- #INCLUDE_DIRECTORIES(${SZIP_INCLUDE_DIR})
- ENDIF()
-
SET(H5_USE_16_API 1)
OPTION(NC_ENABLE_HDF_16_API "Enable HDF5 1.6.x Compatibility(Required)" ON)
IF(NOT NC_ENABLE_HDF_16_API)
@@ -860,30 +881,12 @@ IF(ENABLE_TESTS)
ENDIF()
###
-# Allow the user to specify libraries
-# to link against, similar to automakes 'LIBS' variable.
+# Option to enable extreme numbers during testing.
###
-SET(NC_EXTRA_DEPS "" CACHE STRING "Additional libraries to link against.")
-IF(NC_EXTRA_DEPS)
- STRING(REPLACE " " ";" DEPS_LIST ${NC_EXTRA_DEPS})
- FOREACH(_DEP ${DEPS_LIST})
- STRING(REGEX REPLACE "^-l" "" _LIB ${_DEP})
- FIND_LIBRARY("${_LIB}_DEP" NAMES "${_LIB}" "lib${_LIB}")
- MESSAGE(${${_LIB}_DEP})
- IF(NOT "${_LIB}_DEP")
- MESSAGE(FATAL_ERROR "Error finding ${_LIB}.")
- ELSE()
- MESSAGE(STATUS "Found ${_LIB}: ${${_LIB}_DEP}")
- ENDIF()
- SET(EXTRA_DEPS ${EXTRA_DEPS} "${${_LIB}_DEP}")
- ENDFOREACH()
- MESSAGE("Extra deps: ${EXTRA_DEPS}")
- LIST(REMOVE_DUPLICATES EXTRA_DEPS)
+OPTION(ENABLE_EXTREME_NUMBERS "Enable extreme numbers during testing, such as MAX_INT-1" ON)
+IF(ENABLE_EXTREME_NUMBERS)
+ SET(USE_EXTREME_NUMBERS ON)
ENDIF()
-###
-# End user-specified dependent libraries.
-###
-
# Enable Large file tests
IF(ENABLE_LARGE_FILE_TESTS)
@@ -1074,14 +1077,6 @@ MARK_AS_ADVANCED(ENABLE_DAP_REMOTE_TESTS ENABLE_DAP_LONG_TESTS USE_REMOTE_CDASH)
MARK_AS_ADVANCED(ENABLE_DOXYGEN_BUILD_RELEASE_DOCS DOXYGEN_ENABLE_TASKS ENABLE_DOXYGEN_SERVER_SIDE_SEARCH)
MARK_AS_ADVANCED(ENABLE_SHARED_LIBRARY_VERSION)
-# This option is temporary and should always be on except if netcdf-4 is off.
-IF(ENABLE_NETCDF_4)
-OPTION(ENABLE_FILEINFO "Enable FILEINFO." ON)
-ELSE()
-OPTION(ENABLE_FILEINFO "Enable FILEINFO." OFF)
-ENDIF()
-MARK_AS_ADVANCED(ENABLE_FILEINFO)
-
################################
# Option checks
################################
@@ -1385,6 +1380,7 @@ MACRO(print_conf_summary)
MESSAGE(STATUS "Coverage Tests: ${ENABLE_COVERAGE_TESTS}")
MESSAGE(STATUS "Parallel Tests: ${ENABLE_PARALLEL_TESTS}")
MESSAGE(STATUS "Large File Tests: ${ENABLE_LARGE_FILE_TESTS}")
+ MESSAGE(STATUS "Extreme Numbers: ${ENABLE_EXTREME_NUMBERS}")
ENDIF()
MESSAGE("")
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index e5cbefb..745e847 100755
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -7,6 +7,16 @@ This file contains a high-level description of this package's evolution. Release
> Note: The combination of netCDF-C library versions earlier than 4.4.1 and libhdf5 1.10.0+ should be avoided, as they will result in binary files not readable by systems using earlier libhdf5 versions.
+## 4.4.1.1 - November 21, 2016
+
+* [Bug] Fixed an issue where `ncgen` would potentially crash or write incorrect netCDF4 binary data under very specific circumstances. This bug did *not* affect data written on 32-bit systems or by using the netCDF library; it was specific to `ncgen`. This would only happen when writing a compound data type containing an 8-byte data type followed by a 4-byte data type *and* the 4-byte data type was not properly aligned; this would *possibly* result in incorrect padding. This did not af [...]
+* [Documentation] Updated documentation related to netCDF variable names and DAP2 access to reflect the undefined behavior potentially observed when DAP2 reserved keywords are used as netCDF variable names. See [GitHub #308](https://github.com/Unidata/netcdf-c/issues/308) for more information.
+* [Bug] Fixed an issue with `nc_inq_type()` not returning proper value in some circumstances. See [GitHub #317](https://github.com/Unidata/netcdf-c/issues/317) for more information.
+* [Bug] Corrected an issue related to test failures when `--disable-utilities` or `-DENABLE_UTILITIES=OFF` are specified when building with autotools or cmake, respectively. See [GitHub #313](https://github.com/Unidata/netcdf-c/issues/313) for more information.
+* [Bug][Enhancement] Corrected a behavioral issue with the `_NCProperties` attribute taking up too much space. See [GitHub #300](https://github.com/Unidata/netcdf-c/issues/300) and [GitHub #301](https://github.com/Unidata/netcdf-c/pull/301) for more information.
+
+* [Bug] Corrected behavior for `nc-config` so that, if `nf-config` is found in system, the proper fortran-related information will be conveyed. See [GitHub #296](https://github.com/Unidata/netcdf-c/issues/296] for more information.
+
## 4.4.1 - June 28, 2016
* [File Change] Starting with release 4.4.1, netCDF-4 files created will have superblock version 0 instead of superblock version 2, as was observed in previous netCDF versions. This is due to a workaround required to avoid backwards binary incompatibility when using libhdf5 1.10.x or greater. Superblock versions 0 and 2 appear to be forward and backward compatible. Other than a different superblock number the data should remain consistent.
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 82bd163..0fb66a3 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -87,7 +87,6 @@ are set when opening a binary file on Windows. */
#cmakedefine ENABLE_DAP 1
#cmakedefine ENABLE_DAP_GROUPS 1
#cmakedefine ENABLE_DAP_REMOTE_TESTS 1
-#cmakedefine ENABLE_FILEINFO 1
#cmakedefine EXTRA_TESTS
#cmakedefine USE_NETCDF4 1
#cmakedefine USE_LIBDL 1
@@ -110,6 +109,7 @@ are set when opening a binary file on Windows. */
#cmakedefine USE_SZIP 1
#cmakedefine USE_ZLIB 1
#cmakedefine USE_X_GETOPT 1
+#cmakedefine ENABLE_EXTREME_NUMBERS
#cmakedefine LARGE_FILE_TESTS 1
#cmakedefine HAVE_DECL_ISFINITE 1
#cmakedefine HAVE_DECL_ISNAN 1
diff --git a/config.h.in b/config.h.in
index d4436d9..5b88c28 100644
--- a/config.h.in
+++ b/config.h.in
@@ -44,9 +44,6 @@
/* if true, do remote tests */
#undef ENABLE_DAP_REMOTE_TESTS
-/* file info */
-#undef ENABLE_FILEINFO
-
/* if true, run extra tests which may not work yet */
#undef EXTRA_TESTS
diff --git a/configure b/configure
index ae27670..eeed273 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.1.
+# Generated by GNU Autoconf 2.69 for netCDF 4.4.1.1.
#
# 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.1'
-PACKAGE_STRING='netCDF 4.4.1'
+PACKAGE_VERSION='4.4.1.1'
+PACKAGE_STRING='netCDF 4.4.1.1'
PACKAGE_BUGREPORT='support-netcdf at unidata.ucar.edu'
PACKAGE_URL=''
@@ -783,8 +783,6 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
-ENABLE_FILEINFO_FALSE
-ENABLE_FILEINFO_TRUE
BUILD_INTERNAL_DOCS
NC_ENABLE_DOXYGEN_PDF_OUTPUT
NC_ENABLE_DOXYGEN_PDF_OUTPUT_FALSE
@@ -1498,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.1 to adapt to many kinds of systems.
+\`configure' configures netCDF 4.4.1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1569,7 +1567,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of netCDF 4.4.1:";;
+ short | recursive ) echo "Configuration of netCDF 4.4.1.1:";;
esac
cat <<\_ACEOF
@@ -1786,7 +1784,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-netCDF configure 4.4.1
+netCDF configure 4.4.1.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2495,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.1, which was
+It was created by netCDF $as_me 4.4.1.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2857,7 +2855,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
NC_VERSION_MAJOR=4
NC_VERSION_MINOR=4
NC_VERSION_PATCH=1
- NC_VERSION_NOTE=""
+ NC_VERSION_NOTE=".1"
#####
# Set some variables used to generate a libnetcdf.settings file,
@@ -2866,11 +2864,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Create the VERSION file, which contains the package version from
# AC_INIT.
-echo 4.4.1>VERSION
+echo 4.4.1.1>VERSION
-{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.1" >&5
-$as_echo "$as_me: netCDF 4.4.1" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.1.1" >&5
+$as_echo "$as_me: netCDF 4.4.1.1" >&6;}
# Keep libtool macros in an m4 directory.
@@ -3530,7 +3528,7 @@ fi
# Define the identity of the package.
PACKAGE='netcdf'
- VERSION='4.4.1'
+ VERSION='4.4.1.1'
cat >>confdefs.h <<_ACEOF
@@ -3874,32 +3872,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_netcdf_4" >&5
$as_echo "$enable_netcdf_4" >&6; }
-####
-# Is Netcdf4 file info capture enabled; includes properties attribute
-# We do not actually provide a direct flag for disabling this
-if test "x$enable_netcdf_4" = xyes ; then
-enable_fileinfo=yes
-else
-enable_fileinfo=no
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking If file info capture is enabled" >&5
-$as_echo_n "checking If file info capture is enabled... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_fileinfo" >&5
-$as_echo "$enable_fileinfo" >&6; }
-if test "x$enable_fileinfo" = xyes ; then
-
-$as_echo "#define ENABLE_FILEINFO 1" >>confdefs.h
-
-fi
- if test x$enable_fileinfo = xyes; then
- ENABLE_FILEINFO_TRUE=
- ENABLE_FILEINFO_FALSE='#'
-else
- ENABLE_FILEINFO_TRUE='#'
- ENABLE_FILEINFO_FALSE=
-fi
-
-
# Does the user require dynamic loading?
# This is only for those hdf5 installs that support it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking do we require hdf5 dynamic-loading support" >&5
@@ -19209,10 +19181,6 @@ if test -z "${NC_ENABLE_DOXYGEN_PDF_OUTPUT_TRUE}" && test -z "${NC_ENABLE_DOXYGE
as_fn_error $? "conditional \"NC_ENABLE_DOXYGEN_PDF_OUTPUT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${ENABLE_FILEINFO_TRUE}" && test -z "${ENABLE_FILEINFO_FALSE}"; then
- as_fn_error $? "conditional \"ENABLE_FILEINFO\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19759,7 +19727,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.1, which was
+This file was extended by netCDF $as_me 4.4.1.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19829,7 +19797,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.1
+netCDF config.status 4.4.1.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 196f7d4..264108c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-M# -*- Autoconf -*-
+# -*- Autoconf -*-
## Process this file with autoconf to produce a configure script.
# This is part of Unidata's netCDF package. Copyright 2005-2012, see
@@ -15,7 +15,7 @@ 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.1], [support-netcdf at unidata.ucar.edu])
+AC_INIT([netCDF], [4.4.1.1], [support-netcdf at unidata.ucar.edu])
##
# Prefer an empty CFLAGS variable instead of the default -g -O2.
@@ -27,7 +27,7 @@ AC_INIT([netCDF], [4.4.1], [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=1
-AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE=""
+AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE=".1"
#####
# Set some variables used to generate a libnetcdf.settings file,
@@ -205,21 +205,6 @@ enable_netcdf_4=no
fi
AC_MSG_RESULT([$enable_netcdf_4])
-####
-# Is Netcdf4 file info capture enabled; includes properties attribute
-# We do not actually provide a direct flag for disabling this
-if test "x$enable_netcdf_4" = xyes ; then
-enable_fileinfo=yes
-else
-enable_fileinfo=no
-fi
-AC_MSG_CHECKING([If file info capture is enabled])
-AC_MSG_RESULT([$enable_fileinfo])
-if test "x$enable_fileinfo" = xyes ; then
-AC_DEFINE([ENABLE_FILEINFO], [1], [file info])
-fi
-AM_CONDITIONAL(ENABLE_FILEINFO, [test x$enable_fileinfo = xyes])
-
# Does the user require dynamic loading?
# This is only for those hdf5 installs that support it.
AC_MSG_CHECKING([do we require hdf5 dynamic-loading support])
diff --git a/docs/Doxyfile.developer b/docs/Doxyfile.developer
index c8e9208..412275a 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.1
+PROJECT_NUMBER = 4.4.1.1
# 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
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 6951579..9f94508 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -322,7 +322,7 @@ We test releases on the following operating systems with various compilers:
- Solaris
- Windows (some versions, see below)
-The [NetCDF Installation and Porting Guide](http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/index.html) explains how to build netCDF from source on various platforms. Often, it's as easy as running
+The [NetCDF Installation and Porting Guide](@ref getting_and_building_netcdf) explains how to build netCDF from source on various platforms. Often, it's as easy as running
~~~~ {.boldcode}
./configure
@@ -483,7 +483,7 @@ How do I build and install netCDF for a specific development environment? {#How-
You have to build and install the netCDF C library first, before you build and install other language libraries that depend on it, such as Fortran, C++, or Python netCDF libraries. The netCDF Java library is mostly independent of the netCDF C library, unless you need to write netCDF-4 files from Java, in which case you will also need an installed netCDF C library.
For more details, see
-[Getting and Building netCDF](http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html).
+[NetCDF Installation and Porting Guide](@ref getting_and_building_netcdf).
----------
diff --git a/docs/OPeNDAP.dox b/docs/OPeNDAP.dox
index 813aab9..576f879 100644
--- a/docs/OPeNDAP.dox
+++ b/docs/OPeNDAP.dox
@@ -32,6 +32,7 @@ See the following pages for more information.
- <a href="auth.html">netCDF Authorization Support</a>
- \subpage esg
- \subpage dap_to_netcdf
+- \subpage dap2_reserved_keywords
- \subpage var_dim_trans
- \subpage var_name_trans
@@ -248,6 +249,36 @@ within grids are left out in order to mimic the behavior of libnc-dap.
lon
\endcode
+\page dap2_reserved_keywords DAP2 Reserved Keywords
+
+\tableofcontents
+
+In the OPeNDAP DAP2 protocol, there are a number of reserved keywords. These keywords are case insensitive and if you use one as a netCDF variable name, you may encounter odd behavior such as case changes (depending on the client DDS/DAS parser). The list of reserved keywords as used by the netCDF-C library parser are as follows:
+
+- alias
+- array
+- attributes
+- byte
+- dataset
+- error
+- float32
+- float64
+- grid
+- int16
+- int32
+- maps
+- sequence
+- string
+- structure
+- uint16
+- uint32
+- url
+- code
+- message
+- program_type
+- program
+
+
\page var_dim_trans Variable Dimension Translation
\tableofcontents
@@ -690,4 +721,4 @@ 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.
-*/
\ No newline at end of file
+*/
diff --git a/docs/attribute_conventions.md b/docs/attribute_conventions.md
index cb05ccb..c589ac7 100644
--- a/docs/attribute_conventions.md
+++ b/docs/attribute_conventions.md
@@ -131,10 +131,11 @@ It is strongly recommended that applicable conventions be followed unless there
These attributes can occur in netCDF enhanced (netcdf-4) files beginning
with version 4.4.1. They all are associated with the root group as
-global attributes. They are hidden in the sense that they have no
-attribute number, so they can only be accessed thru the netcdf-C api
-calls via the name. Additionally, these attributes will not be counted
-in the number of global attributes in the root group.
+global attributes, although only _NCProperties is actually stored in the
+file; the others are computed. They are hidden in the sense that they
+have no attribute number, so they can only be accessed thru the netcdf-C
+API calls via the name. Additionally, these attributes will not be
+counted in the number of global attributes in the root group.
The simplest way to view these attributes is to use the -s flag to the
ncdump command. Alternatively, one can use the following API calls to
@@ -152,7 +153,6 @@ Using the following API calls will fail.
- nc_del_att
- nc_put_att (and derivatives)
-
`_NCProperties`
> This attribute is persistent in the file, but hidden. It is inserted in the file at creation time and is never modified after that point. It specifies the following.
diff --git a/docs/guide.dox b/docs/guide.dox
index eee0a9a..a26f791 100644
--- a/docs/guide.dox
+++ b/docs/guide.dox
@@ -750,6 +750,8 @@ characters.
Some widely used conventions restrict names to only alphanumeric
characters or underscores.
+\note Note that, when using the DAP2 protocol to access netCDF data, there are \em reserved keywords, the use of which may result in undefined behavior. See \ref dap2_reserved_keywords for more information.
+
\section archival Is NetCDF a Good Archive Format?
NetCDF classic or 64-bit offset formats can be used as a
diff --git a/docs/install.md b/docs/install.md
index 50de54f..fd70e05 100755
--- a/docs/install.md
+++ b/docs/install.md
@@ -3,27 +3,18 @@ Getting and Building netCDF {#getting_and_building_netcdf}
[TOC]
-This document is for getting and building the netCDF C library and
-utilities for the most recent released version. Other libraries that
-depend on the netCDF C library, such as the Fortran, Python, Java, and
-C++ libraries, are available as separate distributions that can be
-optionally built and installed after the C library is successfully
-installed. The netCDF-Java library is independent of the netCDF C
-library unless writing netCDF-4 files from Java is required.
-
+This document is for getting and building the netCDF C library and utilities for the most recent released version. Other libraries that depend on the netCDF C library, such as the Fortran, Python, Java, and C++ libraries, are available as separate distributions that can be optionally built and installed after the C library is successfully installed. The netCDF-Java library is independent of the netCDF C library unless writing netCDF-4 files from Java is required.
Getting netCDF-C {#getting}
=========================
* For information regarding the netCDF-Fortran libraries, see \subpage building_netcdf_fortran.
-* Functionality to make it easier to build netcdf-fortran as part of
- the netcdf-c build for *non-MSVC* builds may be enabled at configure
- time by using the following **Highly Experimental** options:
+* Functionality to make it easier to build netcdf-fortran as part of the netcdf-c build for *non-MSVC* builds may be enabled at configure time by using the following **Highly Experimental** options:
* Autotools: `--enable-remote-fortran-bootstrap`
* CMake: `-DENABLE_REMOTE_FORTRAN_BOOTSTRAP=ON`
-For more details, see the <a href="http://github.com/Unidata/netcdf-c/blob/v4.3.3.1/RELEASE_NOTES.md">draft instructions</a> in the Release 4.3.3-rc3 Notes.
+For more details, see the <a href="https://github.com/Unidata/netcdf-c/blob/master/RELEASE_NOTES.md">draft instructions</a> in the Release Notes under the `4.3.3-rc3` section.
Getting pre-built netCDF-C libraries. {#sec_get_pre_built}
-------------------------------------
@@ -96,91 +87,63 @@ CMake and Windows support {#sub}
Building with netCDF-4 and the Remote Data Client {#build_default}
--------------------------------
-The usual way of building netCDF requires the HDF5, zlib, and curl
-libraries. Versions required are
-at least HDF5 1.8.9, zlib 1.2.5, and curl 7.18.0 or later.
-
-HDF5 and zlib packages are available from the <a
-href="http://www.hdfgroup.org/downloads/">HDF5 downloads site</a> and
-the <a href="http://www.zlib.net/">zlib home site</a>.
-If you wish to use the remote data client code, then you
-will also need libcurl, which can be obtained from the <a
-href="http://curl.haxx.se/download.html">curl website</a>.
-
-Note that for building netCDF, it is not necessary to build the HDF5
-Fortran, C++, or Java API's. Only the HDF5 C library is used, even
-for netCDF Fortran or C++ libraries.
-
-Optionally, you can also build netCDF-4 with the szip library
-(a.k.a. szlib). If building with szlib, get szip 2.0 or later.
-NetCDF cannot create szipped data files, but can read
-HDF5 data files that have used szip.
-To determine whether license restrictions on the use of szip apply to
-your situation, see the <a
-href="http://www.hdfgroup.org/doc_resource/SZIP/">web page on szip
-compression in HDF products</a>.
-
-If ``make check'' fails for either zlib or HDF5, the problem must be
-resolved before the netCDF-4 installation can continue. For HDF5
-problems, see the <a
-href="http://www.hdfgroup.org/services/support.html">HDF5 help
-services</a>.
-
-To build zlib from source, specify where you want to install zlib in
-a shell variable you will also use later (ZDIR, for example), and build it like this
-from the top-level zlib source directory
+The usual way of building netCDF requires the HDF5, zlib, and curl libraries. Versions required are at least HDF5 1.8.9, zlib 1.2.5, and curl 7.18.0 or later.
+
+HDF5 and zlib packages are available from the <a href="http://www.hdfgroup.org/downloads/">HDF5 downloads site</a> and the <a href="http://www.zlib.net/">zlib home site</a>. If you wish to use the remote data client code, then you will also need libcurl, which can be obtained from the <a href="http://curl.haxx.se/download.html">curl website</a>.
+
+> Note that for building netCDF, it is not necessary to build the HDF5 Fortran, C++, or Java API's. Only the HDF5 C library is used, even for netCDF Fortran or C++ libraries.
+
+### Optional: szip support {#op_szip_support}
+
+*Optionally*, you can also build netCDF-4 with the szip library (a.k.a. szlib). If building with szlib, get szip 2.0 or later. NetCDF cannot create szipped data files, but can read HDF5 data files that have used szip. To determine whether license restrictions on the use of szip apply to your situation, see the <a href="http://www.hdfgroup.org/doc_resource/SZIP/">web page on szip compression in HDF products</a>.
+
+If `make check` fails for either `zlib` or `HDF5`, the problem must be resolved before the netCDF-4 installation can continue. For HDF5 problems, see the <a href="http://www.hdfgroup.org/services/support.html">HDF5 help services</a>.
+
+### Building zlib from source {#build_zlib_from_source}
+To build zlib from source, specify where you want to install zlib in a shell variable you will also use later (ZDIR, for example), and build it like this from the top-level zlib source directory
+
+~~~~{.py}
$ # Build and install zlib
$ ZDIR=/usr/local
$ ./configure --prefix=${ZDIR}
$ make check
$ make install # or sudo make install, if root permissions required
+~~~~
-Next, specify where you want to install HDF5 in another shell
-variable, for example H5DIR, and build it from the HDF5 top-level
-source directory:
+### Building hdf5 from source {#build_hdf5_from_source}
+Next, specify where you want to install HDF5 in another shell variable, for example H5DIR, and build it from the HDF5 top-level source directory:
+
+~~~~{.py}
$ # Build and install HDF5
$ H5DIR=/usr/local
$ ./configure --with-zlib=${ZDIR} --prefix=${H5DIR}
$ make check
$ make install # or sudo make install, if root permissions required
+~~~~
+
+If you are building HDF5 with the optional szip library, include the `--with-szlib=` option to specify where it was installed.
-If you are building HDF5 with the optional szip library, include the
-<CODE>--with-szlib=</CODE> option to specify where it was installed.
+In all cases, the installation location specified with the `--prefix` option *must be different* from the source directory where the software is being built.
-In all cases, the installation location specified with the <CODE>--prefix</CODE>
-option *must be different* from the source directory where the software
-is being built.
+### Building netCDF-4 and the Remote Data Client from source {#build_nc4_dap_from_source}
-Before building netCDF, you may need to add ${H5DIR}/lib to the
-LD_LIBRARY_PATH environment variable if that lib directory is not searched
-by default. See the <a
-href="http://www.unidata.ucar.edu/netcdf/docs/faq.html#Shared%20Libraries">netCDF
-FAQ</a> for more details on using shared libraries.
+Before building netCDF, you may need to add `${H5DIR}/lib` to the LD_LIBRARY_PATH environment variable if that lib directory is not searched by default. See the <a href="http://www.unidata.ucar.edu/netcdf/docs/faq.html#Shared%20Libraries">netCDF FAQ</a> for more details on using shared libraries.
-Indicate where you want to install netCDF in another shell
-variable, for example NCDIR. Then run the netCDF configure script,
-specifying where HDF5 was installed using the CPPFLAGS and LDFLAGS
-environment variables. For example, from the top-level netCDF source
-directory:
+Indicate where you want to install netCDF in another shell variable, for example NCDIR. Then run the netCDF configure script, specifying where HDF5 was installed using the CPPFLAGS and LDFLAGS environment variables. For example, from the top-level netCDF source directory:
+~~~~{.py}
$ # Build and install netCDF-4
$ NCDIR=/usr/local
$ CPPFLAGS=-I${H5DIR}/include LDFLAGS=-L${H5DIR}/lib ./configure --prefix=${NCDIR}
$ make check
$ make install # or sudo make install
+~~~~
-If you don't provide a <CODE>--prefix</CODE> option, installation will
-be in /usr/local/, in subdirectories lib/, include/, and bin/. The
-installation location specified with the <CODE>--prefix</CODE> option
-must be different from the source directory where the software is
-being built.
+If you don't provide a `--prefix` option, installation will be in `/usr/local/`, in subdirectories lib/, include/, and bin/. The installation location specified with the `--prefix` option must be different from the source directory where the software is being built.
-WARNING: you should be able to use parallel 'make all'. But 'make check'
-will probably fail if you use parallel make. This is because historically,
-there are inter-dependencies between test programs. It is unlikely
-that this will be fixed any time soon, if ever.
+> WARNING: you should be able to use parallel 'make all'. But 'make check' will probably fail if you use parallel make. This is because historically, there are inter-dependencies between test programs. It is unlikely that this will be fixed any time soon, if ever.
Building netCDF with Classic Library Only {#build_classic}
---------------------------------------
@@ -197,22 +160,28 @@ If necessary, set the NCDIR shell variable to indicate where netCDF should be
installed. Then to build a netCDF-3 library without support for the
netCDF-4 formats or functions, but with remote client access, use:
+~~~~{.py}
$ # Build and install netCDF-3 from netCDF-4 source
$ ./configure --prefix=${NCDIR} --disable-netcdf-4
$ make check install
+~~~~
To build with full support for netCDF-4 API's and format but without
remote client access, use:
+~~~~{.py}
$ # Build and install netCDF-4 without DAP client support
$ ./configure --prefix=${NCDIR} --disable-dap
$ make check install
+~~~~
To build without netCDF-4 support or remote client access, use:
+~~~~{.py}
$ # Build and install minimal netCDF-3 with no DAP client support
$ ./configure --prefix=${NCDIR} --disable-netcdf-4 --disable-dap
$ make check install
+~~~~
If you get the message that netCDF installed correctly, then you are
done!
@@ -224,12 +193,12 @@ The netCDF-4 library can read HDF4 data files, if they were created
with the SD (Scientific Data) API.
For this to work, you must build the HDF4 library with the
-configure option <CODE>--disable-netcdf</CODE>
+configure option `--disable-netcdf`
to prevent it from building an HDF4 version of the netCDF-2 library
that conflicts with the netCDF-2 functions that are built into the Unidata
netCDF library.
-Then, when building netCDF-4, use the <CODE>--enable-hdf4</CODE>.
+Then, when building netCDF-4, use the `--enable-hdf4`.
option to configure. The location for the HDF4 header files and
library must be specified in the CPPFLAGS and LDFLAGS environment variables
or configure options.
@@ -242,19 +211,23 @@ installed in H5DIR and you will build and install the HDF4 library in
H4DIR (which could be the same as H5DIR). From the top-level HDF4
source directory:
+~~~~{.py}
$ # Build and install HDF4
$ ./configure --enable-shared --disable-netcdf --disable-fortran --prefix=${H4DIR}
$ make check
$ make install
+~~~~
Then from the top-level netCDF directory:
+~~~~{.py}
$ # Build and install netCDF-4 with HDF4 access enabled
$ CPPFLAGS="-I${H5DIR}/include -I${H4DIR}/include" \
LDFLAGS="-L${H5DIR}/lib -L${H4DIR}/lib" \
./configure --enable-hdf4 --enable-hdf4-file-tests
$ make check
$ make install
+~~~~
Building with Parallel I/O Support {#build_parallel}
--------------
@@ -267,27 +240,24 @@ an mpicc wrapper script.
The following works from the top-level HDF5 source directory to build
HDF5 with parallel I/O:
+~~~~{.py}
$ # Build and install HDF5 with parallel support
$ CC=mpicc ./configure --enable-parallel --prefix=${H5DIR}
$ make check
$ make install
+~~~~
-If the HDF5 used by netCDF has been built with parallel I/O, then
-netCDF will also be built with inherited support for parallel
-I/O. This allows parallel I/O access to netCDF-4/HDF5 files. Note that
-shared libraries are not supported for parallel HDF5, which makes
-linking more difficult to get right. (See /ref netcdf_formats for
-more information about the netCDF format variants.)
+If the HDF5 used by netCDF has been built with parallel I/O, then netCDF will also be built with inherited support for parallel I/O. This allows parallel I/O access to netCDF-4/HDF5 files. (See /ref netcdf_formats for more information about the netCDF format variants.)
-From the top-level netCDF-4 source directory, the following builds
-netCDF-4 with parallel I/O, assuming H5DIR specifies where parallel
-HDF5 was installed:
+From the top-level netCDF-4 source directory, the following builds netCDF-4 with parallel I/O, assuming H5DIR specifies where parallel HDF5 was installed:
+~~~~{.py}
$ # Build, test, and install netCDF-4 with HDF5 parallel support
$ CC=mpicc CPPFLAGS=-I${H5DIR}/include LDFLAGS=-L${H5DIR}/lib \
./configure --disable-shared --enable-parallel-tests --prefix=${NCDIR}
$ make check
$ make install
+~~~~
If parallel I/O access to netCDF classic and 64-bit offset files is
needed, an alternate
@@ -297,6 +267,7 @@ installed in the directory named by the PNDIR shell variable.
Then, from the top-level netCDF-4 source directory, configure netCDF
with the "--enable-pnetcdf" option:
+~~~~{.py}
$ # Build, test, and install netCDF-4 with pnetcdf support
$ CC=mpicc CPPFLAGS="-I${H5DIR}/include -I${PNDIR}/include" \
LDFLAGS="-L${H5DIR}/lib -L${PNDIR}/lib" ./configure \
@@ -304,6 +275,7 @@ with the "--enable-pnetcdf" option:
--prefix=${NCDIR}
$ make check
$ make install
+~~~~
Linking to netCDF-C {#linking}
-------------------
@@ -318,35 +290,41 @@ For example, you might build other applications with netCDF-4 by
setting the LIBS environment variable, assuming NCDIR, H5DIR, and ZDIR
indicate where netCDF, HDF5, and zlib are installed:
+~~~~{.py}
LIBS="-L${NCDIR}/lib -lnetcdf -L${H5DIR}/lib -lhdf5_hl -lhdf5 -L${ZDIR}/lib -lz -lm"
+~~~~
-For shared builds, only <CODE>-L${NCDIR}/lib -lnetcdf</CODE> is
+For shared builds, only `-L${NCDIR}/lib -lnetcdf` is
needed. All other libraries will be found automatically.
-The <CODE>pkg-config</CODE> or <CODE>nc-config</CODE> utilities can be
+The `pkg-config` or `nc-config` utilities can be
used to specify build options for software that uses netCDF. For
example, to compile and link an application named myapp.c with a
netCDF-C libraries, whether shared or static, you can use
+~~~~{.py}
$ cc -o myapp myapp.c `nc-config --cflags --libs`
+~~~~
or
+~~~~{.py}
$ PKG_CONFIG_PATH=${NCDIR}/lib/pkgconfig:$PKG_CONFIG_PATH
$ export PKG_CONFIG_PATH
$ cc -o myapp myapp.c `pkg-config --cflags --libs netcdf`
+~~~~
configure options {#configure_options}
-----------------------------
-These options are used for `autotools`-based builds. For `cmake` options, see
+These options are used for `autotools`-based builds.yup
-Note: --disable prefix indicates that the option is normally enabled.
+Note: `--disable` prefix indicates that the option is normally enabled.
<table>
<tr><th>Option<th>Description<th>Dependencies
<tr><td>--disable-doxygen<td>Disable generation of documentation.<td>doxygen
<tr><td>--disable-fsync<td>disable fsync support<td>kernel fsync support
-<tr><td>--enable-valgrind-tests <td>build with valgrind-tests; static builds only<td>valgrind
+
<tr><td>--disable-netcdf-4<td>build netcdf-3 without HDF5 and zlib<td>
<tr><td>--disable-netcdf4<td>synonym for disable-netcdf-4
<tr><td>--enable-hdf4<td>build netcdf-4 with HDF4 read capability<td>HDF4, HDF5 and zlib
@@ -369,17 +347,17 @@ Note: --disable prefix indicates that the option is normally enabled.
<tr><td>--enable-large-file-tests <td>Run tests which create very large data
files<td>~13 GB disk space required, but recovered when
tests are complete). See option --with-temp-large to
- specify temporary directory<td>
+ specify temporary directory
<tr><td>--enable-benchmarks<td>Run benchmarks. This is an experimental feature.
The benchmarks are extra tests, used to check netCDF performance.
<td>sample data files from the Unidata ftp site
<tr><td>--disable-extreme-numbers
<td>don't use extreme numbers during testing, such as MAX_INT - 1<td>
-<tr><td>--enable-dll<td>build a win32 DLL<td>mingw compiler
<tr><td>--disable-shared<td>don't build shared libraries<td>
<tr><td>--disable-static<td>don't build static libraries<td>
<tr><td>--disable-largefile<td>omit support for files larger than 2GB<td>
-<tr><td>--enable-mmap<td>Use mmap to implement NC_DISKLESS<td>
+<tr><td>--enable-mmap<td>Use mmap to implement NC_DISKLESS<td>System-provided `mmap` or `mremap` functions
+<tr><td>--enable-valgrind-tests <td>build with valgrind-tests; static builds only<td>valgrind
</table>
Build Instructions for netCDF-C using CMake {#netCDF-CMake}
diff --git a/docs/netcdf.m4 b/docs/netcdf.m4
index 2baa478..19dd1d6 100644
--- a/docs/netcdf.m4
+++ b/docs/netcdf.m4
@@ -774,15 +774,15 @@ Learn about a compound type.
.HP
FDECL(def_vlen, (INCID(), INAME(), INCTYPE(base_typeid), ONCTYPE(xtypep)))
.sp
-Create a varaible length array type.
+Create a variable length array type.
.HP
FDECL(inq_vlen, (INCID(), INCTYPE(), ONAME(), OSIZET(datum_sizep), ONCTYPE(base_nc_typep)))
.sp
-Learn about a varaible length array type.
+Learn about a variable length array type.
.HP
FDECL(free_vlen, (nc_vlen_t *vl))
.sp
-Free memory comsumed by reading data of a varaible length array type.
+Free memory comsumed by reading data of a variable length array type.
.HP
FDECL(put_vlen_element, (INCID(), INCTYPE(), IVOIDP(vlen_element), ISIZET(len), IVOIDP(data)))
.sp
diff --git a/docs/old/netcdf-f90.texi b/docs/old/netcdf-f90.texi
index 335132d..31a0be6 100755
--- a/docs/old/netcdf-f90.texi
+++ b/docs/old/netcdf-f90.texi
@@ -5180,7 +5180,7 @@ rh in an existing netCDF dataset named foo.nc:
@findex NF90_INQ_VARID
@cindex NF90_INQ_VARID, example
-Given the name of a varaible, nf90_inq_varid finds the variable ID.
+Given the name of a variable, nf90_inq_varid finds the variable ID.
@heading Usage
@example
diff --git a/docs/release_header.html b/docs/release_header.html
index 9e7bcdb..bcca138 100644
--- a/docs/release_header.html
+++ b/docs/release_header.html
@@ -29,6 +29,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.1.1\">4.4.1.1</option>" +
" <option value=\"http://www.unidata.ucar.edu/software/netcdf/documentation/4.4.1\">4.4.1</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\">Historic Documentation</option>" +
diff --git a/docs/windows-binaries.md b/docs/windows-binaries.md
index e214ad0..fb25cc6 100644
--- a/docs/windows-binaries.md
+++ b/docs/windows-binaries.md
@@ -28,18 +28,18 @@ These libraries have been built using Visual Studio 2012. The downloads are ins
The included dependencies and versions are as follows:
-* `libhdf5`: 1.8.16
+* `libhdf5`: 1.8.17
* `libcurl`: 7.35.0
* `zlib`: 1.2.8
-## Latest Release (netCDF-C 4.4.1) {#msvc-latest-release}
+## Latest Release (netCDF-C 4.4.1.1) {#msvc-latest-release}
Configuration | 32-bit | 64-bit |
:-------------------|:-------- |:-------|
-netCDF 3 | [netCDF4.4.1-NC3-32.exe][r1] | [netCDF4.4.1-NC3-64.exe][r6]
-netCDF3+DAP | [netCDF4.4.1-NC3-DAP-32.exe][r2] | [netCDF4.4.1-NC3-DAP-64.exe][r6]
-netCDF4 | [netCDF4.4.1-NC4-32.exe][r3] | [netCDF4.4.1-NC4-64.exe][r7]
-netCDF4+DAP | [netCDF4.4.1-NC4-DAP-32.exe][r4] | [netCDF4.4.1-NC4-DAP-64.exe][r8]
+netCDF 3 | [netCDF4.4.1.1-NC3-32.exe][r1] | [netCDF4.4.1.1-NC3-64.exe][r6]
+netCDF3+DAP | [netCDF4.4.1.1-NC3-DAP-32.exe][r2] | [netCDF4.4.1.1-NC3-DAP-64.exe][r6]
+netCDF4 | [netCDF4.4.1.1-NC4-32.exe][r3] | [netCDF4.4.1.1-NC4-64.exe][r7]
+netCDF4+DAP | [netCDF4.4.1.1-NC4-DAP-32.exe][r4] | [netCDF4.4.1.1-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.1-NC3-32.exe
-[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC3-DAP-32.exe
-[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC4-32.exe
-[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC4-DAP-32.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC3-64.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC3-DAP-64.exe
-[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC4-64.exe
-[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1-NC4-DAP-64.exe
+[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC3-32.exe
+[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC3-DAP-32.exe
+[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC4-32.exe
+[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC4-DAP-32.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC3-64.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC3-DAP-64.exe
+[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC4-64.exe
+[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.1.1-NC4-DAP-64.exe
diff --git a/h5_test/tst_h_mem.c b/h5_test/tst_h_mem.c
index c4696e5..bc59418 100644
--- a/h5_test/tst_h_mem.c
+++ b/h5_test/tst_h_mem.c
@@ -9,6 +9,7 @@
*/
#include "nc_tests.h"
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 60eabd1..1cc7580 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -14,7 +14,7 @@ INSTALL(FILES ${netCDF_BINARY_DIR}/include/netcdf_meta.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT headers)
-IF(ENABLE_PNETCDF OR ENABLE_PARALLEL)
+IF(ENABLE_PNETCDF OR ENABLE_PARALLEL4)
INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf_par.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT headers)
diff --git a/include/nc4internal.h b/include/nc4internal.h
index 05ae839..bfd3678 100644
--- a/include/nc4internal.h
+++ b/include/nc4internal.h
@@ -102,10 +102,8 @@ typedef enum {VAR, DIM, ATT} NC_OBJ_T;
/* Boolean type, to make the code easier to read */
typedef enum {NC_FALSE = 0, NC_TRUE = 1} nc_bool_t;
-#ifdef ENABLE_FILEINFO
/*Forward*/
struct NCFILEINFO;
-#endif
/* Generic doubly-linked list node */
typedef struct NC_LIST_NODE
@@ -322,9 +320,7 @@ typedef struct NC_HDF5_FILE_INFO
nc_bool_t hdf4; /* True for HDF4 file */
int sdid;
#endif /* USE_HDF4 */
-#ifdef ENABLE_FILEINFO
struct NCFILEINFO* fileinfo;
-#endif
} NC_HDF5_FILE_INFO_T;
@@ -452,12 +448,9 @@ For netcdf4 files, capture state information about the following:
5. Per file: _NCProperties attribute
*/
-#ifdef ENABLE_FILEINFO
-
#define NCPROPS "_NCProperties"
#define NCPROPS_VERSION (1)
#define NCPROPSSEP '|'
-#define NCPROPS_LENGTH (8192)
/* Currently used properties */
#define NCPVERSION "version" /* Of the properties format */
@@ -475,7 +468,6 @@ struct NCFILEINFO {
int version; /* 0 => not defined */
char hdf5ver[NC_MAX_NAME+1];
char netcdfver[NC_MAX_NAME+1];
- char text[NCPROPS_LENGTH+1]; /* Value of the NCPROPS attribute */
} propattr;
};
@@ -484,11 +476,10 @@ extern struct NCPROPINFO globalpropinfo;
extern int NC4_fileinfo_init(void); /*libsrc4/ncinfo.c*/
extern int NC4_get_fileinfo(struct NC_HDF5_FILE_INFO* info, struct NCPROPINFO*); /*libsrc4/ncinfo.c*/
extern int NC4_put_propattr(struct NC_HDF5_FILE_INFO* info); /*libsrc4/ncinfo.c*/
+extern int NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap);
-/* ENABLE_FILEINFO => ENABLE_NETCDF4 */
extern int NC4_hdf5get_libversion(unsigned*,unsigned*,unsigned*);/*libsrc4/nc4hdf.c*/
extern int NC4_hdf5get_superblock(struct NC_HDF5_FILE_INFO*, int*);/*libsrc4/nc4hdf.c*/
extern int NC4_isnetcdf4(struct NC_HDF5_FILE_INFO*); /*libsrc4/nc4hdf.c*/
-#endif /*ENABLE_FILEINFO*/
#endif /* _NETCDF4_ */
diff --git a/include/nc_tests.h b/include/nc_tests.h
index b7a58c4..8ac5bc7 100644
--- a/include/nc_tests.h
+++ b/include/nc_tests.h
@@ -20,7 +20,7 @@ for conditions of use.
#include "netcdf_par.h"
#endif
#include "netcdf.h"
-#include "err_macros.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. */
diff --git a/include/netcdf.h b/include/netcdf.h
index 9748315..2dbcebe 100644
--- a/include/netcdf.h
+++ b/include/netcdf.h
@@ -1948,7 +1948,7 @@ ncrecget(int ncid, long recnum, void **datap);
EXTERNL int
ncrecput(int ncid, long recnum, void *const *datap);
- //EXTERNL int nc_finalize();
+/* EXTERNL int nc_finalize(); */
/* End v2.4 backward compatibility */
#endif /*!NO_NETCDF_2*/
diff --git a/libdap2/dceparselex.h b/libdap2/dceparselex.h
index 612814f..88bc9ae 100644
--- a/libdap2/dceparselex.h
+++ b/libdap2/dceparselex.h
@@ -40,12 +40,12 @@ typedef struct DCElexstate {
} DCElexstate;
/*! Specifies DCEparsestate. */
-typedef struct DCEparsestate {
+struct DCEparsestate {
DCEconstraint* constraint;
char errorbuf[1024];
int errorcode;
DCElexstate* lexstate;
-} DCEparsestate;
+};
/* Define a generic object carrier; this serves
essentially the same role as the typical bison %union
diff --git a/libdap2/env b/libdap2/env
index e4e59c3..d6d8bca 100644
--- a/libdap2/env
+++ b/libdap2/env
@@ -4,7 +4,7 @@ alias xx="cd ..;make; cd libdap2"
PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""; SHARP='#'
alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=;
-F="https://eosdap.hdfgroup.org:8080/opendap/data/test/kent/ceres-converted/edition_4/CER_SSF1deg-Hour_Terra-MODIS_TestSuite_000000.200407D01.hdf"
+F="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.dailyavgs/pressure/air.1947.nc"
if test -e "/cygdrive/f/git/netcdf-c" ; then
TOP="/cygdrive/f/git/netcdf-c"
diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c
index 5e17787..cf39fd3 100644
--- a/libdispatch/dfile.c
+++ b/libdispatch/dfile.c
@@ -547,12 +547,12 @@ stored.
<h2>Open Mode</h2>
-A zero value (or NC_NOWRITE) specifies the default behavior: open the
+A zero value (or ::NC_NOWRITE) specifies the default behavior: open the
dataset with read-only access, buffering and caching accesses for
efficiency.
-Otherwise, the open mode is NC_WRITE, NC_SHARE, or
-NC_WRITE|NC_SHARE. Setting the NC_WRITE flag opens the dataset with
+Otherwise, the open mode is ::NC_WRITE, ::NC_SHARE, or
+::NC_WRITE|::NC_SHARE. Setting the ::NC_WRITE flag opens the dataset with
read-write access. ("Writing" means any kind of change to the dataset,
including appending or changing data, adding or renaming dimensions,
variables, and attributes, or deleting attributes.)
@@ -1587,7 +1587,7 @@ nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
if(stat != NC_NOERR) { /* bad ncid; do what we can */
/* For compatibility, we need to allow inq about
atomic types, even if ncid is ill-defined */
- if(xtype <= ATOMICTYPEMAX5) {
+ if(xtype <= ATOMICTYPEMAX4) {
if(name) strncpy(name,NC_atomictypename(xtype),NC_MAX_NAME);
if(size) *size = NC_atomictypelen(xtype);
return NC_NOERR;
diff --git a/libdispatch/dgroup.c b/libdispatch/dgroup.c
index 5952bb9..8b1fe4b 100644
--- a/libdispatch/dgroup.c
+++ b/libdispatch/dgroup.c
@@ -40,9 +40,17 @@ than 32767. Similarly, the number of simultaneously open netCDF-4
files in one program context is limited to 32767.
*/
-/** \{ */
-/*!
+/** \{*/ /* All these functions are part of the above defgroup... */
+
+/*! Return the group ID for a group given the name.
+
+
+ @param[in] ncid A valid file or group ncid.
+ @param[in] name The name of the group you are querying.
+ @param[out] grp_ncid Pointer to memory to hold the group ncid.
+
+ @returns Error code or ::NC_NOERR or no error.
*/
int nc_inq_ncid(int ncid, const char *name, int *grp_ncid)
@@ -53,6 +61,15 @@ int nc_inq_ncid(int ncid, const char *name, int *grp_ncid)
return ncp->dispatch->inq_ncid(ncid,name,grp_ncid);
}
+/*! Get a list of groups or subgroups from a file or groupID.
+
+ @param[in] ncid The ncid of the file or parent group.
+ @param[out] numgrps Pointer to memory to hold the number of groups.
+ @param[out] ncids Pointer to memory to hold the ncid for each group.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+ */
int nc_inq_grps(int ncid, int *numgrps, int *ncids)
{
NC* ncp;
@@ -61,6 +78,13 @@ int nc_inq_grps(int ncid, int *numgrps, int *ncids)
return ncp->dispatch->inq_grps(ncid,numgrps,ncids);
}
+/*! Get the name of a group given an ID.
+
+ @param[in] ncid The ncid of the file or parent group.
+ @param[out] name The name of the group associated with the id.
+
+ @returns Error code or ::NC_NOERR for no error.
+*/
int nc_inq_grpname(int ncid, char *name)
{
NC* ncp;
@@ -69,6 +93,16 @@ int nc_inq_grpname(int ncid, char *name)
return ncp->dispatch->inq_grpname(ncid,name);
}
+/*! Get the full path/groupname of a group/subgroup given an ID.
+
+ @param[in] ncid The ncid of the file or parent group.
+ @param[out] lenp Pointer to memory to hold the length of the full name.
+ @param[out] full_name Pointer to memory to hold the full name of the group including root/parent.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+*/
+
int nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
{
NC* ncp;
@@ -77,12 +111,28 @@ int nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name);
}
+/*! Get the length of a group name given an ID.
+
+ @param[in] ncid The ncid of the group in question.
+ @param[out] lenp Pointer to memory to hold the length of the name of the group in question.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+*/
int nc_inq_grpname_len(int ncid, size_t *lenp)
{
int stat = nc_inq_grpname_full(ncid,lenp,NULL);
return stat;
}
+/*! Get the ID of the parent based on a group ID.
+
+ @param[in] ncid The ncid of the group in question.
+ @param[out] parent_ncid Pointer to memory to hold the identifier of the parent of the group in question.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+ */
int nc_inq_grp_parent(int ncid, int *parent_ncid)
{
NC* ncp;
@@ -91,7 +141,15 @@ int nc_inq_grp_parent(int ncid, int *parent_ncid)
return ncp->dispatch->inq_grp_parent(ncid,parent_ncid);
}
-/*! This has same semantics as nc_inq_ncid
+/*! Get a group ncid given the group name.
+
+ @param[in] ncid The ncid of the file.
+ @param[in] grp_name The name of the group in question.
+ @param[out] grp_ncid Pointer to memory to hold the identifier of the group in question.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+\note{This has same semantics as nc_inq_ncid}
*/
int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
@@ -99,6 +157,15 @@ int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
return nc_inq_ncid(ncid,grp_name,grp_ncid);
}
+/*! Get the full ncid given a group name.
+
+ @param[in] ncid The ncid of the file.
+ @param[in] full_name The full name of the group in question.
+ @param[out] grp_ncid Pointer to memory to hold the identifier of the full group in question.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+ */
int nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
{
NC* ncp;
@@ -107,6 +174,16 @@ int nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
return ncp->dispatch->inq_grp_full_ncid(ncid,full_name,grp_ncid);
}
+
+/*! Get a list of varids associated with a group given a group ID.
+
+ @param[in] ncid The ncid of the group in question.
+ @param[out] nvars Pointer to memory to hold the number of variables in the group in question.
+ @param[out] varids Pointer to memory to hold the variable ids contained by the group in question.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+*/
int nc_inq_varids(int ncid, int *nvars, int *varids)
{
NC* ncp;
@@ -115,6 +192,16 @@ int nc_inq_varids(int ncid, int *nvars, int *varids)
return ncp->dispatch->inq_varids(ncid,nvars,varids);
}
+/*! Retrieve a list of dimension ids associated with a group.
+
+ @param[in] ncid The ncid of the group in question.
+ @param[out] ndims Pointer to memory to contain the number of dimids associated with the group.
+ @param[out] dimids Pointer to memory to contain the number of dimensions associated with the group.
+ @param[in] include_parents If non-zero, parent groups are also traversed.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+ */
int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
{
NC* ncp;
@@ -123,6 +210,16 @@ int nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents);
}
+/*! Retrieve a list of types associated with a group
+
+ @param[in] ncid The ncid for the group in question.
+ @param[out] ntypes Pointer to memory to hold the number of typeids contained by the group in question.
+ @param[out] typeids Pointer to memory to hold the typeids contained by the group in question.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+*/
+
int nc_inq_typeids(int ncid, int *ntypes, int *typeids)
{
NC* ncp;
@@ -131,6 +228,43 @@ int nc_inq_typeids(int ncid, int *ntypes, int *typeids)
return ncp->dispatch->inq_typeids(ncid,ntypes,typeids);
}
+/*! Define a new group.
+
+ The function nc_def_grp() adds a new
+ group to an open netCDF dataset in define mode. It returns (as an
+ argument) a group id, given the parent ncid and the name of the group.
+
+ A group may be a top-level group if it is passed the ncid of the file,
+ or a sub-group if passed the ncid of an existing group.
+
+ @param[in] parent_ncid The ncid of the parent for the group.
+ @param[in] name Name of the new group.
+ @param[out] new_ncid Pointer to memory to hold the new ncid.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+ @retval ::NC_NOERR No error.
+ @retval ::NC_ENOTNC4 Not an nc4 file.
+ @retval ::NC_ENOTINDEFINE Not in define mode.
+ @retval ::NC_ESTRICTNC3 Not permissible in nc4 classic mode.
+ @retval ::NC_EPERM Write to read only.
+ @retval ::NC_ENOMEM Memory allocation (malloc) failure.
+ @retval ::NC_ENAMEINUSE String match to name in use.
+
+ \section nc_def_grp_example Example
+
+ Here is an example using nc_def_grp() to create a new group.
+
+ \code{.c}
+
+ #include <netcdf.h>
+ ...
+ int status, ncid, grpid, latid, recid;
+ ...
+
+ \endcode
+
+*/
int nc_def_grp(int parent_ncid, const char *name, int *new_ncid)
{
NC* ncp;
@@ -139,6 +273,14 @@ int nc_def_grp(int parent_ncid, const char *name, int *new_ncid)
return ncp->dispatch->def_grp(parent_ncid,name,new_ncid);
}
+/*! Rename a group.
+
+ @param[in] grpid The ID for the group in question.
+ @param[in] name The new name for the group.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+*/
int nc_rename_grp(int grpid, const char *name)
{
NC* ncp;
@@ -147,6 +289,13 @@ int nc_rename_grp(int grpid, const char *name)
return ncp->dispatch->rename_grp(grpid,name);
}
+/*! Print the metadata for a file.
+
+ @param[in] ncid The ncid of an open file.
+
+ @returns Error code or ::NC_NOERR for no error.
+
+ */
int nc_show_metadata(int ncid)
{
NC* ncp;
diff --git a/libdispatch/dvar.c b/libdispatch/dvar.c
index 507dc90..2a4cda8 100644
--- a/libdispatch/dvar.c
+++ b/libdispatch/dvar.c
@@ -52,7 +52,7 @@ Operations supported on variables are:
- Get a subsampled or mapped array-section of values from a variable,
given variable ID, corner indices, edge lengths, stride vector, and
index mapping vector.
-- Rename a variable.
+- Rename a variable.
\section language_types Language Types Corresponding to netCDF
External Data Types
@@ -131,13 +131,13 @@ Use these functions to define variables.
\ingroup variables
Define a new variable.
-This function adds a new variable to an open netCDF dataset or group.
+This function adds a new variable to an open netCDF dataset or group.
It returns (as an argument) a variable ID, given the netCDF ID,
the variable name, the variable type, the number of dimensions, and a
list of the dimension IDs.
\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 name Variable \ref object_name.
@@ -160,13 +160,13 @@ element of the dimids array.
\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad ncid.
-\returns ::NC_ENOTINDEFINE Not in define mode.
+\returns ::NC_ENOTINDEFINE Not in define mode.
\returns ::NC_ESTRICTNC3 Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
\returns ::NC_EMAXVARS NC_MAX_VARS exceeded
\returns ::NC_EBADTYPE Bad type.
\returns ::NC_EINVAL Invalid input.
\returns ::NC_ENAMEINUSE Name already in use.
-\returns ::NC_EPERM Attempt to create object in read-only file.
+\returns ::NC_EPERM Attempt to create object in read-only file.
\section nc_def_var_example Example
@@ -177,11 +177,11 @@ dataset named foo.nc:
\code
#include <netcdf.h>
...
- int status;
- int ncid;
- int lat_dim, lon_dim, time_dim;
- int rh_id;
- int rh_dimids[3];
+ int status;
+ int ncid;
+ int lat_dim, lon_dim, time_dim;
+ int rh_id;
+ int rh_dimids[3];
...
status = nc_create("foo.nc", NC_NOCLOBBER, &ncid);
if (status != NC_NOERR) handle_error(status);
@@ -204,7 +204,7 @@ dataset named foo.nc:
*/
int
-nc_def_var(int ncid, const char *name, nc_type xtype,
+nc_def_var(int ncid, const char *name, nc_type xtype,
int ndims, const int *dimidsp, int *varidp)
{
NC* ncp;
@@ -233,10 +233,10 @@ variable.
For classic format, 64-bit offset format, and netCDF-4/HDF5 with
classic mode, if the new name is longer than the old name, the netCDF
-dataset must be in define mode.
+dataset must be in define mode.
\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
@@ -259,14 +259,14 @@ rel_hum in an existing netCDF dataset named foo.nc:
\code
#include <netcdf.h>
...
- int status;
- int ncid;
- int rh_id;
+ int status;
+ int ncid;
+ int rh_id;
...
status = nc_open("foo.nc", NC_WRITE, &ncid);
if (status != NC_NOERR) handle_error(status);
...
- status = nc_redef(ncid);
+ status = nc_redef(ncid);
if (status != NC_NOERR) handle_error(status);
status = nc_inq_varid (ncid, "rh", &rh_id);
if (status != NC_NOERR) handle_error(status);
@@ -298,7 +298,7 @@ NC_is_recvar(int ncid, int varid, size_t* nrecs)
int unlimid;
int ndims;
int dimset[NC_MAX_VAR_DIMS];
-
+
status = nc_inq_unlimdim(ncid,&unlimid);
if(status != NC_NOERR) return 0; /* no unlimited defined */
status = nc_inq_varndims(ncid,varid,&ndims);
@@ -336,7 +336,7 @@ NC_inq_recvar(int ncid, int varid, int* nrecdimsp, int *is_recdim)
int dimset[NC_MAX_VAR_DIMS];
int dim;
int nrecdims = 0;
-
+
status = nc_inq_varndims(ncid,varid,&nvardims);
if(status != NC_NOERR) return status;
if(nvardims == 0) return NC_NOERR; /* scalars have no dims */
@@ -371,7 +371,7 @@ NC_inq_recvar(int ncid, int varid, int* nrecdimsp, int *is_recdim)
if(dimset[dim] == unlimids[recdim]) {
is_recdim[dim] = 1;
nrecdims++;
- }
+ }
}
}
free(unlimids);
@@ -404,7 +404,7 @@ ncvarget(cdfid, varid, cor, edg, vals);
\endcode
*/
int
-nctypelen(nc_type type)
+nctypelen(nc_type type)
{
switch(type){
case NC_CHAR :
@@ -417,10 +417,10 @@ nctypelen(nc_type type)
return ((int)sizeof(int));
case NC_FLOAT :
return ((int)sizeof(float));
- case NC_DOUBLE :
+ case NC_DOUBLE :
return ((int)sizeof(double));
- /* These can occur in netcdf-3 code */
+ /* These can occur in netcdf-3 code */
case NC_UBYTE :
return ((int)sizeof(unsigned char));
case NC_USHORT :
@@ -465,7 +465,7 @@ NC_atomictypelen(nc_type xtype)
case NC_STRING: sz = sizeof(char*); break;
#endif
default: break;
- }
+ }
return sz;
}
@@ -493,13 +493,13 @@ NC_atomictypename(nc_type xtype)
case NC_STRING: nm = "string"; break;
#endif
default: break;
- }
+ }
return nm;
}
/** \internal
\ingroup variables
-Get the shape of a variable.
+Get the shape of a variable.
*/
int
NC_getshape(int ncid, int varid, int ndims, size_t* shape)
@@ -510,7 +510,7 @@ NC_getshape(int ncid, int varid, int ndims, size_t* shape)
if ((status = nc_inq_vardimid(ncid, varid, dimids)))
return status;
- for(i = 0; i < ndims; i++)
+ for(i = 0; i < ndims; i++)
if ((status = nc_inq_dimlen(ncid, dimids[i], &shape[i])))
break;
@@ -521,7 +521,7 @@ NC_getshape(int ncid, int varid, int ndims, size_t* shape)
/** \ingroup variables
\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
@@ -544,20 +544,20 @@ chunks.
\returns ::NC_EINVAL Invalid input
*/
int
-nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
+nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
float preemption)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return ncp->dispatch->set_var_chunk_cache(ncid, varid, size,
+ return ncp->dispatch->set_var_chunk_cache(ncid, varid, size,
nelems, preemption);
}
/** \ingroup variables
\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
@@ -582,7 +582,7 @@ chunks are always preempted before other chunks. \ref ignored_if_null.
\returns ::NC_EINVAL Invalid input
*/
int
-nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
+nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
float *preemptionp)
{
NC* ncp;
@@ -598,10 +598,10 @@ Free string space allocated by the library.
When you read string type the library will allocate the storage space
for the data. This storage space must be freed, so pass the pointer
back to this function, when you're done with the data, and it will
-free the string memory.
+free the string memory.
-\param len The number of character arrays in the array.
-\param data The pointer to the data array.
+\param len The number of character arrays in the array.
+\param data The pointer to the data array.
\returns ::NC_NOERR No error.
*/
@@ -632,14 +632,80 @@ nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
return ncp->dispatch->def_var_fletcher32(ncid,varid,fletcher32);
}
+/*! Define chunking parameters for a variable
+
+\ingroup variables
+
+The function nc_def_var_chunking sets the chunking parameters for a variable in a netCDF-4 file. It can set the chunk sizes to get chunked storage, or it can set the contiguous flag to get contiguous storage.
+
+The total size of a chunk must be less than 4 GiB. That is, the product of all chunksizes and the size of the data (or the size of nc_vlen_t for VLEN types) must be less than 4 GiB.
+
+This function may only be called after the variable is defined, but before nc_enddef is called. Once the chunking parameters are set for a variable, they cannot be changed.
+
+Note that this does not work for scalar variables. Only non-scalar variables can have chunking.
+
+
+
+ at param[in] ncid NetCDF ID, from a previous call to nc_open or nc_create.
+ at param[in] varid Variable ID.
+ at param[in] storage If ::NC_CONTIGUOUS, then contiguous storage is used for this variable. Variables with one or more unlimited dimensions cannot use contiguous storage. If contiguous storage is turned on, the chunksizes parameter is ignored. If ::NC_CHUNKED, then chunked storage is used for this variable. Chunk sizes may be specified with the chunksizes parameter or default sizes will be used if that parameter is NULL.
+ at param[in] chunksizesp A pointer to an array list of chunk sizes. The array must have one chunksize for each dimension of the variable. If ::NC_CONTIGUOUS storage is set, then the chunksizes parameter is ignored.
+
+ at returns ::NC_NOERR No error.
+ at returns ::NC_EBADID Bad ID.
+ at returns ::NC_ENOTNC4 Not a netCDF-4 file.
+ at returns ::NC_ELATEDEF This variable has already been the subject of a nc_enddef call. In netCDF-4 files nc_enddef will be called automatically for any data read or write. Once nc_enddef has been called after the nc_def_var call for a variable, it is impossible to set the chunking for that variable.
+ at returns ::NC_ENOTINDEFINE Not in define mode. This is returned for netCDF classic or 64-bit offset files, or for netCDF-4 files, when they wwere created with NC_STRICT_NC3 flag. See \ref nc_create.
+ at returns ::NC_EPERM Attempt to create object in read-only file.
+ at returns ::NC_EBADCHUNK Retunrs if the chunk size specified for a variable is larger than the length of the dimensions associated with variable.
+
+\section nc_def_var_chunking_example Example
+
+In this example from libsrc4/tst_vars2.c, chunksizes are set with nc_var_def_chunking, and checked with nc_var_inq_chunking.
+
+\code
+ printf("**** testing chunking...");
+ {
+ #define NDIMS5 1
+ #define DIM5_NAME "D5"
+ #define VAR_NAME5 "V5"
+ #define DIM5_LEN 1000
+
+ int dimids[NDIMS5], dimids_in[NDIMS5];
+ int varid;
+ int ndims, nvars, natts, unlimdimid;
+ nc_type xtype_in;
+ char name_in[NC_MAX_NAME + 1];
+ int data[DIM5_LEN], data_in[DIM5_LEN];
+ size_t chunksize[NDIMS5] = {5};
+ size_t chunksize_in[NDIMS5];
+ int storage_in;
+ int i, d;
+
+ for (i = 0; i < DIM5_LEN; i++)
+ data[i] = i;
+
+ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+ if (nc_def_dim(ncid, DIM5_NAME, DIM5_LEN, &dimids[0])) ERR;
+ if (nc_def_var(ncid, VAR_NAME5, NC_INT, NDIMS5, dimids, &varid)) ERR;
+ if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, chunksize)) ERR;
+ if (nc_put_var_int(ncid, varid, data)) ERR;
+
+ if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksize_in)) ERR;
+ for (d = 0; d < NDIMS5; d++)
+ if (chunksize[d] != chunksize_in[d]) ERR;
+ if (storage_in != NC_CHUNKED) ERR;
+\endcode
+
+*/
int
-nc_def_var_chunking(int ncid, int varid, int storage,
+nc_def_var_chunking(int ncid, int varid, int storage,
const size_t *chunksizesp)
{
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
- return ncp->dispatch->def_var_chunking(ncid, varid, storage,
+ return ncp->dispatch->def_var_chunking(ncid, varid, storage,
chunksizesp);
}
diff --git a/libdispatch/dvarinq.c b/libdispatch/dvarinq.c
index f125a0b..369ca7b 100644
--- a/libdispatch/dvarinq.c
+++ b/libdispatch/dvarinq.c
@@ -423,6 +423,44 @@ ignored_if_null.
\returns ::NC_EBADID Bad ncid.
\returns ::NC_ENOTNC4 Not a netCDF-4 file.
\returns ::NC_ENOTVAR Invalid variable ID.
+
+
+\section nc_inq_var_chunking_example Example
+
+\code
+ printf("**** testing contiguous storage...");
+ {
+ #define NDIMS6 1
+ #define DIM6_NAME "D5"
+ #define VAR_NAME6 "V5"
+ #define DIM6_LEN 100
+
+ int dimids[NDIMS6], dimids_in[NDIMS6];
+ int varid;
+ int ndims, nvars, natts, unlimdimid;
+ nc_type xtype_in;
+ char name_in[NC_MAX_NAME + 1];
+ int data[DIM6_LEN], data_in[DIM6_LEN];
+ size_t chunksize_in[NDIMS6];
+ int storage_in;
+ int i, d;
+
+ for (i = 0; i < DIM6_LEN; i++)
+ data[i] = i;
+
+
+ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+ if (nc_def_dim(ncid, DIM6_NAME, DIM6_LEN, &dimids[0])) ERR;
+ if (dimids[0] != 0) ERR;
+ if (nc_def_var(ncid, VAR_NAME6, NC_INT, NDIMS6, dimids, &varid)) ERR;
+ if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL)) ERR;
+ if (nc_put_var_int(ncid, varid, data)) ERR;
+
+
+ if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
+ if (storage_in != NC_CONTIGUOUS) ERR;
+\endcode
+
*/
int
nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp)
@@ -571,12 +609,34 @@ nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
#endif /* USE_NETCDF4 */
-/**
+/*!
+
+Used in libdap2 and libdap4.
+
+ at param[in] ncid ncid for file.
+ at param[in] varid varid for variable in question.
+ at param[out] name Pointer to memory to contain the name of the variable.
+ at param[out] xtypep Pointer to memory to contain the type of the variable.
+ at param[out] ndimsp Pointer to memory to store the number of associated dimensions for the variable.
+ at param[out] dimidsp Pointer to memory to store the dimids associated with the variable.
+ at param[out] nattsp Pointer to memory to store the number of attributes associated with the variable.
+ at param[out] shufflep Pointer to memory to store shuffle information associated with the variable.
+ at param[out] deflatep Pointer to memory to store compression type associated with the variable.
+ at param[out] deflate_levelp Pointer to memory to store compression level associated with the variable.
+ at param[out] fletcher32p Pointer to memory to store compression information associated with the variable.
+ at param[out] contiguousp Pointer to memory to store contiguous-data information associated with the variable.
+ at param[out] chunksizesp Pointer to memory to store chunksize information associated with the variable.
+ at param[out] no_fill Pointer to memory to store whether or not there is a fill value associated with the variable.
+ at param[out] fill_valuep Pointer to memory to store the fill value (if one exists) for the variable.
+ at param[out] endiannessp Pointer to memory to store endianness value. One of ::NC_ENDIAN_BIG ::NC_ENDIAN_LITTLE ::NC_ENDIAN_NATIVE
+ at param[out] options_maskp Pointer to memory to store mask options information.
+ at param[out] pixels_per_blockp Pointer to memory to store pixels-per-block information for chunked data.
+
+\note Expose access to nc_inq_var_all().
+
\internal
\ingroup variables
-Expose access to nc_inq_var_all().
-Used in libdap2 and libdap4.
*/
int
@@ -597,7 +657,7 @@ NC_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
contiguousp, chunksizesp,
no_fill, fill_valuep,
endiannessp,
- options_maskp,
+ options_maskp,
pixels_per_blockp);
}
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index 7fb5096..f1d7597 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -81,7 +81,7 @@ IF(TLL_LIBS)
ENDIF()
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
-
+SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${TLL_LIBS})
IF(MSVC)
SET_TARGET_PROPERTIES(netcdf PROPERTIES
LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
diff --git a/liblib/Makefile.am b/liblib/Makefile.am
index 59eb1f8..5d38891 100755
--- a/liblib/Makefile.am
+++ b/liblib/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = libnetcdf.la
# for information regarding incrementing `-version-info`.
##
-libnetcdf_la_LDFLAGS = -version-info 11:3:0 ${NOUNDEFINED}
+libnetcdf_la_LDFLAGS = -version-info 11:4:0 ${NOUNDEFINED}
libnetcdf_la_CPPFLAGS = ${AM_CPPFLAGS}
libnetcdf_la_LIBADD =
diff --git a/liblib/Makefile.in b/liblib/Makefile.in
index 8a725af..5c9a958 100644
--- a/liblib/Makefile.in
+++ b/liblib/Makefile.in
@@ -428,7 +428,7 @@ lib_LTLIBRARIES = libnetcdf.la
# These linker flags specify libtool version info.
# See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
# for information regarding incrementing `-version-info`.
-libnetcdf_la_LDFLAGS = -version-info 11:3:0 ${NOUNDEFINED} \
+libnetcdf_la_LDFLAGS = -version-info 11:4: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 3da1acc..128d142 100644
--- a/liblib/nc_initialize.c
+++ b/liblib/nc_initialize.c
@@ -67,11 +67,8 @@ nc_initialize()
#endif
#ifdef USE_NETCDF4
if((stat = NC4_initialize())) goto done;
-#endif /* USE_NETCDF4 */
-
-#ifdef ENABLE_FILEINFO
stat = NC4_fileinfo_init();
-#endif
+#endif /* USE_NETCDF4 */
done:
return stat;
diff --git a/libsrc/attr.c b/libsrc/attr.c
index b59c314..f02d5b3 100644
--- a/libsrc/attr.c
+++ b/libsrc/attr.c
@@ -1,6 +1,4 @@
-#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.
@@ -622,1405 +620,722 @@ 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 ef7dfb3..7d904ee 100644
--- a/libsrc/dim.c
+++ b/libsrc/dim.c
@@ -475,10 +475,12 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname)
free(newname);
if(newStr == NULL)
return NC_ENOMEM;
- dimp->name = newStr;
/* Remove old name from hashmap; add new... */
NC_hashmapRemoveDim(&ncp->dims, old->cp);
+
+ dimp->name = newStr;
+
NC_hashmapAddDim(&ncp->dims, dimid, newStr->cp);
free_NC_string(old);
@@ -487,13 +489,15 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname)
/* else, not in define mode */
+
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveDim(&ncp->dims, old->cp);
+
status = set_NC_string(dimp->name, newname);
free(newname);
if(status != NC_NOERR)
return status;
- /* Remove old name from hashmap; add new... */
- NC_hashmapRemoveDim(&ncp->dims, old->cp);
NC_hashmapAddDim(&ncp->dims, dimid, dimp->name->cp);
set_NC_hdirty(ncp);
diff --git a/libsrc/ncx.c b/libsrc/ncx.c
index 993cf03..20902a1 100644
--- a/libsrc/ncx.c
+++ b/libsrc/ncx.c
@@ -1,6 +1,4 @@
-#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.
@@ -353,35 +351,24 @@ 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 */
@@ -435,272 +422,143 @@ 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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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 */
-#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 */
-#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 */
-#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 */
-#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
-#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
-#line 585
return NC_NOERR;
-#line 585
}
-#line 585
static int
@@ -725,206 +583,109 @@ ncx_put_short_uchar(void *xp, const uchar *ip)
}
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);
-#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
-#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);
-#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
-#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);
-#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
-#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
-#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
-#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
-#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;
-#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;
-#line 615
return NC_NOERR;
-#line 615
}
-#line 615
/* x_ushort ------------------------------------------------------------------*/
@@ -973,282 +734,148 @@ 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
-#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
-#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
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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
-#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
-#line 671
return NC_NOERR;
-#line 671
}
-#line 671
static int
@@ -1275,206 +902,109 @@ ncx_put_ushort_uchar(void *xp, const uchar *ip)
}
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 */
-#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 */
-#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 */
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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;
-#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;
-#line 703
return NC_NOERR;
-#line 703
}
-#line 703
/* x_int ---------------------------------------------------------------------*/
@@ -1526,272 +1056,143 @@ 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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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 */
-#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 */
-#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 */
-#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 */
-#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
-#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
-#line 762
return NC_NOERR;
-#line 762
}
-#line 762
static int
@@ -1826,206 +1227,109 @@ ncx_put_int_uchar(void *xp, const uchar *ip)
}
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);
-#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
-#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);
-#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
-#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);
-#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
-#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
-#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
-#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
-#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;
-#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;
-#line 802
return NC_NOERR;
-#line 802
}
-#line 802
@@ -2072,284 +1376,150 @@ 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);
-#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
-#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
-#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
-#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
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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
-#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
-#line 858
return NC_NOERR;
-#line 858
}
-#line 858
static int
@@ -2379,208 +1549,111 @@ ncx_put_uint_uchar(void *xp, const uchar *ip)
#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);
-#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
-#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 */
-#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 */
-#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 */
-#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);
-#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
-#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);
-#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
-#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;
-#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;
-#line 895
return NC_NOERR;
-#line 895
}
-#line 895
/* x_float -------------------------------------------------------------------*/
@@ -2642,196 +1715,105 @@ 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
}
@@ -2891,7 +1873,6 @@ 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)
@@ -2901,86 +1882,48 @@ 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
}
}
@@ -2992,182 +1935,96 @@ 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
}
}
@@ -3256,175 +2113,94 @@ ncx_get_float_float(const void *xp, float *ip)
#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;
-#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;
-#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;
-#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
-#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;
-#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;
-#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;
-#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;
-#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;
-#line 1327
return NC_NOERR;
-#line 1327
}
-#line 1327
#if X_SIZEOF_FLOAT != SIZEOF_FLOAT || defined(NO_IEEE_FLOAT)
@@ -3441,157 +2217,85 @@ ncx_put_float_float(void *xp, const float *ip)
#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
-#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
-#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
-#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;
-#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
-#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
-#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
-#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
-#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
-#line 1350
return NC_NOERR;
-#line 1350
}
-#line 1350
@@ -3658,218 +2362,116 @@ 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
}
@@ -3963,137 +2565,74 @@ 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;
-#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;
-#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;
-#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;
-#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;
-#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;
-#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;
-#line 1638
return NC_NOERR;
-#line 1638
}
-#line 1638
int
@@ -4137,140 +2676,76 @@ ncx_get_double_double(const void *xp, double *ip)
#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
-#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
-#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
-#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
-#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
-#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
-#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
-#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
-#line 1687
return NC_NOERR;
-#line 1687
}
-#line 1687
static int
@@ -4349,521 +2824,273 @@ 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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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 */
-#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 */
-#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 */
-#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 */
-#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
-#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
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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
-#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
-#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
-#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
-#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;
-#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;
-#line 1784
return NC_NOERR;
-#line 1784
}
-#line 1784
/* x_ulonglong --------------------------------------------------------------------*/
@@ -4916,541 +3143,283 @@ 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
-#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
-#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
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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
-#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
-#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 */
-#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 */
-#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 */
-#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 */
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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);
-#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
-#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;
-#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;
-#line 1855
return NC_NOERR;
-#line 1855
}
-#line 1855
/* x_size_t */
@@ -5696,2894 +3665,1519 @@ 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);
-#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);
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
-#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
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
-#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
-#line 2600
return NC_NOERR;
-#line 2600
}
int
-#line 2602
ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp)
-#line 2602
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
-#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
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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);
-#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);
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
-#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
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
{
-#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
-#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
-#line 2687
return NC_NOERR;
-#line 2687
}
int
-#line 2689
ncx_putn_uchar_short(void **xpp, size_t nelems, const short *tp)
-#line 2689
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
-#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
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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
{
-#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;
-#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 ---------------------------------------------------------------------*/
@@ -8603,1706 +5197,866 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
}
#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
}
-#line 2735
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2735
-#line 2735
#else /* not SX */
-#line 2735
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2737
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2737
-#line 2737
#else /* not SX */
-#line 2737
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2738
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2738
-#line 2738
#else /* not SX */
-#line 2738
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2739
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2739
-#line 2739
#else /* not SX */
-#line 2739
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2740
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2740
-#line 2740
#else /* not SX */
-#line 2740
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2741
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2741
-#line 2741
#else /* not SX */
-#line 2741
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2742
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2742
-#line 2742
#else /* not SX */
-#line 2742
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2743
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2743
-#line 2743
#else /* not SX */
-#line 2743
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2744
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2744
-#line 2744
#else /* not SX */
-#line 2744
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2745
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2745
-#line 2745
#else /* not SX */
-#line 2745
const char *xp = (const char *) *xpp;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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
@@ -10320,1886 +6074,956 @@ ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
}
#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
}
-#line 2772
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2772
-#line 2772
#else /* not SX */
-#line 2772
-#line 2772
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2774
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2774
-#line 2774
#else /* not SX */
-#line 2774
-#line 2774
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2775
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2775
-#line 2775
#else /* not SX */
-#line 2775
-#line 2775
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2776
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2776
-#line 2776
#else /* not SX */
-#line 2776
-#line 2776
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2777
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2777
-#line 2777
#else /* not SX */
-#line 2777
-#line 2777
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2778
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2778
-#line 2778
#else /* not SX */
-#line 2778
-#line 2778
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2779
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2779
-#line 2779
#else /* not SX */
-#line 2779
-#line 2779
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2780
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2780
-#line 2780
#else /* not SX */
-#line 2780
-#line 2780
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2781
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2781
-#line 2781
#else /* not SX */
-#line 2781
-#line 2781
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2782
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2782
-#line 2782
#else /* not SX */
-#line 2782
-#line 2782
char *xp = (char *) *xpp;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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
@@ -12220,1706 +7044,866 @@ ncx_getn_ushort_ushort(const void **xpp, size_t nelems, unsigned short *tp)
}
#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
}
-#line 2812
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2812
-#line 2812
#else /* not SX */
-#line 2812
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2814
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2814
-#line 2814
#else /* not SX */
-#line 2814
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2815
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2815
-#line 2815
#else /* not SX */
-#line 2815
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2816
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2816
-#line 2816
#else /* not SX */
-#line 2816
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2817
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2817
-#line 2817
#else /* not SX */
-#line 2817
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2818
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2818
-#line 2818
#else /* not SX */
-#line 2818
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2819
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2819
-#line 2819
#else /* not SX */
-#line 2819
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2820
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2820
-#line 2820
#else /* not SX */
-#line 2820
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2821
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2821
-#line 2821
#else /* not SX */
-#line 2821
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2822
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2822
-#line 2822
#else /* not SX */
-#line 2822
const char *xp = (const char *) *xpp;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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
@@ -13937,1886 +7921,956 @@ ncx_putn_ushort_ushort(void **xpp, size_t nelems, const unsigned short *tp)
}
#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
}
-#line 2849
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2849
-#line 2849
#else /* not SX */
-#line 2849
-#line 2849
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2851
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2851
-#line 2851
#else /* not SX */
-#line 2851
-#line 2851
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2852
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2852
-#line 2852
#else /* not SX */
-#line 2852
-#line 2852
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2853
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2853
-#line 2853
#else /* not SX */
-#line 2853
-#line 2853
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2854
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2854
-#line 2854
#else /* not SX */
-#line 2854
-#line 2854
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2855
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2855
-#line 2855
#else /* not SX */
-#line 2855
-#line 2855
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2856
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2856
-#line 2856
#else /* not SX */
-#line 2856
-#line 2856
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2857
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2857
-#line 2857
#else /* not SX */
-#line 2857
-#line 2857
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2858
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2858
-#line 2858
#else /* not SX */
-#line 2858
-#line 2858
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2859
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2859
-#line 2859
#else /* not SX */
-#line 2859
-#line 2859
char *xp = (char *) *xpp;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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;
-#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);
-#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
@@ -15837,1295 +8891,655 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
}
#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
}
-#line 2889
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2889
-#line 2889
#else /* not SX */
-#line 2889
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2891
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2891
-#line 2891
#else /* not SX */
-#line 2891
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2892
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2892
-#line 2892
#else /* not SX */
-#line 2892
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2893
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2893
-#line 2893
#else /* not SX */
-#line 2893
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2894
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2894
-#line 2894
#else /* not SX */
-#line 2894
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2895
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2895
-#line 2895
#else /* not SX */
-#line 2895
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2896
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2896
-#line 2896
#else /* not SX */
-#line 2896
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2897
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2897
-#line 2897
#else /* not SX */
-#line 2897
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2898
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2898
-#line 2898
#else /* not SX */
-#line 2898
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2899
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2899
-#line 2899
#else /* not SX */
-#line 2899
const char *xp = (const char *) *xpp;
-#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);
-#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
@@ -17143,1393 +9557,704 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
}
#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
}
-#line 2915
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2915
-#line 2915
#else /* not SX */
-#line 2915
-#line 2915
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2917
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2917
-#line 2917
#else /* not SX */
-#line 2917
-#line 2917
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2918
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2918
-#line 2918
#else /* not SX */
-#line 2918
-#line 2918
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2919
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2919
-#line 2919
#else /* not SX */
-#line 2919
-#line 2919
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2920
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2920
-#line 2920
#else /* not SX */
-#line 2920
-#line 2920
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2921
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2921
-#line 2921
#else /* not SX */
-#line 2921
-#line 2921
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2922
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2922
-#line 2922
#else /* not SX */
-#line 2922
-#line 2922
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2923
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2923
-#line 2923
#else /* not SX */
-#line 2923
-#line 2923
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2924
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2924
-#line 2924
#else /* not SX */
-#line 2924
-#line 2924
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2925
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2925
-#line 2925
#else /* not SX */
-#line 2925
-#line 2925
char *xp = (char *) *xpp;
-#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);
-#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 ----------------------------------------------------------------------*/
@@ -18549,1295 +10274,655 @@ ncx_getn_uint_uint(const void **xpp, size_t nelems, unsigned int *tp)
}
#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
}
-#line 2943
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2943
-#line 2943
#else /* not SX */
-#line 2943
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2945
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2945
-#line 2945
#else /* not SX */
-#line 2945
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2946
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2946
-#line 2946
#else /* not SX */
-#line 2946
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2947
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2947
-#line 2947
#else /* not SX */
-#line 2947
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2948
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2948
-#line 2948
#else /* not SX */
-#line 2948
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2949
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2949
-#line 2949
#else /* not SX */
-#line 2949
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2950
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2950
-#line 2950
#else /* not SX */
-#line 2950
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2951
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2951
-#line 2951
#else /* not SX */
-#line 2951
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2952
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2952
-#line 2952
#else /* not SX */
-#line 2952
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 2953
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2953
-#line 2953
#else /* not SX */
-#line 2953
const char *xp = (const char *) *xpp;
-#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);
-#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
@@ -19855,1395 +10940,705 @@ ncx_putn_uint_uint(void **xpp, size_t nelems, const unsigned int *tp)
}
#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
}
-#line 2969
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2969
-#line 2969
#else /* not SX */
-#line 2969
-#line 2969
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2971
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2971
-#line 2971
#else /* not SX */
-#line 2971
-#line 2971
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2972
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2972
-#line 2972
#else /* not SX */
-#line 2972
-#line 2972
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2973
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2973
-#line 2973
#else /* not SX */
-#line 2973
-#line 2973
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2974
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2974
-#line 2974
#else /* not SX */
-#line 2974
-#line 2974
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2975
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2975
-#line 2975
#else /* not SX */
-#line 2975
-#line 2975
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2976
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2976
-#line 2976
#else /* not SX */
-#line 2976
-#line 2976
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2977
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2977
-#line 2977
#else /* not SX */
-#line 2977
-#line 2977
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2978
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2978
-#line 2978
#else /* not SX */
-#line 2978
-#line 2978
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 2979
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 2979
-#line 2979
#else /* not SX */
-#line 2979
-#line 2979
char *xp = (char *) *xpp;
-#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);
-#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
@@ -21271,95 +11666,50 @@ 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++;
@@ -21387,1165 +11737,589 @@ 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
}
-#line 3031
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3031
-#line 3031
#else /* not SX */
-#line 3031
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3032
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3032
-#line 3032
#else /* not SX */
-#line 3032
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3033
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3033
-#line 3033
#else /* not SX */
-#line 3033
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3034
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3034
-#line 3034
#else /* not SX */
-#line 3034
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3035
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3035
-#line 3035
#else /* not SX */
-#line 3035
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3036
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3036
-#line 3036
#else /* not SX */
-#line 3036
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3037
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3037
-#line 3037
#else /* not SX */
-#line 3037
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3038
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3038
-#line 3038
#else /* not SX */
-#line 3038
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3039
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3039
-#line 3039
#else /* not SX */
-#line 3039
const char *xp = (const char *) *xpp;
-#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);
-#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)
@@ -22570,93 +12344,49 @@ 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++;
@@ -22683,1255 +12413,634 @@ 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
}
-#line 3087
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3087
-#line 3087
#else /* not SX */
-#line 3087
-#line 3087
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3088
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3088
-#line 3088
#else /* not SX */
-#line 3088
-#line 3088
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3089
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3089
-#line 3089
#else /* not SX */
-#line 3089
-#line 3089
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3090
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3090
-#line 3090
#else /* not SX */
-#line 3090
-#line 3090
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3091
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3091
-#line 3091
#else /* not SX */
-#line 3091
-#line 3091
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3092
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3092
-#line 3092
#else /* not SX */
-#line 3092
-#line 3092
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3093
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3093
-#line 3093
#else /* not SX */
-#line 3093
-#line 3093
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3094
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3094
-#line 3094
#else /* not SX */
-#line 3094
-#line 3094
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3095
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3095
-#line 3095
#else /* not SX */
-#line 3095
-#line 3095
char *xp = (char *) *xpp;
-#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);
-#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 --------------------------------------------------------------------*/
@@ -23958,87 +13067,46 @@ 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;
@@ -24065,1165 +13133,589 @@ 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
}
-#line 3145
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3145
-#line 3145
#else /* not SX */
-#line 3145
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3146
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3146
-#line 3146
#else /* not SX */
-#line 3146
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3147
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3147
-#line 3147
#else /* not SX */
-#line 3147
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3148
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3148
-#line 3148
#else /* not SX */
-#line 3148
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3149
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3149
-#line 3149
#else /* not SX */
-#line 3149
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3150
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3150
-#line 3150
#else /* not SX */
-#line 3150
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3151
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3151
-#line 3151
#else /* not SX */
-#line 3151
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3152
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3152
-#line 3152
#else /* not SX */
-#line 3152
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3153
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3153
-#line 3153
#else /* not SX */
-#line 3153
const char *xp = (const char *) *xpp;
-#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);
-#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)
@@ -25248,123 +13740,64 @@ 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;
@@ -25391,1255 +13824,634 @@ 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
}
-#line 3201
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3201
-#line 3201
#else /* not SX */
-#line 3201
-#line 3201
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3202
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3202
-#line 3202
#else /* not SX */
-#line 3202
-#line 3202
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3203
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3203
-#line 3203
#else /* not SX */
-#line 3203
-#line 3203
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3204
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3204
-#line 3204
#else /* not SX */
-#line 3204
-#line 3204
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3205
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3205
-#line 3205
#else /* not SX */
-#line 3205
-#line 3205
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3206
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3206
-#line 3206
#else /* not SX */
-#line 3206
-#line 3206
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3207
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3207
-#line 3207
#else /* not SX */
-#line 3207
-#line 3207
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3208
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3208
-#line 3208
#else /* not SX */
-#line 3208
-#line 3208
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3209
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3209
-#line 3209
#else /* not SX */
-#line 3209
-#line 3209
char *xp = (char *) *xpp;
-#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);
-#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
@@ -26660,1295 +14472,655 @@ ncx_getn_longlong_longlong(const void **xpp, size_t nelems, long long *tp)
}
#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
}
-#line 3228
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3228
-#line 3228
#else /* not SX */
-#line 3228
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3230
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3230
-#line 3230
#else /* not SX */
-#line 3230
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3231
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3231
-#line 3231
#else /* not SX */
-#line 3231
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3232
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3232
-#line 3232
#else /* not SX */
-#line 3232
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3233
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3233
-#line 3233
#else /* not SX */
-#line 3233
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3234
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3234
-#line 3234
#else /* not SX */
-#line 3234
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3235
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3235
-#line 3235
#else /* not SX */
-#line 3235
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3236
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3236
-#line 3236
#else /* not SX */
-#line 3236
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3237
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3237
-#line 3237
#else /* not SX */
-#line 3237
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3238
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3238
-#line 3238
#else /* not SX */
-#line 3238
const char *xp = (const char *) *xpp;
-#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);
-#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
@@ -27966,1395 +15138,705 @@ ncx_putn_longlong_longlong(void **xpp, size_t nelems, const long long *tp)
}
#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
}
-#line 3254
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3254
-#line 3254
#else /* not SX */
-#line 3254
-#line 3254
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3256
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3256
-#line 3256
#else /* not SX */
-#line 3256
-#line 3256
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3257
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3257
-#line 3257
#else /* not SX */
-#line 3257
-#line 3257
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3258
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3258
-#line 3258
#else /* not SX */
-#line 3258
-#line 3258
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3259
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3259
-#line 3259
#else /* not SX */
-#line 3259
-#line 3259
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3260
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3260
-#line 3260
#else /* not SX */
-#line 3260
-#line 3260
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3261
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3261
-#line 3261
#else /* not SX */
-#line 3261
-#line 3261
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3262
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3262
-#line 3262
#else /* not SX */
-#line 3262
-#line 3262
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3263
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3263
-#line 3263
#else /* not SX */
-#line 3263
-#line 3263
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3264
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3264
-#line 3264
#else /* not SX */
-#line 3264
-#line 3264
char *xp = (char *) *xpp;
-#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);
-#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 ----------------------------------------------------------------------*/
@@ -29374,1295 +15856,655 @@ ncx_getn_ulonglong_ulonglong(const void **xpp, size_t nelems, unsigned long long
}
#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
}
-#line 3282
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3282
-#line 3282
#else /* not SX */
-#line 3282
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3284
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3284
-#line 3284
#else /* not SX */
-#line 3284
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3285
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3285
-#line 3285
#else /* not SX */
-#line 3285
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3286
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3286
-#line 3286
#else /* not SX */
-#line 3286
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3287
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3287
-#line 3287
#else /* not SX */
-#line 3287
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3288
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3288
-#line 3288
#else /* not SX */
-#line 3288
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3289
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3289
-#line 3289
#else /* not SX */
-#line 3289
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3290
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3290
-#line 3290
#else /* not SX */
-#line 3290
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3291
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3291
-#line 3291
#else /* not SX */
-#line 3291
const char *xp = (const char *) *xpp;
-#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);
-#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
}
-#line 3292
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3292
-#line 3292
#else /* not SX */
-#line 3292
const char *xp = (const char *) *xpp;
-#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);
-#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
@@ -30680,1395 +16522,705 @@ ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const unsigned long long
}
#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
}
-#line 3308
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3308
-#line 3308
#else /* not SX */
-#line 3308
-#line 3308
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3310
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3310
-#line 3310
#else /* not SX */
-#line 3310
-#line 3310
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3311
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3311
-#line 3311
#else /* not SX */
-#line 3311
-#line 3311
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3312
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3312
-#line 3312
#else /* not SX */
-#line 3312
-#line 3312
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3313
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3313
-#line 3313
#else /* not SX */
-#line 3313
-#line 3313
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3314
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3314
-#line 3314
#else /* not SX */
-#line 3314
-#line 3314
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3315
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3315
-#line 3315
#else /* not SX */
-#line 3315
-#line 3315
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3316
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3316
-#line 3316
#else /* not SX */
-#line 3316
-#line 3316
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3317
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3317
-#line 3317
#else /* not SX */
-#line 3317
-#line 3317
char *xp = (char *) *xpp;
-#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);
-#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
}
-#line 3318
return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3318
-#line 3318
#else /* not SX */
-#line 3318
-#line 3318
char *xp = (char *) *xpp;
-#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);
-#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
@@ -32086,11 +17238,8 @@ ncx_getn_text(const void **xpp, size_t nelems, char *tp)
#endif
{
(void) memcpy(tp, *xpp, nelems);
-#line 3334
*xpp = (void *)((schar *)(*xpp) + nelems);
-#line 3334
return NC_NOERR;
-#line 3334
}
@@ -32103,23 +17252,14 @@ 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
-#line 3345
return NC_NOERR;
-#line 3345
}
@@ -32131,13 +17271,9 @@ 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
-#line 3355
return NC_NOERR;
-#line 3355
}
@@ -32150,35 +17286,20 @@ 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
-#line 3366
return NC_NOERR;
-#line 3366
}
@@ -32189,11 +17310,8 @@ int
ncx_getn_void(const void **xpp, size_t nelems, void *tp)
{
(void) memcpy(tp, *xpp, nelems);
-#line 3375
*xpp = (void *)((schar *)(*xpp) + nelems);
-#line 3375
return NC_NOERR;
-#line 3375
}
@@ -32201,23 +17319,14 @@ 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
-#line 3381
return NC_NOERR;
-#line 3381
}
@@ -32225,13 +17334,9 @@ 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
-#line 3387
return NC_NOERR;
-#line 3387
}
@@ -32239,34 +17344,19 @@ 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
-#line 3393
return NC_NOERR;
-#line 3393
}
diff --git a/libsrc/netcdf.3 b/libsrc/netcdf.3
deleted file mode 100644
index 26cea37..0000000
--- a/libsrc/netcdf.3
+++ /dev/null
@@ -1,1405 +0,0 @@
-.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/putget.c b/libsrc/putget.c
index cab6eb3..2ae29b2 100644
--- a/libsrc/putget.c
+++ b/libsrc/putget.c
@@ -1,6 +1,4 @@
-#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.
@@ -72,7 +70,6 @@ arrayp(const char *label, size_t count, const size_t *array)
#endif
-#line 107
/*
* Next 6 type specific functions
@@ -81,480 +78,252 @@ 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
@@ -1087,17080 +856,8655 @@ 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*/
@@ -18307,7 +9651,6 @@ 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)
diff --git a/libsrc/var.c b/libsrc/var.c
index a510ba5..27f413c 100644
--- a/libsrc/var.c
+++ b/libsrc/var.c
@@ -15,7 +15,24 @@
#include "utf8proc.h"
#ifndef OFF_T_MAX
-#define OFF_T_MAX (~ (off_t) 0 - (~ (off_t) 0 << (CHAR_BIT * sizeof (off_t) - 1)))
+//#define OFF_T_MAX (~ (off_t) 0 - (~ (off_t) 0 << (CHAR_BIT * sizeof (off_t) - 1)))
+
+/* The behavior above is undefined, re: bitshifting a negative value, according
+ to warnings thrown by clang/gcc. An alternative OFF_T_MAX was written
+ based on info found at:
+ * http://stackoverflow.com/questions/4514572/c-question-off-t-and-other-signed-integer-types-minimum-and-maximum-values
+ */
+#define MAX_INT_VAL_STEP(t) \
+ ((t) 1 << (CHAR_BIT * sizeof(t) - 1 - ((t) -1 < 1)))
+
+#define MAX_INT_VAL(t) \
+ ((MAX_INT_VAL_STEP(t) - 1) + MAX_INT_VAL_STEP(t))
+
+#define MIN_INT_VAL(t) \
+ ((t) -MAX_INT_VAL(t) - 1)
+
+#define OFF_T_MAX MAX_INT_VAL(off_t)
+
#endif
/*
@@ -740,14 +757,14 @@ NC3_rename_var(int ncid, int varid, const char *unewname)
return NC_ENOMEM;
if(NC_indef(ncp))
{
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveVar(&ncp->vars, old->cp);
+
newStr = new_NC_string(strlen(newname),newname);
free(newname);
if(newStr == NULL)
return(-1);
varp->name = newStr;
-
- /* Remove old name from hashmap; add new... */
- NC_hashmapRemoveVar(&ncp->vars, old->cp);
NC_hashmapAddVar(&ncp->vars, varid, newStr->cp);
free_NC_string(old);
@@ -755,13 +772,14 @@ NC3_rename_var(int ncid, int varid, const char *unewname)
}
/* else, not in define mode */
+ /* Remove old name from hashmap; add new... */
+ NC_hashmapRemoveVar(&ncp->vars, old->cp);
+
status = set_NC_string(varp->name, newname);
free(newname);
if(status != NC_NOERR)
return status;
- /* Remove old name from hashmap; add new... */
- NC_hashmapRemoveVar(&ncp->vars, old->cp);
NC_hashmapAddVar(&ncp->vars, varid, varp->name->cp);
set_NC_hdirty(ncp);
diff --git a/libsrc4/Makefile.am b/libsrc4/Makefile.am
index d1197bd..eb474ae 100644
--- a/libsrc4/Makefile.am
+++ b/libsrc4/Makefile.am
@@ -15,10 +15,8 @@ endif
# This is our output. The netCDF-4 convenience library.
noinst_LTLIBRARIES = libnetcdf4.la
libnetcdf4_la_SOURCES = nc4dispatch.c nc4dispatch.h nc4attr.c nc4dim.c \
-nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c
-if ENABLE_FILEINFO
-libnetcdf4_la_SOURCES += nc4info.c
-endif
+nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c \
+nc4info.c
EXTRA_DIST=CMakeLists.txt
diff --git a/libsrc4/Makefile.in b/libsrc4/Makefile.in
index 87abb3f..0035d50 100644
--- a/libsrc4/Makefile.in
+++ b/libsrc4/Makefile.in
@@ -109,7 +109,6 @@ target_triplet = @target@
# This turns on declspec magic in netcdf.h for windows DLLs.
@BUILD_DLL_TRUE at am__append_3 = -DDLL_EXPORT
- at ENABLE_FILEINFO_TRUE@am__append_4 = nc4info.c
subdir = libsrc4
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -125,17 +124,13 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libnetcdf4_la_LIBADD =
-am__libnetcdf4_la_SOURCES_DIST = nc4dispatch.c nc4dispatch.h nc4attr.c \
- nc4dim.c nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c \
- nc4var.c ncfunc.c error4.c nc4info.c
- at ENABLE_FILEINFO_TRUE@am__objects_1 = libnetcdf4_la-nc4info.lo
am_libnetcdf4_la_OBJECTS = libnetcdf4_la-nc4dispatch.lo \
libnetcdf4_la-nc4attr.lo libnetcdf4_la-nc4dim.lo \
libnetcdf4_la-nc4file.lo libnetcdf4_la-nc4grp.lo \
libnetcdf4_la-nc4hdf.lo libnetcdf4_la-nc4internal.lo \
libnetcdf4_la-nc4type.lo libnetcdf4_la-nc4var.lo \
libnetcdf4_la-ncfunc.lo libnetcdf4_la-error4.lo \
- $(am__objects_1)
+ libnetcdf4_la-nc4info.lo
libnetcdf4_la_OBJECTS = $(am_libnetcdf4_la_OBJECTS)
AM_V_lt = $(am__v_lt_ at AM_V@)
am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -176,7 +171,7 @@ am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libnetcdf4_la_SOURCES)
-DIST_SOURCES = $(am__libnetcdf4_la_SOURCES_DIST)
+DIST_SOURCES = $(libnetcdf4_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -380,9 +375,10 @@ libnetcdf4_la_CPPFLAGS = ${AM_CPPFLAGS} $(am__append_3)
# This is our output. The netCDF-4 convenience library.
noinst_LTLIBRARIES = libnetcdf4.la
-libnetcdf4_la_SOURCES = nc4dispatch.c nc4dispatch.h nc4attr.c nc4dim.c \
- nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c \
- ncfunc.c error4.c $(am__append_4)
+libnetcdf4_la_SOURCES = nc4dispatch.c nc4dispatch.h nc4attr.c nc4dim.c \
+nc4file.c nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c \
+nc4info.c
+
EXTRA_DIST = CMakeLists.txt
all: all-am
diff --git a/libsrc4/nc4attr.c b/libsrc4/nc4attr.c
index 7530c28..d230ee3 100644
--- a/libsrc4/nc4attr.c
+++ b/libsrc4/nc4attr.c
@@ -17,10 +17,8 @@ conditions.
#include "nc4dispatch.h"
#include "ncdispatch.h"
-#ifdef ENABLE_FILEINFO
static int nc4_get_att_special(NC_HDF5_FILE_INFO_T*, const char*,
nc_type*, nc_type, size_t*, int*, int, void*);
-#endif
int nc4typelen(nc_type type);
@@ -62,7 +60,6 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name,
if ((retval = nc4_normalize_name(name, norm_name)))
BAIL(retval);
-#ifdef ENABLE_FILEINFO
if(nc->ext_ncid == ncid && varid == NC_GLOBAL) {
const char** sp;
for(sp = NC_RESERVED_SPECIAL_LIST;*sp;sp++) {
@@ -71,7 +68,6 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name,
}
}
}
-#endif
/* Find the attribute, if it exists.
<strike>If we don't find it, we are major failures.</strike>
@@ -251,7 +247,6 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
if ((retval = nc4_check_name(name, norm_name)))
return retval;
-#ifdef ENABLE_FILEINFO
if(nc->ext_ncid == ncid && varid == NC_GLOBAL) {
const char** sp;
for(sp = NC_RESERVED_SPECIAL_LIST;*sp;sp++) {
@@ -260,7 +255,6 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
}
}
}
-#endif
/* Find att, if it exists. */
if (varid == NC_GLOBAL)
@@ -877,7 +871,6 @@ nc4_put_att_tc(int ncid, int varid, const char *name, nc_type file_type,
mem_type_is_long, op);
}
-#ifdef ENABLE_FILEINFO
static int
nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name,
nc_type* filetypep, nc_type mem_type, size_t* lenp,
@@ -888,14 +881,21 @@ nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name,
return NC_EATTMETA;
if(strcmp(name,NCPROPS)==0) {
+ char* propdata = NULL;
+ int stat = NC_NOERR;
+ int len;
if(h5->fileinfo->propattr.version == 0)
return NC_ENOTATT;
if(mem_type == NC_NAT) mem_type = NC_CHAR;
if(mem_type != NC_CHAR)
return NC_ECHAR;
if(filetypep) *filetypep = NC_CHAR;
- if(lenp) *lenp = strlen(h5->fileinfo->propattr.text);
- if(data) strcpy((char*)data,h5->fileinfo->propattr.text);
+ stat = NC4_buildpropinfo(&h5->fileinfo->propattr, &propdata);
+ if(stat != NC_NOERR) return stat;
+ len = strlen(propdata);
+ if(lenp) *lenp = len;
+ if(data) strncpy((char*)data,propdata,len+1);
+ free(propdata);
} else if(strcmp(name,ISNETCDF4ATT)==0
|| strcmp(name,SUPERBLOCKATT)==0) {
unsigned long long iv = 0;
@@ -922,7 +922,6 @@ nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name,
}
return NC_NOERR;
}
-#endif
/* Read an attribute of any type, with type conversion. This may be
* called by any of the nc_get_att_* functions. */
diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c
index 7db5323..7667b35 100644
--- a/libsrc4/nc4file.c
+++ b/libsrc4/nc4file.c
@@ -101,15 +101,12 @@ NULL
const char* NC_RESERVED_ATT_LIST[] = {
NC_ATT_FORMAT,
NC3_STRICT_ATT_NAME,
-#ifdef ENABLE_FILEINFO
NCPROPS,
ISNETCDF4ATT,
SUPERBLOCKATT,
-#endif
NULL
};
-#ifdef ENABLE_FILEINFO
/* Define the subset of the reserved list that is readable by name only */
const char* NC_RESERVED_SPECIAL_LIST[] = {
ISNETCDF4ATT,
@@ -117,7 +114,6 @@ SUPERBLOCKATT,
NCPROPS,
NULL
};
-#endif
/* These are the default chunk cache sizes for HDF5 files created or
* opened with netCDF-4. */
@@ -468,10 +464,8 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
/* Define mode gets turned on automatically on create. */
nc4_info->flags |= NC_INDEF;
-#ifdef ENABLE_FILEINFO
NC4_get_fileinfo(nc4_info,&globalpropinfo);
NC4_put_propattr(nc4_info);
-#endif
return NC_NOERR;
@@ -2355,9 +2349,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
num_plists--;
#endif
-#ifdef ENABLE_FILEINFO
NC4_get_fileinfo(nc4_info,NULL);
-#endif
return NC_NOERR;
@@ -3094,9 +3086,7 @@ close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort)
}
#endif
-#ifdef ENABLE_FILEINFO
if(h5->fileinfo) free(h5->fileinfo);
-#endif
if (H5Fclose(h5->hdfid) < 0)
{
diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c
index 1fb0820..d82d501 100644
--- a/libsrc4/nc4hdf.c
+++ b/libsrc4/nc4hdf.c
@@ -550,9 +550,9 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
NC_VAR_INFO_T *var;
NC_DIM_INFO_T *dim;
hid_t file_spaceid = 0, mem_spaceid = 0, xfer_plistid = 0;
- hsize_t xtend_size[NC_MAX_VAR_DIMS] , count[NC_MAX_VAR_DIMS];
+ long long unsigned xtend_size[NC_MAX_VAR_DIMS];
hsize_t fdims[NC_MAX_VAR_DIMS], fmaxdims[NC_MAX_VAR_DIMS];
- hsize_t start[NC_MAX_VAR_DIMS];
+ hsize_t start[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS];
char *name_to_use;
int need_to_extend = 0;
int retval = NC_NOERR, range_error = 0, i, d2;
@@ -617,7 +617,7 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
log_dim_info(var, fdims, fmaxdims, start, count);
#endif
- /* Check dimension bounds. Remember that unlimited dimnsions can
+ /* Check dimension bounds. Remember that unlimited dimensions can
* put data beyond their current length. */
for (d2 = 0; d2 < var->ndims; d2++)
{
@@ -625,7 +625,8 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
assert(dim && dim->dimid == var->dimids[d2]);
if (!dim->unlimited)
{
- if (start[d2] >= (hssize_t)fdims[d2])
+ if (start[d2] > (hssize_t)fdims[d2] ||
+ (start[d2] == (hssize_t)fdims[d2] && count[d2] > 0))
BAIL_QUIET(NC_EINVALCOORDS);
if (start[d2] + count[d2] > fdims[d2])
BAIL_QUIET(NC_EEDGE);
@@ -733,11 +734,11 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
{
if (start[d2] + count[d2] > fdims[d2])
{
- xtend_size[d2] = start[d2] + count[d2];
+ xtend_size[d2] = (long long unsigned)(start[d2] + count[d2]);
need_to_extend++;
}
else
- xtend_size[d2] = fdims[d2];
+ xtend_size[d2] = (long long unsigned)fdims[d2];
if (start[d2] + count[d2] > dim->len)
{
@@ -747,7 +748,7 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
}
else
{
- xtend_size[d2] = dim->len;
+ xtend_size[d2] = (long long unsigned)dim->len;
}
}
@@ -775,15 +776,15 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
BAIL(NC_ECANTEXTEND);
/* Reach consensus about dimension sizes to extend to */
- /* (Note: Somewhat hackish, with the use of MPI_INTEGER, but MPI_MAX is
- * correct with this usage, as long as it's not executed on
- * heterogeneous systems)
- */
- if(MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &xtend_size, (var->ndims * (sizeof(hsize_t) / sizeof(int))), MPI_UNSIGNED, MPI_MAX, h5->comm))
+ if(MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, xtend_size, var->ndims, MPI_UNSIGNED_LONG_LONG, MPI_MAX, h5->comm))
BAIL(NC_EMPI);
}
#endif /* USE_PARALLEL4 */
- if (H5Dset_extent(var->hdf_datasetid, xtend_size) < 0)
+ /* Convert xtend_size back to hsize_t for use with H5Dset_extent */
+ for (d2 = 0; d2 < var->ndims; d2++)
+ fdims[d2] = (hsize_t)xtend_size[d2];
+
+ if (H5Dset_extent(var->hdf_datasetid, fdims) < 0)
BAIL(NC_EHDFERR);
if (file_spaceid > 0 && H5Sclose(file_spaceid) < 0)
BAIL2(NC_EHDFERR);
@@ -956,7 +957,8 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
BAIL(retval);
/* Check for out of bound requests. */
- if (start[d2] >= (hssize_t)ulen && count[d2])
+ if (start[d2] > (hssize_t)ulen ||
+ (start[d2] == (hssize_t)ulen && count[d2] > 0))
BAIL_QUIET(NC_EINVALCOORDS);
if (start[d2] + count[d2] > ulen)
BAIL_QUIET(NC_EEDGE);
@@ -979,7 +981,8 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
else
{
/* Check for out of bound requests. */
- if (start[d2] >= (hssize_t)fdims[d2])
+ if (start[d2] > (hssize_t)fdims[d2] ||
+ (start[d2] == (hssize_t)fdims[d2] && count[d2] > 0))
BAIL_QUIET(NC_EINVALCOORDS);
if (start[d2] + count[d2] > fdims[d2])
BAIL_QUIET(NC_EEDGE);
@@ -1952,26 +1955,16 @@ write_nc3_strict_att(hid_t hdf_grpid)
{
hid_t attid = 0, spaceid = 0;
int one = 1, num, a;
- char att_name[NC_MAX_NAME + 1];
+ char att_name[NC_MAX_HDF5_NAME + 1];
int retval = NC_NOERR;
+ htri_t attr_exists;
/* If the attribute already exists, call that a success and return
* NC_NOERR. */
- if ((num = H5Aget_num_attrs(hdf_grpid)) < 0)
+ if ((attr_exists = H5Aexists(hdf_grpid, NC3_STRICT_ATT_NAME)) < 0)
return NC_EHDFERR;
- for (a = 0; a < num; a++)
- {
- if ((attid = H5Aopen_idx(hdf_grpid, (unsigned int)a)) < 0)
- BAIL(NC_EHDFERR);
- if (H5Aget_name(attid, NC_MAX_HDF5_NAME, att_name) < 0)
- BAIL(NC_EHDFERR);
- if (H5Aclose(attid) < 0)
- return NC_EFILEMETA;
- if (strcmp(att_name, NC3_STRICT_ATT_NAME)==0)
- {
- return NC_NOERR;
- }
- }
+ if (attr_exists)
+ return NC_NOERR;
/* Create the attribute to mark this as a file that needs to obey
* strict netcdf-3 rules. */
@@ -1987,12 +1980,12 @@ write_nc3_strict_att(hid_t hdf_grpid)
BAIL(NC_EFILEMETA);
exit:
- if (spaceid && (H5Sclose(spaceid) < 0))
+ if (spaceid > 0 && (H5Sclose(spaceid) < 0))
BAIL2(NC_EFILEMETA);
#ifdef EXTRA_TESTS
num_spaces--;
#endif
- if (attid && (H5Aclose(attid) < 0))
+ if (attid > 0 && (H5Aclose(attid) < 0))
BAIL2(NC_EFILEMETA);
return retval;
}
@@ -3856,7 +3849,7 @@ nc4_get_typelen_mem(NC_HDF5_FILE_INFO_T *h5, nc_type xtype, int is_long,
*len = type->size;
- LOG((5, "type->size ", type->size));
+ LOG((5, "type->size: %d", type->size));
return NC_NOERR;
}
@@ -4000,7 +3993,6 @@ reportopenobjects(int log, hid_t fid)
}
-#ifdef ENABLE_FILEINFO
int
NC4_hdf5get_libversion(unsigned* major,unsigned* minor,unsigned* release)
{
@@ -4073,7 +4065,6 @@ NC4_get_strict_att(NC_HDF5_FILE_INFO_T* h5)
{
int ncstat = NC_NOERR;
size_t size;
- char text[NCPROPS_LENGTH+1];
hid_t grp = -1;
hid_t attid = -1;
herr_t herr = 0;
@@ -4143,5 +4134,3 @@ NC4_walk(hid_t gid, int* countp)
}
return ncstat;
}
-
-#endif
diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c
index 4f6e152..cc16ca7 100644
--- a/libsrc4/nc4info.c
+++ b/libsrc4/nc4info.c
@@ -26,7 +26,6 @@ NC4_fileinfo_init(void)
int stat = NC_NOERR;
unsigned major,minor,release;
int super;
- size_t total = 0;
/* Build nc properties */
memset((void*)&globalpropinfo,0,sizeof(globalpropinfo));
@@ -39,75 +38,60 @@ NC4_fileinfo_init(void)
snprintf(globalpropinfo.hdf5ver,sizeof(globalpropinfo.hdf5ver),
"%1u.%1u.%1u",major,minor,release);
strncpy(globalpropinfo.netcdfver,PACKAGE_VERSION,sizeof(globalpropinfo.netcdfver));
- /* Now build actual attribute text */
- total = 0;
- total += strlen(NCPVERSION);
- total += strlen("=00000000|");
- total += strlen(NCPNCLIBVERSION);
- total += strlen(globalpropinfo.netcdfver);
- total += strlen("=|");
- total += strlen(NCPHDF5LIBVERSION);
- total += strlen(globalpropinfo.hdf5ver);
- total += strlen("="); /* Last pair has no trailing '|' */
- if(total >= sizeof(globalpropinfo.text)) {
- fprintf(stderr,"%s size is too small\n",NCPROPS);
- goto done;
- }
- globalpropinfo.text[0] = '\0';
- snprintf(globalpropinfo.text,sizeof(globalpropinfo.text),
- "%s=%d|%s=%s|%s=%s",
- NCPVERSION,globalpropinfo.version,
- NCPNCLIBVERSION,globalpropinfo.netcdfver,
- NCPHDF5LIBVERSION,globalpropinfo.hdf5ver);
done:
return stat;
}
static int
-NC4_properties_parse(struct NCPROPINFO* ncprops)
+NC4_properties_parse(struct NCPROPINFO* ncprops, const char* text)
{
+ int ret = NC_NOERR;
size_t len;
- char propdata[NCPROPS_LENGTH]; /* match nc.h struct NCProperties */
char* p;
+ char* propdata = NULL;
ncprops->version = 0;
ncprops->hdf5ver[0] = '\0';
ncprops->netcdfver[0] = '\0';
- strncpy(propdata,ncprops->text,sizeof(propdata)-1);
- propdata[sizeof(propdata)-1] = '\0';
- len = strlen(propdata);
+ len = strlen(text);
if(len == 0) return NC_NOERR;
+ propdata = (char*)malloc(len+1);
+ if(propdata == NULL) return NC_ENOMEM;
+ memcpy(propdata,text,len+1);
+ propdata[len] = '\0'; /* guarantee */
/* Walk and fill in ncinfo */
p = propdata;
while(*p) {
- char* name = p;
- char* value = NULL;
- char* q = strchr(p,'=');
- if(q == NULL)
- return NC_EINVAL;
- *q++ = '\0';
- value = p = q;
- q = strchr(p,NCPROPSSEP);
- if(q == NULL) q = (p+strlen(p)); else* q++ = '\0';
- p = q;
- if(name != NULL && value != NULL) {
+ char* name = p;
+ char* value = NULL;
+ char* q = strchr(p,'=');
+ if(q == NULL)
+ {ret = NC_EINVAL; goto done;}
+ *q++ = '\0';
+ value = p = q;
+ q = strchr(p,NCPROPSSEP);
+ if(q == NULL) q = (p+strlen(p)); else* q++ = '\0';
+ p = q;
+ if(value != NULL) {
if(strcmp(name,NCPVERSION) == 0) {
- int v = atoi(value);
- if(v < 0) v = 0;
- ncprops->version = v;
+ int v = atoi(value);
+ if(v < 0) v = 0;
+ ncprops->version = v;
} else if(strcmp(name,NCPNCLIBVERSION) == 0)
- strncpy(ncprops->netcdfver,value,sizeof(ncprops->netcdfver)-1);
+ strncpy(ncprops->netcdfver,value,sizeof(ncprops->netcdfver)-1);
else if(strcmp(name,NCPHDF5LIBVERSION) == 0)
- strncpy(ncprops->hdf5ver,value,sizeof(ncprops->hdf5ver)-1);
+ strncpy(ncprops->hdf5ver,value,sizeof(ncprops->hdf5ver)-1);
/* else ignore */
- }
+ }
}
/* Guarantee null term */
ncprops->netcdfver[sizeof(ncprops->netcdfver)-1] = '\0';
ncprops->hdf5ver[sizeof(ncprops->hdf5ver)-1] = '\0';
- return NC_NOERR;
+done:
+ if(propdata != NULL) free(propdata);
+ return ret;
}
static int
@@ -115,14 +99,14 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5)
{
int ncstat = NC_NOERR;
size_t size;
- H5T_class_t t_class;
- char text[NCPROPS_LENGTH+1];
+ H5T_class_t t_class;
hid_t grp = -1;
hid_t attid = -1;
hid_t aspace = -1;
hid_t atype = -1;
hid_t ntype = -1;
herr_t herr = 0;
+ char* text = NULL;
/* Get root group */
grp = h5->root_grp->hdf_grpid; /* get root group */
@@ -136,20 +120,24 @@ NC4_get_propattr(NC_HDF5_FILE_INFO_T* h5)
t_class = H5Tget_class(atype);
if(t_class != H5T_STRING) {ncstat = NC_EATTMETA; goto done;}
size = H5Tget_size(atype);
- if(size != NCPROPS_LENGTH) {ncstat = NC_EATTMETA; goto done;}
+ if(size == 0) goto done;
+ text = (char*)malloc(size+1);
+ if(text == NULL)
+ {ncstat = NC_ENOMEM; goto done;}
HCHECK((ntype = H5Tget_native_type(atype, H5T_DIR_ASCEND)));
HCHECK((H5Aread(attid, ntype, text)));
+ /* Make sure its null terminated */
+ text[size] = '\0';
/* Try to parse text */
- strncpy(h5->fileinfo->propattr.text,text,NCPROPS_LENGTH);
- h5->fileinfo->propattr.text[NCPROPS_LENGTH-1] = '\0';
- ncstat = NC4_properties_parse(&h5->fileinfo->propattr);
+ ncstat = NC4_properties_parse(&h5->fileinfo->propattr,text);
herr = 0;
- }
+ }
done:
if(attid >= 0) HCHECK((H5Aclose(attid)));
if(aspace >= 0) HCHECK((H5Sclose(aspace)));
if(ntype >= 0) HCHECK((H5Tclose(ntype)));
if(atype >= 0) HCHECK((H5Tclose(atype)));
+ if(text != NULL) free(text);
return ncstat;
}
@@ -157,8 +145,7 @@ int
NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5)
{
int ncstat = NC_NOERR;
- char text[NCPROPS_LENGTH+1];
- H5T_class_t t_class;
+ H5T_class_t t_class;
size_t size;
hid_t grp = -1;
hid_t exists = -1;
@@ -166,22 +153,34 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5)
hid_t aspace = -1;
hid_t atype = -1;
herr_t herr = 0;
+ char* text = NULL;
/* Get root group */
grp = h5->root_grp->hdf_grpid; /* get root group */
/* See if the NCPROPS attribute exists */
if(H5Aexists(grp,NCPROPS) == 0) { /* Does not exist */
- herr = -1;
- /* Create a datatype to refer to. */
- HCHECK((atype = H5Tcopy(H5T_C_S1)));
- HCHECK((H5Tset_cset(atype, H5T_CSET_UTF8)));
- HCHECK((H5Tset_size(atype, NCPROPS_LENGTH)));
- HCHECK((aspace = H5Screate(H5S_SCALAR)));
- HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT)));
- HCHECK((H5Awrite(attid, atype, h5->fileinfo->propattr.text)));
- herr = 0;
+ ncstat = NC4_buildpropinfo(&h5->fileinfo->propattr,&text);
+ if(text == NULL || ncstat != NC_NOERR) {
+ goto done;
+ }
+ herr = -1;
+ /* Create a datatype to refer to. */
+ HCHECK((atype = H5Tcopy(H5T_C_S1)));
+ HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII)));
+ HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */
+ HCHECK((aspace = H5Screate(H5S_SCALAR)));
+ HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT)));
+ HCHECK((H5Awrite(attid, atype, text)));
+ herr = 0;
}
-done:
+ done:
+ if(ncstat != NC_NOERR) {
+ if(text != NULL) {
+ free(text);
+ text = NULL;
+ }
+ }
+
if(attid >= 0) HCHECK((H5Aclose(attid)));
if(aspace >= 0) HCHECK((H5Sclose(aspace)));
if(atype >= 0) HCHECK((H5Tclose(atype)));
@@ -207,5 +206,54 @@ NC4_get_fileinfo(NC_HDF5_FILE_INFO_T* h5, struct NCPROPINFO* init)
h5->fileinfo->propattr = *init; /* Initialize */
}
done:
- return ncstat;
+ return ncstat;
+}
+
+int
+NC4_buildpropinfo(struct NCPROPINFO* info,char** propdatap)
+{
+ size_t total;
+ char* propdata = NULL;
+
+ if(info == NULL || info->version == 0) return NC_EINVAL;
+ if(propdatap == NULL)
+ return NC_NOERR;
+ *propdatap = NULL;
+
+ /* compute attribute length */
+ total = 0;
+ total += strlen(NCPVERSION);
+ total += strlen("=00000000");
+ if(strlen(info->netcdfver) > 0) {
+ total += 1; /*|NCPROPSEP|*/
+ total += strlen(NCPNCLIBVERSION);
+ total += strlen("=");
+ total += strlen(info->netcdfver);
+ }
+ if(strlen(info->hdf5ver) > 0) {
+ total += 1; /*|NCPROPSEP|*/
+ total += strlen(NCPHDF5LIBVERSION);
+ total += strlen("=");
+ total += strlen(info->hdf5ver);
+ }
+ propdata = (char*)malloc(total+1);
+ if(propdata == NULL)
+ return NC_ENOMEM;
+ snprintf(propdata,total+1,
+ "%s=%d|%s=%s|%s=%s",
+ NCPVERSION,info->version,
+ NCPNCLIBVERSION,info->netcdfver,
+ NCPHDF5LIBVERSION,info->hdf5ver);
+ /* Force null termination */
+ propdata[total] = '\0';
+ *propdatap = propdata;
+
+ /* propdatap is checked against being NULL above already. */
+ //if(propdatap) {
+ // *propdatap = propdata;
+ //} else {
+ // free(propdata);
+ //}
+
+ return NC_NOERR;
}
diff --git a/nc-config.cmake.in b/nc-config.cmake.in
index 2ef0706..a6c2488 100755
--- a/nc-config.cmake.in
+++ b/nc-config.cmake.in
@@ -22,6 +22,7 @@ fi
has_nc2="@BUILD_V2@"
+
if [ -z $has_nc2 -o "$has_nc2" = "OFF" ]; then
has_nc2="no"
else
@@ -73,9 +74,15 @@ fi
version="@PACKAGE@ @VERSION@"
+
+has_fortran="no"
has_f90="no"
has_f03="no"
-if type -p nf-config > /dev/null 2>&1; then
+
+nfconf=$(which nf-config 2>/dev/null)
+
+if [ -f "$nfconf" ]; then
+ has_fortran="yes"
fc=`nf-config --fc`
fflags=`nf-config --fflags`
flibs=`nf-config --flibs`
@@ -87,9 +94,13 @@ has_cxx="no"
has_cxx4="no"
if type -p ncxx4-config > /dev/null 2>&1; then
cxx4=`ncxx4-config --cxx`
+ cxx4flags=`ncxx4-config --cflags`
+ cxx4libs=`ncxx4-config --libs`
has_cxx4="yes"
elif type -p ncxx-config > /dev/null 2>&1; then
cxx=`ncxx-config --cxx`
+ cxxflags=`ncxx-config --cflags`
+ cxxlibs=`ncxx-config --libs`
has_cxx="yes"
fi
@@ -104,6 +115,9 @@ Available values for OPTION include:
--all display all options
--cc C compiler
--cflags pre-processor and compiler flags
+ --has-c++ whether C++ API is installed
+ --has-c++4 whether netCDF-4 C++ API is installed
+ --has-fortran whether Fortran API is installed
--has-dap whether OPeNDAP is enabled in this build
--has-nc2 whether NetCDF-2 API is enabled
--has-nc4 whether NetCDF-4/HDF-5 is enabled in this build
@@ -115,25 +129,24 @@ Available values for OPTION include:
--libs library linking information for netcdf
--prefix Install prefix
--includedir Include directory
+ --libdir Library directory
--version Library version
EOF
-# When supported by ncxx4-config and ncxx-config, add
-# --cxxflags flags needed to compile a netCDF-4 C++ program
-# --cxxlibs libraries needed to link a netCDF-4 C++ program
if type -p ncxx4-config > /dev/null 2>&1; then
cat <<EOF
- --cxx4 C++ compiler for netCDF-4 C++ library
- --has-c++4 whether netCDF-4 C++ API is installed
+ --cxx4 C++ compiler for netCDF-4 C++ library
+ --cxx4flags flags needed to compile a C++ program
+ --cxx4libs libraries needed to link a C++ program
EOF
elif type -p ncxx-config > /dev/null 2>&1; then
cat <<EOF
--cxx C++ compiler
- --has-c++ whether C++ API is installed
-
+ --cxxflags flags needed to compile a C++ program
+ --cxxlibs libraries needed to link a C++ program
EOF
fi
-if type -p nf-config > /dev/null 2>&1; then
+if [ -f "$nfconf" ]; then
cat <<EOF
--fc Fortran compiler
--fflags flags needed to compile a Fortran program
@@ -156,15 +169,29 @@ all()
echo
echo " --has-c++ -> $has_cxx"
echo " --cxx -> $cxx"
+
+if type -p ncxx-config > /dev/null 2>&1; then
+ echo " --cxxflags -> $cxxflags"
+ echo " --cxxlibs -> $cxxlibs"
+fi
+ echo
echo " --has-c++4 -> $has_cxx4"
echo " --cxx4 -> $cxx4"
+if type -p ncxx4-config > /dev/null 2>&1; then
+ echo " --cxx4flags -> $cxx4flags"
+ echo " --cxx4libs -> $cxx4libs"
+fi
echo
+
+ echo " --has-fortran-> $has_fortran"
+if [ -f "$nfconf" ]; then
echo " --fc -> $fc"
echo " --fflags -> $fflags"
echo " --flibs -> $flibs"
echo " --has-f90 -> $has_f90"
echo " --has-f03 -> $has_f03"
echo
+fi
echo " --has-dap -> $has_dap"
echo " --has-nc2 -> $has_nc2"
echo " --has-nc4 -> $has_nc4"
@@ -176,6 +203,7 @@ all()
echo
echo " --prefix -> $prefix"
echo " --includedir-> $includedir"
+ echo " --libdir -> $libdir"
echo " --version -> $version"
echo
}
@@ -255,6 +283,10 @@ while test $# -gt 0; do
echo "${includedir}"
;;
+ --libdir)
+ echo "${libdir}"
+ ;;
+
--version)
echo $version
;;
@@ -267,6 +299,14 @@ while test $# -gt 0; do
echo $cxx
;;
+ --cxxflags)
+ echo $cxxflags
+ ;;
+
+ --cxxlibs)
+ echo $cxxlibs
+ ;;
+
--has-c++4)
echo $has_cxx4
;;
@@ -275,13 +315,17 @@ while test $# -gt 0; do
echo $cxx4
;;
-# --cxxflags)
-# echo $cxxflags
-# ;;
-#
-# --cxxlibs)
-# echo $cxxlibs
-# ;;
+ --cxx4flags)
+ echo $cxx4flags
+ ;;
+
+ --cxx4libs)
+ echo $cxx4libs
+ ;;
+
+ --has-fortran)
+ echo $has_fortran
+ ;;
--fc)
echo $fc
@@ -305,9 +349,8 @@ while test $# -gt 0; do
*)
echo "unknown option: $1"
- usage
- exit 1
- ;;
+ usage 1
+ ;;
esac
shift
done
diff --git a/nc-config.in b/nc-config.in
old mode 100644
new mode 100755
index f6c07d3..1c7198d
--- a/nc-config.in
+++ b/nc-config.in
@@ -5,12 +5,14 @@
# contributed by netCDF user Arlindo DaSilva. Thanks Arlindo!
prefix=@prefix@
-exec_prefix=${prefix}
-includedir=${prefix}/include
-
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
cc="@CC@"
-cflags=" -I${includedir} @CPPFLAGS@"
+cflags="-I${includedir} @CPPFLAGS@"
+libs="-L${libdir} @NC_LIBS@"
+
has_dap="@HAS_DAP@"
has_nc2="@HAS_NC2@"
has_nc4="@HAS_NC4@"
@@ -20,9 +22,14 @@ has_hdf5="@HAS_HDF5@"
has_logging="@HAS_LOGGING@"
version="@PACKAGE_NAME@ @PACKAGE_VERSION@"
+has_fortran="no"
has_f90="no"
has_f03="no"
-if type -p nf-config > /dev/null 2>&1; then
+
+nfconf=$(which nf-config 2>/dev/null)
+
+if [ -f "$nfconf" ]; then
+ has_fortran="yes"
fc=`nf-config --fc`
fflags=`nf-config --fflags`
flibs=`nf-config --flibs`
@@ -34,9 +41,13 @@ has_cxx="no"
has_cxx4="no"
if type -p ncxx4-config > /dev/null 2>&1; then
cxx4=`ncxx4-config --cxx`
+ cxx4flags=`ncxx4-config --cflags`
+ cxx4libs=`ncxx4-config --libs`
has_cxx4="yes"
elif type -p ncxx-config > /dev/null 2>&1; then
cxx=`ncxx-config --cxx`
+ cxxflags=`ncxx-config --cflags`
+ cxxlibs=`ncxx-config --libs`
has_cxx="yes"
fi
@@ -51,6 +62,9 @@ Available values for OPTION include:
--all display all options
--cc C compiler
--cflags pre-processor and compiler flags
+ --has-c++ whether C++ API is installed
+ --has-c++4 whether netCDF-4 C++ API is installed
+ --has-fortran whether Fortran API is installed
--has-dap whether OPeNDAP is enabled in this build
--has-nc2 whether NetCDF-2 API is enabled
--has-nc4 whether NetCDF-4/HDF-5 is enabled in this build
@@ -62,25 +76,24 @@ Available values for OPTION include:
--libs library linking information for netcdf
--prefix Install prefix
--includedir Include directory
+ --libdir Library directory
--version Library version
EOF
-# When supported by ncxx4-config and ncxx-config, add
-# --cxxflags flags needed to compile a netCDF-4 C++ program
-# --cxxlibs libraries needed to link a netCDF-4 C++ program
if type -p ncxx4-config > /dev/null 2>&1; then
cat <<EOF
- --cxx4 C++ compiler for netCDF-4 C++ library
- --has-c++4 whether netCDF-4 C++ API is installed
+ --cxx4 C++ compiler for netCDF-4 C++ library
+ --cxx4flags flags needed to compile a C++ program
+ --cxx4libs libraries needed to link a C++ program
EOF
elif type -p ncxx-config > /dev/null 2>&1; then
cat <<EOF
--cxx C++ compiler
- --has-c++ whether C++ API is installed
-
+ --cxxflags flags needed to compile a C++ program
+ --cxxlibs libraries needed to link a C++ program
EOF
fi
-if type -p nf-config > /dev/null 2>&1; then
+if [ -f "$nfconf" ]; then
cat <<EOF
--fc Fortran compiler
--fflags flags needed to compile a Fortran program
@@ -104,17 +117,28 @@ all()
echo " --has-c++ -> $has_cxx"
echo " --cxx -> $cxx"
-# echo " --cxxflags -> $cxxflags"
-# echo " --cxxlibs -> $cxxlibs"
+if type -p ncxx-config > /dev/null 2>&1; then
+ echo " --cxxflags -> $cxxflags"
+ echo " --cxxlibs -> $cxxlibs"
+fi
+ echo
echo " --has-c++4 -> $has_cxx4"
echo " --cxx4 -> $cxx4"
+if type -p ncxx4-config > /dev/null 2>&1; then
+ echo " --cxx4flags -> $cxx4flags"
+ echo " --cxx4libs -> $cxx4libs"
+fi
echo
+
+ echo " --has-fortran-> $has_fortran"
+if [ -f "$nfconf" ]; then
echo " --fc -> $fc"
echo " --fflags -> $fflags"
echo " --flibs -> $flibs"
echo " --has-f90 -> $has_f90"
echo " --has-f03 -> $has_f03"
echo
+fi
echo " --has-dap -> $has_dap"
echo " --has-nc2 -> $has_nc2"
echo " --has-nc4 -> $has_nc4"
@@ -126,6 +150,7 @@ all()
echo
echo " --prefix -> $prefix"
echo " --includedir-> $includedir"
+ echo " --libdir -> $libdir"
echo " --version -> $version"
echo
}
@@ -194,7 +219,7 @@ while test $# -gt 0; do
;;
--libs)
- PKG_CONFIG_PATH=${prefix}/lib/pkgconfig pkg-config netcdf --libs
+ echo $libs
;;
--prefix)
@@ -205,6 +230,10 @@ while test $# -gt 0; do
echo "${includedir}"
;;
+ --libdir)
+ echo "${libdir}"
+ ;;
+
--version)
echo $version
;;
@@ -217,6 +246,14 @@ while test $# -gt 0; do
echo $cxx
;;
+ --cxxflags)
+ echo $cxxflags
+ ;;
+
+ --cxxlibs)
+ echo $cxxlibs
+ ;;
+
--has-c++4)
echo $has_cxx4
;;
@@ -225,6 +262,18 @@ while test $# -gt 0; do
echo $cxx4
;;
+ --cxx4flags)
+ echo $cxx4flags
+ ;;
+
+ --cxx4libs)
+ echo $cxx4libs
+ ;;
+
+ --has-fortran)
+ echo $has_fortran
+ ;;
+
--fc)
echo $fc
;;
@@ -247,9 +296,8 @@ while test $# -gt 0; do
*)
echo "unknown option: $1"
- usage
- exit 1
- ;;
+ usage 1
+ ;;
esac
shift
done
diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt
index 23430f9..f46ac17 100644
--- a/nc_test/CMakeLists.txt
+++ b/nc_test/CMakeLists.txt
@@ -68,16 +68,19 @@ ENDFOREACH()
ADD_TEST(nc_test ${EXECUTABLE_OUTPUT_PATH}/nc_test)
-IF(BUILD_DISKLESS)
- add_sh_test(nc_test run_diskless)
- IF(BUILD_MMAP)
- add_sh_test(nc_test run_mmap)
- ENDIF()
- IF(LARGE_FILE_TESTS)
- add_sh_test(nc_test run_diskless2)
- ENDIF()
-
-ENDIF()
+IF(BUILD_UTILITIES)
+
+ IF(BUILD_DISKLESS)
+ add_sh_test(nc_test run_diskless)
+ IF(BUILD_MMAP)
+ add_sh_test(nc_test run_mmap)
+ ENDIF(BUILD_MMAP)
+ IF(LARGE_FILE_TESTS)
+ add_sh_test(nc_test run_diskless2)
+ ENDIF(LARGE_FILE_TESTS)
+
+ ENDIF(BUILD_DISKLESS)
+ENDIF(BUILD_UTILITIES)
# Copy some test files from current source dir to out-of-tree build dir.
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am
index 17df263..2c46c4b 100644
--- a/nc_test/Makefile.am
+++ b/nc_test/Makefile.am
@@ -62,14 +62,16 @@ endif
TESTS = $(TESTPROGRAMS)
-if BUILD_DISKLESS
-TESTS += run_diskless.sh
-if BUILD_MMAP
-TESTS += run_mmap.sh
-endif
-if LARGE_FILE_TESTS
-TESTS += run_diskless2.sh
-endif
+if BUILD_UTILITIES
+ if BUILD_DISKLESS
+ TESTS += run_diskless.sh
+ if BUILD_MMAP
+ TESTS += run_mmap.sh
+ endif
+ if LARGE_FILE_TESTS
+ TESTS += run_diskless2.sh
+ endif
+ endif
endif
if USE_PNETCDF
diff --git a/nc_test/Makefile.in b/nc_test/Makefile.in
index 37357aa..ff18402 100644
--- a/nc_test/Makefile.in
+++ b/nc_test/Makefile.in
@@ -119,13 +119,9 @@ check_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7)
# Build Diskless test helpers
@BUILD_DISKLESS_TRUE at am__append_8 = tst_diskless tst_diskless3 tst_diskless4
@BUILD_DISKLESS_TRUE@@USE_NETCDF4_TRUE at am__append_9 = tst_diskless2
-TESTS = $(am__EXEEXT_5) $(am__append_10) $(am__append_11) \
- $(am__append_12) $(am__append_13) $(am__append_14)
- at BUILD_DISKLESS_TRUE@am__append_10 = run_diskless.sh
- at BUILD_DISKLESS_TRUE@@BUILD_MMAP_TRUE at am__append_11 = run_mmap.sh
- at BUILD_DISKLESS_TRUE@@LARGE_FILE_TESTS_TRUE at am__append_12 = run_diskless2.sh
- at USE_PNETCDF_TRUE@am__append_13 = run_pnetcdf_test.sh
- at USE_VALGRIND_TESTS_TRUE@am__append_14 = run_valgrind_tests.sh
+TESTS = $(am__EXEEXT_5) $(am__append_10) $(am__append_11)
+ at USE_PNETCDF_TRUE@am__append_10 = run_pnetcdf_test.sh
+ at USE_VALGRIND_TESTS_TRUE@am__append_11 = run_valgrind_tests.sh
subdir = nc_test
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -1394,27 +1390,6 @@ testnc3perf.log: testnc3perf$(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)
-run_diskless.sh.log: run_diskless.sh
- @p='run_diskless.sh'; \
- b='run_diskless.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)
-run_mmap.sh.log: run_mmap.sh
- @p='run_mmap.sh'; \
- b='run_mmap.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)
-run_diskless2.sh.log: run_diskless2.sh
- @p='run_diskless2.sh'; \
- b='run_diskless2.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)
run_pnetcdf_test.sh.log: run_pnetcdf_test.sh
@p='run_pnetcdf_test.sh'; \
b='run_pnetcdf_test.sh'; \
@@ -1604,6 +1579,16 @@ uninstall-am:
.PRECIOUS: Makefile
+ at BUILD_UTILITIES_TRUE@ if BUILD_DISKLESS
+ at BUILD_UTILITIES_TRUE@ TESTS += run_diskless.sh
+ at BUILD_UTILITIES_TRUE@ if BUILD_MMAP
+ at BUILD_UTILITIES_TRUE@ TESTS += run_mmap.sh
+ at BUILD_UTILITIES_TRUE@ endif
+ at BUILD_UTILITIES_TRUE@ if LARGE_FILE_TESTS
+ at BUILD_UTILITIES_TRUE@ TESTS += run_diskless2.sh
+ at BUILD_UTILITIES_TRUE@ endif
+ at BUILD_UTILITIES_TRUE@ endif
+
# Only clean these on mainatiner-clean, because they require m4 to
# regenerate.
#MAINTAINERCLEANFILES = test_get.c test_put.c
diff --git a/nc_test/quick_large_files.c b/nc_test/quick_large_files.c
index 7c8567d..a1209e5 100644
--- a/nc_test/quick_large_files.c
+++ b/nc_test/quick_large_files.c
@@ -10,6 +10,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
@@ -49,7 +50,7 @@ main(int argc, char **argv)
int cmode_run;
int cflag = NC_CLOBBER;
- int res;
+ int res;
printf("\n*** Testing large files, quickly.\n");
@@ -57,14 +58,14 @@ main(int argc, char **argv)
{
size_t big_index = (size_t)MAX_CLASSIC_BYTES + 10;
/* On second pass, try using NC_SHARE. */
- if (cmode_run == 1)
+ if (cmode_run == 1)
{
cflag |= NC_SHARE;
printf("*** Turned on NC_SHARE for subsequent tests.\n");
}
/* Create a netCDF 64-bit offset format file. Write a value. */
- sprintf(file_name, "%s/%s", TEMP_LARGE, FILE_NAME);
+ sprintf(file_name, "%s/%s", TEMP_LARGE, FILE_NAME);
printf("*** Creating %s for 64-bit offset large file test...", file_name);
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
@@ -76,13 +77,13 @@ main(int argc, char **argv)
/* test bug fix writing record beyond 2**31 */
if ((res = nc_def_dim(ncid, "longerdim", NC_UNLIMITED, &recdimid)))
ERR;
- if ((res = nc_def_var(ncid, "spock", NC_DOUBLE, NUMDIMS,
+ if ((res = nc_def_var(ncid, "spock", NC_DOUBLE, NUMDIMS,
dimids, &spockid)))
ERR;
- if ((res = nc_def_var(ncid, "kirk", NC_DOUBLE, NUMDIMS,
+ if ((res = nc_def_var(ncid, "kirk", NC_DOUBLE, NUMDIMS,
dimids, &kirkid)))
ERR;
- if ((res = nc_def_var(ncid, "scotty", NC_BYTE, 1,
+ if ((res = nc_def_var(ncid, "scotty", NC_BYTE, 1,
&recdimid, &scottyid)))
ERR;
if ((res = nc_enddef(ncid)))
@@ -93,14 +94,14 @@ main(int argc, char **argv)
ERR;
if ((res = nc_get_var1_int(ncid, scottyid, &big_index, &int_val_in)))
ERR;
- if (int_val_in != int_val_out)
+ if (int_val_in != int_val_out)
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* How about a meteorological data file about the weather
- experience by various generals of revolutionary armies?
+ experience by various generals of revolutionary armies?
This has 3 dims, 4 vars. The dimensions are such that this will
(just barely) not fit in a classic format file. The first three
@@ -112,21 +113,21 @@ main(int argc, char **argv)
everything is rounded to a 4 byte boundary, so you need to add
some bytes for that (how many?), and that pushes us over the
limit.
-
+
We will create this file twice, once to ensure it succeeds (with
64-bit offset format), and once to make sure it fails (with
classic format). Then some variations to check record var
- boundaries.
+ boundaries.
*/
- printf("*** Now a 64-bit offset, large file, fixed var test...");
+ printf("*** Now a 64-bit offset, large file, fixed var test...");
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
QTR_CLASSIC_MAX, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
QTR_CLASSIC_MAX, &dimids_gen[1])))
ERR;
if ((res = nc_def_dim(ncid, "ruthlessness", 100, &dimids_gen[2])))
@@ -134,18 +135,18 @@ main(int argc, char **argv)
if ((res = nc_def_var(ncid, "Cromwell", NC_BYTE, 1, &dimids_gen[0],
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 1, &dimids_gen[1],
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 1, &dimids_gen[1],
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 1, &dimids_gen[0],
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 1, &dimids_gen[0],
&napoleanid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* Write a value or two just for fun. */
/*index[0] = QTR_CLASSIC_MAX - 296;
@@ -155,7 +156,7 @@ main(int argc, char **argv)
ERR;
if (int_val_in != int_val_out)
BAIL2;*/
- printf("*** Now writing some values...");
+ printf("*** Now writing some values...");
index[0] = QTR_CLASSIC_MAX - 295;
if ((res = nc_put_var1_int(ncid, napoleanid, index, &int_val_out)))
ERR;
@@ -182,20 +183,20 @@ main(int argc, char **argv)
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* This time it should fail, because we're trying to cram this into
a classic format file. nc_enddef will detect our violations and
give an error. We've*/
- printf("*** Now a classic file which will fail...");
+ printf("*** Now a classic file which will fail...");
if ((res = nc_create(file_name, cflag, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
QTR_CLASSIC_MAX, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
QTR_CLASSIC_MAX, &dimids_gen[1])))
ERR;
if ((res = nc_def_dim(ncid, "ruthlessness", 100, &dimids_gen[2])))
@@ -203,82 +204,82 @@ main(int argc, char **argv)
if ((res = nc_def_var(ncid, "Cromwell", NC_BYTE, 1, &dimids_gen[0],
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 1, &dimids_gen[1],
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 1, &dimids_gen[1],
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 1, &dimids_gen[0],
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 1, &dimids_gen[0],
&napoleanid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)) != NC_EVARSIZE)
ERR;
if ((res = nc_close(ncid)) != NC_EVARSIZE)
ERR;
- printf("ok\n");
+ printf("ok\n");
/* This will create some max sized 64-bit offset format fixed vars. */
- printf("*** Now a 64-bit offset, simple fixed var create test...");
+ printf("*** Now a 64-bit offset, simple fixed var create test...");
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
MAX_CLASSIC_BYTES, &dimids_gen[0])))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_SHORT, 1, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_SHORT, 1, dimids_gen,
+ if ((res = nc_def_var(ncid, "Napolean", NC_SHORT, 1, dimids_gen,
&napoleanid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, dimids_gen,
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, dimids_gen,
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)))
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* This will exceed the 64-bit offset format limits for one of the
fixed vars. */
- printf("*** Now a 64-bit offset, over-sized file that will fail...");
+ printf("*** Now a 64-bit offset, over-sized file that will fail...");
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
/* max dim size is MAX_CLASSIC_BYTES. */
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
MAX_CLASSIC_BYTES, dimids_gen)))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_DOUBLE, 1, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 1, dimids_gen,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 1, dimids_gen,
&washingtonid)))
if ((res = nc_enddef(ncid)) != NC_EVARSIZE)
ERR;
if ((res = nc_close(ncid)) != NC_EVARSIZE)
ERR;
- printf("ok\n");
+ printf("ok\n");
/* Now let's see about record vars. First create a 64-bit offset
file with three rec variables, each with the same numbers as
defined above for the fixed var tests. This should all work. */
- printf("*** Now a 64-bit offset, record var file...");
+ printf("*** Now a 64-bit offset, record var file...");
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
QTR_CLASSIC_MAX, &dimids_gen[1])))
ERR;
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
QTR_CLASSIC_MAX, &dimids_gen[2])))
ERR;
if ((res = nc_def_dim(ncid, "ruthlessness", 100, &dimids_gen[3])))
@@ -286,35 +287,35 @@ main(int argc, char **argv)
if ((res = nc_def_var(ncid, "Cromwell", NC_BYTE, 2, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen,
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen,
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen,
&napoleanid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)))
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* Now try this record file in classic format. It should fail and
the enddef. Too many bytes in the first record.*/
- printf("*** Now a classic file that's too big and will fail...");
+ printf("*** Now a classic file that's too big and will fail...");
if ((res = nc_create(file_name, cflag, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
QTR_CLASSIC_MAX, &dimids_gen[1])))
ERR;
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
QTR_CLASSIC_MAX, &dimids_gen[2])))
ERR;
if ((res = nc_def_dim(ncid, "ruthlessness", 100, &dimids_gen[3])))
@@ -322,34 +323,34 @@ main(int argc, char **argv)
if ((res = nc_def_var(ncid, "Cromwell", NC_BYTE, 2, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen,
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen,
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen,
&napoleanid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)) != NC_EVARSIZE)
ERR;
if ((res = nc_close(ncid)) != NC_EVARSIZE)
ERR;
- printf("ok\n");
+ printf("ok\n");
/* Now try this record file in classic format. It just barely
passes at the enddef. Almost, but not quite, too many bytes in
- the first record. Since I'm adding a fixed variable (Collins),
- I don't get the last record size exemption. */
- printf("*** Now a classic file with recs and one fixed will fail...");
+ the first record. Since I'm adding a fixed variable (Collins),
+ I don't get the last record size exemption. */
+ printf("*** Now a classic file with recs and one fixed will fail...");
if ((res = nc_create(file_name, cflag, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
MAX_CLASSIC_BYTES, &dimids_gen[1])))
ERR;
if ((res = nc_def_dim(ncid, "ruthlessness", 100, &dimids_gen[2])))
@@ -357,14 +358,14 @@ main(int argc, char **argv)
if ((res = nc_def_var(ncid, "Cromwell", NC_BYTE, 2, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 1, &dimids_gen[2],
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)))
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* Try a classic file with several records, and the last record var
with a record size greater than our magic number of 2 GiB - 4
@@ -373,17 +374,17 @@ main(int argc, char **argv)
increases his size to 2147483644 (the max dimension size) times
8, or about 16 GB per record. Zowie! (Mind you, Cromwell
certainly had a great deal of revolutionary fervor.)
- */
- printf("*** Now a classic file with one large rec var...");
+ */
+ printf("*** Now a classic file with one large rec var...");
if ((res = nc_create(file_name, cflag, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
- MAX_CLASSIC_BYTES, &dimids_gen[1])))
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ MAX_CLASSIC_BYTES, &dimids_gen[1])))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_DOUBLE, 2, dimids_gen,
&cromwellid)))
@@ -400,8 +401,8 @@ main(int argc, char **argv)
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
-
+ printf("ok\n");
+
/* This is a classic format file with an extra-large last record
var. */
printf("*** Now a classic file with extra-large last record var...") ;
@@ -409,23 +410,23 @@ main(int argc, char **argv)
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
- MAX_CLASSIC_BYTES, &dimids_gen[1])))
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ MAX_CLASSIC_BYTES, &dimids_gen[1])))
ERR;
dimids_gen1[0] = dimids_gen[0];
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
5368, &dimids_gen1[1])))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen1,
&napoleanid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
&collinsid)))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_DOUBLE, 2, dimids_gen,
@@ -443,108 +444,108 @@ main(int argc, char **argv)
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
/* This is a classic format file with an extra-large second to last
record var. But this time it won't work, because the size
exemption only applies to the last record var. Note that one
dimension is small (5000). */
- printf("*** Now a classic file xtra-large 2nd to last var that will fail...");
+ printf("*** Now a classic file xtra-large 2nd to last var that will fail...");
if ((res = nc_create(file_name, cflag, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
- MAX_CLASSIC_BYTES, &dimids_gen[1])))
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ MAX_CLASSIC_BYTES, &dimids_gen[1])))
ERR;
dimids_gen1[0] = dimids_gen[0];
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
5000, &dimids_gen1[1])))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen1,
&napoleanid)))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_DOUBLE, 2, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)) != NC_EVARSIZE)
ERR;
if ((res = nc_close(ncid)) != NC_EVARSIZE)
ERR;
- printf("ok\n");
+ printf("ok\n");
/* Now try an extra large second to last ver with 64-bit
offset. This won't work either, because the cromwell var is so
large. It exceeds the 4GiB - 4 byte per record limit for record
vars. */
- printf("*** Now a 64-bit offset file with too-large rec var that will fail...");
+ printf("*** Now a 64-bit offset file with too-large rec var that will fail...");
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
- MAX_CLASSIC_BYTES, &dimids_gen[1])))
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ MAX_CLASSIC_BYTES, &dimids_gen[1])))
ERR;
dimids_gen1[0] = dimids_gen[0];
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
5368, &dimids_gen1[1])))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Napolean", NC_BYTE, 2, dimids_gen1,
&napoleanid)))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_DOUBLE, 2, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)) != NC_EVARSIZE)
ERR;
if ((res = nc_close(ncid)) != NC_EVARSIZE)
ERR;
- printf("ok\n");
+ printf("ok\n");
/* A 64-bit offset record file that just fits... */
- printf("*** Now a 64 bit-offset file that just fits...");
+ printf("*** Now a 64 bit-offset file that just fits...");
if ((res = nc_create(file_name, cflag|NC_64BIT_OFFSET, &ncid)))
ERR;
if ((res = nc_set_fill(ncid, NC_NOFILL, NULL)))
ERR;
- if ((res = nc_def_dim(ncid, "political_trouble",
+ if ((res = nc_def_dim(ncid, "political_trouble",
NC_UNLIMITED, &dimids_gen[0])))
ERR;
- if ((res = nc_def_dim(ncid, "revolutionary_fervor",
- MAX_CLASSIC_BYTES, &dimids_gen[1])))
+ if ((res = nc_def_dim(ncid, "revolutionary_fervor",
+ MAX_CLASSIC_BYTES, &dimids_gen[1])))
ERR;
dimids_gen1[0] = dimids_gen[0];
- if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
+ if ((res = nc_def_dim(ncid, "post_revoultionary_hangover",
MAX_CLASSIC_BYTES, &dimids_gen1[1])))
ERR;
- if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Washington", NC_SHORT, 2, dimids_gen1,
&washingtonid)))
ERR;
- if ((res = nc_def_var(ncid, "Napolean", NC_SHORT, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Napolean", NC_SHORT, 2, dimids_gen1,
&napoleanid)))
ERR;
if ((res = nc_def_var(ncid, "Cromwell", NC_SHORT, 2, dimids_gen,
&cromwellid)))
ERR;
- if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
+ if ((res = nc_def_var(ncid, "Collins", NC_DOUBLE, 2, dimids_gen1,
&collinsid)))
ERR;
if ((res = nc_enddef(ncid)))
@@ -559,20 +560,14 @@ main(int argc, char **argv)
ERR;
if ((res = nc_close(ncid)))
ERR;
- printf("ok\n");
+ printf("ok\n");
} /* end of cmode run */
/* Wow! Everything worked! */
- printf("*** Tests successful!\n");
+ printf("*** Tests successful!\n");
/* Delete the huge data file we created. */
- (void) remove(file_name);
+ (void) remove(file_name);
return 0;
}
-
-
-
-
-
-
diff --git a/nc_test/test_get.c b/nc_test/test_get.c
new file mode 100644
index 0000000..5cb14fa
--- /dev/null
+++ b/nc_test/test_get.c
@@ -0,0 +1,9223 @@
+/* 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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_get.m4 b/nc_test/test_get.m4
index 3b77f9c..5b792be 100644
--- a/nc_test/test_get.m4
+++ b/nc_test/test_get.m4
@@ -308,15 +308,6 @@ test_nc_get_vara_$1(void)
err = nc_get_vara_$1(ncid, BAD_VARID, start, edge, value);
IF (err != NC_ENOTVAR)
error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_get_vara_$1(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
err = nc_get_vara_$1(ncid, i, start, edge, value);
if (canConvert) {
IF (err)
diff --git a/nc_test/test_put.c b/nc_test/test_put.c
new file mode 100644
index 0000000..a55118f
--- /dev/null
+++ b/nc_test/test_put.c
@@ -0,0 +1,11714 @@
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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;
+ }
+ }
+
+/* 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/test_put.m4 b/nc_test/test_put.m4
index 3e6ca5d..32601f5 100644
--- a/nc_test/test_put.m4
+++ b/nc_test/test_put.m4
@@ -614,25 +614,6 @@ test_nc_put_vara_$1(void)
edge[j] = 1;
}
}
- /* Check correct error returned even when nothing to put */
- for (j = 0; j < var_rank[i]; j++) {
- edge[j] = 0;
- }
- err = nc_put_vara_$1(BAD_ID, i, start, edge, value);
- IF (err != NC_EBADID)
- error("bad ncid: status = %d", err);
- err = nc_put_vara_$1(ncid, BAD_VARID, start, edge, value);
- IF (err != NC_ENOTVAR)
- error("bad var id: status = %d", err);
- for (j = 0; j < var_rank[i]; j++) {
- if (var_dimid[i][j] > 0) { /* skip record dim */
- start[j] = var_shape[i][j];
- err = nc_put_vara_$1(ncid, i, start, edge, value);
- IF (canConvert && err != NC_EINVALCOORDS)
- error("bad start: status = %d", err);
- start[j] = 0;
- }
- }
/* wkliao: this test below of put_vara is redundant and incorrectly uses the
value[] set from the previously iteration. There is no such test
diff --git a/nc_test/tst_atts.c b/nc_test/tst_atts.c
index 506797d..64edf3a 100644
--- a/nc_test/tst_atts.c
+++ b/nc_test/tst_atts.c
@@ -10,6 +10,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <string.h>
@@ -2355,7 +2356,7 @@ main(int argc, char **argv)
#define A1_NAME "a"
#define B1_NAME "b"
#define VAR_NAME "var"
-
+
int ncid, nvars, v, natts, varid;
char name_in[NC_MAX_NAME + 1];
char char_data = 'a';
@@ -2369,7 +2370,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, &varid)) ERR;
if (nc_put_att(ncid, varid, A1_NAME, NC_CHAR, 1, &char_data)) ERR;
if (nc_put_att(ncid, varid, B1_NAME, NC_CHAR, 1, &char_data)) ERR;
-
+
/* Add a global attribute A1_NAME. */
if (nc_put_att(ncid, NC_GLOBAL, A1_NAME, NC_CHAR, 1, &char_data)) ERR;
@@ -2398,7 +2399,7 @@ main(int argc, char **argv)
!= NC_EINVAL) ERR;
#endif
/* This also should return error, because types don't match */
- if (nc_put_att_float(ncid, varid, "_FillValue", NC_FLOAT, 1, &var_FillValue_att)
+ if (nc_put_att_float(ncid, varid, "_FillValue", NC_FLOAT, 1, &var_FillValue_att)
!= NC_EBADTYPE) ERR;
/* This should succeed, _FillValue is valid */
if (nc_put_att_int(ncid, varid, "_FillValue", NC_INT, 1, var_FillValue_atts)) ERR;
diff --git a/nc_test/tst_atts3.c b/nc_test/tst_atts3.c
index 01d2eea..3855e01 100644
--- a/nc_test/tst_atts3.c
+++ b/nc_test/tst_atts3.c
@@ -2,13 +2,14 @@
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
- Test attributes.
+ Test attributes.
$Id: tst_atts3.c 2796 2014-10-28 03:40:29Z wkliao $
*/
#include "config.h"
#include <nc_tests.h>
+#include "err_macros.h"
#include <signal.h>
#include "netcdf.h"
#ifdef USE_PARALLEL
@@ -84,7 +85,7 @@ int
tst_att_ordering(int cmode)
{
int ncid;
- char name[NUM_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
+ char name[NUM_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
"Gd", "Gatt-name-dashes", "Gatt.name.dots"};
int len[NUM_ATTS] = {0, 2, 3, 3, 3, 3, 1, 1};
signed char b[2] = {-128, 127};
@@ -102,16 +103,16 @@ tst_att_ordering(int cmode)
#else
if (nc_create(FILE_NAME, cmode, &ncid)) ERR;
#endif
- if (nc_put_att_text(ncid, NC_GLOBAL, name[0], len[0], NULL)) ERR;
- if (nc_put_att_schar(ncid, NC_GLOBAL, name[1], NC_BYTE, len[1], b)) ERR;
- if (nc_put_att_short(ncid, NC_GLOBAL, name[2], NC_SHORT, len[2], s)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, name[3], NC_INT, len[3], i)) ERR;
- if (nc_put_att_float(ncid, NC_GLOBAL, name[4], NC_FLOAT, len[4], f)) ERR;
- if (nc_put_att_double(ncid, NC_GLOBAL, name[5], NC_DOUBLE, len[5], d)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, name[6], NC_INT, len[6], &att_name_dashes)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, name[7], NC_INT, len[7], &att_name_dots)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, name[0], len[0], NULL)) ERR;
+ if (nc_put_att_schar(ncid, NC_GLOBAL, name[1], NC_BYTE, len[1], b)) ERR;
+ if (nc_put_att_short(ncid, NC_GLOBAL, name[2], NC_SHORT, len[2], s)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[3], NC_INT, len[3], i)) ERR;
+ if (nc_put_att_float(ncid, NC_GLOBAL, name[4], NC_FLOAT, len[4], f)) ERR;
+ if (nc_put_att_double(ncid, NC_GLOBAL, name[5], NC_DOUBLE, len[5], d)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[6], NC_INT, len[6], &att_name_dashes)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[7], NC_INT, len[7], &att_name_dots)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check the order. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -158,7 +159,7 @@ main(int argc, char **argv)
#define NUM_SIMPLE_ATTS 9
{
int ncid;
- char name[NUM_SIMPLE_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
+ char name[NUM_SIMPLE_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
"Gd", "G7", "G8", "G9"};
char name_in[NC_MAX_NAME];
int j;
@@ -170,9 +171,9 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
for (j = 0; j < NUM_SIMPLE_ATTS; j++)
- if (nc_put_att_int(ncid, NC_GLOBAL, name[j], NC_INT, 0, NULL)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[j], NC_INT, 0, NULL)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check the order. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -190,7 +191,7 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
printf("*** testing simple global atts...");
- {
+ {
int ncid;
nc_type att_type;
size_t att_len;
@@ -204,8 +205,8 @@ main(int argc, char **argv)
#else
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
- if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
- int_out)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
+ int_out)) ERR;
/* It is also OK to read classic types converted into
* supported C types. though the conversion may encounter
* out-of-range values */
@@ -225,12 +226,12 @@ main(int argc, char **argv)
#else
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
- if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
- if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
- if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
- if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
+ if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
+ if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
+ if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
if (nc_close(ncid)) ERR;
/* Open the file and check attributes. */
@@ -244,23 +245,23 @@ main(int argc, char **argv)
ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
/* Check numeric values. */
- if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
+ if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (schar_in[i] != schar_out[i]) ERR;
- if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
+ if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (short_in[i] != short_out[i]) ERR;
- if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
+ if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (int_in[i] != int_out[i]) ERR;
- if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
+ if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (float_in[i] != float_out[i]) ERR;
- if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
+ if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (double_in[i] != double_out[i]) ERR;
if (nc_close(ncid)) ERR;
@@ -540,10 +541,10 @@ main(int argc, char **argv)
#else
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1,
- speech)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1,
+ speech)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Rename it. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_WRITE|NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -555,7 +556,7 @@ main(int argc, char **argv)
if (nc_inq_attname(ncid, NC_GLOBAL, attid_in, name_in)) ERR;
if (strcmp(name_in, ATT_TEXT_NAME)) ERR;
if (nc_redef(ncid)) ERR;
- if (nc_rename_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, ATT_TEXT_NAME2)) ERR;
+ if (nc_rename_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, ATT_TEXT_NAME2)) ERR;
if (nc_inq_attname(ncid, NC_GLOBAL, attid_in, name_in)) ERR;
if (strcmp(name_in, ATT_TEXT_NAME2)) ERR;
if (nc_close(ncid)) ERR;
@@ -568,10 +569,10 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME2, &att_type, &att_len)) ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME2, speech_in)) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME2, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in) != NC_ENOTATT) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in) != NC_ENOTATT) ERR;
if (nc_close(ncid)) ERR;
/* Now delete the att. */
@@ -590,13 +591,13 @@ main(int argc, char **argv)
#else
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
if (nc_def_dim(ncid, DIM2_NAME, DIM2_LEN, &dimids[1])) ERR;
if (nc_def_var(ncid, VAR1_NAME, NC_INT, 2, dimids, &varid)) ERR;
- if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
+ if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and delete it. Make sure it's gone. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_WRITE|NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -615,7 +616,7 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
#endif
if (nc_redef(ncid)) ERR;
- if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
+ if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
if (nc_enddef(ncid)) ERR;
if (nc_redef(ncid)) ERR;
if (nc_del_att(ncid, 0, ATT_INT_NAME)) ERR;
@@ -643,7 +644,7 @@ main(int argc, char **argv)
if (nc_put_att_int(ncid, NC_GLOBAL, ATT0, NC_INT, 1, &number)) ERR;
if (nc_put_att_int(ncid, NC_GLOBAL, ATT1, NC_INT, 1, &number)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Open it and check the order. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_WRITE|NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -668,7 +669,7 @@ main(int argc, char **argv)
if (nc_put_att_int(ncid, varid, ATT0, NC_INT, 1, &number)) ERR;
if (nc_put_att_int(ncid, varid, ATT1, NC_INT, 1, &number)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check the order of the attributes on the var. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_WRITE|NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -686,9 +687,9 @@ main(int argc, char **argv)
printf("*** testing attribute ordering some more...");
#define VAR_NAME "i"
-#define A1_NAME "i"
-#define A2_NAME "f"
-#define A3_NAME "d"
+#define A1_NAME "i"
+#define A2_NAME "f"
+#define A3_NAME "d"
#define A1_LEN 3
#define A2_LEN 4
#define A3_LEN 5
@@ -705,11 +706,11 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, &varid)) ERR;
- if (nc_put_att_double(ncid, varid, A1_NAME, NC_INT, A1_LEN, dvalue)) ERR;
- if (nc_put_att_double(ncid, varid, A2_NAME, NC_INT, A2_LEN, dvalue)) ERR;
- if (nc_put_att_double(ncid, varid, A3_NAME, NC_INT, A3_LEN, dvalue)) ERR;
+ if (nc_put_att_double(ncid, varid, A1_NAME, NC_INT, A1_LEN, dvalue)) ERR;
+ if (nc_put_att_double(ncid, varid, A2_NAME, NC_INT, A2_LEN, dvalue)) ERR;
+ if (nc_put_att_double(ncid, varid, A3_NAME, NC_INT, A3_LEN, dvalue)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check. */
#ifdef TEST_PNETCDF
if (nc_open_par(FILE_NAME, NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)) ERR;
@@ -770,7 +771,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("*** testing copy of simple global atts...");
- {
+ {
int ncid, ncid2;
nc_type att_type;
size_t att_len;
@@ -789,12 +790,12 @@ main(int argc, char **argv)
#else
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
#endif
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
- if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
- if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
- if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
- if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
+ if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
+ if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
+ if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
/* Create another file and copy all the attributes. */
#ifdef TEST_PNETCDF
@@ -823,23 +824,23 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, &att_type, &att_len)) ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
/* Check numeric values. */
- if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
+ if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (schar_in[i] != schar_out[i]) ERR;
- if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
+ if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (short_in[i] != short_out[i]) ERR;
- if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
+ if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (int_in[i] != int_out[i]) ERR;
- if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
+ if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (float_in[i] != float_out[i]) ERR;
- if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
+ if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (double_in[i] != double_out[i]) ERR;
if (nc_close(ncid)) ERR;
@@ -850,5 +851,3 @@ main(int argc, char **argv)
#endif
FINAL_RESULTS;
}
-
-
diff --git a/nc_test/tst_big_rvar.c b/nc_test/tst_big_rvar.c
index cc1a8f8..800d054 100644
--- a/nc_test/tst_big_rvar.c
+++ b/nc_test/tst_big_rvar.c
@@ -12,6 +12,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
@@ -37,7 +38,7 @@
static int
-test_big_var(const char *testfile)
+test_big_var(const char *testfile)
{
int ncid, varid, dimids[NUMDIMS];
size_t index[NUMDIMS];
@@ -48,7 +49,7 @@ test_big_var(const char *testfile)
signed char data[DIM2][DIM3];
int i, j;
int nerrs = 0;
-
+
/* Create a file with one big record variable. */
if (nc_create(testfile, NC_CLOBBER, &ncid)) ERR;
if (nc_set_fill(ncid, NC_NOFILL, NULL)) ERR;
@@ -81,9 +82,9 @@ test_big_var(const char *testfile)
for (i = 0; i < DIM2; i++)
for (j = 0; j < DIM3; j++)
{
- if (data[i][j] != (signed char)((i + j) % 16))
+ if (data[i][j] != (signed char)((i + j) % 16))
{
- printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
+ printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
start[0], i, j, (i + j) % 16, data[i][j]);
ERR;
if(nerrs++ > 2)
@@ -95,9 +96,9 @@ test_big_var(const char *testfile)
for (i = 0; i < DIM2; i++)
for (j = 0; j < DIM3; j++)
{
- if (data[i][j] != (signed char)((i + j) % 16))
+ if (data[i][j] != (signed char)((i + j) % 16))
{
- printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
+ printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
start[0], i, j, (i + j) % 16, data[i][j]);
ERR;
if(nerrs++ > 2)
@@ -123,6 +124,6 @@ main(int argc, char **argv) {
(void) remove(testfile);
SUMMARIZE_ERR;
}
-
+
FINAL_RESULTS;
}
diff --git a/nc_test/tst_big_var.c b/nc_test/tst_big_var.c
index 6ba5f19..f66080c 100644
--- a/nc_test/tst_big_var.c
+++ b/nc_test/tst_big_var.c
@@ -9,6 +9,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
@@ -29,13 +30,13 @@
#define DIM1 2048
#define DIM2 2097153 /* DIM1*DIM2*sizeof(char) > 2**32 */
-/*
+/*
* In netCDF-3.6.2, an assertion failure occurs on 32-bit platforms
* when creating a byte variable for which the product of dimensions
* is greater than 2**32. Check that this bug has been fixed.
*/
static int
-test_big_var(const char *testfile)
+test_big_var(const char *testfile)
{
int ncid, varid, dimids[NUMDIMS];
size_t index[NUMDIMS];
@@ -78,6 +79,6 @@ main(int argc, char **argv) {
(void) remove(testfile);
SUMMARIZE_ERR;
}
-
+
FINAL_RESULTS;
}
diff --git a/nc_test/tst_big_var2.c b/nc_test/tst_big_var2.c
index 0b90916..6ca5c9c 100644
--- a/nc_test/tst_big_var2.c
+++ b/nc_test/tst_big_var2.c
@@ -12,6 +12,7 @@
#include "config.h"
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
@@ -32,7 +33,7 @@
#define DIM1 1000
#define DIM2 2000 /* DIM0*DIM1*DIM2 > 2**32 */
-/*
+/*
* This program tests the fix for a large file bug in versions
* previous to netCDF-4.1.2 for 32-bit platforms, writing to a
* variable with more than 1 dimension and more than 2**32 values,
@@ -41,7 +42,7 @@
* as well, but that's not tested here.
*/
static int
-test_big_var(const char *testfile)
+test_big_var(const char *testfile)
{
int ncid, varid, dimids[NUMDIMS];
size_t index[NUMDIMS];
@@ -91,7 +92,7 @@ test_big_var(const char *testfile)
{
if (data[i][j] != 42 )
{
- printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
+ printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
start[0], i, j, 42, data[i][j]);
ERR;
if(nerrs++ > 1)
@@ -105,7 +106,7 @@ test_big_var(const char *testfile)
{
if (data[i][j] != 19 )
{
- printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
+ printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
start[0], i, j, 19, data[i][j]);
ERR;
if(nerrs++ > 1)
@@ -132,6 +133,6 @@ main(int argc, char **argv) {
(void) remove(testfile);
SUMMARIZE_ERR;
}
-
+
FINAL_RESULTS;
}
diff --git a/nc_test/tst_big_var6.c b/nc_test/tst_big_var6.c
index 574c5bf..054e5d2 100644
--- a/nc_test/tst_big_var6.c
+++ b/nc_test/tst_big_var6.c
@@ -11,6 +11,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
@@ -33,7 +34,7 @@
#define DIM3 1000000 /* DIM2*DIM3 > 2**32 */
#define FIRST_VAL 65
#define SECOND_VAL 90
-/*
+/*
* This program tests the fix for a large file bug in versions
* previous to netCDF-4.1.2 for 32-bit platforms, writing to a
* variable with more than 1 dimension and more than 2**32 values,
@@ -42,7 +43,7 @@
* as well, but that's not tested here.
*/
static int
-test_big_var(const char *testfile)
+test_big_var(const char *testfile)
{
int ncid, varid, dimids[NUMDIMS];
size_t start[NUMDIMS] = {0, 0, 0, 0};
@@ -50,7 +51,7 @@ test_big_var(const char *testfile)
short data[DIM3];
int i, j, k;
int nerrs = 0;
-
+
/* Create a file with one big 4D variable. */
if (nc_create(testfile, NC_CLOBBER, &ncid)) ERR;
if (nc_set_fill(ncid, NC_NOFILL, NULL)) ERR;
@@ -84,7 +85,7 @@ test_big_var(const char *testfile)
if (nc_get_vara_short(ncid, varid, start, count, &data[0])) ERR;
for (j = 0; j < DIM3; j++) {
if (data[j] != FIRST_VAL ) {
- printf("error on start[0..2]: %d,%d,%d j: %d, expected %d got %d\n",
+ printf("error on start[0..2]: %d,%d,%d j: %d, expected %d got %d\n",
start[0], start[1], start[2], j, FIRST_VAL, data[j]);
ERR;
if(nerrs++ > 1)
@@ -110,6 +111,6 @@ main(int argc, char **argv) {
(void) remove(testfile);
SUMMARIZE_ERR;
}
-
+
FINAL_RESULTS;
}
diff --git a/nc_test/tst_diskless.c b/nc_test/tst_diskless.c
index 97708ee..c0ec039 100644
--- a/nc_test/tst_diskless.c
+++ b/nc_test/tst_diskless.c
@@ -1,6 +1,6 @@
/** \file \internal
Basic diskless API tests.
-
+
Copyright 2011, UCAR/Unidata. See COPYRIGHT file for copying and
redistribution conditions.
*/
@@ -9,6 +9,7 @@ redistribution conditions.
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
@@ -19,7 +20,7 @@ redistribution conditions.
#define PERSIST (NC_WRITE)
#define RESISTOR "resistor_value"
-#define CAPACITOR "capacitor_value"
+#define CAPACITOR "capacitor_value"
#define NUM555 "number_of_555_timer_chips"
#ifdef DDBG
@@ -89,27 +90,27 @@ printf("*** testing diskless file with scalar vars...");
float float_data = 3.14, float_data_in;
int int_data = 42, int_data_in;
short short_data = 2, short_data_in;
-
+
removefile(persist,filename);
/* Create a netCDF file (which exists only in memory). */
if (nc_create(filename, flags, &ncid)) ERR;
-
+
/* Create some variables. */
if (nc_def_var(ncid, RESISTOR, NC_INT, 0, NULL, &varid0)) ERR;
if (nc_def_var(ncid, CAPACITOR, NC_FLOAT, 0, NULL, &varid1)) ERR;
if (nc_def_var(ncid, NUM555, NC_SHORT, 0, NULL, &varid2)) ERR;
if (nc_enddef(ncid)) ERR;
-
+
/* Write some data to this file. */
if (nc_put_vara_int(ncid, varid0, NULL, NULL, &int_data)) ERR;
if (nc_put_vara_float(ncid, varid1, NULL, NULL, &float_data)) ERR;
if (nc_put_vara_short(ncid, varid2, NULL, NULL, &short_data)) ERR;
-
+
/* Now check the phony file. */
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != 0 || nvars_in != 3 || natts_in != 0 || unlimdimid_in != -1) ERR;
-
+
/* Check variables. */
if (nc_inq_var(ncid, varid0, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR;
if (strcmp(name_in, RESISTOR) || type_in != NC_INT || ndims_in != 0 ||
@@ -119,7 +120,7 @@ printf("*** testing diskless file with scalar vars...");
natts_in != 0) ERR;
if (nc_inq_var(ncid, varid2, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR;
if (strcmp(name_in, NUM555) || type_in != NC_SHORT || natts_in != 0) ERR;
-
+
/* Read my absolutely crucial data. */
if (nc_get_vara_int(ncid, varid0, NULL, NULL, &int_data_in)) ERR;
if (int_data_in != int_data) ERR;
@@ -127,7 +128,7 @@ printf("*** testing diskless file with scalar vars...");
if (float_data_in != float_data) ERR;
if (nc_get_vara_short(ncid, varid2, NULL, NULL, &short_data_in)) ERR;
if (short_data_in != short_data) ERR;
-
+
/* Close the file. */
if (nc_close(ncid))
abort(); /* ERR; */
@@ -148,16 +149,16 @@ printf("*** testing diskless file with scalar vars...");
if (nc_inq_varid(ncid, RESISTOR, &varid0)) ERR;
if (nc_inq_varid(ncid, CAPACITOR, &varid1)) ERR;
if (nc_inq_varid(ncid, NUM555, &varid2)) ERR;
-
+
if (nc_get_vara_int(ncid, varid0, NULL, NULL, &int_data_in)) ERR;
if (int_data_in != int_data) ERR;
if (nc_get_vara_float(ncid, varid1, NULL, NULL, &float_data_in)) ERR;
if (float_data_in != float_data) ERR;
if (nc_get_vara_short(ncid, varid2, NULL, NULL, &short_data_in)) ERR;
if (short_data_in != short_data) ERR;
-
+
nc_close(ncid);
- }
+ }
SUMMARIZE_ERR;
printf("*** testing creation of simple diskless file...");
@@ -171,7 +172,7 @@ printf("*** testing diskless file with scalar vars...");
#define VAR0_NAME "nightlife"
#define VAR1_NAME "time"
#define VAR2_NAME "taxi_distance"
-
+
int ncid, dimid[NDIMS], dimid_in[NDIMS], varid0, varid1, varid2;
int ndims_in, nvars_in, natts_in, unlimdimid_in;
char name_in[NC_MAX_NAME + 1], att0_in[NC_MAX_NAME + 1];
@@ -182,53 +183,53 @@ printf("*** testing diskless file with scalar vars...");
size_t count[1] = {DIM1_LEN};
int i;
float float_data = 42.22, float_data_in;
-
+
/* This is some really important data that I want to save. */
for (i = 0; i < DIM1_LEN; i++)
short_data[i] = i;
-
+
removefile(persist,filename);
/* Create a netCDF file (which exists only in memory). I am
* confident that the world-famous netCDF format is the way to
* store my data! */
if (nc_create(filename, flags, &ncid)) ERR;
-
+
/* Create some atts. They will help document my data forever. */
if (nc_put_att_text(ncid, NC_GLOBAL, ATT0_NAME,
sizeof(ATT0_TEXT) + 1, ATT0_TEXT)) ERR;
-
+
/* Create dimensions: money is limited, but fun is not! */
if (nc_def_dim(ncid, DIM0_NAME, NC_UNLIMITED, &dimid[0])) ERR;
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimid[1])) ERR;
-
+
/* Create some variables. The data they hold must persist
* through the ages. */
if (nc_def_var(ncid, VAR0_NAME, NC_INT, NDIMS, dimid, &varid0)) ERR;
if (nc_def_var(ncid, VAR1_NAME, NC_FLOAT, 0, NULL, &varid1)) ERR;
if (nc_def_var(ncid, VAR2_NAME, NC_SHORT, 1, &dimid[1], &varid2)) ERR;
if (nc_enddef(ncid)) ERR;
-
+
/* Write some data to this file. I'm glad I'm saving this
* important data in such a safe format! */
if (nc_put_vara_float(ncid, varid1, NULL, NULL, &float_data)) ERR;
if (nc_put_vara_short(ncid, varid2, start, count, short_data)) ERR;
-
+
/* Now check the phony file. Is my data safe? */
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != 2 || nvars_in != 3 || natts_in != 1 || unlimdimid_in != 0) ERR;
-
+
/* Check attributes - they will be needed by future generations
* of scientists to understand my data. */
if (nc_get_att_text(ncid, NC_GLOBAL, ATT0_NAME, att0_in)) ERR;
if (strcmp(att0_in, ATT0_TEXT)) ERR;
-
+
/* Check dimensions. */
if (nc_inq_dim(ncid, dimid[0], name_in, &len_in)) ERR;
if (strcmp(name_in, DIM0_NAME) || len_in != 0) ERR;
if (nc_inq_dim(ncid, dimid[1], name_in, &len_in)) ERR;
if (strcmp(name_in, DIM1_NAME) || len_in != DIM1_LEN) ERR;
-
+
/* Check variables. */
if (nc_inq_var(ncid, varid0, name_in, &type_in, &ndims_in, dimid_in, &natts_in)) ERR;
if (strcmp(name_in, VAR0_NAME) || type_in != NC_INT || ndims_in != NDIMS ||
@@ -239,11 +240,11 @@ printf("*** testing diskless file with scalar vars...");
if (nc_inq_var(ncid, varid2, name_in, &type_in, &ndims_in, dimid_in, &natts_in)) ERR;
if (strcmp(name_in, VAR2_NAME) || type_in != NC_SHORT || ndims_in != 1 ||
dimid_in[0] != 1 || natts_in != 0) ERR;
-
+
/* Read my absolutely crucial data. */
if (nc_get_vara_float(ncid, varid1, NULL, NULL, &float_data_in)) ERR;
if (float_data_in != float_data) ERR;
-
+
/* Close the file, losing all information. Hey! What kind of
* storage format is this, anyway? */
if (nc_close(ncid))
@@ -255,7 +256,7 @@ printf("*** testing diskless file with scalar vars...");
#define DUNE "dune"
#define STAR_TREK "capacitor_value"
#define STAR_WARS "number_of_555_timer_chips"
-
+
int ncid, varid0, varid1, varid2;
int ndims_in, nvars_in, natts_in, unlimdimid_in;
char name_in[NC_MAX_NAME + 1];
@@ -263,27 +264,27 @@ printf("*** testing diskless file with scalar vars...");
float float_data = 3.14, float_data_in;
int int_data = 42, int_data_in;
short short_data = 2, short_data_in;
-
+
removefile(persist,filename);
/* Create a netCDF file (which exists only in memory). */
if (nc_create(filename, flags, &ncid)) ERR;
-
+
/* Create some variables. */
if (nc_def_var(ncid, DUNE, NC_INT, 0, NULL, &varid0)) ERR;
if (nc_def_var(ncid, STAR_TREK, NC_FLOAT, 0, NULL, &varid1)) ERR;
if (nc_def_var(ncid, STAR_WARS, NC_SHORT, 0, NULL, &varid2)) ERR;
if (nc_enddef(ncid)) ERR;
-
+
/* Write some data to this file. */
if (nc_put_vara_int(ncid, varid0, NULL, NULL, &int_data)) ERR;
if (nc_put_vara_float(ncid, varid1, NULL, NULL, &float_data)) ERR;
if (nc_put_vara_short(ncid, varid2, NULL, NULL, &short_data)) ERR;
-
+
/* Now check the phony file. */
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != 0 || nvars_in != 3 || natts_in != 0 || unlimdimid_in != -1) ERR;
-
+
/* Check variables. */
if (nc_inq_var(ncid, varid0, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR;
if (strcmp(name_in, DUNE) || type_in != NC_INT || ndims_in != 0 ||
@@ -294,7 +295,7 @@ printf("*** testing diskless file with scalar vars...");
natts_in != 0) ERR;
if (nc_inq_var(ncid, varid2, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR;
if (strcmp(name_in, STAR_WARS) || type_in != NC_SHORT || natts_in != 0) ERR;
-
+
/* Read my absolutely crucial data. */
if (nc_get_vara_int(ncid, varid0, NULL, NULL, &int_data_in)) ERR;
if (int_data_in != int_data) ERR;
@@ -302,15 +303,14 @@ printf("*** testing diskless file with scalar vars...");
if (float_data_in != float_data) ERR;
if (nc_get_vara_short(ncid, varid2, NULL, NULL, &short_data_in)) ERR;
if (short_data_in != short_data) ERR;
-
+
/* Close the file. */
if (nc_close(ncid))
abort(); /* ERR; */
}
SUMMARIZE_ERR;
FINAL_RESULTS;
-
+
/* Unnecessary exit(0), FINAL_RESULTS returns. */
/* exit(0); */
}
-
diff --git a/nc_test/tst_diskless3.c b/nc_test/tst_diskless3.c
index 9667582..8f9e0ec 100644
--- a/nc_test/tst_diskless3.c
+++ b/nc_test/tst_diskless3.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
/* Derived from tst_small.c */
@@ -17,7 +18,7 @@
#define NCFILENAME "tst_diskless3.nc"
#define ATT_NAME "Atom"
-#define MAX_LEN 7
+#define MAX_LEN 7
#define VAR_NAME2 "var2"
#define NUM_VARS 2
@@ -81,7 +82,7 @@ test_two_growing_with_att(const char *testfile)
if((status=nc_enddef(ncid))) ERRSTAT(status);
}
if((status=nc_close(ncid))) ERRSTAT(status);
-
+
/* Reopen the file and check it. */
if((status=nc_open(testfile, diskmode|NC_WRITE, &ncid))) ERRSTAT(status);
if((status=nc_inq_dimlen(ncid, 0, &len_in))) ERRSTAT(status);
@@ -92,7 +93,7 @@ test_two_growing_with_att(const char *testfile)
if((status=nc_get_var1_text(ncid, varid[v], index, &data_in))) ERRSTAT(status);
if (data_in != data[r]) ERR;
}
- if((status=nc_close(ncid))) ERRSTAT(status);
+ if((status=nc_close(ncid))) ERRSTAT(status);
} /* Next record. */
return 0;
}
@@ -121,7 +122,7 @@ test_one_with_att(const char *testfile)
/* We're done! */
if((status=nc_close(ncid))) ERRSTAT(status);
-
+
/* Reopen the file and check it. */
if((status=nc_open(testfile, diskmode|NC_WRITE, &ncid))) ERRSTAT(status);
if((status=nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid))) ERRSTAT(status);
@@ -130,7 +131,7 @@ test_one_with_att(const char *testfile)
if (data_in != data) ERRSTAT(status);
if((status=nc_get_att_text(ncid, NC_GLOBAL, ATT_NAME, &data_in))) ERRSTAT(status);
if (data_in != data) ERRSTAT(status);
- if((status=nc_close(ncid))) ERRSTAT(status);
+ if((status=nc_close(ncid))) ERRSTAT(status);
return 0;
}
#endif
@@ -174,4 +175,3 @@ main(int argc, char **argv)
FINAL_RESULTS;
}
-
diff --git a/nc_test/tst_diskless4.c b/nc_test/tst_diskless4.c
index 117dbdd..5dc0d6c 100644
--- a/nc_test/tst_diskless4.c
+++ b/nc_test/tst_diskless4.c
@@ -9,6 +9,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
@@ -44,7 +45,7 @@ main(int argc, char **argv)
unsigned int data[DATASIZE];
size_t start[1];
size_t count[1];
- Tag tag = Create;
+ Tag tag = Create;
int cmode = 0;
int ncid;
int dimids[1];
@@ -88,7 +89,7 @@ main(int argc, char **argv)
}
} else
tag = Create; /* default */
-
+
switch (tag) {
case Create: printf("\n*** Create file\n"); break;
case CreateDiskless: printf("\n*** Create file diskless\n"); break;
diff --git a/nc_test/tst_formatx_pnetcdf.c b/nc_test/tst_formatx_pnetcdf.c
index fa1ee1e..b11699f 100644
--- a/nc_test/tst_formatx_pnetcdf.c
+++ b/nc_test/tst_formatx_pnetcdf.c
@@ -9,6 +9,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/nc_test/tst_inq_type.c b/nc_test/tst_inq_type.c
index 08542b1..c0f0ccc 100644
--- a/nc_test/tst_inq_type.c
+++ b/nc_test/tst_inq_type.c
@@ -13,6 +13,7 @@
#include "config.h"
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#ifdef USE_PNETCDF
diff --git a/nc_test/tst_large.c b/nc_test/tst_large.c
index 8e0ce59..92d12ac 100644
--- a/nc_test/tst_large.c
+++ b/nc_test/tst_large.c
@@ -12,6 +12,7 @@
#include <string.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
/* Test with both classic and 64-bit offset files. If netcdf-4 is
@@ -28,10 +29,10 @@
#define DIM3 1024
#define DIM4 2097153 /* DIM3*DIM4*sizeof(short) > 2**32 */
-/*
+/*
* In netCDF-3.6.2, a divide by zero occurs on 32-bit platforms when
* creating a variable for which the product of dimensions is exactly
- * 2**32. Check that this bug has been fixed.
+ * 2**32. Check that this bug has been fixed.
*/
static int
test_big_var(const char *testfile) {
@@ -89,7 +90,7 @@ test_large_byte_var(const char *testfile) {
count[0] = 1;
count[1] = DIM2;
for (start[0] = 0; start[0] < DIM1; start[0]++) {
- if (nc_put_vara_schar(ncid, varid, start, count, vals))
+ if (nc_put_vara_schar(ncid, varid, start, count, vals))
{
ERR;
break;
@@ -151,15 +152,15 @@ main(int argc, char **argv) {
testfile);
/* Go thru formats and run all tests for each of two (for netCDF-3
* only builds), or 4 (for netCDF-4 builds) different formats. */
- for (i = NC_FORMAT_CLASSIC; i <= NUM_FORMATS; i++)
+ for (i = NC_FORMAT_CLASSIC; i <= NUM_FORMATS; i++)
{
nc_set_default_format(i, NULL);
-
+
printf("*** testing format %d with a variable with 2**32 values...", i);
test_big_var(testfile);
(void) remove(testfile);
SUMMARIZE_ERR;
-
+
printf("*** testing format %d with a byte variable with > 2**32 values...", i);
test_large_byte_var(testfile);
(void) remove(testfile);
diff --git a/nc_test/tst_misc.c b/nc_test/tst_misc.c
index 4a999a9..dc9310f 100644
--- a/nc_test/tst_misc.c
+++ b/nc_test/tst_misc.c
@@ -3,7 +3,7 @@
See COPYRIGHT file for copying and redistribution conditions.
This is part of netCDF.
-
+
This program runs some extra tests.
$Id: tst_misc.c,v 1.6 2010/05/05 22:15:36 dmh Exp $
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include "netcdf.h"
#include "nc_tests.h"
+#include "err_macros.h"
#ifdef USE_PARALLEL
#include "netcdf_par.h"
#endif
@@ -21,7 +22,7 @@
#define FILE_NAME "tst_misc.nc"
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{
#ifdef TEST_PNETCDF
MPI_Init(&argc, &argv);
@@ -29,7 +30,7 @@ main(int argc, char **argv)
printf("\n*** Testing some extra stuff.\n");
printf("*** Trying to open non-netCDF files of tiny length...");
{
-#define DATA_LEN 32
+#define DATA_LEN 32
int ncid,openstat;
char dummy_data[DATA_LEN];
FILE *file;
@@ -45,7 +46,7 @@ main(int argc, char **argv)
if (!(file = fopen(FILE_NAME, "w+"))) ERR;
if (fwrite(dummy_data, 1, i, file) != i) ERR;
if (fclose(file)) ERR;
-
+
/* Make sure that netCDF rejects this file politely. */
#ifdef TEST_PNETCDF
openstat = nc_open_par(FILE_NAME, NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid);
@@ -55,7 +56,7 @@ main(int argc, char **argv)
/* Some platforms (OSX, buddy) return stat = 2 (file not found)
for index i == 2. Not sure why, but this is a work around. */
if(openstat != NC_ENOTNC && openstat != 2) ERR;
-
+
}
}
diff --git a/nc_test/tst_names.c b/nc_test/tst_names.c
index fe7bfe1..a6de352 100644
--- a/nc_test/tst_names.c
+++ b/nc_test/tst_names.c
@@ -3,7 +3,7 @@
See COPYRIGHT file for conditions of use.
This is a very simple example which tests rejection of bad names for
- netCDF data objects, including names with "/" character, trailing spaces,
+ netCDF data objects, including names with "/" character, trailing spaces,
leading special characters, and invalid UTF-8 strings.
$Id: tst_names.c 2792 2014-10-27 06:02:59Z wkliao $
@@ -17,6 +17,7 @@
#include <netcdf_par.h>
#endif
#include <nc_tests.h>
+#include "err_macros.h"
/* The data file we will create. */
#define FILE_NAME "tst_names.nc"
@@ -249,7 +250,7 @@ main(int argc, char **argv)
if((res = nc_create(testfile, NC_CLOBBER, &ncid)))
#endif
ERROR
-
+
/* Define dimensions, variables, and attributes with various
* acceptable names */
for (i = 0; i < NUM_GOOD; i++) {
@@ -258,34 +259,34 @@ main(int argc, char **argv)
dimids[i] = dimid;
/* Define variable with same name */
- if ((res = nc_def_var(ncid, valid[i], NC_FLOAT, NDIMS, &dimids[i],
+ if ((res = nc_def_var(ncid, valid[i], NC_FLOAT, NDIMS, &dimids[i],
&varid)))
ERRORI
varids[i] = varid;
/* Define variable and global attributes with same name and value */
- if ((res = nc_put_att_text(ncid, varid, valid[i],
+ if ((res = nc_put_att_text(ncid, varid, valid[i],
strlen(valid[i]), valid[i])))
ERRORI
- if ((res = nc_put_att_double(ncid, NC_GLOBAL, valid[i], NC_DOUBLE,
+ if ((res = nc_put_att_double(ncid, NC_GLOBAL, valid[i], NC_DOUBLE,
NATTVALS, attvals)))
ERRORI
#if 0
attnums[i] = i;
#endif
}
-
+
/* Try defining dimensions, variables, and attributes with various
* bad names and make sure these are rejected */
for (i = 0; i < NUM_BAD; i++) {
- if ((res = nc_def_dim(ncid, notvalid[i], DIMLEN, &dimid))
+ if ((res = nc_def_dim(ncid, notvalid[i], DIMLEN, &dimid))
!= NC_EBADNAME) ERRORI
- if ((res = nc_def_var(ncid, notvalid[i], NC_FLOAT, NDIMS, dimids,
+ if ((res = nc_def_var(ncid, notvalid[i], NC_FLOAT, NDIMS, dimids,
&varid))
!= NC_EBADNAME) ERRORI
- if ((res = nc_put_att_text(ncid, varid, notvalid[i],
+ if ((res = nc_put_att_text(ncid, varid, notvalid[i],
strlen(attstring), attstring))
!= NC_EBADNAME) ERRORI
- if ((res = nc_put_att_double(ncid, NC_GLOBAL, notvalid[i], NC_DOUBLE,
+ if ((res = nc_put_att_double(ncid, NC_GLOBAL, notvalid[i], NC_DOUBLE,
NATTVALS, attvals))
!= NC_EBADNAME) ERRORI
}
@@ -293,7 +294,7 @@ main(int argc, char **argv)
ERROR
if ((res = nc_close(ncid)))
ERROR
-
+
/* Check it out, make sure all objects with good names were defined OK */
#ifdef TEST_PNETCDF
if ((res = nc_open_par(testfile, NC_NOWRITE|NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid)))
@@ -303,21 +304,21 @@ main(int argc, char **argv)
ERROR
for (i = 0; i < NUM_GOOD; i++) {
size_t attlen;
- if ((res = nc_inq_dimid(ncid, valid[i], &dimid)) ||
+ if ((res = nc_inq_dimid(ncid, valid[i], &dimid)) ||
dimid != dimids[i])
ERRORI
- if ((res = nc_inq_varid(ncid, valid[i], &varid)) ||
+ if ((res = nc_inq_varid(ncid, valid[i], &varid)) ||
varid != varids[i])
ERRORI
res = nc_inq_attlen(ncid, varid, valid[i], &attlen);
- if ((res = nc_get_att_text(ncid, varid, valid[i], attstr_in)))
+ if ((res = nc_get_att_text(ncid, varid, valid[i], attstr_in)))
ERRORI
attstr_in[attlen] = '\0';
- if (strcmp(valid[i], attstr_in) != 0)
+ if (strcmp(valid[i], attstr_in) != 0)
ERRORI
- if ((res = nc_get_att_double(ncid, NC_GLOBAL, valid[i],
- attvals_in))
- || attvals[0] != attvals_in[0])
+ if ((res = nc_get_att_double(ncid, NC_GLOBAL, valid[i],
+ attvals_in))
+ || attvals[0] != attvals_in[0])
ERRORI
}
if ((res = nc_close(ncid)))
diff --git a/nc_test/tst_nofill.c b/nc_test/tst_nofill.c
index e763707..2fe651e 100644
--- a/nc_test/tst_nofill.c
+++ b/nc_test/tst_nofill.c
@@ -3,7 +3,7 @@
See COPYRIGHT file for copying and redistribution conditions.
This is part of netCDF.
-
+
This program tests for a bug discovered with nofill mode that failed
only on file systems with block size in a particular range. It fails
when invoked with the blksize argument between 2091953 and 2150032,
@@ -14,6 +14,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
@@ -38,7 +39,7 @@ check_err(const int stat, const int line, const char *file) {
#define TIME_LEN 1
int
-create_file(char *file_name, int fill_mode, size_t* sizehintp)
+create_file(char *file_name, int fill_mode, size_t* sizehintp)
{
int i;
int stat; /* return status */
@@ -177,7 +178,7 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
sfc_temp_dims[0] = time_dim;
sfc_temp_dims[1] = lat_dim;
sfc_temp_dims[2] = lon_dim;
- stat = nc_def_var(ncid, "sfc_temp", NC_FLOAT, RANK_sfc_temp, sfc_temp_dims, &sfc_temp_id);
+ stat = nc_def_var(ncid, "sfc_temp", NC_FLOAT, RANK_sfc_temp, sfc_temp_dims, &sfc_temp_id);
check_err(stat,__LINE__,__FILE__);
zonal_wnd_dims[0] = time_dim;
@@ -201,13 +202,13 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_vara_double(ncid, time_id, time_start, time_count, time);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store lat */
float lat[] = {90, 88.5, 87, 85.5, 84, 82.5, 81, 79.5, 78, 76.5, 75, 73.5, 72, 70.5, 69, 67.5, 66, 64.5, 63, 61.5, 60, 58.5, 57, 55.5, 54, 52.5, 51, 49.5, 48, 46.5, 45, 43.5, 42, 40.5, 39, 37.5, 36, 34.5, 33, 31.5, 30, 28.5, 27, 25.5, 24, 22.5, 21, 19.5, 18, 16.5, 15, 13.5, 12, 10.5, 9, 7.5, 6, 4.5, 3, 1.5, 0, -1.5, -3, -4.5, -6, -7.5, -9, -10.5, -12, -13.5, -15, -16.5, -18, -19.5, -21, -22.5, -24, -25.5, -27, -28.5, -30, -31.5, -33, -34.5, -36, -37.5, -39, -40.5, -42, -43.5, -45, [...]
stat = nc_put_var_float(ncid, lat_id, lat);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store lon */
float lon[] = {0, 1.5, 3, 4.5, 6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18, 19.5, 21, 22.5, 24, 25.5, 27, 28.5, 30, 31.5, 33, 34.5, 36, 37.5, 39, 40.5, 42, 43.5, 45, 46.5, 48, 49.5, 51, 52.5, 54, 55.5, 57, 58.5, 60, 61.5, 63, 64.5, 66, 67.5, 69, 70.5, 72, 73.5, 75, 76.5, 78, 79.5, 81, 82.5, 84, 85.5, 87, 88.5, 90, 91.5, 93, 94.5, 96, 97.5, 99, 100.5, 102, 103.5, 105, 106.5, 108, 109.5, 111, 112.5, 114, 115.5, 117, 118.5, 120, 121.5, 123, 124.5, 126, 127.5, 129, 130.5, 132, 133.5, 135, [...]
stat = nc_put_var_float(ncid, lon_id, lon);
@@ -219,12 +220,12 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_var_float(ncid, lvl_id, lvl);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store sfc_pres */
size_t sfc_pres_start[RANK_sfc_pres];
size_t sfc_pres_count[RANK_sfc_pres];
float sfc_pres[LON_LEN*LAT_LEN];
-
+
for(ii = 0; ii < LAT_LEN * LON_LEN; ii++) {
sfc_pres[ii] = 6;
}
@@ -242,7 +243,7 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
size_t temp_scrn_start[RANK_temp_scrn];
size_t temp_scrn_count[RANK_temp_scrn];
float temp_scrn[LON_LEN*LAT_LEN];
-
+
for(ii = 0; ii < LAT_LEN * LON_LEN; ii++) {
temp_scrn[ii] = 11;
}
@@ -255,12 +256,12 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_vara_float(ncid, temp_scrn_id, temp_scrn_start, temp_scrn_count, temp_scrn);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store qsair_scrn */
size_t qsair_scrn_start[RANK_qsair_scrn];
size_t qsair_scrn_count[RANK_qsair_scrn];
float qsair_scrn[LON_LEN*LAT_LEN];
-
+
for(ii = 0; ii < LAT_LEN * LON_LEN; ii++) {
qsair_scrn[ii] = 22;
}
@@ -273,12 +274,12 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_vara_float(ncid, qsair_scrn_id, qsair_scrn_start, qsair_scrn_count, qsair_scrn);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store topog */
size_t topog_start[RANK_topog];
size_t topog_count[RANK_topog];
float topog[LON_LEN*LAT_LEN];
-
+
for(ii = 0; ii < LAT_LEN * LON_LEN; ii++) {
topog[ii] = 33;
}
@@ -291,12 +292,12 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_vara_float(ncid, topog_id, topog_start, topog_count, topog);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store mslp */
size_t mslp_start[RANK_mslp];
size_t mslp_count[RANK_mslp];
float mslp[LON_LEN*LAT_LEN];
-
+
for(ii = 0; ii < LAT_LEN * LON_LEN; ii++) {
mslp[ii] = 44;
}
@@ -309,12 +310,12 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_vara_float(ncid, mslp_id, mslp_start, mslp_count, mslp);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store sfc_temp */
size_t sfc_temp_start[RANK_sfc_temp];
size_t sfc_temp_count[RANK_sfc_temp];
float sfc_temp[LON_LEN*LAT_LEN];
-
+
for(ii = 0; ii < LAT_LEN * LON_LEN; ii++) {
sfc_temp[ii] = 55;
}
@@ -327,7 +328,7 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
stat = nc_put_vara_float(ncid, sfc_temp_id, sfc_temp_start, sfc_temp_count, sfc_temp);
check_err(stat,__LINE__,__FILE__);
}
-
+
{ /* store zonal_wnd */
/* Bug exposed when written in reverse order. */
for(i = LVL_LEN - 1; i>=0; i--)
@@ -416,7 +417,7 @@ main(int argc, char **argv)
size_t nvals, nn;
int ndims, *dimids, dim;
nc_type vtype;
- char varname1[NC_MAX_NAME];
+ char varname1[NC_MAX_NAME];
char varname2[NC_MAX_NAME];
/* How many values in this variable to compare? */
if (nc_inq_varndims(ncid1, varid, &ndims)) ERR;
@@ -432,7 +433,7 @@ main(int argc, char **argv)
if (nc_inq_vartype(ncid1, varid, &vtype)) ERR;
if (nc_inq_varname(ncid1, varid, varname1)) ERR;
if (nc_inq_varname(ncid1, varid, varname2)) ERR;
-
+
if (vtype != NC_CHAR) { /* numeric data, just read in as doubles */
double *data1, *data2;
/* Allocate space to hold values in both files */
@@ -447,8 +448,8 @@ main(int argc, char **argv)
for(nn = 0; nn < nvals; nn++) {
if (data1[nn] != data2[nn]) {
badvars++;
- fprintf(stderr,
- "\tFrom nofill file, %s[%lu] = %.15g\tFrom fill file, %s[%lu] = %.15g\n",
+ fprintf(stderr,
+ "\tFrom nofill file, %s[%lu] = %.15g\tFrom fill file, %s[%lu] = %.15g\n",
varname1, (unsigned long)nn, data1[nn], varname2, (unsigned long)nn, data2[nn]);
break;
};
@@ -469,8 +470,8 @@ main(int argc, char **argv)
for(nn = 0; nn < nvals; nn++) {
if (data1[nn] != data2[nn]) {
badvars++;
- fprintf(stderr,
- "\tFrom nofill file, %s[%lu] = %d\tFrom fill file, %s[%lu] = %d\n",
+ fprintf(stderr,
+ "\tFrom nofill file, %s[%lu] = %d\tFrom fill file, %s[%lu] = %d\n",
varname1, (unsigned long)nn, data1[nn], varname2, (unsigned long)nn, data2[nn]);
break;
};
diff --git a/nc_test/tst_nofill2.c b/nc_test/tst_nofill2.c
index 4e91d9f..e8187f2 100644
--- a/nc_test/tst_nofill2.c
+++ b/nc_test/tst_nofill2.c
@@ -3,7 +3,7 @@
See COPYRIGHT file for copying and redistribution conditions.
This is part of netCDF.
-
+
This program tests for a bug discovered with nofill mode that failed
only on file systems with block size in a particular range. It fails
when invoked with the blksize argument between 2091953 and 2150032,
@@ -12,6 +12,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
@@ -27,7 +28,7 @@
#define NDIMS4 4
int
-create_file(char *file_name, int fill_mode, size_t* sizehintp)
+create_file(char *file_name, int fill_mode, size_t* sizehintp)
{
int ncid, time_id, zonal_wnd_id;
int dimids[NDIMS4];
@@ -39,7 +40,7 @@ create_file(char *file_name, int fill_mode, size_t* sizehintp)
int i;
/* Init data. */
- for(i = 0; i < TIME_LEN * LAT_LEN * LON_LEN; i++)
+ for(i = 0; i < TIME_LEN * LAT_LEN * LON_LEN; i++)
zonal_wnd[i] = 100 + i;
/* To test bug on filesystem without large block size, we can get
diff --git a/nc_test/tst_nofill3.c b/nc_test/tst_nofill3.c
index 6bfb9ee..d9dbbcf 100644
--- a/nc_test/tst_nofill3.c
+++ b/nc_test/tst_nofill3.c
@@ -3,7 +3,7 @@
See COPYRIGHT file for copying and redistribution conditions.
This is part of netCDF.
-
+
This program tests for a bug discovered with nofill mode that failed
only on file systems with block size in a particular range. This version
of the test showed failure using a normal nc_create() call rather tha
@@ -12,6 +12,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
@@ -31,7 +32,7 @@
#define LVL_LEN 34
int
-create_file(char *file_name, int fill_mode)
+create_file(char *file_name, int fill_mode)
{
int ncid;
int lon_dim, lat_dim, lvl_dim, time_dim;
diff --git a/nc_test/tst_norm.c b/nc_test/tst_norm.c
index b861e0f..e7d9737 100644
--- a/nc_test/tst_norm.c
+++ b/nc_test/tst_norm.c
@@ -16,6 +16,7 @@
#include <netcdf_par.h>
#endif
#include <nc_tests.h>
+#include "err_macros.h"
/* The data file we will create. */
#define FILE7_NAME "tst_norm.nc"
diff --git a/nc_test/tst_parallel2.c b/nc_test/tst_parallel2.c
index c2c5b6c..99d4be3 100644
--- a/nc_test/tst_parallel2.c
+++ b/nc_test/tst_parallel2.c
@@ -7,6 +7,7 @@
/*#define USE_MPE 1*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <mpi.h>
#include <pnetcdf.h>
diff --git a/nc_test/tst_pnetcdf.c b/nc_test/tst_pnetcdf.c
index 66d1db2..812ab5d 100644
--- a/nc_test/tst_pnetcdf.c
+++ b/nc_test/tst_pnetcdf.c
@@ -9,6 +9,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/nc_test/tst_small.c b/nc_test/tst_small.c
index c28b00e..9d4791e 100644
--- a/nc_test/tst_small.c
+++ b/nc_test/tst_small.c
@@ -9,6 +9,7 @@
#include "config.h"
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#ifdef USE_PNETCDF
#include <netcdf_par.h>
@@ -19,7 +20,7 @@
#define NUM_FORMATS (5)
#define ATT_NAME "Atom"
-#define MAX_LEN 7
+#define MAX_LEN 7
#define ERR2 { \
err++; \
@@ -37,27 +38,27 @@
}\
}
#else
-#define FMTCHECK
+#define FMTCHECK
#endif
static int file_create(const char *filename, int cmode, int *ncid)
-{
+{
int err;
-
+
/* get the default file format */
int default_format;
nc_set_default_format(NC_FORMAT_CLASSIC, &default_format);
/* set it back to the default */
nc_set_default_format(default_format, NULL);
-
+
#ifdef USE_PNETCDF
if (default_format == NC_FORMAT_CLASSIC ||
default_format == NC_FORMAT_64BIT_OFFSET ||
default_format == NC_FORMAT_64BIT_DATA)
err = nc_create_par(filename, cmode|NC_PNETCDF, MPI_COMM_WORLD, MPI_INFO_NULL, ncid);
else
-#endif
+#endif
err = nc_create(filename, cmode, ncid);
return err;
@@ -93,7 +94,7 @@ test_small_atts(const char *testfile)
int ndims, nvars, natts, unlimdimid;
size_t len_in;
int t, f;
-
+
/* Run this with and without fill mode. */
for (f = 0; f < 2; f++)
{
@@ -103,13 +104,13 @@ test_small_atts(const char *testfile)
{
/* Create null-terminated text string of correct length. */
strncpy(att, source, t);
-
+
/* Create a file with one attribute. */
if (file_create(testfile, NC_CLOBBER, &ncid)) ERR;
if (nc_put_att_text(ncid, NC_GLOBAL, ATT_NAME, t + 1, att)) ERR;
if (f && nc_set_fill(ncid, NC_NOFILL, NULL)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -118,7 +119,7 @@ test_small_atts(const char *testfile)
if (len_in != t + 1) ERR;
if (nc_get_att_text(ncid, NC_GLOBAL, ATT_NAME, att_in)) ERR;
if (strncmp(att_in, att, t)) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
}
}
return 0;
@@ -150,7 +151,7 @@ test_small_unlim(const char *testfile)
strcpy(data[i], source);*/
strcpy(data[0], "2005-04-11_12:00:00");
strcpy(data[1], "2005-04-11_13:00:00");
-
+
/* Create a file with two dimensions, one unlimited, and one
* var, and a global att. */
if (file_create(testfile, NC_CLOBBER, &ncid)) ERR;
@@ -172,7 +173,7 @@ test_small_unlim(const char *testfile)
/* We're done! */
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -180,7 +181,7 @@ test_small_unlim(const char *testfile)
if (nc_get_var_text(ncid, varid, (char *)data_in)) ERR;
for (i = 0; i < NUM_VALS; i++)
if (strncmp(data[i], data_in[i], STR_LEN)) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
return 0;
}
@@ -198,7 +199,7 @@ test_small_fixed(const char *testfile)
strcpy(data[i], source);*/
strcpy(data[0], "2005-04-11_12:00:00");
strcpy(data[1], "2005-04-11_13:00:00");
-
+
/* Create a file with two dimensions, one unlimited, and one
* var, and a global att. */
if (file_create(testfile, NC_CLOBBER, &ncid)) ERR;
@@ -217,7 +218,7 @@ test_small_fixed(const char *testfile)
/* We're done! */
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -225,7 +226,7 @@ test_small_fixed(const char *testfile)
if (nc_get_var_text(ncid, varid, (char *)data_in)) ERR;
for (i = 0; i < NUM_VALS; i++)
if (strncmp(data[i], data_in[i], STR_LEN)) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
return 0;
}
@@ -254,14 +255,14 @@ test_small_one(const char *testfile)
/* We're done! */
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != 1 && nvars != 1 && natts != 0 && unlimdimid != 0) ERR;
if (nc_get_var_text(ncid, varid, &data_in)) ERR;
if (data_in != data) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
return 0;
}
@@ -314,7 +315,7 @@ test_one_growing(const char *testfile)
FMTCHECK;
if (nc_put_vara_text(ncid, varid, start, count, &data[r])) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
@@ -322,7 +323,7 @@ test_one_growing(const char *testfile)
index[0] = r;
if (nc_get_var1_text(ncid, 0, index, &data_in)) ERR;
if (data_in != data[r]) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
} /* Next record. */
}
return 0;
@@ -369,7 +370,7 @@ test_one_growing_with_att(const char *testfile)
if (nc_redef(ncid)) ERR;
if (nc_put_att_text(ncid, varid, att_name, 1, &data[r])) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
@@ -379,7 +380,7 @@ test_one_growing_with_att(const char *testfile)
if (data_in != data[r]) ERR;
if (nc_get_att_text(ncid, varid, att_name, &data_in)) ERR;
if (data_in != data[r]) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
} /* Next record. */
return 0;
}
@@ -436,7 +437,7 @@ test_two_growing_with_att(const char *testfile)
if (nc_enddef(ncid)) ERR;
}
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
@@ -447,7 +448,7 @@ test_two_growing_with_att(const char *testfile)
if (nc_get_var1_text(ncid, varid[v], index, &data_in)) ERR;
if (data_in != data[r]) ERR;
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
} /* Next record. */
return 0;
}
@@ -478,7 +479,7 @@ test_one_with_att(const char *testfile)
/* We're done! */
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check it. */
if (file_open(testfile, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -487,7 +488,7 @@ test_one_with_att(const char *testfile)
if (data_in != data) ERR;
if (nc_get_att_text(ncid, NC_GLOBAL, ATT_NAME, &data_in)) ERR;
if (data_in != data) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
return 0;
}
@@ -508,7 +509,7 @@ main(int argc, char **argv)
* only builds), or 4 (for netCDF-4 builds) different formats. */
for (i = NUM_FORMATS; i >= 1; i--)
{
- switch (i)
+ switch (i)
{
case NC_FORMAT_CLASSIC:
nc_set_default_format(NC_FORMAT_CLASSIC, NULL);
@@ -549,7 +550,7 @@ main(int argc, char **argv)
printf("*** testing simple small file with a global attribute...");
test_small_atts(testfile);
SUMMARIZE_ERR;
-
+
printf("*** testing simple small file with fixed dimensions...");
test_small_fixed(testfile);
SUMMARIZE_ERR;
@@ -557,15 +558,15 @@ main(int argc, char **argv)
printf("*** testing simple small file with an unlimited dimension...");
test_small_unlim(testfile);
SUMMARIZE_ERR;
-
+
printf("*** testing small file with one variable...");
test_small_one(testfile);
SUMMARIZE_ERR;
-
+
printf("*** testing small file with one variable and one att...");
test_one_with_att(testfile);
SUMMARIZE_ERR;
-
+
printf("*** testing small file with one record variable, which grows...");
test_one_growing(testfile);
SUMMARIZE_ERR;
@@ -586,4 +587,3 @@ main(int argc, char **argv)
#endif
FINAL_RESULTS;
}
-
diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt
index 0c6979e..12199ca 100644
--- a/nc_test4/CMakeLists.txt
+++ b/nc_test4/CMakeLists.txt
@@ -5,15 +5,21 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars
tst_strings2 tst_interops tst_interops4 tst_interops6
tst_enums tst_coords tst_coords2 tst_coords3 tst_vars3 tst_vars4
tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 tst_fillbug
- tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts
+ tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts
t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
- tst_put_vars_two_unlim_dim tst_hdf5_file_compat tst_fill_attr_vanish)
+ tst_put_vars_two_unlim_dim tst_hdf5_file_compat tst_fill_attr_vanish
+ tst_rehash)
# Note, renamegroup needs to be compiled before run_grp_rename
-build_bin_test(renamegroup)
-add_sh_test(nc_test4 run_grp_rename)
+
+IF(BUILD_UTILITIES)
+ SET(NC4_TESTS ${NC4_TESTS} tst_xplatform)
+ build_bin_test(renamegroup)
+ add_sh_test(nc_test4 run_grp_rename)
+ ADD_SH_TEST(nc_test4 tst_misc)
+ENDIF(BUILD_UTILITIES)
##
# The shell script, run_empty_vlen_test.sh,
@@ -22,7 +28,7 @@ add_sh_test(nc_test4 run_grp_rename)
BUILD_BIN_TEST(tst_empty_vlen_unlim)
ADD_SH_TEST(nc_test4 run_empty_vlen_test)
-ADD_SH_TEST(nc_test4 tst_misc)
+
IF(NOT MSVC)
SET(NC4_TESTS ${NC4_TESTS} tst_interops5 tst_camrun)
diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am
index 8bb674b..0a31560 100644
--- a/nc_test4/Makefile.am
+++ b/nc_test4/Makefile.am
@@ -22,7 +22,7 @@ tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts \
t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
-tst_hdf5_file_compat
+tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash
check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim
@@ -33,7 +33,11 @@ endif
TESTS = $(NC4_TESTS)
-TESTS += run_grp_rename.sh run_empty_vlen_test.sh tst_misc.sh
+if BUILD_UTILITIES
+ TESTS += run_grp_rename.sh tst_misc.sh
+endif
+
+TESTS += run_empty_vlen_test.sh
# If the v2 API was built, add its test program.
if BUILD_V2
@@ -67,7 +71,7 @@ tst_knmi_SOURCES = tst_knmi.c tst_utils.c
#WARNING: test_knmi depends on run_get_knmi_files.sh,
# so they must appear in the appropriate order.
TESTS += tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \
-run_bm_test2.sh run_tst_chunks.sh run_bm_ar4.sh tst_files2 tst_files3 \
+run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 \
tst_ar5 tst_h_files3 tst_mem \
run_get_knmi_files.sh tst_knmi
@@ -125,7 +129,8 @@ run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \
-ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_hdf4_read_var.sh
+ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh \
+tdset.h5 tst_hdf4_read_var.sh
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
@@ -138,7 +143,7 @@ usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc \
-tst_parallel4_simplerw_coll.nc
+tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc tst_rehash.nc
if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \
diff --git a/nc_test4/Makefile.in b/nc_test4/Makefile.in
index 3226b59..793b30b 100644
--- a/nc_test4/Makefile.in
+++ b/nc_test4/Makefile.in
@@ -114,10 +114,10 @@ check_PROGRAMS = $(am__EXEEXT_1) renamegroup$(EXEEXT) \
# 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 run_empty_vlen_test.sh \
- tst_misc.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_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
@@ -135,7 +135,7 @@ TESTS = $(am__EXEEXT_1) run_grp_rename.sh run_empty_vlen_test.sh \
#WARNING: test_knmi depends on run_get_knmi_files.sh,
# so they must appear in the appropriate order.
@BUILD_BENCHMARKS_TRUE at am__append_9 = tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \
- at BUILD_BENCHMARKS_TRUE@run_bm_test2.sh run_tst_chunks.sh run_bm_ar4.sh tst_files2 tst_files3 \
+ at BUILD_BENCHMARKS_TRUE@run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 \
@BUILD_BENCHMARKS_TRUE at tst_ar5 tst_h_files3 tst_mem \
@BUILD_BENCHMARKS_TRUE at run_get_knmi_files.sh tst_knmi
@@ -198,7 +198,8 @@ am__EXEEXT_1 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(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_hdf5_file_compat$(EXEEXT)
+ tst_hdf5_file_compat$(EXEEXT) tst_fill_attr_vanish$(EXEEXT) \
+ tst_rehash$(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)
@@ -369,6 +370,9 @@ tst_files5_LDADD = $(LDADD)
tst_files6_SOURCES = tst_files6.c
tst_files6_OBJECTS = tst_files6.$(OBJEXT)
tst_files6_LDADD = $(LDADD)
+tst_fill_attr_vanish_SOURCES = tst_fill_attr_vanish.c
+tst_fill_attr_vanish_OBJECTS = tst_fill_attr_vanish.$(OBJEXT)
+tst_fill_attr_vanish_LDADD = $(LDADD)
tst_fillbug_SOURCES = tst_fillbug.c
tst_fillbug_OBJECTS = tst_fillbug.$(OBJEXT)
tst_fillbug_LDADD = $(LDADD)
@@ -467,6 +471,9 @@ tst_parallel3_LDADD = $(LDADD)
tst_parallel4_SOURCES = tst_parallel4.c
tst_parallel4_OBJECTS = tst_parallel4.$(OBJEXT)
tst_parallel4_LDADD = $(LDADD)
+tst_rehash_SOURCES = tst_rehash.c
+tst_rehash_OBJECTS = tst_rehash.$(OBJEXT)
+tst_rehash_LDADD = $(LDADD)
tst_rename_SOURCES = tst_rename.c
tst_rename_OBJECTS = tst_rename.$(OBJEXT)
tst_rename_LDADD = $(LDADD)
@@ -561,15 +568,16 @@ SOURCES = $(bm_file_SOURCES) $(bm_many_atts_SOURCES) \
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_files6.c tst_fill_attr_vanish.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_parallel3.c tst_parallel4.c tst_rehash.c tst_rename.c \
tst_simplerw_coll_r.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 \
@@ -588,8 +596,8 @@ DIST_SOURCES = $(am__bm_file_SOURCES_DIST) \
tst_create_files.c tst_dims.c tst_dims2.c tst_dims3.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_files4.c tst_files5.c tst_files6.c tst_fill_attr_vanish.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_hdf5_file_compat.c \
@@ -597,7 +605,7 @@ DIST_SOURCES = $(am__bm_file_SOURCES_DIST) \
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_parallel3.c tst_parallel4.c tst_rehash.c tst_rename.c \
tst_simplerw_coll_r.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 \
@@ -814,10 +822,10 @@ AM_RECURSIVE_TARGETS = check recheck
@BUILD_BENCHMARKS_TRUE@ tst_create_files$(EXEEXT) \
@BUILD_BENCHMARKS_TRUE@ run_bm_test1.sh run_bm_elena.sh \
@BUILD_BENCHMARKS_TRUE@ run_bm_test2.sh run_tst_chunks.sh \
- at BUILD_BENCHMARKS_TRUE@ run_bm_ar4.sh tst_files2$(EXEEXT) \
- at BUILD_BENCHMARKS_TRUE@ tst_files3$(EXEEXT) tst_ar5$(EXEEXT) \
- at BUILD_BENCHMARKS_TRUE@ tst_h_files3$(EXEEXT) tst_mem$(EXEEXT) \
- at BUILD_BENCHMARKS_TRUE@ run_get_knmi_files.sh tst_knmi$(EXEEXT)
+ at BUILD_BENCHMARKS_TRUE@ tst_files2$(EXEEXT) tst_files3$(EXEEXT) \
+ at BUILD_BENCHMARKS_TRUE@ tst_ar5$(EXEEXT) tst_h_files3$(EXEEXT) \
+ at BUILD_BENCHMARKS_TRUE@ tst_mem$(EXEEXT) run_get_knmi_files.sh \
+ at BUILD_BENCHMARKS_TRUE@ tst_knmi$(EXEEXT)
@USE_HDF4_TRUE at am__EXEEXT_10 = tst_interops2$(EXEEXT) \
@USE_HDF4_TRUE@ tst_formatx_hdf4.sh run_chunk_hdf4.sh \
@USE_HDF4_TRUE@ tst_h4_lendian$(EXEEXT)
@@ -1037,7 +1045,7 @@ tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts \
t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
-tst_hdf5_file_compat
+tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash
@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
@@ -1061,7 +1069,8 @@ run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \
-ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_hdf4_read_var.sh
+ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh \
+tdset.h5 tst_hdf4_read_var.sh
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
@@ -1073,7 +1082,7 @@ usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc \
-tst_parallel4_simplerw_coll.nc
+tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc tst_rehash.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 \
@@ -1289,6 +1298,10 @@ tst_files6$(EXEEXT): $(tst_files6_OBJECTS) $(tst_files6_DEPENDENCIES) $(EXTRA_ts
@rm -f tst_files6$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_files6_OBJECTS) $(tst_files6_LDADD) $(LIBS)
+tst_fill_attr_vanish$(EXEEXT): $(tst_fill_attr_vanish_OBJECTS) $(tst_fill_attr_vanish_DEPENDENCIES) $(EXTRA_tst_fill_attr_vanish_DEPENDENCIES)
+ @rm -f tst_fill_attr_vanish$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tst_fill_attr_vanish_OBJECTS) $(tst_fill_attr_vanish_LDADD) $(LIBS)
+
tst_fillbug$(EXEEXT): $(tst_fillbug_OBJECTS) $(tst_fillbug_DEPENDENCIES) $(EXTRA_tst_fillbug_DEPENDENCIES)
@rm -f tst_fillbug$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_fillbug_OBJECTS) $(tst_fillbug_LDADD) $(LIBS)
@@ -1413,6 +1426,10 @@ tst_parallel4$(EXEEXT): $(tst_parallel4_OBJECTS) $(tst_parallel4_DEPENDENCIES) $
@rm -f tst_parallel4$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_parallel4_OBJECTS) $(tst_parallel4_LDADD) $(LIBS)
+tst_rehash$(EXEEXT): $(tst_rehash_OBJECTS) $(tst_rehash_DEPENDENCIES) $(EXTRA_tst_rehash_DEPENDENCIES)
+ @rm -f tst_rehash$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tst_rehash_OBJECTS) $(tst_rehash_LDADD) $(LIBS)
+
tst_rename$(EXEEXT): $(tst_rename_OBJECTS) $(tst_rename_DEPENDENCIES) $(EXTRA_tst_rename_DEPENDENCIES)
@rm -f tst_rename$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tst_rename_OBJECTS) $(tst_rename_LDADD) $(LIBS)
@@ -1524,6 +1541,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files4.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files5.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files6.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fill_attr_vanish.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fillbug.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fills.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fills2.Po at am__quote@
@@ -1555,6 +1573,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel3.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel4.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rehash.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_simplerw_coll_r.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_strings.Po at am__quote@
@@ -2188,23 +2207,23 @@ tst_hdf5_file_compat.log: tst_hdf5_file_compat$(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)
-run_grp_rename.sh.log: run_grp_rename.sh
- @p='run_grp_rename.sh'; \
- b='run_grp_rename.sh'; \
+tst_fill_attr_vanish.log: tst_fill_attr_vanish$(EXEEXT)
+ @p='tst_fill_attr_vanish$(EXEEXT)'; \
+ b='tst_fill_attr_vanish'; \
$(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_empty_vlen_test.sh.log: run_empty_vlen_test.sh
- @p='run_empty_vlen_test.sh'; \
- b='run_empty_vlen_test.sh'; \
+tst_rehash.log: tst_rehash$(EXEEXT)
+ @p='tst_rehash$(EXEEXT)'; \
+ b='tst_rehash'; \
$(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_misc.sh.log: tst_misc.sh
- @p='tst_misc.sh'; \
- b='tst_misc.sh'; \
+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) \
@@ -2265,13 +2284,6 @@ run_tst_chunks.sh.log: run_tst_chunks.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_bm_ar4.sh.log: run_bm_ar4.sh
- @p='run_bm_ar4.sh'; \
- b='run_bm_ar4.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_files2.log: tst_files2$(EXEEXT)
@p='tst_files2$(EXEEXT)'; \
b='tst_files2'; \
@@ -2581,6 +2593,8 @@ uninstall-am:
.PRECIOUS: Makefile
+ at BUILD_UTILITIES_TRUE@ TESTS += run_grp_rename.sh tst_misc.sh
+
@BUILD_BENCHMARKS_TRUE at benchmarks: check
@BUILD_BENCHMARKS_TRUE@ ./run_bm_radar_2D.sh
@BUILD_BENCHMARKS_TRUE@ ./run_bm_radar_2D_compression1.sh
diff --git a/nc_test4/bm_file.c b/nc_test4/bm_file.c
index b12351e..f0bb590 100644
--- a/nc_test4/bm_file.c
+++ b/nc_test4/bm_file.c
@@ -16,7 +16,9 @@
$Id: bm_file.c,v 1.64 2010/01/11 19:27:11 ed Exp $
*/
-#include <config.h>
+#include <nc_tests.h> /* The ERR macro is here... */
+#include <err_macros.h>
+
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -28,8 +30,7 @@
#ifdef USE_PARALLEL
#include <mpi.h>
#endif
-#include <nc_tests.h> /* The ERR macro is here... */
-#include <netcdf.h>
+#include <netcdf.h>
#define MILLION 1000000
#define BAD -99
@@ -65,15 +66,15 @@ MPI_Error_string(e, err_buffer, &resultlen); \
printf("MPI error, line %d, file %s: %s\n", __LINE__, __FILE__, err_buffer); \
MPI_Finalize(); \
return 2; \
-} while (0)
+} while (0)
#endif
/* This function will fill the start and count arrays for the reads
* and writes. */
-static int
-get_starts_counts(int ndims, size_t *dimlen, int p, int my_rank,
- int slow_count, int use_scs, VAR_OPTS_T *vo,
- int *num_steps, int *start_inc, int *slice_len,
+static int
+get_starts_counts(int ndims, size_t *dimlen, int p, int my_rank,
+ int slow_count, int use_scs, VAR_OPTS_T *vo,
+ int *num_steps, int *start_inc, int *slice_len,
size_t *last_count, size_t *start, size_t *count)
{
int extra_step = 0;
@@ -140,7 +141,7 @@ get_starts_counts(int ndims, size_t *dimlen, int p, int my_rank,
if (start[0] > dimlen[0])
{
fprintf(stderr, "slow_count too large for this many processors, "
- "start_inc=%d, slow_count=%d, p=%d, my_rank=%d start[0]=%ld\n",
+ "start_inc=%d, slow_count=%d, p=%d, my_rank=%d start[0]=%ld\n",
*start_inc, slow_count, p, my_rank, start[0]);
return 2;
}
@@ -211,7 +212,7 @@ check_att(int ncid1, int ncid2, int varid, int a)
return ret;
if ((ret = nc_inq_att(ncid2, varid, name, &typeid2, &len2)))
return ret;
- if (len != len2 || typeid != typeid2)
+ if (len != len2 || typeid != typeid2)
return BAD;
if ((ret = nc_inq_type(ncid1, typeid, NULL, &typelen)))
return ret;
@@ -230,7 +231,7 @@ check_att(int ncid1, int ncid2, int varid, int a)
goto exit;
if ((ret = nc_get_att(ncid2, varid, name, d2)))
goto exit;
-
+
/* Are they the same? */
if (memcmp(d, d2, typelen * len))
ret = BAD;
@@ -247,9 +248,9 @@ check_att(int ncid1, int ncid2, int varid, int a)
}
/* Do two files contain the same data and metadata? */
-static int
+static int
cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
- int use_par, int par_access, int do_cmp, int p, int my_rank,
+ int use_par, int par_access, int do_cmp, int p, int my_rank,
int slow_count, int verbose, int num_vo, VAR_OPTS_T *vo, int use_scs)
{
int ncid1, ncid2;
@@ -317,11 +318,11 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
/* Check dims. */
for (d = 0; d < ndims; d++)
{
- if ((ret = nc_inq_dim(ncid1, d, name, &len)))
+ if ((ret = nc_inq_dim(ncid1, d, name, &len)))
ERR1(ret);
if ((ret = nc_inq_dim(ncid2, d, name2, &len2)))
ERR1(ret);
- if (len != len2 || strcmp(name, name2))
+ if (len != len2 || strcmp(name, name2))
ERR1(BAD);
}
@@ -378,12 +379,12 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
if (ndims == 0)
dimlen[0] = 1;
- if ((ret = get_starts_counts(ndims, dimlen, p, my_rank, slow_count, use_scs,
- &vo[v], &num_steps, &start_inc, &slice_len,
+ if ((ret = get_starts_counts(ndims, dimlen, p, my_rank, slow_count, use_scs,
+ &vo[v], &num_steps, &start_inc, &slice_len,
&last_count, start, count)))
return ret;
if (verbose)
- printf("%d: num_steps=%d, start_inc=%d, slice_len=%d, last_count=%ld\n",
+ printf("%d: num_steps=%d, start_inc=%d, slice_len=%d, last_count=%ld\n",
my_rank, num_steps, start_inc, slice_len, last_count);
/* If there are no records, we're done. */
@@ -400,7 +401,7 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
ERR1(NC_ENOMEM);
if (!(data2 = malloc(slice_len * type_size)))
ERR1(NC_ENOMEM);
-
+
/* Check the var data for each slice. */
/* for (step = 0; !ret && step < num_steps; step++)*/
for (step = 0; !ret && step < num_steps; step++)
@@ -413,7 +414,7 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
/* Read data from file2. */
#ifdef USE_PARALLEL
- ftime = MPI_Wtime();
+ ftime = MPI_Wtime();
#else
if (gettimeofday(&start_time, NULL)) ERR;
#endif
@@ -438,7 +439,7 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
* dimension. */
start[0] += start_inc;
}
-
+
exit:
if (data) free(data);
if (data2) free(data2);
@@ -459,9 +460,9 @@ cmp_file(char *file1, char *file2, int *meta_read_us, int *data_read_us,
* deflate, shuffle, and endianness parameters if desired. */
static
int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
- int num_vo, VAR_OPTS_T *vo, int *meta_read_us, int *meta_write_us,
- int *data_read_us, int *data_write_us, int *in_format, int use_par,
- int par_access, long long *num_bytes, int p, int my_rank,
+ int num_vo, VAR_OPTS_T *vo, int *meta_read_us, int *meta_write_us,
+ int *data_read_us, int *data_write_us, int *in_format, int use_par,
+ int par_access, long long *num_bytes, int p, int my_rank,
int slow_count, int verbose, int use_scs, int endianness,
int convert_unlim)
{
@@ -480,7 +481,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
if (use_par)
{
#ifdef USE_PARALLEL
- ftime = MPI_Wtime();
+ ftime = MPI_Wtime();
if ((ret = nc_open_par(file_name_in, 0, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid_in)))
ERR1(ret);
*meta_read_us += (MPI_Wtime() - ftime) * MILLION;
@@ -511,7 +512,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
if (use_par)
{
#ifdef USE_PARALLEL
- if ((ret = nc_create_par(file_name_out, cmode_out, MPI_COMM_WORLD,
+ if ((ret = nc_create_par(file_name_out, cmode_out, MPI_COMM_WORLD,
MPI_INFO_NULL, &ncid_out)))
ERR1(ret);
#else
@@ -529,7 +530,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
ERR1(ret);
}
}
-
+
if ((ret = nc_inq(ncid_in, &ndims, &nvars, &natts, &unlimdimid)))
ERR1(ret);
@@ -538,7 +539,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
/* Copy dims. */
for (d = 0; d < ndims; d++)
{
- if ((ret = nc_inq_dim(ncid_in, d, name, &len)))
+ if ((ret = nc_inq_dim(ncid_in, d, name, &len)))
ERR1(ret);
if (convert_unlim)
{
@@ -547,20 +548,20 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
}
else
{
- if ((ret = nc_def_dim(ncid_out, name,
- (d == unlimdimid) ? NC_UNLIMITED : len,
+ if ((ret = nc_def_dim(ncid_out, name,
+ (d == unlimdimid) ? NC_UNLIMITED : len,
NULL)))
ERR1(ret);
}
}
-
+
/* Copy global atts. */
for (a = 0; a < natts; a++)
{
if (nc_inq_attname(ncid_in, NC_GLOBAL, a, name)) ERR;
if (nc_copy_att(ncid_in, NC_GLOBAL, name, ncid_out, NC_GLOBAL)) ERR;
}
-
+
/* Copy the variable metadata. */
for (v = 0; v < nvars; v++)
{
@@ -571,21 +572,21 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
int varid_out;
int a, o1;
int ret = NC_NOERR;
-
+
/* Learn about this var. */
if ((ret = nc_inq_var(ncid_in, v, name, &xtype, &ndims, dimids, &natts)))
return ret;
-
+
/* Create the output var. */
if (nc_def_var(ncid_out, name, xtype, ndims, dimids, &varid_out)) ERR;
-
+
/* Set the output endianness. For simplicity in this program,
* all vars get the same endianness. But there's no reason why
* this couldn't be varied from var to var, though it is hard to
* see why one would do so. */
if (endianness)
if (nc_def_var_endian(ncid_out, varid_out, endianness)) ERR;
-
+
/* Sent chunking and compression if specified in the var options. */
for (o1 = 0; o1 < num_vo; o1++)
if (vo[o1].varid == v)
@@ -602,7 +603,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
if (nc_def_var_deflate(ncid_out, v, vo[o1].shuffle, 1, vo[o1].deflate_num)) ERR;
break;
}
-
+
/* Copy the attributes. */
for (a=0; a<natts; a++)
{
@@ -610,9 +611,9 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
if (nc_copy_att(ncid_in, v, att_name, ncid_out, varid_out)) ERR;
}
}
-
+
#ifdef USE_PARALLEL
- ftime = MPI_Wtime();
+ ftime = MPI_Wtime();
#else
if (gettimeofday(&start_time, NULL)) ERR;
#endif
@@ -625,7 +626,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
*meta_write_us += (int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec;
#endif
-
+
if (verbose)
printf("%d: copying %d vars, %d global atts, and %d dims took %d micro-seconds\n",
my_rank, nvars, natts, ndims, *meta_write_us);
@@ -687,12 +688,12 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
* varying (i.e. the zeroth) dimension to read at one time. For
* vars with an unlimited dimension, this is the number of
* records to read at once. */
- if ((ret = get_starts_counts(ndims, dimlen, p, my_rank, slow_count, use_scs,
+ if ((ret = get_starts_counts(ndims, dimlen, p, my_rank, slow_count, use_scs,
&vo[v], &num_steps, &start_inc, &slice_len,
&last_count, start, count)))
return ret;
if (verbose)
- printf("%d: num_steps=%d, start_inc=%d, slice_len=%d, last_count=%ld\n",
+ printf("%d: num_steps=%d, start_inc=%d, slice_len=%d, last_count=%ld\n",
my_rank, num_steps, start_inc, slice_len, last_count);
/* If there are no records, we're done. */
@@ -702,7 +703,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
/* Allocate memory for one slice. */
if (!(data = malloc(slice_len * type_size)))
return NC_ENOMEM;
-
+
/* Copy the var data one slice at a time. */
for (step = 0; !ret && step < num_steps; step++)
{
@@ -716,7 +717,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
/* Read input data. */
#ifdef USE_PARALLEL
- ftime = MPI_Wtime();
+ ftime = MPI_Wtime();
#else
if (gettimeofday(&start_time, NULL)) ERR;
#endif
@@ -755,16 +756,16 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
printf("%d: writing step %d, var %d took %d micro-seconds\n",
my_rank, step, v, *data_write_us);
}
-
+
/* Increment start index. */
start[0] += start_inc;
} /* next step */
-
+
/* Calculate the data read and write rates in MB/sec. */
for (d = 0, var_num_bytes = type_size; d < ndims; d++)
var_num_bytes *= dimlen[d];
(*num_bytes) += var_num_bytes;
-
+
exit:
if (data) free(data);
if (dimlen) free(dimlen);
@@ -780,7 +781,7 @@ int copy_file(char *file_name_in, char *file_name_out, int cmode_out,
}
#define NDIMS 3
-#define MAX_DEFLATE 9
+#define MAX_DEFLATE 9
#define INPUT_FILE "/upc/share/testdata/nssl/mosaic3d_nc/tile1/20070803-2300.netcdf"
#define COLON ":"
#define COMMA ","
@@ -854,7 +855,7 @@ main(int argc, char **argv)
vo[o1].chunksize[i] = 0;
while ((c = getopt(argc, argv, "vo:f:hc:dpms:it:u:r:e:l")) != EOF)
- switch(c)
+ switch(c)
{
case 'v':
verbose++;
@@ -889,14 +890,14 @@ main(int argc, char **argv)
header++;
break;
case 'c':
- for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
+ for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
{
int got_z = 0, got_s = 0;
if (num_vo > MAX_VO)
return 1;
if (!(token = strtok_r(str1, COMMA, &saveptr1)))
break;
- for (ndims = 0, str2 = token; ; str2 = NULL)
+ for (ndims = 0, str2 = token; ; str2 = NULL)
{
int tmp_int;
if (!(subtoken = strtok_r(str2, COLON, &saveptr2)))
@@ -917,13 +918,13 @@ main(int argc, char **argv)
}
break;
case 't':
- for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
+ for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
{
if (num_vo > MAX_VO)
return 1;
if (!(token = strtok_r(str1, COMMA, &saveptr1)))
break;
- for (ndims = 0, str2 = token; ; str2 = NULL)
+ for (ndims = 0, str2 = token; ; str2 = NULL)
{
if (!(subtoken = strtok_r(str2, COLON, &saveptr2)))
break;
@@ -937,13 +938,13 @@ main(int argc, char **argv)
use_scs++;
break;
case 'u':
- for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
+ for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
{
if (num_vo > MAX_VO)
return 1;
if (!(token = strtok_r(str1, COMMA, &saveptr1)))
break;
- for (ndims = 0, str2 = token; ; str2 = NULL)
+ for (ndims = 0, str2 = token; ; str2 = NULL)
{
if (!(subtoken = strtok_r(str2, COLON, &saveptr2)))
break;
@@ -956,13 +957,13 @@ main(int argc, char **argv)
}
break;
case 'r':
- for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
+ for (num_vo = 0, str1 = optarg; ; num_vo++, str1 = NULL)
{
if (num_vo > MAX_VO)
return 1;
if (!(token = strtok_r(str1, COMMA, &saveptr1)))
break;
- for (ndims = 0, str2 = token; ; str2 = NULL)
+ for (ndims = 0, str2 = token; ; str2 = NULL)
{
if (!(subtoken = strtok_r(str2, COLON, &saveptr2)))
break;
@@ -1041,10 +1042,10 @@ main(int argc, char **argv)
* anything else to figure out what the heck is going on. */
if (verbose && !my_rank)
{
- printf("copying %s to %s on %d processors with endianness %d and...\n",
+ printf("copying %s to %s on %d processors with endianness %d and...\n",
file_in, file_out, p, endianness);
if (use_scs)
- for (v = 0; v < num_vo; v++)
+ for (v = 0; v < num_vo; v++)
{
printf("options for var %d:\n", vo[v].varid);
for (d = 0; d < vo[v].ndims; d++)
@@ -1056,8 +1057,8 @@ main(int argc, char **argv)
}
/* Copy the file, keeping track of the read and write times for metadata and data. */
- if ((ret = copy_file(file_in, file_out, cmode, num_vo, vo, &meta_read_us, &meta_write_us,
- &data_read_us, &data_write_us, &in_format, use_par, par_access,
+ if ((ret = copy_file(file_in, file_out, cmode, num_vo, vo, &meta_read_us, &meta_write_us,
+ &data_read_us, &data_write_us, &in_format, use_par, par_access,
&num_bytes, p, my_rank, slow_count, verbose, use_scs, endianness,
convert_unlim)))
return ret;
@@ -1068,9 +1069,9 @@ main(int argc, char **argv)
{
#ifdef USE_PARALLEL
MPI_Barrier(MPI_COMM_WORLD);
-#endif
- if ((ret = cmp_file(file_in, file_out, &meta_read2_us, &data_read2_us,
- use_par, par_access, do_cmp, p, my_rank, slow_count,
+#endif
+ if ((ret = cmp_file(file_in, file_out, &meta_read2_us, &data_read2_us,
+ use_par, par_access, do_cmp, p, my_rank, slow_count,
verbose, num_vo, vo, use_scs)))
return ret;
}
@@ -1104,7 +1105,7 @@ main(int argc, char **argv)
write_rate = (float)num_bytes/((float)tdata_write_us/p);
reread_rate = (float)num_bytes/((float)tdata_read2_us/p);
if (verbose)
- printf("%d: read rate %g, write rate %g, reread_rate %g\n", my_rank, read_rate,
+ printf("%d: read rate %g, write rate %g, reread_rate %g\n", my_rank, read_rate,
write_rate, reread_rate);
/* Print some output. */
@@ -1126,11 +1127,11 @@ main(int argc, char **argv)
"chunksize[3]\n");
}
- printf("%d, %d, %ld, %ld, %d, %d, %d, %d, %d, ", in_format, out_format, file_size(file_in),
+ printf("%d, %d, %ld, %ld, %d, %d, %d, %d, %d, ", in_format, out_format, file_size(file_in),
file_size(file_out), tmeta_read_us, tmeta_write_us, tdata_read_us, tdata_write_us,
endianness);
if (doublecheck)
- printf("%d, %d, %g, %g, %g, ", tmeta_read2_us, tdata_read2_us, read_rate, write_rate,
+ printf("%d, %d, %g, %g, %g, ", tmeta_read2_us, tdata_read2_us, read_rate, write_rate,
reread_rate);
else
printf("%g, %g, ", read_rate, write_rate);
@@ -1138,7 +1139,7 @@ main(int argc, char **argv)
printf("%d, ", p);
for (o1 = 0; o1 < num_vo; o1++)
{
- printf("%d, %d, %d, %d, %d, %d ", vo[o1].deflate_num, vo[o1].shuffle,
+ printf("%d, %d, %d, %d, %d, %d ", vo[o1].deflate_num, vo[o1].shuffle,
(int)vo[o1].chunksize[0], (int)vo[o1].chunksize[1], (int)vo[o1].chunksize[2], (int)vo[o1].chunksize[3]);
if (o1 != num_vo - 1)
printf(", ");
@@ -1148,7 +1149,7 @@ main(int argc, char **argv)
#ifdef USE_PARALLEL
MPI_Finalize();
-#endif
+#endif
return 0;
}
diff --git a/nc_test4/bm_many_atts.c b/nc_test4/bm_many_atts.c
index 9e6936d..83109fe 100644
--- a/nc_test4/bm_many_atts.c
+++ b/nc_test4/bm_many_atts.c
@@ -9,6 +9,7 @@ $Id $
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <stdlib.h>
@@ -29,7 +30,7 @@ int main(int argc, char **argv)
int g, grp, numgrp;
char gname[16];
int a, numatt, an, aleft, natts;
-
+
if(argc > 2) { /* Usage */
printf("NetCDF performance test, writing many groups, variables, and attributes.\n");
printf("Usage:\t%s [N]\n", argv[0]);
@@ -39,7 +40,7 @@ int main(int argc, char **argv)
for(i = 1; i < argc; i++) {
nitem = atoi(argv[i]);
}
-
+
/* create new file */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* create N group/global attributes, printing time after every 100.
diff --git a/nc_test4/bm_many_objs.c b/nc_test4/bm_many_objs.c
index 56215ee..d78ae58 100644
--- a/nc_test4/bm_many_objs.c
+++ b/nc_test4/bm_many_objs.c
@@ -7,6 +7,7 @@ redistribution conditions.
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <stdlib.h>
@@ -27,7 +28,7 @@ int main(int argc, char **argv)
int g, grp, numgrp;
char gname[16];
int v, var, numvar, vn, vleft, nvars;
-
+
if(argc > 2) { /* Usage */
printf("NetCDF performance test, writing many groups and variables.\n");
printf("Usage:\t%s [N]\n", argv[0]);
@@ -58,11 +59,11 @@ int main(int argc, char **argv)
}
}
nc_close(ncid);
-
+
/* create new file */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
- /* create N variables, printing time after every 1000.
- * Put NC_MAX_VARS variables per group (even though netcdf4 non-classic
+ /* create N variables, printing time after every 1000.
+ * Put NC_MAX_VARS variables per group (even though netcdf4 non-classic
* format does not limit variable count), create the necessary number
* of groups to hold nitem variables. */
numvar = nitem;
@@ -71,7 +72,7 @@ int main(int argc, char **argv)
vleft = numvar - (NC_MAX_VARS * (numgrp - 1));
if (gettimeofday(&start_time, NULL))
ERR;
-
+
for(g = 1; g < numgrp + 1; g++) {
sprintf(gname, "group%d", g);
if (nc_def_grp(ncid, gname, &grp)) ERR;
diff --git a/nc_test4/bm_netcdf4_recs.c b/nc_test4/bm_netcdf4_recs.c
index b5a3cef..4419a48 100644
--- a/nc_test4/bm_netcdf4_recs.c
+++ b/nc_test4/bm_netcdf4_recs.c
@@ -1,4 +1,4 @@
-/** \file
+/** \file
This program benchmarks creating a netCDF file and reading records.
@@ -8,6 +8,7 @@ redistribution conditions.
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <stdlib.h>
@@ -28,7 +29,7 @@ int main(int argc, char **argv)
int g, grp, numgrp;
char gname[16];
int v, var, numvar, vn, vleft, nvars;
-
+
int stat; /* return status */
/* dimension ids */
@@ -73,7 +74,7 @@ int main(int argc, char **argv)
temperature_2m_dims[1] = forecast_dim;
temperature_2m_dims[2] = latitude_dim;
temperature_2m_dims[3] = longitude_dim;
- if (nc_def_var(ncid, "temperature_2m", NC_FLOAT, RANK_temperature_2m,
+ if (nc_def_var(ncid, "temperature_2m", NC_FLOAT, RANK_temperature_2m,
temperature_2m_dims, &temperature_2m_id)) ERR;
/* assign per-variable attributes */
@@ -89,6 +90,6 @@ int main(int argc, char **argv)
if (nc_close(ncid)) ERR;
if (gettimeofday(&start_time, NULL)) ERR;
-
+
return(0);
}
diff --git a/nc_test4/cdm_sea_soundings.c b/nc_test4/cdm_sea_soundings.c
index 3fe2511..5b4289d 100644
--- a/nc_test4/cdm_sea_soundings.c
+++ b/nc_test4/cdm_sea_soundings.c
@@ -8,6 +8,7 @@
$Id: cdm_sea_soundings.c,v 1.5 2010/05/25 13:53:04 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "cdm_sea_soundings.nc"
#define DIM_NAME "Sounding"
@@ -36,7 +37,7 @@ main(int argc, char **argv)
printf("\n*** Testing netcdf-4 CDM compliance: sea soundings.\n");
printf("*** creating simple sea sounding file...");
-
+
/* Create a netcdf-4 file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -68,7 +69,7 @@ main(int argc, char **argv)
/* Free the memory the phony data are using. */
for (i = 0; i < DIM_LEN; i++)
- free(data[i].temp_vl.p);
+ free(data[i].temp_vl.p);
/* Print out our number of errors, if any, and exit badly. */
if (total_err)
@@ -76,9 +77,7 @@ main(int argc, char **argv)
printf("%d errors detected! Sorry!\n", total_err);
return 2;
}
-
+
printf("*** Tests successful!\n");
return 0;
}
-
-
diff --git a/nc_test4/ref_chunks1.cdl b/nc_test4/ref_chunks1.cdl
index 4ed0415..7a8f99b 100644
--- a/nc_test4/ref_chunks1.cdl
+++ b/nc_test4/ref_chunks1.cdl
@@ -6,15 +6,21 @@ dimensions:
variables:
float var_contiguous(dim1, dim2, dim3) ;
var_contiguous:_Storage = "contiguous" ;
+ var_contiguous:_Endianness = "little" ;
float var_chunked(dim1, dim2, dim3) ;
var_chunked:_Storage = "chunked" ;
var_chunked:_ChunkSizes = 2, 3, 1 ;
+ var_chunked:_Endianness = "little" ;
float var_compressed(dim1, dim2, dim3) ;
var_compressed:_Storage = "chunked" ;
var_compressed:_ChunkSizes = 2, 3, 1 ;
var_compressed:_DeflateLevel = 1 ;
+ var_compressed:_Endianness = "little" ;
// global attributes:
+ :_NCProperties = "version=1|netcdflibversion=4.4.2-development|hdf5libversion=1.8.17" ;
+ :_SuperblockVersion = 0 ;
+ :_IsNetcdf4 = 1 ;
:_Format = "netCDF-4 classic model" ;
data:
diff --git a/nc_test4/ref_chunks2.cdl b/nc_test4/ref_chunks2.cdl
index 6522a2a..a00eaf5 100644
--- a/nc_test4/ref_chunks2.cdl
+++ b/nc_test4/ref_chunks2.cdl
@@ -6,14 +6,20 @@ dimensions:
variables:
float var_contiguous(dim1, dim2, dim3) ;
var_contiguous:_Storage = "contiguous" ;
+ var_contiguous:_Endianness = "little" ;
float var_chunked(dim1, dim2, dim3) ;
var_chunked:_Storage = "chunked" ;
var_chunked:_ChunkSizes = 8, 10, 13 ;
+ var_chunked:_Endianness = "little" ;
float var_compressed(dim1, dim2, dim3) ;
var_compressed:_Storage = "chunked" ;
var_compressed:_ChunkSizes = 8, 10, 13 ;
var_compressed:_DeflateLevel = 1 ;
+ var_compressed:_Endianness = "little" ;
// global attributes:
+ :_NCProperties = "version=1|netcdflibversion=4.4.2-development|hdf5libversion=1.8.17" ;
+ :_SuperblockVersion = 0 ;
+ :_IsNetcdf4 = 1 ;
:_Format = "netCDF-4 classic model" ;
}
diff --git a/nc_test4/run_tst_chunks.sh b/nc_test4/run_tst_chunks.sh
index 67c189c..ef1a436 100755
--- a/nc_test4/run_tst_chunks.sh
+++ b/nc_test4/run_tst_chunks.sh
@@ -39,4 +39,4 @@ cachepre=0.0
diff tst_chunks3.cdl ref_chunks2.cdl
echo '*** SUCCESS!!!'
-exit 0
\ No newline at end of file
+exit 0
diff --git a/nc_test4/t_type.c b/nc_test4/t_type.c
index 47aeb73..81c7520 100644
--- a/nc_test4/t_type.c
+++ b/nc_test4/t_type.c
@@ -4,11 +4,12 @@
This test program is only built if netCDF-4 is disabled. It tests
the netCDF-3 version of nc_inq_type().
- $Id: t_type.c,v 2.3 2010/05/26 21:43:33 dmh Exp $
+ $Id: t_type.c,v 2.3 2010/05/26 21:43:33 dmh Exp $
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
diff --git a/nc_test4/tst_ar4.c b/nc_test4/tst_ar4.c
index 1fcddc6..f4b5614 100644
--- a/nc_test4/tst_ar4.c
+++ b/nc_test4/tst_ar4.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 2009, UCAR/Unidata
See COPYRIGHT file for copying and redistribution conditions.
@@ -8,6 +8,7 @@ $Id: tst_ar4.c,v 1.4 2010/01/11 19:27:11 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
@@ -85,7 +86,7 @@ usage(void)
#define TIME_LEN 1560
#define NUM_TS 1
-int
+int
main(int argc, char **argv)
{
extern int optind;
@@ -106,7 +107,7 @@ main(int argc, char **argv)
struct timeval start_time, end_time, diff_time;
while ((c = getopt(argc, argv, "vhtc:")) != EOF)
- switch(c)
+ switch(c)
{
case 'v':
verbose++;
@@ -124,17 +125,17 @@ main(int argc, char **argv)
usage();
return 1;
}
-
+
argc -= optind;
argv += optind;
-
+
/* If no file arguments left, report and exit */
if (argc < 1)
{
printf("no file specified\n");
return 0;
}
-
+
/* Print the header if desired. */
if (header)
{
@@ -163,12 +164,12 @@ main(int argc, char **argv)
if (nc_inq_dim(ncid, TIME_DIMID, name_in, &len)) ERR;
if (strcmp(name_in, "time") || len != TIME_LEN) ERR;
if (nc_inq_var(ncid, varid, NULL, NULL, &ndims, dimid, NULL)) ERR;
- if (ndims != NDIMS3 || dimid[0] != TIME_DIMID ||
+ if (ndims != NDIMS3 || dimid[0] != TIME_DIMID ||
dimid[1] != LAT_DIMID || dimid[2] != LON_DIMID) ERR;
/* Get info about the main data var. */
if (nc_inq_var_chunking(ncid, varid, &storage, cs)) ERR;
- if (nc_inq_var_deflate(ncid, varid, &shuffle, &deflate,
+ if (nc_inq_var_deflate(ncid, varid, &shuffle, &deflate,
&deflate_level)) ERR;
if (timeseries)
@@ -180,7 +181,7 @@ main(int argc, char **argv)
count[0] = TIME_LEN;
count[1] = 1;
count[2] = 1;
-
+
/* Read the first timeseries. */
if (gettimeofday(&start_time, NULL)) ERR;
if (nc_get_vara_float(ncid, varid, start, count, ts_data)) ERR_RET;
@@ -195,7 +196,7 @@ main(int argc, char **argv)
if (nc_get_vara_float(ncid, varid, start, count, ts_data)) ERR_RET;
if (gettimeofday(&end_time, NULL)) ERR;
if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
(LAT_LEN * LON_LEN);
}
else
@@ -221,7 +222,7 @@ main(int argc, char **argv)
if (nc_get_vara_float(ncid, varid, start, count, hor_data)) ERR_RET;
if (gettimeofday(&end_time, NULL)) ERR;
if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec +
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec +
read_1_us) / TIME_LEN;
}
@@ -230,8 +231,8 @@ main(int argc, char **argv)
/* Print results. */
printf("%d\t%d\t%d\t%.1f\t\t%d\t%d\t\t",
- (int)cs[0], (int)cs[1], (int)cs[2],
- (storage == NC_CHUNKED) ? (cache/(float)MEGABYTE) : 0,
+ (int)cs[0], (int)cs[1], (int)cs[2],
+ (storage == NC_CHUNKED) ? (cache/(float)MEGABYTE) : 0,
deflate, shuffle);
if (timeseries)
printf("%d\t\t%d\n", (int)read_1_us, (int)avg_read_us);
@@ -240,4 +241,3 @@ main(int argc, char **argv)
return 0;
}
-
diff --git a/nc_test4/tst_ar4_3d.c b/nc_test4/tst_ar4_3d.c
index 0244ad5..728cb3e 100644
--- a/nc_test4/tst_ar4_3d.c
+++ b/nc_test4/tst_ar4_3d.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 2009, UCAR/Unidata
See COPYRIGHT file for copying and redistribution conditions.
@@ -8,6 +8,7 @@ $Id: tst_ar4_3d.c,v 1.1 2010/01/11 19:28:28 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
@@ -93,7 +94,7 @@ usage(char* msg)
#define TIME_LEN 1560
#define NUM_TS 1
-int
+int
main(int argc, char **argv)
{
extern int optind;
@@ -114,7 +115,7 @@ main(int argc, char **argv)
struct timeval start_time, end_time, diff_time;
while ((c = getopt(argc, argv, "vhtc:")) != EOF)
- switch(c)
+ switch(c)
{
case 'v':
verbose++;
@@ -132,17 +133,17 @@ main(int argc, char **argv)
usage("unknown option");
return 1;
}
-
+
argc -= optind;
argv += optind;
-
+
/* If no file arguments left, report and exit */
if (argc < 1)
{
printf("no file specified\n");
return 0;
}
-
+
/* Print the header if desired. */
if (header)
{
@@ -171,12 +172,12 @@ main(int argc, char **argv)
if (nc_inq_dim(ncid, TIME_DIMID, name_in, &len)) ERR;
if (strcmp(name_in, "time") || len != TIME_LEN) ERR;
if (nc_inq_var(ncid, varid, NULL, NULL, &ndims, dimid, NULL)) ERR;
- if (ndims != NDIMS3 || dimid[0] != TIME_DIMID ||
+ if (ndims != NDIMS3 || dimid[0] != TIME_DIMID ||
dimid[1] != LAT_DIMID || dimid[2] != LON_DIMID) ERR;
/* Get info about the main data var. */
if (nc_inq_var_chunking(ncid, varid, &storage, cs)) ERR;
- if (nc_inq_var_deflate(ncid, varid, &shuffle, &deflate,
+ if (nc_inq_var_deflate(ncid, varid, &shuffle, &deflate,
&deflate_level)) ERR;
if (timeseries)
@@ -188,7 +189,7 @@ main(int argc, char **argv)
count[0] = TIME_LEN;
count[1] = 1;
count[2] = 1;
-
+
/* Read the first timeseries. */
if (gettimeofday(&start_time, NULL)) ERR;
if (nc_get_vara_float(ncid, varid, start, count, ts_data)) ERR_RET;
@@ -203,7 +204,7 @@ main(int argc, char **argv)
if (nc_get_vara_float(ncid, varid, start, count, ts_data)) ERR_RET;
if (gettimeofday(&end_time, NULL)) ERR;
if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
(LAT_LEN * LON_LEN);
}
else
@@ -229,7 +230,7 @@ main(int argc, char **argv)
if (nc_get_vara_float(ncid, varid, start, count, hor_data)) ERR_RET;
if (gettimeofday(&end_time, NULL)) ERR;
if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec +
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec +
read_1_us) / TIME_LEN;
}
@@ -238,8 +239,8 @@ main(int argc, char **argv)
/* Print results. */
printf("%d\t%d\t%d\t%.1f\t\t%d\t%d\t\t",
- (int)cs[0], (int)cs[1], (int)cs[2],
- (storage == NC_CHUNKED) ? (cache/(float)MEGABYTE) : 0,
+ (int)cs[0], (int)cs[1], (int)cs[2],
+ (storage == NC_CHUNKED) ? (cache/(float)MEGABYTE) : 0,
deflate, shuffle);
if (timeseries)
printf("%d\t\t%d\n", (int)read_1_us, (int)avg_read_us);
@@ -248,4 +249,3 @@ main(int argc, char **argv)
return 0;
}
-
diff --git a/nc_test4/tst_ar4_4d.c b/nc_test4/tst_ar4_4d.c
index e4652e5..deb0868 100644
--- a/nc_test4/tst_ar4_4d.c
+++ b/nc_test4/tst_ar4_4d.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 2009, UCAR/Unidata
See COPYRIGHT file for copying and redistribution conditions.
@@ -8,6 +8,7 @@ $Id: tst_ar4_4d.c,v 1.2 2010/01/14 20:25:55 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
@@ -23,7 +24,7 @@ $Id: tst_ar4_4d.c,v 1.2 2010/01/14 20:25:55 ed Exp $
/* From the data file we are using:
-../ncdump/ncdump -h -s thetao_O1.SRESA1B_2.CCSM.ocnm.2000-01_cat_2099-12.nc
+../ncdump/ncdump -h -s thetao_O1.SRESA1B_2.CCSM.ocnm.2000-01_cat_2099-12.nc
netcdf thetao_O1.SRESA1B_2.CCSM.ocnm.2000-01_cat_2099-12 {
dimensions:
lon = 320 ;
@@ -199,7 +200,7 @@ usage(void)
#define NUM_TS 1
#define MAX_READ_COUNT 100
-int
+int
main(int argc, char **argv)
{
extern int optind;
@@ -222,7 +223,7 @@ main(int argc, char **argv)
int read_count = 0, num_reads;
while ((c = getopt(argc, argv, "vhtc:")) != EOF)
- switch(c)
+ switch(c)
{
case 'v':
vertical_profile++;
@@ -240,17 +241,17 @@ main(int argc, char **argv)
usage();
return 1;
}
-
+
argc -= optind;
argv += optind;
-
+
/* If no file arguments left, report and exit */
if (argc < 1)
{
printf("no file specified\n");
return 0;
}
-
+
/* Print the header if desired. */
if (header)
{
@@ -283,13 +284,13 @@ main(int argc, char **argv)
if (nc_inq_dim(ncid, TIME_DIMID, name_in, &len)) ERR;
if (strcmp(name_in, "time") || len != TIME_LEN) ERR;
if (nc_inq_var(ncid, varid, NULL, NULL, &ndims, dimid, NULL)) ERR;
- if (ndims != NDIMS4 || dimid[0] != TIME_DIMID ||
- dimid[1] != DEPTH_DIMID || dimid[2] != LAT_DIMID ||
+ if (ndims != NDIMS4 || dimid[0] != TIME_DIMID ||
+ dimid[1] != DEPTH_DIMID || dimid[2] != LAT_DIMID ||
dimid[3] != LON_DIMID) ERR;
/* Get info about the main data var. */
if (nc_inq_var_chunking(ncid, varid, &storage, cs)) ERR;
- if (nc_inq_var_deflate(ncid, varid, &shuffle, &deflate,
+ if (nc_inq_var_deflate(ncid, varid, &shuffle, &deflate,
&deflate_level)) ERR;
if (timeseries)
@@ -303,7 +304,7 @@ main(int argc, char **argv)
count[1] = 1;
count[2] = 1;
count[3] = 1;
-
+
/* Read the first timeseries. */
if (gettimeofday(&start_time, NULL)) ERR;
if (nc_get_vara_float(ncid, varid, start, count, ts_data)) ERR_RET;
@@ -323,7 +324,7 @@ main(int argc, char **argv)
if (gettimeofday(&end_time, NULL)) ERR;
if (timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
num_reads = (read_count == MAX_READ_COUNT) ? MAX_READ_COUNT : (LAT_LEN * LON_LEN * DEPTH_LEN);
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
num_reads;
}
else if (vertical_profile)
@@ -337,7 +338,7 @@ main(int argc, char **argv)
count[1] = DEPTH_LEN;
count[2] = 1;
count[3] = 1;
-
+
/* Read the first vertical profile. */
if (gettimeofday(&start_time, NULL)) ERR;
if (nc_get_vara_float(ncid, varid, start, count, vert_data)) ERR_RET;
@@ -358,7 +359,7 @@ main(int argc, char **argv)
if (gettimeofday(&end_time, NULL)) ERR;
if (timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
num_reads = (read_count == MAX_READ_COUNT) ? MAX_READ_COUNT : (LAT_LEN * LON_LEN * DEPTH_LEN);
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec + read_1_us) /
num_reads;
}
else
@@ -391,7 +392,7 @@ main(int argc, char **argv)
if (gettimeofday(&end_time, NULL)) ERR;
if (timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
num_reads = (read_count == MAX_READ_COUNT) ? MAX_READ_COUNT : TIME_LEN;
- avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec +
+ avg_read_us = ((int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec +
read_1_us) / num_reads;
}
@@ -400,8 +401,8 @@ main(int argc, char **argv)
/* Print results. */
printf("%d\t%d\t%d\t%.1f\t\t%d\t%d\t\t",
- (int)cs[0], (int)cs[1], (int)cs[2],
- (storage == NC_CHUNKED) ? (cache/(float)MEGABYTE) : 0,
+ (int)cs[0], (int)cs[1], (int)cs[2],
+ (storage == NC_CHUNKED) ? (cache/(float)MEGABYTE) : 0,
deflate, shuffle);
if (timeseries)
printf("%d\t\t%d\n", (int)read_1_us, (int)avg_read_us);
@@ -410,4 +411,3 @@ main(int argc, char **argv)
return 0;
}
-
diff --git a/nc_test4/tst_ar5.c b/nc_test4/tst_ar5.c
index 5d97c28..18a06f5 100644
--- a/nc_test4/tst_ar5.c
+++ b/nc_test4/tst_ar5.c
@@ -7,6 +7,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <unistd.h>
#include <time.h>
@@ -50,7 +51,7 @@ main(int argc, char **argv)
{
#define BUFSIZE 1000000 /* access data in megabyte sized pieces */
-#define THETAU_FILE "/machine/downloads/AR5_sample_data/thetao_O1.SRESA1B_2.CCSM.ocnm.2000-01_cat_2099-12.nc"
+#define THETAU_FILE "/machine/downloads/AR5_sample_data/thetao_O1.SRESA1B_2.CCSM.ocnm.2000-01_cat_2099-12.nc"
#define NDIMS_DATA 4
printf("\n*** Running some AR-5 benchmarks.\n");
printf("*** testing various chunksizes for thetau file...\n");
@@ -89,7 +90,7 @@ main(int argc, char **argv)
/* /\* if (nc_out_vara_double(ncid, varid, start, count, data)) ERR; *\/ */
/* /\* } *\/ */
/* /\* if (nvals < 0) ERR; *\/ */
-
+
/* if (nc_close(ncid)) ERR; */
/* if (nc_close(ncid_out)) ERR; */
}
diff --git a/nc_test4/tst_atts.c b/nc_test4/tst_atts.c
index d90db31..76ae57d 100644
--- a/nc_test4/tst_atts.c
+++ b/nc_test4/tst_atts.c
@@ -12,6 +12,7 @@
#include <config.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <string.h>
@@ -27,7 +28,7 @@ main(int argc, char **argv)
#define OLD_NAME "Constantinople"
#define NEW_NAME "Istanbul"
#define CONTENTS "Lots of people!"
-
+
int ncid, attid;
char *data_in;
@@ -35,19 +36,19 @@ main(int argc, char **argv)
/* Create a file with an att. */
if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
- CONTENTS)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+ CONTENTS)) ERR;
/* Rename the att. */
- if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, NEW_NAME)) ERR;
-
+ if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, NEW_NAME)) ERR;
+
/* Check the file. */
if (nc_inq_attid(ncid, NC_GLOBAL, NEW_NAME, &attid)) ERR;
if (attid != 0) ERR;
if (nc_get_att_text(ncid, NC_GLOBAL, NEW_NAME, data_in)) ERR;
if (strncmp(CONTENTS, data_in, strlen(CONTENTS))) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check again. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
@@ -75,19 +76,19 @@ main(int argc, char **argv)
/* Create a file with an att. */
if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, &varid)) ERR;
- if (nc_put_att_text(ncid, varid, OLD_NAME1, strlen(CONTENTS1),
- CONTENTS1)) ERR;
+ if (nc_put_att_text(ncid, varid, OLD_NAME1, strlen(CONTENTS1),
+ CONTENTS1)) ERR;
/* Rename the att. */
- if (nc_rename_att(ncid, varid, OLD_NAME1, NEW_NAME1)) ERR;
-
+ if (nc_rename_att(ncid, varid, OLD_NAME1, NEW_NAME1)) ERR;
+
/* Check the file. */
if (nc_inq_attid(ncid, varid, NEW_NAME1, &attid)) ERR;
if (attid != 0) ERR;
if (nc_get_att_text(ncid, varid, NEW_NAME1, data_in)) ERR;
if (strncmp(CONTENTS1, data_in, strlen(CONTENTS1))) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check again. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
diff --git a/nc_test4/tst_atts1.c b/nc_test4/tst_atts1.c
index 719bc2a..12a5cc8 100644
--- a/nc_test4/tst_atts1.c
+++ b/nc_test4/tst_atts1.c
@@ -2,12 +2,13 @@
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
- Test attributes.
+ Test attributes.
$Id$
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <signal.h>
@@ -80,7 +81,7 @@ int
tst_att_ordering(int cmode)
{
int ncid;
- char name[NUM_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
+ char name[NUM_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
"Gd", "Gatt-name-dashes", "Gatt.name.dots"};
int len[NUM_ATTS] = {0, 2, 3, 3, 3, 3, 1, 1};
signed char b[2] = {-128, 127};
@@ -94,16 +95,16 @@ tst_att_ordering(int cmode)
/* Create a file with some global atts. */
if (nc_create(FILE_NAME, cmode, &ncid)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, name[0], len[0], NULL)) ERR;
- if (nc_put_att_schar(ncid, NC_GLOBAL, name[1], NC_BYTE, len[1], b)) ERR;
- if (nc_put_att_short(ncid, NC_GLOBAL, name[2], NC_SHORT, len[2], s)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, name[3], NC_INT, len[3], i)) ERR;
- if (nc_put_att_float(ncid, NC_GLOBAL, name[4], NC_FLOAT, len[4], f)) ERR;
- if (nc_put_att_double(ncid, NC_GLOBAL, name[5], NC_DOUBLE, len[5], d)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, name[6], NC_INT, len[6], &att_name_dashes)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, name[7], NC_INT, len[7], &att_name_dots)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, name[0], len[0], NULL)) ERR;
+ if (nc_put_att_schar(ncid, NC_GLOBAL, name[1], NC_BYTE, len[1], b)) ERR;
+ if (nc_put_att_short(ncid, NC_GLOBAL, name[2], NC_SHORT, len[2], s)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[3], NC_INT, len[3], i)) ERR;
+ if (nc_put_att_float(ncid, NC_GLOBAL, name[4], NC_FLOAT, len[4], f)) ERR;
+ if (nc_put_att_double(ncid, NC_GLOBAL, name[5], NC_DOUBLE, len[5], d)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[6], NC_INT, len[6], &att_name_dashes)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[7], NC_INT, len[7], &att_name_dots)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check the order. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
for (j = 0; j < NUM_ATTS; j++)
@@ -132,14 +133,14 @@ main(int argc, char **argv)
double double_in[ATT_LEN], double_out[ATT_LEN] = {-0.25, .5, 0.125};
long long longlong_in[ATT_LEN], longlong_out[ATT_LEN] = {-3123456789LL, 128LL, 3123456789LL};
unsigned long long ulonglong_in[ATT_LEN], ulonglong_out[ATT_LEN] = {0LL, 128LL, 3123456789LL};
-
+
(void) signal(SIGFPE, SIG_IGN);
printf("\n*** Testing netcdf-4 attribute functions.\n");
printf("*** testing really simple global atts...");
#define NUM_SIMPLE_ATTS 9
{
int ncid;
- char name[NUM_SIMPLE_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
+ char name[NUM_SIMPLE_ATTS][ATT_MAX_NAME + 1] = {"Gc", "Gb", "Gs", "Gi", "Gf",
"Gd", "G7", "G8", "G9"};
char name_in[NC_MAX_NAME];
int j;
@@ -147,9 +148,9 @@ main(int argc, char **argv)
/* Create a file with some global atts. */
if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
for (j = 0; j < NUM_SIMPLE_ATTS; j++)
- if (nc_put_att_int(ncid, NC_GLOBAL, name[j], NC_INT, 0, NULL)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, name[j], NC_INT, 0, NULL)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check the order. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
for (j = 0; j < NUM_SIMPLE_ATTS; j++)
@@ -163,7 +164,7 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
printf("*** testing simple global atts...");
- {
+ {
int ncid;
nc_type att_type;
size_t att_len;
@@ -173,28 +174,28 @@ main(int argc, char **argv)
/* This won't work, because classic files can't create these types. */
if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
- if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN,
- ushort_out) != NC_ESTRICTNC3) ERR;
- if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN,
- uint_out) != NC_ESTRICTNC3) ERR;
- if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN,
- longlong_out) != NC_ESTRICTNC3) ERR;
- if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN,
- ulonglong_out) != NC_ESTRICTNC3) ERR;
+ if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN,
+ ushort_out) != NC_ESTRICTNC3) ERR;
+ if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN,
+ uint_out) != NC_ESTRICTNC3) ERR;
+ if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN,
+ longlong_out) != NC_ESTRICTNC3) ERR;
+ if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN,
+ ulonglong_out) != NC_ESTRICTNC3) ERR;
/* But it's OK to put classic types like NC_INT converted from
* supported C types, though there may be out-of-range errrors
* for some values */
- if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
+ if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
uint_out) != NC_ERANGE) ERR;
- if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
+ if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
longlong_out) != NC_ERANGE) ERR;
- if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
+ if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
ulonglong_out) != NC_ERANGE) ERR;
- if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
- ushort_out)) ERR;
+ if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
+ ushort_out)) ERR;
/* restore to intended values for subsequent tests */
- if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
- int_out)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
+ int_out)) ERR;
/* It should also be OK to read classic types converted into
* supported C types. though the conversion may encounter
* out-of-range values */
@@ -208,17 +209,17 @@ main(int argc, char **argv)
/* Create a file with a global attribute of each type. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
- if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
if (nc_put_att_uchar(ncid, NC_GLOBAL, ATT_UCHAR_NAME, NC_UBYTE, ATT_LEN, uchar_out)) ERR;
- if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
- if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
- if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
- if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN, ushort_out)) ERR;
- if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN, uint_out)) ERR;
- if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN, longlong_out)) ERR;
- if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN, ulonglong_out)) ERR;
+ if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
+ if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
+ if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
+ if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN, ushort_out)) ERR;
+ if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN, uint_out)) ERR;
+ if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN, longlong_out)) ERR;
+ if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN, ulonglong_out)) ERR;
if (nc_close(ncid)) ERR;
/* Open the file and check attributes. */
@@ -228,38 +229,38 @@ main(int argc, char **argv)
ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
/* Check numeric values. */
- if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
+ if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (schar_in[i] != schar_out[i]) ERR;
- if (nc_get_att_uchar(ncid, NC_GLOBAL, ATT_UCHAR_NAME, uchar_in)) ERR;
+ if (nc_get_att_uchar(ncid, NC_GLOBAL, ATT_UCHAR_NAME, uchar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (uchar_in[i] != uchar_out[i]) ERR;
- if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
+ if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (short_in[i] != short_out[i]) ERR;
- if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
+ if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (int_in[i] != int_out[i]) ERR;
- if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
+ if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (float_in[i] != float_out[i]) ERR;
- if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
+ if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (double_in[i] != double_out[i]) ERR;
- if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, ushort_in)) ERR;
+ if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, ushort_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (ushort_in[i] != ushort_out[i]) ERR;
- if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, uint_in)) ERR;
+ if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, uint_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (uint_in[i] != uint_out[i]) ERR;
- if (nc_get_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, longlong_in)) ERR;
+ if (nc_get_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, longlong_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (longlong_in[i] != longlong_out[i]) ERR;
- if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, ulonglong_in)) ERR;
+ if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, ulonglong_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (ulonglong_in[i] != ulonglong_out[i]) ERR;
if (nc_close(ncid)) ERR;
@@ -351,7 +352,7 @@ main(int argc, char **argv)
/* for (i = 0; i < ATT_LEN; i++) */
/* if (float_in[i] != (float) longlong_out[i]) ERR; */
if (nc_get_att_float(ncid, NC_GLOBAL, ATT_UINT64_NAME, float_in)) ERR;
-#if !defined(_WIN32) && !defined(_WIN64)
+#if !defined(_WIN32) && !defined(_WIN64)
for (i = 0; i < ATT_LEN; i++)
if (float_in[i] != (float) ulonglong_out[i]) ERR;
#endif
@@ -635,19 +636,19 @@ main(int argc, char **argv)
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
if (nc_def_dim(ncid, DIM2_NAME, DIM2_LEN, &dimids[1])) ERR;
if (nc_def_var(ncid, VAR1_NAME, NC_INT, 2, dimids, &varid)) ERR;
- if (nc_put_att_text(ncid, varid, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
- if (nc_put_att_schar(ncid, varid, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
- if (nc_put_att_short(ncid, varid, ATT_SHORT_NAME, NC_SHORT, 3, short_out)) ERR;
- if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
- if (nc_put_att_float(ncid, varid, ATT_FLOAT_NAME, NC_FLOAT, 3, float_out)) ERR;
- if (nc_put_att_double(ncid, varid, ATT_DOUBLE_NAME, NC_DOUBLE, 3, double_out)) ERR;
+ if (nc_put_att_text(ncid, varid, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_schar(ncid, varid, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
+ if (nc_put_att_short(ncid, varid, ATT_SHORT_NAME, NC_SHORT, 3, short_out)) ERR;
+ if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
+ if (nc_put_att_float(ncid, varid, ATT_FLOAT_NAME, NC_FLOAT, 3, float_out)) ERR;
+ if (nc_put_att_double(ncid, varid, ATT_DOUBLE_NAME, NC_DOUBLE, 3, double_out)) ERR;
if (nc_def_var(ncid, VAR2_NAME, NC_UINT, 2, dimids, &varid)) ERR;
- if (nc_put_att_text(ncid, varid, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
- if (nc_put_att_schar(ncid, varid, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
- if (nc_put_att_short(ncid, varid, ATT_SHORT_NAME, NC_SHORT, 3, short_out)) ERR;
- if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
- if (nc_put_att_float(ncid, varid, ATT_FLOAT_NAME, NC_FLOAT, 3, float_out)) ERR;
- if (nc_put_att_double(ncid, varid, ATT_DOUBLE_NAME, NC_DOUBLE, 3, double_out)) ERR;
+ if (nc_put_att_text(ncid, varid, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_schar(ncid, varid, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
+ if (nc_put_att_short(ncid, varid, ATT_SHORT_NAME, NC_SHORT, 3, short_out)) ERR;
+ if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
+ if (nc_put_att_float(ncid, varid, ATT_FLOAT_NAME, NC_FLOAT, 3, float_out)) ERR;
+ if (nc_put_att_double(ncid, varid, ATT_DOUBLE_NAME, NC_DOUBLE, 3, double_out)) ERR;
if (nc_close(ncid)) ERR;
/* Open the file and check attributes. */
@@ -657,22 +658,22 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, v, ATT_TEXT_NAME, &att_type, &att_len)) ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, v, ATT_TEXT_NAME, speech_in)) ERR;
+ if (nc_get_att_text(ncid, v, ATT_TEXT_NAME, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
- if (nc_get_att_schar(ncid, v, ATT_SCHAR_NAME, schar_in)) ERR;
+ if (nc_get_att_schar(ncid, v, ATT_SCHAR_NAME, schar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (schar_in[i] != schar_out[i]) ERR;
- if (nc_get_att_short(ncid, v, ATT_SHORT_NAME, short_in)) ERR;
+ if (nc_get_att_short(ncid, v, ATT_SHORT_NAME, short_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (short_in[i] != short_out[i]) ERR;
- if (nc_get_att_int(ncid, v, ATT_INT_NAME, int_in)) ERR;
+ if (nc_get_att_int(ncid, v, ATT_INT_NAME, int_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (int_in[i] != int_out[i]) ERR;
- if (nc_get_att_float(ncid, v, ATT_FLOAT_NAME, float_in)) ERR;
+ if (nc_get_att_float(ncid, v, ATT_FLOAT_NAME, float_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (float_in[i] != float_out[i]) ERR;
- if (nc_get_att_double(ncid, v, ATT_DOUBLE_NAME, double_in)) ERR;
+ if (nc_get_att_double(ncid, v, ATT_DOUBLE_NAME, double_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (double_in[i] != double_out[i]) ERR;
}
@@ -793,17 +794,17 @@ main(int argc, char **argv)
/* Create a file with a global attribute. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1,
- speech)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1,
+ speech)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Rename it. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq_attid(ncid, NC_GLOBAL, ATT_TEXT_NAME, &attid_in)) ERR;
if (attid_in != 0) ERR;
if (nc_inq_attname(ncid, NC_GLOBAL, attid_in, name_in)) ERR;
if (strcmp(name_in, ATT_TEXT_NAME)) ERR;
- if (nc_rename_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, ATT_TEXT_NAME2)) ERR;
+ if (nc_rename_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, ATT_TEXT_NAME2)) ERR;
if (nc_inq_attname(ncid, NC_GLOBAL, attid_in, name_in)) ERR;
if (strcmp(name_in, ATT_TEXT_NAME2)) ERR;
if (nc_close(ncid)) ERR;
@@ -812,10 +813,10 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME2, &att_type, &att_len)) ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME2, speech_in)) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME2, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in) != NC_ENOTATT) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in) != NC_ENOTATT) ERR;
if (nc_close(ncid)) ERR;
/* Now delete the att. */
@@ -825,13 +826,13 @@ main(int argc, char **argv)
/* Now create a file with a variable, which has an att. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
if (nc_def_dim(ncid, DIM2_NAME, DIM2_LEN, &dimids[1])) ERR;
if (nc_def_var(ncid, VAR1_NAME, NC_INT, 2, dimids, &varid)) ERR;
- if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
+ if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and delete it. Make sure it's gone. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_del_att(ncid, 0, ATT_INT_NAME)) ERR;
@@ -840,7 +841,7 @@ main(int argc, char **argv)
/* Reopen the file and readd the attribute. Enddef and redef,
* and delete it, then check to make sure it's gone. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
- if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
+ if (nc_put_att_int(ncid, varid, ATT_INT_NAME, NC_INT, 3, int_out)) ERR;
if (nc_enddef(ncid)) ERR;
if (nc_redef(ncid)) ERR;
if (nc_del_att(ncid, 0, ATT_INT_NAME)) ERR;
@@ -864,7 +865,7 @@ main(int argc, char **argv)
if (nc_put_att_int(ncid, NC_GLOBAL, ATT0, NC_INT, 1, &number)) ERR;
if (nc_put_att_int(ncid, NC_GLOBAL, ATT1, NC_INT, 1, &number)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Open it and check the order. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq_attid(ncid, NC_GLOBAL, ATT0, &attid_in)) ERR;
@@ -881,7 +882,7 @@ main(int argc, char **argv)
if (nc_put_att_int(ncid, varid, ATT0, NC_INT, 1, &number)) ERR;
if (nc_put_att_int(ncid, varid, ATT1, NC_INT, 1, &number)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check the order of the attributes on the var. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq_attid(ncid, 0, ATT0, &attid_in)) ERR;
@@ -895,9 +896,9 @@ main(int argc, char **argv)
printf("*** testing attribute ordering some more...");
#define VAR_NAME "i"
-#define A1_NAME "i"
-#define A2_NAME "f"
-#define A3_NAME "d"
+#define A1_NAME "i"
+#define A2_NAME "f"
+#define A3_NAME "d"
#define A1_LEN 3
#define A2_LEN 4
#define A3_LEN 5
@@ -911,11 +912,11 @@ main(int argc, char **argv)
/* Create a file with one var, and attach three atts to it. */
if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, &varid)) ERR;
- if (nc_put_att_double(ncid, varid, A1_NAME, NC_INT, A1_LEN, dvalue)) ERR;
- if (nc_put_att_double(ncid, varid, A2_NAME, NC_INT, A2_LEN, dvalue)) ERR;
- if (nc_put_att_double(ncid, varid, A3_NAME, NC_INT, A3_LEN, dvalue)) ERR;
+ if (nc_put_att_double(ncid, varid, A1_NAME, NC_INT, A1_LEN, dvalue)) ERR;
+ if (nc_put_att_double(ncid, varid, A2_NAME, NC_INT, A2_LEN, dvalue)) ERR;
+ if (nc_put_att_double(ncid, varid, A3_NAME, NC_INT, A3_LEN, dvalue)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
if (nc_inq_varids(ncid, &nvars, varids)) ERR;
@@ -966,7 +967,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("*** testing copy of simple global atts...");
- {
+ {
int ncid, ncid2;
nc_type att_type;
size_t att_len;
@@ -986,20 +987,20 @@ main(int argc, char **argv)
/* Create a file with a global attribute of each type. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
- if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
+ if (nc_put_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, strlen(speech)+1, speech)) ERR;
+ if (nc_put_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, NC_BYTE, ATT_LEN, schar_out)) ERR;
if (nc_put_att_uchar(ncid, NC_GLOBAL, ATT_UCHAR_NAME, NC_UBYTE, ATT_LEN, uchar_out)) ERR;
- if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
- if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
- if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
- if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
- if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN, ushort_out)) ERR;
- if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN, uint_out)) ERR;
- if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN, longlong_out)) ERR;
- if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN, ulonglong_out)) ERR;
+ if (nc_put_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, NC_SHORT, ATT_LEN, short_out)) ERR;
+ if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, int_out)) ERR;
+ if (nc_put_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, NC_FLOAT, ATT_LEN, float_out)) ERR;
+ if (nc_put_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, NC_DOUBLE, ATT_LEN, double_out)) ERR;
+ if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN, ushort_out)) ERR;
+ if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN, uint_out)) ERR;
+ if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN, longlong_out)) ERR;
+ if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN, ulonglong_out)) ERR;
/* Create another file and copy all the attributes. */
- if (nc_create(FILE_NAME2, NC_NETCDF4, &ncid2)) ERR;
+ if (nc_create(FILE_NAME2, NC_NETCDF4, &ncid2)) ERR;
if (nc_copy_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, ncid2, NC_GLOBAL)) ERR;
if (nc_copy_att(ncid, NC_GLOBAL, ATT_SCHAR_NAME, ncid2, NC_GLOBAL)) ERR;
if (nc_copy_att(ncid, NC_GLOBAL, ATT_UCHAR_NAME, ncid2, NC_GLOBAL)) ERR;
@@ -1022,26 +1023,26 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, &att_type, &att_len)) ERR;
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERR;
if (!(speech_in = malloc(att_len + 1))) ERR;
- if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
+ if (nc_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) ERR;
if (strcmp(speech, speech_in)) ERR;
free(speech_in);
/* Check numeric values. */
- if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
+ if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (schar_in[i] != schar_out[i]) ERR;
if (nc_get_att_uchar(ncid, NC_GLOBAL, ATT_UCHAR_NAME, uchar_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (uchar_in[i] != uchar_out[i]) ERR;
- if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
+ if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SHORT_NAME, short_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (short_in[i] != short_out[i]) ERR;
- if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
+ if (nc_get_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, int_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (int_in[i] != int_out[i]) ERR;
- if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
+ if (nc_get_att_float(ncid, NC_GLOBAL, ATT_FLOAT_NAME, float_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (float_in[i] != float_out[i]) ERR;
- if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
+ if (nc_get_att_double(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, double_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (double_in[i] != double_out[i]) ERR;
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, ushort_in)) ERR;
@@ -1061,5 +1062,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_atts2.c b/nc_test4/tst_atts2.c
index e2d2216..53de6d3 100644
--- a/nc_test4/tst_atts2.c
+++ b/nc_test4/tst_atts2.c
@@ -2,12 +2,13 @@
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
- Test copy of attributes.
+ Test copy of attributes.
$Id: tst_atts2.c,v 1.7 2010/05/05 22:15:32 dmh Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME1 "tst_atts2.nc"
@@ -29,7 +30,7 @@ main(int argc, char **argv)
int ncid[NUM_FILES], typeid;
char file_name[NUM_FILES][NC_MAX_NAME + 1] = {FILE_NAME1, FILE_NAME2};
int i;
- struct s1
+ struct s1
{
int i1;
int i2;
@@ -41,7 +42,7 @@ main(int argc, char **argv)
int i2;
};
- /* Create some phony data. */
+ /* Create some phony data. */
for (i = 0; i < DIM_LEN; i++)
{
data[i].i1 = 32768;
@@ -54,26 +55,26 @@ main(int argc, char **argv)
/* Define s1 in file 1. */
if (nc_def_compound(ncid[0], sizeof(struct s1), CMP_NAME1, &typeid)) ERR;
- if (nc_insert_compound(ncid[0], typeid, I1_NAME,
+ if (nc_insert_compound(ncid[0], typeid, I1_NAME,
NC_COMPOUND_OFFSET(struct s1, i1), NC_INT)) ERR;
- if (nc_insert_compound(ncid[0], typeid, I2_NAME,
+ if (nc_insert_compound(ncid[0], typeid, I2_NAME,
NC_COMPOUND_OFFSET(struct s1, i2), NC_INT)) ERR;
/* Define s2 in file 2, but named the same as s1. */
if (nc_def_compound(ncid[1], sizeof(struct s2), CMP_NAME1, &typeid)) ERR;
- if (nc_insert_compound(ncid[1], typeid, I1_NAME,
+ if (nc_insert_compound(ncid[1], typeid, I1_NAME,
NC_COMPOUND_OFFSET(struct s2, i1), NC_SHORT)) ERR;
- if (nc_insert_compound(ncid[1], typeid, I2_NAME,
+ if (nc_insert_compound(ncid[1], typeid, I2_NAME,
NC_COMPOUND_OFFSET(struct s2, i2), NC_INT)) ERR;
/* Write an att in one file. */
- if (nc_put_att(ncid[0], NC_GLOBAL, ATT_NAME3, typeid, DIM_LEN,
+ if (nc_put_att(ncid[0], NC_GLOBAL, ATT_NAME3, typeid, DIM_LEN,
data)) ERR;
/* Try to copy. It must fail, because the two types are not the
* same. */
- if (nc_copy_att(ncid[0], NC_GLOBAL, ATT_NAME3, ncid[1],
+ if (nc_copy_att(ncid[0], NC_GLOBAL, ATT_NAME3, ncid[1],
NC_GLOBAL) != NC_EBADTYPE) ERR;
/* Close the files. */
@@ -84,7 +85,7 @@ main(int argc, char **argv)
printf("*** testing string attribute copy...");
{
#define ATT_NAME "Irish_Leader"
-#define ATT_LEN 1
+#define ATT_LEN 1
int ncid1, ncid2;
const char *mc[ATT_LEN] = {"Michael Collins"};
char *mc_in;
@@ -92,12 +93,12 @@ main(int argc, char **argv)
/* Create a file with a string att. */
if (nc_create(FILE_NAME1, NC_NETCDF4, &ncid1)) ERR;
if (nc_put_att_string(ncid1, NC_GLOBAL, ATT_NAME, ATT_LEN, mc)) ERR;
-
+
/* Create another file, and copy the att. */
if (nc_create(FILE_NAME2, NC_NETCDF4, &ncid2)) ERR;
if (nc_copy_att(ncid1, NC_GLOBAL, ATT_NAME, ncid2, NC_GLOBAL)) ERR;
- /* Close up. */
+ /* Close up. */
if (nc_close(ncid1)) ERR;
if (nc_close(ncid2)) ERR;
@@ -112,7 +113,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("*** testing non-string atomic attribute copy...");
{
-#define ATT_LEN 1
+#define ATT_LEN 1
#define NUM_ATT 5
int ncid1, ncid2;
char name[NUM_ATT][NC_MAX_NAME + 1];
@@ -124,16 +125,16 @@ main(int argc, char **argv)
for (a = 0; a < NUM_ATT; a++)
{
sprintf(name[a], "atomic_att_type_%d", a + 1);
- nc_put_att(ncid1, NC_GLOBAL, name[a], a + 1, ATT_LEN,
+ nc_put_att(ncid1, NC_GLOBAL, name[a], a + 1, ATT_LEN,
(void *)&data);
}
-
+
/* Create another file, and copy the att. */
if (nc_create(FILE_NAME2, NC_NETCDF4, &ncid2)) ERR;
for (a = 0; a < NUM_ATT; a++)
if (nc_copy_att(ncid1, NC_GLOBAL, name[a], ncid2, NC_GLOBAL)) ERR;
- /* Close up. */
+ /* Close up. */
if (nc_close(ncid1)) ERR;
if (nc_close(ncid2)) ERR;
@@ -156,14 +157,14 @@ main(int argc, char **argv)
int ncid[NUM_FILES], typeid;
char file_name[NUM_FILES][NC_MAX_NAME + 1] = {FILE_NAME1, FILE_NAME2};
int i;
- struct s1
+ struct s1
{
int i1;
int i2;
};
struct s1 data[DIM_LEN], data_in[DIM_LEN];
- /* Create some phony data. */
+ /* Create some phony data. */
for (i = 0; i < DIM_LEN; i++)
{
data[i].i1 = 5;
@@ -175,17 +176,17 @@ main(int argc, char **argv)
{
if (nc_create(file_name[i], NC_NETCDF4, &ncid[i])) ERR;
if (nc_def_compound(ncid[i], sizeof(struct s1), CMP_NAME, &typeid)) ERR;
- if (nc_insert_compound(ncid[i], typeid, I1,
+ if (nc_insert_compound(ncid[i], typeid, I1,
NC_COMPOUND_OFFSET(struct s1, i1), NC_INT)) ERR;
- if (nc_insert_compound(ncid[i], typeid, I2,
+ if (nc_insert_compound(ncid[i], typeid, I2,
NC_COMPOUND_OFFSET(struct s1, i2), NC_INT)) ERR;
}
/* Write an att in one file and copy it. */
- if (nc_put_att(ncid[0], NC_GLOBAL, ATT_NAME2, typeid, DIM_LEN,
+ if (nc_put_att(ncid[0], NC_GLOBAL, ATT_NAME2, typeid, DIM_LEN,
data)) ERR;
- if (nc_copy_att(ncid[0], NC_GLOBAL, ATT_NAME2, ncid[1],
+ if (nc_copy_att(ncid[0], NC_GLOBAL, ATT_NAME2, ncid[1],
NC_GLOBAL)) ERR;
/* Close the files. */
@@ -211,7 +212,7 @@ main(int argc, char **argv)
int ncid[NUM_FILES], typeid;
char file_name[NUM_FILES][NC_MAX_NAME + 1] = {FILE_NAME1, FILE_NAME2};
- char member_name[NUM_MEMBERS][NC_MAX_NAME + 1] = {"Munster", "Connacht",
+ char member_name[NUM_MEMBERS][NC_MAX_NAME + 1] = {"Munster", "Connacht",
"Leinster", "Ulster"};
int member_value[NUM_MEMBERS] = {0, 1, 2, 3};
int data_in[DIM_LEN_10], data[DIM_LEN_10] = {0, 1, 2, 3, 0, 1, 2, 3, 0, 1};
@@ -223,15 +224,15 @@ main(int argc, char **argv)
if (nc_create(file_name[i], NC_NETCDF4, &ncid[i])) ERR;
if (nc_def_enum(ncid[i], NC_INT, TYPE_NAME, &typeid)) ERR;
for (j = 0; j < NUM_MEMBERS; j++)
- if (nc_insert_enum(ncid[i], typeid, member_name[j],
+ if (nc_insert_enum(ncid[i], typeid, member_name[j],
&member_value[j])) ERR;
}
/* Write an att in one file and copy it. */
- if (nc_put_att(ncid[0], NC_GLOBAL, ATT_NAME2, typeid, DIM_LEN_10,
+ if (nc_put_att(ncid[0], NC_GLOBAL, ATT_NAME2, typeid, DIM_LEN_10,
data)) ERR;
- if (nc_copy_att(ncid[0], NC_GLOBAL, ATT_NAME2, ncid[1],
+ if (nc_copy_att(ncid[0], NC_GLOBAL, ATT_NAME2, ncid[1],
NC_GLOBAL)) ERR;
/* Close the files. */
@@ -250,5 +251,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_atts_string_rewrite.c b/nc_test4/tst_atts_string_rewrite.c
index ebabf74..8a2de0f 100644
--- a/nc_test4/tst_atts_string_rewrite.c
+++ b/nc_test4/tst_atts_string_rewrite.c
@@ -14,6 +14,7 @@
#include <netcdf.h>
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <string.h>
#define FILE_NAME "tst_atts_string_rewrite.nc"
diff --git a/nc_test4/tst_camrun.c b/nc_test4/tst_camrun.c
index a76a59d..3038aa7 100644
--- a/nc_test4/tst_camrun.c
+++ b/nc_test4/tst_camrun.c
@@ -11,6 +11,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
@@ -678,11 +679,11 @@ get_mem_used2(int *mem_used)
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
assert(mem_used);
-
+
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
- if ((pf = fopen(buf, "r")))
+ if ((pf = fopen(buf, "r")))
{
- fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
+ fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = (data * page_size) / MEGABYTE;
}
@@ -690,10 +691,10 @@ get_mem_used2(int *mem_used)
*mem_used = -1;
fclose(pf);
}
-#endif
+#endif
int
-main()
+main()
{
int ncid; /* netCDF id */
@@ -7391,7 +7392,7 @@ main()
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("before enddef data memory %d MB\n", memused);
-#endif
+#endif
/* leave define mode */
if (nc_enddef (ncid)) ERR;
@@ -7399,7 +7400,7 @@ main()
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("before close data memory %d MB\n", memused);
-#endif
+#endif
/* assign variable data */
if (nc_close(ncid)) ERR;
@@ -7407,8 +7408,8 @@ main()
#ifdef EXTRA_TESTS
get_mem_used2(&memused);
printf("after close data memory %d MB\n", memused);
-#endif
-
+#endif
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
diff --git a/nc_test4/tst_chunk_hdf4.c b/nc_test4/tst_chunk_hdf4.c
index 8ccca07..137f0d8 100644
--- a/nc_test4/tst_chunk_hdf4.c
+++ b/nc_test4/tst_chunk_hdf4.c
@@ -6,6 +6,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
#include <mfhdf.h>
@@ -37,7 +38,7 @@ main(int argc, char **argv)
{
/* Open with netCDF */
- if (nc_open(CHUNKEDFILE, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(CHUNKEDFILE, NC_NOWRITE, &ncid)) ERR;
/* Get a variable id */
if(nc_inq_varid(ncid,CHUNKEDVAR,&varid)) ERR;
@@ -60,13 +61,13 @@ main(int argc, char **argv)
ERR;
}
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
}
-
+
printf("\n*** Testing HDF4/NetCDF-4 chunking API: contiguous...\n");
{
/* Open with netCDF */
- if (nc_open(CONTIGFILE, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(CONTIGFILE, NC_NOWRITE, &ncid)) ERR;
/* Get a variable id */
if(nc_inq_varid(ncid,CONTIGVAR,&varid)) ERR;
@@ -83,10 +84,9 @@ main(int argc, char **argv)
ERR;
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_chunks.c b/nc_test4/tst_chunks.c
index e228d5b..cc85ec0 100644
--- a/nc_test4/tst_chunks.c
+++ b/nc_test4/tst_chunks.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_chunks.c,v 1.3 2010/01/21 16:00:18 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_chunks.nc"
#define NDIMS1 1
@@ -60,7 +61,7 @@ main(int argc, char **argv)
if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, &dimids_in, &natts_in)) ERR;
if (strcmp(var_name_in, V_SMALL) || xtype_in != NC_INT64 || ndims_in != 1 ||
natts_in != 0) ERR;
-
+
/* Make sure chunking sizes are what we expect. */
if (nc_inq_var_chunking(ncid, small_varid, &contig, chunksize_in)) ERR;
if (contig || chunksize_in[0] != D_SMALL_LEN) ERR;
@@ -103,10 +104,10 @@ main(int argc, char **argv)
if (nc_def_var(ncid, var_name, type_id[t], NUM_DIM, dimid, &varid[t])) ERR;
if (nc_inq_var_chunking(ncid, varid[t], &contig, chunksize_in)) ERR;
#ifdef PRINT_DEFAULT_CHUNKSIZE_TABLE
- printf("chunksizes for %d x %d x %d x %d var: %d x %d x %d x %d (=%d)\n",
- dim_len[0], dim_len[1], dim_len[2], dim_len[3],
- (int)chunksize_in[0], (int)chunksize_in[1], (int)chunksize_in[2],
- (int)chunksize_in[3],
+ printf("chunksizes for %d x %d x %d x %d var: %d x %d x %d x %d (=%d)\n",
+ dim_len[0], dim_len[1], dim_len[2], dim_len[3],
+ (int)chunksize_in[0], (int)chunksize_in[1], (int)chunksize_in[2],
+ (int)chunksize_in[3],
(int)(chunksize_in[0] * chunksize_in[1] * chunksize_in[2] * chunksize_in[3]));
#endif
}
@@ -117,16 +118,16 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (nvars != NUM_TYPE || ndims != NUM_DIM || ngatts != 0 || unlimdimid != 0) ERR;
-
+
for (t = 0; t < NUM_TYPE; t++)
{
sprintf(var_name, "var_%d", type_id[t]);
if (nc_inq_var_chunking(ncid, varid[t], &contig, chunksize_in)) ERR;
if (contig) ERR;
#ifdef PRINT_DEFAULT_CHUNKSIZE_TABLE
- printf("chunksizes for %d x %d x %d x %d var: %d x %d x %d x %d (=%d)\n",
- dim_len[0], dim_len[1], dim_len[2], dim_len[3],
- (int)chunksize_in[0], (int)chunksize_in[1], (int)chunksize_in[2],
+ printf("chunksizes for %d x %d x %d x %d var: %d x %d x %d x %d (=%d)\n",
+ dim_len[0], dim_len[1], dim_len[2], dim_len[3],
+ (int)chunksize_in[0], (int)chunksize_in[1], (int)chunksize_in[2],
(int)chunksize_in[3],
(int)(chunksize_in[0] * chunksize_in[1] * chunksize_in[2] * chunksize_in[3]));
#endif
@@ -176,7 +177,7 @@ main(int argc, char **argv)
if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, &dimids_in, &natts_in)) ERR;
if (strcmp(var_name_in, V_SMALL) || xtype_in != NC_INT64 || ndims_in != 1 ||
natts_in != 0) ERR;
-
+
/* Make sure chunking settings are what we expect. */
if (nc_inq_var_chunking(ncid, small_varid, &contig, &chunksize_in)) ERR;
if (!contig) ERR;
@@ -200,7 +201,7 @@ main(int argc, char **argv)
#define D_EFFECTIVENESS_LEN 2
int ncid, dimids[NDIMS_3], varid[NUM_PLANS];
- size_t chunksize[NDIMS_3] = {D_SNEAKINESS_LEN, D_CLEVERNESS_LEN,
+ size_t chunksize[NDIMS_3] = {D_SNEAKINESS_LEN, D_CLEVERNESS_LEN,
D_EFFECTIVENESS_LEN};
char plan_name[NC_MAX_NAME + 1];
int contig;
@@ -217,11 +218,11 @@ main(int argc, char **argv)
for (i = 0; i < NUM_PLANS; i++)
{
sprintf(plan_name, "Richelieu_sneaky_plan_%d", i);
- if (nc_def_var(ncid, plan_name, i % (NC_STRING - 1) + 1, NDIMS_3,
+ if (nc_def_var(ncid, plan_name, i % (NC_STRING - 1) + 1, NDIMS_3,
dimids, &varid[i])) ERR;
if (i % 2 && nc_def_var_chunking(ncid, varid[i], 0, chunksize)) ERR;
}
-
+
/* Check the chunking. */
for (i = 0; i < NUM_PLANS; i++)
{
@@ -230,7 +231,7 @@ main(int argc, char **argv)
{
for (j = 0; j < NDIMS_3; j++)
if (chunksize_in[j] != chunksize[j]) ERR;
- }
+ }
else
if (!contig) ERR;
}
@@ -246,7 +247,7 @@ main(int argc, char **argv)
{
for (j = 0; j < NDIMS_3; j++)
if (chunksize_in[j] != chunksize[j]) ERR;
- }
+ }
else
if (!contig) ERR;
}
@@ -293,9 +294,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_chunks2.c b/nc_test4/tst_chunks2.c
index c1c115b..b6ac94a 100644
--- a/nc_test4/tst_chunks2.c
+++ b/nc_test4/tst_chunks2.c
@@ -2,10 +2,11 @@
Copyright 2011 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 chunking.
+ Test netcdf-4 chunking.
*/
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_chunks2.nc"
#define MAX_WASTE 25.0
@@ -32,19 +33,19 @@ calculate_waste(int ndims, size_t *dimlen, size_t *chunksize, float *waste)
for (d = 0; d < ndims; d++)
{
/* How many chunks along this dimension are required to hold all the data? */
- for (num_chunks[d] = 0; (num_chunks[d] * chunksize[d]) < (dimlen[d] ? dimlen[d] : 1);
+ for (num_chunks[d] = 0; (num_chunks[d] * chunksize[d]) < (dimlen[d] ? dimlen[d] : 1);
num_chunks[d]++)
;
chunked *= (num_chunks[d] * chunksize[d]);
}
-
+
/* Calculate the minimum space required for this data
* (i.e. unchunked) or one record of it. */
for (d = 0; d < ndims; d++)
unchunked *= (dimlen[d] ? dimlen[d] : 1);
#ifdef PRINT_CHUNK_WASTE_REPORT
- printf("size for unchunked %g elements; size for chunked %g elements\n",
+ printf("size for unchunked %g elements; size for chunked %g elements\n",
unchunked, chunked);
#endif
@@ -57,16 +58,16 @@ calculate_waste(int ndims, size_t *dimlen, size_t *chunksize, float *waste)
for (d = 0; d < ndims; d++)
{
#ifdef PRINT_CHUNK_WASTE_REPORT
- printf("%ld\t%ld\t\t%ld\n", (long int)dimlen[d], (long int)chunksize[d],
+ printf("%ld\t%ld\t\t%ld\n", (long int)dimlen[d], (long int)chunksize[d],
(long int)num_chunks[d]);
#endif
chunk_size *= chunksize[d];
}
#ifdef PRINT_CHUNK_WASTE_REPORT
- printf("size of chunk: %ld elements; wasted space: %2.2f percent\n",
+ printf("size of chunk: %ld elements; wasted space: %2.2f percent\n",
(long int)chunk_size, *waste);
#endif
-
+
free(num_chunks);
return 0;
}
@@ -148,7 +149,7 @@ main(int argc, char **argv)
int varid, ncid;
int dimids[NDIMS3];
size_t dim_len[NDIMS3] = {1, 11, 152750};
-
+
int storage = 0;
size_t chunksizes[NDIMS3];
int d;
@@ -163,7 +164,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -186,7 +187,7 @@ main(int argc, char **argv)
int varid, ncid;
int dimids[NDIMS3];
size_t dim_len[NDIMS3] = {1804289383, 846930886, 1681692777};
-
+
int storage = 0;
size_t chunksizes[NDIMS3];
int d;
@@ -201,7 +202,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -224,7 +225,7 @@ main(int argc, char **argv)
int varid, ncid;
int dimids[NDIMS3];
size_t dim_len[NDIMS3] = {1714636915, 1957747793, 424238335};
-
+
int storage = 0;
size_t chunksizes[NDIMS3];
int d;
@@ -239,7 +240,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -265,7 +266,7 @@ main(int argc, char **argv)
int varid, ncid;
int dimids[NDIMS3];
size_t dim_len[NDIMS3] = {1967513926, 1365180540, 426};
-
+
int storage = 0;
size_t chunksizes[NDIMS3];
int d;
@@ -280,7 +281,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -305,7 +306,7 @@ main(int argc, char **argv)
int varid, ncid;
int dimids[NDIMS3];
size_t dim_len[NDIMS3] = {1804289383, 846930886, 1681692777};
-
+
int storage = 0;
size_t chunksizes[NDIMS3];
int d;
@@ -320,7 +321,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -362,7 +363,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -401,7 +402,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
@@ -440,7 +441,7 @@ main(int argc, char **argv)
sprintf(dim_name, "dim_%d", d);
if (nc_def_dim(ncid, dim_name, dim_len[d], &dimids[d])) ERR;
}
-
+
/* Define a var with these dimensions, and turn on chunking. */
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, NDIMS3, dimids, &varid)) ERR;
if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
diff --git a/nc_test4/tst_compounds.c b/nc_test4/tst_compounds.c
index ec0291a..79ce911 100644
--- a/nc_test4/tst_compounds.c
+++ b/nc_test4/tst_compounds.c
@@ -10,6 +10,7 @@
#include <config.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_compounds.nc"
#define SVC_REC "Service_Record"
diff --git a/nc_test4/tst_compounds2.c b/nc_test4/tst_compounds2.c
index 8d55ed3..c6d8556 100644
--- a/nc_test4/tst_compounds2.c
+++ b/nc_test4/tst_compounds2.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_compounds2.c,v 1.15 2010/05/25 13:53:04 ed Exp $
*/
@@ -10,6 +10,7 @@
#include <config.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_compounds2.nc"
@@ -17,10 +18,10 @@ int
main(int argc, char **argv)
{
- printf("\n*** Testing netcdf-4 user defined type functions, even more.\n");
- printf("*** testing compound var containing byte arrays of various size...");
+ printf("\n*** Testing netcdf-4 user defined type functions, even more.\n");
+ printf("*** testing compound var containing byte arrays of various size...");
{
-#define DIM1_LEN 1
+#define DIM1_LEN 1
#define ARRAY_LEN (NC_MAX_NAME + 1)
int ncid;
size_t len;
@@ -40,12 +41,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), DIM1_LEN)))
- return NC_ENOMEM;
- memcpy((void *)data_out, (void *)dummy, sizeof(struct s1) * DIM1_LEN);
- free(dummy);
+ if (!(dummy = calloc(sizeof(struct s1), DIM1_LEN)))
+ return NC_ENOMEM;
+ memcpy((void *)data_out, (void *)dummy, sizeof(struct s1) * DIM1_LEN);
+ free(dummy);
- /* Create some phony data. */
+ /* Create some phony data. */
for (i = 0; i < DIM1_LEN; i++)
{
data_out[i].y = 99.99;
@@ -54,7 +55,7 @@ main(int argc, char **argv)
}
/* Create a file with a nested compound type attribute and variable. */
- if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* Now define the compound type. */
if (nc_def_compound(ncid, sizeof(struct s1), "c", &type_id)) ERR;
@@ -76,11 +77,11 @@ main(int argc, char **argv)
for (j = 0; j < ARRAY_LEN; j++)
if (data_in[i].x[j] != data_out[i].x[j]) ERR_RET;
}
-
+
/* Use the inq functions to learn about the compound type. */
if (nc_inq_att(ncid, NC_GLOBAL, "a1", &xtype, &len)) ERR;
if (len != DIM1_LEN) ERR;
-
+
/* Finish checking the containing compound type. */
if (nc_close(ncid)) ERR;
}
@@ -141,7 +142,7 @@ main(int argc, char **argv)
if (nc_get_att(ncid, NC_GLOBAL, "a1", data_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
if (data_in[i].x != data_out[i].x || data_in[i].y != data_out[i].y) ERR;
-
+
/* Use the inq functions to learn about the compound type. */
if (nc_inq_att(ncid, NC_GLOBAL, "a1", &xtype, &len)) ERR;
if (len != DIM1_LEN) ERR;
@@ -154,7 +155,7 @@ main(int argc, char **argv)
if (strcmp(field_name_in, NAME2) || field_typeid != NC_DOUBLE || field_ndims) ERR;
printf("offset y: %d NC_COMPOUND_OFFSET(struct s1, y): %d ", (int)offset_in,
(int)NC_COMPOUND_OFFSET(struct s1, y));
-
+
/* Finish checking the containing compound type. */
if (nc_close(ncid)) ERR;
}
@@ -234,7 +235,7 @@ main(int argc, char **argv)
if (nc_get_att(ncid, NC_GLOBAL, ATT_NAME, data_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
if (data_in[i].s1.x != data_out[i].s1.x || data_in[i].s1.y != data_out[i].s1.y) ERR;
-
+
/* Use the inq functions to learn about the compound type. */
if (nc_inq_typeids(ncid, &ntypes, typeids)) ERR;
if (ntypes != NUM_TYPES) ERR;
@@ -254,7 +255,7 @@ main(int argc, char **argv)
if (nc_inq_compound_field(ncid, field_typeid, 1, field_name_in,
&offset_in, &field_typeid, &field_ndims, NULL)) ERR;
if (strcmp(field_name_in, S1_NAME_Y) || field_typeid != NC_DOUBLE || field_ndims) ERR;
-
+
/* Finish checking the containing compound type. */
if (nc_close(ncid)) ERR;
}
@@ -262,5 +263,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 3d50b3d..adda5b5 100644
--- a/nc_test4/tst_compounds3.c
+++ b/nc_test4/tst_compounds3.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, even more.
+ Test netcdf-4 compound type feature, even more.
$Id: tst_compounds3.c,v 1.8 2010/05/25 13:53:04 ed Exp $
*/
@@ -10,6 +10,7 @@
#include <config.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_compounds3.nc"
#define S1_PACKED_NAME "s1_packed_compound_type_with_boring_name"
@@ -103,7 +104,7 @@ main(int argc, char **argv)
field_sizes)) ERR;
if (strcmp(name_in, J_NAME) || offset != NC_COMPOUND_OFFSET(struct s1, j) ||
field_xtype != NC_INT64) ERR;
-
+
/* Now check the data. */
if (nc_get_var(ncid, varid, data_in)) ERR;
for (i = 0; i < DIM_LEN; i++)
@@ -195,5 +196,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_converts.c b/nc_test4/tst_converts.c
index 474283d..e0e3deb 100644
--- a/nc_test4/tst_converts.c
+++ b/nc_test4/tst_converts.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_converts.nc"
@@ -21,7 +22,7 @@
#define VAR2_NAME "var2"
/* This is handy for print statements. */
-static char *format_name[] = {"", "classic", "64-bit offset", "netCDF-4",
+static char *format_name[] = {"", "classic", "64-bit offset", "netCDF-4",
"netCDF-4 classic model"};
int check_file(int format, unsigned char *uchar_out);
@@ -32,7 +33,7 @@ main(int argc, char **argv)
{
unsigned char uchar_out[DIM1_LEN] = {0, 128, 255};
int format;
-
+
printf("\n*** Testing netcdf data conversion.\n");
for (format = 1; format < 5; format++)
@@ -96,7 +97,7 @@ check_file(int format, unsigned char *uchar_out)
/* Read it back in, and check conversions. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_var(ncid, 0, var_name, &var_type, &ndims, dimids_var, &natts)) ERR;
- if (strcmp(var_name, VAR1_NAME) || natts !=0 || ndims != 1 ||
+ if (strcmp(var_name, VAR1_NAME) || natts !=0 || ndims != 1 ||
dimids_var[0] != 0 || var_type != NC_BYTE) ERR;
/* This is actually an NC_BYTE, with some negatives, so this should
@@ -109,7 +110,7 @@ check_file(int format, unsigned char *uchar_out)
if (res != NC_ERANGE) ERR;
}
else if (res) ERR;
-
+
for (i=0; i<DIM1_LEN; i++)
if (uchar_in[i] != uchar_out[i]) ERR;
@@ -149,7 +150,7 @@ check_file(int format, unsigned char *uchar_out)
if (int64_in[i] != (signed char)uchar_out[i]) ERR;
}
-
+
if (nc_close(ncid)) ERR;
return 0;
}
diff --git a/nc_test4/tst_converts2.c b/nc_test4/tst_converts2.c
index eb58941..c5a2566 100644
--- a/nc_test4/tst_converts2.c
+++ b/nc_test4/tst_converts2.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include "math.h"
@@ -25,7 +26,7 @@ main(int argc, char **argv)
int ndims, natts, int_in;
long long_in;
nc_type var_type;
-
+
printf("\n*** Testing more netcdf-4 data conversion.\n");
printf ("*** Testing NC_BYTE conversions...");
{
@@ -38,7 +39,7 @@ main(int argc, char **argv)
/* Now open the file and check it. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_var(ncid, 0, var_name, &var_type, &ndims, NULL, &natts)) ERR;
- if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 0 ||
+ if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 0 ||
var_type != NC_BYTE) ERR;
if (nc_get_var_schar(ncid, varid, &schar_in)) ERR;
if (schar_in != schar) ERR;
@@ -75,16 +76,16 @@ main(int argc, char **argv)
coord[0] = 2;
if (nc_put_var1_float(ncid, varid, coord, &fval)) ERR;
coord[0] = 3;
- if (nc_put_var1_double(ncid, varid, coord, &dval)) ERR;
+ if (nc_put_var1_double(ncid, varid, coord, &dval)) ERR;
coord[0] = 4;
- if (nc_put_var1_long(ncid, varid, coord, &lval)) ERR;
+ if (nc_put_var1_long(ncid, varid, coord, &lval)) ERR;
if (nc_close(ncid)) ERR;
/* Now open the file and check it. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_var(ncid, 0, var_name, &var_type, &ndims, NULL, &natts)) ERR;
- if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 1 ||
+ if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 1 ||
var_type != NC_USHORT) ERR;
coord[0] = 0;
if (nc_get_var1_ushort(ncid, varid, coord, &ushort_in)) ERR;
@@ -135,16 +136,16 @@ main(int argc, char **argv)
coord[0] = 2;
if (nc_put_var1_float(ncid, varid, coord, &fval)) ERR;
coord[0] = 3;
- if (nc_put_var1_double(ncid, varid, coord, &dval)) ERR;
+ if (nc_put_var1_double(ncid, varid, coord, &dval)) ERR;
coord[0] = 4;
- if (nc_put_var1_long(ncid, varid, coord, &lval)) ERR;
+ if (nc_put_var1_long(ncid, varid, coord, &lval)) ERR;
if (nc_close(ncid)) ERR;
/* Now open the file and check it. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_var(ncid, 0, var_name, &var_type, &ndims, NULL, &natts)) ERR;
- if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 1 ||
+ if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 1 ||
var_type != NC_USHORT) ERR;
coord[0] = 0;
if (nc_get_var1_ushort(ncid, varid, coord, &ushort_in)) ERR;
@@ -164,7 +165,7 @@ main(int argc, char **argv)
/* This should fail. */
coord[0] = 5;
- if (nc_get_var1_ushort(ncid, varid, coord,
+ if (nc_get_var1_ushort(ncid, varid, coord,
&ushort_in) != NC_EINVALCOORDS) ERR;
if (nc_close(ncid)) ERR;
@@ -182,7 +183,7 @@ main(int argc, char **argv)
unsigned long long uint64_in;
float float_in;
double double_in;
-
+
/* Write a scalar NC_INT with value X_MAX_INT. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, &varid)) ERR;
@@ -192,7 +193,7 @@ main(int argc, char **argv)
/* Now open the file and check it. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_var(ncid, 0, var_name, &var_type, &ndims, NULL, &natts)) ERR;
- if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 0 ||
+ if (strcmp(var_name, VAR_NAME) || natts !=0 || ndims != 0 ||
var_type != NC_INT) ERR;
if (nc_get_var_schar(ncid, varid, &schar_in) != NC_ERANGE) ERR;
if (schar_in != (signed char)ivalue) ERR;
@@ -213,9 +214,9 @@ main(int argc, char **argv)
if (nc_get_var_ulonglong(ncid, varid, &uint64_in)) ERR;
if (uint64_in != ivalue) ERR;
if (nc_get_var_float(ncid, varid, &float_in)) ERR;
-
+
if(fabs( (float_in-X_INT_MAX) - ((float)ivalue - X_INT_MAX)) > 1) ERR;
-
+
if (nc_get_var_double(ncid, varid, &double_in)) ERR;
if (double_in != (double)ivalue) ERR;
if (nc_close(ncid)) ERR;
@@ -223,4 +224,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_coords.c b/nc_test4/tst_coords.c
index 53a8c30..d5acaf2 100644
--- a/nc_test4/tst_coords.c
+++ b/nc_test4/tst_coords.c
@@ -2,12 +2,13 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use.
- Test netcdf-4 coordinate variables and dimensions.
+ Test netcdf-4 coordinate variables and dimensions.
$Id: tst_coords.c,v 1.20 2010/03/30 16:25:41 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_coords.nc"
@@ -33,7 +34,7 @@ main(int argc, char **argv)
{
#define NDIMS 2
#define NLAT 10
-#define NLON 20
+#define NLON 20
#define LAT_NAME "lat"
#define LON_NAME "lon"
#define NVARS 2
@@ -54,7 +55,7 @@ main(int argc, char **argv)
lats[lat] = START_LAT + 5. * lat;
for (lon = 0; lon < NLON; lon++)
lons[lon] = START_LON + 5. * lon;
-
+
/* Create file with two dimensions. */
if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR;
if (nc_def_dim(ncid, LAT_NAME, NLAT, &lat_dimid)) ERR;
@@ -74,7 +75,7 @@ main(int argc, char **argv)
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
if (nvars_in != 2 || varids_in[0] != 0 || varids_in[1] != 1) ERR;
if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
- if (strcmp(var_name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
+ if (strcmp(var_name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
dimids_in[0] != 1 || natts_in != 0) ERR;
/* Close the file. */
@@ -88,7 +89,7 @@ main(int argc, char **argv)
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
if (nvars_in != 2 || varids_in[0] != 0 || varids_in[1] != 1) ERR;
if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
- if (strcmp(var_name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
+ if (strcmp(var_name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
dimids_in[0] != 1 || natts_in != 0) ERR;
if (nc_close(ncid)) ERR;
@@ -129,7 +130,7 @@ main(int argc, char **argv)
int ncid_classic, ncid_nc4;
/*int attid;*/
char att_in_classic[NC_MAX_NAME + 1], att_in_nc4[NC_MAX_NAME + 1];
-
+
#define FILE_CLASSIC "tst_coords_classic_att.nc"
#define FILE_NC4 "tst_coords_nc4_att.nc"
/* Create a classic and a netcdf-4 file. */
@@ -154,7 +155,7 @@ main(int argc, char **argv)
if (strcmp(att_in_classic, INSTITUTION) || strcmp(att_in_nc4, INSTITUTION) ||
strcmp(att_in_classic, att_in_nc4)) ERR;
if (memcmp(att_in_classic, att_in_nc4, strlen(INSTITUTION) + 1)) ERR;
-
+
/* Close them. */
if (nc_close(ncid_classic)) ERR;
if (nc_close(ncid_nc4)) ERR;
@@ -504,7 +505,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
-
+
}
SUMMARIZE_ERR;
printf("**** testing dim order when coord vars are defined in the wrong order...");
@@ -799,9 +800,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_coords2.c b/nc_test4/tst_coords2.c
index de93cd4..952597b 100644
--- a/nc_test4/tst_coords2.c
+++ b/nc_test4/tst_coords2.c
@@ -2,12 +2,13 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use.
- Test netcdf-4 coordinate variables and dimensions.
+ Test netcdf-4 coordinate variables and dimensions.
$Id: tst_coords2.c,v 1.3 2010/06/01 15:34:51 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_coords2.nc"
@@ -83,7 +84,7 @@ main(int argc, char **argv)
if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (nvars != NVARS || ndims != NDIMS || ngatts != 0 || unlimdimid != -1) ERR;
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
- if (nvars_in != NVARS || varids_in[0] != 0 || varids_in[1] != 1 ||
+ if (nvars_in != NVARS || varids_in[0] != 0 || varids_in[1] != 1 ||
varids_in[2] != 2 || varids_in[3] != 3) ERR;
if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
if (strcmp(var_name_in, TIME_NAME) || xtype_in != NC_CHAR || ndims_in != TIME_NDIMS ||
@@ -111,7 +112,7 @@ main(int argc, char **argv)
if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (nvars != NVARS || ndims != NDIMS || ngatts != 0 || unlimdimid != -1) ERR;
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
- if (nvars_in != NVARS || varids_in[0] != 0 || varids_in[1] != 1 ||
+ if (nvars_in != NVARS || varids_in[0] != 0 || varids_in[1] != 1 ||
varids_in[2] != 2 || varids_in[3] != 3) ERR;
if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
if (strcmp(var_name_in, TIME_NAME) || xtype_in != NC_CHAR || ndims_in != TIME_NDIMS ||
@@ -155,7 +156,7 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_CLOBBER|NC_NETCDF4, &ncid)) ERR;
if (nc_def_grp(ncid, GRPNAME, &grpid)) ERR;
-
+
if (nc_def_dim(ncid, DIM0NAME, dim0_len, &dim0_dim)) ERR;
if (nc_def_dim(ncid, DIM1NAME, dim1_len, &dim1_dim)) ERR;
if (nc_def_dim(grpid, DIM2NAME, dim2_len, &dim2_dim)) ERR;
@@ -164,13 +165,13 @@ main(int argc, char **argv)
var_dims[0] = dim2_dim;
var_dims[1] = dim3_dim;
if (nc_def_var(grpid, VARNAME, NC_INT, VARRANK, var_dims, &varid)) ERR;
-
+
if (nc_close(ncid)) ERR;
-
+
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
-
+
if (nc_inq_grp_ncid(ncid, GRPNAME, &grpid)) ERR;
-
+
if (nc_inq_varid(grpid, VARNAME, &varid)) ERR;
if (nc_inq_vardimid(grpid, varid, var_dims_in)) ERR;
if (nc_inq_dimname(grpid, var_dims_in[0], name2)) ERR;
@@ -181,9 +182,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_coords3.c b/nc_test4/tst_coords3.c
index dbc3e27..f03cc7c 100644
--- a/nc_test4/tst_coords3.c
+++ b/nc_test4/tst_coords3.c
@@ -37,6 +37,7 @@ variables:
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_coords3.nc"
@@ -106,7 +107,7 @@ check_cf_data(int ncid)
int
check_cf_metadata(int ncid)
{
-
+
int nvars_in, varids_in[NVARS];
int nvars, ndims, ngatts, unlimdimid;
int ndims_in, natts_in, dimids_in[NDIMS];
@@ -207,7 +208,7 @@ main(int argc, char **argv)
printf("\n*** Testing with CF example http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.4/ch05s02.html....\n");
printf("**** simple test with only metadata");
{
- int ncid, dimids[NDIMS], varids[NVARS], data_dimids[DATA_NDIMS];
+ int ncid, dimids[NDIMS], varids[NVARS], data_dimids[DATA_NDIMS];
int coord_dimids[COORD_NDIMS];
/* Create a netcdf-4 file. */
@@ -224,44 +225,44 @@ main(int argc, char **argv)
data_dimids[2] = dimids[0];
if (nc_def_var(ncid, T_NAME, NC_FLOAT, DATA_NDIMS, data_dimids, &varids[0])) ERR;
if (nc_put_att_text(ncid, varids[0], LONG_NAME, strlen(TEMPERATURE),
- TEMPERATURE)) ERR;
- if (nc_put_att_text(ncid, varids[0], UNITS, strlen(KELVIN), KELVIN)) ERR;
+ TEMPERATURE)) ERR;
+ if (nc_put_att_text(ncid, varids[0], UNITS, strlen(KELVIN), KELVIN)) ERR;
if (nc_put_att_text(ncid, varids[0], COORDINATES_NAME, strlen(LONLAT_COORDINATES),
- LONLAT_COORDINATES)) ERR;
+ LONLAT_COORDINATES)) ERR;
/* Define xc variable. */
if (nc_def_var(ncid, XC_NAME, NC_FLOAT, 1, &dimids[0], &varids[1])) ERR;
- if (nc_put_att_text(ncid, varids[1], AXIS, strlen(X_NAME), X_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[1], AXIS, strlen(X_NAME), X_NAME)) ERR;
if (nc_put_att_text(ncid, varids[1], LONG_NAME, strlen(X_LONG_NAME),
- X_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[1], UNITS, strlen(METER), METER)) ERR;
+ X_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[1], UNITS, strlen(METER), METER)) ERR;
/* Define yc variable. */
if (nc_def_var(ncid, YC_NAME, NC_FLOAT, 1, &dimids[1], &varids[2])) ERR;
- if (nc_put_att_text(ncid, varids[2], AXIS, strlen(Y_NAME), Y_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[2], AXIS, strlen(Y_NAME), Y_NAME)) ERR;
if (nc_put_att_text(ncid, varids[2], LONG_NAME, strlen(Y_LONG_NAME),
- Y_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[2], UNITS, strlen(METER), METER)) ERR;
+ Y_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[2], UNITS, strlen(METER), METER)) ERR;
/* Define lev variable. */
if (nc_def_var(ncid, LEV_NAME, NC_FLOAT, 1, &dimids[2], &varids[3])) ERR;
if (nc_put_att_text(ncid, varids[3], LONG_NAME, strlen(LEV_LONG_NAME),
- LEV_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[3], UNITS, strlen(HPA), HPA)) ERR;
+ LEV_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[3], UNITS, strlen(HPA), HPA)) ERR;
/* Define lon variable. */
coord_dimids[0] = dimids[1];
coord_dimids[1] = dimids[0];
if (nc_def_var(ncid, LON_NAME, NC_FLOAT, COORD_NDIMS, coord_dimids, &varids[4])) ERR;
if (nc_put_att_text(ncid, varids[4], LONG_NAME, strlen(LON_LONG_NAME),
- LON_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[4], UNITS, strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
+ LON_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[4], UNITS, strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
/* Define lat variable. */
if (nc_def_var(ncid, LAT_NAME, NC_FLOAT, COORD_NDIMS, coord_dimids, &varids[5])) ERR;
if (nc_put_att_text(ncid, varids[5], LONG_NAME, strlen(LAT_LONG_NAME),
- LAT_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[5], UNITS, strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
+ LAT_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[5], UNITS, strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
/* Check the metadata. */
if (check_cf_metadata(ncid)) ERR;
@@ -281,7 +282,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("**** test with data writes...");
{
- int ncid, dimids[NDIMS], varids[NVARS], data_dimids[DATA_NDIMS];
+ int ncid, dimids[NDIMS], varids[NVARS], data_dimids[DATA_NDIMS];
int coord_dimids[COORD_NDIMS];
float temp[YC_LEN][XC_LEN], xc[XC_LEN], yc[YC_LEN];
size_t start[DATA_NDIMS] = {0, 0, 0}, count[DATA_NDIMS] = {1, YC_LEN, XC_LEN};
@@ -310,44 +311,44 @@ main(int argc, char **argv)
data_dimids[2] = dimids[0];
if (nc_def_var(ncid, T_NAME, NC_FLOAT, DATA_NDIMS, data_dimids, &varids[0])) ERR;
if (nc_put_att_text(ncid, varids[0], LONG_NAME, strlen(TEMPERATURE),
- TEMPERATURE)) ERR;
- if (nc_put_att_text(ncid, varids[0], UNITS, strlen(KELVIN), KELVIN)) ERR;
+ TEMPERATURE)) ERR;
+ if (nc_put_att_text(ncid, varids[0], UNITS, strlen(KELVIN), KELVIN)) ERR;
if (nc_put_att_text(ncid, varids[0], COORDINATES_NAME, strlen(LONLAT_COORDINATES),
- LONLAT_COORDINATES)) ERR;
+ LONLAT_COORDINATES)) ERR;
/* Define xc variable. */
if (nc_def_var(ncid, XC_NAME, NC_FLOAT, 1, &dimids[0], &varids[1])) ERR;
- if (nc_put_att_text(ncid, varids[1], AXIS, strlen(X_NAME), X_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[1], AXIS, strlen(X_NAME), X_NAME)) ERR;
if (nc_put_att_text(ncid, varids[1], LONG_NAME, strlen(X_LONG_NAME),
- X_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[1], UNITS, strlen(METER), METER)) ERR;
+ X_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[1], UNITS, strlen(METER), METER)) ERR;
/* Define yc variable. */
if (nc_def_var(ncid, YC_NAME, NC_FLOAT, 1, &dimids[1], &varids[2])) ERR;
- if (nc_put_att_text(ncid, varids[2], AXIS, strlen(Y_NAME), Y_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[2], AXIS, strlen(Y_NAME), Y_NAME)) ERR;
if (nc_put_att_text(ncid, varids[2], LONG_NAME, strlen(Y_LONG_NAME),
- Y_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[2], UNITS, strlen(METER), METER)) ERR;
+ Y_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[2], UNITS, strlen(METER), METER)) ERR;
/* Define lev variable. */
if (nc_def_var(ncid, LEV_NAME, NC_FLOAT, 1, &dimids[2], &varids[3])) ERR;
if (nc_put_att_text(ncid, varids[3], LONG_NAME, strlen(LEV_LONG_NAME),
- LEV_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[3], UNITS, strlen(HPA), HPA)) ERR;
+ LEV_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[3], UNITS, strlen(HPA), HPA)) ERR;
/* Define lon variable. */
coord_dimids[0] = dimids[1];
coord_dimids[1] = dimids[0];
if (nc_def_var(ncid, LON_NAME, NC_FLOAT, COORD_NDIMS, coord_dimids, &varids[4])) ERR;
if (nc_put_att_text(ncid, varids[4], LONG_NAME, strlen(LON_LONG_NAME),
- LON_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[4], UNITS, strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
+ LON_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[4], UNITS, strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
/* Define lat variable. */
if (nc_def_var(ncid, LAT_NAME, NC_FLOAT, COORD_NDIMS, coord_dimids, &varids[5])) ERR;
if (nc_put_att_text(ncid, varids[5], LONG_NAME, strlen(LAT_LONG_NAME),
- LAT_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[5], UNITS, strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
+ LAT_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[5], UNITS, strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
/* Write some data to T. */
if (nc_put_vara_float(ncid, 0, start, count, (const float *)temp)) ERR;
@@ -376,7 +377,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("**** test with data writes without enddefs...");
{
- int ncid, dimids[NDIMS], varids[NVARS], data_dimids[DATA_NDIMS];
+ int ncid, dimids[NDIMS], varids[NVARS], data_dimids[DATA_NDIMS];
int coord_dimids[COORD_NDIMS];
float temp[YC_LEN][XC_LEN], xc[XC_LEN], yc[YC_LEN];
size_t start[DATA_NDIMS] = {0, 0, 0}, count[DATA_NDIMS] = {1, YC_LEN, XC_LEN};
@@ -405,30 +406,30 @@ main(int argc, char **argv)
data_dimids[2] = dimids[0];
if (nc_def_var(ncid, T_NAME, NC_FLOAT, DATA_NDIMS, data_dimids, &varids[0])) ERR;
if (nc_put_att_text(ncid, varids[0], LONG_NAME, strlen(TEMPERATURE),
- TEMPERATURE)) ERR;
- if (nc_put_att_text(ncid, varids[0], UNITS, strlen(KELVIN), KELVIN)) ERR;
+ TEMPERATURE)) ERR;
+ if (nc_put_att_text(ncid, varids[0], UNITS, strlen(KELVIN), KELVIN)) ERR;
if (nc_put_att_text(ncid, varids[0], COORDINATES_NAME, strlen(LONLAT_COORDINATES),
- LONLAT_COORDINATES)) ERR;
+ LONLAT_COORDINATES)) ERR;
/* Write some data to T. */
if (nc_put_vara_float(ncid, 0, start, count, (const float *)temp)) ERR;
/* Define xc variable. */
if (nc_def_var(ncid, XC_NAME, NC_FLOAT, 1, &dimids[0], &varids[1])) ERR;
- if (nc_put_att_text(ncid, varids[1], AXIS, strlen(X_NAME), X_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[1], AXIS, strlen(X_NAME), X_NAME)) ERR;
if (nc_put_att_text(ncid, varids[1], LONG_NAME, strlen(X_LONG_NAME),
- X_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[1], UNITS, strlen(METER), METER)) ERR;
+ X_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[1], UNITS, strlen(METER), METER)) ERR;
/* Write data to XC. */
if (nc_put_var_float(ncid, 1, xc)) ERR;
/* Define yc variable. */
if (nc_def_var(ncid, YC_NAME, NC_FLOAT, 1, &dimids[1], &varids[2])) ERR;
- if (nc_put_att_text(ncid, varids[2], AXIS, strlen(Y_NAME), Y_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[2], AXIS, strlen(Y_NAME), Y_NAME)) ERR;
if (nc_put_att_text(ncid, varids[2], LONG_NAME, strlen(Y_LONG_NAME),
- Y_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[2], UNITS, strlen(METER), METER)) ERR;
+ Y_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[2], UNITS, strlen(METER), METER)) ERR;
/* Write data to YC. */
if (nc_put_var_float(ncid, 2, yc)) ERR;
@@ -436,22 +437,22 @@ main(int argc, char **argv)
/* Define lev variable. */
if (nc_def_var(ncid, LEV_NAME, NC_FLOAT, 1, &dimids[2], &varids[3])) ERR;
if (nc_put_att_text(ncid, varids[3], LONG_NAME, strlen(LEV_LONG_NAME),
- LEV_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[3], UNITS, strlen(HPA), HPA)) ERR;
+ LEV_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[3], UNITS, strlen(HPA), HPA)) ERR;
/* Define lon variable. */
coord_dimids[0] = dimids[1];
coord_dimids[1] = dimids[0];
if (nc_def_var(ncid, LON_NAME, NC_FLOAT, COORD_NDIMS, coord_dimids, &varids[4])) ERR;
if (nc_put_att_text(ncid, varids[4], LONG_NAME, strlen(LON_LONG_NAME),
- LON_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[4], UNITS, strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
+ LON_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[4], UNITS, strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
/* Define lat variable. */
if (nc_def_var(ncid, LAT_NAME, NC_FLOAT, COORD_NDIMS, coord_dimids, &varids[5])) ERR;
if (nc_put_att_text(ncid, varids[5], LONG_NAME, strlen(LAT_LONG_NAME),
- LAT_LONG_NAME)) ERR;
- if (nc_put_att_text(ncid, varids[5], UNITS, strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
+ LAT_LONG_NAME)) ERR;
+ if (nc_put_att_text(ncid, varids[5], UNITS, strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
/* Check the metadata and data. */
if (check_cf_metadata(ncid)) ERR;
@@ -473,9 +474,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_create_files.c b/nc_test4/tst_create_files.c
index 09a2efb..2d0b5fc 100644
--- a/nc_test4/tst_create_files.c
+++ b/nc_test4/tst_create_files.c
@@ -8,10 +8,12 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdio.h>
#include <string.h>
#include "ncdispatch.h"
+#include <math.h>
/* We will create this file. */
#define FILE_NAME "tst_floats_1D.nc"
@@ -19,8 +21,8 @@
int
main(int argc, char **argv)
{
- nc_argc = argc;
- nc_argv = argv;
+ int nc_argc = argc;
+ int nc_argv = argv;
nc_initialize();
printf("\n*** Create some files for testing benchmarks.\n");
@@ -41,7 +43,7 @@ main(int argc, char **argv)
size_t chunk_sizes[NDIMS3] = {1, D1, D2};
float *data;
char file_name[NC_MAX_NAME * 2 + 1];
- int d, i;
+ int d, i;
/* Initialize the data to random floats. */
if (!(data = (float *)malloc(D1 * D2 * sizeof(float)))) ERR;
@@ -78,7 +80,7 @@ main(int argc, char **argv)
count[d] = dim_len[d];
}
for ( ; start[0] < D0; (start[0])++)
- if (nc_put_vara_float(ncid, varid, start, count, (const float *) data))
+ if (nc_put_vara_float(ncid, varid, start, count, (const float *) data))
ERR_RET;
/* Close up shop. */
@@ -101,7 +103,7 @@ main(int argc, char **argv)
char name_in[NC_MAX_NAME + 1];
size_t len;
float data[DIMLEN], data_in[DIMLEN];
- int i;
+ int i;
for (i = 0; i < DIMLEN; i++)
data[i] = ((float)rand() / (float)(RAND_MAX));
@@ -114,7 +116,7 @@ main(int argc, char **argv)
if (nc_enddef(ncid)) ERR;
if (nc_put_var_float(ncid, varid, data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reopen and check the file. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -124,12 +126,12 @@ main(int argc, char **argv)
if (nc_inq_dim(ncid, 0, name_in, &len)) ERR;
if (strcmp(name_in, DIM_NAME) || len != DIMLEN) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype, &ndims, dimids, &natts)) ERR;
- if (strcmp(name_in, var_name) || xtype != NC_FLOAT || ndims != 1 ||
+ if (strcmp(name_in, var_name) || xtype != NC_FLOAT || ndims != 1 ||
dimids[0] != 0 || natts != 0) ERR;
if (nc_get_var_float(ncid, 0, data_in)) ERR;
for (i = 0; i < DIMLEN; i++)
if (data_in[i] != data[i]) ERR;
-
+
if (nc_close(ncid)) ERR;
}
@@ -151,7 +153,7 @@ main(int argc, char **argv)
short sdata[TOTAL_SIZE];
void *data[MAX_TYPES];
int ndims;
- int i, d, t;
+ int i, d, t;
/* Initialize the data to random floats. */
for (i = 0; i < TOTAL_SIZE; i++)
@@ -195,11 +197,11 @@ main(int argc, char **argv)
#define NDIMS 3
#define E_VAR_NAME "Like_Elenas_Benchmark"
#define ELENA_FILE_NAME "tst_elena_int_3D.nc"
-#define E_TYPE_SIZE 4
+#define E_TYPE_SIZE 4
int ncid, dimids[NDIMS], varid;
int *idata;
- int i;
+ int i;
/* Initialize data to random int between 0 and 255. */
if (!(idata = malloc(XLEN * YLEN * ZLEN * E_TYPE_SIZE)))
@@ -230,7 +232,7 @@ main(int argc, char **argv)
int ncid, dimids[NDIMS1], varid;
int data[DIM_LEN];
- int i;
+ int i;
/* Initialize data to my favorite numbers. */
for (i = 0; i < DIM_LEN; i++)
@@ -263,7 +265,7 @@ main(int argc, char **argv)
short sdata[TOTAL_SIZE];
void *data[MAX_TYPES];
int ndims;
- int i, d, t;
+ int i, d, t;
/* Initialize the data to random floats. */
for (i = 0; i < TOTAL_SIZE; i++)
@@ -302,4 +304,3 @@ main(int argc, char **argv)
nc_finalize();
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_dims.c b/nc_test4/tst_dims.c
index dc44452..0edae99 100644
--- a/nc_test4/tst_dims.c
+++ b/nc_test4/tst_dims.c
@@ -2,12 +2,13 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use. See www.unidata.ucar.edu for more info.
- Test netcdf-4 dimensions.
+ Test netcdf-4 dimensions.
$Id: tst_dims.c,v 1.30 2010/05/25 13:53:04 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_dims.nc"
#define LAT_NAME "lat"
@@ -35,7 +36,7 @@
#define BUBBA "Bubba"
#define MAX_DIMS 5
-
+
int
main(int argc, char **argv)
{
@@ -340,7 +341,7 @@ main(int argc, char **argv)
if (unlimdimid_in != 0) ERR;
if (nc_inq_unlimdims(ncid, &nunlimdims_in, &unlimdimid_in)) ERR;
if (nunlimdims_in != 1 || unlimdimid_in != 0) ERR;
-
+
/* Automatically enddef and close. */
if (nc_close(ncid)) ERR;
@@ -361,7 +362,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
#define ROMULUS "Romulus"
#define REMUS "Remus"
-#define DIMS2 2
+#define DIMS2 2
printf("*** Testing file with two unlimited dimensions...");
{
int ncid, dimid[DIMS2];
@@ -387,7 +388,7 @@ main(int argc, char **argv)
if (unlimdimid_in[0] != 0) ERR;
if (nc_inq_unlimdims(ncid, &nunlimdims_in, unlimdimid_in)) ERR;
if (nunlimdims_in != 2 || unlimdimid_in[0] != 0 || unlimdimid_in[1] != 1) ERR;
-
+
/* Automatically enddef and close. */
if (nc_close(ncid)) ERR;
@@ -726,7 +727,7 @@ main(int argc, char **argv)
for (i = 0; i < LAT_LEN; i++)
for (j = 0; j < LON_LEN; j++)
pres[i][j] = 1013.1 + j;
-
+
/* Create a file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -763,7 +764,7 @@ main(int argc, char **argv)
dimids_in, &natts_in)) ERR;
if (strcmp(name_in, PRES_NAME) || xtype_in != NC_DOUBLE || ndims_in != 2 ||
dimids_in[0] != lat_dimid || dimids_in[1] != lon_dimid || natts_in != 0) ERR;
-
+
/* Write our latitude and longitude values. This writes all
* metadata to disk too. */
if (nc_put_var_float(ncid, lat_varid, lat)) ERR;
@@ -811,7 +812,7 @@ main(int argc, char **argv)
dimids_in, &natts_in)) ERR;
if (strcmp(name_in, PRES_NAME) || xtype_in != NC_DOUBLE || ndims_in != 2 ||
dimids_in[0] != lat_dimid || dimids_in[1] != lon_dimid || natts_in != 0) ERR;
-
+
/* Check our latitude and longitude values. */
if (nc_get_var(ncid, lat_varid, lat_in)) ERR;
for (i = 0; i < LAT_LEN; i++)
@@ -857,13 +858,13 @@ main(int argc, char **argv)
for (k = 0; k < LEVEL_LEN; k++)
for (l = 0; l <TIME_LEN; l++)
pres[i][j][k][l] = 1013.1 + j;
-
+
/* Some phony 3D hp data. */
for (i = 0; i < LAT_LEN; i++)
for (j = 0; j < LON_LEN; j++)
for (l = 0; l <TIME_LEN; l++)
hp[i][j][l] = 100 + l;
-
+
/* Some phony 2D elevaton data. */
for (i = 0; i < LAT_LEN; i++)
for (j = 0; j < LON_LEN; j++)
@@ -908,7 +909,7 @@ main(int argc, char **argv)
* Center. */
if (nc_def_var(ncid, ELEV_NAME, NC_INT64, 2, dimids, &elev_varid)) ERR;
if (elev_varid != ELEV_VARID) ERR;
-
+
/* Define a 3D NC_USHORT variable to store the number of Harry
* Potter books in this grid square at this time (ignore HP
* books in airplanes, dirigibles, hot air balloons, space
@@ -956,7 +957,7 @@ main(int argc, char **argv)
if (strcmp(name_in, HP_NAME) || xtype_in != NC_USHORT || ndims_in != 3 ||
dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
dimids_in[2] != TIME_DIMID || natts_in != 0) ERR;
-
+
/* Write our latitude and longitude values. This writes all
* metadata to disk too. */
if (nc_put_var_float(ncid, lat_varid, lat)) ERR;
@@ -1016,7 +1017,7 @@ main(int argc, char **argv)
count[1] = LON_LEN;
count[2] = LEVEL_LEN;
count[3] = TIME_LEN;
- if (nc_put_vara(ncid, pres_varid, start, count,
+ if (nc_put_vara(ncid, pres_varid, start, count,
(double *)pres)) ERR;
count[2] = TIME_LEN;
if (nc_put_vara(ncid, hp_varid, start, count,
@@ -1147,7 +1148,7 @@ main(int argc, char **argv)
/* Check it out. */
if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
- if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
+ if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
strcmp(name_in, LAT_NAME)) ERR;
if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
if (ndims_in != 1) ERR;
@@ -1165,7 +1166,7 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
/* Check it out. */
if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
- if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
+ if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
strcmp(name_in, LAT_NAME)) ERR;
if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
if (ndims_in != 1) ERR;
@@ -1197,7 +1198,7 @@ main(int argc, char **argv)
{
strcat(file_in, getenv("srcdir"));
strcat(file_in, "/");
- }
+ }
strcat(file_in, REF_FILE_NAME);
/* Reopen and check it out again. */
@@ -1227,4 +1228,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_dims2.c b/nc_test4/tst_dims2.c
index d7ead94..4811bc2 100644
--- a/nc_test4/tst_dims2.c
+++ b/nc_test4/tst_dims2.c
@@ -2,18 +2,19 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use. See www.unidata.ucar.edu for more info.
- Test netcdf-4 dimensions some more.
+ Test netcdf-4 dimensions some more.
$Id: tst_dims2.c,v 1.17 2010/05/25 13:53:04 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_dims2.nc"
#define NDIMS1 1
-#define NDIMS2 2
+#define NDIMS2 2
int
main(int argc, char **argv)
@@ -320,7 +321,7 @@ main(int argc, char **argv)
count[1] = j;
else
count[1] = 1000-j;
-
+
if (nc_put_vara_int(ncid, varid, start, count, value)) ERR;
time_recs = MAX(time_recs, start[0] + count[0]);
beam_recs = MAX(beam_recs, start[1] + count[1]);
@@ -395,7 +396,7 @@ main(int argc, char **argv)
/* Reopen and write some more time values. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
-
+
/* Write some more time values. */
index[1] = 0;
count[0] = 1;
diff --git a/nc_test4/tst_dims3.c b/nc_test4/tst_dims3.c
index f29f8ea..e1ae65a 100644
--- a/nc_test4/tst_dims3.c
+++ b/nc_test4/tst_dims3.c
@@ -2,13 +2,14 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use. See www.unidata.ucar.edu for more info.
- Test netcdf-4 dimensions inheritance.
+ Test netcdf-4 dimensions inheritance.
$Id: tst_dims3.c,v 1.7 2010/05/25 13:53:04 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
int
main(int argc, char **argv)
@@ -25,7 +26,7 @@ nc_set_log_level(0);
#define VAR2_NAME "z"
#define TIME_RANK 1
#define NUM_TIMES 2
-#define LEV_NAME "level"
+#define LEV_NAME "level"
#define VRT_NAME "vert_number"
#define LEV_NUM 3
#define LEV_RANK 1
@@ -46,14 +47,14 @@ nc_set_log_level(0);
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_grp(ncid, GRP_NAME, &grpid)) ERR;
if (nc_def_dim(ncid, TIME_NAME, NC_UNLIMITED, &time_dim)) ERR;
- if (nc_def_var(ncid, TIME_NAME, NC_INT, TIME_RANK, &time_dim,
+ if (nc_def_var(ncid, TIME_NAME, NC_INT, TIME_RANK, &time_dim,
&time_var)) ERR;
- if (nc_def_var(grpid, VAR2_NAME, NC_INT, TIME_RANK, &time_dim,
+ if (nc_def_var(grpid, VAR2_NAME, NC_INT, TIME_RANK, &time_dim,
&z_var)) ERR;
if (nc_enddef(ncid)) ERR;
/* Assign data to time variable, creating two times */
- if (nc_put_vara(ncid, time_dim, time_startset, time_countset,
+ if (nc_put_vara(ncid, time_dim, time_startset, time_countset,
time_data)) ERR;
/* Check the dim len from the root group */
@@ -89,7 +90,7 @@ nc_set_log_level(0);
{
int ncid, dimid, varid;
float data = 42.5;
-
+
/* Create a scalar coordinate dimension. The only reason that
* the user can ever possibly have for doing this is just
* because they like to make life difficult for poor, poor
diff --git a/nc_test4/tst_empty_vlen_unlim.c b/nc_test4/tst_empty_vlen_unlim.c
index e76f349..6c2f0a5 100644
--- a/nc_test4/tst_empty_vlen_unlim.c
+++ b/nc_test4/tst_empty_vlen_unlim.c
@@ -15,6 +15,7 @@
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <nc_logging.h>
diff --git a/nc_test4/tst_endian_fill.c b/nc_test4/tst_endian_fill.c
index d5bd57d..38afba1 100644
--- a/nc_test4/tst_endian_fill.c
+++ b/nc_test4/tst_endian_fill.c
@@ -9,17 +9,18 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <stdio.h>
#include <netcdf.h>
-#define FILE_NAME "tst_endian_fill.nc"
+#define FILE_NAME "tst_endian_fill.nc"
#define VAR_NAME "v1"
#define VAR2_NAME "v2"
#define VAR3_NAME "v3"
#define VAR_RANK 0
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{
printf("\n*** Testing specified endiannesss fill values.\n");
printf("*** testing simple case with int...");
@@ -40,7 +41,7 @@ main(int argc, char **argv)
if (nc_def_var_endian(ncid, var3id, NC_ENDIAN_BIG)) ERR;
if (nc_put_var(ncid, var3id, &fill)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_varid(ncid, VAR_NAME, &varid)) ERR;
@@ -56,12 +57,12 @@ main(int argc, char **argv)
{
#define NUM_TYPES_TO_CHECK 6
int ncid, varid[NUM_TYPES_TO_CHECK];
- int check_type[NUM_TYPES_TO_CHECK] = {NC_SHORT, NC_USHORT, NC_INT,
+ int check_type[NUM_TYPES_TO_CHECK] = {NC_SHORT, NC_USHORT, NC_INT,
NC_UINT, NC_INT64, NC_UINT64};
- char var_name[NUM_TYPES_TO_CHECK][NC_MAX_NAME + 1] = {"SHORT", "USHORT",
- "INT", "UINT", "INT64",
+ char var_name[NUM_TYPES_TO_CHECK][NC_MAX_NAME + 1] = {"SHORT", "USHORT",
+ "INT", "UINT", "INT64",
"UINT64"};
- long long fill_value[NUM_TYPES_TO_CHECK] = {NC_FILL_SHORT, NC_FILL_USHORT, NC_FILL_INT,
+ long long fill_value[NUM_TYPES_TO_CHECK] = {NC_FILL_SHORT, NC_FILL_USHORT, NC_FILL_INT,
NC_FILL_UINT, NC_FILL_INT64, NC_FILL_UINT64};
long long data_in;
int t;
@@ -74,7 +75,7 @@ main(int argc, char **argv)
if (nc_def_var_endian(ncid, varid[t], NC_ENDIAN_BIG)) ERR;
}
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
for (t = 0; t < NUM_TYPES_TO_CHECK; t++)
@@ -89,6 +90,6 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
FINAL_RESULTS;
-
+
return 0;
}
diff --git a/nc_test4/tst_enums.c b/nc_test4/tst_enums.c
index 9b82ba0..873800f 100644
--- a/nc_test4/tst_enums.c
+++ b/nc_test4/tst_enums.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_enums.nc"
@@ -35,7 +36,7 @@ main(int argc, char **argv)
{
int value_in;
/* Can't use the same name twice! */
- char member_name[NUM_MEMBERS][NC_MAX_NAME + 1] = {"Mene1", "Mene2",
+ char member_name[NUM_MEMBERS][NC_MAX_NAME + 1] = {"Mene1", "Mene2",
"Tekel", "Upharsin"};
int member_value[NUM_MEMBERS] = {0, 99, 81232, 12};
@@ -45,7 +46,7 @@ main(int argc, char **argv)
/* Create an enum type. */
if (nc_def_enum(ncid, NC_INT, TYPE_NAME, &typeid)) ERR;
for (i = 0; i < NUM_MEMBERS; i++)
- if (nc_insert_enum(ncid, typeid, member_name[i],
+ if (nc_insert_enum(ncid, typeid, member_name[i],
&member_value[i])) ERR;
/* Check it out. */
@@ -54,7 +55,7 @@ main(int argc, char **argv)
if (strcmp(name_in, TYPE_NAME) || base_size_in != sizeof(int) ||
base_nc_type_in != NC_INT || nfields_in != NUM_MEMBERS || class_in != NC_ENUM) ERR;
if (nc_inq_enum(ncid, typeid, name_in, &base_nc_type, &base_size_in, &num_members)) ERR;
- if (strcmp(name_in, TYPE_NAME) || base_nc_type != NC_INT ||
+ if (strcmp(name_in, TYPE_NAME) || base_nc_type != NC_INT ||
num_members != NUM_MEMBERS) ERR;
for (i = 0; i < NUM_MEMBERS; i++)
{
@@ -91,7 +92,7 @@ main(int argc, char **argv)
if (strcmp(name_in, member_name[i])) ERR;
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
@@ -109,14 +110,14 @@ main(int argc, char **argv)
unsigned char brady_value[NUM_BRADYS] = {8, 7, 6 , 5, 4, 3, 2, 1, 0};
unsigned char data[BRADY_DIM_LEN] = {0, 4, 8};
unsigned char value_in;
-
+
/* Create a file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* Create an enum type based on unsigned bytes. */
if (nc_def_enum(ncid, NC_UBYTE, BRADYS, &typeid)) ERR;
for (i = 0; i < NUM_BRADYS; i++)
- if (nc_insert_enum(ncid, typeid, brady_name[i],
+ if (nc_insert_enum(ncid, typeid, brady_name[i],
&brady_value[i])) ERR;
/* Check it out. */
@@ -137,7 +138,7 @@ main(int argc, char **argv)
/* Write an att of this enum type. */
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME, typeid, BRADY_DIM_LEN, data)) ERR;
-
+
/* Close the file. */
if (nc_close(ncid)) ERR;
@@ -160,7 +161,7 @@ main(int argc, char **argv)
if (strcmp(name_in, brady_name[i])) ERR;
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
@@ -199,17 +200,17 @@ main(int argc, char **argv)
char *name;
unsigned char value;
} cloud_types[] = {
- {"Clear", CLEAR},
- {"Cumulonimbus", CUMULONIMBUS},
- {"Stratus", STRATUS},
- {"Stratocumulus", STRATOCUMULUS},
- {"Cumulus", CUMULUS},
- {"Altostratus", ALTOSTRATUS},
- {"Nimbostratus", NIMBOSTRATUS},
- {"Altocumulus", ALTOCUMULUS},
- {"Cirrostratus", CIRROSTRATUS},
- {"Cirrocumulus", CIRROCUMULUS},
- {"Cirrus", CIRRUS},
+ {"Clear", CLEAR},
+ {"Cumulonimbus", CUMULONIMBUS},
+ {"Stratus", STRATUS},
+ {"Stratocumulus", STRATOCUMULUS},
+ {"Cumulus", CUMULUS},
+ {"Altostratus", ALTOSTRATUS},
+ {"Nimbostratus", NIMBOSTRATUS},
+ {"Altocumulus", ALTOCUMULUS},
+ {"Cirrostratus", CIRROSTRATUS},
+ {"Cirrocumulus", CIRROCUMULUS},
+ {"Cirrus", CIRRUS},
{"Missing", MISSING}
};
int var_dims[VAR2_RANK];
@@ -242,28 +243,28 @@ 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;
if (nc_inq_user_type(ncid, typeid, name_in, &base_size_in, &base_nc_type_in,
&nfields_in, &class_in)) ERR;
- if (strcmp(name_in, TYPE2_NAME) ||
+ if (strcmp(name_in, TYPE2_NAME) ||
base_size_in != sizeof(unsigned char) ||
- base_nc_type_in != NC_UBYTE ||
- nfields_in != num_members ||
+ base_nc_type_in != NC_UBYTE ||
+ nfields_in != num_members ||
class_in != NC_ENUM) ERR;
- if (nc_inq_enum(ncid, typeid, name_in,
+ if (nc_inq_enum(ncid, typeid, name_in,
&base_nc_type_in, &base_size_in, &num_members_in)) ERR;
- if (strcmp(name_in, TYPE2_NAME) ||
- base_nc_type_in != NC_UBYTE ||
+ if (strcmp(name_in, TYPE2_NAME) ||
+ base_nc_type_in != NC_UBYTE ||
num_members_in != num_members) ERR;
for (i = 0; i < num_members; i++)
{
if (nc_inq_enum_member(ncid, typeid, i, name_in, &value_in)) ERR;
- if (strcmp(name_in, cloud_types[i].name) ||
+ if (strcmp(name_in, cloud_types[i].name) ||
value_in != cloud_types[i].value) ERR;
- if (nc_inq_enum_ident(ncid, typeid, cloud_types[i].value,
+ if (nc_inq_enum_ident(ncid, typeid, cloud_types[i].value,
name_in)) ERR;
if (strcmp(name_in, cloud_types[i].name)) ERR;
}
@@ -276,15 +277,15 @@ main(int argc, char **argv)
for (i = 0; i < DIM2_LEN; i++) {
if (cloud_data_in[i] != cloud_data[i]) ERR;
}
-
- if (nc_close(ncid)) ERR;
+
+ if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
printf("*** testing enum interuptus...");
{
#define GEEKY_NAME "Galadriel"
-
+
/* Create a file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -308,4 +309,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_files.c b/nc_test4/tst_files.c
index 5af8b15..5b949a9 100644
--- a/nc_test4/tst_files.c
+++ b/nc_test4/tst_files.c
@@ -2,13 +2,14 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test internal netcdf-4 file code.
+ Test internal netcdf-4 file code.
$Id: tst_files.c,v 1.42 2010/05/18 12:30:05 ed Exp $
*/
#include <config.h>
#include "netcdf.h"
#include <nc_tests.h>
+#include "err_macros.h"
#ifdef IGNORE
extern NC_FILE_INFO_T *nc_file;
@@ -33,7 +34,7 @@ main(int argc, char **argv)
printf("\n*** Testing netcdf-4 file functions.\n");
{
char str[NC_MAX_NAME+1];
-
+
/* Actually we never make any promises about the length of the
* version string, but it is always smaller than NC_MAX_NAME. */
if (strlen(nc_inq_libvers()) > NC_MAX_NAME) ERR;
@@ -47,7 +48,7 @@ main(int argc, char **argv)
/* Make sure bad create mode causes failure. */
/*if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;*/
-
+
/* Create an empty file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_close(ncid)) ERR;
@@ -105,7 +106,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
if (nc_close(ncid2)) ERR;
if (nc_close(ncid3)) ERR;
-
+
/* Open and close empty file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_close(ncid)) ERR;
@@ -334,7 +335,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid[f], VAR_NAME, NC_CHAR, NDIMS, &dimid, &varid)) ERR;
if (f % 2 == 0)
if (nc_def_var_chunking(ncid[f], varid, 0, chunks)) ERR;
-
+
/* Write one time to the coordinate variable. */
count[0] = TEXT_LEN + 1;
if (nc_put_vara_text(ncid[f], varid, index, count, ttext)) ERR;
@@ -377,7 +378,7 @@ main(int argc, char **argv)
#define NEW_CACHE_PREEMPTION .75
int
-test_redef(int format)
+test_redef(int format)
{
int ncid, varid, dimids[REDEF_NDIMS], dimids_in[REDEF_NDIMS];
int ndims, nvars, natts, unlimdimid;
@@ -405,14 +406,14 @@ test_redef(int format)
cflags |= NC_NETCDF4;
/* Change chunk cache. */
- if (nc_set_chunk_cache(NEW_CACHE_SIZE, NEW_CACHE_NELEMS,
+ if (nc_set_chunk_cache(NEW_CACHE_SIZE, NEW_CACHE_NELEMS,
NEW_CACHE_PREEMPTION)) ERR;
/* Create a file with two dims, two vars, and two atts. */
if (nc_create(FILE_NAME, cflags|NC_CLOBBER, &ncid)) ERR;
/* Retrieve the chunk cache settings, just for fun. */
- if (nc_get_chunk_cache(&cache_size_in, &cache_nelems_in,
+ if (nc_get_chunk_cache(&cache_size_in, &cache_nelems_in,
&cache_preemption_in)) ERR;
if (cache_size_in != NEW_CACHE_SIZE || cache_nelems_in != NEW_CACHE_NELEMS ||
cache_preemption_in != NEW_CACHE_PREEMPTION) ERR;
@@ -420,7 +421,7 @@ test_redef(int format)
/* This will fail, except for netcdf-4/hdf5, which permits any
* name. */
if (format != NC_FORMAT_NETCDF4)
- if (nc_def_dim(ncid, REDEF_NAME_ILLEGAL, REDEF_DIM2_LEN,
+ if (nc_def_dim(ncid, REDEF_NAME_ILLEGAL, REDEF_DIM2_LEN,
&dimids[1]) != NC_EBADNAME) ERR;
if (nc_def_dim(ncid, REDEF_DIM1_NAME, REDEF_DIM1_LEN, &dimids[0])) ERR;
@@ -434,10 +435,10 @@ test_redef(int format)
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != REDEF_NDIMS || nvars != 2 || natts != 2 || unlimdimid != -1) ERR;
if (nc_inq_var(ncid, 0, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
if (nc_inq_var(ncid, 1, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
/* Close it up. */
@@ -450,14 +451,14 @@ test_redef(int format)
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != REDEF_NDIMS || nvars != 2 || natts != 2 || unlimdimid != -1) ERR;
if (nc_inq_var(ncid, 0, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
if (nc_inq_var(ncid, 1, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
/* This will fail. */
- ret = nc_def_var(ncid, REDEF_VAR3_NAME, NC_UBYTE, REDEF_NDIMS,
+ ret = nc_def_var(ncid, REDEF_VAR3_NAME, NC_UBYTE, REDEF_NDIMS,
dimids, &varid);
if(format == NC_FORMAT_NETCDF4) {
if(ret != NC_EPERM) {
@@ -470,7 +471,7 @@ test_redef(int format)
}
/* This will fail. */
if (!nc_put_att_uchar(ncid, NC_GLOBAL, REDEF_ATT3_NAME, NC_CHAR, 1, &uchar_out)) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
/* Make sure we can't redef a file opened for NOWRITE. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
@@ -480,13 +481,13 @@ test_redef(int format)
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != REDEF_NDIMS || nvars != 2 || natts != 2 || unlimdimid != -1) ERR;
if (nc_inq_var(ncid, 0, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
if (nc_inq_var(ncid, 1, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
/* Reopen the file and check it, add a variable and attribute. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
@@ -508,16 +509,16 @@ test_redef(int format)
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != REDEF_NDIMS || nvars != 3 || natts != 3 || unlimdimid != -1) ERR;
if (nc_inq_var(ncid, 0, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR1_NAME) || xtype_in != NC_INT || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
if (nc_inq_var(ncid, 1, var_name, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
+ if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
if (nc_inq_var(ncid, 2, var_name, &var_type, &ndims, dimids_var, &natts)) ERR;
if (ndims != REDEF_NDIMS || strcmp(var_name, REDEF_VAR3_NAME) || var_type != NC_BYTE ||
natts != 0) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
/* Reopen it and check each dim, var, and att. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
@@ -543,10 +544,8 @@ test_redef(int format)
if (ret != NC_ERANGE) ERR;
}
else if (ret) ERR;
-
+
if (uchar_in != uchar_out) ERR;
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
return NC_NOERR;
}
-
-
diff --git a/nc_test4/tst_files2.c b/nc_test4/tst_files2.c
index ded2004..5128dd5 100644
--- a/nc_test4/tst_files2.c
+++ b/nc_test4/tst_files2.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_files2.c,v 1.11 2010/01/31 19:00:44 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <unistd.h>
#include <time.h>
@@ -53,7 +54,7 @@ get_mem_used2(int *mem_used)
{
char buf[30];
FILE *pf;
-
+
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
pf = fopen(buf, "r");
if (pf) {
@@ -64,7 +65,7 @@ get_mem_used2(int *mem_used)
unsigned lib;/* library */
unsigned data;/* data/stack */
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
- fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
+ fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = data;
}
@@ -85,7 +86,7 @@ get_mem_used3(int *mem_used)
* lens of dim_len size. */
#define MAX_DIMS 4
int
-create_sample_file(char *file_name, int ndims, int *dim_len,
+create_sample_file(char *file_name, int ndims, int *dim_len,
int num_vars, int mode, int num_recs)
{
int ncid, dimids[MAX_DIMS], *varids;
@@ -124,10 +125,10 @@ create_sample_file(char *file_name, int ndims, int *dim_len,
for (i = 0; i < num_vars; i++)
{
sprintf(varname, "a_%d", i);
- if (nc_def_var(ncid, varname, NC_FLOAT, ndims, dimids,
+ if (nc_def_var(ncid, varname, NC_FLOAT, ndims, dimids,
&varids[i])) ERR_RET;
}
-
+
/* Enddef required for classic files. */
if (nc_enddef(ncid)) ERR;
@@ -150,13 +151,13 @@ create_sample_file(char *file_name, int ndims, int *dim_len,
{
for (start[0] = 0; start[0] < (dim_len[0] ? dim_len[0] : num_recs); start[0]++)
for (start[1] = 0; start[1] < dim_len[1]; start[1]++)
- if (nc_put_vara_float(ncid, varids[i], start, count,
+ if (nc_put_vara_float(ncid, varids[i], start, count,
data_out)) ERR_RET;
}
else
{
for (start[0] = 0; start[0] < (dim_len[0] ? dim_len[0] : num_recs); start[0]++)
- if (nc_put_vara_float(ncid, varids[i], start, count,
+ if (nc_put_vara_float(ncid, varids[i], start, count,
data_out)) ERR_RET;
}
}
@@ -213,7 +214,7 @@ main(int argc, char **argv)
ndims[t] = 4;
for (d = 0; d < ndims[t]; d++)
dim_len[t][d] = dim_4d[d];
-
+
/* Create sample file (unless it already exists). */
if (gettimeofday(&start_time, NULL)) ERR;
if (create_sample_file(file_name[t], ndims[t], dim_len[t], num_vars[t],
@@ -226,7 +227,7 @@ main(int argc, char **argv)
/* Change the cache settings. */
if (nc_set_chunk_cache(cache_size[t], 20000, .75)) ERR;
-
+
/* We need storage for an array of ncids. */
if (!(ncid_in = malloc(num_files[t] * sizeof(int)))) ERR;
@@ -234,7 +235,7 @@ main(int argc, char **argv)
if (get_mem_used1(&mem_used)) ERR;
/* get_mem_used2(&mem_used);
get_mem_used3(&mem_used);*/
-
+
/* Open the first file to get chunksizes. */
if (gettimeofday(&start_time, NULL)) ERR;
if (nc_open(file_name[t], 0, &ncid_in[0])) ERR;
@@ -305,7 +306,7 @@ main(int argc, char **argv)
get_mem_used2(&mem_used);
mem_used1 = mem_used;
mem_used2 = mem_used;
- printf("start: memuse= %d\t%d\t%d \n",mem_used, mem_used1,
+ printf("start: memuse= %d\t%d\t%d \n",mem_used, mem_used1,
mem_used2);
printf("bef_open\taft_open\taft_close\tused_open\tused_closed\n");
@@ -325,8 +326,8 @@ main(int argc, char **argv)
get_mem_used2(&mem_used2);
if (mem_used2 - mem_used)
- printf("try %d - %d\t\t%d\t\t%d\t\t%d\t\t%d \n", i,
- mem_used, mem_used1, mem_used2, mem_used1 - mem_used,
+ printf("try %d - %d\t\t%d\t\t%d\t\t%d\t\t%d \n", i,
+ mem_used, mem_used1, mem_used2, mem_used1 - mem_used,
mem_used2 - mem_used);
}
}
diff --git a/nc_test4/tst_files3.c b/nc_test4/tst_files3.c
index 6f60cad..e59c73e 100644
--- a/nc_test4/tst_files3.c
+++ b/nc_test4/tst_files3.c
@@ -2,13 +2,14 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test internal netcdf-4 file code.
+ Test internal netcdf-4 file code.
$Id: tst_files3.c,v 1.5 2010/02/02 17:19:28 ed Exp $
*/
#include <config.h>
#include <stdio.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <hdf5.h>
#include <unistd.h>
@@ -17,7 +18,7 @@
#include <string.h>
#define NDIMS1 1
-#define NDIMS 3
+#define NDIMS 3
#define FILE_NAME "tst_files3.nc"
#define X_LEN 120
#define Y_LEN 64
@@ -38,7 +39,7 @@ int dump_file2(const float *data, int docompression, int usedefdim)
if (nc_def_dim(ncid, "lat", Y_LEN, &dimids[1])) ERR_RET;
if (nc_def_dim(ncid, "lon", Z_LEN, &dimids[2])) ERR_RET;
if (nc_def_var(ncid, "test", NC_FLOAT, NDIMS, dimids, &var)) ERR_RET;
- if (docompression)
+ if (docompression)
if (nc_def_var_deflate(ncid, var, 1, 1, 1)) ERR_RET;
if (nc_enddef(ncid)) ERR_RET;
for (start[0] = 0; start[0] < X_LEN; start[0]++)
@@ -62,7 +63,7 @@ int dump_file(const float *data, int docompression, int usedefdim)
if (nc_def_dim(ncid, "lat", Y_LEN, &dimids[1])) ERR_RET;
if (nc_def_dim(ncid, "lon", Z_LEN, &dimids[2])) ERR_RET;
if (nc_def_var(ncid, "test", NC_FLOAT, NDIMS, dimids, &var)) ERR_RET;
- if (docompression)
+ if (docompression)
if (nc_def_var_deflate(ncid, var, 1, 1, 1)) ERR_RET;
if (nc_enddef(ncid)) ERR_RET;
if (nc_put_vars_float(ncid, var, start, count, stride, data)) ERR_RET;
@@ -84,7 +85,7 @@ int dump_file3(const float *data, int docompression, int usedefdim)
if (nc_def_dim(ncid, "lat", Y_LEN, &dimids[1])) ERR_RET;
if (nc_def_dim(ncid, "lon", Z_LEN, &dimids[2])) ERR_RET;
if (nc_def_var(ncid, "test", NC_FLOAT, NDIMS, dimids, &var)) ERR_RET;
- if (docompression)
+ if (docompression)
if (nc_def_var_deflate(ncid, var, 1, 1, 1)) ERR_RET;
if (nc_enddef(ncid)) ERR_RET;
if (nc_put_vars_float(ncid, var, start, count, stride, data)) ERR_RET;
@@ -109,7 +110,7 @@ int dump_hdf_file(const float *data, int docompression)
/* create property for dataset */
propid = H5Pcreate(H5P_DATASET_CREATE);
- if (docompression)
+ if (docompression)
{
if (H5Pset_layout(propid, H5D_CHUNKED) < 0) ERR;
if (H5Pset_chunk(propid, NDIMS, dims) < 0) ERR;
@@ -127,7 +128,7 @@ int dump_hdf_file(const float *data, int docompression)
CHUNK_CACHE_SIZE, CHUNK_CACHE_PREEMPTION) < 0) ERR;
/* Create the dataset. */
- if ((dataset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_FLOAT, file_spaceid,
+ if ((dataset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_FLOAT, file_spaceid,
H5P_DEFAULT, propid, access_plistid)) < 0) ERR;
/* if ((file_spaceid = H5Dget_space(dataset_id)) < 0) ERR;*/
@@ -138,9 +139,9 @@ int dump_hdf_file(const float *data, int docompression)
for (start[0] = 0; start[0] < X_LEN; start[0]++)
for (start[1] = 0; start[1] < Y_LEN; start[1]++)
{
- if (H5Sselect_hyperslab(file_spaceid, H5S_SELECT_SET, start, NULL,
+ if (H5Sselect_hyperslab(file_spaceid, H5S_SELECT_SET, start, NULL,
count, NULL) < 0) ERR_RET;
- if (H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, mem_spaceid, file_spaceid,
+ if (H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, mem_spaceid, file_spaceid,
xfer_plistid, data) < 0) ERR_RET;
}
@@ -166,7 +167,7 @@ get_mem_used2(int *mem_used)
{
char buf[30];
FILE *pf;
-
+
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
pf = fopen(buf, "r");
if (pf) {
@@ -177,7 +178,7 @@ get_mem_used2(int *mem_used)
unsigned lib;/* library */
unsigned data;/* data/stack */
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
- fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
+ fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = data;
}
@@ -190,7 +191,7 @@ int main(void)
{
float data[X_LEN * Y_LEN * Z_LEN];
int i;
-
+
printf("\n*** Testing netcdf-4 file functions with caching.\n");
/* Initialize data. */
@@ -201,7 +202,7 @@ int main(void)
int mem_used, mem_used1;
printf("*** testing netcdf-4 writes...\n");
- for (i = 0; i < NUM_TRIES; i++)
+ for (i = 0; i < NUM_TRIES; i++)
{
get_mem_used2(&mem_used);
if (dump_file3(data, 1, 0)) ERR_RET;
diff --git a/nc_test4/tst_files4.c b/nc_test4/tst_files4.c
index d04862b..55fb289 100644
--- a/nc_test4/tst_files4.c
+++ b/nc_test4/tst_files4.c
@@ -3,7 +3,7 @@
See COPYRIGHT file for conditions of use.
Test netcdf-4 file from user-reported error. This code based on an
- ncgen output.
+ ncgen output.
$Id: tst_files4.c,v 1.4 2010/05/18 12:30:05 ed Exp $
*/
@@ -11,6 +11,7 @@
#include <config.h>
#include <stdio.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <string.h>
@@ -26,7 +27,7 @@
int
main() {/* create data.nc */
- int ncid;
+ int ncid;
int classical_grp;
/* dimension ids */
@@ -60,7 +61,7 @@ main() {/* create data.nc */
/* Sample data. */
for (i = 0; i < SLICE_LEN * PARTICLE_LEN * AXIS_LEN; i++)
data[i] = 42.42;
-
+
if (nc_create(FILE_NAME, NC_CLOBBER|NC_NETCDF4, &ncid)) ERR;
if (nc_def_grp(ncid, CLASSICAL, &classical_grp)) ERR;
@@ -74,17 +75,17 @@ main() {/* create data.nc */
dimids[1] = slice_dim;
dimids[2] = particle_dim;
dimids[3] = axis_dim;
- if (nc_def_var(classical_grp, "position", NC_DOUBLE, NDIMS4,
+ if (nc_def_var(classical_grp, "position", NC_DOUBLE, NDIMS4,
dimids, &position_id)) ERR;
/* First write some position data. */
- if (nc_put_vara_double(classical_grp, position_id,
+ if (nc_put_vara_double(classical_grp, position_id,
start, count, data)) ERR;
/* Now define some coordinate variables. */
- if (nc_def_var(classical_grp, "snapshot", NC_INT, NDIMS1,
+ if (nc_def_var(classical_grp, "snapshot", NC_INT, NDIMS1,
&snapshot_dim, &snapshot_id)) ERR;
- if (nc_def_var(classical_grp, "axis", NC_CHAR, NDIMS1,
+ if (nc_def_var(classical_grp, "axis", NC_CHAR, NDIMS1,
&axis_dim, &axis_id)) ERR;
/* Check some stuff. */
@@ -96,7 +97,7 @@ main() {/* create data.nc */
if (strcmp(name_in, CLASSICAL)) ERR;
if (nc_inq(classical_grp, &ndims_in, &nvars_in, &natts_in, &unlimdimid)) ERR;
if (ndims_in != 4 || nvars_in != 3 || natts_in != 0 || unlimdimid != 0) ERR;
-
+
if (nc_close(ncid)) ERR;
@@ -109,7 +110,7 @@ main() {/* create data.nc */
{
int i, ncid;
- for (i = 0; i < 32768; i++)
+ for (i = 0; i < 32768; i++)
{
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR_RET;
if (nc_close(ncid)) ERR_RET;
diff --git a/nc_test4/tst_files5.c b/nc_test4/tst_files5.c
index 6449cc9..dbfff6f 100644
--- a/nc_test4/tst_files5.c
+++ b/nc_test4/tst_files5.c
@@ -2,10 +2,11 @@
Copyright 2010 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf files a bit.
+ Test netcdf files a bit.
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_files.nc"
@@ -55,5 +56,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_files6.c b/nc_test4/tst_files6.c
index 907ebf2..fa265f2 100644
--- a/nc_test4/tst_files6.c
+++ b/nc_test4/tst_files6.c
@@ -2,10 +2,11 @@
Copyright 2010 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf files a bit.
+ Test netcdf files a bit.
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_files6.nc"
@@ -16,11 +17,11 @@ main(int argc, char **argv)
printf("\n*** Testing netcdf file functions some more.\n");
printf("*** testing Jeff Whitaker's test...");
{
-#define DIM_NAME "xc"
-#define DIM_LEN 134
+#define DIM_NAME "xc"
+#define DIM_LEN 134
#define VAR_NAME1 "var1"
#define VAR_NAME2 "var2"
-
+
int ncid, dimid, varid1, varid2, dimid_in;
int ndims_in, natts_in;
size_t len_in;
@@ -38,22 +39,20 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_CLOBBER|NC_NETCDF4, &ncid)) ERR;
if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
if (strcmp(name_in, DIM_NAME) || len_in != DIM_LEN) ERR;
- if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in,
&dimid_in, &natts_in)) ERR;
- if (strcmp(name_in, VAR_NAME1) || xtype_in != NC_FLOAT ||
+ if (strcmp(name_in, VAR_NAME1) || xtype_in != NC_FLOAT ||
ndims_in != 1 || dimid_in != 0 || natts_in != 0) ERR;
- if (nc_inq_var(ncid, 1, name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(ncid, 1, name_in, &xtype_in, &ndims_in,
&dimid_in, &natts_in)) ERR;
- if (strcmp(name_in, VAR_NAME2) || xtype_in != NC_FLOAT ||
+ if (strcmp(name_in, VAR_NAME2) || xtype_in != NC_FLOAT ||
ndims_in != 1 || dimid_in != 0 || natts_in != 0) ERR;
- if (nc_inq_var(ncid, 2, name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(ncid, 2, name_in, &xtype_in, &ndims_in,
&dimid_in, &natts_in)) ERR;
- if (strcmp(name_in, DIM_NAME) || xtype_in != NC_FLOAT ||
+ if (strcmp(name_in, DIM_NAME) || xtype_in != NC_FLOAT ||
ndims_in != 1 || dimid_in != 0 || natts_in != 0) ERR;
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_fill_attr_vanish.c b/nc_test4/tst_fill_attr_vanish.c
index 09000f2..4d119cd 100644
--- a/nc_test4/tst_fill_attr_vanish.c
+++ b/nc_test4/tst_fill_attr_vanish.c
@@ -14,6 +14,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
diff --git a/nc_test4/tst_fillbug.c b/nc_test4/tst_fillbug.c
index 1457e84..b4a04e2 100644
--- a/nc_test4/tst_fillbug.c
+++ b/nc_test4/tst_fillbug.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
@@ -18,7 +19,7 @@
#define LEN 4
int
-main()
+main()
{
int ncid, dimids[RANK_P], time_id, p_id;
int ndims, dimids_in[RANK_P];
@@ -87,7 +88,7 @@ main()
if (nc_close(ncid)) ERR;
SUMMARIZE_ERR;
-
+
FINAL_RESULTS;
return 0;
}
diff --git a/nc_test4/tst_fills.c b/nc_test4/tst_fills.c
index 943f063..c8cf164 100644
--- a/nc_test4/tst_fills.c
+++ b/nc_test4/tst_fills.c
@@ -8,14 +8,15 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <stdio.h>
#include <netcdf.h>
-#define FILE_NAME "tst_fills.nc"
+#define FILE_NAME "tst_fills.nc"
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{ /* create tst_classic_fills.nc */
printf("\n*** Testing fill values.\n");
printf("*** testing very simple scalar string var...");
diff --git a/nc_test4/tst_fills2.c b/nc_test4/tst_fills2.c
index de3c051..0ae26cd 100644
--- a/nc_test4/tst_fills2.c
+++ b/nc_test4/tst_fills2.c
@@ -8,14 +8,15 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <stdio.h>
#include <netcdf.h>
-#define FILE_NAME "tst_fills2.nc"
+#define FILE_NAME "tst_fills2.nc"
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{ /* create tst_classic_fills.nc */
printf("\n*** Testing fill values.\n");
printf("*** testing read of string record var with no data...");
@@ -43,7 +44,7 @@ main(int argc, char **argv)
* empty string. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, "sentence", NC_UNLIMITED, &dimid)) ERR;
- if (nc_def_var(ncid, STRING_VAR_NAME, NC_STRING, NDIMS_STRING,
+ if (nc_def_var(ncid, STRING_VAR_NAME, NC_STRING, NDIMS_STRING,
&dimid, &varid)) ERR;
/* Check it out. */
@@ -100,7 +101,7 @@ main(int argc, char **argv)
* empty string. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, "sentence", NC_UNLIMITED, &dimid)) ERR;
- if (nc_def_var(ncid, STRING_VAR_NAME, NC_STRING, NDIMS_STRING,
+ if (nc_def_var(ncid, STRING_VAR_NAME, NC_STRING, NDIMS_STRING,
&dimid, &varid)) ERR;
if (nc_put_att_string(ncid, varid, "_FillValue", FILLVALUE_LEN,
missing_val)) ERR;
@@ -332,9 +333,9 @@ main(int argc, char **argv)
* empty string. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, "Lunar_Years", NC_UNLIMITED, &dimid)) ERR;
- if (nc_def_var(ncid, STRING_VAR_NAME, NC_STRING, NDIMS_STRING,
+ if (nc_def_var(ncid, STRING_VAR_NAME, NC_STRING, NDIMS_STRING,
&dimid, &varid)) ERR;
- if (nc_put_att_string(ncid, varid, "_FillValue", FILLVALUE_LEN,
+ if (nc_put_att_string(ncid, varid, "_FillValue", FILLVALUE_LEN,
missing_val)) ERR;
/* Check it out. */
@@ -345,7 +346,7 @@ main(int argc, char **argv)
/* Get all the data from the variable. There is none! */
if (nc_get_var_string(ncid, varid_in, NULL)) ERR;
-
+
/* Close file. */
if (nc_close(ncid)) ERR;
@@ -358,7 +359,7 @@ main(int argc, char **argv)
/* Get all the data from the variable. There is none! */
if (nc_get_var_string(ncid, varid_in, NULL)) ERR;
-
+
/* Close file. */
if (nc_close(ncid)) ERR;
}
@@ -380,4 +381,3 @@ main(int argc, char **argv)
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_grps.c b/nc_test4/tst_grps.c
index 613f912..2cadc03 100644
--- a/nc_test4/tst_grps.c
+++ b/nc_test4/tst_grps.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 group code.
+ Test netcdf-4 group code.
$Id: tst_grps.c,v 1.37 2010/04/07 15:21:28 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_grps.nc"
@@ -53,7 +54,7 @@ main(int argc, char **argv)
if (ncid_in != henry_vii_id) ERR;
if (nc_inq_ncid(ncid, MARGARET, &ncid_in) != NC_ENOGRP) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grp_parent(ncid, &parent_ncid) != NC_ENOGRP) ERR;
@@ -119,7 +120,7 @@ main(int argc, char **argv)
if (nc_def_var(henry_vii_id, VAR_NAME1, NC_INT64, NDIMS_IN_VAR, &dimid1, &varid1)) ERR;
if (nc_def_var(henry_vii_id, VAR_NAME2, NC_INT64, NDIMS_IN_VAR, &dimid1, &varid2)) ERR;
if (nc_def_var(henry_vii_id, VAR_NAME3, NC_INT64, NDIMS_IN_VAR, &dimid2, &varid3)) ERR;
-
+
/* Check it out. Find the group by name. */
if (nc_inq_ncid(ncid, HENRY_VII, &grpid_in)) ERR;
@@ -404,7 +405,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
-
+
printf("*** testing more group attributes...");
{
int ncid, num_grps, dynasty, ncid_in;
@@ -420,23 +421,23 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_grp(ncid, DYNASTY, &tudor_id)) ERR;
if (nc_def_grp(tudor_id, HENRY_VII, &henry_vii_id)) ERR;
- if (nc_put_att_int(henry_vii_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
+ if (nc_put_att_int(henry_vii_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
1, &num_castles_henry_vii)) ERR;
if (nc_def_grp(tudor_id, MARGARET, &margaret_id)) ERR;
- if (nc_put_att_int(margaret_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
+ if (nc_put_att_int(margaret_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
1, &num_castles_margaret)) ERR;
if (nc_def_grp(tudor_id, JAMES_V_OF_SCOTLAND, &james_v_of_scotland_id)) ERR;
- if (nc_put_att_int(james_v_of_scotland_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
+ if (nc_put_att_int(james_v_of_scotland_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
1, &num_castles_james_v)) ERR;
if (nc_def_grp(tudor_id, MARY_I_OF_SCOTLAND, &mary_i_of_scotland_id)) ERR;
- if (nc_put_att_int(mary_i_of_scotland_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
+ if (nc_put_att_int(mary_i_of_scotland_id, NC_GLOBAL, NUM_CASTLES_NAME, NC_INT,
1, &num_castles_mary_i)) ERR;
- if (nc_def_grp(tudor_id, JAMES_VI_OF_SCOTLAND_AND_I_OF_ENGLAND,
+ if (nc_def_grp(tudor_id, JAMES_VI_OF_SCOTLAND_AND_I_OF_ENGLAND,
&james_i_of_england_id)) ERR;
- if (nc_put_att_int(james_i_of_england_id, NC_GLOBAL, NUM_CASTLES_NAME,
+ if (nc_put_att_int(james_i_of_england_id, NC_GLOBAL, NUM_CASTLES_NAME,
NC_INT, 1, &num_castles_james_vi)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Make sure we've got all the tudors where we want them. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grps(ncid, &num_grps, &dynasty)) ERR;
@@ -480,7 +481,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Now check the file to see if the dimension is there. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grps(ncid, &num_grps, &dynasty)) ERR;
if (num_grps != 1) ERR;
if (nc_inq_grpname(dynasty, name_in)) ERR;
@@ -518,12 +519,12 @@ main(int argc, char **argv)
/* Now check the file to see if the dimension and variable are
* there. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grps(ncid, &num_grps, &dynasty)) ERR;
if (num_grps != 1) ERR;
if (nc_inq_dim(dynasty, 0, name_in, &len_in)) ERR;
if (strcmp(name_in, DIM1_NAME) || len_in != DIM1_LEN) ERR;
- if (nc_inq_var(dynasty, 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(dynasty, 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_INT || ndims_in != 1 ||
dimids_in[0] != 0 || natts_in != 0) ERR;
@@ -544,7 +545,7 @@ main(int argc, char **argv)
/* Now check the file to see if the dimension and variable are
* there. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grps(ncid, &num_grps, NULL)) ERR;
if (num_grps) ERR;
if (nc_close(ncid)) ERR;
@@ -608,7 +609,7 @@ main(int argc, char **argv)
{
if (nc_inq_dim(grpids_in[i], i, name_in, &len_in)) ERR;
if (strcmp(name_in, DIM1_NAME) || len_in != DIM1_LEN) ERR;
- if (nc_inq_var(grpids_in[i], 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(grpids_in[i], 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_INT || ndims_in != 1 ||
dimids_in[0] != i || natts_in != 0) ERR;
@@ -620,7 +621,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Reopen. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
/* Check it out. */
if (nc_inq_grps(ncid, &num_grps, &dynasty)) ERR;
@@ -633,7 +634,7 @@ main(int argc, char **argv)
* dimid is not i. */
/*if (nc_inq_dim(grpids_in[i], i, name_in, &len_in)) ERR;
if (strcmp(name_in, DIM1_NAME) || len_in != DIM1_LEN) ERR;*/
- if (nc_inq_var(grpids_in[i], 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(grpids_in[i], 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_INT || ndims_in != 1 ||
natts_in != 0) ERR;
@@ -673,12 +674,12 @@ main(int argc, char **argv)
if (nc_def_grp(ncid, HENRY_VII, &henry_vii_id)) ERR;
if (nc_def_var(henry_vii_id, VAR1_NAME, NC_INT, 1, &dimid, &varid)) ERR;
if (nc_put_var_int(henry_vii_id, varid, data_out)) ERR;
-
+
/* Done! */
if (nc_close(ncid)) ERR;
/* Reopen the file. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
/* Check the file. */
if (nc_inq_grps(ncid, &num_grps, &henry_vii_id)) ERR;
@@ -687,7 +688,7 @@ main(int argc, char **argv)
if (num_grps != 0) ERR;
if (nc_inq(henry_vii_id, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != 0 || nvars_in != 1 || natts_in != 0 || unlimdimid_in != -1) ERR;
- if (nc_inq_var(henry_vii_id, 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(henry_vii_id, 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_INT || ndims_in != 1 ||
dimids_in[0] != dimid || natts_in != 0) ERR;
@@ -738,7 +739,7 @@ main(int argc, char **argv)
if (nc_def_grp(tudor_id, HENRY_VII, &henry_vii_id)) ERR;
if (nc_def_var(henry_vii_id, VAR1_NAME, NC_INT, 1, &dimid, &varid)) ERR;
if (nc_put_var_int(henry_vii_id, varid, data_out)) ERR;
-
+
/* Define a MARGARET group. */
if (nc_def_grp(tudor_id, MARGARET, &margaret_id)) ERR;
if (nc_def_var(margaret_id, VAR1_NAME, NC_INT, 1, &dimid, &varid)) ERR;
@@ -763,7 +764,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Reopen the file. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
/* Check the file. */
if (nc_inq_grps(ncid, &num_grps, &dynasty)) ERR;
@@ -774,7 +775,7 @@ main(int argc, char **argv)
{
if (nc_inq(grpids_in[i], &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != 0 || nvars_in != 1 || natts_in != 0 || unlimdimid_in != -1) ERR;
- if (nc_inq_var(grpids_in[i], 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(grpids_in[i], 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_INT || ndims_in != 1 ||
dimids_in[0] != dimid || natts_in != 0) ERR;
@@ -818,7 +819,7 @@ main(int argc, char **argv)
dimids[0] = year_did;
dimids[1] = kingdom_did;
if (nc_def_var(henry_vii_id, VAR1_NAME, NC_UINT64, 2, dimids, &varid)) ERR;
- if (nc_inq_var(henry_vii_id, varid, name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(henry_vii_id, varid, name_in, &xtype_in, &ndims_in,
dimids_in, &natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_UINT64 || ndims_in != 2 ||
dimids_in[0] != year_did || dimids_in[1] != kingdom_did ||
@@ -826,9 +827,9 @@ main(int argc, char **argv)
/* Close the file. */
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
/* Find our group. */
if (nc_inq_grps(ncid, &numgrps, grpids_in)) ERR;
@@ -837,14 +838,14 @@ main(int argc, char **argv)
if (nc_inq_grps(parent_id, &numgrps, grpids_in)) ERR;
if (numgrps != 1) ERR;
henry_vii_id = grpids_in[0];
- if (nc_inq_var(henry_vii_id, varid, name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(henry_vii_id, varid, name_in, &xtype_in, &ndims_in,
dimids_in, &natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_UINT64 || ndims_in != 2 ||
dimids_in[0] != year_did || dimids_in[1] != kingdom_did ||
natts_in != 0) ERR;
/* Close the file. */
if (nc_close(ncid)) ERR;
-
+
}
SUMMARIZE_ERR;
printf("*** testing groups and unlimited dimensions...");
@@ -882,7 +883,7 @@ main(int argc, char **argv)
if (num_grps != 1) ERR;
if (nc_inq_dim(grpids_in[0], 0, name_in, &len_in)) ERR;
if (strcmp(name_in, DIM1_NAME) || len_in != DIM1_LEN) ERR;
- if (nc_inq_var(grpids_in[0], 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(grpids_in[0], 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR1_NAME) || xtype_in != NC_INT || ndims_in != 1 ||
dimids_in[0] != 0 || natts_in != 0) ERR;
@@ -910,7 +911,7 @@ main(int argc, char **argv)
int dimid, varid;
int var_dims[VAR_RANK];
int g1id, g2id, g3id;
-
+
/* Create a file with nested groups. */
if (nc_create(FILE_NAME, NC_CLOBBER | NC_NETCDF4, &ncid)) ERR;
/* At root level define dim, var, atts */
@@ -918,16 +919,16 @@ main(int argc, char **argv)
var_dims[0] = dimid;
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(ncid, varid, ATT_NAME, strlen(ATT_VAL), ATT_VAL)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
+ if (nc_put_att_text(ncid, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
GATT_VAL)) ERR;
-
+
/* put dim, var, atts with same names in a group */
if (nc_def_grp(ncid, G1_NAME, &g1id)) ERR;
if (nc_def_dim(g1id, DIM_NAME, DIM_LEN, &dimid)) ERR;
var_dims[0] = dimid;
if (nc_def_var(g1id, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(g1id, varid, ATT_NAME, strlen(ATT_VAL), ATT_VAL)) ERR;
- if (nc_put_att_text(g1id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
+ if (nc_put_att_text(g1id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
GATT_VAL)) ERR;
if (nc_enddef(g1id)) ERR;
@@ -937,17 +938,17 @@ main(int argc, char **argv)
var_dims[0] = dimid;
if (nc_def_var(g2id, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(g2id, varid, ATT_NAME, strlen(ATT_VAL), ATT_VAL)) ERR;
- if (nc_put_att_text(g2id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
+ if (nc_put_att_text(g2id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
GATT_VAL)) ERR;
if (nc_enddef(g2id)) ERR;
-
+
/* put dim, var, atts with same names in a subgroup of second group */
if (nc_def_grp(g2id, G3_NAME, &g3id)) ERR;
if (nc_def_dim(g3id, DIM_NAME, DIM_LEN, &dimid)) ERR;
var_dims[0] = dimid;
if (nc_def_var(g3id, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(g3id, varid, ATT_NAME, strlen(ATT_VAL), ATT_VAL)) ERR;
- if (nc_put_att_text(g3id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
+ if (nc_put_att_text(g3id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
GATT_VAL)) ERR;
if (nc_enddef(g3id)) ERR;
@@ -958,7 +959,7 @@ main(int argc, char **argv)
printf("*** testing nested groups, user defined types, and enddef...");
{
-#define SCI_FI "Science_Fiction"
+#define SCI_FI "Science_Fiction"
#define BASE_SIZE 2
#define TYPE_NAME "The_Blob"
#define DATE_MOVIE "data_movie"
@@ -966,7 +967,7 @@ main(int argc, char **argv)
char name_in[NC_MAX_NAME + 1];
size_t len_in;
unsigned char data[BASE_SIZE] = {42, 43}, data_in[BASE_SIZE];
-
+
/* Create a file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -992,7 +993,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Reopen and recheck. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_grp_ncid(ncid, SCI_FI, &g1id)) ERR;
if (nc_inq_user_type(g1id, xtype, name_in, &len_in, NULL, NULL, &class)) ERR;
@@ -1009,28 +1010,28 @@ main(int argc, char **argv)
{
int ncid, typeid;
int g1id, g2id, g3id;
-
+
/* Create a file with nested groups. */
if (nc_create(FILE_NAME, NC_CLOBBER | NC_NETCDF4, &ncid)) ERR;
if (nc_def_opaque(ncid, 10, "opaque-1", &typeid)) ERR;
if (nc_def_vlen(ncid, "vlen-1", NC_INT, &typeid)) ERR;
- if (nc_enddef(ncid)) ERR;
+ if (nc_enddef(ncid)) ERR;
if (nc_def_grp(ncid, G1_NAME, &g1id)) ERR;
if (nc_def_opaque(g1id, 7, "opaque-2", &typeid)) ERR;
if (nc_def_vlen(g1id, "vlen-2", NC_BYTE, &typeid)) ERR;
- if (nc_enddef(g1id)) ERR;
+ if (nc_enddef(g1id)) ERR;
if (nc_def_grp(ncid, G2_NAME, &g2id)) ERR;
if (nc_def_opaque(g2id, 4, "opaque-3", &typeid)) ERR;
if (nc_def_vlen(g2id, "vlen-3", NC_BYTE, &typeid)) ERR;
- if (nc_enddef(g2id)) ERR;
-
+ if (nc_enddef(g2id)) ERR;
+
/* put dim, var, atts with same names in a subgroup of second group */
if (nc_def_grp(g2id, G3_NAME, &g3id)) ERR;
if (nc_def_opaque(g3id, 13, "opaque-4", &typeid)) ERR;
if (nc_def_vlen(g3id, "vlen-4", NC_BYTE, &typeid)) ERR;
- if (nc_enddef(g3id)) ERR;
+ if (nc_enddef(g3id)) ERR;
if (nc_close(ncid)) ERR;
@@ -1044,11 +1045,11 @@ main(int argc, char **argv)
printf("*** creating file with lots of groups...");
{
#define PARENT_NUM_GRPS 6
-#define SUB_NUM_GRPS 2
+#define SUB_NUM_GRPS 2
int ncid, g1id, sub_grpid, num_grps, g, s;
char grp_name[NC_MAX_NAME + 1];
-
+
/* Create a file with lots of groups. */
if (nc_create(FILE_NAME, NC_CLOBBER | NC_NETCDF4, &ncid)) ERR;
for (g = 0; g < PARENT_NUM_GRPS; g++)
@@ -1084,12 +1085,12 @@ main(int argc, char **argv)
size_t nfields;
char name[NC_MAX_NAME + 1];
size_t size;
- struct s1
+ struct s1
{
int i1;
int i2;
};
- struct s2
+ struct s2
{
int i3;
double f1;
@@ -1097,7 +1098,7 @@ main(int argc, char **argv)
struct s1 data;
struct s2 data2;
- /* Create some phony data. */
+ /* Create some phony data. */
data.i1 = 5;
data.i2 = 10;
data2.i3 = 50;
@@ -1110,9 +1111,9 @@ main(int argc, char **argv)
if (nc_def_compound(ncid, sizeof(struct s1), CMP1_NAME, &typeid)) ERR;
if (nc_inq_compound(ncid, typeid, name, &size, &nfields)) ERR;
if (size != sizeof(struct s1) || strcmp(name, CMP1_NAME) || nfields) ERR;
- if (nc_insert_compound(ncid, typeid, "i1",
+ if (nc_insert_compound(ncid, typeid, "i1",
NC_COMPOUND_OFFSET(struct s1, i1), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid, "i2",
+ if (nc_insert_compound(ncid, typeid, "i2",
NC_COMPOUND_OFFSET(struct s1, i2), NC_INT)) ERR;
/* Create variable with compound datatype #1, in root group */
@@ -1132,9 +1133,9 @@ main(int argc, char **argv)
if (nc_def_compound(ncid, sizeof(struct s2), CMP2_NAME, &typeid2)) ERR;
if (nc_inq_compound(ncid, typeid2, name, &size, &nfields)) ERR;
if (size != sizeof(struct s2) || strcmp(name, CMP2_NAME) || nfields) ERR;
- if (nc_insert_compound(ncid, typeid2, "i3",
+ if (nc_insert_compound(ncid, typeid2, "i3",
NC_COMPOUND_OFFSET(struct s2, i3), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid2, "f1",
+ if (nc_insert_compound(ncid, typeid2, "f1",
NC_COMPOUND_OFFSET(struct s2, f1), NC_DOUBLE)) ERR;
/* Create variable with compound datatype #2, in root group */
@@ -1155,4 +1156,3 @@ main(int argc, char **argv)
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_grps2.c b/nc_test4/tst_grps2.c
index efed9bc..297fb1f 100644
--- a/nc_test4/tst_grps2.c
+++ b/nc_test4/tst_grps2.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_grps.nc"
@@ -56,7 +57,7 @@ main(int argc, char **argv)
if (nc_def_var(henry_vii_id, VAR_NAME1, NC_INT64, NDIMS_IN_VAR, &dimid1, &varid1)) ERR;
if (nc_def_var(henry_vii_id, VAR_NAME2, NC_INT64, NDIMS_IN_VAR, &dimid1, &varid2)) ERR;
if (nc_def_var(henry_vii_id, VAR_NAME3, NC_INT64, NDIMS_IN_VAR, &dimid2, &varid3)) ERR;
-
+
/* Check it out. Find the group by name. */
if (nc_inq_ncid(ncid, HENRY_VII, &grpid_in)) ERR;
@@ -201,4 +202,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_h4_lendian.c b/nc_test4/tst_h4_lendian.c
index f7128fe..e610e6b 100644
--- a/nc_test4/tst_h4_lendian.c
+++ b/nc_test4/tst_h4_lendian.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <unistd.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
#include "mfhdf.h"
diff --git a/nc_test4/tst_h_atts2.c b/nc_test4/tst_h_atts2.c
index 47164b5..7c40520 100644
--- a/nc_test4/tst_h_atts2.c
+++ b/nc_test4/tst_h_atts2.c
@@ -11,6 +11,7 @@
$Id: tst_h_atts2.c,v 1.18 2009/07/03 13:07:14 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#define FILE_NAME "tst_h_atts2.h5"
@@ -105,7 +106,7 @@ main()
/* Now getting another copy of the native typeid will fail! WTF? */
if ((file_typeid2 = H5Aget_type(attid)) < 0) ERR;
if ((native_typeid2 = H5Tget_native_type(file_typeid, H5T_DIR_DEFAULT)) < 0) ERR;
-
+
/* Close the attribute. */
if (H5Aclose(attid) < 0) ERR;
diff --git a/nc_test4/tst_h_files3.c b/nc_test4/tst_h_files3.c
index 4ca4ca8..1131884 100644
--- a/nc_test4/tst_h_files3.c
+++ b/nc_test4/tst_h_files3.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_h_files3.c,v 1.2 2010/02/05 17:06:28 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <unistd.h>
#include <time.h>
@@ -26,7 +27,7 @@ get_mem_used2(int *mem_used)
{
char buf[30];
FILE *pf;
-
+
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
pf = fopen(buf, "r");
if (pf) {
@@ -37,7 +38,7 @@ get_mem_used2(int *mem_used)
unsigned lib;/* library */
unsigned data;/* data/stack */
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
- fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
+ fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = data;
}
@@ -75,7 +76,7 @@ main(int argc, char **argv)
/* if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; */
/* if ((fileid = H5Fopen(FILE_NAME2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) ERR; */
/* if ((grpid = H5Gopen(fileid, "/")) < 0) ERR; */
-
+
/* if ((datasetid = H5Dopen2(grpid, obj_name2, H5P_DEFAULT)) < 0) ERR; */
/* num_scales = H5DSget_num_scales(datasetid, 0); */
@@ -143,7 +144,7 @@ main(int argc, char **argv)
/* H5F_LIBVER_LATEST) < 0) ERR; */
/* if ((fileid = H5Fopen(FILE_NAME2, H5F_ACC_RDONLY, fapl_id)) < 0) ERR; */
/* if ((grpid = H5Gopen(fileid, "/")) < 0) ERR; */
-
+
/* if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; */
/* if (num_obj > MAX_OBJ) ERR; */
/* for (i = 0; i < num_obj; i++) */
@@ -195,7 +196,7 @@ main(int argc, char **argv)
/* if (H5Pclose(access_pid)) ERR; */
/* if (H5Sclose(spaceid)) ERR; */
/* } */
-
+
/* get_mem_used2(&mem_used1); */
/* /\* Close everything. *\/ */
diff --git a/nc_test4/tst_h_many_atts.c b/nc_test4/tst_h_many_atts.c
index 9cb42a1..ac23989 100644
--- a/nc_test4/tst_h_many_atts.c
+++ b/nc_test4/tst_h_many_atts.c
@@ -9,6 +9,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include <hdf5.h>
#include <H5DSpublic.h>
@@ -52,11 +53,11 @@ main()
for (i = 0; i < NUM_ATTS; i++)
{
sprintf(name, "att_%d", i);
- if ((attid1 = H5Acreate2(grpid, name, H5T_NATIVE_INT, spaceid,
+ if ((attid1 = H5Acreate2(grpid, name, H5T_NATIVE_INT, spaceid,
H5P_DEFAULT, H5P_DEFAULT)) < 0) ERR;
if (H5Awrite(attid1, H5T_NATIVE_INT, &one) < 0) ERR;
/* if (H5Aclose(attid1) < 0) ERR;*/
- if((i + 1) % 1000 == 0)
+ if((i + 1) % 1000 == 0)
{ /* only print every 1000th attribute name */
if (gettimeofday(&end_time, NULL)) ERR;
if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;
diff --git a/nc_test4/tst_h_scalar.c b/nc_test4/tst_h_scalar.c
index f455bf8..8853f2a 100644
--- a/nc_test4/tst_h_scalar.c
+++ b/nc_test4/tst_h_scalar.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#define FILE_NAME "tst_h_scalar.h5"
@@ -32,7 +33,7 @@ add_attrs(hid_t objid)
/* Create scalar dataspace */
if ((scalar_spaceid = H5Screate(H5S_SCALAR)) < 0) ERR_GOTO;
-
+
/* Create string datatypes */
if ((vlstr_typeid = H5Tcreate(H5T_STRING, (size_t)H5T_VARIABLE)) < 0) ERR_GOTO;
if ((fixstr_typeid = H5Tcreate(H5T_STRING, (size_t)10)) < 0) ERR_GOTO;
@@ -193,10 +194,10 @@ main()
if ((fcplid = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
if (H5Pset_link_creation_order(fcplid, H5P_CRT_ORDER_TRACKED) < 0) ERR;
if (H5Pset_attr_creation_order(fcplid, H5P_CRT_ORDER_TRACKED) < 0) ERR;
-
+
/* Create new file, using default properties */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcplid, H5P_DEFAULT)) < 0) ERR;
-
+
/* Close file creation property list */
if (H5Pclose(fcplid) < 0) ERR;
@@ -212,7 +213,7 @@ main()
if ((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if (H5Pset_attr_creation_order(dcplid, H5P_CRT_ORDER_TRACKED) < 0) ERR;
-
+
/* Create scalar dataset with VL string datatype */
if ((dsetid = H5Dcreate2(fileid, VSTR_VAR1_NAME, vlstr_typeid, scalar_spaceid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0) ERR;
@@ -328,7 +329,7 @@ main()
char *vlstr;
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
-
+
/* Write to the VL string variable */
if (nc_inq_varid(ncid, VSTR_VAR1_NAME, &varid)) ERR;
vlstr = NULL;
@@ -378,4 +379,3 @@ main()
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_hdf5_file_compat.c b/nc_test4/tst_hdf5_file_compat.c
index ff9e915..51a3ae6 100644
--- a/nc_test4/tst_hdf5_file_compat.c
+++ b/nc_test4/tst_hdf5_file_compat.c
@@ -22,6 +22,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
@@ -45,13 +46,13 @@ int main(int argc, char **argv) {
{
printf("Testing %s\n",FILE_NAME2);
- if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME2, NC_NOWRITE, &ncid)) ERR;
if (nc_close(ncid)) ERR;
}
{
printf("Testing %s\n",FILE_NAME3);
- if (nc_open(FILE_NAME1, NC_NOWRITE, &ncid)) ERR;
+ if (nc_open(FILE_NAME3, NC_NOWRITE, &ncid)) ERR;
if (nc_close(ncid)) ERR;
}
diff --git a/nc_test4/tst_interops.c b/nc_test4/tst_interops.c
index ad3965d..0050bf7 100644
--- a/nc_test4/tst_interops.c
+++ b/nc_test4/tst_interops.c
@@ -8,6 +8,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
@@ -28,11 +29,11 @@
#define ATT_NAME "song"
#define NEW_FLOAT 1.0
-void
-printRes(const char *msg, int ires)
+void
+printRes(const char *msg, int ires)
{
printf("%s: %d\n", msg, ires);
- if (ires < 0)
+ if (ires < 0)
{
printf("bad ires: %d\n", ires);
/*H5Eprint2(ires, stdout);*/
@@ -170,7 +171,7 @@ main(int argc, char **argv)
if ((typeid = H5Aget_type(attid)) < 0) ERR;
if (H5Aread(attid, typeid, song_in) < 0) ERR;
if (strcmp(song, song_in)) ERR;
-
+
/* Close up the shop. */
if (H5Tclose(typeid) < 0 ||
H5Aclose(attid) < 0 ||
@@ -208,7 +209,7 @@ main(int argc, char **argv)
if ((pres_spaceid = H5Screate_simple(DIMS_2, dims, dims)) < 0) ERR;
/* Create a variable. It will not have dimension scales. */
- if ((pres_datasetid = H5Dcreate(fileid, PRES_NAME, H5T_NATIVE_FLOAT,
+ if ((pres_datasetid = H5Dcreate(fileid, PRES_NAME, H5T_NATIVE_FLOAT,
pres_spaceid, H5P_DEFAULT)) < 0) ERR;
/* Ring down the curtain. */
@@ -235,7 +236,7 @@ main(int argc, char **argv)
size_t len_in;
/* Create file. */
- if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
+ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
/* Create the space for the dataset. */
@@ -244,7 +245,7 @@ main(int argc, char **argv)
if ((pres_spaceid = H5Screate_simple(DIMS_2, dims, dims)) < 0) ERR;
/* Create a variable. It will not have dimension scales. */
- if ((pres_datasetid = H5Dcreate(fileid, PRES_NAME, H5T_NATIVE_FLOAT,
+ if ((pres_datasetid = H5Dcreate(fileid, PRES_NAME, H5T_NATIVE_FLOAT,
pres_spaceid, H5P_DEFAULT)) < 0) ERR;
/* Ring down the curtain. */
@@ -271,7 +272,7 @@ main(int argc, char **argv)
size_t len_in;
/* Create file. */
- if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
+ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
/* Create the space for the datasets. */
@@ -280,9 +281,9 @@ main(int argc, char **argv)
if ((spaceid = H5Screate_simple(DIMS_2, dims, dims)) < 0) ERR;
/* Create two datasets. They will not have dimension scales. */
- if ((pres_datasetid = H5Dcreate(fileid, PRES_NAME, H5T_NATIVE_FLOAT,
+ if ((pres_datasetid = H5Dcreate(fileid, PRES_NAME, H5T_NATIVE_FLOAT,
spaceid, H5P_DEFAULT)) < 0) ERR;
- if ((temp_datasetid = H5Dcreate(fileid, TEMP_NAME, H5T_NATIVE_FLOAT,
+ if ((temp_datasetid = H5Dcreate(fileid, TEMP_NAME, H5T_NATIVE_FLOAT,
spaceid, H5P_DEFAULT)) < 0) ERR;
/* Ring down the curtain. */
@@ -318,16 +319,16 @@ main(int argc, char **argv)
int i;
/* Create file. */
- if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
+ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
if (H5Tset_size(typeid, MAX_LEN + 1) < 0) ERR;
-
+
/* Write an attribute of this (string) type. */
if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR;
- if ((attid = H5Acreate(fileid, ATT_NAME2, typeid, spaceid,
+ if ((attid = H5Acreate(fileid, ATT_NAME2, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
if (H5Awrite(attid, typeid, data) < 0) ERR;
@@ -374,7 +375,7 @@ main(int argc, char **argv)
if (H5Aclose(attid) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
-
+
/* Read the data with netCDF. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
@@ -445,4 +446,3 @@ main(int argc, char **argv)
/* SUMMARIZE_ERR; */
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_interops2.c b/nc_test4/tst_interops2.c
index 24f06ef..412878c 100644
--- a/nc_test4/tst_interops2.c
+++ b/nc_test4/tst_interops2.c
@@ -6,6 +6,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
#include <mfhdf.h>
@@ -47,14 +48,14 @@ main(int argc, char **argv)
if (SDend(sd_id)) ERR;
/* Now open with netCDF and check the contents. */
- if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
- if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
+ if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+ if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
if (ndims_in != 2 || nvars_in != 1 || natts_in != 0 || unlimdim_in != -1) ERR;
if (nc_inq_dim(ncid, 0, NULL, &len_in)) ERR;
if (len_in != LAT_LEN) ERR;
if (nc_inq_dim(ncid, 1, NULL, &len_in)) ERR;
if (len_in != LON_LEN) ERR;
-
+
/* Read the data through a vara function from the netCDF API. */
if (nc_get_vara(ncid, 0, nstart, ncount, data_in)) ERR;
for (i = 0; i < LAT_LEN; i++)
@@ -96,7 +97,7 @@ main(int argc, char **argv)
if (scalar_data_in != data_out[i][j]) ERR;
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
printf("*** testing with a more complex HDF4 file...");
@@ -113,11 +114,11 @@ main(int argc, char **argv)
int ncid, nvars_in, ndims_in, natts_in, unlimdim_in;
size_t len_in;
nc_type type_in;
- int hdf4_type[NUM_TYPES] = {DFNT_FLOAT32, DFNT_FLOAT64,
- DFNT_INT8, DFNT_UINT8, DFNT_INT16,
+ int hdf4_type[NUM_TYPES] = {DFNT_FLOAT32, DFNT_FLOAT64,
+ DFNT_INT8, DFNT_UINT8, DFNT_INT16,
DFNT_UINT16, DFNT_INT32, DFNT_UINT32};
- int netcdf_type[NUM_TYPES] = {NC_FLOAT, NC_DOUBLE,
- NC_BYTE, NC_UBYTE, NC_SHORT,
+ int netcdf_type[NUM_TYPES] = {NC_FLOAT, NC_DOUBLE,
+ NC_BYTE, NC_UBYTE, NC_SHORT,
NC_USHORT, NC_INT, NC_UINT};
char tmp_name[NC_MAX_NAME + 1], name_in[NC_MAX_NAME + 1];
char dim_name[NC_MAX_NAME + 1][DIMS_3] = {"z", "y", "x"};
@@ -130,8 +131,8 @@ main(int argc, char **argv)
for (t = 0; t < NUM_TYPES; t++)
{
sprintf(tmp_name, "hdf4_dataset_type_%d", t);
- if ((sds_id = SDcreate(sd_id, tmp_name, hdf4_type[t],
- DIMS_3, dim_size)) == FAIL) ERR;
+ if ((sds_id = SDcreate(sd_id, tmp_name, hdf4_type[t],
+ DIMS_3, dim_size)) == FAIL) ERR;
/* Set up dimensions. By giving them the same names for each
* dataset, I am specifying that they are shared
* dimensions. */
@@ -157,16 +158,15 @@ main(int argc, char **argv)
if (len_in != X_LEN) ERR;
for (t = 0; t < NUM_TYPES; t++)
{
- if (nc_inq_var(ncid, t, name_in, &type_in, &ndims_in,
+ if (nc_inq_var(ncid, t, name_in, &type_in, &ndims_in,
dimids_in, &natts_in)) ERR;
if (type_in != netcdf_type[t] || ndims_in != DIMS_3 ||
- dimids_in[0] != 0 || dimids_in[2] != 2 || dimids_in[2] != 2 ||
+ dimids_in[0] != 0 || dimids_in[2] != 2 || dimids_in[2] != 2 ||
natts_in != 0) ERR;
}
-
+
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_interops3.c b/nc_test4/tst_interops3.c
index b28bb41..b1a0c8f 100644
--- a/nc_test4/tst_interops3.c
+++ b/nc_test4/tst_interops3.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <mfhdf.h>
#define FILE_NAME "tst_interops2.h4"
@@ -21,14 +22,14 @@ main(int argc, char **argv)
#define NUM_SAMPLE_FILES 5
int ncid;
int nvars_in, ndims_in, natts_in, unlimdim_in;
- char file_name[NUM_SAMPLE_FILES][NC_MAX_NAME + 1] = {"AMSR_E_L2_Rain_V10_200905312326_A.hdf",
+ char file_name[NUM_SAMPLE_FILES][NC_MAX_NAME + 1] = {"AMSR_E_L2_Rain_V10_200905312326_A.hdf",
"AMSR_E_L3_DailyLand_V06_20020619.hdf",
"MOD29.A2000055.0005.005.2006267200024.hdf",
"MYD29.A2002185.0000.005.2007160150627.hdf",
"MYD29.A2009152.0000.005.2009153124331.hdf"};
size_t len_in;
int f;
-
+
for (f = 0; f < NUM_SAMPLE_FILES; f++)
{
if (nc_open(file_name[f], NC_NOWRITE, &ncid)) ERR;
@@ -39,4 +40,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_interops4.c b/nc_test4/tst_interops4.c
index ef0dd7b..d655ab3 100644
--- a/nc_test4/tst_interops4.c
+++ b/nc_test4/tst_interops4.c
@@ -7,6 +7,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_interops4.nc"
#define REF_FILE_NAME "ref_tst_interops4.nc"
@@ -14,7 +15,7 @@
#define NUM_DIMS 1
#define NUM_ATTS 20
#define NUM_VARS 20
-#define ATT_LEN 30
+#define ATT_LEN 30
#define VAR_LEN 4
int att_data[ATT_LEN];
@@ -29,7 +30,7 @@ write_atts(int ncid, int varid)
for (a = 0; a < NUM_ATTS; a++)
{
sprintf(att_name, "att_%d", a);
- if (nc_put_att_int(ncid, varid, att_name, NC_INT,
+ if (nc_put_att_int(ncid, varid, att_name, NC_INT,
ATT_LEN, att_data)) ERR_RET;
}
return NC_NOERR;
@@ -45,11 +46,11 @@ read_atts(int ncid, int varid)
for (a = 0; a < NUM_ATTS; a++)
{
sprintf(att_name, "att_%d", a);
- if (nc_get_att_int(ncid, varid, att_name,
+ if (nc_get_att_int(ncid, varid, att_name,
att_data_in)) ERR_RET;
for (i = 0; i < ATT_LEN; i++)
if (att_data_in[i] != att_data[i]) ERR_RET;
-
+
}
return NC_NOERR;
}
@@ -67,10 +68,10 @@ write_vars(int ncid)
for (v = 0; v < NUM_VARS; v++)
{
sprintf(var_name, "var_%d", v);
- if (nc_def_var(ncid, var_name, NC_INT, NUM_DIMS,
+ if (nc_def_var(ncid, var_name, NC_INT, NUM_DIMS,
dimid, NULL)) ERR_RET;
write_atts(ncid, v);
- if (nc_put_var_int(ncid, v, var_data)) ERR;
+ if (nc_put_var_int(ncid, v, var_data)) ERR;
}
return NC_NOERR;
}
@@ -86,16 +87,16 @@ read_vars(int ncid)
for (v = 0; v < NUM_VARS; v++)
{
- if (nc_inq_var(ncid, v, var_name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(ncid, v, var_name_in, &xtype_in, &ndims_in,
NULL, &natts_in)) ERR_RET;
sprintf(var_name, "var_%d", v);
- if (strcmp(var_name, var_name_in) || xtype_in != NC_INT ||
+ if (strcmp(var_name, var_name_in) || xtype_in != NC_INT ||
ndims_in != NUM_DIMS || natts_in != NUM_ATTS) ERR_RET;
read_atts(ncid, v);
if (nc_get_var_int(ncid, v, var_data_in)) ERR;
for (i = 0; i < VAR_LEN; i++)
if (var_data_in[i] != var_data[i]) ERR_RET;
-
+
}
return NC_NOERR;
}
@@ -115,7 +116,7 @@ main(int argc, char **argv)
att_data[i] = i;
for (i = 0; i < VAR_LEN; i++)
var_data[i] = i;
-
+
/* Create a file that will activate the bug in HDF5 1.8.4. */
if (nc_create(FILE_NAME, NC_CLOBBER|NC_NETCDF4, &ncid)) ERR;
if (write_atts(ncid, NC_GLOBAL)) ERR;
@@ -125,7 +126,7 @@ main(int argc, char **argv)
/* Open the file and check it. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
- if (ndims_in != NUM_DIMS || nvars_in != NUM_VARS ||
+ if (ndims_in != NUM_DIMS || nvars_in != NUM_VARS ||
natts_in != NUM_ATTS || unlimdim_in != -1) ERR;
if (read_atts(ncid, NC_GLOBAL)) ERR;
if (read_vars(ncid)) ERR;
@@ -152,7 +153,7 @@ main(int argc, char **argv)
printf("*** testing with file %s...", file_in);
if (nc_open(file_in, 0, &ncid)) ERR;
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
- if (ndims_in != NUM_DIMS || nvars_in != NUM_VARS ||
+ if (ndims_in != NUM_DIMS || nvars_in != NUM_VARS ||
natts_in != NUM_ATTS || unlimdim_in != -1) ERR;
if (read_atts(ncid, NC_GLOBAL)) ERR;
if (read_vars(ncid)) ERR;
@@ -161,4 +162,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_interops5.c b/nc_test4/tst_interops5.c
index b81a79c..3869106 100644
--- a/nc_test4/tst_interops5.c
+++ b/nc_test4/tst_interops5.c
@@ -6,6 +6,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
@@ -31,7 +32,7 @@ main(int argc, char **argv)
hsize_t yscaleDims[1];
hid_t xdimSpaceId, spaceId;
hid_t fileId;
- hid_t fapl;
+ hid_t fapl;
hsize_t curDims[2];
hsize_t maxDims[2];
hid_t dataTypeId, dsPropertyId, grpaId, grpaPropId, dsId;
@@ -53,8 +54,8 @@ main(int argc, char **argv)
if (H5Pset_fclose_degree(fapl, H5F_CLOSE_SEMI)) ERR;
/* Create file */
- if((fileId = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC,
- H5Pcreate(H5P_FILE_CREATE), fapl)) < 0) ERR;
+ if((fileId = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC,
+ H5Pcreate(H5P_FILE_CREATE), fapl)) < 0) ERR;
if (H5Pclose(fapl) < 0) ERR;
/* Create data space */
@@ -69,30 +70,30 @@ main(int argc, char **argv)
if ((dsPropertyId = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if ((grpaPropId = H5Pcreate(H5P_GROUP_CREATE)) < 0) ERR;
- if ((grpaId = H5Gcreate2(fileId, GRPA_NAME, H5P_DEFAULT,
+ if ((grpaId = H5Gcreate2(fileId, GRPA_NAME, H5P_DEFAULT,
grpaPropId, H5P_DEFAULT)) < 0) ERR;
if (H5Pclose(grpaPropId) < 0) ERR;
/* Create vara dataset */
- if ((dsId = H5Dcreate2(fileId, varaName, dataTypeId, spaceId,
- H5P_DEFAULT, dsPropertyId,
- H5P_DEFAULT)) < 0) ERR;
+ if ((dsId = H5Dcreate2(fileId, varaName, dataTypeId, spaceId,
+ H5P_DEFAULT, dsPropertyId,
+ H5P_DEFAULT)) < 0) ERR;
if (H5Pclose(dsPropertyId) < 0) ERR;
if (H5Tclose(dataTypeId) < 0) ERR;
- if ((ydimSpaceId = H5Screate_simple(1, yscaleDims, NULL)) < 0) ERR;
+ if ((ydimSpaceId = H5Screate_simple(1, yscaleDims, NULL)) < 0) ERR;
/* Create xdim dimension dataset */
- if ((xdimId = H5Dcreate2(fileId, "/xdim", H5T_IEEE_F32BE,
+ if ((xdimId = H5Dcreate2(fileId, "/xdim", H5T_IEEE_F32BE,
xdimSpaceId, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0) ERR;
+ H5P_DEFAULT)) < 0) ERR;
if (H5Sclose(xdimSpaceId) < 0) ERR;
/* Create ydim dimension dataset */
if ((ydimId = H5Dcreate2(fileId, "/ydim", H5T_IEEE_F32BE,
ydimSpaceId, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0) ERR;
+ H5P_DEFAULT)) < 0) ERR;
if (H5Sclose(ydimSpaceId) < 0) ERR;
/* Create xdim scale */
@@ -117,8 +118,8 @@ main(int argc, char **argv)
if (H5Fclose(fileId) < 0) ERR;
/* Create some data */
- for (ii = 0; ii < nrowCur; ii++)
- for (jj = 0; jj < ncolCur; jj++)
+ for (ii = 0; ii < nrowCur; ii++)
+ for (jj = 0; jj < ncolCur; jj++)
amat[ii][jj] = 100 * ii + jj;
/* Re-open file */
@@ -127,13 +128,13 @@ main(int argc, char **argv)
if ((dsId = H5Dopen2(grpaId, varaName, H5P_DEFAULT)) < 0) ERR;
/* Write dataset */
- if (H5Dwrite(dsId, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ if (H5Dwrite(dsId, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
amat) < 0) ERR;
/* Write dimension values for both xdim, ydim */
{
short xydimMat[ nrowCur >= ncolCur ? nrowCur : ncolCur];
- for (ii = 0; ii < nrowCur; ii++)
+ for (ii = 0; ii < nrowCur; ii++)
xydimMat[ii] = 0; /*#### 100 * ii; */
/* Write xdim */
@@ -168,11 +169,11 @@ main(int argc, char **argv)
if (nc_inq(grpid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (ndims != 0 || nvars != 1 || ngatts != 0 || unlimdimid != -1) ERR;
- if (nc_inq_var(grpid, 0, name_in, &xtype_in, &ndims_in, dimid_in,
+ if (nc_inq_var(grpid, 0, name_in, &xtype_in, &ndims_in, dimid_in,
&natts_in)) ERR;
if (strcmp(name_in, VAR_NAME) || xtype_in != NC_SHORT || ndims_in != NDIMS ||
dimid_in[0] != 0 || dimid_in[1] != 1 || natts_in != 0) ERR;
-
+
if (nc_close(ncid)) ERR;
}
}
@@ -182,7 +183,7 @@ main(int argc, char **argv)
{
#define DEFLATE_LEVEL 9
-#define MAX_NAME 100
+#define MAX_NAME 100
#define NUM_CD_ELEM 10
/* HDF5 defines this... */
#define DEFLATE_NAME "deflate"
@@ -208,21 +209,21 @@ main(int argc, char **argv)
for (i = 0; i < DIM1_LEN; i++)
data_out[i] = i;
-
+
/* Open file and create group. */
- if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
+ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR;
-
+
/* Write an array of bools, with szip compression. */
if ((propid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if (H5Pset_layout(propid, H5D_CHUNKED)) ERR;
if (H5Pset_chunk(propid, 1, dims)) ERR;
if (H5Pset_szip(propid, H5_SZIP_EC_OPTION_MASK, 32)) ERR;
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
- if ((datasetid = H5Dcreate(grpid, BATTLE_RECORD, H5T_NATIVE_INT,
+ if ((datasetid = H5Dcreate(grpid, BATTLE_RECORD, H5T_NATIVE_INT,
spaceid, propid)) < 0) ERR;
- if (H5Dwrite(datasetid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ if (H5Dwrite(datasetid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data_out) < 0) ERR;
if (H5Dclose(datasetid) < 0 ||
H5Pclose(propid) < 0 ||
@@ -250,7 +251,7 @@ main(int argc, char **argv)
if (nc_get_var(grpid, 0, data_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
if (data_in[i] != data_out[i]) ERR;
-
+
if (nc_close(ncid)) ERR;
}
@@ -258,4 +259,3 @@ main(int argc, char **argv)
#endif /* USE_SZIP */
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_interops6.c b/nc_test4/tst_interops6.c
index 2721ab2..ef92219 100644
--- a/nc_test4/tst_interops6.c
+++ b/nc_test4/tst_interops6.c
@@ -8,6 +8,7 @@
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#include <H5DSpublic.h>
@@ -32,7 +33,7 @@ main(int argc, char **argv)
/* Create create property list. */
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
-
+
/* Set H5P_CRT_ORDER_TRACKED in the creation property list. This
* turns on HDF5 creation ordering in the file. */
if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
@@ -41,17 +42,17 @@ main(int argc, char **argv)
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
/* Open file. */
- if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id,
+ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id,
H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR;
-
+
/* Create string type. */
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
if (H5Tset_size(typeid, H5T_VARIABLE) < 0) ERR;
-
+
/* Write an attribute of this type. */
if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
- if ((attid = H5Acreate(grpid, ATT_NAME, typeid, spaceid,
+ if ((attid = H5Acreate(grpid, ATT_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
if (H5Awrite(attid, typeid, &data) < 0) ERR;
@@ -62,14 +63,14 @@ main(int argc, char **argv)
if (H5Gclose(grpid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
if (H5Pclose(fcpl_id) < 0) ERR;
-
+
/* Now reopen the file and check it out. */
if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gopen(fileid, "/")) < 0) ERR;
if ((attid = H5Aopen_name(grpid, ATT_NAME)) < 0) ERR;
if ((typeid = H5Aget_type(attid)) < 0) ERR;
if ((spaceid = H5Aget_space(attid)) < 0) ERR;
-
+
/* Given this type id, how would we know this is a string
* attribute? */
if ((class = H5Tget_class(typeid)) < 0)
@@ -80,7 +81,7 @@ main(int argc, char **argv)
/* Make sure this is a scalar. */
if (H5Sget_simple_extent_type(spaceid) != H5S_SCALAR) ERR;
-
+
/* Read the attribute. */
if (H5Aread(attid, typeid, &data_in) < 0) ERR;
@@ -117,7 +118,7 @@ main(int argc, char **argv)
/* Create create property list. */
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
-
+
/* Set H5P_CRT_ORDER_TRACKED in the creation property list. This
* turns on HDF5 creation ordering in the file. */
if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
@@ -126,27 +127,27 @@ main(int argc, char **argv)
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
/* Create the file, open root group. */
- if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id,
+ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id,
H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR;
-
+
/* Create string type. */
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
if (H5Tset_size(typeid, strlen(data) + 1) < 0) ERR;
-
+
/* Create a scalar space. */
if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
/* Write an scalar dataset of this type. */
if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
/* if (H5Pset_fill_value(plistid, typeid, &empty) < 0) ERR;*/
- if ((datasetid = H5Dcreate2(grpid, VAR_NAME, typeid, spaceid,
+ if ((datasetid = H5Dcreate2(grpid, VAR_NAME, typeid, spaceid,
H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0) ERR;
- if (H5Dwrite(datasetid, typeid, spaceid, spaceid, H5P_DEFAULT,
+ if (H5Dwrite(datasetid, typeid, spaceid, spaceid, H5P_DEFAULT,
data) < 0) ERR;
/* Close up. */
- if (H5Dclose(datasetid) < 0) ERR;
+ if (H5Dclose(datasetid) < 0) ERR;
if (H5Pclose(plistid) < 0) ERR;
if (H5Pclose(fcpl_id) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
@@ -201,7 +202,7 @@ main(int argc, char **argv)
/* /\* Create file access and create property lists. *\/ */
/* if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; */
/* if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR; */
-
+
/* /\* Set latest_format in access propertly list. This ensures that */
/* * the latest, greatest, HDF5 versions are used in the file. *\/ */
/* if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR; */
@@ -216,11 +217,11 @@ main(int argc, char **argv)
/* /\* Create the file, open root group. *\/ */
/* if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR; */
/* if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; */
-
+
/* /\* Create string type. *\/ */
/* if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR; */
/* if (H5Tset_size(typeid, strlen(data) + 1) < 0) ERR; */
-
+
/* /\* Create a scalar space. *\/ */
/* if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR; */
@@ -256,4 +257,3 @@ main(int argc, char **argv)
/* SUMMARIZE_ERR; */
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_knmi.c b/nc_test4/tst_knmi.c
index 3a6d774..b66e579 100644
--- a/nc_test4/tst_knmi.c
+++ b/nc_test4/tst_knmi.c
@@ -1,12 +1,13 @@
/** \file
Performance test from KNMI.
-
+
Copyright 2009, UCAR/Unidata. See \ref copyright file for copying and
redistribution conditions.
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
@@ -38,7 +39,7 @@ complain(int stat)
return stat;
}
-static int
+static int
read_file(char *filename)
{
#define CWP "cwp"
@@ -73,7 +74,7 @@ read_file(char *filename)
return 0;
}
-int
+int
main(int argc, char **argv)
{
int c, header = 0, verbose = 0, timeseries = 0;
@@ -91,10 +92,9 @@ main(int argc, char **argv)
struct timeval start_time, end_time, diff_time;
printf("\n*** Testing netcdf-4 vs. netcdf-3 performance.\n");
- if (complain(read_file(FILE_NAME_1))) ERR;
- if (complain(read_file(FILE_NAME_2))) ERR;
+ if (complain(read_file(FILE_NAME_1))) ERR;
+ if (complain(read_file(FILE_NAME_2))) ERR;
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_large.c b/nc_test4/tst_large.c
index 3d37fda..0a069c1 100644
--- a/nc_test4/tst_large.c
+++ b/nc_test4/tst_large.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_large.c,v 1.5 2009/05/18 10:26:24 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#include "ncdispatch.h"
@@ -32,7 +33,7 @@ main(int argc, char **argv)
int j;
/* Create phony data. */
- for (j = 0; j < DIM2; j++)
+ for (j = 0; j < DIM2; j++)
vals[j] = 9 * (j + 11); /* note vals[j] is 99 when j==0 */
/* Create file with 2 dims and one var. */
@@ -61,5 +62,3 @@ main(int argc, char **argv)
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_large2.c b/nc_test4/tst_large2.c
index 0a683fc..dd22b53 100644
--- a/nc_test4/tst_large2.c
+++ b/nc_test4/tst_large2.c
@@ -9,6 +9,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_large2.nc"
@@ -35,11 +36,11 @@ int main(int argc, char **argv)
char file_name[NC_MAX_NAME * 2 + 1];
float *data;
int this_format[NUM_FORMATS] = {NC_64BIT_OFFSET, NC_NETCDF4};
- char format_name[NUM_FORMATS][NC_MAX_NAME + 1] =
+ char format_name[NUM_FORMATS][NC_MAX_NAME + 1] =
{"64-bit offset", "netCDF-4"};
int i, j, f;
- printf("sizes: int - %d, size_t - %d, and int * - %d\n",
+ printf("sizes: int - %d, size_t - %d, and int * - %d\n",
sizeof(int), sizeof(size_t), sizeof(int *));
/* Allocate room for one slab of data. */
@@ -80,9 +81,9 @@ int main(int argc, char **argv)
for (i = 0; i < LAT_LEN; i++)
for (j = 0; j < LON_LEN; j++)
{
- if (data[j + LON_LEN * i] != (start[0] + i + j) % 19)
+ if (data[j + LON_LEN * i] != (start[0] + i + j) % 19)
{
- printf("error on start[0]: %d i: %d j: %d expected %d got %g\n",
+ printf("error on start[0]: %d i: %d j: %d expected %d got %g\n",
start[0], i, j, (start[0] + i + j), data[j + LON_LEN * i]);
ERR_RET;
}
@@ -99,5 +100,3 @@ int main(int argc, char **argv)
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_mem.c b/nc_test4/tst_mem.c
index 4c32beb..fcfec9e 100644
--- a/nc_test4/tst_mem.c
+++ b/nc_test4/tst_mem.c
@@ -2,13 +2,14 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test internal netcdf-4 file code.
+ Test internal netcdf-4 file code.
$Id$
*/
#include <config.h>
#include <stdio.h>
#include <nc_tests.h>
+#include <err_macros.h>
#include "netcdf.h"
#include <hdf5.h>
#include <unistd.h>
@@ -27,7 +28,7 @@ get_mem_used2(int *mem_used)
{
char buf[30];
FILE *pf;
-
+
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
pf = fopen(buf, "r");
if (pf) {
@@ -38,7 +39,7 @@ get_mem_used2(int *mem_used)
unsigned lib;/* library */
unsigned data;/* data/stack */
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
- fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
+ fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = data;
}
@@ -58,14 +59,14 @@ int main(void)
printf("\n*** Testing netcdf-4 memory use with unlimited dimensions.\n");
printf("*** testing with user-contributed code...");
-
+
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, TIME_NAME, NC_UNLIMITED, &dimid)) ERR;
if (nc_def_var(ncid, SFC_TEMP_NAME, NC_FLOAT, NDIMS, &dimid, &sfc_tempid)) ERR;
/* Write data each 100ms*/
get_mem_used2(&mem_used);
- for (i = 0; i < NUM_TRIES; i++)
+ for (i = 0; i < NUM_TRIES; i++)
{
data = 25.5 + l_index[0];
if (nc_put_var1_float(ncid, sfc_tempid, l_index, (const float*) &data)) ERR;
diff --git a/nc_test4/tst_mode.c b/nc_test4/tst_mode.c
index 24594c8..a5f31b8 100644
--- a/nc_test4/tst_mode.c
+++ b/nc_test4/tst_mode.c
@@ -1,10 +1,11 @@
/**
- * @file
+ * @file
* Test some illegal mode combinations
*
*/
#include "nc_tests.h"
+#include "err_macros.h"
#include "netcdf_par.h"
#define FILE_NAME "tst_mode.nc"
@@ -13,7 +14,7 @@ int
main(int argc, char** argv)
{
int ncid,varid;
- int retval;
+ int retval;
printf("\n*** Testing illegal mode combinations\n");
@@ -38,4 +39,3 @@ main(int argc, char** argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_mpi_parallel.c b/nc_test4/tst_mpi_parallel.c
index de76c59..7323345 100644
--- a/nc_test4/tst_mpi_parallel.c
+++ b/nc_test4/tst_mpi_parallel.c
@@ -1,5 +1,5 @@
-/* This is a quickie tester for netcdf-4.
-
+/* This is a quickie tester for netcdf-4.
+
This just excersizes MPI file I/O to make sure everything's working
properly. If this doesn't work, netcdf/HDF5 parallel I/O also won't
work.
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <mpi.h>
#define FILE "tst_mpi_parallel.bin"
@@ -26,7 +27,7 @@ main(int argc, char **argv)
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
/*MPI_Get_processor_name(mpi_name, &mpi_namelen);*/
- /*printf("mpi_name: %s size: %d rank: %d\n", mpi_name,
+ /*printf("mpi_name: %s size: %d rank: %d\n", mpi_name,
mpi_size, my_rank);*/
if (my_rank == 0)
diff --git a/nc_test4/tst_nc4perf.c b/nc_test4/tst_nc4perf.c
index 3528b82..26d5efc 100644
--- a/nc_test4/tst_nc4perf.c
+++ b/nc_test4/tst_nc4perf.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright 2009, UCAR/Unidata
See COPYRIGHT file for copying and redistribution conditions.
@@ -10,6 +10,7 @@ $Id: tst_nc4perf.c,v 1.4 2009/08/19 15:58:57 ed Exp $
*/
#include "nc_tests.h"
+#include "err_macros.h"
#define FILENAME "tst_nc4perf.nc"
#define NDIMS1 2
@@ -27,9 +28,9 @@ $Id: tst_nc4perf.c,v 1.4 2009/08/19 15:58:57 ed Exp $
/* This function creates a file with 10 2D variables, no unlimited
* dimension. */
-int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm,
- MPI_Info info, int mpi_size, int mpi_rank,
- size_t *chunk_size)
+int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm,
+ MPI_Info info, int mpi_size, int mpi_rank,
+ size_t *chunk_size)
{
double starttime, endtime, write_time = 0, bandwidth = 0;
int ncid;
@@ -37,7 +38,7 @@ int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
size_t start[NDIMS1], count[NDIMS1];
float *data;
char file_name[NC_MAX_NAME + 1];
- char var_name1[NUMVARS][NC_MAX_NAME + 1] = {"GWa", "JAd", "TJe", "JMa", "JMo",
+ char var_name1[NUMVARS][NC_MAX_NAME + 1] = {"GWa", "JAd", "TJe", "JMa", "JMo",
"JQA", "AJa", "MVB", "WHH", "JTy"};
int varid1[NUMVARS];
size_t nelems_in;
@@ -61,7 +62,7 @@ int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
for (t = 0; t < NUM_TRIES; t++)
{
/* Create a netcdf-4 file, opened for parallel I/O. */
- if (nc_create_par(file_name, facc_type|NC_NETCDF4, comm,
+ if (nc_create_par(file_name, facc_type|NC_NETCDF4, comm,
info, &ncid)) ERR;
/* Create two dimensions. */
@@ -86,7 +87,7 @@ int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
count[1] = DIMSIZE1 / mpi_size;
/* start parallel netcdf4 */
- for (i = 0; i < NUMVARS; i++)
+ for (i = 0; i < NUMVARS; i++)
if (nc_var_par_access(ncid, varid1[i], access_flag)) ERR;
starttime = MPI_Wtime();
@@ -99,15 +100,15 @@ int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
if (nc_close(ncid)) ERR;
endtime = MPI_Wtime();
- if (!mpi_rank)
+ if (!mpi_rank)
{
- bandwidth += ((sizeof(float) * DIMSIZE1 * DIMSIZE2 * NUMVARS) /
+ bandwidth += ((sizeof(float) * DIMSIZE1 * DIMSIZE2 * NUMVARS) /
((endtime - starttime) * 1024 * 1024)) / NUM_TRIES;
write_time += (endtime - starttime) / NUM_TRIES;
}
}
free(data);
- if (!mpi_rank)
+ if (!mpi_rank)
{
char chunk_string[NC_MAX_NAME + 1] = "";
@@ -118,15 +119,15 @@ int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
strcat(chunk_string, "contiguous");
/* Print the results. */
- printf("%d\t\t%s\t%s\t%d\t\t%dx%d\t\t%s\t%f\t\t%f\t\t\t%d\n", mpi_size,
- (facc_type == NC_MPIIO ? "MPI-IO " : "MPI-POSIX"),
- (access_flag == NC_INDEPENDENT ? "independent" : "collective"),
- (int)cache_size/MEGABYTE, DIMSIZE1, DIMSIZE2, chunk_string,
- write_time, bandwidth, NUM_TRIES);
+ printf("%d\t\t%s\t%s\t%d\t\t%dx%d\t\t%s\t%f\t\t%f\t\t\t%d\n", mpi_size,
+ (facc_type == NC_MPIIO ? "MPI-IO " : "MPI-POSIX"),
+ (access_flag == NC_INDEPENDENT ? "independent" : "collective"),
+ (int)cache_size/MEGABYTE, DIMSIZE1, DIMSIZE2, chunk_string,
+ write_time, bandwidth, NUM_TRIES);
}
/* Delete this file. */
- remove(file_name);
+ remove(file_name);
return 0;
}
@@ -134,14 +135,14 @@ int test_pio_2d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
/* Both read and write will be tested */
/* Case 2: create four dimensional integer data,
one dimension is unlimited. */
-int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm,
- MPI_Info info, int mpi_size, int mpi_rank, size_t *chunk_size)
+int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm,
+ MPI_Info info, int mpi_size, int mpi_rank, size_t *chunk_size)
{
int ncid, dimuids[NDIMS2], varid2[NUMVARS];
size_t ustart[NDIMS2], ucount[NDIMS2];
float *udata, *tempudata;
char file_name[NC_MAX_NAME + 1];
- char var_name2[NUMVARS][NC_MAX_NAME + 1] = {"JKP", "ZTa", "MFi", "FPi", "JBu",
+ char var_name2[NUMVARS][NC_MAX_NAME + 1] = {"JKP", "ZTa", "MFi", "FPi", "JBu",
"ALi", "AJo", "USG", "RBH", "JAG"};
double starttime, endtime, write_time = 0, bandwidth = 0;
size_t nelems_in;
@@ -162,7 +163,7 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
/* Get the file name. */
sprintf(file_name, "%s/%s", TEMP_LARGE, FILENAME);
-
+
/* Set the cache size. */
if (nc_get_chunk_cache(NULL, &nelems_in, &preemption_in)) ERR;
if (nc_set_chunk_cache(cache_size, nelems_in, preemption_in)) ERR;
@@ -170,7 +171,7 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
for (t = 0; t < NUM_TRIES; t++)
{
/* Create a netcdf-4 file. */
- if (nc_create_par(file_name, facc_type|NC_NETCDF4, comm, info,
+ if (nc_create_par(file_name, facc_type|NC_NETCDF4, comm, info,
&ncid)) ERR;
/* Create four dimensions. */
@@ -185,7 +186,7 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
dimuids, &varid2[i])) ERR;
if (nc_enddef(ncid)) ERR;
-
+
/* Set up selection parameters */
ustart[0] = 0;
ustart[1] = 0;
@@ -214,7 +215,7 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
if (!mpi_rank)
{
write_time += (endtime - starttime) / NUM_TRIES;
- bandwidth += (sizeof(float) * TIMELEN * DIMSIZE1 * DIMSIZE2 * DIMSIZE3 * NUMVARS) /
+ bandwidth += (sizeof(float) * TIMELEN * DIMSIZE1 * DIMSIZE2 * DIMSIZE3 * NUMVARS) /
((endtime - starttime) * 1024 * 1024 * NUM_TRIES);
}
}
@@ -225,21 +226,21 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
/* What was our chunking? */
if (chunk_size[0])
- sprintf(chunk_string, "%dx%dx%dx%d", (int)chunk_size[0], (int)chunk_size[1],
+ sprintf(chunk_string, "%dx%dx%dx%d", (int)chunk_size[0], (int)chunk_size[1],
(int)chunk_size[2], (int)chunk_size[3]);
else
strcat(chunk_string, "contiguous");
/* Print our results. */
- printf("%d\t\t%s\t%s\t%d\t\t%dx%dx%dx%d\t%s\t%f\t\t%f\t\t\t%d\n", mpi_size,
- (facc_type == NC_MPIIO ? "MPI-IO " : "MPI-POSIX"),
- (access_flag == NC_INDEPENDENT ? "independent" : "collective"),
- (int)cache_size / MEGABYTE, TIMELEN, DIMSIZE3, DIMSIZE2, DIMSIZE1, chunk_string, write_time,
- bandwidth, NUM_TRIES);
+ printf("%d\t\t%s\t%s\t%d\t\t%dx%dx%dx%d\t%s\t%f\t\t%f\t\t\t%d\n", mpi_size,
+ (facc_type == NC_MPIIO ? "MPI-IO " : "MPI-POSIX"),
+ (access_flag == NC_INDEPENDENT ? "independent" : "collective"),
+ (int)cache_size / MEGABYTE, TIMELEN, DIMSIZE3, DIMSIZE2, DIMSIZE1, chunk_string, write_time,
+ bandwidth, NUM_TRIES);
}
/* Delete this file. */
- remove(file_name);
+ remove(file_name);
return 0;
}
@@ -262,11 +263,11 @@ int main(int argc, char **argv)
int mpi_size, mpi_rank;
int mpi_mode[NUM_MODES] = {NC_MPIIO, NC_MPIPOSIX};
int facc_type[NUM_FACC] = {NC_INDEPENDENT, NC_COLLECTIVE};
- size_t chunk_size_2d[NUM_CHUNK_COMBOS_2D][NDIMS1] = {{0, 0},
+ size_t chunk_size_2d[NUM_CHUNK_COMBOS_2D][NDIMS1] = {{0, 0},
{DIMSIZE2, DIMSIZE1},
{DIMSIZE2/2 + 1, DIMSIZE1 / 2}};
- size_t chunk_size_4d[NUM_CHUNK_COMBOS_4D][NDIMS2] = {{0, 0, 0, 0},
- {1, DIMSIZE3, DIMSIZE2, DIMSIZE1},
+ size_t chunk_size_4d[NUM_CHUNK_COMBOS_4D][NDIMS2] = {{0, 0, 0, 0},
+ {1, DIMSIZE3, DIMSIZE2, DIMSIZE1},
{TIMELEN / 2, DIMSIZE3 / 2 + 1, DIMSIZE2 / 2 + 1, DIMSIZE1 / 2},
{TIMELEN, DIMSIZE3, DIMSIZE2, DIMSIZE1}};
size_t cache_size[NUM_CACHE_SIZES] = {MEGABYTE, 32 * MEGABYTE, 64 * MEGABYTE};
@@ -280,7 +281,7 @@ int main(int argc, char **argv)
/* Check for invalid number of processors. */
if ((float)DIMSIZE1 / mpi_size != (int)(DIMSIZE1 / mpi_size))
{
- printf("%d divided by number of processors must be a whole number!\n",
+ printf("%d divided by number of processors must be a whole number!\n",
DIMSIZE1);
return -1;
}
@@ -296,17 +297,17 @@ int main(int argc, char **argv)
for (m = 0; m < NUM_MODES; m++)
for (f = 0; f < NUM_FACC; f++)
for (c = 0; c < NUM_CHUNK_COMBOS_2D; c++)
- if (test_pio_2d(cache_size[i], mpi_mode[m], facc_type[f], comm,
+ if (test_pio_2d(cache_size[i], mpi_mode[m], facc_type[f], comm,
info, mpi_size, mpi_rank, chunk_size_2d[c])) ERR;
for (i = 0; i < NUM_CACHE_SIZES; i++)
for (m = 0; m < NUM_MODES; m++)
for (f = 0; f < NUM_FACC; f++)
for (c = 0; c < NUM_CHUNK_COMBOS_4D; c++)
- if (test_pio_4d(cache_size[i], mpi_mode[m], facc_type[f], comm,
- info, mpi_size, mpi_rank, chunk_size_4d[c])) ERR;
+ if (test_pio_4d(cache_size[i], mpi_mode[m], facc_type[f], comm,
+ info, mpi_size, mpi_rank, chunk_size_4d[c])) ERR;
- if (!mpi_rank)
+ if (!mpi_rank)
SUMMARIZE_ERR;
MPI_Finalize();
@@ -315,4 +316,3 @@ int main(int argc, char **argv)
return 0;
}
-
diff --git a/nc_test4/tst_opaques.c b/nc_test4/tst_opaques.c
index 80dd922..731f8db 100644
--- a/nc_test4/tst_opaques.c
+++ b/nc_test4/tst_opaques.c
@@ -9,6 +9,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_opaques.nc"
#define DIM_LEN 3
@@ -47,14 +48,14 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
if (nc_def_opaque(ncid, BASE_SIZE, TYPE_NAME, &xtype)) ERR;
if (nc_inq_user_type(ncid, xtype, name_in, &base_size_in, &base_nc_type_in, &nfields_in, &class_in)) ERR;
- if (strcmp(name_in, TYPE_NAME) || base_size_in != BASE_SIZE ||
+ if (strcmp(name_in, TYPE_NAME) || base_size_in != BASE_SIZE ||
base_nc_type_in != 0 || nfields_in != 0 || class_in != NC_OPAQUE) ERR;
if (nc_inq_opaque(ncid, xtype, name_in, &base_size_in)) ERR;
if (strcmp(name_in, TYPE_NAME) || base_size_in != BASE_SIZE) ERR;
- if (nc_def_var(ncid, VAR_NAME, xtype, 0, NULL, &varid)) ERR;
- if (nc_put_var(ncid, varid, &data[0])) ERR;
+ if (nc_def_var(ncid, VAR_NAME, xtype, 0, NULL, &varid)) ERR;
+ if (nc_put_var(ncid, varid, &data[0])) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -89,7 +90,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, xtype, 1, dimids, &varid)) ERR;
if (nc_put_var(ncid, varid, data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -193,7 +194,7 @@ main(int argc, char **argv)
if (strcmp(name_in, type_name[i]) || base_size_in != TYPE_SIZE1) ERR;
}
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -214,4 +215,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_parallel.c b/nc_test4/tst_parallel.c
index 8313978..171c047 100644
--- a/nc_test4/tst_parallel.c
+++ b/nc_test4/tst_parallel.c
@@ -1,8 +1,8 @@
-/*
+/*
Copyright 2009, UCAR/Unidata
See COPYRIGHT file for copying and redistribution conditions.
-This program tests netcdf-4 parallel I/O.
+This program tests netcdf-4 parallel I/O.
$Id: tst_parallel.c,v 1.7 2009/08/19 15:58:57 ed Exp $
*/
@@ -14,6 +14,7 @@ $Id: tst_parallel.c,v 1.7 2009/08/19 15:58:57 ed Exp $
/*#define USE_MPE 1*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <mpi.h>
#ifdef USE_MPE
#include <mpe.h>
@@ -29,7 +30,7 @@ int
main(int argc, char **argv)
{
/* MPI stuff. */
- int mpi_namelen;
+ int mpi_namelen;
char mpi_name[MPI_MAX_PROCESSOR_NAME];
int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
@@ -52,19 +53,19 @@ main(int argc, char **argv)
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Get_processor_name(mpi_name, &mpi_namelen);
- /*printf("mpi_name: %s size: %d rank: %d\n", mpi_name,
+ /*printf("mpi_name: %s size: %d rank: %d\n", mpi_name,
mpi_size, mpi_rank);*/
#ifdef USE_MPE
MPE_Init_log();
- s_init = MPE_Log_get_event_number();
- e_init = MPE_Log_get_event_number();
- s_define = MPE_Log_get_event_number();
- e_define = MPE_Log_get_event_number();
- s_write = MPE_Log_get_event_number();
- e_write = MPE_Log_get_event_number();
- s_close = MPE_Log_get_event_number();
- e_close = MPE_Log_get_event_number();
+ s_init = MPE_Log_get_event_number();
+ e_init = MPE_Log_get_event_number();
+ s_define = MPE_Log_get_event_number();
+ e_define = MPE_Log_get_event_number();
+ s_write = MPE_Log_get_event_number();
+ e_write = MPE_Log_get_event_number();
+ s_close = MPE_Log_get_event_number();
+ e_close = MPE_Log_get_event_number();
MPE_Describe_state(s_init, e_init, "Init", "red");
MPE_Describe_state(s_define, e_define, "Define", "yellow");
MPE_Describe_state(s_write, e_write, "Write", "green");
@@ -96,7 +97,7 @@ main(int argc, char **argv)
/* Create a parallel netcdf-4 file. */
/*nc_set_log_level(3);*/
sprintf(file_name, "%s/%s", TEMP_LARGE, FILE);
- if ((res = nc_create_par(file_name, NC_NETCDF4|NC_MPIIO, comm,
+ if ((res = nc_create_par(file_name, NC_NETCDF4|NC_MPIIO, comm,
info, &ncid))) ERR;
/* Create three dimensions. */
@@ -147,13 +148,13 @@ main(int argc, char **argv)
/* Close the netcdf file. */
if ((res = nc_close(ncid))) ERR;
-
+
#ifdef USE_MPE
MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */
/* Delete this large file. */
- remove(file_name);
+ remove(file_name);
/* Shut down MPI. */
MPI_Finalize();
diff --git a/nc_test4/tst_parallel3.c b/nc_test4/tst_parallel3.c
index 737ff5d..2dff429 100644
--- a/nc_test4/tst_parallel3.c
+++ b/nc_test4/tst_parallel3.c
@@ -19,7 +19,7 @@
*/
#include <nc_tests.h>
-
+#include "err_macros.h"
#define FILE_NAME "tst_parallel3.nc"
/*2,3,4 dimensional test, the first dimension is unlimited, time.
@@ -27,7 +27,7 @@
#define NDIMS1 2
#define NDIMS2 4
-#define DIMSIZE /*4 */ 768*2
+#define DIMSIZE /*4 */ 768*2
#define DIMSIZE2 4
#define DIMSIZE3 4
#define TIMELEN 1
@@ -162,7 +162,7 @@ int main(int argc, char **argv)
SUMMARIZE_ERR;
/* if(!getenv_all(MPI_COMM_WORLD,0,"NETCDF4_NOCLEANUP")) */
- remove(file_name);
+ remove(file_name);
MPI_Finalize();
if (mpi_rank == 0)
@@ -171,7 +171,7 @@ int main(int argc, char **argv)
}
/* Both read and write will be tested */
-int test_pio(int flag)
+int test_pio(int flag)
{
/* MPI stuff. */
int mpi_size, mpi_rank;
@@ -259,7 +259,7 @@ int test_pio(int flag)
if (nc_def_var(ncid, "uv1", NC_INT, NDIMS2, dimuids, &uvid)) ERR;
if (nc_enddef(ncid)) ERR;
-
+
/* Set up selection parameters */
ustart[0] = 0;
ustart[1] = 0;
@@ -272,7 +272,7 @@ int test_pio(int flag)
/* Access parallel */
if (nc_var_par_access(ncid, uvid, flag)) ERR;
-
+
/* Create phony data. */
if (!(udata = malloc(ucount[0]*ucount[1]*ucount[2]*ucount[3]*sizeof(int)))) ERR;
tempudata = udata;
@@ -311,14 +311,14 @@ int test_pio(int flag)
if (nc_inq_varid(ncid, "v1", &rvid)) ERR;
if (nc_var_par_access(ncid, rvid, flag)) ERR;
-
+
if (!(rdata = malloc(sizeof(int)*count[1]*count[0]))) ERR;
if (nc_get_vara_int(ncid, rvid, start, count, rdata)) ERR;
temprdata = rdata;
for (j=0; j<count[0];j++){
for (i=0; i<count[1]; i++){
- if(*temprdata != mpi_rank*(j+1))
+ if(*temprdata != mpi_rank*(j+1))
{
ERR_RET;
break;
@@ -339,12 +339,12 @@ int test_pio(int flag)
ucount[1] = DIMSIZE3;
ucount[2] = DIMSIZE2;
ucount[3] = DIMSIZE/mpi_size;
-
+
/* Inquiry the data */
/* (NOTE: This variable isn't written out, when access is independent) */
if (NC_INDEPENDENT != flag) {
if (nc_inq_varid(ncid, "uv1", &rvid)) ERR;
-
+
/* Access the parallel */
if (nc_var_par_access(ncid, rvid, flag)) ERR;
@@ -376,7 +376,7 @@ int test_pio(int flag)
/* Attributes: both read and write will be tested for parallel NetCDF*/
-int test_pio_attr(int flag)
+int test_pio_attr(int flag)
{
/* MPI stuff. */
int mpi_size, mpi_rank;
@@ -426,14 +426,14 @@ int test_pio_attr(int flag)
/* Write attributes of a variable */
- if (nc_put_att_double (ncid, nvid, "valid_range", NC_DOUBLE,
+ if (nc_put_att_double (ncid, nvid, "valid_range", NC_DOUBLE,
orivr_len, rh_range)) ERR;
- if (nc_put_att_text (ncid, nvid, "title", strlen(title),
+ if (nc_put_att_text (ncid, nvid, "title", strlen(title),
title)) ERR;
/* Write global attributes */
- if (nc_put_att_double (ncid, NC_GLOBAL, "g_valid_range", NC_DOUBLE,
+ if (nc_put_att_double (ncid, NC_GLOBAL, "g_valid_range", NC_DOUBLE,
orivr_len, rh_range)) ERR;
if (nc_put_att_text (ncid, NC_GLOBAL, "g_title", strlen(title), title)) ERR;
@@ -444,10 +444,10 @@ int test_pio_attr(int flag)
start[1] = mpi_rank * DIMSIZE/mpi_size;
count[0] = DIMSIZE2;
count[1] = DIMSIZE/mpi_size;
-
+
/* Access parallel */
if (nc_var_par_access(ncid, nvid, flag)) ERR;
-
+
/* Allocating data */
data = malloc(sizeof(int)*count[1]*count[0]);
tempdata = data;
@@ -486,22 +486,22 @@ if (nc_open_par(file_name, facc_type_open, comm, info, &ncid)) ERR;
if(vr_type != NC_DOUBLE || vr_len != orivr_len) ERR;
vr_val = (double *) malloc(vr_len * sizeof(double));
-
+
/* Get variable attribute values */
if (nc_get_att_double(ncid, nvid, "valid_range", vr_val)) ERR;
/* Check variable attribute value */
for(i = 0; i < vr_len; i++)
- if (vr_val[i] != rh_range[i])
+ if (vr_val[i] != rh_range[i])
ERR_RET;
free(vr_val);
-
+
/* Inquiry global attribute */
if (nc_inq_att (ncid, NC_GLOBAL, "g_valid_range", &vr_type, &vr_len)) ERR;
/* Check stuff. */
if(vr_type != NC_DOUBLE || vr_len != orivr_len) ERR;
-
+
/* Obtain global attribute value */
vr_val = (double *) malloc(vr_len * sizeof(double));
if (nc_get_att_double(ncid, NC_GLOBAL, "g_valid_range", vr_val)) ERR;
@@ -522,7 +522,7 @@ if (nc_open_par(file_name, facc_type_open, comm, info, &ncid)) ERR;
/* Allocate meory for string attribute */
st_val = (char *) malloc(st_len * (sizeof(char)));
-
+
/* Obtain variable string attribute value */
if (nc_get_att_text(ncid, nvid,"title", st_val)) ERR;
@@ -561,7 +561,7 @@ if (nc_open_par(file_name, facc_type_open, comm, info, &ncid)) ERR;
/* test different hyperslab settings */
int test_pio_hyper(int flag){
-
+
/* MPI stuff. */
int mpi_size, mpi_rank;
int res = NC_NOERR;
@@ -608,7 +608,7 @@ int test_pio_hyper(int flag){
if (nc_enddef(ncid)) ERR;
- /* hyperslab illustration for 3-processor case
+ /* hyperslab illustration for 3-processor case
--------
|aaaacccc|
@@ -620,7 +620,7 @@ int test_pio_hyper(int flag){
/* odd number of processors should be treated differently */
if(mpi_size%2 != 0) {
-
+
count_atom = DIMSIZE*2/(mpi_size+1);
if(mpi_rank <= mpi_size/2) {
start[0] = 0;
@@ -633,10 +633,10 @@ int test_pio_hyper(int flag){
start[1] = (mpi_rank-mpi_size/2-1)*count_atom;
count[0] = DIMSIZE2/2;
count[1] = count_atom;
- }
+ }
}
else {
-
+
count_atom = DIMSIZE*2/mpi_size;
if(mpi_rank < mpi_size/2) {
start[0] = 0;
@@ -649,7 +649,7 @@ int test_pio_hyper(int flag){
start[1] = (mpi_rank-mpi_size/2)*count_atom;
count[0] = DIMSIZE2/2;
count[1] = count_atom;
- }
+ }
}
if (nc_var_par_access(ncid, nvid, flag)) ERR;
@@ -670,12 +670,12 @@ int test_pio_hyper(int flag){
if (nc_close(ncid)) ERR;
if (nc_open_par(file_name, facc_type_open, comm, info, &ncid)) ERR;
-
+
/* Inquiry the variable */
if (nc_inq_varid(ncid, "v1", &rvid)) ERR;
if (nc_var_par_access(ncid, rvid, flag)) ERR;
-
+
rdata = malloc(sizeof(int)*count[1]*count[0]);
/* Read the data with the same slab settings */
if (nc_get_vara_int(ncid, rvid, start, count, rdata)) ERR;
@@ -683,7 +683,7 @@ int test_pio_hyper(int flag){
temprdata = rdata;
for (j=0; j<count[0];j++){
for (i=0; i<count[1]; i++){
- if(*temprdata != mpi_rank*(j+1))
+ if(*temprdata != mpi_rank*(j+1))
{
res = -1;
break;
@@ -697,7 +697,7 @@ int test_pio_hyper(int flag){
/* Close the netcdf file. */
if (nc_close(ncid)) ERR;
-
+
return 0;
}
@@ -821,5 +821,3 @@ char* getenv_all(MPI_Comm comm, int root, const char* name)
return env;
}
-
-
diff --git a/nc_test4/tst_parallel4.c b/nc_test4/tst_parallel4.c
index 5a35be4..15f0f42 100644
--- a/nc_test4/tst_parallel4.c
+++ b/nc_test4/tst_parallel4.c
@@ -13,6 +13,7 @@
/*#define USE_MPE 1*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <mpi.h>
#ifdef USE_MPE
#include <mpe.h>
@@ -31,7 +32,7 @@ int
main(int argc, char **argv)
{
/* MPI stuff. */
- int mpi_namelen;
+ int mpi_namelen;
char mpi_name[MPI_MAX_PROCESSOR_NAME];
int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
@@ -44,7 +45,7 @@ main(int argc, char **argv)
size_t count[NDIMS] = {1, DIMSIZE, DIMSIZE};
int data[DIMSIZE * DIMSIZE], data_in[DIMSIZE * DIMSIZE];
int j, i, ret;
-
+
char file_name[NC_MAX_NAME + 1];
int ndims_in, nvars_in, natts_in, unlimdimid_in;
@@ -62,23 +63,23 @@ main(int argc, char **argv)
/* Must be able to evenly divide my slabs between processors. */
if (NUM_SLABS % mpi_size != 0)
{
- if (!mpi_rank) printf("NUM_SLABS (%d) is not evenly divisible by mpi_size(%d)\n",
+ if (!mpi_rank) printf("NUM_SLABS (%d) is not evenly divisible by mpi_size(%d)\n",
NUM_SLABS, mpi_size);
ERR;
}
#ifdef USE_MPE
MPE_Init_log();
- s_init = MPE_Log_get_event_number();
- e_init = MPE_Log_get_event_number();
- s_define = MPE_Log_get_event_number();
- e_define = MPE_Log_get_event_number();
- s_write = MPE_Log_get_event_number();
- e_write = MPE_Log_get_event_number();
- s_close = MPE_Log_get_event_number();
- e_close = MPE_Log_get_event_number();
- s_open = MPE_Log_get_event_number();
- e_open = MPE_Log_get_event_number();
+ s_init = MPE_Log_get_event_number();
+ e_init = MPE_Log_get_event_number();
+ s_define = MPE_Log_get_event_number();
+ e_define = MPE_Log_get_event_number();
+ s_write = MPE_Log_get_event_number();
+ e_write = MPE_Log_get_event_number();
+ s_close = MPE_Log_get_event_number();
+ e_close = MPE_Log_get_event_number();
+ s_open = MPE_Log_get_event_number();
+ e_open = MPE_Log_get_event_number();
MPE_Describe_state(s_init, e_init, "Init", "red");
MPE_Describe_state(s_define, e_define, "Define", "yellow");
MPE_Describe_state(s_write, e_write, "Write", "green");
@@ -165,19 +166,19 @@ main(int argc, char **argv)
/* Close the netcdf file. */
if (nc_close(ncid)) ERR;
-
+
#ifdef USE_MPE
MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */
/* Reopen the file and check it. */
- if ((ret = nc_open_par(file_name, NC_NOWRITE|NC_MPIIO, comm, info, &ncid)))
+ if ((ret = nc_open_par(file_name, NC_NOWRITE|NC_MPIIO, comm, info, &ncid)))
{
printf("ret = %d\n", ret);
ERR_RET;
}
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
- if (ndims_in != NDIMS || nvars_in != 1 || natts_in != 1 ||
+ if (ndims_in != NDIMS || nvars_in != 1 || natts_in != 1 ||
unlimdimid_in != -1) ERR;
/* Read all the slabs this process is responsible for. */
@@ -191,10 +192,10 @@ main(int argc, char **argv)
/* Read one slab of data. */
if (nc_get_vara_int(ncid, varid, start, count, data_in)) ERR;
-
+
/* Check data. */
for (j = 0; j < DIMSIZE * DIMSIZE; j++)
- if (data_in[j] != mpi_rank)
+ if (data_in[j] != mpi_rank)
{
ERR;
break;
@@ -211,13 +212,13 @@ main(int argc, char **argv)
/* Close the netcdf file. */
if (nc_close(ncid)) ERR;
-
+
#ifdef USE_MPE
MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */
/* Delete this large file. */
- remove(file_name);
+ remove(file_name);
/* Shut down MPI. */
MPI_Finalize();
diff --git a/nc_test4/tst_rehash.c b/nc_test4/tst_rehash.c
new file mode 100644
index 0000000..04ed043
--- /dev/null
+++ b/nc_test4/tst_rehash.c
@@ -0,0 +1,43 @@
+/* This is part of the netCDF package.
+ Copyright 2016 University Corporation for Atmospheric Research/Unidata
+ See COPYRIGHT file for conditions of use.
+
+ Provided in support of https://github.com/Unidata/netcdf-c/issues/282
+ Test provided by Greg Sjaardema
+
+ Tests to see if the hashmap is being properly updated.
+
+ */
+
+#define FILENAME "tst_rehash.nc"
+
+#include <netcdf.h>
+int main()
+{
+ int status;
+ int id;
+ int rh_id, varid, v1, v2, v3, v4;
+ int dimids[2];
+
+
+ nc_create(FILENAME, NC_CLOBBER, &id);
+ nc_redef(id);
+
+ status = nc_def_dim(id, "dim1", 10, &dimids[0]);
+ status = nc_def_var(id, "dim1", NC_FLOAT, 1, dimids, &v1);
+ status = nc_def_var(id, "var1", NC_FLOAT, 1, dimids, &v2);
+
+ nc_close(id);
+
+ nc_open(FILENAME, NC_WRITE, &id);
+
+ nc_redef(id);
+ nc_rename_var(id, v1,"dim_new1");
+ nc_rename_dim(id, dimids[0], "dim_new1");
+
+ status = nc_def_dim(id, "dim2", 20, &dimids[1]);
+ nc_def_var(id, "dim2", NC_FLOAT, 1, &dimids[1], &v3);
+ nc_def_var(id, "var2", NC_FLOAT, 2, dimids, &v4);
+
+ nc_close(id);
+}
diff --git a/nc_test4/tst_strings.c b/nc_test4/tst_strings.c
index cc45bc3..30c951f 100644
--- a/nc_test4/tst_strings.c
+++ b/nc_test4/tst_strings.c
@@ -9,6 +9,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_strings.nc"
#define DIM_LEN 9
@@ -31,7 +32,7 @@ main(int argc, char **argv)
int ncid, i;
char *data_in[ATT_LEN_1] = {NULL};
char *data[ATT_LEN_1] = {"R"};
-
+
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, MOUNTAIN_RANGE, NC_STRING, ATT_LEN_1, data)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -39,7 +40,7 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, MOUNTAIN_RANGE, &att_type, &att_len)) ERR;
if (att_type != NC_STRING || att_len != ATT_LEN_1) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -70,7 +71,7 @@ main(int argc, char **argv)
"Whether you had not sometime in your life",
"Err'd in this point which now you censure him",
"And pull'd the law upon you."};
-
+
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME, NC_STRING, ATT_LEN, data)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -78,7 +79,7 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, ATT_NAME, &att_type, &att_len)) ERR;
if (att_type != NC_STRING || att_len != ATT_LEN) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -120,7 +121,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, NC_STRING, NDIMS, dimids, &varid)) ERR;
if (nc_put_var_string(ncid, varid, (const char **)data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_get_var_string(ncid, varid, data_in)) ERR;
@@ -147,13 +148,13 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_put_att_string(ncid, NC_GLOBAL, ATT2_NAME, SOME_PRES, (const char **)data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_get_att_string(ncid, NC_GLOBAL, ATT2_NAME, (char **)data_in)) ERR;
for (i=0; i < SOME_PRES; i++)
if (strcmp(data_in[i], data[i])) ERR;
-
+
/* Must free your data! */
if (nc_free_string(SOME_PRES, (char **)data_in)) ERR;
@@ -183,7 +184,7 @@ main(int argc, char **argv)
count[0] = SOME_PRES;
if (nc_put_vara_string(ncid, varid, start, count, (const char **)data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_get_var_string(ncid, varid, data_in)) ERR;
@@ -192,7 +193,7 @@ main(int argc, char **argv)
if (i < SOME_PRES && (data_in[i] == NULL || strcmp(data_in[i], data[i]))) ERR;
if (i >= SOME_PRES && (data_in[i] == NULL || strcmp(data_in[i], ""))) ERR;
}
-
+
/* Must free your data! */
if (nc_free_string(NUM_PRES, (char **)data_in)) ERR;
@@ -227,7 +228,7 @@ main(int argc, char **argv)
if(status != NC_NOERR)
fprintf(stderr,"%s\n",nc_strerror(status));
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_get_vars_string(ncid, varid, start, count, stride, data_in)) ERR;
@@ -235,7 +236,7 @@ main(int argc, char **argv)
{
if (i < SOME_PRES && strcmp(data_in[i], data[i])) ERR;
}
-
+
/* Must free your data! */
if (nc_free_string(SOME_PRES, (char **)data_in)) ERR;
@@ -425,7 +426,7 @@ main(int argc, char **argv)
"any of the rights and freedoms set forth herein."
};
char *empty_string[] = {""};
-
+
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* Create an array of strings for the Universal Declaraion of Human Rights. */
@@ -452,12 +453,12 @@ main(int argc, char **argv)
/* Close the file. */
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != NDIMS || nvars != 2 || natts != 0 || unlimdimid != -1) ERR;
-
+
/* Check declaration. */
if (nc_inq_varid(ncid, VAR_NAME1, &varid)) ERR;
if (nc_inq_var(ncid, varid, var_name, &var_type, &var_ndims,
@@ -480,4 +481,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_strings2.c b/nc_test4/tst_strings2.c
index 661b309..f5c60d6 100644
--- a/nc_test4/tst_strings2.c
+++ b/nc_test4/tst_strings2.c
@@ -9,6 +9,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_strings2.nc"
#define ATT_NAME "WC"
@@ -19,7 +20,7 @@ main(int argc, char **argv)
printf("\n*** Testing netcdf-4 string type.\n");
printf("*** testing very simple string attribute...");
{
-#define ATT_LEN 1
+#define ATT_LEN 1
size_t att_len;
int ndims, nvars, natts, unlimdimid;
nc_type att_type;
@@ -27,7 +28,7 @@ main(int argc, char **argv)
char *data_in[ATT_LEN];
char *data[ATT_LEN] = {"An appeaser is one who feeds a crocodile — "
"hoping it will eat him last."};
-
+
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME, NC_STRING, ATT_LEN, data)) ERR;
@@ -36,7 +37,7 @@ main(int argc, char **argv)
if (nc_inq_att(ncid, NC_GLOBAL, ATT_NAME, &att_type, &att_len)) ERR;
if (att_type != NC_STRING || att_len != ATT_LEN) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -52,4 +53,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_sync.c b/nc_test4/tst_sync.c
index fb7931b..2cba1bf 100644
--- a/nc_test4/tst_sync.c
+++ b/nc_test4/tst_sync.c
@@ -2,10 +2,11 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use.
- Test netcdf-4 syncs.
+ Test netcdf-4 syncs.
*/
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_sync.nc"
#define DIM_NAME "x"
@@ -30,7 +31,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR1_NAME, NC_FLOAT, 1, &dimid, &var1_id)) ERR;
if (nc_sync(ncid)) ERR;
if (nc_def_var(ncid, VAR2_NAME, NC_FLOAT, 1, &dimid, &var2_id)) ERR;
-
+
/* Now define a coordinate variable for the dimension. */
if (nc_def_var(ncid, DIM_NAME, NC_FLOAT, 1, &dimid, &var3_id)) ERR;
if (nc_close(ncid)) ERR;
@@ -40,7 +41,7 @@ main(int argc, char **argv)
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != 1 || nvars != 3 || natts != 0 || unlimdimid != -1) ERR;
if (nc_inq_var(ncid, 2, name_in, &xtype_in, &ndims, &dimid_in, &natts)) ERR;
- if (strcmp(name_in, DIM_NAME) || xtype_in != NC_FLOAT || ndims != 1 ||
+ if (strcmp(name_in, DIM_NAME) || xtype_in != NC_FLOAT || ndims != 1 ||
dimid_in != 0 || natts != 0) ERR;
if (nc_close(ncid)) ERR;
}
@@ -87,9 +88,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_unlim_vars.c b/nc_test4/tst_unlim_vars.c
index dc4781e..306e53e 100644
--- a/nc_test4/tst_unlim_vars.c
+++ b/nc_test4/tst_unlim_vars.c
@@ -3,12 +3,13 @@
See COPYRIGHT file for conditions of use.
Test netcdf-4 variables with unlimited dimensions.
-
+
$Id: tst_unlim_vars.c,v 1.9 2010/05/25 13:53:04 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_unlim_vars.nc"
#define SFC_TEMP_NAME "surface_temperature"
@@ -42,7 +43,7 @@ main(int argc, char **argv)
printf("\n*** Testing netcdf-4 variable with unlimited dimensions.\n");
printf("*** Testing file with one var, one unlim dim...");
-
+
/* Create a file with a 3D surface temp variable. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -152,5 +153,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_utf8.c b/nc_test4/tst_utf8.c
index 3705b8c..6d2bb45 100644
--- a/nc_test4/tst_utf8.c
+++ b/nc_test4/tst_utf8.c
@@ -12,6 +12,7 @@
#include <config.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <string.h>
@@ -45,10 +46,10 @@ check_nc4_file(int ncid)
char name_in[NC_MAX_NAME + 1], strings_in[NC_MAX_NAME + 1], value;
/* Check the group. */
- if (nc_inq_grps(ncid, &numgrps, &grpid)) ERR;
+ if (nc_inq_grps(ncid, &numgrps, &grpid)) ERR;
if (numgrps != 1) ERR;
name_in[0] = 0;
- if (nc_inq_grpname(grpid, name_in)) ERR;
+ if (nc_inq_grpname(grpid, name_in)) ERR;
if (strncmp(norm_utf8, name_in, sizeof(norm_utf8))) ERR;
/* Check the variable. */
@@ -62,7 +63,7 @@ check_nc4_file(int ncid)
if (nc_get_var(grpid, varid, strings_in)) ERR;
if (strncmp(name_utf8, strings_in, sizeof(name_utf8))) ERR;
strings_in[0] = '\0'; /* Reset my string buffer. */
-
+
/* Check the dimension. */
if (nc_inq_dimid(grpid, name_utf8, &dimid)) ERR;
if (nc_inq_dimname(grpid, dimid, name_in)) ERR;
@@ -85,34 +86,34 @@ check_nc4_file(int ncid)
if (strncmp(name_utf8, strings_in, sizeof(name_utf8))) ERR;
/* Check the enum type. */
- if (nc_inq_grps(grpid, &numgrps, &grpid2)) ERR;
+ if (nc_inq_grps(grpid, &numgrps, &grpid2)) ERR;
if (numgrps != 1) ERR;
if (nc_inq_typeids(grpid2, &numtypes, &enum_typeid)) ERR;
if (numtypes != 1) ERR;
- if (nc_inq_user_type(grpid2, enum_typeid, name_in, &size_in, &base_type_in,
+ if (nc_inq_user_type(grpid2, enum_typeid, name_in, &size_in, &base_type_in,
&nfields_in, &class_in)) ERR;
- if (strncmp(norm_utf8, name_in, strlen(norm_utf8)) || size_in != 1 ||
+ if (strncmp(norm_utf8, name_in, strlen(norm_utf8)) || size_in != 1 ||
base_type_in != NC_BYTE || nfields_in != 1 || class_in != NC_ENUM) ERR;
name_in[0] = size_in = base_type_in = 0;
if (nc_inq_enum(grpid2, enum_typeid, name_in, &base_type_in, &size_in, &num_mem)) ERR;
- if (strncmp(norm_utf8, name_in, strlen(norm_utf8)) || size_in != 1 ||
+ if (strncmp(norm_utf8, name_in, strlen(norm_utf8)) || size_in != 1 ||
base_type_in != NC_BYTE || num_mem != 1) ERR;
if (nc_inq_enum_member(grpid2, enum_typeid, 0, name_in, &value)) ERR;
if (strncmp(norm_utf8, name_in, sizeof(norm_utf8)) || value != ENUM_VALUE) ERR;
/* Check the compound type. */
- if (nc_inq_grps(grpid2, &numgrps, &grpid3)) ERR;
+ if (nc_inq_grps(grpid2, &numgrps, &grpid3)) ERR;
if (numgrps != 1) ERR;
if (nc_inq_typeids(grpid3, &numtypes, &comp_typeid)) ERR;
if (numtypes != 1) ERR;
name_in[0] = 0;
- if (nc_inq_user_type(grpid3, comp_typeid, name_in, &size_in, &base_type_in,
+ if (nc_inq_user_type(grpid3, comp_typeid, name_in, &size_in, &base_type_in,
&nfields_in, &class_in)) ERR;
- if (strncmp(norm_utf8, name_in, sizeof(norm_utf8)) || size_in != sizeof(struct comp) ||
+ if (strncmp(norm_utf8, name_in, sizeof(norm_utf8)) || size_in != sizeof(struct comp) ||
base_type_in != NC_NAT || nfields_in != 1 || class_in != NC_COMPOUND) ERR;
size_in = nfields_in = 999;
if (nc_inq_compound(grpid3, comp_typeid, name_in, &size_in, &nfields_in)) ERR;
- if (strncmp(norm_utf8, name_in, sizeof(norm_utf8)) || size_in != sizeof(struct comp) ||
+ if (strncmp(norm_utf8, name_in, sizeof(norm_utf8)) || size_in != sizeof(struct comp) ||
nfields_in != 1) ERR;
name_in[0] = 0;
if (nc_inq_compound_fieldname(grpid3, comp_typeid, 0, name_in)) ERR;
@@ -141,7 +142,7 @@ check_classic_file(int ncid)
if (nc_get_var_text(ncid, varid, strings_in)) ERR;
if (strncmp(name_utf8, strings_in, sizeof(name_utf8))) ERR;
strings_in[0] = '\0'; /* Reset my string buffer. */
-
+
/* Check the dimension. */
if (nc_inq_dimid(ncid, name_utf8, &dimid)) ERR;
if (nc_inq_dimname(ncid, dimid, name_in)) ERR;
@@ -178,7 +179,7 @@ main(int argc, char **argv)
{
if (nc_set_default_format(f, NULL)) ERR;
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
-
+
/* Define various netcdf objects with a Unicode UTF-8 encoded name
* that must be normalized. Where possible, also use the utf8
* string as the value. The name will be normalized, but not the
@@ -186,17 +187,17 @@ main(int argc, char **argv)
if (nc_def_dim(ncid, name_utf8, NX, &dimids[0])) ERR;
if (nc_def_var(ncid, name_utf8, NC_CHAR, NDIMS, dimids, &varid)) ERR;
if (nc_put_att_text(ncid, varid, name_utf8, sizeof(name_utf8), name_utf8)) ERR;
-
+
if (nc_enddef(ncid)) ERR;
-
+
/* Write var data. */
if (nc_put_var_text(ncid, varid, name_utf8)) ERR;
-
+
/* Check the file. */
check_classic_file(ncid);
-
+
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check again. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
check_classic_file(ncid);
@@ -218,24 +219,24 @@ main(int argc, char **argv)
{
if (nc_set_default_format(f, NULL)) ERR;
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
-
+
/* Create objects. */
if (nc_def_dim(ncid, DIM1_NAME, NX, &dimids[0])) ERR;
if (nc_rename_dim(ncid, 0, name_utf8)) ERR;
- if (nc_def_var(ncid, name_utf8, NC_CHAR, NDIMS, dimids, &varid)) ERR;
- if (nc_put_att_text(ncid, varid, ATT1_NAME, sizeof(name_utf8), name_utf8)) ERR;
- if (nc_rename_att(ncid, 0, ATT1_NAME, name_utf8)) ERR;
-
+ if (nc_def_var(ncid, name_utf8, NC_CHAR, NDIMS, dimids, &varid)) ERR;
+ if (nc_put_att_text(ncid, varid, ATT1_NAME, sizeof(name_utf8), name_utf8)) ERR;
+ if (nc_rename_att(ncid, 0, ATT1_NAME, name_utf8)) ERR;
+
if (nc_enddef(ncid)) ERR;
-
+
/* Write var data. */
if (nc_put_var_text(ncid, varid, name_utf8)) ERR;
-
+
/* Check the file. */
check_classic_file(ncid);
-
+
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check again. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
check_classic_file(ncid);
@@ -249,9 +250,9 @@ main(int argc, char **argv)
int ncid, varid, grpid, comp_typeid, enum_typeid, grpid2, grpid3;
int dimids[NDIMS];
char my_int = ENUM_VALUE;
-
+
if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR;
-
+
/* Define various netcdf objects with a Unicode UTF-8 encoded name
* that must be normalized. Where possible, also use the utf8
* string as the value. The name will be normalized, but not the
@@ -260,23 +261,23 @@ main(int argc, char **argv)
if (nc_def_dim(grpid, name_utf8, NX, &dimids[0])) ERR;
if (nc_def_var(grpid, name_utf8, NC_CHAR, NDIMS, dimids, &varid)) ERR;
if (nc_put_att_text(grpid, varid, name_utf8, sizeof(name_utf8), name_utf8)) ERR;
-
+
if (nc_def_grp(grpid, "tmp", &grpid2)) ERR;
if (nc_def_enum(grpid2, NC_BYTE, name_utf8, &enum_typeid)) ERR;
if (nc_insert_enum(grpid2, enum_typeid, name_utf8, &my_int)) ERR;
-
+
if (nc_def_grp(grpid2, "tmp", &grpid3)) ERR;
if (nc_def_compound(grpid3, sizeof(struct comp), name_utf8, &comp_typeid)) ERR;
if (nc_insert_compound(grpid3, comp_typeid, name_utf8, offsetof(struct comp, i), NC_INT)) ERR;
-
+
/* Write var data. */
if (nc_put_var_text(grpid, varid, name_utf8)) ERR;
-
+
/* Check the file. */
check_nc4_file(ncid);
-
+
if (nc_close(ncid)) ERR;
-
+
/* Reopen the file and check again. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
check_nc4_file(ncid);
diff --git a/nc_test4/tst_v2.c b/nc_test4/tst_v2.c
index 350a82a..0204ce9 100644
--- a/nc_test4/tst_v2.c
+++ b/nc_test4/tst_v2.c
@@ -2,13 +2,14 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test internal netcdf-4 file code.
+ Test internal netcdf-4 file code.
$Id: tst_v2.c,v 1.9 2009/02/14 14:09:44 ed Exp $
*/
#include <config.h>
#include "netcdf.h"
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_v2.nc"
#define NDIMS 2
diff --git a/nc_test4/tst_varms.c b/nc_test4/tst_varms.c
index ba1b2db..63a3e8e 100644
--- a/nc_test4/tst_varms.c
+++ b/nc_test4/tst_varms.c
@@ -2,9 +2,9 @@
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
- Test netcdf-4 mapped var operations.
+ Test netcdf-4 mapped var operations.
- Remember, in C, last dimension of an array varies fastest in memory.
+ Remember, in C, last dimension of an array varies fastest in memory.
int data[2][3] is order in memory (0,0), (0,1), (0,2), (1,0), (1,1), (1,2).
applying map of (1,2) will reorder them in the following way:
(0,0), (1,0), (0,1), (1,1), (0,2), (1,2)
@@ -19,7 +19,7 @@
*/
#include <nc_tests.h>
-
+#include "err_macros.h"
#define FILE_NAME "tst_varms.nc"
#define DIM1_NAME "i"
#define DIM1_LEN 2
@@ -50,7 +50,7 @@ main(int argc, char **argv)
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
data_2d[i][j] = k++;
-
+
/* Create a file with one 2D variable of type int and write our
* data. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -60,10 +60,10 @@ main(int argc, char **argv)
if (nc_enddef(ncid)) ERR;
if (nc_put_var_int(ncid, varid, (int *)data_2d)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Open the file and check. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_int(ncid, varid, (int *)data_2d_in)) ERR;
+ if (nc_get_var_int(ncid, varid, (int *)data_2d_in)) ERR;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
if (data_2d_in[i][j] != data_2d[i][j]) ERR;
@@ -75,8 +75,8 @@ main(int argc, char **argv)
stride[0] = stride[1] = 1;
map[0] = 1;
map[1] = 2;
- if (nc_get_varm_int(ncid, varid, start, count, stride, map,
- (int *)data_2d_in)) ERR;
+ if (nc_get_varm_int(ncid, varid, start, count, stride, map,
+ (int *)data_2d_in)) ERR;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
if (data_2d_in[j][i] != data_2d[i][j]) ERR;
@@ -85,8 +85,8 @@ main(int argc, char **argv)
* what these numbers mean. */
map[0] = 2;
map[1] = 1;
- if (nc_get_varm_int(ncid, varid, start, count, stride, map,
- (int *)data_2d_in)) ERR;
+ if (nc_get_varm_int(ncid, varid, start, count, stride, map,
+ (int *)data_2d_in)) ERR;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
if (data_2d_in[i][j] != data_2d[i][j]) ERR;
@@ -105,7 +105,7 @@ main(int argc, char **argv)
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
data[i][j] = k++;
-
+
/* Create a file with one variable of type int. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
@@ -114,15 +114,15 @@ main(int argc, char **argv)
if (nc_enddef(ncid)) ERR;
if (nc_put_var_int(ncid, varid, (int *)data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Open the file and check. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
- if (strcmp(name_in, VAR_NAME) || xtype_in != NC_INT ||
+ if (strcmp(name_in, VAR_NAME) || xtype_in != NC_INT ||
ndims_in != 2 || natts_in != 0 || dimids_in[0] != dimids[0] ||
dimids_in[1] != dimids[1]) ERR;
- if (nc_get_var_int(ncid, varid, (int *)data_in)) ERR;
+ if (nc_get_var_int(ncid, varid, (int *)data_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (data_in[i][j] != data[i][j]) ERR;
@@ -134,8 +134,8 @@ main(int argc, char **argv)
stride[0] = stride[1] = 1;
map[0] = 1;
map[1] = 2;
- if (nc_get_varm_int(ncid, varid, start, count, stride, map,
- (int *)data_in_t)) ERR;
+ if (nc_get_varm_int(ncid, varid, start, count, stride, map,
+ (int *)data_in_t)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (data_in_t[j][i] != data[i][j]) ERR;
@@ -150,7 +150,7 @@ main(int argc, char **argv)
{
#define D0 4
#define D1 3
-#define D2 2
+#define D2 2
/* netCDF dimension inter-element distance */
/* ---------------- ---------------------- */
@@ -161,7 +161,7 @@ main(int argc, char **argv)
size_t start[3] = {0, 0, 0}, count[3] = {D0, D1, D2};
int ncid, varid, dimids[3];
float data[D0][D1][D2], data_in[D0][D1][D2];
-
+
for (i = 0; i < D0; i++)
for (j = 0; j < D1; j++)
for (k = 0; k < D2; k++)
@@ -181,7 +181,7 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != 3 || nvars != 1 || natts != 0 || unlimdimid != -1) ERR;
- if (nc_get_var_float(ncid, 0, (float *)data_in)) ERR;
+ if (nc_get_var_float(ncid, 0, (float *)data_in)) ERR;
for (i = 0; i < D0; i++)
for (j = 0; j < D1; j++)
for (k = 0; k < D2; k++)
@@ -189,8 +189,8 @@ main(int argc, char **argv)
/* Using the imap above I should get identical results
* (according to the manual). */
- if (nc_get_varm_float(ncid, 0, start, count, stride, imap,
- (float *)data_in)) ERR;
+ if (nc_get_varm_float(ncid, 0, start, count, stride, imap,
+ (float *)data_in)) ERR;
for (i = 0; i < D0; i++)
for (j = 0; j < D1; j++)
for (k = 0; k < D2; k++)
@@ -221,7 +221,7 @@ main(int argc, char **argv)
int ncid, varid, dimids[3];
float data[4][6], data_in[6][4];
int k=0;
-
+
/* Phoney data. */
for (i = 0; i < 4; i++)
for (j = 0; j < 6; j++)
@@ -240,11 +240,11 @@ main(int argc, char **argv)
dimids[1] = 0;
if (nc_def_var(ncid, "rh2", NC_FLOAT, 2, dimids, &varid)) ERR;
if (nc_enddef(ncid)) ERR;
- if (nc_put_varm_float(ncid, 0, start, count, stride, imap,
+ if (nc_put_varm_float(ncid, 0, start, count, stride, imap,
(float *)data)) ERR;
count[0] = 4;
count[1] = 6;
- if (nc_put_vara_float(ncid, 1, start, count,
+ if (nc_put_vara_float(ncid, 1, start, count,
(float *)data_in)) ERR;
if (nc_close(ncid)) ERR;
@@ -252,7 +252,7 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
if (ndims != 2 || nvars != 2 || natts != 0 || unlimdimid != -1) ERR;
- if (nc_get_var_float(ncid, 0, (float *)data_in)) ERR;
+ if (nc_get_var_float(ncid, 0, (float *)data_in)) ERR;
/* for (i = 0; i < 4; i++) */
/* for (j = 0; j < 6; j++) */
/* if (data_in[i][j] != data[j][i]) ERR; */
@@ -263,5 +263,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_vars.c b/nc_test4/tst_vars.c
index 1d4d84b..f7c991c 100644
--- a/nc_test4/tst_vars.c
+++ b/nc_test4/tst_vars.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_vars.c,v 1.49 2009/12/30 12:03:48 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_vars.nc"
@@ -69,7 +70,7 @@
#define MAX_ATT_LEN 80
int
-create_4D_example(char *file_name, int cmode)
+create_4D_example(char *file_name, int cmode)
{
/* IDs for the netCDF file, dimensions, and variables. */
int ncid, lon_dimid, lat_dimid, lvl_dimid, rec_dimid;
@@ -90,7 +91,7 @@ create_4D_example(char *file_name, int cmode)
/* Loop indexes. */
int lvl, lat, lon, rec, i = 0;
-
+
/* Create some pretend data. If this wasn't an example program, we
* would have some real data to write, for example, model
* output. */
@@ -98,7 +99,7 @@ create_4D_example(char *file_name, int cmode)
lats[lat] = START_LAT + 5.*lat;
for (lon = 0; lon < NLON; lon++)
lons[lon] = START_LON + 5.*lon;
-
+
for (lvl = 0; lvl < NLVL; lvl++)
for (lat = 0; lat < NLAT; lat++)
for (lon = 0; lon < NLON; lon++)
@@ -124,15 +125,15 @@ create_4D_example(char *file_name, int cmode)
since coordinate variables only have one dimension, we can
simply provide the address of that dimension ID (&lat_dimid) and
similarly for (&lon_dimid). */
- if (nc_def_var(ncid, LAT_NAME, NC_FLOAT, 1, &lat_dimid,
+ if (nc_def_var(ncid, LAT_NAME, NC_FLOAT, 1, &lat_dimid,
&lat_varid)) ERR;
- if (nc_def_var(ncid, LON_NAME, NC_FLOAT, 1, &lon_dimid,
+ if (nc_def_var(ncid, LON_NAME, NC_FLOAT, 1, &lon_dimid,
&lon_varid)) ERR;
/* Assign units attributes to coordinate variables. */
- if (nc_put_att_text(ncid, lat_varid, UNITS,
+ if (nc_put_att_text(ncid, lat_varid, UNITS,
strlen(DEGREES_NORTH), DEGREES_NORTH)) ERR;
- if (nc_put_att_text(ncid, lon_varid, UNITS,
+ if (nc_put_att_text(ncid, lon_varid, UNITS,
strlen(DEGREES_EAST), DEGREES_EAST)) ERR;
/* The dimids array is used to pass the dimids of the dimensions of
@@ -146,15 +147,15 @@ create_4D_example(char *file_name, int cmode)
/* Define the netCDF variables for the pressure and temperature
* data. */
- if (nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS_EX,
+ if (nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS_EX,
dimids, &pres_varid)) ERR;
- if (nc_def_var(ncid, TEMP_NAME, NC_FLOAT, NDIMS_EX,
+ if (nc_def_var(ncid, TEMP_NAME, NC_FLOAT, NDIMS_EX,
dimids, &temp_varid)) ERR;
/* Assign units attributes to the netCDF variables. */
- if (nc_put_att_text(ncid, pres_varid, UNITS,
+ if (nc_put_att_text(ncid, pres_varid, UNITS,
strlen(PRES_UNITS), PRES_UNITS)) ERR;
- if (nc_put_att_text(ncid, temp_varid, UNITS,
+ if (nc_put_att_text(ncid, temp_varid, UNITS,
strlen(TEMP_UNITS), TEMP_UNITS)) ERR;
/* End define mode. */
@@ -183,9 +184,9 @@ create_4D_example(char *file_name, int cmode)
for (rec = 0; rec < NREC; rec++)
{
start[0] = rec;
- if (nc_put_vara_float(ncid, pres_varid, start, count,
+ if (nc_put_vara_float(ncid, pres_varid, start, count,
&pres_out[0][0][0])) ERR;
- if (nc_put_vara_float(ncid, temp_varid, start, count,
+ if (nc_put_vara_float(ncid, temp_varid, start, count,
&temp_out[0][0][0])) ERR;
}
@@ -247,18 +248,18 @@ check_4D_example(char *file_name, int expected_format)
strcmp(var_name_in[2], PRES_NAME) || strcmp(var_name_in[3], TEMP_NAME)) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimid, &natts_in)) ERR;
- if (strcmp(name_in, LAT_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
+ if (strcmp(name_in, LAT_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
dimid[0] != 1 || natts_in != 1) ERR;
if (nc_inq_var(ncid, 1, name_in, &xtype_in, &ndims_in, dimid, &natts_in)) ERR;
- if (strcmp(name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
+ if (strcmp(name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
dimid[0] != 2 || natts_in != 1) ERR;
if (nc_inq_var(ncid, 2, name_in, &xtype_in, &ndims_in, dimid, &natts_in)) ERR;
- if (strcmp(name_in, PRES_NAME) || xtype_in != NC_FLOAT || ndims_in != 4 ||
- dimid[0] != 3 || dimid[1] != 0 || dimid[2] != 1 || dimid[3] != 2 ||
+ if (strcmp(name_in, PRES_NAME) || xtype_in != NC_FLOAT || ndims_in != 4 ||
+ dimid[0] != 3 || dimid[1] != 0 || dimid[2] != 1 || dimid[3] != 2 ||
natts_in != 1) ERR;
if (nc_inq_var(ncid, 3, name_in, &xtype_in, &ndims_in, dimid, &natts_in)) ERR;
- if (strcmp(name_in, TEMP_NAME) || xtype_in != NC_FLOAT || ndims_in != 4 ||
- dimid[0] != 3 || dimid[1] != 0 || dimid[2] != 1 || dimid[3] != 2 ||
+ if (strcmp(name_in, TEMP_NAME) || xtype_in != NC_FLOAT || ndims_in != 4 ||
+ dimid[0] != 3 || dimid[1] != 0 || dimid[2] != 1 || dimid[3] != 2 ||
natts_in != 1) ERR;
/* Check variable atts. */
@@ -333,7 +334,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("*** testing simple variables...");
- {
+ {
/* Create a file with a variable of each type. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
@@ -371,9 +372,9 @@ main(int argc, char **argv)
size_t size_in;
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
- if (strcmp(name_in, VAR_BYTE_NAME) || xtype_in != NC_BYTE ||
+ if (strcmp(name_in, VAR_BYTE_NAME) || xtype_in != NC_BYTE ||
ndims_in != 2 || natts_in != 0 || dimids_in[0] != dimids[0] ||
dimids_in[1] != dimids[1]) ERR;
if (nc_inq_varid(ncid, VAR_BYTE_NAME, &varid_in)) ERR;
@@ -388,11 +389,11 @@ main(int argc, char **argv)
if (strcmp(name_in, VAR_CHAR_NAME)) ERR;
if (nc_inq_varname(ncid, 2, name_in)) ERR;
if (strcmp(name_in, VAR_SHORT_NAME)) ERR;
- if (nc_inq_vartype(ncid, 0, &xtype_in)) ERR;
+ if (nc_inq_vartype(ncid, 0, &xtype_in)) ERR;
if (xtype_in != NC_BYTE) ERR;
- if (nc_inq_vartype(ncid, 1, &xtype_in)) ERR;
+ if (nc_inq_vartype(ncid, 1, &xtype_in)) ERR;
if (xtype_in != NC_CHAR) ERR;
- if (nc_inq_vartype(ncid, 2, &xtype_in)) ERR;
+ if (nc_inq_vartype(ncid, 2, &xtype_in)) ERR;
if (xtype_in != NC_SHORT) ERR;
/* Check inquire of atomic types */
@@ -451,43 +452,43 @@ main(int argc, char **argv)
/* Open the file and check data. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
+ if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != byte_out[i][j]) ERR;
- if (nc_get_var_short(ncid, short_varid, (short *)short_in)) ERR;
+ if (nc_get_var_short(ncid, short_varid, (short *)short_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (short_in[i][j] != short_out[i][j]) ERR;
- if (nc_get_var_int(ncid, int_varid, (int *)int_in)) ERR;
+ if (nc_get_var_int(ncid, int_varid, (int *)int_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (int_in[i][j] != int_out[i][j]) ERR;
- if (nc_get_var_float(ncid, float_varid, (float *)float_in)) ERR;
+ if (nc_get_var_float(ncid, float_varid, (float *)float_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (float_in[i][j] != float_out[i][j]) ERR;
- if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != double_out[i][j]) ERR;
- if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != double_out[i][j]) ERR;
- if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != double_out[i][j]) ERR;
- if (nc_get_var_uint(ncid, uint_varid, (unsigned int *)uint_in)) ERR;
+ if (nc_get_var_uint(ncid, uint_varid, (unsigned int *)uint_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (uint_in[i][j] != uint_out[i][j]) ERR;
- if (nc_get_var_longlong(ncid, int64_varid, (long long *)int64_in)) ERR;
+ if (nc_get_var_longlong(ncid, int64_varid, (long long *)int64_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (int64_in[i][j] != int64_out[i][j]) ERR;
- if (nc_get_var_ulonglong(ncid, uint64_varid, (unsigned long long *)uint64_in)) ERR;
+ if (nc_get_var_ulonglong(ncid, uint64_varid, (unsigned long long *)uint64_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (uint64_in[i][j] != uint64_out[i][j]) ERR;
@@ -495,39 +496,39 @@ main(int argc, char **argv)
/* Open the file and read everything as double. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_double(ncid, byte_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, byte_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)byte_out[i][j]) ERR;
- if (nc_get_var_double(ncid, ubyte_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, ubyte_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)ubyte_out[i][j]) ERR;
- if (nc_get_var_double(ncid, short_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, short_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)short_out[i][j]) ERR;
- if (nc_get_var_double(ncid, ushort_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, ushort_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)ushort_out[i][j]) ERR;
- if (nc_get_var_double(ncid, int_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, int_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)int_out[i][j]) ERR;
- if (nc_get_var_double(ncid, uint_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, uint_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)uint_out[i][j]) ERR;
- if (nc_get_var_double(ncid, float_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, float_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)float_out[i][j]) ERR;
- if (nc_get_var_double(ncid, int64_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, int64_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)int64_out[i][j]) ERR;
- if (nc_get_var_double(ncid, uint64_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, uint64_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)uint64_out[i][j]) ERR;
@@ -535,39 +536,39 @@ main(int argc, char **argv)
/* Open the file and read everything as NC_BYTE. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
+ if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)byte_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, ubyte_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, ubyte_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)ubyte_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, short_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, short_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)short_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, ushort_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, ushort_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)ushort_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, int_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, int_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)int_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, uint_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, uint_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)uint_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, float_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, float_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)float_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, int64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, int64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)int64_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, uint64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, uint64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)uint64_out[i][j]) ERR;
@@ -627,9 +628,9 @@ main(int argc, char **argv)
char name_in[NC_MAX_NAME+1];
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in,
+ if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in,
&natts_in)) ERR;
- if (strcmp(name_in, VAR_BYTE_NAME) || xtype_in != NC_BYTE ||
+ if (strcmp(name_in, VAR_BYTE_NAME) || xtype_in != NC_BYTE ||
ndims_in != 2 || natts_in != 0 || dimids_in[0] != dimids[0] ||
dimids_in[1] != dimids[1]) ERR;
if (nc_inq_varid(ncid, VAR_BYTE_NAME, &varid_in)) ERR;
@@ -644,54 +645,54 @@ main(int argc, char **argv)
if (strcmp(name_in, VAR_CHAR_NAME)) ERR;
if (nc_inq_varname(ncid, 2, name_in)) ERR;
if (strcmp(name_in, VAR_SHORT_NAME)) ERR;
- if (nc_inq_vartype(ncid, 0, &xtype_in)) ERR;
+ if (nc_inq_vartype(ncid, 0, &xtype_in)) ERR;
if (xtype_in != NC_BYTE) ERR;
- if (nc_inq_vartype(ncid, 1, &xtype_in)) ERR;
+ if (nc_inq_vartype(ncid, 1, &xtype_in)) ERR;
if (xtype_in != NC_CHAR) ERR;
- if (nc_inq_vartype(ncid, 2, &xtype_in)) ERR;
+ if (nc_inq_vartype(ncid, 2, &xtype_in)) ERR;
if (xtype_in != NC_SHORT) ERR;
if (nc_close(ncid)) ERR;
}
/* Open the file and check data. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
+ if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != byte_out[i][j]) ERR;
- if (nc_get_var_short(ncid, short_varid, (short *)short_in)) ERR;
+ if (nc_get_var_short(ncid, short_varid, (short *)short_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (short_in[i][j] != short_out[i][j]) ERR;
- if (nc_get_var_int(ncid, int_varid, (int *)int_in)) ERR;
+ if (nc_get_var_int(ncid, int_varid, (int *)int_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (int_in[i][j] != int_out[i][j]) ERR;
- if (nc_get_var_float(ncid, float_varid, (float *)float_in)) ERR;
+ if (nc_get_var_float(ncid, float_varid, (float *)float_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (float_in[i][j] != float_out[i][j]) ERR;
- if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != double_out[i][j]) ERR;
- if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != double_out[i][j]) ERR;
- if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, double_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != double_out[i][j]) ERR;
- if (nc_get_var_uint(ncid, uint_varid, (unsigned int *)uint_in)) ERR;
+ if (nc_get_var_uint(ncid, uint_varid, (unsigned int *)uint_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (uint_in[i][j] != uint_out[i][j]) ERR;
- if (nc_get_var_longlong(ncid, int64_varid, (long long *)int64_in)) ERR;
+ if (nc_get_var_longlong(ncid, int64_varid, (long long *)int64_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (int64_in[i][j] != int64_out[i][j]) ERR;
- if (nc_get_var_ulonglong(ncid, uint64_varid, (unsigned long long *)uint64_in)) ERR;
+ if (nc_get_var_ulonglong(ncid, uint64_varid, (unsigned long long *)uint64_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (uint64_in[i][j] != uint64_out[i][j]) ERR;
@@ -699,39 +700,39 @@ main(int argc, char **argv)
/* Open the file and read everything as double. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_double(ncid, byte_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, byte_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)byte_out[i][j]) ERR;
- if (nc_get_var_double(ncid, ubyte_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, ubyte_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)ubyte_out[i][j]) ERR;
- if (nc_get_var_double(ncid, short_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, short_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)short_out[i][j]) ERR;
- if (nc_get_var_double(ncid, ushort_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, ushort_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)ushort_out[i][j]) ERR;
- if (nc_get_var_double(ncid, int_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, int_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)int_out[i][j]) ERR;
- if (nc_get_var_double(ncid, uint_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, uint_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)uint_out[i][j]) ERR;
- if (nc_get_var_double(ncid, float_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, float_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)float_out[i][j]) ERR;
- if (nc_get_var_double(ncid, int64_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, int64_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)int64_out[i][j]) ERR;
- if (nc_get_var_double(ncid, uint64_varid, (double *)double_in)) ERR;
+ if (nc_get_var_double(ncid, uint64_varid, (double *)double_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (double_in[i][j] != (double)uint64_out[i][j]) ERR;
@@ -739,39 +740,39 @@ main(int argc, char **argv)
/* Open the file and read everything as NC_BYTE. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
- if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
+ if (nc_get_var_schar(ncid, byte_varid, (signed char *)byte_in)) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)byte_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, ubyte_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, ubyte_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)ubyte_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, short_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, short_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)short_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, ushort_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, ushort_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)ushort_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, int_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, int_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)int_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, uint_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, uint_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)uint_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, float_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, float_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)float_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, int64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, int64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)int64_out[i][j]) ERR;
- if (nc_get_var_schar(ncid, uint64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
+ if (nc_get_var_schar(ncid, uint64_varid, (signed char *)byte_in) != NC_ERANGE) ERR;
for (i = 0; i < DIM1_LEN; i++)
for (j = 0; j < DIM2_LEN; j++)
if (byte_in[i][j] != (signed char)uint64_out[i][j]) ERR;
@@ -815,9 +816,9 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, VAR_NAME4) || xtype_in != NC_INT64 ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
&deflate_level)) ERR;
- if (shuffle_in != NC_NOSHUFFLE ||!deflate_in ||
+ if (shuffle_in != NC_NOSHUFFLE ||!deflate_in ||
deflate_level != DEFLATE_LEVEL) ERR;
if (nc_close(ncid)) ERR;
@@ -835,9 +836,9 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, VAR_NAME4) || xtype_in != NC_INT64 ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
&deflate_level)) ERR;
- if (shuffle_in != NC_NOSHUFFLE ||!deflate_in ||
+ if (shuffle_in != NC_NOSHUFFLE ||!deflate_in ||
deflate_level != DEFLATE_LEVEL) ERR;
if (nc_close(ncid)) ERR;
@@ -874,7 +875,7 @@ main(int argc, char **argv)
if (dimids[0] != 0) ERR;
for (i = 0; i < NVARS5; i++)
{
- if (nc_def_var(ncid, var_name[i], NC_INT64, NDIMS5, dimids,
+ if (nc_def_var(ncid, var_name[i], NC_INT64, NDIMS5, dimids,
&varid[i])) ERR;
if (varid[i] != i) ERR;
if (nc_def_var_deflate(ncid, varid[i], NC_SHUFFLE, 1, deflate_level[i])) ERR;
@@ -893,9 +894,9 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, var_name[i]) || xtype_in != NC_INT64 ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
&deflate_level_in)) ERR;
- if (shuffle_in != NC_SHUFFLE || !deflate_in ||
+ if (shuffle_in != NC_SHUFFLE || !deflate_in ||
deflate_level_in != deflate_level[i]) ERR;
}
@@ -916,9 +917,9 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, var_name[i]) || xtype_in != NC_INT64 ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
&deflate_level_in)) ERR;
- if (shuffle_in != NC_SHUFFLE || !deflate_in ||
+ if (shuffle_in != NC_SHUFFLE || !deflate_in ||
deflate_level_in != deflate_level[i]) ERR;
}
@@ -978,7 +979,7 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, var_name[i]) || xtype_in != NC_DOUBLE ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
&deflate_level_in)) ERR;
if (shuffle_in != NC_NOSHUFFLE || !deflate_in || deflate_level_in != 0) ERR;
if (nc_inq_var_fletcher32(ncid, varid[i], &checksum_in)) ERR;
@@ -1002,9 +1003,9 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, var_name[i]) || xtype_in != NC_DOUBLE ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, varid[i], &shuffle_in, &deflate_in,
&deflate_level_in)) ERR;
- if (shuffle_in != NC_NOSHUFFLE || !deflate_in ||
+ if (shuffle_in != NC_NOSHUFFLE || !deflate_in ||
deflate_level_in != 0) ERR;
if (nc_inq_var_fletcher32(ncid, varid[i], &checksum_in)) ERR;
if (checksum_in != NC_FLETCHER32) ERR;
@@ -1041,7 +1042,7 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, VAR7_NAME) || xtype_in != NC_USHORT ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
&deflate_level_in)) ERR;
if (shuffle_in != NC_NOSHUFFLE || deflate_in) ERR;
if (nc_inq_var_fletcher32(ncid, 0, &checksum_in)) ERR;
@@ -1069,7 +1070,7 @@ main(int argc, char **argv)
dimids_in, &natts)) ERR;
if (strcmp(name_in, VAR7_NAME) || xtype_in != NC_USHORT ||
ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
- if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
+ if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
&deflate_level_in)) ERR;
if (shuffle_in != NC_NOSHUFFLE || deflate_in) ERR;
if (nc_inq_var_fletcher32(ncid, 0, &checksum_in)) ERR;
@@ -1123,13 +1124,13 @@ main(int argc, char **argv)
printf("*** testing fill values for 2D unlimited dimension variable...");
{
#define D1_NAME "unlimited"
-#define D1_TARGET 3
+#define D1_TARGET 3
#define D2_NAME "fixed"
#define D2_LEN 3
#define D2_TARGET 2
#define V1_NAME "var1"
#define ND1 2
-#define TARGET_VALUE 42
+#define TARGET_VALUE 42
int dimids[ND1];
size_t index[ND1];
@@ -1212,25 +1213,23 @@ main(int argc, char **argv)
printf("*** testing 4D example file in classic format...");
if (create_4D_example(NC3_CLASSIC_FILE, NC_CLOBBER)) ERR;
- if (check_4D_example(NC3_CLASSIC_FILE, NC_FORMAT_CLASSIC)) ERR;
+ if (check_4D_example(NC3_CLASSIC_FILE, NC_FORMAT_CLASSIC)) ERR;
SUMMARIZE_ERR;
printf("*** testing 4D example file in 64-bit offset format...");
if (create_4D_example(NC3_64BIT_OFFSET_FILE, NC_CLOBBER|NC_64BIT_OFFSET)) ERR;
- if (check_4D_example(NC3_64BIT_OFFSET_FILE, NC_FORMAT_64BIT_OFFSET)) ERR;
+ if (check_4D_example(NC3_64BIT_OFFSET_FILE, NC_FORMAT_64BIT_OFFSET)) ERR;
SUMMARIZE_ERR;
printf("*** testing 4D example file in netCDF-4/HDF5 format...");
if (create_4D_example(NC3_NETCDF4_FILE, NC_CLOBBER|NC_NETCDF4)) ERR;
- if (check_4D_example(NC3_NETCDF4_FILE, NC_FORMAT_NETCDF4)) ERR;
+ if (check_4D_example(NC3_NETCDF4_FILE, NC_FORMAT_NETCDF4)) ERR;
SUMMARIZE_ERR;
printf("*** testing 4D example file in netCDF-4/HDF5 format with classic model rules...");
if (create_4D_example(NC3_NETCDF4_CLASSIC_FILE, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL)) ERR;
- if (check_4D_example(NC3_NETCDF4_CLASSIC_FILE, NC_FORMAT_NETCDF4_CLASSIC)) ERR;
+ if (check_4D_example(NC3_NETCDF4_CLASSIC_FILE, NC_FORMAT_NETCDF4_CLASSIC)) ERR;
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_vars2.c b/nc_test4/tst_vars2.c
index 19527c0..5b8081b 100644
--- a/nc_test4/tst_vars2.c
+++ b/nc_test4/tst_vars2.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_vars2.c,v 1.35 2010/01/25 21:01:08 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_vars2.nc"
@@ -14,7 +15,7 @@
#define DIM1_LEN NC_UNLIMITED
#define DIM1_NAME "Hoplites_Engaged"
#define VAR_NAME "Battle_of_Marathon"
-#define LOSSES_NAME "Miltiades_Losses"
+#define LOSSES_NAME "Miltiades_Losses"
#define MAX_CNUM 4
@@ -35,7 +36,7 @@ main(int argc, char **argv)
for (cnum = 0; cnum < MAX_CNUM; cnum++)
{
int cmode = 0;
-
+
switch(cnum)
{
case 0:
@@ -66,7 +67,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, 0, NULL, &varid)) ERR;
if (nc_enddef(ncid)) ERR;
if (nc_redef(ncid)) ERR;
- if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
+ if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
if (nc_close(ncid)) ERR;
/* Open the file and check. */
@@ -95,7 +96,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, NUM_DIMS, dimids, &varid)) ERR;
if (nc_enddef(ncid)) ERR;
if (nc_redef(ncid)) ERR;
- if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
+ if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
if (nc_enddef(ncid)) ERR;
/* Write the second record. */
@@ -113,7 +114,7 @@ main(int argc, char **argv)
start[0] = 1;
if (nc_get_vara_schar(ncid, varid, start, count, &data_in)) ERR;
if (data_in != data) ERR;
-
+
/* Close up. */
if (nc_close(ncid)) ERR;
@@ -142,7 +143,7 @@ main(int argc, char **argv)
start[0] = 1;
if (nc_get_vara_schar(ncid, varid, start, count, &data_in)) ERR;
if (data_in != data) ERR;
-
+
if (nc_close(ncid)) ERR;
}
@@ -158,7 +159,7 @@ main(int argc, char **argv)
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, NUM_DIMS, dimids, &varid)) ERR;
if (nc_put_att_int(ncid, varid, LOSSES_NAME, NC_INT, 1, &losses_value)) ERR;
- if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
+ if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
if (nc_close(ncid)) ERR;
/* Open the file and check. */
@@ -182,8 +183,8 @@ main(int argc, char **argv)
printf("**** testing fill value with three other attributes...");
{
#define NUM_LEADERS 3
- char leader[NUM_LEADERS][NC_MAX_NAME + 1] = {"hair_length_of_strategoi",
- "hair_length_of_Miltiades",
+ char leader[NUM_LEADERS][NC_MAX_NAME + 1] = {"hair_length_of_strategoi",
+ "hair_length_of_Miltiades",
"hair_length_of_Darius_I"};
short hair_length[NUM_LEADERS] = {3, 11, 4};
short short_in;
@@ -196,7 +197,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, NC_BYTE, NUM_DIMS, dimids, &varid)) ERR;
for (a = 0; a < NUM_LEADERS; a++)
if (nc_put_att_short(ncid, varid, leader[a], NC_SHORT, 1, &hair_length[a])) ERR;
- if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
+ if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
if (nc_close(ncid)) ERR;
/* Open the file. */
@@ -257,13 +258,13 @@ main(int argc, char **argv)
if (nc_def_dim(ncid, DIM_C, DIM_C_LEN, &dimid[2])) ERR;
/* Create var. */
- if (nc_def_var(ncid, CXX_VAR_NAME, NC_FLOAT, VAR_DIMS,
+ if (nc_def_var(ncid, CXX_VAR_NAME, NC_FLOAT, VAR_DIMS,
var_dimids, &varid)) ERR;
if (varid) ERR;
- if (nc_put_att(ncid, varid, LONG_NAME, NC_CHAR, strlen(long_name) + 1,
+ if (nc_put_att(ncid, varid, LONG_NAME, NC_CHAR, strlen(long_name) + 1,
long_name)) ERR;
- if (nc_put_att(ncid, varid, UNITS, NC_CHAR, strlen(UNITS) + 1,
+ if (nc_put_att(ncid, varid, UNITS, NC_CHAR, strlen(UNITS) + 1,
UNITS)) ERR;
/* Check to ensure the atts have their expected attnums. */
@@ -275,7 +276,7 @@ main(int argc, char **argv)
/* Now add a fill value. This will acutually cause HDF5 to
* destroy the dataset and recreate it, recreating also the
* three attributes that are attached to it. */
- if (nc_put_att(ncid, varid, _FillValue, NC_FLOAT,
+ if (nc_put_att(ncid, varid, _FillValue, NC_FLOAT,
1, &fill_value)) ERR;
/* Check to ensure the atts have their expected attnums. */
@@ -441,7 +442,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
- SUMMARIZE_ERR;
+ SUMMARIZE_ERR;
printf("**** testing dimension and variable renaming...");
{
/* This test contributed by Jeff Whitaker of NOAA - Thanks Jeff! */
@@ -481,7 +482,7 @@ main(int argc, char **argv)
if (nc_rename_var(ncid, wind_id, "wind")) ERR;
if (nc_close(ncid)) ERR;
}
- SUMMARIZE_ERR;
+ SUMMARIZE_ERR;
/* printf("*** testing 2D array of NC_CHAR..."); */
@@ -685,7 +686,7 @@ main(int argc, char **argv)
if (nvars != 1) ERR;
if (varids_in[0] != 0) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(name_in, VAR_NAME5) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
+ if (strcmp(name_in, VAR_NAME5) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
dimids_in[0] != 0) ERR;
if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
for (d = 0; d < NDIMS5; d++)
@@ -695,7 +696,7 @@ main(int argc, char **argv)
for (i = 0; i < DIM5_LEN; i++)
if (data[i] != data_in[i])
ERR_RET;
- if (nc_get_var_chunk_cache(ncid, varid, &cache_size_in, &cache_nelems_in,
+ if (nc_get_var_chunk_cache(ncid, varid, &cache_size_in, &cache_nelems_in,
&cache_preemption_in)) ERR;
if (cache_size_in != CACHE_SIZE || cache_nelems_in != CACHE_NELEMS ||
cache_preemption_in != CACHE_PREEMPTION) ERR;
@@ -712,7 +713,7 @@ main(int argc, char **argv)
if (nvars != 1) ERR;
if (varids_in[0] != 0) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(name_in, VAR_NAME5) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
+ if (strcmp(name_in, VAR_NAME5) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
dimids_in[0] != 0) ERR;
if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
for (d = 0; d < NDIMS5; d++)
@@ -762,7 +763,7 @@ main(int argc, char **argv)
if (nvars != 1) ERR;
if (varids_in[0] != 0) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(name_in, VAR_NAME6) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
+ if (strcmp(name_in, VAR_NAME6) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
dimids_in[0] != 0) ERR;
if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
if (storage_in != NC_CONTIGUOUS) ERR;
@@ -783,7 +784,7 @@ main(int argc, char **argv)
if (nvars != 1) ERR;
if (varids_in[0] != 0) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(name_in, VAR_NAME6) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
+ if (strcmp(name_in, VAR_NAME6) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
dimids_in[0] != 0) ERR;
if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
if (storage_in != NC_CONTIGUOUS) ERR;
@@ -839,7 +840,7 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("**** testing error codes for name clashes...");
{
-#define GENERIC_NAME "bob"
+#define GENERIC_NAME "bob"
int ncid, varid, numgrps, ntypes;
/* Create a netcdf-4 file with one var. */
@@ -853,7 +854,7 @@ main(int argc, char **argv)
/* Close it. */
if (nc_close(ncid)) ERR;
-
+
/* Open the file and check. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
@@ -871,7 +872,7 @@ main(int argc, char **argv)
printf("**** testing error codes for name clashes some more...");
{
-#define GENERIC_NAME "bob"
+#define GENERIC_NAME "bob"
int ncid, varid, numgrps, ntypes;
/* Create a netcdf-4 file with one type. */
@@ -885,7 +886,7 @@ main(int argc, char **argv)
/* Close it. */
if (nc_close(ncid)) ERR;
-
+
/* Open the file and check. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
@@ -900,7 +901,7 @@ main(int argc, char **argv)
printf("**** testing error codes for name clashes even more...");
{
-#define GENERIC_NAME "bob"
+#define GENERIC_NAME "bob"
int ncid, varid, numgrps, ntypes;
/* Create a netcdf-4 file with one group. */
@@ -914,7 +915,7 @@ main(int argc, char **argv)
/* Close it. */
if (nc_close(ncid)) ERR;
-
+
/* Open the file and check. */
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
@@ -963,7 +964,7 @@ main(int argc, char **argv)
if (nvars != 1) ERR;
if (varids_in[0] != 0) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(name_in, VAR_NAME17) || xtype_in != NC_UINT64 || ndims != 2 || natts != 0 ||
+ if (strcmp(name_in, VAR_NAME17) || xtype_in != NC_UINT64 || ndims != 2 || natts != 0 ||
dimids_in[0] != 0 || dimids_in[1] != 1) ERR;
if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
for (d = 0; d < NDIMS17; d++)
@@ -982,7 +983,7 @@ main(int argc, char **argv)
if (nvars != 1) ERR;
if (varids_in[0] != 0) ERR;
if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
- if (strcmp(name_in, VAR_NAME17) || xtype_in != NC_UINT64 || ndims != 2 || natts != 0 ||
+ if (strcmp(name_in, VAR_NAME17) || xtype_in != NC_UINT64 || ndims != 2 || natts != 0 ||
dimids_in[0] != 0 || dimids_in[1] != 1) ERR;
if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
for (d = 0; d < NDIMS17; d++)
@@ -1018,7 +1019,7 @@ main(int argc, char **argv)
/* This won't work because of the deflate filter. */
if (nc_def_var_chunking(ncid, varid2, NC_CONTIGUOUS, NULL) != NC_EINVAL) ERR;
-
+
/* Storage must be chunked because of unlimited dimension and
* the deflate filter. */
if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksize_in)) ERR;
@@ -1056,7 +1057,7 @@ main(int argc, char **argv)
/* This won't work because of the deflate filter. */
if (nc_def_var_chunking(ncid, varid2, NC_CONTIGUOUS, NULL) != NC_EINVAL) ERR;
-
+
/* Storage must be chunked because of unlimited dimension and
* the deflate filter. */
if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksize_in)) ERR;
@@ -1069,5 +1070,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
diff --git a/nc_test4/tst_vars3.c b/nc_test4/tst_vars3.c
index 370784f..f876798 100644
--- a/nc_test4/tst_vars3.c
+++ b/nc_test4/tst_vars3.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id: tst_vars3.c,v 1.29 2010/04/30 18:21:52 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_vars3.nc"
@@ -90,7 +91,7 @@ main(int argc, char **argv)
for (y = 0; y < NY; y++)
data_outy[y] = y;
#endif
-
+
/* Create file with two dims, two 1D vars. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_dim(ncid, D1_NAME, NX, &x_dimid)) ERR;
@@ -107,7 +108,7 @@ main(int argc, char **argv)
/* Check the file. */
if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (nvars != 2 || ndims != 2 || ngatts != 0 || unlimdimid != -1) ERR;
-
+
/* Check the dimensions. */
if (nc_inq_dimids(ncid, &ndims, dimids_in, 1)) ERR;
if (ndims != 2 || dimids_in[0] != x_dimid || dimids_in[1] != y_dimid) ERR;
@@ -131,7 +132,7 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (nvars != 2 || ndims != 2 || ngatts != 0 || unlimdimid != -1) ERR;
-
+
/* Check the dimensions. */
if (nc_inq_dimids(ncid, &ndims, dimids_in, 1)) ERR;
if (ndims != 2 || dimids_in[0] != x_dimid || dimids_in[1] != y_dimid) ERR;
@@ -233,7 +234,7 @@ main(int argc, char **argv)
#define LEN 4
int ncid, dimids[RANK_P], time_id, p_id;
int ndims, dimids_in[RANK_P];
-
+
double data[1] = {3.14159};
size_t start[1] = {0}, count[1] = {1};
static float P_data[LEN];
@@ -321,7 +322,7 @@ main(int argc, char **argv)
#define D_VARNAME "dd"
#define E_VARNAME "ee"
int ncid, grpid;
- int timeDimId, bDimId, cDimId, dimidIn;
+ int timeDimId, bDimId, cDimId, dimidIn;
size_t timeDimSize = 2, bDimSize = 3, cDimSize = 1;
int cNdims = 1, eeNdims = 1, ddNdims = 1 ;
int cVarId, eeVarId, ddVarId ;
@@ -359,7 +360,7 @@ main(int argc, char **argv)
#define DIMNAME "abc"
#define SCALAR_VARNAME DIMNAME
int ncid;
- int dimid, varid;
+ int dimid, varid;
int ndims = 1;
size_t dimsize = 3;
char varname_in[NC_MAX_NAME];
@@ -440,7 +441,7 @@ main(int argc, char **argv)
/* if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, &dimids_in, &natts_in)) ERR; */
/* if (strcmp(var_name_in, V_SMALL) || xtype_in != NC_INT64 || ndims_in != 1 || */
/* natts_in != 0) ERR; */
-
+
/* /\* Make sure we have the szip settings we expect. *\/ */
/* if (nc_inq_var_szip(ncid, small_varid, &options_mask_in, &bits_per_pixel_in)) ERR; */
/* if (options_mask_in != 0 || bits_per_pixel_in !=0) ERR; */
@@ -455,9 +456,3 @@ main(int argc, char **argv)
/* #endif */
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_vars4.c b/nc_test4/tst_vars4.c
index 2674d53..51df425 100644
--- a/nc_test4/tst_vars4.c
+++ b/nc_test4/tst_vars4.c
@@ -2,11 +2,12 @@
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
- Test netcdf-4 variables.
+ Test netcdf-4 variables.
$Id$
*/
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_vars4.nc"
@@ -63,9 +64,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
-
-
-
-
-
diff --git a/nc_test4/tst_vl.c b/nc_test4/tst_vl.c
index 6d34d29..ac84f43 100644
--- a/nc_test4/tst_vl.c
+++ b/nc_test4/tst_vl.c
@@ -2,12 +2,13 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use. See www.unidata.ucar.edu for more info.
- Test netcdf-4 variable length code.
+ Test netcdf-4 variable length code.
$Id: tst_vl.c,v 1.30 2009/10/26 22:07:16 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_vl.nc"
@@ -38,7 +39,7 @@ main(int argc, char **argv)
int *phony, class_in;
size_t len_in;
int i, j;
-
+
/* Create phony data. */
for (i=0; i<DIM_LEN; i++)
{
@@ -49,7 +50,7 @@ main(int argc, char **argv)
data[i].p = phony;
data[i].len = i+1;
}
-
+
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_vlen(ncid, VLEN_NAME, NC_INT, &typeid)) ERR;
if (nc_inq_vlen(ncid, typeid, name_in, &size_in, &base_nc_type_in)) ERR;
@@ -61,7 +62,7 @@ main(int argc, char **argv)
if (nc_inq_compound(ncid, typeid, name_in, &size_in, NULL) != NC_EBADTYPE) ERR;
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME, typeid, DIM_LEN, data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Reset data to make sure it was really copied. */
for (i=0; i<DIM_LEN; i++)
for (j = 0; j < i + 1; j++)
@@ -110,7 +111,7 @@ main(int argc, char **argv)
nc_vlen_t data[DIM_LEN], data_in[DIM_LEN];
int *phony;
int i, j;
-
+
/* Create phony data. */
for (i=0; i<DIM_LEN; i++)
{
@@ -128,7 +129,7 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME, typeid, 1, dimids, &varid)) ERR;
if (nc_put_var(ncid, varid, data)) ERR;
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
@@ -164,7 +165,7 @@ main(int argc, char **argv)
int *phony, class_in;
size_t len_in;
int i, j;
-
+
/* Create phony data. */
for (i=0; i<DIM_LEN; i++)
{
@@ -175,7 +176,7 @@ main(int argc, char **argv)
data[i].p = phony;
data[i].len = i+1;
}
-
+
/* Create two files with the same vlen type. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid1)) ERR;
if (nc_create(FILE_NAME2, NC_NETCDF4, &ncid2)) ERR;
@@ -185,7 +186,7 @@ main(int argc, char **argv)
if (nc_copy_att(ncid1, NC_GLOBAL, ATT_NAME, ncid2, NC_GLOBAL)) ERR;
if (nc_close(ncid1)) ERR;
if (nc_close(ncid2)) ERR;
-
+
/* Reset data to make sure it was really copied. */
for (i=0; i<DIM_LEN; i++)
for (j = 0; j < i + 1; j++)
@@ -226,4 +227,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_xplatform.c b/nc_test4/tst_xplatform.c
index 1bca06a..b99149c 100644
--- a/nc_test4/tst_xplatform.c
+++ b/nc_test4/tst_xplatform.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME "tst_xplatform.nc"
@@ -40,9 +41,9 @@ main(int argc, char **argv)
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_compound(ncid, sizeof(struct s1), CMP_TYPE_NAME, &cmp_typeid)) ERR;
- if (nc_insert_compound(ncid, cmp_typeid, X_NAME,
+ if (nc_insert_compound(ncid, cmp_typeid, X_NAME,
NC_COMPOUND_OFFSET(struct s1, x), NC_FLOAT)) ERR;
- if (nc_insert_compound(ncid, cmp_typeid, Y_NAME,
+ if (nc_insert_compound(ncid, cmp_typeid, Y_NAME,
NC_COMPOUND_OFFSET(struct s1, y), NC_DOUBLE)) ERR;
if (nc_close(ncid)) ERR;
@@ -52,13 +53,13 @@ main(int argc, char **argv)
if (ntypes_in != 1) ERR;
if (nc_inq_compound(ncid, cmp_typeid, name_in, &size_in, &nfields_in)) ERR;
if (nfields_in != 2 || strcmp(name_in, CMP_TYPE_NAME) || size_in != sizeof(struct s1)) ERR;
- if (nc_inq_compound_field(ncid, cmp_typeid, 0, name_in, &offset_in,
+ if (nc_inq_compound_field(ncid, cmp_typeid, 0, name_in, &offset_in,
&field_type_in, &ndims_in, NULL)) ERR;
- if (strcmp(name_in, X_NAME) || offset_in != 0 || field_type_in != NC_FLOAT ||
+ if (strcmp(name_in, X_NAME) || offset_in != 0 || field_type_in != NC_FLOAT ||
ndims_in) ERR;
- if (nc_inq_compound_field(ncid, cmp_typeid, 1, name_in, &offset_in,
+ if (nc_inq_compound_field(ncid, cmp_typeid, 1, name_in, &offset_in,
&field_type_in, &ndims_in, NULL)) ERR;
- if (strcmp(name_in, Y_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s1, y) ||
+ if (strcmp(name_in, Y_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s1, y) ||
field_type_in != NC_DOUBLE || ndims_in) ERR;
if (nc_close(ncid)) ERR;
}
@@ -80,7 +81,7 @@ main(int argc, char **argv)
var = {1, -2} ;
}
*/
-
+
int ncid, cmp_typeid, ntypes_in, ndims_in, dimids_in[1], natts_in;
int nvars_in, unlimdimid;
char name_in[NC_MAX_NAME + 1];
@@ -94,7 +95,7 @@ main(int argc, char **argv)
{
strcat(file_in, getenv("srcdir"));
strcat(file_in, "/");
- }
+ }
strcat(file_in, "../ncdump/");
strcat(file_in, IN_FILE_NAME_3);
@@ -111,13 +112,13 @@ main(int argc, char **argv)
if (ntypes_in != 1) ERR;
if (nc_inq_compound(ncid, cmp_typeid, name_in, &size_in, &nfields_in)) ERR;
if (nfields_in != 2 || strcmp(name_in, CMP_TYPE_NAME) || size_in != sizeof(struct s1)) ERR;
- if (nc_inq_compound_field(ncid, cmp_typeid, 0, name_in, &offset_in,
+ if (nc_inq_compound_field(ncid, cmp_typeid, 0, name_in, &offset_in,
&field_type_in, &ndims_in, NULL)) ERR;
- if (strcmp(name_in, X_NAME) || offset_in != 0 || field_type_in != NC_FLOAT ||
+ if (strcmp(name_in, X_NAME) || offset_in != 0 || field_type_in != NC_FLOAT ||
ndims_in) ERR;
- if (nc_inq_compound_field(ncid, cmp_typeid, 1, name_in, &offset_in,
+ if (nc_inq_compound_field(ncid, cmp_typeid, 1, name_in, &offset_in,
&field_type_in, &ndims_in, NULL)) ERR;
- if (strcmp(name_in, Y_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s1, y) || field_type_in != NC_DOUBLE ||
+ if (strcmp(name_in, Y_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s1, y) || field_type_in != NC_DOUBLE ||
ndims_in) ERR;
/* Read the data. */
@@ -165,7 +166,7 @@ main(int argc, char **argv)
{
strcat(file_in, getenv("srcdir"));
strcat(file_in, "/");
- }
+ }
strcat(file_in, "../ncdump/");
strcat(file_in, IN_FILE_NAME_4);
@@ -206,4 +207,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/nc_test4/tst_xplatform2.c b/nc_test4/tst_xplatform2.c
index 1f46fac..5a50be5 100644
--- a/nc_test4/tst_xplatform2.c
+++ b/nc_test4/tst_xplatform2.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include "netcdf.h"
#define FILE_NAME_1 "tst_xplatform2_1.nc"
@@ -28,10 +29,10 @@
#define DIM1_LEN 5
#define DIM2_LEN 3
-#define VLEN_NAME "Magna_Carta_VLEN"
+#define VLEN_NAME "Magna_Carta_VLEN"
#define VLEN_ATT_NAME "We_will_sell_to_no_man_we_will_not_deny_or_defer_to_any_man_either_Justice_or_Right"
#define TWO_TYPES 2
-#define NUM_S1 4
+#define NUM_S1 4
#define DIM3_LEN 1
#define DIM3_NAME "DIMENSION->The city of London shall enjoy all its ancient liberties and free customs, both by land and by water."
@@ -40,7 +41,7 @@
#define NUM_VL 1
#define S3_ATT_NAME "King_John"
#define S3_TYPE_NAME "barons"
-#define VL_NAME "No scutage or aid may be levied in our kingdom without its general consent"
+#define VL_NAME "No scutage or aid may be levied in our kingdom without its general consent"
#define THREE_TYPES 3
struct s1
@@ -86,7 +87,7 @@ check_file_1(int ncid, nc_vlen_t *data_out)
/* How does the vlen type look? */
if (nc_inq_vlen(ncid, typeids_in[1], name_in, &size_in, &base_nc_type_in)) ERR;
- if (strcmp(name_in, VLEN_NAME) || size_in != sizeof(nc_vlen_t) ||
+ if (strcmp(name_in, VLEN_NAME) || size_in != sizeof(nc_vlen_t) ||
base_nc_type_in != typeids_in[0]) ERR;
/* Now read the attribute. */
@@ -108,7 +109,7 @@ check_file_1(int ncid, nc_vlen_t *data_out)
/* We're done! */
return NC_NOERR;
}
-
+
int
check_file_2(int ncid, struct s2 *data_out)
{
@@ -139,9 +140,9 @@ check_file_2(int ncid, struct s2 *data_out)
/* How does the containing compound type look? */
if (nc_inq_compound(ncid, typeids_in[1], name_in, &size_in, &nfields_in)) ERR;
- if (strcmp(name_in, S2_TYPE_NAME) || size_in != sizeof(struct s2) ||
+ if (strcmp(name_in, S2_TYPE_NAME) || size_in != sizeof(struct s2) ||
nfields_in != 1) ERR;
- if (nc_inq_compound_field(ncid, typeids_in[1], 0, name_in, &offset_in, &field_type_in,
+ if (nc_inq_compound_field(ncid, typeids_in[1], 0, name_in, &offset_in, &field_type_in,
&ndims_in, field_dims_in)) ERR;
if (strcmp(name_in, S1_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s2, data) ||
field_type_in != typeids_in[0] || ndims_in != 1 || field_dims_in[0] != NUM_S1) ERR;
@@ -154,11 +155,11 @@ check_file_2(int ncid, struct s2 *data_out)
for (j = 0; j < NUM_S1; j++)
if (data_out[i].data[j].x != data_in[i].data[j].x ||
data_out[i].data[j].y != data_in[i].data[j].y) ERR;
-
+
/* We're done! */
return NC_NOERR;
}
-
+
int
check_file_3(int ncid, struct s3 *data_out)
{
@@ -189,14 +190,14 @@ check_file_3(int ncid, struct s3 *data_out)
/* How does the vlen type look? */
if (nc_inq_vlen(ncid, typeids_in[1], name_in, &size_in, &base_nc_type_in)) ERR;
- if (strcmp(name_in, VLEN_NAME) || size_in != sizeof(nc_vlen_t) ||
+ if (strcmp(name_in, VLEN_NAME) || size_in != sizeof(nc_vlen_t) ||
base_nc_type_in != typeids_in[0]) ERR;
/* How does the containing compound type look? */
if (nc_inq_compound(ncid, typeids_in[2], name_in, &size_in, &nfields_in)) ERR;
- if (strcmp(name_in, S3_TYPE_NAME) || size_in != sizeof(struct s3) ||
+ if (strcmp(name_in, S3_TYPE_NAME) || size_in != sizeof(struct s3) ||
nfields_in != 1) ERR;
- if (nc_inq_compound_field(ncid, typeids_in[2], 0, name_in, &offset_in, &field_type_in,
+ if (nc_inq_compound_field(ncid, typeids_in[2], 0, name_in, &offset_in, &field_type_in,
&ndims_in, field_dims_in)) ERR;
if (strcmp(name_in, VL_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s3, data) ||
field_type_in != typeids_in[1] || ndims_in != 1 || field_dims_in[0] != NUM_VL) ERR;
@@ -222,7 +223,7 @@ check_file_3(int ncid, struct s3 *data_out)
/* We're done! */
return NC_NOERR;
}
-
+
int
check_file_4(int ncid, struct s3 *data_out)
{
@@ -253,14 +254,14 @@ check_file_4(int ncid, struct s3 *data_out)
/* How does the vlen type look? */
if (nc_inq_vlen(ncid, typeids_in[1], name_in, &size_in, &base_nc_type_in)) ERR;
- if (strcmp(name_in, VLEN_NAME) || size_in != sizeof(nc_vlen_t) ||
+ if (strcmp(name_in, VLEN_NAME) || size_in != sizeof(nc_vlen_t) ||
base_nc_type_in != typeids_in[0]) ERR;
/* How does the containing compound type look? */
if (nc_inq_compound(ncid, typeids_in[2], name_in, &size_in, &nfields_in)) ERR;
- if (strcmp(name_in, S3_TYPE_NAME) || size_in != sizeof(struct s3) ||
+ if (strcmp(name_in, S3_TYPE_NAME) || size_in != sizeof(struct s3) ||
nfields_in != 1) ERR;
- if (nc_inq_compound_field(ncid, typeids_in[2], 0, name_in, &offset_in, &field_type_in,
+ if (nc_inq_compound_field(ncid, typeids_in[2], 0, name_in, &offset_in, &field_type_in,
&ndims_in, field_dims_in)) ERR;
if (strcmp(name_in, VL_NAME) || offset_in != NC_COMPOUND_OFFSET(struct s3, data) ||
field_type_in != typeids_in[1] || ndims_in != 1 || field_dims_in[0] != NUM_VL) ERR;
@@ -286,7 +287,7 @@ check_file_4(int ncid, struct s3 *data_out)
/* We're done! */
return NC_NOERR;
}
-
+
int
main(int argc, char **argv)
{
@@ -563,4 +564,3 @@ main(int argc, char **argv)
FINAL_RESULTS;
}
-
diff --git a/ncdap_test/CMakeLists.txt b/ncdap_test/CMakeLists.txt
index 1294fa6..333bf31 100644
--- a/ncdap_test/CMakeLists.txt
+++ b/ncdap_test/CMakeLists.txt
@@ -43,8 +43,10 @@ IF(ENABLE_TESTS)
ENDIF()
IF(ENABLE_DAP_REMOTE_TESTS)
- add_sh_test(ncdap tst_remote3)
- add_sh_test(ncdap tst_formatx)
+ IF(BUILD_UTILITIES)
+ add_sh_test(ncdap tst_remote3)
+ add_sh_test(ncdap tst_formatx)
+ ENDIF(BUILD_UTILITIES)
add_bin_test(ncdap test_partvar)
IF(ENABLE_DAP_LONG_TESTS)
add_sh_test(ncdap tst_longremote3)
diff --git a/ncdap_test/Makefile.am b/ncdap_test/Makefile.am
index b4e0a9f..f672ccb 100644
--- a/ncdap_test/Makefile.am
+++ b/ncdap_test/Makefile.am
@@ -33,7 +33,11 @@ if ENABLE_DAP_REMOTE_TESTS
check_PROGRAMS += nctestserver
nctestserver_SOURCES = nctestserver.c
-TESTS += tst_remote3.sh tst_formatx.sh test_partvar testurl.sh
+if BUILD_UTILITIES
+TESTS += tst_remote3.sh tst_formatx.sh
+endif
+
+TESTS += test_partvar testurl.sh
if ENABLE_DAP_LONG_TESTS
TESTS += tst_longremote3.sh
diff --git a/ncdap_test/Makefile.in b/ncdap_test/Makefile.in
index a7b412c..ba1a02d 100644
--- a/ncdap_test/Makefile.in
+++ b/ncdap_test/Makefile.in
@@ -107,8 +107,8 @@ target_triplet = @target@
check_PROGRAMS = t_dap3a$(EXEEXT) test_cvt3$(EXEEXT) \
test_vara$(EXEEXT) $(am__EXEEXT_1)
TESTS = tst_ncdap3.sh t_dap3a$(EXEEXT) test_cvt3$(EXEEXT) \
- test_vara$(EXEEXT) $(am__EXEEXT_2) $(am__append_5) \
- $(am__EXEEXT_3) $(am__append_7)
+ test_vara$(EXEEXT) $(am__append_4) $(am__EXEEXT_2) \
+ $(am__append_6) $(am__EXEEXT_3) $(am__append_8)
# remote tests are optional
# because the server may be down or inaccessible
@@ -117,17 +117,18 @@ TESTS = tst_ncdap3.sh t_dap3a$(EXEEXT) test_cvt3$(EXEEXT) \
@ENABLE_DAP_REMOTE_TESTS_TRUE at am__append_3 = nctestserver test_partvar \
@ENABLE_DAP_REMOTE_TESTS_TRUE@ test_nstride_cached t_misc \
@ENABLE_DAP_REMOTE_TESTS_TRUE@ test_varm3 t_ncf330
- at ENABLE_DAP_REMOTE_TESTS_TRUE@am__append_4 = tst_remote3.sh tst_formatx.sh test_partvar testurl.sh
- at ENABLE_DAP_LONG_TESTS_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE at am__append_5 = tst_longremote3.sh
+ at BUILD_UTILITIES_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE at am__append_4 = tst_remote3.sh tst_formatx.sh
+ at ENABLE_DAP_REMOTE_TESTS_TRUE@am__append_5 = test_partvar testurl.sh
+ at ENABLE_DAP_LONG_TESTS_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE at am__append_6 = tst_longremote3.sh
#t_ncf330_SOURCES = t_ncf330.c
#TESTS += t_ncf330
- at ENABLE_DAP_REMOTE_TESTS_TRUE@am__append_6 = test_varm3 \
+ at ENABLE_DAP_REMOTE_TESTS_TRUE@am__append_7 = test_varm3 \
@ENABLE_DAP_REMOTE_TESTS_TRUE@ test_nstride_cached t_misc
#check_PROGRAMS += t_auth t_auth1
#TESTS += t_auth
- at ENABLE_DAP_AUTH_TESTS_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE at am__append_7 = testauth.sh
- at USE_NETCDF4_TRUE@am__append_8 = test_cvt4 t_dap4
+ at ENABLE_DAP_AUTH_TESTS_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE at am__append_8 = testauth.sh
+ at USE_NETCDF4_TRUE@am__append_9 = test_cvt4 t_dap4
subdir = ncdap_test
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -460,9 +461,8 @@ am__set_TESTS_bases = \
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
- at ENABLE_DAP_REMOTE_TESTS_TRUE@am__EXEEXT_2 = tst_remote3.sh \
- at ENABLE_DAP_REMOTE_TESTS_TRUE@ tst_formatx.sh \
- at ENABLE_DAP_REMOTE_TESTS_TRUE@ test_partvar$(EXEEXT) testurl.sh
+ at ENABLE_DAP_REMOTE_TESTS_TRUE@am__EXEEXT_2 = test_partvar$(EXEEXT) \
+ at ENABLE_DAP_REMOTE_TESTS_TRUE@ testurl.sh
@ENABLE_DAP_REMOTE_TESTS_TRUE at am__EXEEXT_3 = test_varm3$(EXEEXT) \
@ENABLE_DAP_REMOTE_TESTS_TRUE@ test_nstride_cached$(EXEEXT) \
@ENABLE_DAP_REMOTE_TESTS_TRUE@ t_misc$(EXEEXT)
@@ -727,7 +727,7 @@ EXTRA_DIST = tst_ncdap3.sh tst_ncdap4.sh \
CLEANFILES = test_varm3 test_cvt3 results/*.dmp results/*.das \
results/*.dds datadds* t_dap3a test_nstride_cached \
- $(am__append_8)
+ $(am__append_9)
# One last thing
BUILT_SOURCES = .dodsrc
diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt
index fb96ee4..8d888a1 100644
--- a/ncdump/CMakeLists.txt
+++ b/ncdump/CMakeLists.txt
@@ -59,7 +59,7 @@ IF(ENABLE_TESTS)
TARGET_LINK_LIBRARIES(bom netcdf)
TARGET_LINK_LIBRARIES(tst_dimsizes netcdf)
-IF(ENABLE_FILEINFO)
+IF(USE_NETCDF4)
ADD_EXECUTABLE(tst_fileinfo tst_fileinfo.c)
TARGET_LINK_LIBRARIES(tst_fileinfo netcdf)
add_sh_test(ncdump tst_fileinfo)
diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am
index bb7046a..b8bec73 100644
--- a/ncdump/Makefile.am
+++ b/ncdump/Makefile.am
@@ -35,7 +35,7 @@ tst_lengths.sh tst_calendars.sh tst_utf8 run_utf8_tests.sh \
tst_nccopy3.sh tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \
tst_dimsizes.sh
-if ENABLE_FILEINFO
+if USE_NETCDF4
check_PROGRAMS += tst_fileinfo
TESTS += tst_fileinfo.sh
endif
diff --git a/ncdump/Makefile.in b/ncdump/Makefile.in
index fdd8cd6..578fb3d 100644
--- a/ncdump/Makefile.in
+++ b/ncdump/Makefile.in
@@ -111,7 +111,7 @@ bin_PROGRAMS = ncdump$(EXEEXT) nccopy$(EXEEXT)
@BUILD_TESTSETS_TRUE@ ctest$(EXEEXT) ctest64$(EXEEXT) \
@BUILD_TESTSETS_TRUE@ ncdump$(EXEEXT) tst_utf8$(EXEEXT) \
@BUILD_TESTSETS_TRUE@ bom$(EXEEXT) tst_dimsizes$(EXEEXT) \
- at BUILD_TESTSETS_TRUE@ $(am__EXEEXT_1) $(am__EXEEXT_2)
+ at BUILD_TESTSETS_TRUE@ $(am__EXEEXT_1)
@BUILD_TESTSETS_TRUE at TESTS = tst_inttags.sh run_tests.sh tst_64bit.sh \
@BUILD_TESTSETS_TRUE@ ctest$(EXEEXT) ctest64$(EXEEXT) \
@BUILD_TESTSETS_TRUE@ tst_output.sh tst_lengths.sh \
@@ -121,30 +121,38 @@ bin_PROGRAMS = ncdump$(EXEEXT) nccopy$(EXEEXT)
@BUILD_TESTSETS_TRUE@ tst_formatx3.sh tst_bom.sh \
@BUILD_TESTSETS_TRUE@ tst_dimsizes.sh $(am__append_4) \
@BUILD_TESTSETS_TRUE@ $(am__append_5) $(am__append_6) \
- at BUILD_TESTSETS_TRUE@ $(am__append_7) $(am__EXEEXT_3) \
- at BUILD_TESTSETS_TRUE@ $(am__append_10) tst_ncgen4_classic.sh \
- at BUILD_TESTSETS_TRUE@ $(am__append_11)
- at BUILD_TESTSETS_TRUE@@ENABLE_FILEINFO_TRUE at am__append_3 = tst_fileinfo
- at BUILD_TESTSETS_TRUE@@ENABLE_FILEINFO_TRUE at am__append_4 = tst_fileinfo.sh
+ at BUILD_TESTSETS_TRUE@ $(am__append_7) $(am__EXEEXT_2) \
+ at BUILD_TESTSETS_TRUE@ $(am__append_9) tst_ncgen4_classic.sh \
+ at BUILD_TESTSETS_TRUE@ $(am__append_10)
+
+# NetCDF-4 has some extra tests.
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_3 = tst_fileinfo \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_create_files \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_h_rdc0 \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_group_data \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_enum_data \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_opaque_data \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_string_data \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_vlen_data tst_comp \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_comp2 tst_nans \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_special_atts \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_unicode tst_fillbug \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_compress \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_chunking \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_h_scalar tst_bug324
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_4 = tst_fileinfo.sh
@BUILD_TESTSETS_TRUE@@LARGE_FILE_TESTS_TRUE at am__append_5 = tst_iter.sh
@BUILD_DISKLESS_TRUE@@BUILD_TESTSETS_TRUE at am__append_6 = tst_inmemory_nc3.sh
@BUILD_DISKLESS_TRUE@@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_7 = tst_inmemory_nc4.sh
-
-# NetCDF-4 has some extra tests.
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_8 = tst_create_files tst_h_rdc0 tst_group_data \
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_enum_data tst_opaque_data tst_string_data tst_vlen_data tst_comp \
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_comp2 tst_nans tst_special_atts tst_unicode tst_fillbug tst_compress \
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_chunking tst_h_scalar tst_bug324
-
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_9 = tst_inttags4.sh tst_create_files tst_group_data tst_enum_data tst_opaque_data \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_8 = tst_inttags4.sh tst_create_files tst_group_data tst_enum_data tst_opaque_data \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_string_data tst_vlen_data tst_comp tst_comp2 tst_nans \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_special_atts tst_netcdf4.sh tst_h_rdc0 tst_unicode tst_fillbug \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_fillbug.sh tst_netcdf4_4.sh tst_compress tst_nccopy4.sh \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_grp_spec.sh tst_mud.sh tst_h_scalar tst_h_scalar.sh tst_formatx4.sh \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at tst_bug324 run_utf8_nc4_tests.sh
- at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE@@USE_NETCDF4_TRUE at am__append_10 = run_back_comp_tests.sh
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_11 = tst_ncgen4.sh
+ at BUILD_TESTSETS_TRUE@@EXTRA_TESTS_TRUE@@USE_NETCDF4_TRUE at am__append_9 = run_back_comp_tests.sh
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__append_10 = tst_ncgen4.sh
subdir = ncdump
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -159,8 +167,9 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
- at BUILD_TESTSETS_TRUE@@ENABLE_FILEINFO_TRUE at am__EXEEXT_1 = tst_fileinfo$(EXEEXT)
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_2 = tst_create_files$(EXEEXT) \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_1 = \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_fileinfo$(EXEEXT) \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_create_files$(EXEEXT) \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_h_rdc0$(EXEEXT) \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_group_data$(EXEEXT) \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_enum_data$(EXEEXT) \
@@ -563,7 +572,7 @@ am__set_TESTS_bases = \
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
- at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_3 = tst_inttags4.sh \
+ at BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_2 = tst_inttags4.sh \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_create_files$(EXEEXT) \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_group_data$(EXEEXT) \
@BUILD_TESTSETS_TRUE@@USE_NETCDF4_TRUE@ tst_enum_data$(EXEEXT) \
diff --git a/ncdump/ncdump.c b/ncdump/ncdump.c
index 6d353ed..374a883 100644
--- a/ncdump/ncdump.c
+++ b/ncdump/ncdump.c
@@ -763,7 +763,7 @@ pr_att(
ncatt_t att; /* attribute */
NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) );
-#ifdef ENABLE_FILEINFO
+#ifdef USE_NETCDF4
if (ncid == getrootid(ncid)
&& varid == NC_GLOBAL
&& strcmp(att.name,NCPROPS)==0)
@@ -1074,7 +1074,7 @@ pr_att_specials(
}
#endif /* USE_NETCDF4 */
-#ifdef ENABLE_FILEINFO /*=>NETCDF4*/
+#ifdef USE_NETCDF4
static void
pr_att_hidden(
int ncid,
@@ -1083,7 +1083,6 @@ pr_att_hidden(
{
int stat;
size_t len;
- char propdata[NCPROPS_LENGTH];
/* No special variable attributes for classic or 64-bit offset data */
if(kind == 1 || kind == 2)
@@ -1091,14 +1090,18 @@ pr_att_hidden(
/* Print out Selected hidden attributes */
/* NCPROPS */
stat = nc_inq_att(ncid,NC_GLOBAL,NCPROPS,NULL,&len);
- if(stat == NC_NOERR && len < sizeof(propdata)) {
+ if(stat == NC_NOERR) {
+ char* propdata = (char*)malloc(len+1);
+ if(propdata == NULL)
+ return;
stat = nc_get_att_text(ncid,NC_GLOBAL,NCPROPS,propdata);
if(stat == NC_NOERR) {
pr_att_name(ncid, "", NCPROPS);
/* make sure its null terminated */
- propdata[NCPROPS_LENGTH-1] = '\0';
+ propdata[len] = '\0';
printf(" = \"%s\" ;\n",propdata);
}
+ free(propdata);
}
/* _SuperblockVersion */
stat = nc_inq_att(ncid,NC_GLOBAL,SUPERBLOCKATT,NULL,&len);
@@ -1121,7 +1124,7 @@ pr_att_hidden(
}
}
}
-#endif /* ENABLE_FILEINFO */
+#endif /* USE_NETCDF4 */
/*
* Print a variable attribute for NcML
@@ -1138,7 +1141,7 @@ pr_attx(
int attvalslen = 0;
NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) );
-#ifdef ENABLE_FILEINFO
+#ifdef USE_NETCDF4
if (ncid == getrootid(ncid)
&& varid == NC_GLOBAL
&& strcmp(att.name,NCPROPS)==0
@@ -1751,7 +1754,7 @@ do_ncdump_rec(int ncid, const char *path)
}
if (is_root && formatting_specs.special_atts) { /* output special attribute
* for format variant */
-#ifdef ENABLE_FILEINFO
+#ifdef USE_NETCDF4
pr_att_hidden(ncid, kind);
#endif
pr_att_global_format(ncid, kind);
diff --git a/ncdump/ref_ctest1_nc4.cdl b/ncdump/ref_ctest1_nc4.cdl
index ef6bbed..0050660 100644
--- a/ncdump/ref_ctest1_nc4.cdl
+++ b/ncdump/ref_ctest1_nc4.cdl
@@ -28,9 +28,9 @@ variables:
double d ;
d:c = "abcd\tZ$&" ;
int64 i64 ;
- i64:att_int64 = 1LL ;
+ i64:att_int64 = 1 ;
uint64 ui64 ;
- ui64:att_uint64 = 1ULL ;
+ ui64:att_uint64 = 1 ;
char cr(Dr) ;
byte br(Dr) ;
short sr(Dr) ;
diff --git a/ncdump/tst_bug324.c b/ncdump/tst_bug324.c
index 2e6bcd2..2ce5b27 100644
--- a/ncdump/tst_bug324.c
+++ b/ncdump/tst_bug324.c
@@ -1,4 +1,5 @@
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
@@ -12,7 +13,7 @@
#define NAME_H "h"
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{/* Test bug fix for NCF-324, file that caused nc_close() failure for
* non-coordinate variable and dimension with the same name */
@@ -60,7 +61,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check file can be opened and read correctly */
- {
+ {
int format;
int ndims, nvars, ngatts, xdimid, nunlim;
nc_type lat_type, h_type;
@@ -91,7 +92,7 @@ main(int argc, char **argv)
}
}
if (nc_close(ncid)) ERR;
-
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
diff --git a/ncdump/tst_chunking.c b/ncdump/tst_chunking.c
index b491dc8..17e5910 100644
--- a/ncdump/tst_chunking.c
+++ b/ncdump/tst_chunking.c
@@ -9,6 +9,7 @@
#include <netcdf.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_chunking.nc"
#define VAR_RANK 7
diff --git a/ncdump/tst_comp.c b/ncdump/tst_comp.c
index 11d9d21..6768f49 100644
--- a/ncdump/tst_comp.c
+++ b/ncdump/tst_comp.c
@@ -9,6 +9,7 @@
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <string.h>
@@ -46,12 +47,12 @@ main(int argc, char **argv)
obs_t obsdata[DIM6_LEN] = {
{15, 2, 1, 0.5, 3600.01, 0, 0, 0, 0LL},
- {-99, -99, -99, -99.0f, -99.0, 255, 65535, 4294967295U,
+ {-99, -99, -99, -99.0f, -99.0, 255, 65535, 4294967295U,
-9223372036854775806LL},
{20, 6, 3, 0.75, 5000.01, 200, 64000, 4220002000U, 9000000000000000000LL }
};
- obs_t missing_val = {-99, -99, -99, -99, -99, 255, 65535, 4294967295U,
+ obs_t missing_val = {-99, -99, -99, -99, -99, 255, 65535, 4294967295U,
-9223372036854775806LL};
obs_t val_in;
size_t size_in;
@@ -64,29 +65,29 @@ main(int argc, char **argv)
/* Create a compound type. */
if (nc_def_compound(ncid, sizeof(obs_t), TYPE6_NAME, &typeid)) ERR;
- if (nc_insert_compound(ncid, typeid, "day",
+ if (nc_insert_compound(ncid, typeid, "day",
NC_COMPOUND_OFFSET(struct obs_t, day), NC_BYTE)) ERR;
- if (nc_insert_compound(ncid, typeid, "elev",
+ if (nc_insert_compound(ncid, typeid, "elev",
NC_COMPOUND_OFFSET(struct obs_t, elev), NC_SHORT)) ERR;
- if (nc_insert_compound(ncid, typeid, "count",
+ if (nc_insert_compound(ncid, typeid, "count",
NC_COMPOUND_OFFSET(struct obs_t, count), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid, "relhum",
- NC_COMPOUND_OFFSET(struct obs_t, relhum),
+ if (nc_insert_compound(ncid, typeid, "relhum",
+ NC_COMPOUND_OFFSET(struct obs_t, relhum),
NC_FLOAT)) ERR;
- if (nc_insert_compound(ncid, typeid, "time",
- NC_COMPOUND_OFFSET(struct obs_t, time),
+ if (nc_insert_compound(ncid, typeid, "time",
+ NC_COMPOUND_OFFSET(struct obs_t, time),
NC_DOUBLE)) ERR;
- if (nc_insert_compound(ncid, typeid, "category",
- NC_COMPOUND_OFFSET(struct obs_t, category),
+ if (nc_insert_compound(ncid, typeid, "category",
+ NC_COMPOUND_OFFSET(struct obs_t, category),
NC_UBYTE)) ERR;
- if (nc_insert_compound(ncid, typeid, "id",
- NC_COMPOUND_OFFSET(struct obs_t, id),
+ if (nc_insert_compound(ncid, typeid, "id",
+ NC_COMPOUND_OFFSET(struct obs_t, id),
NC_USHORT)) ERR;
- if (nc_insert_compound(ncid, typeid, "particularity",
- NC_COMPOUND_OFFSET(struct obs_t, particularity),
+ if (nc_insert_compound(ncid, typeid, "particularity",
+ NC_COMPOUND_OFFSET(struct obs_t, particularity),
NC_UINT)) ERR;
- if (nc_insert_compound(ncid, typeid, "attention_span",
- NC_COMPOUND_OFFSET(struct obs_t, attention_span),
+ if (nc_insert_compound(ncid, typeid, "attention_span",
+ NC_COMPOUND_OFFSET(struct obs_t, attention_span),
NC_INT64)) ERR;
/* Declare a dimension for number of obs */
@@ -107,19 +108,19 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE6_NAME, NC_NOWRITE, &ncid)) ERR;
/* Get info with the generic inquire for user-defined types */
- if (nc_inq_user_type(ncid, typeid, name_in, NULL, NULL,
+ if (nc_inq_user_type(ncid, typeid, name_in, NULL, NULL,
NULL, &class_in)) ERR;
- if (strcmp(name_in, TYPE6_NAME) ||
+ if (strcmp(name_in, TYPE6_NAME) ||
class_in != NC_COMPOUND) ERR;
/* Get the same info with the compound-specific inquire function */
if (nc_inq_compound(ncid, typeid, name_in, &size_in, &nfields_in)) ERR;
- if (strcmp(name_in, TYPE6_NAME) ||
+ if (strcmp(name_in, TYPE6_NAME) ||
size_in != sizeof(obs_t) ||
nfields_in != 9) ERR;
@@ -130,7 +131,7 @@ main(int argc, char **argv)
if (val_in.day != missing_val.day ||
val_in.elev != missing_val.elev ||
val_in.count != missing_val.count ||
- val_in.relhum != missing_val.relhum ||
+ val_in.relhum != missing_val.relhum ||
val_in.time != missing_val.time ||
val_in.category != missing_val.category ||
val_in.id != missing_val.id ||
@@ -152,10 +153,9 @@ main(int argc, char **argv)
if (val_in.particularity != obsdata[i].particularity) ERR;
if (val_in.attention_span != obsdata[i].attention_span) ERR;
}
-
- if (nc_close(ncid)) ERR;
-
+
+ if (nc_close(ncid)) ERR;
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_comp2.c b/ncdump/tst_comp2.c
index e4074e6..7ed2e9b 100644
--- a/ncdump/tst_comp2.c
+++ b/ncdump/tst_comp2.c
@@ -10,6 +10,7 @@
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <string.h>
@@ -47,21 +48,21 @@ main(int argc, char **argv)
struct vecmat_t data[DIM_LEN] = {
{
- 'S',
+ 'S',
"jan",
- {1, 2, 3},
+ {1, 2, 3},
{{4, 5, 6}, {7, 8, 9}}
},
{
- 'M',
+ 'M',
"feb",
- {11, 12, 13},
+ {11, 12, 13},
{{4.25, 5.25, 6.25}, {7.25, 8.25, 9.25}}
},
{
- 'T',
+ 'T',
"mar",
- {21, 22, 23},
+ {21, 22, 23},
{{4.5, 5.5, 6.5}, {7.5, 8.5, 9.5}}
}
};
@@ -69,7 +70,7 @@ main(int argc, char **argv)
struct vecmat_t missing_val = {
'?',
"---",
- {-1, -2, -3},
+ {-1, -2, -3},
{{-4.0f, -5.0f, -6.0f}, {-7.0f, -8.0f, -9.0f}}
};
struct vecmat_t val_in;
@@ -93,10 +94,10 @@ main(int argc, char **argv)
NC_COMPOUND_OFFSET(struct vecmat_t, mon),
NC_CHAR, 1, mon_sizes)) ERR;
if (nc_insert_array_compound(ncid, typeid, "vect",
- NC_COMPOUND_OFFSET(struct vecmat_t, vec),
+ NC_COMPOUND_OFFSET(struct vecmat_t, vec),
NC_SHORT, 1, vec_sizes)) ERR;
if (nc_insert_array_compound(ncid, typeid, "matr",
- NC_COMPOUND_OFFSET(struct vecmat_t, mat),
+ NC_COMPOUND_OFFSET(struct vecmat_t, mat),
NC_FLOAT, 2, mat_sizes)) ERR;
/* Declare a dimension for number of obs */
@@ -117,19 +118,19 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE9_NAME, NC_NOWRITE, &ncid)) ERR;
/* Get info with the generic inquire for user-defined types */
- if (nc_inq_user_type(ncid, typeid, name_in, NULL, NULL,
+ if (nc_inq_user_type(ncid, typeid, name_in, NULL, NULL,
NULL, &class_in)) ERR;
- if (strcmp(name_in, TYPE_NAME) ||
+ if (strcmp(name_in, TYPE_NAME) ||
class_in != NC_COMPOUND) ERR;
/* Get the same info with the compound-specific inquire function */
if (nc_inq_compound(ncid, typeid, name_in, &size_in, &nfields_in)) ERR;
- if (strcmp(name_in, TYPE_NAME) ||
+ if (strcmp(name_in, TYPE_NAME) ||
size_in != sizeof(struct vecmat_t) ||
nfields_in != NFIELDS) ERR;
@@ -166,10 +167,9 @@ main(int argc, char **argv)
}
}
}
-
- if (nc_close(ncid)) ERR;
-
+
+ if (nc_close(ncid)) ERR;
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_compress.c b/ncdump/tst_compress.c
index ea398e8..0301129 100644
--- a/ncdump/tst_compress.c
+++ b/ncdump/tst_compress.c
@@ -9,6 +9,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <netcdf.h>
diff --git a/ncdump/tst_create_files.c b/ncdump/tst_create_files.c
index 12c4279..1937d85 100644
--- a/ncdump/tst_create_files.c
+++ b/ncdump/tst_create_files.c
@@ -9,6 +9,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdlib.h>
@@ -71,36 +72,36 @@ main(int argc, char **argv)
if (nc_def_grp(ncid, SOLAR_SYSTEM, &solar_system_id)) ERR;
if (nc_def_grp(solar_system_id, EARTH, &earth_id)) ERR;
if (nc_def_grp(earth_id, LUNA, &luna_id)) ERR;
-
+
/* Put some attributes in the root group. */
if (nc_put_att_uchar(ncid, NC_GLOBAL, UCHAR_ATT_NAME, NC_UBYTE,
ATT_LEN, num_vogons)) ERR;
- if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ULONGLONG_ATT_NAME,
+ if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ULONGLONG_ATT_NAME,
NC_UINT64, ATT_LEN, num_poems)) ERR;
-
+
/* Put a dimension in the root group. */
if (nc_def_dim(ncid, DIM_NAME, DIM_LEN, &dimid)) ERR;
-
+
/* Put an attribute in the Earth group. */
if (nc_put_att_longlong(earth_id, NC_GLOBAL, LONGLONG_ATT_NAME, NC_INT64,
ATT_LEN, alien)) ERR;
-
+
/* Put an attribute in the bottom group. */
- if (nc_put_att_text(luna_id, NC_GLOBAL, ATT_NAME,
+ if (nc_put_att_text(luna_id, NC_GLOBAL, ATT_NAME,
strlen(poem) + 1, poem)) ERR;
-
+
/* Put a variable in the bottom group. */
if (nc_def_var(luna_id, VAR_NAME, NC_INT64, 1, &dimid, &varid)) ERR;
if (nc_put_var_longlong(luna_id, varid, data)) ERR;
-
+
if (nc_close(ncid)) ERR;
}
-
+
SUMMARIZE_ERR;
printf("*** checking nested group file %s...", FILE_NAME_1);
#define CHAR_ATT_MAX 3000
-
+
{
int ncid, solar_system_id;
int earth_id, luna_id;
@@ -116,8 +117,8 @@ main(int argc, char **argv)
/* Oh well, might as well check this file. It will also be
* checked by ncdump tests. */
- if (nc_open(FILE_NAME_1, NC_NOWRITE, &ncid)) ERR;
-
+ if (nc_open(FILE_NAME_1, NC_NOWRITE, &ncid)) ERR;
+
/* Check nested groups. */
if (nc_inq_grps(ncid, &numgrps_in, &solar_system_id)) ERR;
if (numgrps_in != 1) ERR;
@@ -148,12 +149,12 @@ main(int argc, char **argv)
if (ndims_in != 1) ERR;
if (nc_inq_dim(ncid, dimid_in, name_in, &len_in)) ERR;
if (strcmp(name_in, DIM_NAME) || len_in != DIM_LEN) ERR;
-
+
/* Check an attribute in the Earth group. */
if (nc_inq_att(earth_id, NC_GLOBAL, LONGLONG_ATT_NAME, &xtype_in,
&len_in)) ERR;
if (xtype_in != NC_INT64 || len_in != ATT_LEN) ERR;
- if (nc_get_att_longlong(earth_id, NC_GLOBAL, LONGLONG_ATT_NAME,
+ if (nc_get_att_longlong(earth_id, NC_GLOBAL, LONGLONG_ATT_NAME,
longlong_in)) ERR;
for (i = 0; i < ATT_LEN; i++)
if (longlong_in[i] != alien[i]) ERR;
@@ -161,17 +162,17 @@ main(int argc, char **argv)
/* Check an attribute in the bottom group. */
if (nc_inq_att(luna_id, NC_GLOBAL, ATT_NAME, &xtype_in,
&len_in)) ERR;
- if (xtype_in != NC_CHAR || len_in != strlen(poem) + 1 ||
+ if (xtype_in != NC_CHAR || len_in != strlen(poem) + 1 ||
len_in > CHAR_ATT_MAX) ERR;
if (nc_get_att_text(luna_id, NC_GLOBAL, ATT_NAME, char_in)) ERR;
char_in[len_in] = '\0'; /* null terminate, because nc_get_att_text doesn't */
if (strcmp(char_in, poem)) ERR;
-
+
/* Check a variable in the bottom group. */
if (nc_inq_varids(luna_id, &nvars_in, &varid_in)) ERR;
- if (nc_inq_var(luna_id, varid_in, name_in, &xtype_in, &ndims_in,
+ if (nc_inq_var(luna_id, varid_in, name_in, &xtype_in, &ndims_in,
&dimid_in_2, &natts_in)) ERR;
- if (strcmp(name_in, VAR_NAME) || xtype_in != NC_INT64 ||
+ if (strcmp(name_in, VAR_NAME) || xtype_in != NC_INT64 ||
ndims_in != 1 || dimid_in_2 != dimid_in || natts_in != 0) ERR;
if (nc_get_var_longlong(luna_id, varid_in, data_in)) ERR;
for (i = 0; i < DIM_LEN; i++)
@@ -180,7 +181,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
-
+
SUMMARIZE_ERR;
printf("*** creating file with VLEN %s...", FILE_NAME_2);
#define ATT_NAME2 "equally_unimaginatively_named_attribute_YAWN"
@@ -206,7 +207,7 @@ main(int argc, char **argv)
/* Create a file with a VLEN attribute. */
if (nc_create(FILE_NAME_2, NC_NETCDF4, &ncid)) ERR;
-
+
if (nc_def_vlen(ncid, VLEN_TYPE_NAME, NC_INT, &typeid)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME2, typeid, DIM_LEN, data)) ERR;
@@ -219,7 +220,7 @@ main(int argc, char **argv)
for (i=0; i<DIM_LEN; i++)
free(data[i].p);
}
-
+
SUMMARIZE_ERR;
printf("*** creating file with compound type %s...", FILE_NAME_CMP);
#define ATT_NAME_CMP "my_favorite_wind_speeds"
@@ -232,7 +233,7 @@ main(int argc, char **argv)
int ncid;
/* Store winds as two floats: the u and v components of the wind. */
- struct wind_vector
+ struct wind_vector
{
float u, v;
} favs[NUM_FAVS];
@@ -244,24 +245,23 @@ main(int argc, char **argv)
{
favs[fav].u = U_VALUE;
favs[fav].v = V_VALUE;
- }
+ }
/* Create a file with a compound attribute. */
if (nc_create(FILE_NAME_CMP, NC_NETCDF4, &ncid)) ERR;
-
- if (nc_def_compound(ncid, sizeof(struct wind_vector), COMPOUND_NAME,
+
+ if (nc_def_compound(ncid, sizeof(struct wind_vector), COMPOUND_NAME,
&typeid)) ERR;
- if (nc_insert_compound(ncid, typeid, "u", NC_COMPOUND_OFFSET(struct wind_vector, u),
+ if (nc_insert_compound(ncid, typeid, "u", NC_COMPOUND_OFFSET(struct wind_vector, u),
NC_FLOAT)) ERR;
- if (nc_insert_compound(ncid, typeid, "v", NC_COMPOUND_OFFSET(struct wind_vector, v),
+ if (nc_insert_compound(ncid, typeid, "v", NC_COMPOUND_OFFSET(struct wind_vector, v),
NC_FLOAT)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME_CMP, typeid, NUM_FAVS, favs)) ERR;
if (nc_close(ncid)) ERR;
}
-
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_dimsizes.c b/ncdump/tst_dimsizes.c
index 913fa4d..a38bb94 100644
--- a/ncdump/tst_dimsizes.c
+++ b/ncdump/tst_dimsizes.c
@@ -1,4 +1,5 @@
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
@@ -23,7 +24,7 @@ Also, leave the files around so we can test with ncdump.
*/
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{
int ncid;
size_t dimsize;
@@ -73,7 +74,7 @@ main(int argc, char **argv)
if ((stat=nc_inq_dimlen(ncid, dimid, &dimsize))) ERRSTAT(stat);
if(dimsize != DIMMAX64DATA) ERR;
if ((stat=nc_close(ncid))) ERRSTAT(stat);
- }
+ }
SUMMARIZE_ERR;
FINAL_RESULTS;
diff --git a/ncdump/tst_enum_data.c b/ncdump/tst_enum_data.c
index c57ba4a..b5db7f5 100644
--- a/ncdump/tst_enum_data.c
+++ b/ncdump/tst_enum_data.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#define FILE2_NAME "tst_enum_data.nc"
@@ -52,17 +53,17 @@ main(int argc, char **argv)
char *name;
unsigned char value;
} cloud_types[] = {
- {"Clear", CLEAR},
- {"Cumulonimbus", CUMULONIMBUS},
- {"Stratus", STRATUS},
- {"Stratocumulus", STRATOCUMULUS},
- {"Cumulus", CUMULUS},
- {"Altostratus", ALTOSTRATUS},
- {"Nimbostratus", NIMBOSTRATUS},
- {"Altocumulus", ALTOCUMULUS},
- {"Cirrostratus", CIRROSTRATUS},
- {"Cirrocumulus", CIRROCUMULUS},
- {"Cirrus", CIRRUS},
+ {"Clear", CLEAR},
+ {"Cumulonimbus", CUMULONIMBUS},
+ {"Stratus", STRATUS},
+ {"Stratocumulus", STRATOCUMULUS},
+ {"Cumulus", CUMULUS},
+ {"Altostratus", ALTOSTRATUS},
+ {"Nimbostratus", NIMBOSTRATUS},
+ {"Altocumulus", ALTOCUMULUS},
+ {"Cirrostratus", CIRROSTRATUS},
+ {"Cirrocumulus", CIRROCUMULUS},
+ {"Cirrus", CIRRUS},
{"Missing", MISSING}
};
int var_dims[VAR2_RANK];
@@ -81,7 +82,7 @@ main(int argc, char **argv)
num_members = (sizeof cloud_types) / (sizeof cloud_types[0]);
for (i = 0; i < num_members; i++) {
if (nc_insert_enum(ncid, typeid, cloud_types[i].name,
- &cloud_types[i].value))
+ &cloud_types[i].value))
ERR;
}
/* Declare a station dimension */
@@ -99,28 +100,28 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE2_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_user_type(ncid, typeid, name_in, &base_size_in, &base_nc_type_in,
&nfields_in, &class_in)) ERR;
- if (strcmp(name_in, TYPE2_NAME) ||
+ if (strcmp(name_in, TYPE2_NAME) ||
base_size_in != sizeof(unsigned char) ||
- base_nc_type_in != NC_UBYTE ||
- nfields_in != num_members ||
+ base_nc_type_in != NC_UBYTE ||
+ nfields_in != num_members ||
class_in != NC_ENUM) ERR;
- if (nc_inq_enum(ncid, typeid, name_in,
+ if (nc_inq_enum(ncid, typeid, name_in,
&base_nc_type_in, &base_size_in, &num_members_in)) ERR;
- if (strcmp(name_in, TYPE2_NAME) ||
- base_nc_type_in != NC_UBYTE ||
+ if (strcmp(name_in, TYPE2_NAME) ||
+ base_nc_type_in != NC_UBYTE ||
num_members_in != num_members) ERR;
for (i = 0; i < num_members; i++)
{
if (nc_inq_enum_member(ncid, typeid, i, name_in, &value_in)) ERR;
- if (strcmp(name_in, cloud_types[i].name) ||
+ if (strcmp(name_in, cloud_types[i].name) ||
value_in != cloud_types[i].value) ERR;
- if (nc_inq_enum_ident(ncid, typeid, cloud_types[i].value,
+ if (nc_inq_enum_ident(ncid, typeid, cloud_types[i].value,
name_in)) ERR;
if (strcmp(name_in, cloud_types[i].name)) ERR;
}
@@ -133,11 +134,10 @@ main(int argc, char **argv)
for (i = 0; i < DIM2_LEN; i++) {
if (cloud_data_in[i] != cloud_data[i]) ERR;
}
-
- if (nc_close(ncid)) ERR;
-
-
+
+ if (nc_close(ncid)) ERR;
+
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_fileinfo.c b/ncdump/tst_fileinfo.c
index b21face..29687c1 100644
--- a/ncdump/tst_fileinfo.c
+++ b/ncdump/tst_fileinfo.c
@@ -2,7 +2,7 @@
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use. See www.unidata.ucar.edu for more info.
*/
-
+
/*
Test _NCProperties and other special attributes
*/
@@ -14,6 +14,7 @@ Test _NCProperties and other special attributes
#include <hdf5.h>
#include "nc_tests.h"
+#include "err_macros.h"
#include "netcdf.h"
#include "nc4internal.h"
@@ -33,7 +34,7 @@ main(int argc, char **argv)
hid_t fileid;
hid_t fcplid;
hid_t scalar_spaceid;
-
+
printf("*** creating test file using HDF5 directly %s...", HDFFILE);
/* Create scalar dataspace */
@@ -56,7 +57,7 @@ main(int argc, char **argv)
/* Create scalar dataspace */
if((scalar_spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
-
+
/* Create attribute with native integer datatype on object */
if((attid = H5Acreate2(fileid, INT_ATT_NAME, H5T_NATIVE_INT, scalar_spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) ERR;
if(H5Aclose(attid) < 0) ERR;
@@ -81,7 +82,7 @@ main(int argc, char **argv)
char name[NC_MAX_NAME];
printf("\n*** creating netcdf-4 test file using netCDF %s...", NC4FILE);
-
+
if(nc_create(NC4FILE,NC_WRITE|NC_CLOBBER|NC_NETCDF4,&root)!=0) ERR;
/* Create global attribute */
if(nc_put_att_int(root,NC_GLOBAL,INT_ATT_NAME,NC_INT,1,&data)!=0) ERR;
@@ -120,9 +121,9 @@ main(int argc, char **argv)
/* Attempt to get attribute metadata piecemeal; some will fail */
id = -1;
stat = nc_inq_attid(root,NC_GLOBAL,NCPROPS,&id);
- if(stat == NC_NOERR) ERR;
+ if(stat == NC_NOERR) ERR;
stat = nc_inq_attname(root,NC_GLOBAL,id,name);
- if(stat == NC_NOERR) ERR;
+ if(stat == NC_NOERR) ERR;
if(nc_inq_atttype(root,NC_GLOBAL,NCPROPS,&xtype)!=0) ERR;
if(xtype != NC_CHAR) ERR;
if(nc_inq_attlen(root,NC_GLOBAL,NCPROPS,&len)!=0) ERR;
@@ -147,9 +148,9 @@ main(int argc, char **argv)
/* Attempt to get attribute metadata piecemeal */
stat = nc_inq_attid(root,NC_GLOBAL,SUPERBLOCKATT,&id);
- if(stat == NC_NOERR) ERR;
+ if(stat == NC_NOERR) ERR;
stat = nc_inq_attname(root,NC_GLOBAL,id,name);
- if(stat == NC_NOERR) ERR;
+ if(stat == NC_NOERR) ERR;
if(nc_inq_atttype(root,NC_GLOBAL,SUPERBLOCKATT,&xtype)!=0) ERR;
if(xtype != NC_INT) ERR;
if(nc_inq_attlen(root,NC_GLOBAL,SUPERBLOCKATT,&len)!=0) ERR;
@@ -174,9 +175,9 @@ main(int argc, char **argv)
/* Attempt to get attribute metadata piecemeal */
stat = nc_inq_attid(root,NC_GLOBAL,ISNETCDF4ATT,&id);
- if(stat == NC_NOERR) ERR;
+ if(stat == NC_NOERR) ERR;
stat = nc_inq_attname(root,NC_GLOBAL,id,name);
- if(stat == NC_NOERR) ERR;
+ if(stat == NC_NOERR) ERR;
if(nc_inq_atttype(root,NC_GLOBAL,ISNETCDF4ATT,&xtype)!=0) ERR;
if(xtype != NC_INT) ERR;
if(nc_inq_attlen(root,NC_GLOBAL,ISNETCDF4ATT,&len)!=0) ERR;
@@ -191,7 +192,7 @@ main(int argc, char **argv)
if(stat == NC_NOERR) ERR;
if(nc_close(root)!=0) ERR;
- }
+ }
SUMMARIZE_ERR;
FINAL_RESULTS;
diff --git a/ncdump/tst_fillbug.c b/ncdump/tst_fillbug.c
index bccc46e..fc92d9f 100644
--- a/ncdump/tst_fillbug.c
+++ b/ncdump/tst_fillbug.c
@@ -1,4 +1,5 @@
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
@@ -8,7 +9,7 @@
static int count_udtypes(int ncid);
int
-main(int argc, char **argv)
+main(int argc, char **argv)
{/* create file that caused seg fault in ncdump */
int ncid; /* netCDF id */
@@ -74,8 +75,8 @@ main(int argc, char **argv)
* made by ncdump, or an earlier ncdump bug masks the real problem
* until a call is made into the netCDF-4 library ... */
if (nc_open(FILENAME, NC_NOWRITE, &ncid)) ERR;
-
- {
+
+ {
/* We declare local arrays with small constant sizes to avoid
* all the mallocs and frees used in ncdump. For the example
* above, the fixed-size arrays are ample. */
@@ -105,7 +106,7 @@ main(int argc, char **argv)
for (v_grp = 0; v_grp < nvars_grp; v_grp++) {
varid = varids_grp[v_grp];
if ( nc_inq_varndims(ncid, varid, &varndims) ) ERR;
- if ( nc_inq_var(ncid, varid, varname, &vartype, 0, vardims,
+ if ( nc_inq_var(ncid, varid, varname, &vartype, 0, vardims,
&varnatts) ) ERR;
for (id = 0; id < varndims; id++) {
if ( nc_inq_dimname(ncid, vardims[id], dimname) ) ERR;
@@ -114,7 +115,7 @@ main(int argc, char **argv)
for (v_grp = 0; v_grp < nvars_grp; v_grp++) {
varid = varids_grp[v_grp];
if( nc_inq_varndims(ncid, varid, &varndims) ) ERR;
- if( nc_inq_var(ncid, varid, varname, &vartype, 0, vardims,
+ if( nc_inq_var(ncid, varid, varname, &vartype, 0, vardims,
&varnatts) ) ERR;
{
is_recvar = 0;
@@ -131,7 +132,7 @@ main(int argc, char **argv)
if(dimids[dim] == recdimids[recdim]) {
is_recvar = 1;
break;
- }
+ }
}
}
}
@@ -154,7 +155,7 @@ main(int argc, char **argv)
/* first slice retrieved OK */
if (nc_get_vara(ncid, varid, cor, edg, P_data)) ERR;
-
+
/* In ncdump, reading second slice gets seg fault in
* nc4_open_var_grp(), but this attempt to do all the
* same netCDF calls as ncdump can't duplicate the
@@ -166,7 +167,7 @@ main(int argc, char **argv)
}
}
if (nc_close(ncid)) ERR;
-
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
diff --git a/ncdump/tst_group_data.c b/ncdump/tst_group_data.c
index b2da5a8..00d5cb7 100644
--- a/ncdump/tst_group_data.c
+++ b/ncdump/tst_group_data.c
@@ -1,4 +1,4 @@
-/* This is part of the netCDF package.
+/* This is part of the netCDF package.
Copyright 2005-2007, University Corporation for Atmospheric
Research/Unidata See COPYRIGHT file for conditions of use.
@@ -10,6 +10,7 @@
#include <netcdf.h>
#include <nc_tests.h>
+#include "err_macros.h"
#define FILE_NAME "tst_group_data.nc"
#define DIM_NAME "dim"
@@ -41,9 +42,9 @@ main(int argc, char **argv) {
int var_dims[VAR_RANK], var2_dims[VAR2_RANK];
int g1id, g2id, g3id;
float vals[] = {1.0, 2.0, 3.0, 4.0};
- float vals2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ float vals2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
-
+
printf("\n*** Testing groups.\n");
printf("*** creating nested group file %s...", FILE_NAME);
@@ -54,18 +55,18 @@ main(int argc, char **argv) {
var_dims[0] = dimid;
if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(ncid, varid, ATT_NAME, strlen(ATT_VAL), ATT_VAL)) ERR;
- if (nc_put_att_text(ncid, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
+ if (nc_put_att_text(ncid, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL),
GATT_VAL)) ERR;
if (nc_enddef(ncid)) ERR;
if (nc_put_var_float(ncid, varid, vals)) ERR;
-
+
/* put dim, var, atts with same names in a group */
if (nc_def_grp(ncid, G1_NAME, &g1id)) ERR;
if (nc_def_dim(g1id, DIM_NAME, DIM_LEN1, &dimid1)) ERR;
var_dims[0] = dimid1;
if (nc_def_var(g1id, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(g1id, varid, ATT_NAME, strlen(ATT_VAL1), ATT_VAL1)) ERR;
- if (nc_put_att_text(g1id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL1),
+ if (nc_put_att_text(g1id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL1),
GATT_VAL1)) ERR;
if (nc_enddef(g1id)) ERR;
if (nc_put_var_float(g1id, varid, vals)) ERR;
@@ -76,18 +77,18 @@ main(int argc, char **argv) {
var_dims[0] = dimid2;
if (nc_def_var(g2id, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(g2id, varid, ATT_NAME, strlen(ATT_VAL2), ATT_VAL2)) ERR;
- if (nc_put_att_text(g2id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL2),
+ if (nc_put_att_text(g2id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL2),
GATT_VAL2)) ERR;
if (nc_enddef(g2id)) ERR;
if (nc_put_var_float(g2id, varid, vals)) ERR;
-
+
/* put dim, var, atts with same names in a subgroup of second group */
if (nc_def_grp(g2id, G3_NAME, &g3id)) ERR;
if (nc_def_dim(g3id, DIM_NAME, DIM_LEN3, &dimid3)) ERR;
var_dims[0] = dimid3;
if (nc_def_var(g3id, VAR_NAME, NC_FLOAT, VAR_RANK, var_dims, &varid)) ERR;
if (nc_put_att_text(g3id, varid, ATT_NAME, strlen(ATT_VAL3), ATT_VAL3)) ERR;
- if (nc_put_att_text(g3id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL3),
+ if (nc_put_att_text(g3id, NC_GLOBAL, GATT_NAME, strlen(GATT_VAL3),
GATT_VAL3)) ERR;
var2_dims[0] = dimid;
var2_dims[1] = dimid2;
diff --git a/ncdump/tst_h_rdc0.c b/ncdump/tst_h_rdc0.c
index e4fdbea..3344f88 100644
--- a/ncdump/tst_h_rdc0.c
+++ b/ncdump/tst_h_rdc0.c
@@ -8,6 +8,7 @@
$Id: tst_h_rdc0.c,v 1.5 2010/06/01 15:34:53 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#define FILE_NAME "c0.nc"
@@ -24,7 +25,7 @@ main()
hsize_t num_obj, i;
char obj_name[MAX_NAME];
- if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) ERR;
+ if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) ERR;
if ((grpid = H5Gopen(fileid, "/")) < 0) ERR;
/* Find the variables. Read their metadata and attributes. */
diff --git a/ncdump/tst_h_scalar.c b/ncdump/tst_h_scalar.c
index eaa0a08..950e090 100644
--- a/ncdump/tst_h_scalar.c
+++ b/ncdump/tst_h_scalar.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <hdf5.h>
#define FILE_NAME "tst_h_scalar.nc"
@@ -34,7 +35,7 @@ add_attrs(hid_t objid)
/* Create scalar dataspace */
if ((scalar_spaceid = H5Screate(H5S_SCALAR)) < 0) ERR_GOTO;
-
+
/* Create string datatypes */
if ((vlstr_typeid = H5Tcreate(H5T_STRING, (size_t)H5T_VARIABLE)) < 0) ERR_GOTO;
if ((fixstr_typeid = H5Tcreate(H5T_STRING, (size_t)10)) < 0) ERR_GOTO;
@@ -111,10 +112,10 @@ main()
if ((fcplid = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
if (H5Pset_link_creation_order(fcplid, H5P_CRT_ORDER_TRACKED) < 0) ERR;
if (H5Pset_attr_creation_order(fcplid, H5P_CRT_ORDER_TRACKED) < 0) ERR;
-
+
/* Create new file, using default properties */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcplid, H5P_DEFAULT)) < 0) ERR;
-
+
/* Close file creation property list */
if (H5Pclose(fcplid) < 0) ERR;
@@ -130,7 +131,7 @@ main()
if ((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if (H5Pset_attr_creation_order(dcplid, H5P_CRT_ORDER_TRACKED) < 0) ERR;
-
+
/* Create scalar dataset with VL string datatype */
if ((dsetid = H5Dcreate2(fileid, VSTR_VAR1_NAME, vlstr_typeid, scalar_spaceid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0) ERR;
@@ -186,7 +187,7 @@ main()
char *vlstr;
if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
-
+
/* Define new VL string variable */
if (nc_def_var(ncid, VSTR_VAR2_NAME , NC_STRING, 0, NULL, &varid)) ERR;
@@ -220,4 +221,3 @@ main()
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_nans.c b/ncdump/tst_nans.c
index be835ee..36c2100 100644
--- a/ncdump/tst_nans.c
+++ b/ncdump/tst_nans.c
@@ -8,6 +8,7 @@
$Id: tst_nans.c,v 1.9 2009/09/14 20:50:45 russ Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@@ -45,7 +46,7 @@ main(int argc, char **argv)
float fvals[NVALS], fvals_in[NVALS];
double dvals[NVALS], dvals_in[NVALS];
-
+
float fnan = NC_FNAN;/*(NC_INFINITE-NC_INFINITE);//0.f/0.f; */
double dnan = NC_DNAN;/*(NC_INFINITE-NC_INFINITE);//0.0/0.0; */
float fpinf = NC_FPINF;/*NC_INFINITE;//1.0f/0.0f; */
@@ -60,9 +61,9 @@ main(int argc, char **argv)
printf("\n*** Testing NaN\n");
printf("*** creating NaN test file %s...", FILE8_NAME);
if (nc_create(FILE8_NAME, NC_CLOBBER, &ncid)) ERR;
-
+
if (nc_def_dim(ncid, DIM_NAME, NVALS, &dimid)) ERR;
-
+
if (nc_def_var(ncid, F_NAME, NC_FLOAT, NDIMS, &dimid, &fvarid)) ERR;
if (nc_def_var(ncid, D_NAME, NC_DOUBLE, NDIMS, &dimid, &dvarid)) ERR;
@@ -72,23 +73,23 @@ main(int argc, char **argv)
dvals[0] = dninf;
dvals[1] = dnan;
dvals[2] = dpinf;
-
+
/* Create float and double attributes */
if (nc_put_att_float(ncid, fvarid, FV_NAME, NC_FLOAT, FV_NVALS, &fnan)) ERR;
if (nc_put_att_float(ncid, fvarid, ATT_NAME, NC_FLOAT, NVALS, fvals)) ERR;
if (nc_put_att_double(ncid, dvarid, FV_NAME, NC_DOUBLE, FV_NVALS, &dnan)) ERR;
if (nc_put_att_double(ncid, dvarid, ATT_NAME, NC_DOUBLE, NVALS, dvals)) ERR;
-
+
if (nc_enddef(ncid)) ERR;
-
+
/* Write float and double data */
if (nc_put_var_float(ncid, fvarid, fvals)) ERR;
if (nc_put_var_double(ncid, dvarid, dvals)) ERR;
-
+
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE8_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_varid(ncid, F_NAME, &fvarid)) ERR;
@@ -123,7 +124,7 @@ main(int argc, char **argv)
if (!(isinf(dvals_in[2]) && dvals_in[2] > 0)) ERR;
if (nc_close(ncid)) ERR;
-
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
diff --git a/ncdump/tst_opaque_data.c b/ncdump/tst_opaque_data.c
index fec7ab3..c814e3b 100644
--- a/ncdump/tst_opaque_data.c
+++ b/ncdump/tst_opaque_data.c
@@ -9,6 +9,7 @@
#include <config.h>
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#define FILE3_NAME "tst_opaque_data.nc"
@@ -69,19 +70,19 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE3_NAME, NC_NOWRITE, &ncid)) ERR;
/* Get info with the generic inquire for user-defined types */
if (nc_inq_user_type(ncid, typeid, name_in, &size_in, NULL,
NULL, &class_in)) ERR;
- if (strcmp(name_in, TYPE3_NAME) ||
+ if (strcmp(name_in, TYPE3_NAME) ||
size_in != TYPE3_SIZE ||
class_in != NC_OPAQUE) ERR;
/* Get the same info with the opaque-specific inquire function */
if (nc_inq_opaque(ncid, typeid, name_in, &size_in)) ERR;
- if (strcmp(name_in, TYPE3_NAME) ||
+ if (strcmp(name_in, TYPE3_NAME) ||
size_in != TYPE3_SIZE) ERR;
if (nc_inq_varid(ncid, VAR3_NAME, &varid)) ERR;
@@ -95,11 +96,10 @@ main(int argc, char **argv)
if(nc_get_var1(ncid, varid, index, val_in)) ERR;
if (memcmp(val_in, sensor_data[i], TYPE3_SIZE) != 0) ERR;
}
-
- if (nc_close(ncid)) ERR;
-
-
+
+ if (nc_close(ncid)) ERR;
+
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_special_atts.c b/ncdump/tst_special_atts.c
index e7f548c..f4ac1d8 100644
--- a/ncdump/tst_special_atts.c
+++ b/ncdump/tst_special_atts.c
@@ -10,6 +10,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#define FILE_NAME "tst_special_atts.nc"
@@ -49,11 +50,11 @@ main(int argc, char **argv)
int data2_in[DIM1_LEN][DIM2_LEN];
int data3[DIM1_LEN][DIM2_LEN][DIM3_LEN];
int data3_in[DIM1_LEN][DIM2_LEN][DIM3_LEN];
-
+
printf("\n*** Testing '-s' option for special attributes.\n");
printf("*** creating special attributes test file %s...", FILE_NAME);
if (nc_create(FILE_NAME, NC_CLOBBER | NC_NETCDF4, &ncid)) ERR;
-
+
/* Declare dimensions and variables */
if (nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimids[0])) ERR;
if (nc_def_dim(ncid, DIM2_NAME, DIM2_LEN, &dimids[1])) ERR;
@@ -79,33 +80,33 @@ main(int argc, char **argv)
/* Create a compound type. */
if (nc_def_compound(ncid, sizeof(obs_t), TYPE6_NAME, &typeid)) ERR;
- if (nc_insert_compound(ncid, typeid, "day",
+ if (nc_insert_compound(ncid, typeid, "day",
NC_COMPOUND_OFFSET(struct obs_t, day), NC_BYTE)) ERR;
- if (nc_insert_compound(ncid, typeid, "elev",
+ if (nc_insert_compound(ncid, typeid, "elev",
NC_COMPOUND_OFFSET(struct obs_t, elev), NC_SHORT)) ERR;
- if (nc_insert_compound(ncid, typeid, "count",
+ if (nc_insert_compound(ncid, typeid, "count",
NC_COMPOUND_OFFSET(struct obs_t, count), NC_INT)) ERR;
- if (nc_insert_compound(ncid, typeid, "relhum",
- NC_COMPOUND_OFFSET(struct obs_t, relhum),
+ if (nc_insert_compound(ncid, typeid, "relhum",
+ NC_COMPOUND_OFFSET(struct obs_t, relhum),
NC_FLOAT)) ERR;
- if (nc_insert_compound(ncid, typeid, "time",
- NC_COMPOUND_OFFSET(struct obs_t, time),
+ if (nc_insert_compound(ncid, typeid, "time",
+ NC_COMPOUND_OFFSET(struct obs_t, time),
NC_DOUBLE)) ERR;
- if (nc_insert_compound(ncid, typeid, "category",
- NC_COMPOUND_OFFSET(struct obs_t, category),
+ if (nc_insert_compound(ncid, typeid, "category",
+ NC_COMPOUND_OFFSET(struct obs_t, category),
NC_UBYTE)) ERR;
- if (nc_insert_compound(ncid, typeid, "id",
- NC_COMPOUND_OFFSET(struct obs_t, id),
+ if (nc_insert_compound(ncid, typeid, "id",
+ NC_COMPOUND_OFFSET(struct obs_t, id),
NC_USHORT)) ERR;
- if (nc_insert_compound(ncid, typeid, "particularity",
- NC_COMPOUND_OFFSET(struct obs_t, particularity),
+ if (nc_insert_compound(ncid, typeid, "particularity",
+ NC_COMPOUND_OFFSET(struct obs_t, particularity),
NC_UINT)) ERR;
- if (nc_insert_compound(ncid, typeid, "attention_span",
- NC_COMPOUND_OFFSET(struct obs_t, attention_span),
+ if (nc_insert_compound(ncid, typeid, "attention_span",
+ NC_COMPOUND_OFFSET(struct obs_t, attention_span),
NC_INT64)) ERR;
/* create a variable of that compound type */
- if (nc_def_var(ncid, "var5", typeid, VAR1_RANK, dimids, &var5id))
- ERR;
+ if (nc_def_var(ncid, "var5", typeid, VAR1_RANK, dimids, &var5id))
+ ERR;
}
/* Specify contiguous storage and endianness explicitly for var1. */
@@ -153,16 +154,16 @@ main(int argc, char **argv)
if(nc_put_var(ncid, var2id, &data2[0][0])) ERR;
if(nc_put_var(ncid, var3id, &data3[0][0][0])) ERR;
if(nc_put_var(ncid, var4id, &data3[0][0][0])) ERR;
-
+
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_varid(ncid, VAR1_NAME, &var1id)) ERR;
if (nc_inq_varid(ncid, VAR2_NAME, &var2id)) ERR;
if (nc_inq_varid(ncid, VAR3_NAME, &var3id)) ERR;
if (nc_inq_varid(ncid, VAR4_NAME, &var4id)) ERR;
-
+
/* Check chunk sizes */
{
size_t chunks_in[VAR3_RANK];
@@ -179,18 +180,18 @@ main(int argc, char **argv)
if(nc_get_var(ncid, var1id, &data1_in[0])) ERR;
for(i = 0; i < DIM1_LEN; i++)
if(data1_in[i] != data1[i]) ERR;
-
+
if(nc_get_var(ncid, var2id, &data2_in[0][0])) ERR;
for(i = 0; i < DIM1_LEN; i++)
for(j = 0; j < DIM2_LEN; j++)
if(data2_in[i][j] != data2[i][j]) ERR;
-
+
if(nc_get_var(ncid, var3id, &data3_in[0][0][0])) ERR;
for(i = 0; i < DIM1_LEN; i++)
for(j = 0; j < DIM2_LEN; j++)
for(k = 0; k < DIM3_LEN; k++)
if(data3_in[i][j][k] != data3[i][j][k]) ERR;
-
+
if(nc_get_var(ncid, var4id, &data3_in[0][0][0])) ERR;
for(i = 0; i < DIM1_LEN; i++)
for(j = 0; j < DIM2_LEN; j++)
@@ -200,4 +201,3 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_string_data.c b/ncdump/tst_string_data.c
index 43f2396..0d5a030 100644
--- a/ncdump/tst_string_data.c
+++ b/ncdump/tst_string_data.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#define FILE4_NAME "tst_string_data.nc"
@@ -34,39 +35,39 @@ main(int argc, char **argv)
};
const char *missing_val[ATT4_LEN] = {""};
char *strings_in[DIM4_LEN];
-
+
printf("\n*** Testing strings.\n");
printf("*** creating strings test file %s...", FILE4_NAME);
if (nc_create(FILE4_NAME, NC_CLOBBER | NC_NETCDF4, &ncid)) ERR;
-
+
/* Declare a line dimension */
if (nc_def_dim(ncid, DIM4_NAME, DIM4_LEN, &dimid)) ERR;
-
+
/* Declare a string variable */
var_dims[0] = dimid;
if (nc_def_var(ncid, VAR4_NAME, NC_STRING, VAR4_RANK, var_dims, &varid)) ERR;
-
+
/* Create and write a variable attribute of string type */
if (nc_put_att_string(ncid, varid, ATT4_NAME, ATT4_LEN, missing_val)) ERR;
if (nc_enddef(ncid)) ERR;
-
+
/* Store some data of string type */
if(nc_put_var(ncid, varid, desc_data)) ERR;
-
+
/* Write the file. */
if (nc_close(ncid)) ERR;
-
+
/* Check it out. */
if (nc_open(FILE4_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_varid(ncid, VAR4_NAME, &varid)) ERR;
if (nc_inq_att(ncid, varid, ATT4_NAME, &att_type, &att_len)) ERR;
if (att_type != NC_STRING || att_len != ATT4_LEN) ERR;
if (nc_get_att_string(ncid, varid, ATT4_NAME, strings_in)) ERR;
-
+
if (strcmp(strings_in[0], *missing_val) != 0) ERR;
/* string atts should be explicitly freed when done with them */
nc_free_string(ATT4_LEN, strings_in);
-
+
if(nc_get_var_string(ncid, varid, strings_in)) ERR;
for (i = 0; i < DIM4_LEN; i++) {
if (strcmp(strings_in[i], desc_data[i]) != 0) ERR;
@@ -95,9 +96,8 @@ main(int argc, char **argv)
nc_free_string(DIM4_LEN, strings_in);
}
- if (nc_close(ncid)) ERR;
+ if (nc_close(ncid)) ERR;
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/tst_unicode.c b/ncdump/tst_unicode.c
index 8cd680c..83dd839 100644
--- a/ncdump/tst_unicode.c
+++ b/ncdump/tst_unicode.c
@@ -8,6 +8,7 @@
$Id: tst_unicode.c,v 1.12 2008/10/20 01:48:08 ed Exp $
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <stdlib.h>
#include <stdio.h>
#include <netcdf.h>
@@ -66,7 +67,7 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE7_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_varid(ncid, UNAME, &varid)) ERR;
@@ -75,7 +76,7 @@ main(int argc, char **argv)
/* Note, name was normalized before storing, so retrieved name
won't match original unnormalized name. Check that we get
normalized version, instead. */
-
+
/* NFC normalized UTF-8 for Unicode 8-character "Hello" in Greek */
unsigned char norm_utf8[] = {
0xCE, 0x9A, /* GREEK CAPITAL LETTER KAPPA : 2-bytes utf8 */
@@ -83,7 +84,7 @@ main(int argc, char **argv)
0xCE, 0xBB, /* GREEK SMALL LETTER ALPHA : 2-bytes utf8 */
0xCE, 0xB7, /* GREEK SMALL LETTER ETA : 2-bytes utf8 */
0xCE, 0xBC, /* GREEK SMALL LETTER MU : 2-bytes utf8 */
- 0xCE, 0xAD, /* GREEK SMALL LETTER EPSILON WITH TONOS
+ 0xCE, 0xAD, /* GREEK SMALL LETTER EPSILON WITH TONOS
: 2-bytes utf8 */
0xCF, 0x81, /* GREEK SMALL LETTER RHO : 2-bytes utf8 */
0xCE, 0xB1, /* GREEK SMALL LETTER ALPHA : 2-bytes utf8 */
@@ -98,8 +99,8 @@ main(int argc, char **argv)
if (nc_get_att_text(ncid, varid, UNITS, strings_in)) ERR;
strings_in[att_len] = '\0'; /* null terminate, because nc_get_att_text doesn't */
if (strncmp(UNAME, strings_in, UNAMELEN) != 0) ERR;
- if (nc_close(ncid)) ERR;
-
+ if (nc_close(ncid)) ERR;
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
diff --git a/ncdump/tst_utf8.c b/ncdump/tst_utf8.c
index b791230..0d8c0d4 100644
--- a/ncdump/tst_utf8.c
+++ b/ncdump/tst_utf8.c
@@ -12,6 +12,7 @@
#include <config.h>
#include <stdlib.h>
#include <nc_tests.h>
+#include <err_macros.h>
#include <netcdf.h>
#include <string.h>
@@ -48,7 +49,7 @@ main(int argc, char **argv)
char name_in[UNAMELEN + 1], strings_in[UNAMELEN + 1];
nc_type att_type;
size_t att_len;
-
+
printf("\n*** Testing UTF-8.\n");
printf("*** creating UTF-8 test file %s...", FILE7_NAME);
if (nc_create(FILE7_NAME, NC_CLOBBER, &ncid))
@@ -78,7 +79,7 @@ main(int argc, char **argv)
ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE7_NAME, NC_NOWRITE, &ncid))
ERR;
@@ -90,7 +91,7 @@ main(int argc, char **argv)
/* Note, name was normalized before storing, so retrieved name
won't match original unnormalized name. Check that we get
normalized version, instead. */
-
+
/* NFC normalized UTF-8 for Unicode 8-character "Hello" in Greek */
unsigned char norm_utf8[] = {
0xCE, 0x9A, /* GREEK CAPITAL LETTER KAPPA : 2-bytes utf8 */
@@ -98,7 +99,7 @@ main(int argc, char **argv)
0xCE, 0xBB, /* GREEK SMALL LETTER ALPHA : 2-bytes utf8 */
0xCE, 0xB7, /* GREEK SMALL LETTER ETA : 2-bytes utf8 */
0xCE, 0xBC, /* GREEK SMALL LETTER MU : 2-bytes utf8 */
- 0xCE, 0xAD, /* GREEK SMALL LETTER EPSILON WITH TONOS
+ 0xCE, 0xAD, /* GREEK SMALL LETTER EPSILON WITH TONOS
: 2-bytes utf8 */
0xCF, 0x81, /* GREEK SMALL LETTER RHO : 2-bytes utf8 */
0xCE, 0xB1, /* GREEK SMALL LETTER ALPHA : 2-bytes utf8 */
diff --git a/ncdump/tst_vlen_data.c b/ncdump/tst_vlen_data.c
index 8b3cc18..3ae539f 100644
--- a/ncdump/tst_vlen_data.c
+++ b/ncdump/tst_vlen_data.c
@@ -8,6 +8,7 @@
*/
#include <nc_tests.h>
+#include "err_macros.h"
#include <netcdf.h>
#include <stdlib.h>
@@ -75,7 +76,7 @@ main(int argc, char **argv)
}
}
array[4][0] = missing_value; /* overwrite last row with missing for equality test */
-
+
for (i = 0; i < DIM5_LEN; i++) {
ragged_data[i].p = array[i];
ragged_data[i].len = NROWS - i;
@@ -88,21 +89,21 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
/* Check it out. */
-
+
/* Reopen the file. */
if (nc_open(FILE5_NAME, NC_NOWRITE, &ncid)) ERR;
/* Get info with the generic inquire for user-defined types */
- if (nc_inq_user_type(ncid, typeid, name_in, &base_size_in, &base_typeid,
+ if (nc_inq_user_type(ncid, typeid, name_in, &base_size_in, &base_typeid,
NULL, &class_in)) ERR;
- if (strcmp(name_in, TYPE5_NAME) ||
+ if (strcmp(name_in, TYPE5_NAME) ||
base_size_in != sizeof(nc_vlen_t) ||
base_typeid != NC_FLOAT ||
class_in != NC_VLEN) ERR;
/* Get the same info with the vlen-specific inquire function */
if (nc_inq_vlen(ncid, typeid, name_in, &base_size_in, &base_typeid)) ERR;
- if (strcmp(name_in, TYPE5_NAME) ||
+ if (strcmp(name_in, TYPE5_NAME) ||
base_size_in != sizeof(nc_vlen_t) ||
base_typeid != NC_FLOAT) ERR;
@@ -148,14 +149,13 @@ main(int argc, char **argv)
}
- if (nc_close(ncid)) ERR;
-
+ if (nc_close(ncid)) ERR;
+
/* Free space used for sample data. */
- for (i = 0; i < NROWS; i++)
+ for (i = 0; i < NROWS; i++)
free(array[i]);
free(array);
-
+
SUMMARIZE_ERR;
FINAL_RESULTS;
}
-
diff --git a/ncdump/utils.c b/ncdump/utils.c
index 412ea2d..bdaa39e 100644
--- a/ncdump/utils.c
+++ b/ncdump/utils.c
@@ -746,11 +746,11 @@ nc_inq_grps_full(int rootid, int *numgrps, int *grpids)
return stat;
}
-#ifdef ENABLE_FILEINFO
int
getrootid(int grpid)
{
int current = grpid;
+#ifdef USE_NETCDF4
int parent = current;
/* see if root id */
for(;;) {
@@ -758,7 +758,7 @@ getrootid(int grpid)
if(stat) break;
current = parent;
}
+#endif
return current;
}
-#endif
diff --git a/ncdump/vardata.c b/ncdump/vardata.c
index 483fc29..41b17f0 100644
--- a/ncdump/vardata.c
+++ b/ncdump/vardata.c
@@ -64,7 +64,7 @@ lput(const char *cp) {
linep = (int)strlen(LINEPIND) + indent_get();
}
(void) fputs(cp,stdout);
- if (cp[nn - 1] == '\n') {
+ if (nn > 0 && cp[nn - 1] == '\n') {
linep = indent_get();
} else
linep += nn;
diff --git a/ncgen/CMakeLists.txt b/ncgen/CMakeLists.txt
index 65077d9..1e15560 100644
--- a/ncgen/CMakeLists.txt
+++ b/ncgen/CMakeLists.txt
@@ -53,7 +53,7 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
ADD_CUSTOM_COMMAND(
OUTPUT ncgentab.h
- COMMAND flex -Pncg -B ncgen.l
+ COMMAND flex -Pncg -8 ncgen.l
COMMAND rm -f ncgenl.c
COMMAND mv lex.ncg.c ncgenl.c
diff --git a/ncgen/Make0 b/ncgen/Make0
index cc0f191..b58acb5 100644
--- a/ncgen/Make0
+++ b/ncgen/Make0
@@ -1,6 +1,7 @@
# Test c output
-T=test0
-K=1
+T=t
+K=4
+L=-L5
#VG=valgrind --leak-check=full
STDLIB=/usr/local
@@ -13,19 +14,23 @@ LDFLAGS=../liblib/.libs/libnetcdf.a -L${STDLIB}/lib -lhdf5_hl -lhdf5 -lz -lm -lc
CLASSPATH=".:ncCore-4.2.jar"
btest::
- ./ncgen -k$K -lb -o ${T}.nc ${T}.cdl
- ../ncdump/ncdump ./${T}.nc >${T}.dmp
+ ./ncgen ${L} -$K -lb -o ${T}.nc ${T}.cdl
+ ../ncdump/ncdump -L2 ./${T}.nc >${T}.dmp
diff -wBb ${T}.cdl ${T}.dmp
+ rm -f ./junk.nc
+ ../ncdump/nccopy ./${T}.nc ./junk.nc
ctest::
- ./ncgen -k$K -lc ${T}.cdl >${T}.c
+ ./ncgen ${L} -$K -lc ${T}.cdl >${T}.c
gcc -o ${T} ${CFLAGS} ${T}.c ${LDFLAGS}
./${T}
- ../ncdump/ncdump ./${T}.nc >${T}.dmp
+ ../ncdump/ncdump ${L} ./${T}.nc >${T}.dmp
diff -wBb ${T}.cdl ${T}.dmp
+ rm -f ./junk.nc
+ ../ncdump/nccopy ./${T}.nc ./junk.nc
gtest::
- ./ncgen -k$K -lc ${T}.cdl >${T}.c
+ ./ncgen -$K -lc ${T}.cdl >${T}.c
gcc -g -O0 -o ${T} ${CFLAGS} ${T}.c ${LDFLAGS}
gdb --args ./${T}
@@ -35,11 +40,11 @@ vctest::
${VG} ./vt
ftest::
- ./ncgen -k$K -lf77 ${T}.cdl >${T}.f77
+ ./ncgen -$K -lf77 ${T}.cdl >${T}.f77
gfortran -c ${CFLAGS} ${T}.f77
jtest::
- ./ncgen -k$K -lj ${T}.cdl >Main.java
+ ./ncgen -$K -lj ${T}.cdl >Main.java
javac -d . -classpath "${CLASSPATH}" Main.java
# java -cp ${CPATH} ./${T}
diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am
index d6ed0e8..c13f94e 100644
--- a/ncgen/Makefile.am
+++ b/ncgen/Makefile.am
@@ -23,19 +23,22 @@ man_MANS = ncgen.1
# These files all need to be distributed.
EXTRA_DIST = ncgen.y ncgen.l ncgenl.c $(man_MANS) internals.html \
run_tests.sh run_nc4_tests.sh c0.cdl c0_4.cdl ref_camrun.cdl \
-ncf199.cdl CMakeLists.txt XGetopt.c c5.cdl
+ncf199.cdl CMakeLists.txt XGetopt.c c5.cdl \
+compound_datasize_test.cdl compound_datasize_test2.cdl
# This shell script causes ncgen to build a classic and a 64-bit
# offset file from a cdl file shipped with the distribution.
#if !BUILD_DLL
-TESTS = run_tests.sh
+TESTS = run_tests.sh
if USE_NETCDF4
TESTS += run_nc4_tests.sh
endif # USE_NETCDF4
#endif # !BUILD_DLL
CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \
- ncf199.nc c5.nc
+ ncf199.nc c5.nc compound_datasize_test.nc compound_datasize_test2.nc \
+ tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl tst_ncf199.cdl \
+ tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl
# These rules are used if someone wants to rebuild ncgenl.c or ncgeny.c
# Otherwise never invoked, but records how to do it.
diff --git a/ncgen/Makefile.in b/ncgen/Makefile.in
index 7c6d270..4e1b874 100644
--- a/ncgen/Makefile.in
+++ b/ncgen/Makefile.in
@@ -598,7 +598,8 @@ man_MANS = ncgen.1
# These files all need to be distributed.
EXTRA_DIST = ncgen.y ncgen.l ncgenl.c $(man_MANS) internals.html \
run_tests.sh run_nc4_tests.sh c0.cdl c0_4.cdl ref_camrun.cdl \
-ncf199.cdl CMakeLists.txt XGetopt.c c5.cdl
+ncf199.cdl CMakeLists.txt XGetopt.c c5.cdl \
+compound_datasize_test.cdl compound_datasize_test2.cdl
# This shell script causes ncgen to build a classic and a 64-bit
@@ -607,7 +608,9 @@ ncf199.cdl CMakeLists.txt XGetopt.c c5.cdl
TESTS = run_tests.sh $(am__append_3)
#endif # !BUILD_DLL
CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \
- ncf199.nc c5.nc
+ ncf199.nc c5.nc compound_datasize_test.nc compound_datasize_test2.nc \
+ tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl tst_ncf199.cdl \
+ tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl
all: all-am
diff --git a/ncgen/bindata.c b/ncgen/bindata.c
index 3be3307..741cb60 100644
--- a/ncgen/bindata.c
+++ b/ncgen/bindata.c
@@ -8,10 +8,12 @@
#ifdef ENABLE_BINARY
+static void alignto(int alignment, Bytebuffer* buf, int base);
+
static int bin_uid = 0;
static int
-bin_charconstant(Generator* generator, Bytebuffer* buf, ...)
+bin_charconstant(Generator* generator, Symbol* sym, Bytebuffer* buf, ...)
{
/* Just transfer charbuf to codebuf */
Bytebuffer* charbuf;
@@ -25,7 +27,7 @@ bin_charconstant(Generator* generator, Bytebuffer* buf, ...)
}
static int
-bin_constant(Generator* generator, NCConstant* con, Bytebuffer* buf,...)
+bin_constant(Generator* generator, Symbol* sym, NCConstant* con, Bytebuffer* buf,...)
{
if(con->nctype != NC_ECONST) {
alignbuffer(con,buf);
@@ -97,27 +99,39 @@ bin_constant(Generator* generator, NCConstant* con, Bytebuffer* buf,...)
}
static int
-bin_listbegin(Generator* generator, ListClass lc, size_t size, Bytebuffer* buf, int* uidp, ...)
+bin_listbegin(Generator* generator, Symbol* tsym, void* liststate, ListClass lc, size_t size, Bytebuffer* buf, int* uidp, ...)
{
if(uidp) *uidp = ++bin_uid;
+ if(lc == LISTCOMPOUND)
+ *((int*)liststate) = bbLength(buf);
return 1;
}
static int
-bin_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
+bin_list(Generator* generator, Symbol* tsym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
{
+ if(lc == LISTCOMPOUND) {
+ int offsetbase = *((int*)liststate);
+ /* Pad for the alignment */
+ alignto(tsym->typ.alignment,buf,offsetbase);
+ }
return 1;
}
static int
-bin_listend(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
+bin_listend(Generator* generator, Symbol* tsym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
{
+ if(lc == LISTCOMPOUND) {
+ int offsetbase = *((int*)liststate);
+ /* Pad out the whole instance */
+ alignto(tsym->typ.cmpdalign,buf,offsetbase);
+ }
return 1;
}
static int
-bin_vlendecl(Generator* generator, Bytebuffer* buf, Symbol* tsym, int uid, size_t count,...)
+bin_vlendecl(Generator* generator, Symbol* tsym, Bytebuffer* buf, int uid, size_t count,...)
{
va_list ap;
Bytebuffer* vlenmem;
@@ -132,7 +146,7 @@ bin_vlendecl(Generator* generator, Bytebuffer* buf, Symbol* tsym, int uid, size_
}
static int
-bin_vlenstring(Generator* generator, Bytebuffer* codebuf, int* uidp, size_t* sizep,...)
+bin_vlenstring(Generator* generator, Symbol* sym, Bytebuffer* codebuf, int* uidp, size_t* sizep,...)
{
Bytebuffer* vlenmem;
nc_vlen_t ptr;
@@ -147,6 +161,21 @@ bin_vlenstring(Generator* generator, Bytebuffer* codebuf, int* uidp, size_t* siz
return 1;
}
+static const char zeros[] =
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+
+static void
+alignto(int alignment, Bytebuffer* buf, int base)
+{
+ int pad = 0;
+ int offset = bbLength(buf);
+ offset -= base; /* Need to actually align wrt to the base */
+ pad = getpadding(offset,alignment);
+ if(pad > 0) {
+ bbAppendn(buf,(void*)zeros,pad);
+ }
+}
+
/* Define the single static bin data generator */
static Generator bin_generator_singleton = {
NULL,
@@ -161,3 +190,4 @@ static Generator bin_generator_singleton = {
Generator* bin_generator = &bin_generator_singleton;
#endif /*ENABLE_BINARY*/
+
diff --git a/ncgen/c0.cdl b/ncgen/c0.cdl
index a712263..28163f0 100644
--- a/ncgen/c0.cdl
+++ b/ncgen/c0.cdl
@@ -159,8 +159,7 @@ data:
d2 = -1e+308, 1e+308 ;
-// c3 = "\001\300." ; This is actually illegal utf8
- c3 = "\001\177." ;
+ c3 = "\001\177." ;
b3 = -128, 127, -1 ;
@@ -382,4 +381,8 @@ data:
var-name-dashes = -1 ;
var.name.dots = -2 ;
+
+ var+name+plusses = _ ;
+
+ var at name@ats = _;
}
diff --git a/ncgen/c0_4.cdl b/ncgen/c0_4.cdl
index 7e9dfc6..494f722 100644
--- a/ncgen/c0_4.cdl
+++ b/ncgen/c0_4.cdl
@@ -1,4 +1,4 @@
-netcdf c0 {
+netcdf c0_4 {
dimensions:
Dr = UNLIMITED ; // (2 currently)
D1 = 1 ;
@@ -20,7 +20,7 @@ variables:
s:b = 0b, 127b, -128b, -1b ;
s:s = -32768s, 0s, 32767s ;
int i ;
- i:i = -2147483647, 0, 2147483647L ;
+ i:i = -2147483647, 0, 2147483647 ;
i:f = -1.e+36f, 0.f, 1.e+36f ;
i:d = -1.e+308, 0., 1.e+308 ;
float f ;
@@ -28,9 +28,9 @@ variables:
double d ;
d:c = "abcd\tZ$&" ;
int64 i64 ;
- i64:att_int64 = 1LL ;
+ i64:att_int64 = 1 ;
uint64 ui64 ;
- ui64:att_uint64 = 1ULL ;
+ ui64:att_uint64 = 1 ;
char cr(Dr) ;
byte br(Dr) ;
short sr(Dr) ;
@@ -127,9 +127,9 @@ data:
d = -10 ;
- i64 = 9223372036854775807LL;
+ i64 = 9223372036854775807;
- ui64 = 18446744073709551615ULL;
+ ui64 = 18446744073709551615;
cr = "ab" ;
@@ -389,4 +389,8 @@ data:
var-name-dashes = -1 ;
var.name.dots = -2 ;
+
+ var+name+plusses = _ ;
+
+ var at name@ats = _ ;
}
diff --git a/ncgen/cdata.c b/ncgen/cdata.c
index 63c8930..c82fa6f 100644
--- a/ncgen/cdata.c
+++ b/ncgen/cdata.c
@@ -13,7 +13,7 @@
static int c_uid = 0;
static int
-c_charconstant(Generator* generator, Bytebuffer* codebuf, ...)
+c_charconstant(Generator* generator, Symbol* sym, Bytebuffer* codebuf, ...)
{
/* Escapes and quoting will be handled in genc_write */
/* Just transfer charbuf to codebuf */
@@ -28,7 +28,7 @@ c_charconstant(Generator* generator, Bytebuffer* codebuf, ...)
}
static int
-c_constant(Generator* generator, NCConstant* con, Bytebuffer* buf,...)
+c_constant(Generator* generator, Symbol* sym, NCConstant* con, Bytebuffer* buf,...)
{
Bytebuffer* codetmp = bbNew();
char* special = NULL;
@@ -121,7 +121,7 @@ c_constant(Generator* generator, NCConstant* con, Bytebuffer* buf,...)
}
static int
-c_listbegin(Generator* generator, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...)
+c_listbegin(Generator* generator, Symbol* sym, void* liststate, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...)
{
if(uidp) *uidp = ++c_uid;
switch (lc) {
@@ -138,7 +138,7 @@ c_listbegin(Generator* generator, ListClass lc, size_t size, Bytebuffer* codebuf
}
static int
-c_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...)
+c_list(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...)
{
switch (lc) {
case LISTVLEN:
@@ -155,7 +155,7 @@ c_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* co
}
static int
-c_listend(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
+c_listend(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
{
switch (lc) {
case LISTCOMPOUND:
@@ -171,10 +171,10 @@ c_listend(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer*
}
static int
-c_vlendecl(Generator* generator, Bytebuffer* codebuf, Symbol* tsym, int uid, size_t count, ...)
+c_vlendecl(Generator* generator, Symbol* tsym, Bytebuffer* codebuf, int uid, size_t count, ...)
{
/* Build a bytebuffer to capture the vlen decl */
- List* declstack = (List*)generator->state;
+ List* declstack = (List*)generator->globalstate;
Bytebuffer* decl = bbNew();
Bytebuffer* vlenbuf;
va_list ap;
@@ -194,7 +194,7 @@ c_vlendecl(Generator* generator, Bytebuffer* codebuf, Symbol* tsym, int uid, siz
}
static int
-c_vlenstring(Generator* generator, Bytebuffer* vlenmem, int* uidp, size_t* countp,...)
+c_vlenstring(Generator* generator, Symbol* sym, Bytebuffer* vlenmem, int* uidp, size_t* countp,...)
{
if(uidp) *uidp = ++c_uid;
if(countp) *countp = bbLength(vlenmem);
diff --git a/ncgen/cdfdata.c b/ncgen/cdfdata.c
index 4a084aa..6d023fd 100644
--- a/ncgen/cdfdata.c
+++ b/ncgen/cdfdata.c
@@ -29,7 +29,8 @@ static void genbin_arraydatar(Symbol* basetype,
Bytebuffer* code);
static void genbin_primdata(Symbol*, Datasrc*, Datalist*, Bytebuffer*);
static void genbin_fieldarray(Symbol*, Datasrc*, Dimset*, int, Bytebuffer*);
-static void alignbuffer(Constant* prim, Bytebuffer* buf);
+static void alignbuffer(Constant* prim, Bytebuffer* buf, int base);
+static void alignto(int,ByteBuffer*, int base);
/* Datalist rules: see the rules on the man page */
@@ -48,6 +49,7 @@ genbin_attrdata(Symbol* asym, Bytebuffer* memory)
}
}
+#if 0 /* Apparently not used */
void
genbin_scalardata(Symbol* vsym, Bytebuffer* memory)
{
@@ -61,6 +63,7 @@ genbin_scalardata(Symbol* vsym, Bytebuffer* memory)
semerror(srcline(src),"Extra data at end of datalist");
}
}
+*/
void
genbin_datalist(struct Symbol* sym, Datalist* list, Bytebuffer* memory)
@@ -92,22 +95,9 @@ genbin_data(Symbol* tsym, Datasrc* datasrc, Datalist* fillsrc,
genbin_primdata(tsym,datasrc,fillsrc,memory);
break;
- case NC_COMPOUND: {
- int i;
- if(!issublist(datasrc)) {
- semerror(srcline(datasrc),"Compound data must be enclosed in {..}");
- }
- srcpush(datasrc);
- for(i=0;i<listlength(tsym->subnodes);i++) {
- Symbol* field = (Symbol*)listget(tsym->subnodes,i);
- if(!srcmore(datasrc)) { /* generate a fill value*/
- Datalist* fillsrc = getfiller(tsym);
- genbin_data(field,datasrc,fillsrc,memory);
- } else
- genbin_data(field,datasrc,NULL,memory);
- }
- srcpop(datasrc);
- } break;
+ case NC_COMPOUND:
+ genbin_compound(tsym,datasrc,fillsrc,memory);
+ break;
case NC_VLEN: {
Constant* cp;
@@ -138,6 +128,32 @@ genbin_data(Symbol* tsym, Datasrc* datasrc, Datalist* fillsrc,
}
}
+/* Used for compound instances */
+static void
+genbin_compound(Symbol* tsym, Datasrc* datasrc, Datalist* fillsrc, Bytebuffer* memory)
+{
+ int i;
+ int base = bblength(memory);
+ if(!issublist(datasrc)) {
+ semerror(srcline(datasrc),"Compound data must be enclosed in {..}");
+ }
+ /* Use this datasrc list to get values for compound fields */
+ srcpush(datasrc);
+ for(i=0;i<listlength(tsym->subnodes);i++) {
+ Symbol* field = (Symbol*)listget(tsym->subnodes,i);
+ if(!srcmore(datasrc)) { /* generate a fill value*/
+ Datalist* fillsrc = getfiller(tsym);
+ genbin_data(field,datasrc,fillsrc,memory);
+ } else
+ genbin_data(field,datasrc,NULL,memory);
+ }
+ srcpop(datasrc);
+ /* Re: github issue 323: we may need to pad the end of the structure
+ to make its size be a multiple of the largest alignment.
+ */
+ alignto(tsym->cmpdalignment,buf,base);
+}
+
/* Used only for structure field arrays*/
static void
genbin_fieldarray(Symbol* basetype, Datasrc* src, Dimset* dimset, int index,
@@ -428,10 +444,8 @@ genbin_arraydatar(Symbol* vsym,
}
}
-static const char zeros[] =
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
static void
-alignbuffer(Constant* prim, Bytebuffer* buf)
+alignbuffer(Constant* prim, Bytebuffer* buf, int base
{
int alignment,pad,offset;
@@ -443,7 +457,17 @@ alignbuffer(Constant* prim, Bytebuffer* buf)
alignment = nctypealignment(NC_CHAR);
else
alignment = nctypealignment(prim->nctype);
+ alignto(alignment,buf,base);
+}
+
+static const char zeros[] =
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+
+static void
+alignto(int alignment, Bytebuffer* buf, int base)
+{
offset = bbLength(buf);
+ offset -= base; /* Need to actually align wrt to the base */
pad = getpadding(offset,alignment);
if(pad > 0) {
bbAppendn(buf,(void*)zeros,pad);
diff --git a/ncgen/compound_datasize_test.cdl b/ncgen/compound_datasize_test.cdl
new file mode 100644
index 0000000..31e0351
--- /dev/null
+++ b/ncgen/compound_datasize_test.cdl
@@ -0,0 +1,17 @@
+netcdf compound_datasize_test {
+types:
+ compound obs_t {
+ float lat ;
+ float lon ;
+ string stid ;
+ double time ;
+ float temperature ;
+ }; // obs_t
+dimensions:
+ n = UNLIMITED ; // (2 currently)
+variables:
+ obs_t obs(n) ;
+data:
+
+ obs = {39.9, -104.9, "KDEN", 7776000, 15}, {40, -105, "KBOU", 7776000, 16} ;
+}
diff --git a/ncgen/compound_datasize_test2.cdl b/ncgen/compound_datasize_test2.cdl
new file mode 100644
index 0000000..229474c
--- /dev/null
+++ b/ncgen/compound_datasize_test2.cdl
@@ -0,0 +1,30 @@
+netcdf compound_datasize_test2 {
+types:
+ compound cmpd1 {
+ int lat ;
+ int lon ;
+ int id ;
+ uint64 time ;
+ int temperature ;
+ }; // cmpd1
+ compound nested {
+ int field1 ;
+ int field2 ;
+ cmpd1 nested(2) ;
+ uint64 field3 ;
+ int field4 ;
+ }; // nested
+dimensions:
+ n = UNLIMITED ; // (2 currently)
+variables:
+ nested scalar ;
+ nested array(n) ;
+data:
+
+ scalar =
+{40, -105, {{39, -104, 1111,7776000, 15},{39, -104, 1111,7776000, 15}} , 542932516829005, 17 } ;
+
+ array =
+{40, -105, {{39, -104, 1111,7776000, 15},{39, -104, 1111,7776000, 15}} , 542932516829005, 17 },
+{40, -105, {{39, -104, 1111,7776000, 15},{39, -104, 1111,7776000, 15}} , 542932516829005, 17 } ;
+}
diff --git a/ncgen/data.h b/ncgen/data.h
index 2ba073d..4d3da9b 100644
--- a/ncgen/data.h
+++ b/ncgen/data.h
@@ -182,14 +182,14 @@ typedef enum ListClass {
} ListClass;
struct Generator {
- void* state;
- int (*charconstant)(Generator*,Bytebuffer*,...);
- int (*constant)(Generator*,NCConstant*,Bytebuffer*,...);
- int (*listbegin)(Generator*,ListClass,size_t,Bytebuffer*,int*,...);
- int (*list)(Generator*,ListClass,int,size_t,Bytebuffer*,...);
- int (*listend)(Generator*,ListClass,int,size_t,Bytebuffer*,...);
- int (*vlendecl)(Generator*,Bytebuffer*,struct Symbol*,int,size_t,...);
- int (*vlenstring)(Generator*,Bytebuffer*,int*,size_t*,...);
+ void* globalstate; /* per-generator; per list state is in the method args where needed */
+ int (*charconstant)(Generator*,struct Symbol*,Bytebuffer*,...);
+ int (*constant)(Generator*,struct Symbol*,NCConstant*,Bytebuffer*,...);
+ int (*listbegin)(Generator*,struct Symbol*,void*,ListClass,size_t,Bytebuffer*,int*,...);
+ int (*list)(Generator*,struct Symbol*,void*,ListClass,int,size_t,Bytebuffer*,...);
+ int (*listend)(Generator*,struct Symbol*,void*,ListClass,int,size_t,Bytebuffer*,...);
+ int (*vlendecl)(Generator*,struct Symbol*,Bytebuffer*,int,size_t,...);
+ int (*vlenstring)(Generator*,struct Symbol*,Bytebuffer*,int*,size_t*,...);
};
extern int generator_getstate(Generator*,void**);
diff --git a/ncgen/f77data.c b/ncgen/f77data.c
index fd30953..4c67028 100644
--- a/ncgen/f77data.c
+++ b/ncgen/f77data.c
@@ -13,7 +13,7 @@
int f77_uid = 0;
static int
-f77_charconstant(Generator* generator, Bytebuffer* codebuf, ...)
+f77_charconstant(Generator* generator, Symbol* sym, Bytebuffer* codebuf, ...)
{
/* Escapes and quoting will be handled in genc_write */
/* Just transfer charbuf to codebuf */
@@ -28,7 +28,7 @@ f77_charconstant(Generator* generator, Bytebuffer* codebuf, ...)
}
static int
-f77_constant(Generator* generator, NCConstant* ci, Bytebuffer* codebuf,...)
+f77_constant(Generator* generator, Symbol* sym, NCConstant* ci, Bytebuffer* codebuf,...)
{
char tmp[64];
char* special = NULL;
@@ -79,14 +79,14 @@ f77_constant(Generator* generator, NCConstant* ci, Bytebuffer* codebuf,...)
}
static int
-f77_listbegin(Generator* generator, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...)
+f77_listbegin(Generator* generator, Symbol* sym, void* liststate, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...)
{
if(uidp) *uidp = ++f77_uid;
return 1;
}
static int
-f77_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...)
+f77_list(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...)
{
switch (lc) {
case LISTATTR:
@@ -104,19 +104,19 @@ f77_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer*
}
static int
-f77_listend(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
+f77_listend(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
{
return 1;
}
static int
-f77_vlendecl(Generator* generator, Bytebuffer* codebuf, Symbol* tsym, int uid, size_t count, ...)
+f77_vlendecl(Generator* generator, Symbol* tsym, Bytebuffer* codebuf, int uid, size_t count, ...)
{
return 1;
}
static int
-f77_vlenstring(Generator* generator, Bytebuffer* vlenmem, int* uidp, size_t* countp,...)
+f77_vlenstring(Generator* generator, Symbol* sym, Bytebuffer* vlenmem, int* uidp, size_t* countp,...)
{
if(uidp) *uidp = ++f77_uid;
return 1;
diff --git a/ncgen/genc.c b/ncgen/genc.c
index f733085..f1c0748 100644
--- a/ncgen/genc.c
+++ b/ncgen/genc.c
@@ -229,6 +229,14 @@ gen_ncc(const char *filename)
}
codeflush();
+ /* Set log level */
+ if(ncloglevel >= 0) {
+ codeline("");
+ bbprintf0(stmt," nc_set_log_level(%d); /* set log level */",ncloglevel);
+ codedump(stmt);
+ codeline("");
+ }
+
/* create netCDF file, uses NC_CLOBBER mode */
codeline("");
codelined(1,"/* enter define mode */");
@@ -707,7 +715,7 @@ definectype(Symbol* tsym)
Symbol* econst = (Symbol*)listget(tsym->subnodes,i);
Bytebuffer* econststring = bbNew();
ASSERT(econst->subclass == NC_ECONST);
- c_generator->constant(c_generator,&econst->typ.econst,econststring);
+ c_generator->constant(c_generator,tsym,&econst->typ.econst,econststring);
bbNull(econststring);
/* Enum constants must be converted to a fully qualified name */
bbprintf0(stmt,"#define %s ((%s)%s)\n",
@@ -805,7 +813,7 @@ genc_deftype(Symbol* tsym)
Symbol* econst = (Symbol*)listget(tsym->subnodes,i);
Bytebuffer* econststring = bbNew();
ASSERT(econst->subclass == NC_ECONST);
- c_generator->constant(c_generator,&econst->typ.econst,econststring);
+ c_generator->constant(c_generator,tsym,&econst->typ.econst,econststring);
bbNull(econststring);
bbprintf0(stmt,"%seconst = %s;\n",
indented(1),bbContents(econststring));
diff --git a/ncgen/generate.c b/ncgen/generate.c
index b77c1bf..5d684e9 100644
--- a/ncgen/generate.c
+++ b/ncgen/generate.c
@@ -29,13 +29,13 @@ static void generate_fieldarray(Symbol*, NCConstant*, Dimset*, Bytebuffer*, Data
int
generator_getstate(Generator* generator ,void** statep)
{
- if(statep) *statep = (void*)generator->state;
+ if(statep) *statep = (void*)generator->globalstate;
return 1;
}
int generator_reset(Generator* generator, void* state)
{
- generator->state = state;
+ generator->globalstate = state;
return 1;
}
@@ -63,13 +63,13 @@ generate_attrdata(Symbol* asym, Generator* generator, Writer writer, Bytebuffer*
} else {
int uid;
size_t count;
- generator->listbegin(generator,LISTATTR,asym->data->length,codebuf,&uid);
+ generator->listbegin(generator,asym,NULL,LISTATTR,asym->data->length,codebuf,&uid);
for(count=0;count<asym->data->length;count++) {
NCConstant* con = datalistith(asym->data,count);
- generator->list(generator,LISTATTR,uid,count,codebuf);
+ generator->list(generator,asym,NULL,LISTATTR,uid,count,codebuf);
generate_basetype(asym->typ.basetype,con,codebuf,NULL,generator);
}
- generator->listend(generator,LISTATTR,uid,count,codebuf);
+ generator->listend(generator,asym,NULL,LISTATTR,uid,count,codebuf);
}
writer(generator,asym,codebuf,0,NULL,NULL);
}
@@ -149,7 +149,7 @@ generate_array(Symbol* vsym,
if(typecode == NC_CHAR) {
Bytebuffer* charbuf = bbNew();
gen_chararray(dimset,0,vsym->data,charbuf,filler);
- generator->charconstant(generator,code,charbuf);
+ generator->charconstant(generator,vsym,code,charbuf);
/* Create an odometer to get the dimension info */
odom = newodometer(dimset,NULL,NULL);
writer(generator,vsym,code,odom->rank,odom->start,odom->count);
@@ -170,13 +170,13 @@ generate_array(Symbol* vsym,
if(nelems == 0)
break;
bbClear(code);
- generator->listbegin(generator,LISTDATA,vsym->data->length,code,&uid);
+ generator->listbegin(generator,vsym,NULL,LISTDATA,vsym->data->length,code,&uid);
for(i=0;i<nelems;i++) {
NCConstant* con = datalistith(vsym->data,i+offset);
- generator->list(generator,LISTDATA,uid,i,code);
+ generator->list(generator,vsym,NULL,LISTDATA,uid,i,code);
generate_basetype(basetype,con,code,filler,generator);
}
- generator->listend(generator,LISTDATA,uid,i,code);
+ generator->listend(generator,vsym,NULL,LISTDATA,uid,i,code);
writer(generator,vsym,code,rank,odom->start,odom->count);
}
}
@@ -237,20 +237,20 @@ generate_arrayr(Symbol* vsym,
if(typecode == NC_CHAR) {
Bytebuffer* charbuf = bbNew();
gen_chararray(dimset,dimindex,list,charbuf,filler);
- generator->charconstant(generator,code,charbuf);
+ generator->charconstant(generator,vsym,code,charbuf);
bbFree(charbuf);
} else {
/* build a special odometer to walk the last few dimensions */
subodom = newsubodometer(odom,dimset,dimindex,rank);
- generator->listbegin(generator,LISTDATA,list->length,code,&uid);
+ generator->listbegin(generator,vsym,NULL,LISTDATA,list->length,code,&uid);
for(i=0;odometermore(subodom);i++) {
size_t offset = odometeroffset(subodom);
NCConstant* con = datalistith(list,offset);
- generator->list(generator,LISTDATA,uid,i,code);
+ generator->list(generator,vsym,NULL,LISTDATA,uid,i,code);
generate_basetype(basetype,con,code,filler,generator);
odometerincr(subodom);
}
- generator->listend(generator,LISTDATA,uid,i,code);
+ generator->listend(generator,vsym,NULL,LISTDATA,uid,i,code);
odometerfree(subodom); subodom = NULL;
}
} else {/* !islastgroup */
@@ -291,6 +291,7 @@ void
generate_basetype(Symbol* tsym, NCConstant* con, Bytebuffer* codebuf, Datalist* filler, Generator* generator)
{
Datalist* data;
+ int offsetbase = 0;
switch (tsym->subclass) {
@@ -310,7 +311,6 @@ generate_basetype(Symbol* tsym, NCConstant* con, Bytebuffer* codebuf, Datalist*
ASSERT(fill->length == 1);
con = &fill->data[0];
if(!islistconst(con)) {
-
if(con)
semerror(con->lineno,"Compound data fill value is not enclosed in {..}");
else
@@ -334,14 +334,14 @@ generate_basetype(Symbol* tsym, NCConstant* con, Bytebuffer* codebuf, Datalist*
semerror(con->lineno,"Datalist longer than the number of compound fields");
break;
}
- generator->listbegin(generator,LISTCOMPOUND,listlength(tsym->subnodes),codebuf,&uid);
+ generator->listbegin(generator,tsym,&offsetbase,LISTCOMPOUND,listlength(tsym->subnodes),codebuf,&uid);
for(i=0;i<nfields;i++) {
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
con = datalistith(data,i);
- generator->list(generator,LISTCOMPOUND,uid,i,codebuf);
+ generator->list(generator,field,&offsetbase,LISTCOMPOUND,uid,i,codebuf);
generate_basetype(field,con,codebuf,NULL,generator);
}
- generator->listend(generator,LISTCOMPOUND,uid,i,codebuf);
+ generator->listend(generator,tsym,&offsetbase,LISTCOMPOUND,uid,i,codebuf);
} break;
case NC_VLEN: {
@@ -366,18 +366,18 @@ generate_basetype(Symbol* tsym, NCConstant* con, Bytebuffer* codebuf, Datalist*
vlenbuf = bbNew();
if(tsym->typ.basetype->typ.typecode == NC_CHAR) {
gen_charvlen(data,vlenbuf);
- generator->vlenstring(generator,vlenbuf,&uid,&count);
+ generator->vlenstring(generator,tsym,vlenbuf,&uid,&count);
} else {
- generator->listbegin(generator,LISTVLEN,data->length,codebuf,&uid);
+ generator->listbegin(generator,tsym,NULL,LISTVLEN,data->length,codebuf,&uid);
for(count=0;count<data->length;count++) {
NCConstant* con;
- generator->list(generator,LISTVLEN,uid,count,vlenbuf);
+ generator->list(generator,tsym,NULL,LISTVLEN,uid,count,vlenbuf);
con = datalistith(data,count);
generate_basetype(tsym->typ.basetype,con,vlenbuf,NULL,generator);
}
- generator->listend(generator,LISTVLEN,uid,count,codebuf,(void*)vlenbuf);
+ generator->listend(generator,tsym,NULL,LISTVLEN,uid,count,codebuf,(void*)vlenbuf);
}
- generator->vlendecl(generator,codebuf,tsym,uid,count,vlenbuf);
+ generator->vlendecl(generator,tsym,codebuf,uid,count,vlenbuf);
bbFree(vlenbuf);
} break;
@@ -416,18 +416,18 @@ generate_fieldarray(Symbol* basetype, NCConstant* con, Dimset* dimset,
if(chartype) {
Bytebuffer* charbuf = bbNew();
gen_chararray(dimset,0,data,charbuf,filler);
- generator->charconstant(generator,codebuf,charbuf);
+ generator->charconstant(generator,basetype,codebuf,charbuf);
bbFree(charbuf);
} else {
int uid;
size_t xproduct = crossproduct(dimset,0,rank); /* compute total number of elements */
- generator->listbegin(generator,LISTFIELDARRAY,xproduct,codebuf,&uid);
+ generator->listbegin(generator,basetype,NULL,LISTFIELDARRAY,xproduct,codebuf,&uid);
for(i=0;i<xproduct;i++) {
con = (data == NULL ? NULL : datalistith(data,i));
- generator->list(generator,LISTFIELDARRAY,uid,i,codebuf);
+ generator->list(generator,basetype,NULL,LISTFIELDARRAY,uid,i,codebuf);
generate_basetype(basetype,con,codebuf,NULL,generator);
}
- generator->listend(generator,LISTFIELDARRAY,uid,i,codebuf);
+ generator->listend(generator,basetype,NULL,LISTFIELDARRAY,uid,i,codebuf);
}
}
@@ -538,7 +538,7 @@ generate_primdata(Symbol* basetype, NCConstant* prim, Bytebuffer* codebuf,
default:
break;
}
- generator->constant(generator,&target,codebuf);
+ generator->constant(generator,basetype,&target,codebuf);
return;
}
diff --git a/ncgen/generr.c b/ncgen/generr.c
index 348816f..2770b5d 100644
--- a/ncgen/generr.c
+++ b/ncgen/generr.c
@@ -16,6 +16,15 @@ int error_count;
#endif
/*
+ * Invalidate variable list.
+ */
+#ifndef NO_STDARG
+#define vaend(argv,fmt) va_end(argv)
+#else
+#define vaend(argv,fmt) va_end(argv)
+#endif
+
+/*
* For logging error conditions.
* Designed to be called by other vararg procedures
*/
@@ -78,7 +87,7 @@ verror(fmt,va_alist) const char* fmt; va_dcl
strcpy(newfmt,"netCDF classic: not supported: ");
strncat(newfmt,fmt,2000);
vderror(newfmt,argv);
- va_end(argv);
+ vaend(argv,fmt);
}
#ifndef NO_STDARG
diff --git a/ncgen/generr.h b/ncgen/generr.h
index 96b0094..ec4b21c 100644
--- a/ncgen/generr.h
+++ b/ncgen/generr.h
@@ -17,6 +17,12 @@ extern int error_count;
#endif
#ifndef NO_STDARG
+#define vaend(argv,fmt) va_end(argv)
+#else
+#define vaend(argv,fmt) va_end(argv)
+#endif
+
+#ifndef NO_STDARG
#include <stdarg.h>
extern void vderror(const char *fmt, va_list argv);
extern void vdwarn(const char *fmt, va_list argv);
diff --git a/ncgen/jdata.c b/ncgen/jdata.c
index 500ee86..fefd65a 100644
--- a/ncgen/jdata.c
+++ b/ncgen/jdata.c
@@ -13,7 +13,7 @@
static int j_uid = 0;
static int
-j_charconstant(Generator* generator, Bytebuffer* codebuf, ...)
+j_charconstant(Generator* generator, Symbol* sym, Bytebuffer* codebuf, ...)
{
/* Escapes and quoting will be handled in genc_write */
/* Just transfer charbuf to codebuf */
@@ -28,7 +28,7 @@ j_charconstant(Generator* generator, Bytebuffer* codebuf, ...)
}
static int
-j_constant(Generator* generator, NCConstant* con, Bytebuffer* buf,...)
+j_constant(Generator* generator, Symbol* sym, NCConstant* con, Bytebuffer* buf,...)
{
Bytebuffer* codetmp = bbNew();
char* special = NULL;
@@ -99,7 +99,7 @@ j_constant(Generator* generator, NCConstant* con, Bytebuffer* buf,...)
}
static int
-j_listbegin(Generator* generator, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...)
+j_listbegin(Generator* generator, Symbol* sym, void* liststate, ListClass lc, size_t size, Bytebuffer* codebuf, int* uidp, ...)
{
if(uidp) *uidp = ++j_uid;
switch (lc) {
@@ -115,7 +115,7 @@ j_listbegin(Generator* generator, ListClass lc, size_t size, Bytebuffer* codebuf
}
static int
-j_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...)
+j_list(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* codebuf, ...)
{
switch (lc) {
case LISTATTR:
@@ -133,19 +133,19 @@ j_list(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* co
}
static int
-j_listend(Generator* generator, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
+j_listend(Generator* generator, Symbol* sym, void* liststate, ListClass lc, int uid, size_t count, Bytebuffer* buf, ...)
{
return 1;
}
static int
-j_vlendecl(Generator* generator, Bytebuffer* codebuf, Symbol* tsym, int uid, size_t count, ...)
+j_vlendecl(Generator* generator, Symbol* tsym, Bytebuffer* codebuf, int uid, size_t count, ...)
{
return 1;
}
static int
-j_vlenstring(Generator* generator, Bytebuffer* vlenmem, int* uidp, size_t* countp,...)
+j_vlenstring(Generator* generator, Symbol* sym, Bytebuffer* vlenmem, int* uidp, size_t* countp,...)
{
if(uidp) *uidp = ++j_uid;
if(countp) *countp = 0;
diff --git a/ncgen/ncf199.cdl b/ncgen/ncf199.cdl
index eb2ad45..3833d28 100644
--- a/ncgen/ncf199.cdl
+++ b/ncgen/ncf199.cdl
@@ -1,11 +1,13 @@
netcdf ncf199 {
dimensions:
F1 = 3 ;
- R1 = UNLIMITED ;
+ R1 = UNLIMITED ; // (2 currently)
variables:
int fr(F1,R1);
data:
-// This causes assertion violation:
-// assertion failure: (dimindex < lastunlimited && (dimset->dimsyms[dimindex]->dim.isunlimited))
- fr = {1,2}, {3,4}, {5,6} ;
+
+ fr =
+ {1,2},
+ {3,4},
+ {5,6} ;
}
diff --git a/ncgen/ncgen.1 b/ncgen/ncgen.1
index 1582ee3..77a87c2 100644
--- a/ncgen/ncgen.1
+++ b/ncgen/ncgen.1
@@ -864,7 +864,7 @@ There are three other cases of note.
.IP 1. 3
If there is only a single, unlimited dimension,
then all of the constants are concatenated
-and fill characers are added to the
+and fill characters are added to the
end of the resulting string to make its
length be that of the unlimited dimension.
If the length is larger than
diff --git a/ncgen/ncgen.h b/ncgen/ncgen.h
index eb3ea9b..386f8af 100644
--- a/ncgen/ncgen.h
+++ b/ncgen/ncgen.h
@@ -164,6 +164,7 @@ typedef struct Typeinfo {
NCConstant econst; /* for enum values*/
Dimset dimset; /* for NC_VAR/NC_FIELD/NC_ATT*/
size_t size; /* for opaque, compound, etc.*/
+ size_t cmpdalign; /* alignment needed for total size instances */
size_t nelems; /* size in terms of # of datalist constants
it takes to represent it */
Datalist* _Fillvalue; /* per-type cached fillvalue
diff --git a/ncgen/ncgen.y b/ncgen/ncgen.y
index fcc9e7a..ba72412 100644
--- a/ncgen/ncgen.y
+++ b/ncgen/ncgen.y
@@ -879,6 +879,7 @@ yyerror(fmt,va_alist) const char* fmt; va_dcl
vastart(argv,fmt);
(void)fprintf(stderr,"%s: %s line %d: ", progname, cdlname, lineno);
vderror(fmt,argv);
+ vaend(argv,fmt);
}
/* undefine yywrap macro, in case we are using bison instead of yacc */
diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c
index e1d4941..a740978 100644
--- a/ncgen/ncgenl.c
+++ b/ncgen/ncgenl.c
@@ -1,5 +1,5 @@
-#line 3 "lex.ncg.c"
+#line 3 "ncgenl.c"
#define YY_INT_ALIGNED short int
@@ -1320,7 +1320,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})*
/* Note: this definition of string will work for utf8 as well,
although it is a very relaxed definition
*/
-#line 1324 "lex.ncg.c"
+#line 1324 "ncgenl.c"
#define INITIAL 0
#define ST_C_COMMENT 1
@@ -1506,7 +1506,7 @@ YY_DECL
#line 217 "ncgen.l"
-#line 1510 "lex.ncg.c"
+#line 1510 "ncgenl.c"
if ( !(yy_init) )
{
@@ -1565,12 +1565,16 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 416 );
- yy_cp = (yy_last_accepting_cpos);
- yy_current_state = (yy_last_accepting_state);
+ while ( yy_base[yy_current_state] != 2347 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
YY_DO_BEFORE_ACTION;
@@ -2115,7 +2119,7 @@ YY_RULE_SETUP
#line 570 "ncgen.l"
ECHO;
YY_BREAK
-#line 2119 "lex.ncg.c"
+#line 2123 "ncgenl.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(TEXT):
yyterminate();
@@ -2183,8 +2187,7 @@ case YY_STATE_EOF(TEXT):
else
{
- yy_cp = (yy_last_accepting_cpos);
- yy_current_state = (yy_last_accepting_state);
+ yy_cp = (yy_c_buf_p);
goto yy_find_action;
}
}
diff --git a/ncgen/ncgeny.c b/ncgen/ncgeny.c
index 44f123b..1d1378d 100644
--- a/ncgen/ncgeny.c
+++ b/ncgen/ncgeny.c
@@ -338,7 +338,7 @@ Datalist* datalist;
NCConstant constant;
}
/* Line 193 of yacc.c. */
-#line 342 "ncgen.tab.c"
+#line 342 "ncgeny.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -351,7 +351,7 @@ NCConstant constant;
/* Line 216 of yacc.c. */
-#line 355 "ncgen.tab.c"
+#line 355 "ncgeny.c"
#ifdef short
# undef short
@@ -2732,7 +2732,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
/* Line 1267 of yacc.c. */
-#line 2736 "ncgen.tab.c"
+#line 2736 "ncgeny.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2961,6 +2961,7 @@ yyerror(fmt,va_alist) const char* fmt; va_dcl
vastart(argv,fmt);
(void)fprintf(stderr,"%s: %s line %d: ", progname, cdlname, lineno);
vderror(fmt,argv);
+ vaend(argv,fmt);
}
/* undefine yywrap macro, in case we are using bison instead of yacc */
diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h
index 90e5541..6636503 100644
--- a/ncgen/ncgeny.h
+++ b/ncgen/ncgeny.h
@@ -160,7 +160,7 @@ Datalist* datalist;
NCConstant constant;
}
/* Line 1529 of yacc.c. */
-#line 164 "ncgen.tab.h"
+#line 164 "ncgeny.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/ncgen/offsets.c b/ncgen/offsets.c
index 4a67241..bd8dee4 100644
--- a/ncgen/offsets.c
+++ b/ncgen/offsets.c
@@ -28,12 +28,15 @@ Author: D. Heimbigner 10/7/2008
#include "includes.h"
#else
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <assert.h>
#endif
-
#ifdef OFFSETTEST
+
+static void* emalloc(size_t);
+
typedef int nc_type;
typedef struct nc_vlen_t {
size_t len;
@@ -53,6 +56,11 @@ typedef struct nc_vlen_t {
#define NC_INT64 10 /* signed 8-byte int */
#define NC_UINT64 11 /* unsigned 8-byte int */
#define NC_STRING 12 /* string */
+#define NC_STRING 12 /* string */
+#define NC_VLEN 13
+#define NC_OPAQUE 14
+#define NC_ENUM 15
+#define NC_COMPOUND 16
#endif
#include "offsets.h"
@@ -75,6 +83,8 @@ Given the alignments for the various common primitive types,
it is assumed that one can use them anywhere to construct
the layout of a struct of such types.
It seems to work for HDF5 for a wide variety of machines.
+Note that technically, this is compiler dependent, but in practice
+all compilers seem to mimic the gcc rules.
*/
#define COMP_ALIGNMENT(DST,TYPE) {\
@@ -82,13 +92,11 @@ It seems to work for HDF5 for a wide variety of machines.
DST.typename = #TYPE ; \
DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));}
-
char* ctypenames[NCTYPES] = {
(char*)NULL,
"char","unsigned char",
"short","unsigned short",
"int","unsigned int",
-"long","unsigned long",
"long long","unsigned long long",
"float","double",
"void*","nc_vlen_t"
@@ -117,7 +125,9 @@ nctypealignment(nc_type nctype)
case NC_STRING: index = PTRINDEX; break;
case NC_VLEN: index = NCVLENINDEX; break;
case NC_OPAQUE: index = UCHARINDEX; break;
- default: PANIC1("nctypealignment: bad type code: %d",nctype);
+ default:
+ fprintf(stderr,"nctypealignment: bad type code: %d",nctype);
+ exit(1);
}
align = &vec[index];
return align->alignment;
@@ -139,8 +149,6 @@ compute_alignments(void)
COMP_ALIGNMENT(set.ushortalign,unsigned short);
COMP_ALIGNMENT(set.intalign,int);
COMP_ALIGNMENT(set.uintalign,unsigned int);
- COMP_ALIGNMENT(set.longalign,long);
- COMP_ALIGNMENT(set.ulongalign,unsigned long);
COMP_ALIGNMENT(set.longlongalign,long long);
COMP_ALIGNMENT(set.ulonglongalign,unsigned long long);
COMP_ALIGNMENT(set.floatalign,float);
@@ -155,8 +163,6 @@ compute_alignments(void)
COMP_ALIGNMENT(vec[USHORTINDEX],unsigned short);
COMP_ALIGNMENT(vec[INTINDEX],int);
COMP_ALIGNMENT(vec[UINTINDEX],unsigned int);
- COMP_ALIGNMENT(vec[LONGINDEX],long);
- COMP_ALIGNMENT(vec[ULONGINDEX],unsigned long);
COMP_ALIGNMENT(vec[LONGLONGINDEX],long long);
COMP_ALIGNMENT(vec[ULONGLONGINDEX],unsigned long long);
COMP_ALIGNMENT(vec[FLOATINDEX],float);
@@ -167,19 +173,28 @@ compute_alignments(void)
#ifdef OFFSETTEST
+/* Compute the alignment of TYPE when it is preceded
+ by a field of type TYPE1
+*/
#define COMP_ALIGNMENT1(DST,TYPE1,TYPE) {\
struct {TYPE1 f1; TYPE x;} tmp; \
DST.typename = #TYPE ; \
DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));}
+/* Compute the alignment of TYPE when it is preceded
+ by a field of type TYPE1 and a field of type TYPE2
+*/
#define COMP_ALIGNMENT2(DST,TYPE1,TYPE2,TYPE) {\
struct {TYPE1 f1, TYPE2 f2; TYPE x;} tmp; \
DST.typename = #TYPE ; \
DST.alignment = (size_t)((char*)(&(tmp.x)) - (char*)(&tmp));}
+/* Compute the alignment of TYPE when it is preceded
+ by a field of type TYPE1 and a field of type TYPE2
+*/
#define COMP_SIZE0(DST,TYPE1,TYPE2) {\
struct {TYPE1 c; TYPE2 x;} tmp; \
- DST = sizeof(tmp); }g
+ DST = sizeof(tmp); }
static char*
padname(char* name)
@@ -217,14 +232,12 @@ verify(Typealignvec* vec)
COMP_SIZE0(sizes8[4],unsigned short,char);
COMP_SIZE0(sizes8[5],int,char);
COMP_SIZE0(sizes8[6],unsigned int,char);
- COMP_SIZE0(sizes8[7],long,char);
- COMP_SIZE0(sizes8[8],unsigned long,char);
- COMP_SIZE0(sizes8[9],long long,char);
- COMP_SIZE0(sizes8[10],unsigned long long,char);
- COMP_SIZE0(sizes8[11],float,char);
- COMP_SIZE0(sizes8[12],double,char) ;
- COMP_SIZE0(sizes8[13],void*,char);
- COMP_SIZE0(sizes8[14],nc_vlen_t,char);
+ COMP_SIZE0(sizes8[7],long long,char);
+ COMP_SIZE0(sizes8[8],unsigned long long,char);
+ COMP_SIZE0(sizes8[9],float,char);
+ COMP_SIZE0(sizes8[10],double,char) ;
+ COMP_SIZE0(sizes8[11],void*,char);
+ COMP_SIZE0(sizes8[12],nc_vlen_t,char);
COMP_SIZE0(sizes16[1],char,short);
COMP_SIZE0(sizes16[2],unsigned char,short);
@@ -232,14 +245,12 @@ verify(Typealignvec* vec)
COMP_SIZE0(sizes16[4],unsigned short,short);
COMP_SIZE0(sizes16[5],int,short);
COMP_SIZE0(sizes16[6],unsigned int,short);
- COMP_SIZE0(sizes16[7],long,short);
- COMP_SIZE0(sizes16[8],unsigned long,short);
- COMP_SIZE0(sizes16[9],long long,short);
- COMP_SIZE0(sizes16[10],unsigned long long,short);
- COMP_SIZE0(sizes16[11],float,short);
- COMP_SIZE0(sizes16[12],double,short) ;
- COMP_SIZE0(sizes16[13],void*,short);
- COMP_SIZE0(sizes16[14],nc_vlen_t*,short);
+ COMP_SIZE0(sizes16[7],long long,short);
+ COMP_SIZE0(sizes16[8],unsigned long long,short);
+ COMP_SIZE0(sizes16[9],float,short);
+ COMP_SIZE0(sizes16[10],double,short) ;
+ COMP_SIZE0(sizes16[11],void*,short);
+ COMP_SIZE0(sizes16[12],nc_vlen_t*,short);
COMP_SIZE0(sizes32[1],char,int);
COMP_SIZE0(sizes32[2],unsigned char,int);
@@ -247,14 +258,12 @@ verify(Typealignvec* vec)
COMP_SIZE0(sizes32[4],unsigned short,int);
COMP_SIZE0(sizes32[5],int,int);
COMP_SIZE0(sizes32[6],unsigned int,int);
- COMP_SIZE0(sizes32[7],long,int);
- COMP_SIZE0(sizes32[8],unsigned long,int);
- COMP_SIZE0(sizes32[9],long long,int);
- COMP_SIZE0(sizes32[10],unsigned long long,int);
- COMP_SIZE0(sizes32[11],float,int);
- COMP_SIZE0(sizes32[12],double,int) ;
- COMP_SIZE0(sizes32[13],void*,int);
- COMP_SIZE0(sizes32[14],nc_vlen_t*,int);
+ COMP_SIZE0(sizes32[7],long long,int);
+ COMP_SIZE0(sizes32[8],unsigned long long,int);
+ COMP_SIZE0(sizes32[9],float,int);
+ COMP_SIZE0(sizes32[10],double,int) ;
+ COMP_SIZE0(sizes32[11],void*,int);
+ COMP_SIZE0(sizes32[12],nc_vlen_t*,int);
COMP_ALIGNMENT1(vec16[1],char,short);
COMP_ALIGNMENT1(vec16[2],unsigned char,short);
@@ -262,14 +271,12 @@ verify(Typealignvec* vec)
COMP_ALIGNMENT1(vec16[4],unsigned short,short);
COMP_ALIGNMENT1(vec16[5],int,short);
COMP_ALIGNMENT1(vec16[6],unsigned int,short);
- COMP_ALIGNMENT1(vec32[7],long,short);
- COMP_ALIGNMENT1(vec32[8],unsigned long,short);
- COMP_ALIGNMENT1(vec32[9],long long,short);
- COMP_ALIGNMENT1(vec32[10],unsigned long long,short);
- COMP_ALIGNMENT1(vec16[11],float,short);
- COMP_ALIGNMENT1(vec16[12],double,short);
- COMP_ALIGNMENT1(vec16[13],void*,short);
- COMP_ALIGNMENT1(vec16[14],nc_vlen_t*,short);
+ COMP_ALIGNMENT1(vec32[7],long long,short);
+ COMP_ALIGNMENT1(vec32[8],unsigned long long,short);
+ COMP_ALIGNMENT1(vec16[9],float,short);
+ COMP_ALIGNMENT1(vec16[10],double,short);
+ COMP_ALIGNMENT1(vec16[11],void*,short);
+ COMP_ALIGNMENT1(vec16[12],nc_vlen_t*,short);
COMP_ALIGNMENT1(vec32[1],char,short);
COMP_ALIGNMENT1(vec32[2],unsigned char,short);
@@ -277,14 +284,12 @@ verify(Typealignvec* vec)
COMP_ALIGNMENT1(vec32[4],unsigned short,short);
COMP_ALIGNMENT1(vec32[5],int,int);
COMP_ALIGNMENT1(vec32[6],unsigned int,int);
- COMP_ALIGNMENT1(vec32[7],long,int);
- COMP_ALIGNMENT1(vec32[8],unsigned long,int);
- COMP_ALIGNMENT1(vec32[9],long long,int);
- COMP_ALIGNMENT1(vec32[10],unsigned long long,int);
- COMP_ALIGNMENT1(vec32[11],float,int);
- COMP_ALIGNMENT1(vec32[12],double,int);
- COMP_ALIGNMENT1(vec32[13],void*,int);
- COMP_ALIGNMENT1(vec32[14],nc_vlen_t*,int);
+ COMP_ALIGNMENT1(vec32[7],long long,int);
+ COMP_ALIGNMENT1(vec32[8],unsigned long long,int);
+ COMP_ALIGNMENT1(vec32[9],float,int);
+ COMP_ALIGNMENT1(vec32[10],double,int);
+ COMP_ALIGNMENT1(vec32[11],void*,int);
+ COMP_ALIGNMENT1(vec32[12],nc_vlen_t*,int);
for(i=0;i<NCTYPES;i++) {
printf("%s: size=%2d alignment=%2d\n",
@@ -301,6 +306,17 @@ verify(Typealignvec* vec)
}
+void *
+emalloc(size_t bytes) {
+ size_t *memory;
+ memory = malloc(bytes);
+ if(memory == 0) {
+ printf("malloc failed\n");
+ exit(2);
+ }
+ return memory;
+}
+
int
main(int argc, char** argv)
{
diff --git a/ncgen/run_nc4_tests.sh b/ncgen/run_nc4_tests.sh
index 794c15a..0c5b067 100755
--- a/ncgen/run_nc4_tests.sh
+++ b/ncgen/run_nc4_tests.sh
@@ -4,20 +4,55 @@
if test "x$srcdir" = x ; then srcdir="."; fi
+##
+# Function to test a netCDF CDL file.
+# 1. Generate binary nc.
+# Use ncdump to compare against original CDL file.
+# Input: CDL file name, minus the suffix, output filename
+# Other input: arguments.
+#
+# Example:
+# $ validateNC compound_datasize_test -k nc4
+##
+validateNC() {
+ BASENAME=$1
+ INFILE=$srcdir/$1.cdl
+ TMPFILE=tst_$2.cdl
+ shift
+ shift
+ ARGS=$@
+
+ echo "*** generating $BASENAME.nc ***"
+ ./ncgen $ARGS -o $BASENAME.nc $INFILE
+ ../ncdump/ncdump $BASENAME.nc | sed 's/e+0/e+/g' > $TMPFILE
+ echo "*** comparing binary against source CDL file *** "
+ diff -b -w $INFILE $TMPFILE
+
+}
+
+
+
echo "*** Testing ncgen for netCDF-4."
set -e
echo "*** creating netCDF-4 file c0_4.nc from c0_4.cdl..."
-./ncgen -k nc4 -b -o c0_4.nc $srcdir/c0_4.cdl
+validateNC "c0_4" "c0_4" -k nc4 -b -o c0_4.nc
echo "*** creating netCDF-4 classic model file c0_4c.nc from c0.cdl..."
-./ncgen -k nc7 -b -o c0_4c.nc $srcdir/c0.cdl
+validateNC "c0" "c0_4c" -k nc7 -b
echo "*** creating C code for CAM file ref_camrun.cdl..."
./ncgen -lc $srcdir/ref_camrun.cdl >ref_camrun.c
echo "*** test for jira NCF-199 bug"
-./ncgen -k nc4 $srcdir/ncf199.cdl
+validateNC "ncf199" "ncf199" -k nc4
+
+echo "*** creating binary files for github issue 323..."
+echo "*** github issue 323 test 1"
+validateNC "compound_datasize_test" "compound_datasize_test" -k nc4
+
+echo "*** github issue 323 test 2"
+validateNC "compound_datasize_test2" "compound_datasize_test2" -k nc4
echo "*** Test successful!"
exit 0
diff --git a/ncgen/run_tests.sh b/ncgen/run_tests.sh
index e02a641..d933d2f 100755
--- a/ncgen/run_tests.sh
+++ b/ncgen/run_tests.sh
@@ -2,7 +2,6 @@
# This shell script runs the ncgen tests.
# $Id: run_tests.sh,v 1.10 2010/04/04 22:06:03 dmh Exp $
-set -x
if test "x$srcdir" = x ; then
srcdir=`pwd`
fi
@@ -10,21 +9,28 @@ fi
echo "*** Testing ncgen."
set -e
+validateNC() {
+ BASENAME=$1
+ INFILE=$srcdir/$1.cdl
+ TMPFILE=tst_$2.cdl
+ shift
+ shift
+ ARGS=$@
+
+ echo "*** generating $BASENAME.nc ***"
+ ./ncgen $ARGS -o $BASENAME.nc $INFILE
+ ../ncdump/ncdump $BASENAME.nc | sed 's/e+0/e+/g' > $TMPFILE
+ echo "*** comparing $BASENAME.nc against $INFILE *** "
+ diff -b -w $INFILE $TMPFILE
+}
+
echo "*** creating classic file c0.nc from c0.cdl..."
-ls -l "$srcdir/c0.cdl"
-ls -l ./ncgen*
-./ncgen -b -o c0.nc $srcdir/c0.cdl
-if [ ! -f c0.nc ]; then
- echo "Failure."
- exit 1
-fi
+
+validateNC c0 c0 -b
echo "*** creating 64-bit offset file c0_64.nc from c0.cdl..."
-./ncgen -k 64-bit-offset -b -o c0_64.nc $srcdir/c0.cdl
-if [ ! -f c0_64.nc ]; then
- echo "Failure."
- exit 1
-fi
+
+validateNC c0 "c0_64" -k 64-bit-offset -b
echo "*** creating 64-bit offset file c5.nc from c5.cdl..."
./ncgen -k 64-bit-data -b -o c5.nc $srcdir/c5.cdl
diff --git a/ncgen/semantics.c b/ncgen/semantics.c
index 7ad7909..018766e 100644
--- a/ncgen/semantics.c
+++ b/ncgen/semantics.c
@@ -99,7 +99,7 @@ locate(Symbol* refsym)
if(sym != NULL) break;
parent = parent->container;
}
- }
+ }
break;
case NC_TYPE:
if(refsym->is_prefixed) {
@@ -130,7 +130,7 @@ locate(Symbol* refsym)
if(sym == NULL) {
sym = uniquetreelocate(refsym,rootgroup); /* want unique */
}
- }
+ }
break;
case NC_VAR:
if(refsym->is_prefixed) {
@@ -140,7 +140,7 @@ locate(Symbol* refsym)
Symbol* parent = lookupgroup(refsym->prefix);/*get group for refsym*/
/* search this parent for matching name and type*/
sym = lookupingroup(NC_VAR,refsym->name,parent);
- }
+ }
break;
case NC_GRP:
if(refsym->is_prefixed) {
@@ -150,7 +150,7 @@ locate(Symbol* refsym)
Symbol* parent = lookupgroup(refsym->prefix);/*get group for refsym*/
/* search this parent for matching name and type*/
sym = lookupingroup(NC_GRP,refsym->name,parent);
- }
+ }
break;
default: PANIC1("locate: bad refsym type: %d",refsym->objectclass);
@@ -163,7 +163,7 @@ locate(Symbol* refsym)
ncname = ncclassname(refsym->objectclass);
fdebug("locate: %s: %s -> %s\n",
ncname,fullname(refsym),(sym?fullname(sym):"NULL"));
- }
+ }
return sym;
}
@@ -184,7 +184,7 @@ uniquetreelocate(Symbol* refsym, Symbol* root)
if(grp->objectclass == NC_GRP && !grp->ref.is_ref) {
Symbol* nextsym = uniquetreelocate(refsym,grp);
if(nextsym != NULL) {
- if(sym != NULL) return NULL; /* not unique */
+ if(sym != NULL) return NULL; /* not unique */
sym = nextsym;
}
}
@@ -278,14 +278,14 @@ processtypes(void)
break;
case NC_VLEN: /* keep if its basetype is primitive*/
if(sym->typ.basetype->subclass == NC_PRIM) keep=1;
- break;
+ break;
case NC_COMPOUND: /* keep if all fields are primitive*/
keep=1; /*assume all fields are primitive*/
for(j=0;j<listlength(sym->subnodes);j++) {
Symbol* field = (Symbol*)listget(sym->subnodes,j);
ASSERT(field->subclass == NC_FIELD);
if(field->typ.basetype->subclass != NC_PRIM) {keep=0;break;}
- }
+ }
break;
default: break;/* ignore*/
}
@@ -293,7 +293,7 @@ processtypes(void)
sym->touched = 1;
listpush(sorted,(void*)sym);
}
- }
+ }
/* 2. repeated walk to collect level i types*/
do {
added=0;
@@ -302,29 +302,29 @@ processtypes(void)
if(sym->touched) continue; /* ignore already processed types*/
keep=0; /* assume not addable yet.*/
switch (sym->subclass) {
- case NC_PRIM:
+ case NC_PRIM:
case NC_OPAQUE:
case NC_ENUM:
PANIC("type re-touched"); /* should never happen*/
break;
case NC_VLEN: /* keep if its basetype is already processed*/
if(sym->typ.basetype->touched) keep=1;
- break;
+ break;
case NC_COMPOUND: /* keep if all fields are processed*/
keep=1; /*assume all fields are touched*/
for(j=0;j<listlength(sym->subnodes);j++) {
Symbol* field = (Symbol*)listget(sym->subnodes,j);
ASSERT(field->subclass == NC_FIELD);
if(!field->typ.basetype->touched) {keep=1;break;}
- }
+ }
break;
- default: break;
+ default: break;
}
if(keep) {
listpush(sorted,(void*)sym);
sym->touched = 1;
added++;
- }
+ }
}
} while(added > 0);
/* Any untouched type => circular dependency*/
@@ -355,16 +355,16 @@ tagvlentypes(Symbol* tsym)
int tagged = 0;
unsigned long j;
switch (tsym->subclass) {
- case NC_VLEN:
+ case NC_VLEN:
tagged = 1;
tagvlentypes(tsym->typ.basetype);
- break;
+ break;
case NC_COMPOUND: /* keep if all fields are primitive*/
for(j=0;j<listlength(tsym->subnodes);j++) {
Symbol* field = (Symbol*)listget(tsym->subnodes,j);
ASSERT(field->subclass == NC_FIELD);
if(tagvlentypes(field->typ.basetype)) tagged = 1;
- }
+ }
break;
default: break;/* ignore*/
}
@@ -377,7 +377,7 @@ static void
filltypecodes(void)
{
Symbol* sym;
- for(sym=symlist;sym != NULL;sym = sym->next) {
+ for(sym=symlist;sym != NULL;sym = sym->next) {
if(sym->typ.basetype != NULL && sym->typ.typecode == NC_NAT)
sym->typ.typecode = sym->typ.basetype->typ.typecode;
}
@@ -397,7 +397,7 @@ processenums(void)
ASSERT(esym->subclass == NC_ECONST);
listpush(enumids,(void*)esym);
}
- }
+ }
/* Convert enum values to match enum type*/
for(i=0;i<listlength(typdefs);i++) {
Symbol* tsym = (Symbol*)listget(typdefs,i);
@@ -410,7 +410,7 @@ processenums(void)
newec.nctype = esym->typ.typecode;
convert1(&esym->typ.econst,&newec);
esym->typ.econst = newec;
- }
+ }
}
}
@@ -540,7 +540,7 @@ findecmatches(char* ident)
ec = checkeconst(en,ident);
if(ec != NULL)
listpush(matches,ec);
- /* Second, do the prefix check */
+ /* Second, do the prefix check */
len = strlen(en->name);
if(strncmp(ident,en->name,len) == 0) {
Symbol *ec;
@@ -555,7 +555,7 @@ findecmatches(char* ident)
listfree(matches);
matches = NULL;
}
- return matches;
+ return matches;
}
static List*
@@ -633,18 +633,25 @@ computesize(Symbol* tsym)
computesize(field);
/* alignment of struct is same as alignment of first field*/
if(i==0) tsym->typ.alignment = field->typ.alignment;
- }
+ }
/* now compute the size of the compound based on*/
/* what user specified*/
offset = 0;
- for(i=0;i<listlength(tsym->subnodes);i++) {
- Symbol* field = (Symbol*)listget(tsym->subnodes,i);
- /* only support 'c' alignment for now*/
- int alignment = field->typ.alignment;
- offset += getpadding(offset,alignment);
- field->typ.offset = offset;
- offset += field->typ.size;
+ int largealign = 1;
+ for(i=0;i<listlength(tsym->subnodes);i++) {
+ Symbol* field = (Symbol*)listget(tsym->subnodes,i);
+ /* only support 'c' alignment for now*/
+ int alignment = field->typ.alignment;
+ int padding = getpadding(offset,alignment);
+ offset += padding;
+ field->typ.offset = offset;
+ offset += field->typ.size;
+ if (alignment > largealign) {
+ largealign = alignment;
+ }
}
+ tsym->typ.cmpdalign = largealign; /* total structure size alignment */
+ offset += (offset % largealign);
tsym->typ.size = offset;
break;
case NC_FIELD: /* Compute size assume no unlimited dimensions*/
@@ -691,7 +698,7 @@ processvars(void)
if(usingclassic && j != 0)
semerror(vsym->lineno,"Variable: %s: UNLIMITED must be in first dimension only",fullname(vsym));
}
- }
+ }
}
}
@@ -768,7 +775,7 @@ processattributes(void)
Symbol* asym = (Symbol*)listget(attdefs,j);
if(asym->att.var == NULL)
continue; /* ignore globals for now */
- if(asym->att.var != vsym) continue;
+ if(asym->att.var != vsym) continue;
listpush(list,(void*)asym);
}
vsym->var.attributes = list;
@@ -819,7 +826,7 @@ inferattributetype1(Datasrc* src)
return NC_NAT;
}
srcnext(src);
- }
+ }
/* Walk repeatedly to get info for inference (loops could be combined) */
/* Compute: all strings or chars? */
@@ -832,7 +839,7 @@ inferattributetype1(Datasrc* src)
else if(con->nctype == NC_CHAR) charcount++;
}
if((stringcount+charcount) > 0) {
- if((stringcount+charcount) < srclen(src))
+ if((stringcount+charcount) < srclen(src))
return NC_NAT; /* not all textual */
return NC_CHAR;
}
@@ -871,7 +878,7 @@ inferattributetype1(Datasrc* src)
case NC_BYTE : if(con->value.int8v < 0) {hasneg = 1;} break;
case NC_SHORT: if(con->value.int16v < 0) {hasneg = 1;} break;
case NC_INT: if(con->value.int32v < 0) {hasneg = 1;} break;
- }
+ }
}
/* Compute: inferred integer type */
@@ -879,7 +886,7 @@ inferattributetype1(Datasrc* src)
result = NC_NAT;
while(srcmore(src)) {
NCConstant* con = srcnext(src);
- result = infertype(result,con->nctype,hasneg);
+ result = infertype(result,con->nctype,hasneg);
if(result == NC_NAT) break; /* something wrong */
}
return result;
@@ -899,7 +906,7 @@ inferattributetype(Symbol* asym)
return;
}
src = datalist2src(datalist);
- nctype = inferattributetype1(src);
+ nctype = inferattributetype1(src);
freedatasrc(src);
if(nctype == NC_NAT) { /* Illegal attribute value list */
semerror(asym->lineno,"Non-simple list of values for untyped attribute: %s",fullname(asym));
@@ -946,10 +953,9 @@ validateNIL(Symbol* sym)
{
#ifdef USE_NETCDF4
Datalist* datalist = sym->data;
-
- if(sym->data == NULL || datalist->length == 0) return;
+ if(datalist == NULL || datalist->length == 0) return;
if(sym->typ.typecode == NC_STRING) return;
- validateNILr(sym->data);
+ validateNILr(datalist);
#endif
}
@@ -1080,7 +1086,7 @@ computeunlimitedsizes(Dimset* dimset, int dimindex, Datalist* data, int ischar)
int nextunlim,lastunlim;
Symbol* thisunlim = dimset->dimsyms[dimindex];
size_t length;
-
+
ASSERT(thisunlim->dim.isunlimited);
nextunlim = findunlimited(dimset,dimindex+1);
lastunlim = (nextunlim == dimset->ndims);
diff --git a/nctest/tst_rename.c b/nctest/tst_rename.c
index be1246a..0807c89 100644
--- a/nctest/tst_rename.c
+++ b/nctest/tst_rename.c
@@ -6,7 +6,7 @@
*/
#include <nc_tests.h>
-
+#include "err_macros.h"
#define FILE_NAME "tst_rename.nc"
diff --git a/oc2/dap.y b/oc2/dap.y
index cf2569a..e201539 100644
--- a/oc2/dap.y
+++ b/oc2/dap.y
@@ -236,7 +236,7 @@ errorbody:
;
errorcode: /*empty*/ {$$=null;} | SCAN_CODE '=' WORD_WORD ';' {$$=$3;}
-errormsg: /*empty*/ {$$=null;} | SCAN_MESSAGE '=' WORD_WORD ';' {$$=$3;}
+errormsg: /*empty*/ {$$=null;} | SCAN_MESSAGE '=' WORD_STRING ';' {$$=$3;}
errorptype: /*empty*/ {$$=null;} | SCAN_PTYPE '=' WORD_WORD ';' {$$=$3;}
errorprog : /*empty*/ {$$=null;} | SCAN_PROG '=' WORD_WORD ';' {$$=$3;}
diff --git a/oc2/dapy.c b/oc2/dapy.c
index e2af8b2..d1cfa63 100644
--- a/oc2/dapy.c
+++ b/oc2/dapy.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -58,37 +58,32 @@
/* Pull parsers. */
#define YYPULL 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
#define yyparse dapparse
#define yylex daplex
#define yyerror daperror
-#define yylval daplval
-#define yychar dapchar
#define yydebug dapdebug
#define yynerrs dapnerrs
/* Copy the first part of user declarations. */
-
-/* Line 268 of yacc.c */
-#line 11 "dap.y"
+#line 11 "dap.y" /* yacc.c:339 */
#include "config.h"
#include "dapparselex.h"
#include "dapy.h"
int dapdebug = 0;
+#line 79 "dap.tab.c" /* yacc.c:339 */
-/* Line 268 of yacc.c */
-#line 87 "dap.tab.c"
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
@@ -98,61 +93,67 @@ int dapdebug = 0;
# define YYERROR_VERBOSE 1
#endif
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
+/* In a future release of Bison, this section will be replaced
+ by #include "dap.tab.h". */
+#ifndef YY_DAP_DAP_TAB_H_INCLUDED
+# define YY_DAP_DAP_TAB_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+#if YYDEBUG
+extern int dapdebug;
#endif
-
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- SCAN_ALIAS = 258,
- SCAN_ARRAY = 259,
- SCAN_ATTR = 260,
- SCAN_BYTE = 261,
- SCAN_CODE = 262,
- SCAN_DATASET = 263,
- SCAN_DATA = 264,
- SCAN_ERROR = 265,
- SCAN_FLOAT32 = 266,
- SCAN_FLOAT64 = 267,
- SCAN_GRID = 268,
- SCAN_INT16 = 269,
- SCAN_INT32 = 270,
- SCAN_MAPS = 271,
- SCAN_MESSAGE = 272,
- SCAN_SEQUENCE = 273,
- SCAN_STRING = 274,
- SCAN_STRUCTURE = 275,
- SCAN_UINT16 = 276,
- SCAN_UINT32 = 277,
- SCAN_URL = 278,
- SCAN_PTYPE = 279,
- SCAN_PROG = 280,
- WORD_WORD = 281,
- WORD_STRING = 282
- };
+ enum yytokentype
+ {
+ SCAN_ALIAS = 258,
+ SCAN_ARRAY = 259,
+ SCAN_ATTR = 260,
+ SCAN_BYTE = 261,
+ SCAN_CODE = 262,
+ SCAN_DATASET = 263,
+ SCAN_DATA = 264,
+ SCAN_ERROR = 265,
+ SCAN_FLOAT32 = 266,
+ SCAN_FLOAT64 = 267,
+ SCAN_GRID = 268,
+ SCAN_INT16 = 269,
+ SCAN_INT32 = 270,
+ SCAN_MAPS = 271,
+ SCAN_MESSAGE = 272,
+ SCAN_SEQUENCE = 273,
+ SCAN_STRING = 274,
+ SCAN_STRUCTURE = 275,
+ SCAN_UINT16 = 276,
+ SCAN_UINT32 = 277,
+ SCAN_URL = 278,
+ SCAN_PTYPE = 279,
+ SCAN_PROG = 280,
+ WORD_WORD = 281,
+ WORD_STRING = 282
+ };
#endif
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-/* Copy the second part of user declarations. */
+int dapparse (DAPparsestate* parsestate);
+
+#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */
-/* Line 343 of yacc.c */
-#line 156 "dap.tab.c"
+/* Copy the second part of user declarations. */
+
+#line 157 "dap.tab.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -166,11 +167,8 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -190,8 +188,7 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -205,38 +202,67 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
-# define YY_(msgid) msgid
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YYUSE(E) ((void) (E))
#else
-# define YYUSE(e) /* empty */
+# define YYUSE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
@@ -255,9 +281,9 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
@@ -267,8 +293,8 @@ YYID (yyi)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -284,7 +310,7 @@ YYID (yyi)
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -292,15 +318,13 @@ YYID (yyi)
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -310,7 +334,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -335,35 +359,35 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO. The source and destination do
+/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -379,17 +403,19 @@ union yyalloc
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
#define YYNRULES 106
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 201
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 282
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -424,62 +450,7 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 6, 10, 13, 16, 18, 20, 22,
- 24, 30, 31, 34, 39, 47, 54, 66, 68, 70,
- 72, 74, 76, 78, 80, 82, 84, 86, 87, 90,
- 94, 99, 105, 107, 109, 111, 113, 117, 119, 120,
- 123, 126, 131, 136, 141, 146, 151, 156, 161, 166,
- 171, 176, 178, 180, 184, 186, 190, 192, 196, 198,
- 202, 204, 208, 210, 214, 216, 220, 222, 226, 228,
- 232, 234, 236, 238, 242, 250, 251, 256, 257, 262,
- 263, 268, 269, 274, 276, 278, 280, 282, 284, 286,
- 288, 290, 292, 294, 296, 298, 300, 302, 304, 306,
- 308, 310, 312, 314, 316, 318, 320
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 37, 0, -1, 38, 41, -1, 38, 41, 9, -1,
- 39, 49, -1, 40, 64, -1, 1, -1, 8, -1,
- 5, -1, 10, -1, 28, 42, 29, 47, 30, -1,
- -1, 42, 43, -1, 44, 48, 45, 30, -1, 20,
- 28, 42, 29, 48, 45, 30, -1, 18, 28, 42,
- 29, 48, 30, -1, 13, 28, 4, 31, 43, 16,
- 31, 42, 29, 48, 30, -1, 1, -1, 6, -1,
- 14, -1, 21, -1, 15, -1, 22, -1, 11, -1,
- 12, -1, 23, -1, 19, -1, -1, 45, 46, -1,
- 32, 26, 33, -1, 32, 34, 26, 33, -1, 32,
- 69, 34, 26, 33, -1, 1, -1, 48, -1, 1,
- -1, 69, -1, 28, 50, 29, -1, 1, -1, -1,
- 50, 51, -1, 63, 30, -1, 6, 69, 52, 30,
- -1, 14, 69, 53, 30, -1, 21, 69, 54, 30,
- -1, 15, 69, 55, 30, -1, 22, 69, 56, 30,
- -1, 11, 69, 57, 30, -1, 12, 69, 58, 30,
- -1, 19, 69, 59, 30, -1, 23, 69, 60, 30,
- -1, 69, 28, 50, 29, -1, 1, -1, 26, -1,
- 52, 35, 26, -1, 26, -1, 53, 35, 26, -1,
- 26, -1, 54, 35, 26, -1, 26, -1, 55, 35,
- 26, -1, 26, -1, 56, 35, 26, -1, 26, -1,
- 57, 35, 26, -1, 26, -1, 58, 35, 26, -1,
- 62, -1, 59, 35, 62, -1, 61, -1, 60, 35,
- 61, -1, 62, -1, 69, -1, 27, -1, 3, 26,
- 26, -1, 28, 65, 66, 67, 68, 29, 30, -1,
- -1, 7, 34, 26, 30, -1, -1, 17, 34, 26,
- 30, -1, -1, 24, 34, 26, 30, -1, -1, 25,
- 34, 26, 30, -1, 26, -1, 3, -1, 4, -1,
- 5, -1, 6, -1, 8, -1, 9, -1, 10, -1,
- 11, -1, 12, -1, 13, -1, 14, -1, 15, -1,
- 16, -1, 18, -1, 19, -1, 20, -1, 21, -1,
- 22, -1, 23, -1, 7, -1, 17, -1, 25, -1,
- 24, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 54, 54, 55, 56, 57, 58, 62, 66, 70,
@@ -496,7 +467,7 @@ static const yytype_uint16 yyrline[] =
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+#if YYDEBUG || YYERROR_VERBOSE || 1
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@@ -512,13 +483,13 @@ static const char *const yytname[] =
"array_decl", "datasetname", "var_name", "attributebody", "attr_list",
"attribute", "bytes", "int16", "uint16", "int32", "uint32", "float32",
"float64", "strs", "urls", "url", "str_or_id", "alias", "errorbody",
- "errorcode", "errormsg", "errorptype", "errorprog", "name", 0
+ "errorcode", "errormsg", "errorptype", "errorprog", "name", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -528,41 +499,46 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 36, 37, 37, 37, 37, 37, 38, 39, 40,
- 41, 42, 42, 43, 43, 43, 43, 43, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 45, 45, 46,
- 46, 46, 46, 47, 47, 48, 49, 49, 50, 50,
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 52, 52, 53, 53, 54, 54, 55, 55,
- 56, 56, 57, 57, 58, 58, 59, 59, 60, 60,
- 61, 62, 62, 63, 64, 65, 65, 66, 66, 67,
- 67, 68, 68, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69
-};
+#define YYPACT_NINF -91
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-91)))
+
+#define YYTABLE_NINF -1
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] =
{
- 0, 2, 2, 3, 2, 2, 1, 1, 1, 1,
- 5, 0, 2, 4, 7, 6, 11, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0, 2, 3,
- 4, 5, 1, 1, 1, 1, 3, 1, 0, 2,
- 2, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 1, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 1, 1, 3, 7, 0, 4, 0, 4, 0,
- 4, 0, 4, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1
+ 6, -91, -91, -91, -91, 9, -22, 7, -16, -91,
+ -91, 10, -91, -91, -91, 20, -91, 37, -91, 191,
+ -6, 14, -91, -91, -91, -91, 17, -91, -91, 18,
+ -91, 19, -91, -91, -91, 271, -91, 320, -91, 27,
+ -91, -91, 320, -91, -91, -91, -91, 320, 320, -91,
+ 320, 320, -91, -91, -91, 320, -91, 320, 320, 320,
+ -91, -91, -91, -91, -91, 24, 43, 35, 39, 50,
+ 74, -91, -91, -91, -91, -91, -91, -91, -91, -91,
+ -91, -91, -91, -91, 55, -91, -91, -91, 60, 67,
+ 68, 70, 71, 73, 295, 77, 78, 295, -91, -91,
+ 65, 79, 66, 80, 76, 69, 127, -91, 4, -91,
+ -91, -20, -91, -13, -91, -12, -91, -10, -91, -9,
+ -91, 32, -91, -91, -91, 33, -91, 34, 42, -91,
+ -91, 218, -91, 81, 82, 75, 83, 346, 320, 320,
+ -91, -91, 159, -91, -91, 84, -91, 88, -91, 89,
+ -91, 90, -91, 91, -91, 295, -91, 92, -91, 93,
+ -91, 295, -91, -91, 95, 94, 96, 105, 97, -91,
+ 98, 103, 100, -91, -91, -91, -91, -91, -91, -91,
+ -91, -91, -91, 102, -91, 99, -91, 12, -91, 111,
+ 109, -91, -91, -91, -91, 118, 244, -91, 320, 106,
+ -91
};
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint8 yydefact[] =
{
0, 6, 8, 7, 9, 0, 0, 0, 0, 1,
@@ -588,44 +564,7 @@ static const yytype_uint8 yydefact[] =
16
};
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 5, 6, 7, 8, 11, 17, 36, 37, 108,
- 143, 84, 85, 14, 19, 64, 111, 117, 125, 119,
- 127, 113, 115, 121, 128, 129, 130, 65, 16, 21,
- 69, 103, 136, 86
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -91
-static const yytype_int16 yypact[] =
-{
- 6, -91, -91, -91, -91, 9, -22, 7, -16, -91,
- -91, 10, -91, -91, -91, 20, -91, 37, -91, 191,
- -6, 14, -91, -91, -91, -91, 17, -91, -91, 18,
- -91, 19, -91, -91, -91, 271, -91, 320, -91, 27,
- -91, -91, 320, -91, -91, -91, -91, 320, 320, -91,
- 320, 320, -91, -91, -91, 320, -91, 320, 320, 320,
- -91, -91, -91, -91, -91, 24, 43, 35, 39, 50,
- 74, -91, -91, -91, -91, -91, -91, -91, -91, -91,
- -91, -91, -91, -91, 55, -91, -91, -91, 60, 67,
- 68, 70, 71, 73, 295, 77, 78, 295, -91, -91,
- 65, 79, 66, 81, 76, 69, 127, -91, 4, -91,
- -91, -20, -91, -13, -91, -12, -91, -10, -91, -9,
- -91, 32, -91, -91, -91, 33, -91, 34, 42, -91,
- -91, 218, -91, 80, 82, 75, 83, 346, 320, 320,
- -91, -91, 159, -91, -91, 85, -91, 88, -91, 89,
- -91, 90, -91, 91, -91, 295, -91, 92, -91, 93,
- -91, 295, -91, -91, 95, 94, 96, 105, 97, -91,
- 98, 103, 100, -91, -91, -91, -91, -91, -91, -91,
- -91, -91, -91, 102, -91, 99, -91, 12, -91, 111,
- 109, -91, -91, -91, -91, 118, 244, -91, 320, 106,
- -91
-};
-
-/* YYPGOTO[NTERM-NUM]. */
+ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-91, -91, -91, -91, -91, -91, -69, -15, -91, -17,
@@ -634,10 +573,18 @@ static const yytype_int8 yypgoto[] =
-91, -91, -91, -18
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
+{
+ -1, 5, 6, 7, 8, 11, 17, 36, 37, 108,
+ 143, 84, 85, 14, 19, 64, 111, 117, 125, 119,
+ 127, 113, 115, 121, 128, 129, 130, 65, 16, 21,
+ 69, 103, 136, 86
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
87, 66, 105, 106, 122, 140, 10, 1, 12, 9,
@@ -650,8 +597,8 @@ static const yytype_uint8 yytable[] =
22, 99, 160, 101, 102, 23, 123, 161, 104, 123,
24, 25, 26, 27, 28, 107, 109, 29, 30, 31,
32, 33, 34, 110, 112, 132, 114, 116, 138, 118,
- 134, 168, 169, 124, 126, 133, 135, 137, 164, 165,
- 163, 173, 166, 66, 174, 175, 176, 177, 179, 180,
+ 134, 168, 169, 124, 126, 135, 133, 137, 164, 165,
+ 173, 163, 166, 66, 174, 175, 176, 177, 179, 180,
183, 185, 167, 196, 172, 182, 184, 186, 22, 189,
192, 188, 191, 23, 190, 195, 200, 123, 24, 25,
26, 27, 28, 123, 194, 29, 30, 31, 32, 33,
@@ -679,12 +626,6 @@ static const yytype_uint8 yytable[] =
27, 28, 0, 0, 29, 30, 31, 32, 33, 34
};
-#define yypact_value_is_default(yystate) \
- ((yystate) == (-91))
-
-#define yytable_value_is_error(yytable_value) \
- YYID (0)
-
static const yytype_int16 yycheck[] =
{
37, 19, 71, 72, 94, 1, 28, 1, 1, 0,
@@ -697,8 +638,8 @@ static const yytype_int16 yycheck[] =
1, 28, 30, 34, 24, 6, 94, 35, 4, 97,
11, 12, 13, 14, 15, 30, 26, 18, 19, 20,
21, 22, 23, 26, 26, 30, 26, 26, 29, 26,
- 34, 138, 139, 26, 26, 26, 25, 31, 26, 34,
- 30, 26, 29, 131, 26, 26, 26, 26, 26, 26,
+ 34, 138, 139, 26, 26, 25, 27, 31, 26, 34,
+ 26, 30, 29, 131, 26, 26, 26, 26, 26, 26,
26, 16, 137, 192, 142, 30, 30, 30, 1, 26,
31, 33, 30, 6, 34, 26, 30, 155, 11, 12,
13, 14, 15, 161, 33, 18, 19, 20, 21, 22,
@@ -726,8 +667,8 @@ static const yytype_int16 yycheck[] =
14, 15, -1, -1, 18, 19, 20, 21, 22, 23
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 1, 5, 8, 10, 37, 38, 39, 40, 0,
@@ -743,7 +684,7 @@ static const yytype_uint8 yystos[] =
26, 34, 24, 67, 4, 42, 42, 30, 45, 26,
26, 52, 26, 57, 26, 58, 26, 53, 26, 55,
27, 59, 62, 69, 26, 54, 26, 56, 60, 61,
- 62, 50, 30, 26, 34, 25, 68, 31, 29, 29,
+ 62, 50, 30, 27, 34, 25, 68, 31, 29, 29,
1, 30, 32, 46, 30, 35, 30, 35, 30, 35,
30, 35, 30, 35, 30, 35, 30, 35, 30, 35,
30, 35, 29, 30, 26, 34, 29, 43, 48, 48,
@@ -753,94 +694,73 @@ static const yytype_uint8 yystos[] =
30
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 36, 37, 37, 37, 37, 37, 38, 39, 40,
+ 41, 42, 42, 43, 43, 43, 43, 43, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 45, 45, 46,
+ 46, 46, 46, 47, 47, 48, 49, 49, 50, 50,
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+ 51, 51, 52, 52, 53, 53, 54, 54, 55, 55,
+ 56, 56, 57, 57, 58, 58, 59, 59, 60, 60,
+ 61, 62, 62, 63, 64, 65, 65, 66, 66, 67,
+ 67, 68, 68, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69
+};
-#define YYRECOVERING() (!!yyerrstatus)
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 2, 3, 2, 2, 1, 1, 1, 1,
+ 5, 0, 2, 4, 7, 6, 11, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 0, 2, 3,
+ 4, 5, 1, 1, 1, 1, 3, 1, 0, 2,
+ 2, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 1, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 1, 1, 3, 7, 0, 4, 0, 4, 0,
+ 4, 0, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1
+};
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (parsestate, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
-/* This macro is provided for backward compatibility. */
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (parsestate, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, parsestate)
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -850,56 +770,47 @@ while (YYID (0))
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, parsestate); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, parsestate); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- DAPparsestate* parsestate;
-#endif
{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+ YYUSE (parsestate);
if (!yyvaluep)
return;
- YYUSE (parsestate);
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -907,23 +818,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate)
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, parsestate)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- DAPparsestate* parsestate;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate);
YYFPRINTF (yyoutput, ")");
@@ -934,16 +833,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, parsestate)
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -954,50 +845,42 @@ yy_stack_print (yybottom, yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, DAPparsestate* parsestate)
-#else
static void
-yy_reduce_print (yyvsp, yyrule, parsestate)
- YYSTYPE *yyvsp;
- int yyrule;
- DAPparsestate* parsestate;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, DAPparsestate* parsestate)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , parsestate);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , parsestate);
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule, parsestate); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule, parsestate); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1011,7 +894,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1034,15 +917,8 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1058,16 +934,8 @@ yystrlen (yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1097,27 +965,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1140,12 +1008,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = 0;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1153,10 +1020,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1205,11 +1068,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
}
}
}
@@ -1229,10 +1094,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
- yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
if (*yymsg_alloc < yysize)
{
@@ -1269,83 +1136,39 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, DAPparsestate* parsestate)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, parsestate)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- DAPparsestate* parsestate;
-#endif
{
YYUSE (yyvaluep);
YYUSE (parsestate);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (DAPparsestate* parsestate);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
/*----------.
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (DAPparsestate* parsestate)
-#else
-int
-yyparse (parsestate)
- DAPparsestate* parsestate;
-#endif
-#endif
{
/* The lookahead symbol. */
int yychar;
+
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
@@ -1355,10 +1178,10 @@ YYSTYPE yylval;
int yyerrstatus;
/* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
- Refer to the stacks thru separate pointers, to allow yyoverflow
+ Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
@@ -1376,7 +1199,7 @@ YYSTYPE yylval;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- int yytoken;
+ int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -1394,9 +1217,8 @@ YYSTYPE yylval;
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yytoken = 0;
- yyss = yyssa;
- yyvs = yyvsa;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1405,14 +1227,6 @@ YYSTYPE yylval;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
-
goto yysetstate;
/*------------------------------------------------------------.
@@ -1433,23 +1247,23 @@ YYSTYPE yylval;
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1457,22 +1271,22 @@ YYSTYPE yylval;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1481,10 +1295,10 @@ YYSTYPE yylval;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1513,7 +1327,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex (&yylval, parsestate);
}
if (yychar <= YYEOF)
@@ -1553,7 +1367,9 @@ yybackup:
yychar = YYEMPTY;
yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
@@ -1576,7 +1392,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1590,716 +1406,613 @@ yyreduce:
switch (yyn)
{
case 6:
-
-/* Line 1806 of yacc.c */
-#line 58 "dap.y"
+#line 58 "dap.y" /* yacc.c:1646 */
{dap_unrecognizedresponse(parsestate); YYABORT;}
+#line 1412 "dap.tab.c" /* yacc.c:1646 */
break;
case 7:
-
-/* Line 1806 of yacc.c */
-#line 63 "dap.y"
+#line 63 "dap.y" /* yacc.c:1646 */
{dap_tagparse(parsestate,SCAN_DATASET);}
+#line 1418 "dap.tab.c" /* yacc.c:1646 */
break;
case 8:
-
-/* Line 1806 of yacc.c */
-#line 67 "dap.y"
+#line 67 "dap.y" /* yacc.c:1646 */
{dap_tagparse(parsestate,SCAN_ATTR);}
+#line 1424 "dap.tab.c" /* yacc.c:1646 */
break;
case 9:
-
-/* Line 1806 of yacc.c */
-#line 71 "dap.y"
+#line 71 "dap.y" /* yacc.c:1646 */
{dap_tagparse(parsestate,SCAN_ERROR);}
+#line 1430 "dap.tab.c" /* yacc.c:1646 */
break;
case 10:
-
-/* Line 1806 of yacc.c */
-#line 76 "dap.y"
- {dap_datasetbody(parsestate,(yyvsp[(4) - (5)]),(yyvsp[(2) - (5)]));}
+#line 76 "dap.y" /* yacc.c:1646 */
+ {dap_datasetbody(parsestate,(yyvsp[-1]),(yyvsp[-3]));}
+#line 1436 "dap.tab.c" /* yacc.c:1646 */
break;
case 11:
-
-/* Line 1806 of yacc.c */
-#line 81 "dap.y"
+#line 81 "dap.y" /* yacc.c:1646 */
{(yyval)=dap_declarations(parsestate,null,null);}
+#line 1442 "dap.tab.c" /* yacc.c:1646 */
break;
case 12:
-
-/* Line 1806 of yacc.c */
-#line 82 "dap.y"
- {(yyval)=dap_declarations(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));}
+#line 82 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_declarations(parsestate,(yyvsp[-1]),(yyvsp[0]));}
+#line 1448 "dap.tab.c" /* yacc.c:1646 */
break;
case 13:
-
-/* Line 1806 of yacc.c */
-#line 89 "dap.y"
- {(yyval)=dap_makebase(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(1) - (4)]),(yyvsp[(3) - (4)]));}
+#line 89 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_makebase(parsestate,(yyvsp[-2]),(yyvsp[-3]),(yyvsp[-1]));}
+#line 1454 "dap.tab.c" /* yacc.c:1646 */
break;
case 14:
-
-/* Line 1806 of yacc.c */
-#line 91 "dap.y"
- {if(((yyval)=dap_makestructure(parsestate,(yyvsp[(5) - (7)]),(yyvsp[(6) - (7)]),(yyvsp[(3) - (7)])))==null) {YYABORT;}}
+#line 91 "dap.y" /* yacc.c:1646 */
+ {if(((yyval)=dap_makestructure(parsestate,(yyvsp[-2]),(yyvsp[-1]),(yyvsp[-4])))==null) {YYABORT;}}
+#line 1460 "dap.tab.c" /* yacc.c:1646 */
break;
case 15:
-
-/* Line 1806 of yacc.c */
-#line 93 "dap.y"
- {if(((yyval)=dap_makesequence(parsestate,(yyvsp[(5) - (6)]),(yyvsp[(3) - (6)])))==null) {YYABORT;}}
+#line 93 "dap.y" /* yacc.c:1646 */
+ {if(((yyval)=dap_makesequence(parsestate,(yyvsp[-1]),(yyvsp[-3])))==null) {YYABORT;}}
+#line 1466 "dap.tab.c" /* yacc.c:1646 */
break;
case 16:
-
-/* Line 1806 of yacc.c */
-#line 96 "dap.y"
- {if(((yyval)=dap_makegrid(parsestate,(yyvsp[(10) - (11)]),(yyvsp[(5) - (11)]),(yyvsp[(8) - (11)])))==null) {YYABORT;}}
+#line 96 "dap.y" /* yacc.c:1646 */
+ {if(((yyval)=dap_makegrid(parsestate,(yyvsp[-1]),(yyvsp[-6]),(yyvsp[-3])))==null) {YYABORT;}}
+#line 1472 "dap.tab.c" /* yacc.c:1646 */
break;
case 17:
-
-/* Line 1806 of yacc.c */
-#line 98 "dap.y"
+#line 98 "dap.y" /* yacc.c:1646 */
{dapsemanticerror(parsestate,OC_EBADTYPE,"Unrecognized type"); YYABORT;}
+#line 1478 "dap.tab.c" /* yacc.c:1646 */
break;
case 18:
-
-/* Line 1806 of yacc.c */
-#line 103 "dap.y"
+#line 103 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_BYTE;}
+#line 1484 "dap.tab.c" /* yacc.c:1646 */
break;
case 19:
-
-/* Line 1806 of yacc.c */
-#line 104 "dap.y"
+#line 104 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_INT16;}
+#line 1490 "dap.tab.c" /* yacc.c:1646 */
break;
case 20:
-
-/* Line 1806 of yacc.c */
-#line 105 "dap.y"
+#line 105 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_UINT16;}
+#line 1496 "dap.tab.c" /* yacc.c:1646 */
break;
case 21:
-
-/* Line 1806 of yacc.c */
-#line 106 "dap.y"
+#line 106 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_INT32;}
+#line 1502 "dap.tab.c" /* yacc.c:1646 */
break;
case 22:
-
-/* Line 1806 of yacc.c */
-#line 107 "dap.y"
+#line 107 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_UINT32;}
+#line 1508 "dap.tab.c" /* yacc.c:1646 */
break;
case 23:
-
-/* Line 1806 of yacc.c */
-#line 108 "dap.y"
+#line 108 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_FLOAT32;}
+#line 1514 "dap.tab.c" /* yacc.c:1646 */
break;
case 24:
-
-/* Line 1806 of yacc.c */
-#line 109 "dap.y"
+#line 109 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_FLOAT64;}
+#line 1520 "dap.tab.c" /* yacc.c:1646 */
break;
case 25:
-
-/* Line 1806 of yacc.c */
-#line 110 "dap.y"
+#line 110 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_URL;}
+#line 1526 "dap.tab.c" /* yacc.c:1646 */
break;
case 26:
-
-/* Line 1806 of yacc.c */
-#line 111 "dap.y"
+#line 111 "dap.y" /* yacc.c:1646 */
{(yyval)=(Object)SCAN_STRING;}
+#line 1532 "dap.tab.c" /* yacc.c:1646 */
break;
case 27:
-
-/* Line 1806 of yacc.c */
-#line 115 "dap.y"
+#line 115 "dap.y" /* yacc.c:1646 */
{(yyval)=dap_arraydecls(parsestate,null,null);}
+#line 1538 "dap.tab.c" /* yacc.c:1646 */
break;
case 28:
-
-/* Line 1806 of yacc.c */
-#line 116 "dap.y"
- {(yyval)=dap_arraydecls(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));}
+#line 116 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_arraydecls(parsestate,(yyvsp[-1]),(yyvsp[0]));}
+#line 1544 "dap.tab.c" /* yacc.c:1646 */
break;
case 29:
-
-/* Line 1806 of yacc.c */
-#line 120 "dap.y"
- {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[(2) - (3)]));}
+#line 120 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));}
+#line 1550 "dap.tab.c" /* yacc.c:1646 */
break;
case 30:
-
-/* Line 1806 of yacc.c */
-#line 121 "dap.y"
- {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[(3) - (4)]));}
+#line 121 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));}
+#line 1556 "dap.tab.c" /* yacc.c:1646 */
break;
case 31:
-
-/* Line 1806 of yacc.c */
-#line 122 "dap.y"
- {(yyval)=dap_arraydecl(parsestate,(yyvsp[(2) - (5)]),(yyvsp[(4) - (5)]));}
+#line 122 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_arraydecl(parsestate,(yyvsp[-3]),(yyvsp[-1]));}
+#line 1562 "dap.tab.c" /* yacc.c:1646 */
break;
case 32:
-
-/* Line 1806 of yacc.c */
-#line 124 "dap.y"
+#line 124 "dap.y" /* yacc.c:1646 */
{dapsemanticerror(parsestate,OC_EDIMSIZE,"Illegal dimension declaration"); YYABORT;}
+#line 1568 "dap.tab.c" /* yacc.c:1646 */
break;
case 33:
-
-/* Line 1806 of yacc.c */
-#line 128 "dap.y"
- {(yyval)=(yyvsp[(1) - (1)]);}
+#line 128 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[0]);}
+#line 1574 "dap.tab.c" /* yacc.c:1646 */
break;
case 34:
-
-/* Line 1806 of yacc.c */
-#line 130 "dap.y"
+#line 130 "dap.y" /* yacc.c:1646 */
{dapsemanticerror(parsestate,OC_EDDS,"Illegal dataset declaration"); YYABORT;}
+#line 1580 "dap.tab.c" /* yacc.c:1646 */
break;
case 35:
-
-/* Line 1806 of yacc.c */
-#line 133 "dap.y"
- {(yyval)=(yyvsp[(1) - (1)]);}
+#line 133 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[0]);}
+#line 1586 "dap.tab.c" /* yacc.c:1646 */
break;
case 36:
-
-/* Line 1806 of yacc.c */
-#line 136 "dap.y"
- {dap_attributebody(parsestate,(yyvsp[(2) - (3)]));}
+#line 136 "dap.y" /* yacc.c:1646 */
+ {dap_attributebody(parsestate,(yyvsp[-1]));}
+#line 1592 "dap.tab.c" /* yacc.c:1646 */
break;
case 37:
-
-/* Line 1806 of yacc.c */
-#line 138 "dap.y"
+#line 138 "dap.y" /* yacc.c:1646 */
{dapsemanticerror(parsestate,OC_EDAS,"Illegal DAS body"); YYABORT;}
+#line 1598 "dap.tab.c" /* yacc.c:1646 */
break;
case 38:
-
-/* Line 1806 of yacc.c */
-#line 142 "dap.y"
+#line 142 "dap.y" /* yacc.c:1646 */
{(yyval)=dap_attrlist(parsestate,null,null);}
+#line 1604 "dap.tab.c" /* yacc.c:1646 */
break;
case 39:
-
-/* Line 1806 of yacc.c */
-#line 143 "dap.y"
- {(yyval)=dap_attrlist(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));}
+#line 143 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrlist(parsestate,(yyvsp[-1]),(yyvsp[0]));}
+#line 1610 "dap.tab.c" /* yacc.c:1646 */
break;
case 40:
-
-/* Line 1806 of yacc.c */
-#line 147 "dap.y"
+#line 147 "dap.y" /* yacc.c:1646 */
{(yyval)=null;}
+#line 1616 "dap.tab.c" /* yacc.c:1646 */
break;
case 41:
-
-/* Line 1806 of yacc.c */
-#line 149 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_BYTE);}
+#line 149 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_BYTE);}
+#line 1622 "dap.tab.c" /* yacc.c:1646 */
break;
case 42:
-
-/* Line 1806 of yacc.c */
-#line 151 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_INT16);}
+#line 151 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT16);}
+#line 1628 "dap.tab.c" /* yacc.c:1646 */
break;
case 43:
-
-/* Line 1806 of yacc.c */
-#line 153 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_UINT16);}
+#line 153 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT16);}
+#line 1634 "dap.tab.c" /* yacc.c:1646 */
break;
case 44:
-
-/* Line 1806 of yacc.c */
-#line 155 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_INT32);}
+#line 155 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT32);}
+#line 1640 "dap.tab.c" /* yacc.c:1646 */
break;
case 45:
-
-/* Line 1806 of yacc.c */
-#line 157 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_UINT32);}
+#line 157 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT32);}
+#line 1646 "dap.tab.c" /* yacc.c:1646 */
break;
case 46:
-
-/* Line 1806 of yacc.c */
-#line 159 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_FLOAT32);}
+#line 159 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT32);}
+#line 1652 "dap.tab.c" /* yacc.c:1646 */
break;
case 47:
-
-/* Line 1806 of yacc.c */
-#line 161 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_FLOAT64);}
+#line 161 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT64);}
+#line 1658 "dap.tab.c" /* yacc.c:1646 */
break;
case 48:
-
-/* Line 1806 of yacc.c */
-#line 163 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_STRING);}
+#line 163 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_STRING);}
+#line 1664 "dap.tab.c" /* yacc.c:1646 */
break;
case 49:
-
-/* Line 1806 of yacc.c */
-#line 165 "dap.y"
- {(yyval)=dap_attribute(parsestate,(yyvsp[(2) - (4)]),(yyvsp[(3) - (4)]),(Object)SCAN_URL);}
+#line 165 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_URL);}
+#line 1670 "dap.tab.c" /* yacc.c:1646 */
break;
case 50:
-
-/* Line 1806 of yacc.c */
-#line 166 "dap.y"
- {(yyval)=dap_attrset(parsestate,(yyvsp[(1) - (4)]),(yyvsp[(3) - (4)]));}
+#line 166 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrset(parsestate,(yyvsp[-3]),(yyvsp[-1]));}
+#line 1676 "dap.tab.c" /* yacc.c:1646 */
break;
case 51:
-
-/* Line 1806 of yacc.c */
-#line 168 "dap.y"
+#line 168 "dap.y" /* yacc.c:1646 */
{dapsemanticerror(parsestate,OC_EDAS,"Illegal attribute"); YYABORT;}
+#line 1682 "dap.tab.c" /* yacc.c:1646 */
break;
case 52:
-
-/* Line 1806 of yacc.c */
-#line 172 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_BYTE);}
+#line 172 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_BYTE);}
+#line 1688 "dap.tab.c" /* yacc.c:1646 */
break;
case 53:
-
-/* Line 1806 of yacc.c */
-#line 174 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_BYTE);}
+#line 174 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_BYTE);}
+#line 1694 "dap.tab.c" /* yacc.c:1646 */
break;
case 54:
-
-/* Line 1806 of yacc.c */
-#line 177 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_INT16);}
+#line 177 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT16);}
+#line 1700 "dap.tab.c" /* yacc.c:1646 */
break;
case 55:
-
-/* Line 1806 of yacc.c */
-#line 179 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_INT16);}
+#line 179 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT16);}
+#line 1706 "dap.tab.c" /* yacc.c:1646 */
break;
case 56:
-
-/* Line 1806 of yacc.c */
-#line 182 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_UINT16);}
+#line 182 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT16);}
+#line 1712 "dap.tab.c" /* yacc.c:1646 */
break;
case 57:
-
-/* Line 1806 of yacc.c */
-#line 184 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_UINT16);}
+#line 184 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT16);}
+#line 1718 "dap.tab.c" /* yacc.c:1646 */
break;
case 58:
-
-/* Line 1806 of yacc.c */
-#line 187 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_INT32);}
+#line 187 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT32);}
+#line 1724 "dap.tab.c" /* yacc.c:1646 */
break;
case 59:
-
-/* Line 1806 of yacc.c */
-#line 189 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_INT32);}
+#line 189 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT32);}
+#line 1730 "dap.tab.c" /* yacc.c:1646 */
break;
case 60:
-
-/* Line 1806 of yacc.c */
-#line 192 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_UINT32);}
+#line 192 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT32);}
+#line 1736 "dap.tab.c" /* yacc.c:1646 */
break;
case 61:
-
-/* Line 1806 of yacc.c */
-#line 193 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_UINT32);}
+#line 193 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT32);}
+#line 1742 "dap.tab.c" /* yacc.c:1646 */
break;
case 62:
-
-/* Line 1806 of yacc.c */
-#line 196 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_FLOAT32);}
+#line 196 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT32);}
+#line 1748 "dap.tab.c" /* yacc.c:1646 */
break;
case 63:
-
-/* Line 1806 of yacc.c */
-#line 197 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_FLOAT32);}
+#line 197 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT32);}
+#line 1754 "dap.tab.c" /* yacc.c:1646 */
break;
case 64:
-
-/* Line 1806 of yacc.c */
-#line 200 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_FLOAT64);}
+#line 200 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT64);}
+#line 1760 "dap.tab.c" /* yacc.c:1646 */
break;
case 65:
-
-/* Line 1806 of yacc.c */
-#line 201 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_FLOAT64);}
+#line 201 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT64);}
+#line 1766 "dap.tab.c" /* yacc.c:1646 */
break;
case 66:
-
-/* Line 1806 of yacc.c */
-#line 204 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_STRING);}
+#line 204 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_STRING);}
+#line 1772 "dap.tab.c" /* yacc.c:1646 */
break;
case 67:
-
-/* Line 1806 of yacc.c */
-#line 205 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_STRING);}
+#line 205 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_STRING);}
+#line 1778 "dap.tab.c" /* yacc.c:1646 */
break;
case 68:
-
-/* Line 1806 of yacc.c */
-#line 209 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[(1) - (1)]),(Object)SCAN_URL);}
+#line 209 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_URL);}
+#line 1784 "dap.tab.c" /* yacc.c:1646 */
break;
case 69:
-
-/* Line 1806 of yacc.c */
-#line 210 "dap.y"
- {(yyval)=dap_attrvalue(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]),(Object)SCAN_URL);}
+#line 210 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_URL);}
+#line 1790 "dap.tab.c" /* yacc.c:1646 */
break;
case 70:
-
-/* Line 1806 of yacc.c */
-#line 214 "dap.y"
- {(yyval)=(yyvsp[(1) - (1)]);}
+#line 214 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[0]);}
+#line 1796 "dap.tab.c" /* yacc.c:1646 */
break;
case 71:
-
-/* Line 1806 of yacc.c */
-#line 218 "dap.y"
- {(yyval)=(yyvsp[(1) - (1)]);}
+#line 218 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[0]);}
+#line 1802 "dap.tab.c" /* yacc.c:1646 */
break;
case 72:
-
-/* Line 1806 of yacc.c */
-#line 219 "dap.y"
- {(yyval)=(yyvsp[(1) - (1)]);}
+#line 219 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[0]);}
+#line 1808 "dap.tab.c" /* yacc.c:1646 */
break;
case 73:
-
-/* Line 1806 of yacc.c */
-#line 230 "dap.y"
- {(yyval)=(yyvsp[(2) - (3)]); (yyval)=(yyvsp[(3) - (3)]); (yyval)=null;}
+#line 230 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[-1]); (yyval)=(yyvsp[0]); (yyval)=null;}
+#line 1814 "dap.tab.c" /* yacc.c:1646 */
break;
case 74:
-
-/* Line 1806 of yacc.c */
-#line 235 "dap.y"
- {dap_errorbody(parsestate,(yyvsp[(2) - (7)]),(yyvsp[(3) - (7)]),(yyvsp[(4) - (7)]),(yyvsp[(5) - (7)]));}
+#line 235 "dap.y" /* yacc.c:1646 */
+ {dap_errorbody(parsestate,(yyvsp[-5]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[-2]));}
+#line 1820 "dap.tab.c" /* yacc.c:1646 */
break;
case 75:
-
-/* Line 1806 of yacc.c */
-#line 238 "dap.y"
+#line 238 "dap.y" /* yacc.c:1646 */
{(yyval)=null;}
+#line 1826 "dap.tab.c" /* yacc.c:1646 */
break;
case 76:
-
-/* Line 1806 of yacc.c */
-#line 238 "dap.y"
- {(yyval)=(yyvsp[(3) - (4)]);}
+#line 238 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[-1]);}
+#line 1832 "dap.tab.c" /* yacc.c:1646 */
break;
case 77:
-
-/* Line 1806 of yacc.c */
-#line 239 "dap.y"
+#line 239 "dap.y" /* yacc.c:1646 */
{(yyval)=null;}
+#line 1838 "dap.tab.c" /* yacc.c:1646 */
break;
case 78:
-
-/* Line 1806 of yacc.c */
-#line 239 "dap.y"
- {(yyval)=(yyvsp[(3) - (4)]);}
+#line 239 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[-1]);}
+#line 1844 "dap.tab.c" /* yacc.c:1646 */
break;
case 79:
-
-/* Line 1806 of yacc.c */
-#line 240 "dap.y"
+#line 240 "dap.y" /* yacc.c:1646 */
{(yyval)=null;}
+#line 1850 "dap.tab.c" /* yacc.c:1646 */
break;
case 80:
-
-/* Line 1806 of yacc.c */
-#line 240 "dap.y"
- {(yyval)=(yyvsp[(3) - (4)]);}
+#line 240 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[-1]);}
+#line 1856 "dap.tab.c" /* yacc.c:1646 */
break;
case 81:
-
-/* Line 1806 of yacc.c */
-#line 241 "dap.y"
+#line 241 "dap.y" /* yacc.c:1646 */
{(yyval)=null;}
+#line 1862 "dap.tab.c" /* yacc.c:1646 */
break;
case 82:
-
-/* Line 1806 of yacc.c */
-#line 241 "dap.y"
- {(yyval)=(yyvsp[(3) - (4)]);}
+#line 241 "dap.y" /* yacc.c:1646 */
+ {(yyval)=(yyvsp[-1]);}
+#line 1868 "dap.tab.c" /* yacc.c:1646 */
break;
case 83:
-
-/* Line 1806 of yacc.c */
-#line 247 "dap.y"
- {(yyval)=dapdecode(parsestate->lexstate,(yyvsp[(1) - (1)]));}
+#line 247 "dap.y" /* yacc.c:1646 */
+ {(yyval)=dapdecode(parsestate->lexstate,(yyvsp[0]));}
+#line 1874 "dap.tab.c" /* yacc.c:1646 */
break;
case 84:
-
-/* Line 1806 of yacc.c */
-#line 248 "dap.y"
+#line 248 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("alias");}
+#line 1880 "dap.tab.c" /* yacc.c:1646 */
break;
case 85:
-
-/* Line 1806 of yacc.c */
-#line 249 "dap.y"
+#line 249 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("array");}
+#line 1886 "dap.tab.c" /* yacc.c:1646 */
break;
case 86:
-
-/* Line 1806 of yacc.c */
-#line 250 "dap.y"
+#line 250 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("attributes");}
+#line 1892 "dap.tab.c" /* yacc.c:1646 */
break;
case 87:
-
-/* Line 1806 of yacc.c */
-#line 251 "dap.y"
+#line 251 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("byte");}
+#line 1898 "dap.tab.c" /* yacc.c:1646 */
break;
case 88:
-
-/* Line 1806 of yacc.c */
-#line 252 "dap.y"
+#line 252 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("dataset");}
+#line 1904 "dap.tab.c" /* yacc.c:1646 */
break;
case 89:
-
-/* Line 1806 of yacc.c */
-#line 253 "dap.y"
+#line 253 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("data");}
+#line 1910 "dap.tab.c" /* yacc.c:1646 */
break;
case 90:
-
-/* Line 1806 of yacc.c */
-#line 254 "dap.y"
+#line 254 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("error");}
+#line 1916 "dap.tab.c" /* yacc.c:1646 */
break;
case 91:
-
-/* Line 1806 of yacc.c */
-#line 255 "dap.y"
+#line 255 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("float32");}
+#line 1922 "dap.tab.c" /* yacc.c:1646 */
break;
case 92:
-
-/* Line 1806 of yacc.c */
-#line 256 "dap.y"
+#line 256 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("float64");}
+#line 1928 "dap.tab.c" /* yacc.c:1646 */
break;
case 93:
-
-/* Line 1806 of yacc.c */
-#line 257 "dap.y"
+#line 257 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("grid");}
+#line 1934 "dap.tab.c" /* yacc.c:1646 */
break;
case 94:
-
-/* Line 1806 of yacc.c */
-#line 258 "dap.y"
+#line 258 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("int16");}
+#line 1940 "dap.tab.c" /* yacc.c:1646 */
break;
case 95:
-
-/* Line 1806 of yacc.c */
-#line 259 "dap.y"
+#line 259 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("int32");}
+#line 1946 "dap.tab.c" /* yacc.c:1646 */
break;
case 96:
-
-/* Line 1806 of yacc.c */
-#line 260 "dap.y"
+#line 260 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("maps");}
+#line 1952 "dap.tab.c" /* yacc.c:1646 */
break;
case 97:
-
-/* Line 1806 of yacc.c */
-#line 261 "dap.y"
+#line 261 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("sequence");}
+#line 1958 "dap.tab.c" /* yacc.c:1646 */
break;
case 98:
-
-/* Line 1806 of yacc.c */
-#line 262 "dap.y"
+#line 262 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("string");}
+#line 1964 "dap.tab.c" /* yacc.c:1646 */
break;
case 99:
-
-/* Line 1806 of yacc.c */
-#line 263 "dap.y"
+#line 263 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("structure");}
+#line 1970 "dap.tab.c" /* yacc.c:1646 */
break;
case 100:
-
-/* Line 1806 of yacc.c */
-#line 264 "dap.y"
+#line 264 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("uint16");}
+#line 1976 "dap.tab.c" /* yacc.c:1646 */
break;
case 101:
-
-/* Line 1806 of yacc.c */
-#line 265 "dap.y"
+#line 265 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("uint32");}
+#line 1982 "dap.tab.c" /* yacc.c:1646 */
break;
case 102:
-
-/* Line 1806 of yacc.c */
-#line 266 "dap.y"
+#line 266 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("url");}
+#line 1988 "dap.tab.c" /* yacc.c:1646 */
break;
case 103:
-
-/* Line 1806 of yacc.c */
-#line 267 "dap.y"
+#line 267 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("code");}
+#line 1994 "dap.tab.c" /* yacc.c:1646 */
break;
case 104:
-
-/* Line 1806 of yacc.c */
-#line 268 "dap.y"
+#line 268 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("message");}
+#line 2000 "dap.tab.c" /* yacc.c:1646 */
break;
case 105:
-
-/* Line 1806 of yacc.c */
-#line 269 "dap.y"
+#line 269 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("program");}
+#line 2006 "dap.tab.c" /* yacc.c:1646 */
break;
case 106:
-
-/* Line 1806 of yacc.c */
-#line 270 "dap.y"
+#line 270 "dap.y" /* yacc.c:1646 */
{(yyval)=strdup("program_type");}
+#line 2012 "dap.tab.c" /* yacc.c:1646 */
break;
-
-/* Line 1806 of yacc.c */
-#line 2303 "dap.tab.c"
+#line 2016 "dap.tab.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2321,7 +2034,7 @@ yyreduce:
*++yyvsp = yyval;
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -2336,9 +2049,9 @@ yyreduce:
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -2389,20 +2102,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, parsestate);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, parsestate);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -2421,7 +2134,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -2434,35 +2147,37 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, parsestate);
+ yystos[yystate], yyvsp, parsestate);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
@@ -2486,7 +2201,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -2505,14 +2220,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, parsestate);
}
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, parsestate);
+ yystos[*yyssp], yyvsp, parsestate);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -2523,13 +2238,7 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-
-/* Line 2067 of yacc.c */
-#line 273 "dap.y"
-
+#line 273 "dap.y" /* yacc.c:1906 */
diff --git a/oc2/dapy.h b/oc2/dapy.h
index e085df5..d11cfc9 100644
--- a/oc2/dapy.h
+++ b/oc2/dapy.h
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,54 +26,62 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+#ifndef YY_DAP_DAP_TAB_H_INCLUDED
+# define YY_DAP_DAP_TAB_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+#if YYDEBUG
+extern int dapdebug;
+#endif
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- SCAN_ALIAS = 258,
- SCAN_ARRAY = 259,
- SCAN_ATTR = 260,
- SCAN_BYTE = 261,
- SCAN_CODE = 262,
- SCAN_DATASET = 263,
- SCAN_DATA = 264,
- SCAN_ERROR = 265,
- SCAN_FLOAT32 = 266,
- SCAN_FLOAT64 = 267,
- SCAN_GRID = 268,
- SCAN_INT16 = 269,
- SCAN_INT32 = 270,
- SCAN_MAPS = 271,
- SCAN_MESSAGE = 272,
- SCAN_SEQUENCE = 273,
- SCAN_STRING = 274,
- SCAN_STRUCTURE = 275,
- SCAN_UINT16 = 276,
- SCAN_UINT32 = 277,
- SCAN_URL = 278,
- SCAN_PTYPE = 279,
- SCAN_PROG = 280,
- WORD_WORD = 281,
- WORD_STRING = 282
- };
+ enum yytokentype
+ {
+ SCAN_ALIAS = 258,
+ SCAN_ARRAY = 259,
+ SCAN_ATTR = 260,
+ SCAN_BYTE = 261,
+ SCAN_CODE = 262,
+ SCAN_DATASET = 263,
+ SCAN_DATA = 264,
+ SCAN_ERROR = 265,
+ SCAN_FLOAT32 = 266,
+ SCAN_FLOAT64 = 267,
+ SCAN_GRID = 268,
+ SCAN_INT16 = 269,
+ SCAN_INT32 = 270,
+ SCAN_MAPS = 271,
+ SCAN_MESSAGE = 272,
+ SCAN_SEQUENCE = 273,
+ SCAN_STRING = 274,
+ SCAN_STRUCTURE = 275,
+ SCAN_UINT16 = 276,
+ SCAN_UINT32 = 277,
+ SCAN_URL = 278,
+ SCAN_PTYPE = 279,
+ SCAN_PROG = 280,
+ WORD_WORD = 281,
+ WORD_STRING = 282
+ };
#endif
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+int dapparse (DAPparsestate* parsestate);
+#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */
diff --git a/oc2/ocrc.c b/oc2/ocrc.c
index 450a1a7..239c73b 100644
--- a/oc2/ocrc.c
+++ b/oc2/ocrc.c
@@ -338,7 +338,7 @@ ocrc_compile(const char* path)
*value = '\0';
value++;
}
- strncpy(ocrc->triples[ocrc->ntriples].key,key,MAXRCLINESIZE);
+ strncpy(ocrc->triples[ocrc->ntriples].key,key,MAXRCLINESIZE-1);
if(*value == '\0')
strcpy(ocrc->triples[ocrc->ntriples].value,"1");/*dfalt*/
else
@@ -718,14 +718,20 @@ rc_search(const char* prefix, const char* rcname, char** pathp)
oclog(OCLOGDBG, "Found rc file=%s",path);
done:
if(f == NULL || stat != OC_NOERR) {
- if(path != NULL)
+ if(path != NULL)
free(path);
- path = NULL;
+ path = NULL;
}
+
if(f != NULL)
- fclose(f);
+ fclose(f);
if(pathp != NULL)
- *pathp = path;
+ *pathp = path;
+ else {
+ free(path);
+ path = NULL;
+ }
+
return OCTHROW(stat);
}
--
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