[netcdf] 01/10: New upstream version 4.5.0~rc2

Bas Couwenberg sebastic at debian.org
Tue Aug 8 06:41:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository netcdf.

commit 4ab71a1140acaee947f0dd06e8ae670b95d3f3a6
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Tue Aug 8 07:46:11 2017 +0200

    New upstream version 4.5.0~rc2
---
 CMakeLists.txt                                     |     9 +-
 Makefile.in                                        |    23 +-
 RELEASE_NOTES.md                                   |     5 +
 aclocal.m4                                         |    46 +-
 cf                                                 |     4 +-
 cf.cmake                                           |    15 +-
 compile                                            |     9 +-
 config.guess                                       |   188 +-
 config.h.cmake.in                                  |     8 +
 config.h.in                                        |     3 +
 config.sub                                         |    73 +-
 configure                                          |    53 +-
 configure.ac                                       |    25 +-
 dap4_test/CMakeLists.txt                           |     1 -
 dap4_test/Makefile.am                              |     2 +
 dap4_test/Makefile.in                              |     6 +-
 dap4_test/baseline/CMakeLists.txt                  |     2 +-
 dap4_test/baseline/test_struct1.nc.d4d             |     1 -
 dap4_test/baseline/test_struct1.nc.d4m             |     1 -
 dap4_test/baseline/test_struct1.nc.d4p             |     5 +-
 dap4_test/baseline/test_struct_array.6.nc.d4d      |     1 -
 dap4_test/baseline/test_struct_array.6.nc.d4m      |     1 -
 dap4_test/baseline/test_struct_array.6.nc.d4p      |     2 -
 dap4_test/baseline/test_struct_array.nc.d4d        |     1 -
 dap4_test/baseline/test_struct_array.nc.d4m        |     1 -
 dap4_test/baseline/test_struct_array.nc.d4p        |     2 -
 dap4_test/baseline/test_struct_array.syn.d4d       |     2 +-
 dap4_test/baseline/test_struct_array.syn.d4m       |     2 +-
 dap4_test/baseline/test_struct_nested.nc.d4d       |     1 -
 dap4_test/baseline/test_struct_nested.nc.d4m       |     1 -
 dap4_test/baseline/test_struct_nested.nc.d4p       |     5 +-
 dap4_test/baseline/test_struct_type.nc.d4d         |     1 -
 dap4_test/baseline/test_struct_type.nc.d4m         |     1 -
 dap4_test/baseline/test_struct_type.nc.d4p         |     5 +-
 dap4_test/baselineraw/CMakeLists.txt               |     2 +-
 dap4_test/baselineraw/test_struct1.nc.dmp          |     1 -
 dap4_test/baselineraw/test_struct_array.6.nc.dmp   |     1 -
 dap4_test/baselineraw/test_struct_array.nc.dmp     |     1 -
 dap4_test/baselineraw/test_struct_nested.nc.dmp    |     1 -
 dap4_test/baselineraw/test_struct_type.nc.dmp      |     1 -
 dap4_test/baselineremote/CMakeLists.txt            |     2 +-
 dap4_test/cdltestfiles/CMakeLists.txt              |     2 +-
 dap4_test/daptestfiles/CMakeLists.txt              |     2 +-
 dap4_test/daptestfiles/test_atomic_array.nc.dap    |   Bin 2224 -> 2232 bytes
 dap4_test/daptestfiles/test_atomic_array.syn.dap   |   Bin 2214 -> 2222 bytes
 dap4_test/daptestfiles/test_atomic_types.nc.dap    |   Bin 1907 -> 1923 bytes
 dap4_test/daptestfiles/test_atomic_types.syn.dap   |   Bin 1888 -> 1904 bytes
 dap4_test/daptestfiles/test_enum.nc.dap            |   Bin 1228 -> 1236 bytes
 dap4_test/daptestfiles/test_enum_2.nc.dap          |   Bin 1286 -> 1294 bytes
 dap4_test/daptestfiles/test_enum_array.4.nc.dap    |   Bin 1371 -> 1379 bytes
 dap4_test/daptestfiles/test_enum_array.nc.dap      |   Bin 1302 -> 1310 bytes
 dap4_test/daptestfiles/test_struct1.nc.dap         |   Bin 551 -> 495 bytes
 dap4_test/daptestfiles/test_struct_array.6.nc.dap  |   Bin 734 -> 678 bytes
 dap4_test/daptestfiles/test_struct_array.nc.dap    |   Bin 772 -> 716 bytes
 dap4_test/daptestfiles/test_struct_nested.nc.dap   |   Bin 763 -> 693 bytes
 dap4_test/daptestfiles/test_struct_type.nc.dap     |   Bin 555 -> 499 bytes
 dap4_test/dmrtestfiles/CMakeLists.txt              |     2 +-
 dap4_test/dmrtestfiles/test_atomic_array.nc.dmr    |     2 +-
 dap4_test/dmrtestfiles/test_atomic_array.syn.dmr   |     2 +-
 dap4_test/dmrtestfiles/test_atomic_types.nc.dmr    |     4 +-
 dap4_test/dmrtestfiles/test_atomic_types.syn.dmr   |     4 +-
 dap4_test/dmrtestfiles/test_enum.nc.dmr            |     2 +-
 dap4_test/dmrtestfiles/test_enum_2.nc.dmr          |     2 +-
 dap4_test/dmrtestfiles/test_enum_array.4.nc.dmr    |     2 +-
 dap4_test/dmrtestfiles/test_enum_array.nc.dmr      |     2 +-
 dap4_test/dmrtestfiles/test_struct1.nc.dmr         |     2 -
 dap4_test/dmrtestfiles/test_struct_array.6.nc.dmr  |     2 -
 dap4_test/dmrtestfiles/test_struct_array.nc.dmr    |     2 -
 dap4_test/dmrtestfiles/test_struct_nested.nc.dmr   |     2 -
 dap4_test/dmrtestfiles/test_struct_type.nc.dmr     |     2 -
 dap4_test/nctestfiles/CMakeLists.txt               |     2 +-
 dap4_test/nctestfiles/test_atomic_array.nc         |   Bin 14523 -> 14523 bytes
 dap4_test/nctestfiles/test_atomic_types.nc         |   Bin 13136 -> 13136 bytes
 dap4_test/nctestfiles/test_unlim1.nc               |   Bin 10266 -> 10266 bytes
 dap4_test/test_data.sh                             |     2 +
 dap4_test/test_meta.sh                             |     4 +-
 dap4_test/test_parse.sh                            |     2 +
 dap4_test/test_raw.sh                              |     2 +
 dap4_test/test_remote.sh                           |     2 +
 depcomp                                            |     6 +-
 docs/Doxyfile.developer                            |     2 +-
 docs/Makefile.am                                   |     2 +-
 docs/Makefile.in                                   |     6 +-
 docs/images/Makefile.in                            |     4 +-
 docs/install.md                                    |     2 +-
 docs/software.md                                   |  2580 --
 docs/windows-binaries.md                           |    26 +-
 examples/C/Makefile.in                             |     4 +-
 examples/CDL/Makefile.in                           |     4 +-
 examples/Makefile.in                               |     4 +-
 h5_test/Makefile.in                                |     4 +-
 h5_test/run_par_tests.sh                           |     4 +-
 h5_test/tst_h_dimscales.c                          |    81 +-
 h5_test/tst_h_enums.c                              |    69 +-
 include/Makefile.in                                |     4 +-
 include/nc4internal.h                              |     3 +
 include/nctime.h                                   |     7 +-
 include/ncutf8.h                                   |    20 +-
 include/ncwinpath.h                                |     5 +-
 include/netcdf.h                                   |     3 -
 install-sh                                         |     4 +-
 libdap2/Makefile.in                                |     4 +-
 libdap2/dapattr.c                                  |    42 +-
 libdap2/dapcvt.c                                   |    11 +-
 libdap2/dapdebug.c                                 |     8 +-
 libdap2/dapdebug.h                                 |     8 +-
 libdap2/nccommon.h                                 |     9 +-
 libdap2/ncd2dispatch.c                             |    63 +-
 libdap4/Makefile.in                                |     4 +-
 libdap4/d4file.c                                   |   107 +-
 libdap4/d4read.c                                   |     8 +-
 libdap4/d4util.c                                   |     4 +-
 libdap4/ncd4types.h                                |    10 +-
 libdispatch/Makefile.in                            |     4 +-
 libdispatch/dfile.c                                |    41 +-
 libdispatch/dutf8.c                                |    80 +-
 libdispatch/dwinpath.c                             |    44 +-
 libdispatch/ncuri.c                                |     8 +-
 libdispatch/test_ncuri.c                           |     4 +-
 libdispatch/test_pathcvt.c                         |     1 -
 libdispatch/utf8proc.h                             |    25 +-
 liblib/Makefile.am                                 |     5 +
 liblib/Makefile.in                                 |    15 +-
 liblib/nc_initialize.c                             |    10 +
 libsrc/Makefile.am                                 |     2 +-
 libsrc/Makefile.in                                 |     6 +-
 libsrc/nc3internal.c                               |     6 +-
 libsrc/ncx.c                                       | 30610 ++++++++++---------
 libsrc/ncx.h                                       |     6 +-
 libsrc/ncx.m4                                      |     6 +-
 libsrc/posixio.c                                   |     8 +-
 libsrc4/Makefile.in                                |     4 +-
 libsrc4/nc4file.c                                  |    28 +-
 libsrc4/nc4info.c                                  |     8 +-
 libsrcp/Makefile.in                                |     4 +-
 libsrcp/ncpdispatch.c                              |    27 +-
 missing                                            |     6 +-
 nc-config.cmake.in                                 |    16 +-
 nc-config.in                                       |    16 +-
 nc_test/Makefile.in                                |     4 +-
 nc_test/large_files.c                              |    20 +-
 nc_test/test_get.c                                 | 12203 --------
 nc_test/test_put.c                                 | 13742 ---------
 nc_test/test_read.c                                |  1950 --
 nc_test/test_write.c                               |  2376 --
 nc_test/tst_utf8_phrases.c                         |     2 +-
 nc_test/tst_utf8_validate.c                        |   Bin 15275 -> 15275 bytes
 nc_test4/Makefile.in                               |     4 +-
 ncdap_test/CMakeLists.txt                          |     1 +
 ncdap_test/Makefile.am                             |    10 +-
 ncdap_test/Makefile.in                             |    21 +-
 ncdap_test/expected3/123.nc.dmp                    |     7 +-
 ncdap_test/expected3/123bears.nc.dmp               |     7 +-
 ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp |   291 +-
 ncdap_test/expected3/D1.dmp                        |     3 +
 ncdap_test/expected3/Drifters.dmp                  |     6 +
 ncdap_test/expected3/EOSDB.dmp                     |    17 +
 ncdap_test/expected3/Makefile.am                   |     2 +-
 ncdap_test/expected3/Makefile.in                   |     6 +-
 ncdap_test/expected3/OverideExample.dmp            |     9 +
 ncdap_test/expected3/SimpleDrdsExample.dmp         |     6 +
 ncdap_test/expected3/b31.dmp                       |     4 +
 ncdap_test/expected3/bears.nc.dmp                  |     9 +-
 ncdap_test/expected3/ber-2002-10-01.nc.dmp         |   373 +
 ncdap_test/expected3/in.nc.dmp                     |    11 +-
 ncdap_test/expected3/in1.nc.dmp                    |    11 +-
 ncdap_test/expected3/in_2.nc.dmp                   |    11 +-
 ncdap_test/expected3/in_no_three_double_dmn.nc.dmp |    11 +-
 ncdap_test/expected3/in_v.nc.dmp                   |     3 +-
 ncdap_test/expected3/kwcase.nc.dmp                 |    27 +
 ncdap_test/expected3/nestedDAS.dmp                 |    14 +
 ncdap_test/expected3/pbug0001b.dmp                 |     4 +-
 ncdap_test/expected3/synth1.dmp                    |     2 +-
 ncdap_test/expected3/synth4.dmp                    |     1 +
 ncdap_test/expected3/synth5.dmp                    |     3 +
 ncdap_test/expected3/synth6.dmp                    |    10 +
 ncdap_test/expected3/test.01.dmp                   |     6 +
 ncdap_test/expected3/test.21.dmp                   |     6 -
 ncdap_test/expected3/test.nc.dmp                   |     4 +-
 ncdap_test/expected3/text.nc.dmp                   |     4 +-
 ncdap_test/expectremote3/Makefile.in               |     4 +-
 ncdap_test/t_dap.c                                 |     1 +
 ncdap_test/t_dap3a.c                               |     1 +
 ncdap_test/test_cvt.c                              |     1 +
 ncdap_test/test_varm3.c                            |     1 +
 ncdap_test/testauth.sh                             |    12 +-
 ncdap_test/testdata3/Makefile.am                   |     1 +
 ncdap_test/testdata3/Makefile.in                   |     5 +-
 ncdap_test/testdata3/kwcase.nc.das                 |    21 +
 ncdap_test/testdata3/kwcase.nc.dds                 |     9 +
 ncdap_test/testdata3/kwcase.nc.dods                |   Bin 0 -> 435 bytes
 ncdap_test/tst_ber.sh                              |    19 +
 ncdap_test/tst_ncdap.sh                            |    33 +-
 ncdap_test/tst_ncdap3.sh                           |     4 +-
 ncdap_test/tst_ncdap_shared.sh                     |    12 +-
 ncdap_test/tst_remote.sh                           |    27 +-
 ncdump/Makefile.in                                 |     4 +-
 ncdump/cdl/Makefile.in                             |     4 +-
 ncdump/expected/Makefile.in                        |     4 +-
 ncgen/CMakeLists.txt                               |     2 +-
 ncgen/ConvertUTF.c                                 |   539 -
 ncgen/ConvertUTF.h                                 |   149 -
 ncgen/Makefile.am                                  |     2 +-
 ncgen/Makefile.in                                  |     9 +-
 ncgen/escapes.c                                    |    68 +-
 ncgen/includes.h                                   |     1 +
 ncgen/ncgenl.c                                     |   177 +-
 ncgen/ncgeny.c                                     |  2488 +-
 ncgen/ncgeny.h                                     |   216 +-
 ncgen3/Makefile.in                                 |     4 +-
 nctest/Makefile.in                                 |     4 +-
 oc2/Makefile.am                                    |     2 -
 oc2/Makefile.in                                    |     4 +-
 oc2/dap.y                                          |    48 +-
 oc2/dapy.c                                         |    46 +-
 oc2/oc.c                                           |    12 +-
 oc2/ocinternal.c                                   |    95 +-
 oc2/ocinternal.h                                   |     3 +-
 oc2/ocrc.c                                         |     7 +-
 oc2/ocread.c                                       |    11 +-
 oc2/ocutil.c                                       |     4 +-
 test-driver                                        |     6 +-
 test_common.in                                     |    22 +-
 223 files changed, 18693 insertions(+), 51266 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cc0f4d..16faacb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ set(PACKAGE "netCDF" CACHE STRING "")
 SET(NC_VERSION_MAJOR 4)
 SET(NC_VERSION_MINOR 5)
 SET(NC_VERSION_PATCH 0)
-SET(NC_VERSION_NOTE "-rc1")
+SET(NC_VERSION_NOTE "-rc2")
 SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
 SET(VERSION ${netCDF_VERSION})
 SET(NC_VERSION ${netCDF_VERSION})
@@ -955,9 +955,7 @@ IF(ENABLE_LARGE_FILE_SUPPORT)
     SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
     SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LARGEADDRESSAWARE")
   ELSE()
-    SET(_FILE_OFFSET_BITS 64)
-    SET(_LARGEFILE64_SOURCE TRUE)
-    SET(_LARGEFILE_SOURCE TRUE)
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64")
   ENDIF()
 ENDIF()
 
@@ -1234,6 +1232,8 @@ CHECK_INCLUDE_FILE("BaseTsd.h"  HAVE_BASETSD_H)
 CHECK_INCLUDE_FILE("stddef.h"   HAVE_STDDEF_H)
 CHECK_INCLUDE_FILE("memory.h"  HAVE_MEMORY_H)
 CHECK_INCLUDE_FILE("string.h"  HAVE_STRING_H)
+CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
+CHECK_INCLUDE_FILE("ftw.h"  HAVE_FTW_H)
 
 CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
 
@@ -1860,6 +1860,7 @@ SET(host_cpu "${cpu}")
 SET(host_vendor "${osname}")
 SET(host_os "${osrel}")
 SET(abs_top_builddir "${CMAKE_BINARY_DIR}")
+SET(abs_top_srcdir "${CMAKE_SOURCE_DIR}")
 
 SET(CC_VERSION "${CMAKE_C_COMPILER}")
 
diff --git a/Makefile.in b/Makefile.in
index 23a2687..8d1f09e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -122,8 +122,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = nc-config netcdf.pc libnetcdf.settings \
-	postinstall.sh
+CONFIG_CLEAN_FILES = test_common.sh nc-config netcdf.pc \
+	libnetcdf.settings postinstall.sh
 CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
@@ -217,8 +217,9 @@ DIST_SUBDIRS = include h5_test libdispatch libsrc libsrc4 libsrcp oc2 \
 	nc_test4 ncdap_test dap4_test docs examples
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(srcdir)/libnetcdf.settings.in $(srcdir)/nc-config.in \
-	$(srcdir)/netcdf.pc.in $(srcdir)/postinstall.sh.in compile \
-	config.guess config.sub install-sh ltmain.sh missing
+	$(srcdir)/netcdf.pc.in $(srcdir)/postinstall.sh.in \
+	$(srcdir)/test_common.in compile config.guess config.sub \
+	install-sh ltmain.sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -591,6 +592,8 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 
 distclean-hdr:
 	-rm -f config.h stamp-h1
+test_common.sh: $(top_builddir)/config.status $(srcdir)/test_common.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
 nc-config: $(top_builddir)/config.status $(srcdir)/nc-config.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 netcdf.pc: $(top_builddir)/config.status $(srcdir)/netcdf.pc.in
@@ -857,7 +860,7 @@ distdir: $(DISTFILES)
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
 	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -883,7 +886,7 @@ dist-shar: distdir
 	@echo WARNING: "Support for shar distribution archives is" \
 	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
 dist-zip: distdir
 	-rm -f $(distdir).zip
@@ -900,7 +903,7 @@ dist dist-all:
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lz*) \
@@ -910,7 +913,7 @@ distcheck: dist
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 64e6875..57c0ca3 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -7,6 +7,11 @@ This file contains a high-level description of this package's evolution. Release
 
 ## 4.5.0 - TBD
 
+### 4.5.0-rc2 - August 7, 2017
+
+* [Bug Fix] Addressed an issue with how cmake was implementing large file support on 32-bit systems. See [GitHub #385](https://github.com/Unidata/netcdf-c/issues/385) for more information.
+* [Bug Fix] Addressed an issue where ncgen would not respect keyword case. See [GitHub #310](https://github.com/Unidata/netcdf-c/issues/310) for more information.
+
 ### 4.5.0-rc1 - June 5, 2017
 
 * [Enhancement] DAP4 is now included. Since dap2 is the default for urls, dap4 must be specified by
diff --git a/aclocal.m4 b/aclocal.m4
index a0c40b0..8897626 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -408,7 +408,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -605,7 +605,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -626,7 +626,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -648,7 +648,7 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -683,7 +683,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -733,7 +733,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -772,7 +772,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -801,7 +801,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -848,7 +848,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -867,7 +867,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -948,7 +948,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1008,7 +1008,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1036,7 +1036,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1055,7 +1055,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/cf b/cf
index 967868b..40ab555 100644
--- a/cf
+++ b/cf
@@ -54,8 +54,7 @@ MALLOC_CHECK=""
 CPPFLAGS=""
 LDFLAGS=""
 
-#CFLAGS="-g -O0 $CFLAGS"
-CFLAGS="-g $CFLAGS"
+CFLAGS="-g -O0 $CFLAGS -Wno-undefined"
 
 MAKE=make
 IGNORE="test 0 = 1"
@@ -112,7 +111,6 @@ FLAGS="$FLAGS --enable-logging"
 #FLAGS="$FLAGS --enable-jna"
 #FLAGS="$FLAGS --disable-properties-attribute"
 #FLAGS="$FLAGS --disable-silent-rules"
-#FLAGS="$FLAGS --enable-dap4"
 #FLAGS="$FLAGS --with-testservers=remotestserver.localhost:8083"
 
 if test "x$PAR4" != x1 ; then
diff --git a/cf.cmake b/cf.cmake
index dcb842b..f0625b5 100644
--- a/cf.cmake
+++ b/cf.cmake
@@ -1,5 +1,14 @@
 # Visual Studio
-#VS=1
+VS=1
+#VSSETUP=1
+
+#export NCPATHDEBUG=1
+
+if test "x$VSSETUP" = x1 ; then
+CFG="Debug"
+else
+CFG="Release"
+fi
 
 # Is netcdf-4 and/or DAP enabled?
 NC4=1
@@ -33,13 +42,13 @@ NCLIB=`pwd`
 
 if test "x$VS" != x ; then
 # Visual Studio
-#CFG="RelWithDebInfo"
-CFG="Release"
 NCLIB="${NCLIB}/build/liblib/$CFG"
 export PATH="${NCLIB}:${PATH}"
 cmake $FLAGS ..
+if test "x$VSSETUP" = x ; then
 cmake --build . --config ${CFG}
 cmake --build . --config ${CFG} --target RUN_TESTS
+fi
 else
 # GCC
 NCLIB="${NCLIB}/build/liblib"
diff --git a/compile b/compile
index a85b723..2ab71e4 100755
--- a/compile
+++ b/compile
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey at cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -255,7 +255,8 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
     func_cl_wrapper "$@"      # Doesn't return...
     ;;
 esac
@@ -342,6 +343,6 @@ exit $ret
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/config.guess b/config.guess
index 6c32c86..2193702 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2014-11-04'
+timestamp='2017-05-27'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ timestamp='2014-11-04'
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
 # Please send patches to <config-patches at gnu.org>.
 
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
+	# to ELF recently (or will in the future) and ABI.
 	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
-	SUN_ARCH="i386"
+	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	fi
 	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
 		echo m68k-sun-sunos${UNAME_RELEASE}
@@ -618,13 +642,13 @@ EOF
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
 			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
@@ -663,11 +687,11 @@ EOF
 		    exit (0);
 		}
 EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if [ ${HP_ARCH} = hppa2.0w ]
 	then
 	    eval $set_cc_for_build
 
@@ -680,12 +704,12 @@ EOF
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
 		grep -q __LP64__
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -790,14 +814,14 @@ EOF
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -813,10 +837,11 @@ EOF
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	case ${UNAME_PROCESSOR} in
 	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		UNAME_PROCESSOR=x86_64 ;;
+	    i386)
+		UNAME_PROCESSOR=i586 ;;
 	esac
+	echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -879,7 +904,7 @@ EOF
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
@@ -902,7 +927,7 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -933,6 +958,9 @@ EOF
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -945,6 +973,9 @@ EOF
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     m32r*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -970,6 +1001,9 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
+    mips64el:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     openrisc*:Linux:*:*)
 	echo or1k-unknown-linux-${LIBC}
 	exit ;;
@@ -1002,6 +1036,9 @@ EOF
     ppcle:Linux:*:*)
 	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
@@ -1021,7 +1058,7 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1100,7 +1137,7 @@ EOF
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
+	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	exit ;;
@@ -1249,6 +1286,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1262,16 +1302,23 @@ EOF
 	    UNAME_PROCESSOR=powerpc
 	fi
 	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
-	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		    grep IS_64BIT_ARCH >/dev/null
+		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		       grep IS_64BIT_ARCH >/dev/null
 		then
 		    case $UNAME_PROCESSOR in
 			i386) UNAME_PROCESSOR=x86_64 ;;
 			powerpc) UNAME_PROCESSOR=powerpc64 ;;
 		    esac
 		fi
+		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		       grep IS_PPC >/dev/null
+		then
+		    UNAME_PROCESSOR=powerpc
+		fi
 	    fi
 	elif test "$UNAME_PROCESSOR" = i386 ; then
 	    # Avoid executing cc on OS X 10.9, as it ships with a stub
@@ -1286,7 +1333,7 @@ EOF
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
@@ -1295,15 +1342,18 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
-    NEO-?:NONSTOP_KERNEL:*:*)
+    NEO-*:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
+    NSR-*:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit ;;
+    NSX-*:NONSTOP_KERNEL:*:*)
+	echo nsx-tandem-nsk${UNAME_RELEASE}
+	exit ;;
     *:NonStop-UX:*:*)
 	echo mips-compaq-nonstopux
 	exit ;;
@@ -1317,7 +1367,7 @@ EOF
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = "386"; then
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
@@ -1359,7 +1409,7 @@ EOF
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
 	exit ;;
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
@@ -1370,23 +1420,25 @@ EOF
     x86_64:VMkernel:*:*)
 	echo ${UNAME_MACHINE}-unknown-esx
 	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
 esac
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches at gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches at gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 0db40cc..df62631 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -13,7 +13,12 @@
    * https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h
 
    */
+
+#cmakedefine HAVE_WINSOCK2_H
+
+#ifdef HAVE_WINSOCK2_H
    #define _WINSOCKAPI_
+#endif
 
    #if _MSC_VER>=1900
      #define STDC99
@@ -358,6 +363,9 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <string.h> header file. */
 #cmakedefine HAVE_STRING_H 1
 
+/* Define to 1 if you have the <ftw.h> header file. */
+#cmakedefine HAVE_FTW_H 1
+
 /* Define to 1 if you have the `strlcat' function. */
 #cmakedefine HAVE_STRLCAT 1
 
diff --git a/config.h.in b/config.h.in
index cf4299c..f1a11ee 100644
--- a/config.h.in
+++ b/config.h.in
@@ -113,6 +113,9 @@
 /* Define to 1 if you have the `fsync' function. */
 #undef HAVE_FSYNC
 
+/* Define to 1 if you have the <ftw.h> header file. */
+#undef HAVE_FTW_H
+
 /* Define to 1 if you have the <getopt.h> header file. */
 #undef HAVE_GETOPT_H
 
diff --git a/config.sub b/config.sub
index 7ffe373..40ea5df 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2014-12-03'
+timestamp='2017-04-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ timestamp='2014-12-03'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2014-12-03'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,15 +254,16 @@ case $basic_machine in
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| ba \
 	| be32 | be64 \
 	| bfin \
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
-	| fido | fr30 | frv \
+	| e2k | epiphany \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
-	| i370 | i860 | i960 | ia64 \
+	| i370 | i860 | i960 | ia16 | ia64 \
 	| ip2k | iq2000 \
 	| k1om \
 	| le32 | le64 \
@@ -301,11 +301,12 @@ case $basic_machine in
 	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pru \
 	| pyramid \
 	| riscv32 | riscv64 \
 	| rl78 | rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -314,6 +315,7 @@ case $basic_machine in
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| visium \
+	| wasm32 \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -376,17 +378,18 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
+	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| hexagon-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
+	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
 	| ip2k-* | iq2000-* \
 	| k1om-* \
 	| le32-* | le64-* \
@@ -427,13 +430,15 @@ case $basic_machine in
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pru-* \
 	| pyramid-* \
+	| riscv32-* | riscv64-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tile*-* \
@@ -442,6 +447,7 @@ case $basic_machine in
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
 	| visium-* \
+	| wasm32-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -518,6 +524,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-aros
 		;;
+	asmjs)
+		basic_machine=asmjs-unknown
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -638,6 +647,14 @@ case $basic_machine in
 		basic_machine=m68k-bull
 		os=-sysv3
 		;;
+	e500v[12])
+		basic_machine=powerpc-unknown
+		os=$os"spe"
+		;;
+	e500v[12]-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=$os"spe"
+		;;
 	ebmon29k)
 		basic_machine=a29k-amd
 		os=-ebmon
@@ -933,6 +950,9 @@ case $basic_machine in
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
+	nsx-tandem)
+		basic_machine=nsx-tandem
+		;;
 	op50n-* | op60c-*)
 		basic_machine=hppa1.1-oki
 		os=-proelf
@@ -1017,7 +1037,7 @@ case $basic_machine in
 	ppc-* | ppcbe-*)
 		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
+	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		;;
 	ppcle-* | powerpclittle-*)
@@ -1027,7 +1047,7 @@ case $basic_machine in
 		;;
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		;;
 	ppc64le-* | powerpc64little-*)
@@ -1228,6 +1248,9 @@ case $basic_machine in
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
+	wasm32)
+		basic_machine=wasm32-unknown
+		;;
 	w65*)
 		basic_machine=w65-wdc
 		os=-none
@@ -1373,18 +1396,18 @@ case $os in
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
@@ -1393,7 +1416,8 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1525,6 +1549,8 @@ case $os in
 		;;
 	-nacl*)
 		;;
+	-ios)
+		;;
 	-none)
 		;;
 	*)
@@ -1620,6 +1646,9 @@ case $basic_machine in
 	sparc-* | *-sun)
 		os=-sunos4.1.1
 		;;
+	pru-*)
+		os=-elf
+		;;
 	*-be)
 		os=-beos
 		;;
diff --git a/configure b/configure
index e718b1f..24f3cb9 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.5.0-rc1.
+# Generated by GNU Autoconf 2.69 for netCDF 4.5.0-rc2.
 #
 # 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.5.0-rc1'
-PACKAGE_STRING='netCDF 4.5.0-rc1'
+PACKAGE_VERSION='4.5.0-rc2'
+PACKAGE_STRING='netCDF 4.5.0-rc2'
 PACKAGE_BUGREPORT='support-netcdf at unidata.ucar.edu'
 PACKAGE_URL=''
 
@@ -1509,7 +1509,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.5.0-rc1 to adapt to many kinds of systems.
+\`configure' configures netCDF 4.5.0-rc2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1580,7 +1580,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of netCDF 4.5.0-rc1:";;
+     short | recursive ) echo "Configuration of netCDF 4.5.0-rc2:";;
    esac
   cat <<\_ACEOF
 
@@ -1807,7 +1807,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-netCDF configure 4.5.0-rc1
+netCDF configure 4.5.0-rc2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2516,7 +2516,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.5.0-rc1, which was
+It was created by netCDF $as_me 4.5.0-rc2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2878,7 +2878,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
  NC_VERSION_MAJOR=4
  NC_VERSION_MINOR=5
  NC_VERSION_PATCH=0
- NC_VERSION_NOTE="-rc1"
+ NC_VERSION_NOTE="-rc2"
 
 #####
 # Set some variables used to generate a libnetcdf.settings file,
@@ -2887,11 +2887,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 # Create the VERSION file, which contains the package version from
 # AC_INIT.
-echo 4.5.0-rc1>VERSION
+echo 4.5.0-rc2>VERSION
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.5.0-rc1" >&5
-$as_echo "$as_me: netCDF 4.5.0-rc1" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.5.0-rc2" >&5
+$as_echo "$as_me: netCDF 4.5.0-rc2" >&6;}
 
 # Keep libtool macros in an m4 directory.
 
@@ -3556,7 +3556,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='netcdf'
- VERSION='4.5.0-rc1'
+ VERSION='4.5.0-rc2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -15992,6 +15992,20 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
 fi
 
 
+# See if we have ftw.h to walk directory trees
+for ac_header in ftw.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "ftw.h" "ac_cv_header_ftw_h" "$ac_includes_default"
+if test "x$ac_cv_header_ftw_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_FTW_H 1
+_ACEOF
+
+fi
+
+done
+
+
 # Check for these functions...
 for ac_func in strlcat strerror snprintf strchr strrchr strcat strcpy \
                 strdup strcasecmp strtod strtoll strtoull strstr \
@@ -19413,9 +19427,11 @@ abs_top_builddir=`pwd`
 cd $srcdir
 abs_top_srcdir=`pwd`
 cd $abs_top_builddir
-#AC_CONFIG_FILES(test_common.sh.in)
-rm -f ${abs_top_builddir}/test_common.sh
-sed -e "s|@TOPSRCDIR@|${abs_top_srcdir}|" -e "s|@TOPBUILDDIR@|${abs_top_builddir}|" <${abs_top_srcdir}/test_common.in >${abs_top_builddir}/test_common.sh
+
+ac_config_files="$ac_config_files test_common.sh:test_common.in"
+
+#rm -f ${abs_top_builddir}/test_common.sh
+#sed -e "s|@TOPSRCDIR@|${abs_top_srcdir}|" -e "s|@TOPBUILDDIR@|${abs_top_builddir}|" <${abs_top_srcdir}/test_common.in >${abs_top_builddir}/test_common.sh
 
 #####
 # End netcdf_meta.h definitions.
@@ -20132,7 +20148,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.5.0-rc1, which was
+This file was extended by netCDF $as_me 4.5.0-rc2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20202,7 +20218,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.5.0-rc1
+netCDF config.status 4.5.0-rc2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -20625,6 +20641,7 @@ do
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "docs/Doxyfile") CONFIG_FILES="$CONFIG_FILES docs/Doxyfile" ;;
+    "test_common.sh") CONFIG_FILES="$CONFIG_FILES test_common.sh:test_common.in" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "nc-config") CONFIG_FILES="$CONFIG_FILES nc-config" ;;
     "netcdf.pc") CONFIG_FILES="$CONFIG_FILES netcdf.pc" ;;
@@ -21998,6 +22015,6 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
 
-    mv -f ${abs_top_srcdir}/test_common.sh ${abs_top_builddir}/test_common.sh
+    #mv -f ${abs_top_srcdir}/test_common.sh ${abs_top_builddir}/test_common.sh
 
 cat libnetcdf.settings
diff --git a/configure.ac b/configure.ac
index 2c09e67..8bfe223 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.5.0-rc1], [support-netcdf at unidata.ucar.edu])
+AC_INIT([netCDF], [4.5.0-rc2], [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.5.0-rc1], [support-netcdf at unidata.ucar.edu])
 AC_SUBST([NC_VERSION_MAJOR]) NC_VERSION_MAJOR=4
 AC_SUBST([NC_VERSION_MINOR]) NC_VERSION_MINOR=5
 AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=0
-AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc1"
+AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc2"
 
 #####
 # Set some variables used to generate a libnetcdf.settings file,
@@ -791,6 +791,9 @@ AC_CHECK_HEADERS([sys/resource.h])
 # Check for <stdbool.h> that conforms to C99 requirements
 AC_HEADER_STDBOOL
 
+# See if we have ftw.h to walk directory trees
+AC_CHECK_HEADERS([ftw.h])
+
 # Check for these functions...
 AC_CHECK_FUNCS([strlcat strerror snprintf strchr strrchr strcat strcpy \
                 strdup strcasecmp strtod strtoll strtoull strstr \
@@ -805,11 +808,10 @@ AC_ARG_ENABLE([diskless],
 test "x$enable_diskless" = xno || enable_diskless=yes
 AC_MSG_RESULT($enable_diskless)
 
-# Check for enable DAP
-if test "x$enable_dap" = "xyes" -a "xenable_diskless" = xno  ; then
-AC_MSG_NOTICE([--enable-dap requires --enable-diskless])
-AC_MSG_NOTICE([dap support disabled])
-enable_dap=no
+# If DAP enabled and diskless not enabled, then warn of consequences
+if test "x$enable_dap" = "xyes" -a "x$enable_diskless" = xno  ; then
+AC_MSG_NOTICE([Warning: DAP support is enabled but diskless support is disabled.])
+AC_MSG_NOTICE([=> temporary files will be created + reclaimed when using DAP.])
 fi
 
 # disable dap4 if netcdf-4 is disabled
@@ -1443,9 +1445,10 @@ abs_top_builddir=`pwd`
 cd $srcdir
 abs_top_srcdir=`pwd`
 cd $abs_top_builddir
-#AC_CONFIG_FILES(test_common.sh.in)
-rm -f ${abs_top_builddir}/test_common.sh
-sed -e "s|@TOPSRCDIR@|${abs_top_srcdir}|" -e "s|@TOPBUILDDIR@|${abs_top_builddir}|" <${abs_top_srcdir}/test_common.in >${abs_top_builddir}/test_common.sh
+
+AC_CONFIG_FILES(test_common.sh:test_common.in)
+#rm -f ${abs_top_builddir}/test_common.sh
+#sed -e "s|@TOPSRCDIR@|${abs_top_srcdir}|" -e "s|@TOPBUILDDIR@|${abs_top_builddir}|" <${abs_top_srcdir}/test_common.in >${abs_top_builddir}/test_common.sh
 
 #####
 # End netcdf_meta.h definitions.
@@ -1490,6 +1493,6 @@ AC_CONFIG_FILES([Makefile
                  [test -f  nc-config && chmod 755 nc-config])
 AC_OUTPUT()
 
-    mv -f ${abs_top_srcdir}/test_common.sh ${abs_top_builddir}/test_common.sh
+    #mv -f ${abs_top_srcdir}/test_common.sh ${abs_top_builddir}/test_common.sh
 
 cat libnetcdf.settings
diff --git a/dap4_test/CMakeLists.txt b/dap4_test/CMakeLists.txt
index d748677..1b8e3a9 100644
--- a/dap4_test/CMakeLists.txt
+++ b/dap4_test/CMakeLists.txt
@@ -2,7 +2,6 @@ SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
 
 remove_definitions(-DDLL_EXPORT)
 
-
 ADD_SUBDIRECTORY(baseline)
 ADD_SUBDIRECTORY(baselineraw)
 ADD_SUBDIRECTORY(baselineremote)
diff --git a/dap4_test/Makefile.am b/dap4_test/Makefile.am
index d00e857..be5ba4e 100644
--- a/dap4_test/Makefile.am
+++ b/dap4_test/Makefile.am
@@ -68,6 +68,8 @@ clean-local: clean-local-check
 clean-local-check:
 	-rm -rf results
 	-rm -f .dodsrc .daprc
+	-rm -f tmp_*
+    #-find . -name 'tmp_*' -exec rm {} \;
 
 # The shell file maketests.sh is used to build the testdata
 # for dap4 testing. It creates and fills the directories
diff --git a/dap4_test/Makefile.in b/dap4_test/Makefile.in
index 7da09ef..a7a7c02 100644
--- a/dap4_test/Makefile.in
+++ b/dap4_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1141,6 +1141,8 @@ clean-local: clean-local-check
 clean-local-check:
 	-rm -rf results
 	-rm -f .dodsrc .daprc
+	-rm -f tmp_*
+    #-find . -name 'tmp_*' -exec rm {} \;
 
 # The shell file maketests.sh is used to build the testdata
 # for dap4 testing. It creates and fills the directories
diff --git a/dap4_test/baseline/CMakeLists.txt b/dap4_test/baseline/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/baseline/CMakeLists.txt
+++ b/dap4_test/baseline/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/baseline/test_struct1.nc.d4d b/dap4_test/baseline/test_struct1.nc.d4d
index 04629a0..e246bc9 100644
--- a/dap4_test/baseline/test_struct1.nc.d4d
+++ b/dap4_test/baseline/test_struct1.nc.d4d
@@ -6,7 +6,6 @@ types:
   }; // s_t
 variables:
 	s_t s ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct1.nc.d4m b/dap4_test/baseline/test_struct1.nc.d4m
index bbc5834..c75622a 100644
--- a/dap4_test/baseline/test_struct1.nc.d4m
+++ b/dap4_test/baseline/test_struct1.nc.d4m
@@ -6,7 +6,6 @@ types:
   }; // s_t
 variables:
 	s_t s ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct1.nc.d4p b/dap4_test/baseline/test_struct1.nc.d4p
index 6d366ba..d4dd744 100644
--- a/dap4_test/baseline/test_struct1.nc.d4p
+++ b/dap4_test/baseline/test_struct1.nc.d4p
@@ -11,10 +11,7 @@
     </Structure>
   </Types>
   <Variables>
-    <Struct name="s" type="/s">
-      <Map name="/s.x"/>
-      <Map name="/s.y"/>
-    </Struct>
+    <Struct name="s" type="/s"/>
   </Variables>
   <Attribute name="_DAP4_Little_Endian" type="UInt8">
     <Value value="1"/>
diff --git a/dap4_test/baseline/test_struct_array.6.nc.d4d b/dap4_test/baseline/test_struct_array.6.nc.d4d
index 3eb90c3..c5b3e6f 100644
--- a/dap4_test/baseline/test_struct_array.6.nc.d4d
+++ b/dap4_test/baseline/test_struct_array.6.nc.d4d
@@ -8,7 +8,6 @@ dimensions:
 	_Anonymous2 = 2 ;
 variables:
 	s_t s(_Anonymous2, _Anonymous2) ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		string :_dap4.ce = "/s[0:2:3][0:1]" ;
diff --git a/dap4_test/baseline/test_struct_array.6.nc.d4m b/dap4_test/baseline/test_struct_array.6.nc.d4m
index a8e60a0..09940fa 100644
--- a/dap4_test/baseline/test_struct_array.6.nc.d4m
+++ b/dap4_test/baseline/test_struct_array.6.nc.d4m
@@ -8,7 +8,6 @@ dimensions:
 	_Anonymous2 = 2 ;
 variables:
 	s_t s(_Anonymous2, _Anonymous2) ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		string :_dap4.ce = "/s[0:2:3][0:1]" ;
diff --git a/dap4_test/baseline/test_struct_array.6.nc.d4p b/dap4_test/baseline/test_struct_array.6.nc.d4p
index e73b6e0..6c695a1 100644
--- a/dap4_test/baseline/test_struct_array.6.nc.d4p
+++ b/dap4_test/baseline/test_struct_array.6.nc.d4p
@@ -17,8 +17,6 @@
     <Struct name="s" type="/s">
       <Dim name="/_Anonymous2"/>
       <Dim name="/_Anonymous2"/>
-      <Map name="/s.x"/>
-      <Map name="/s.y"/>
     </Struct>
   </Variables>
   <Attribute name="_dap4.ce" type="String">
diff --git a/dap4_test/baseline/test_struct_array.nc.d4d b/dap4_test/baseline/test_struct_array.nc.d4d
index dd8c2f2..68fded4 100644
--- a/dap4_test/baseline/test_struct_array.nc.d4d
+++ b/dap4_test/baseline/test_struct_array.nc.d4d
@@ -9,7 +9,6 @@ dimensions:
 	dy = 3 ;
 variables:
 	s_t s(dx, dy) ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_array.nc.d4m b/dap4_test/baseline/test_struct_array.nc.d4m
index cef0d70..b0684a3 100644
--- a/dap4_test/baseline/test_struct_array.nc.d4m
+++ b/dap4_test/baseline/test_struct_array.nc.d4m
@@ -9,7 +9,6 @@ dimensions:
 	dy = 3 ;
 variables:
 	s_t s(dx, dy) ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_array.nc.d4p b/dap4_test/baseline/test_struct_array.nc.d4p
index e8c31f3..3d93132 100644
--- a/dap4_test/baseline/test_struct_array.nc.d4p
+++ b/dap4_test/baseline/test_struct_array.nc.d4p
@@ -18,8 +18,6 @@
     <Struct name="s" type="/s">
       <Dim name="/dx"/>
       <Dim name="/dy"/>
-      <Map name="/s.x"/>
-      <Map name="/s.y"/>
     </Struct>
   </Variables>
   <Attribute name="_DAP4_Little_Endian" type="UInt8">
diff --git a/dap4_test/baseline/test_struct_array.syn.d4d b/dap4_test/baseline/test_struct_array.syn.d4d
index 75958ba..73d6092 100644
--- a/dap4_test/baseline/test_struct_array.syn.d4d
+++ b/dap4_test/baseline/test_struct_array.syn.d4d
@@ -11,7 +11,7 @@ variables:
 	float z(dx) ;
 	float t(dy) ;
 	s_t s(dx, dy) ;
-		string s:_edu.ucar.maps = "/z", "/t" ;
+ 		string s:_edu.ucar.maps = "/z", "/t" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_array.syn.d4m b/dap4_test/baseline/test_struct_array.syn.d4m
index 39c68c2..2326dbd 100644
--- a/dap4_test/baseline/test_struct_array.syn.d4m
+++ b/dap4_test/baseline/test_struct_array.syn.d4m
@@ -11,7 +11,7 @@ variables:
 	float z(dx) ;
 	float t(dy) ;
 	s_t s(dx, dy) ;
-		string s:_edu.ucar.maps = "/z", "/t" ;
+ 		string s:_edu.ucar.maps = "/z", "/t" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_nested.nc.d4d b/dap4_test/baseline/test_struct_nested.nc.d4d
index d14fb5f..83bc77b 100644
--- a/dap4_test/baseline/test_struct_nested.nc.d4d
+++ b/dap4_test/baseline/test_struct_nested.nc.d4d
@@ -14,7 +14,6 @@ types:
   }; // x_t
 variables:
 	x_t x ;
-		string x:_edu.ucar.maps = "/x_field1.x", "/x_field1.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_nested.nc.d4m b/dap4_test/baseline/test_struct_nested.nc.d4m
index 0a8fb60..78567d8 100644
--- a/dap4_test/baseline/test_struct_nested.nc.d4m
+++ b/dap4_test/baseline/test_struct_nested.nc.d4m
@@ -14,7 +14,6 @@ types:
   }; // x_t
 variables:
 	x_t x ;
-		string x:_edu.ucar.maps = "/x_field1.x", "/x_field1.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_nested.nc.d4p b/dap4_test/baseline/test_struct_nested.nc.d4p
index 91c3d5d..5f87579 100644
--- a/dap4_test/baseline/test_struct_nested.nc.d4p
+++ b/dap4_test/baseline/test_struct_nested.nc.d4p
@@ -19,10 +19,7 @@
     </Structure>
   </Types>
   <Variables>
-    <Struct name="x" type="/x">
-      <Map name="/x_field1.x"/>
-      <Map name="/x_field1.y"/>
-    </Struct>
+    <Struct name="x" type="/x"/>
   </Variables>
   <Attribute name="_DAP4_Little_Endian" type="UInt8">
     <Value value="1"/>
diff --git a/dap4_test/baseline/test_struct_type.nc.d4d b/dap4_test/baseline/test_struct_type.nc.d4d
index 1f8395f..6d6e924 100644
--- a/dap4_test/baseline/test_struct_type.nc.d4d
+++ b/dap4_test/baseline/test_struct_type.nc.d4d
@@ -6,7 +6,6 @@ types:
   }; // s_t
 variables:
 	s_t s ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_type.nc.d4m b/dap4_test/baseline/test_struct_type.nc.d4m
index 941d72e..319a6d7 100644
--- a/dap4_test/baseline/test_struct_type.nc.d4m
+++ b/dap4_test/baseline/test_struct_type.nc.d4m
@@ -6,7 +6,6 @@ types:
   }; // s_t
 variables:
 	s_t s ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baseline/test_struct_type.nc.d4p b/dap4_test/baseline/test_struct_type.nc.d4p
index ddb2fda..4fc19ba 100644
--- a/dap4_test/baseline/test_struct_type.nc.d4p
+++ b/dap4_test/baseline/test_struct_type.nc.d4p
@@ -11,10 +11,7 @@
     </Structure>
   </Types>
   <Variables>
-    <Struct name="s" type="/s">
-      <Map name="/s.x"/>
-      <Map name="/s.y"/>
-    </Struct>
+    <Struct name="s" type="/s"/>
   </Variables>
   <Attribute name="_DAP4_Little_Endian" type="UInt8">
     <Value value="1"/>
diff --git a/dap4_test/baselineraw/CMakeLists.txt b/dap4_test/baselineraw/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/baselineraw/CMakeLists.txt
+++ b/dap4_test/baselineraw/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/baselineraw/test_struct1.nc.dmp b/dap4_test/baselineraw/test_struct1.nc.dmp
index e946f81..23d3a2e 100644
--- a/dap4_test/baselineraw/test_struct1.nc.dmp
+++ b/dap4_test/baselineraw/test_struct1.nc.dmp
@@ -6,7 +6,6 @@ types:
   }; // s_t
 variables:
 	s_t s ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baselineraw/test_struct_array.6.nc.dmp b/dap4_test/baselineraw/test_struct_array.6.nc.dmp
index f5d79b2..00c92c0 100644
--- a/dap4_test/baselineraw/test_struct_array.6.nc.dmp
+++ b/dap4_test/baselineraw/test_struct_array.6.nc.dmp
@@ -8,7 +8,6 @@ dimensions:
 	_Anonymous2 = 2 ;
 variables:
 	s_t s(_Anonymous2, _Anonymous2) ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		string :_dap4.ce = "/s[0:2:3][0:1]" ;
diff --git a/dap4_test/baselineraw/test_struct_array.nc.dmp b/dap4_test/baselineraw/test_struct_array.nc.dmp
index 0199c48..c1d4a5b 100644
--- a/dap4_test/baselineraw/test_struct_array.nc.dmp
+++ b/dap4_test/baselineraw/test_struct_array.nc.dmp
@@ -9,7 +9,6 @@ dimensions:
 	dy = 3 ;
 variables:
 	s_t s(dx, dy) ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baselineraw/test_struct_nested.nc.dmp b/dap4_test/baselineraw/test_struct_nested.nc.dmp
index 9f3eda9..fb83ca2 100644
--- a/dap4_test/baselineraw/test_struct_nested.nc.dmp
+++ b/dap4_test/baselineraw/test_struct_nested.nc.dmp
@@ -14,7 +14,6 @@ types:
   }; // x_t
 variables:
 	x_t x ;
-		string x:_edu.ucar.maps = "/x_field1.x", "/x_field1.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baselineraw/test_struct_type.nc.dmp b/dap4_test/baselineraw/test_struct_type.nc.dmp
index e37f3e2..1675cbd 100644
--- a/dap4_test/baselineraw/test_struct_type.nc.dmp
+++ b/dap4_test/baselineraw/test_struct_type.nc.dmp
@@ -6,7 +6,6 @@ types:
   }; // s_t
 variables:
 	s_t s ;
-		string s:_edu.ucar.maps = "/s.x", "/s.y" ;
 
 // global attributes:
 		:_DAP4_Little_Endian = 1UB ;
diff --git a/dap4_test/baselineremote/CMakeLists.txt b/dap4_test/baselineremote/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/baselineremote/CMakeLists.txt
+++ b/dap4_test/baselineremote/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/cdltestfiles/CMakeLists.txt b/dap4_test/cdltestfiles/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/cdltestfiles/CMakeLists.txt
+++ b/dap4_test/cdltestfiles/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/daptestfiles/CMakeLists.txt b/dap4_test/daptestfiles/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/daptestfiles/CMakeLists.txt
+++ b/dap4_test/daptestfiles/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/daptestfiles/test_atomic_array.nc.dap b/dap4_test/daptestfiles/test_atomic_array.nc.dap
index 511cfa3..ee66dbe 100644
Binary files a/dap4_test/daptestfiles/test_atomic_array.nc.dap and b/dap4_test/daptestfiles/test_atomic_array.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_atomic_array.syn.dap b/dap4_test/daptestfiles/test_atomic_array.syn.dap
index 8032a75..30138ab 100644
Binary files a/dap4_test/daptestfiles/test_atomic_array.syn.dap and b/dap4_test/daptestfiles/test_atomic_array.syn.dap differ
diff --git a/dap4_test/daptestfiles/test_atomic_types.nc.dap b/dap4_test/daptestfiles/test_atomic_types.nc.dap
index 19ca742..154de81 100644
Binary files a/dap4_test/daptestfiles/test_atomic_types.nc.dap and b/dap4_test/daptestfiles/test_atomic_types.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_atomic_types.syn.dap b/dap4_test/daptestfiles/test_atomic_types.syn.dap
index 13e9bd6..906759b 100644
Binary files a/dap4_test/daptestfiles/test_atomic_types.syn.dap and b/dap4_test/daptestfiles/test_atomic_types.syn.dap differ
diff --git a/dap4_test/daptestfiles/test_enum.nc.dap b/dap4_test/daptestfiles/test_enum.nc.dap
index e87e53b..ec69756 100644
Binary files a/dap4_test/daptestfiles/test_enum.nc.dap and b/dap4_test/daptestfiles/test_enum.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_enum_2.nc.dap b/dap4_test/daptestfiles/test_enum_2.nc.dap
index 5cd58c4..d38f533 100644
Binary files a/dap4_test/daptestfiles/test_enum_2.nc.dap and b/dap4_test/daptestfiles/test_enum_2.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_enum_array.4.nc.dap b/dap4_test/daptestfiles/test_enum_array.4.nc.dap
index 1ad1eed..e89b3c5 100644
Binary files a/dap4_test/daptestfiles/test_enum_array.4.nc.dap and b/dap4_test/daptestfiles/test_enum_array.4.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_enum_array.nc.dap b/dap4_test/daptestfiles/test_enum_array.nc.dap
index 7a2a20b..60a17c7 100644
Binary files a/dap4_test/daptestfiles/test_enum_array.nc.dap and b/dap4_test/daptestfiles/test_enum_array.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_struct1.nc.dap b/dap4_test/daptestfiles/test_struct1.nc.dap
index dca9188..1060ad4 100644
Binary files a/dap4_test/daptestfiles/test_struct1.nc.dap and b/dap4_test/daptestfiles/test_struct1.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_struct_array.6.nc.dap b/dap4_test/daptestfiles/test_struct_array.6.nc.dap
index cc2b49b..f551cc1 100644
Binary files a/dap4_test/daptestfiles/test_struct_array.6.nc.dap and b/dap4_test/daptestfiles/test_struct_array.6.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_struct_array.nc.dap b/dap4_test/daptestfiles/test_struct_array.nc.dap
index 8180834..78814df 100644
Binary files a/dap4_test/daptestfiles/test_struct_array.nc.dap and b/dap4_test/daptestfiles/test_struct_array.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_struct_nested.nc.dap b/dap4_test/daptestfiles/test_struct_nested.nc.dap
index ce520c2..33eb9ef 100644
Binary files a/dap4_test/daptestfiles/test_struct_nested.nc.dap and b/dap4_test/daptestfiles/test_struct_nested.nc.dap differ
diff --git a/dap4_test/daptestfiles/test_struct_type.nc.dap b/dap4_test/daptestfiles/test_struct_type.nc.dap
index aeae2ba..2b3ffbf 100644
Binary files a/dap4_test/daptestfiles/test_struct_type.nc.dap and b/dap4_test/daptestfiles/test_struct_type.nc.dap differ
diff --git a/dap4_test/dmrtestfiles/CMakeLists.txt b/dap4_test/dmrtestfiles/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/dmrtestfiles/CMakeLists.txt
+++ b/dap4_test/dmrtestfiles/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/dmrtestfiles/test_atomic_array.nc.dmr b/dap4_test/dmrtestfiles/test_atomic_array.nc.dmr
index 29a27e1..5ede1b9 100644
--- a/dap4_test/dmrtestfiles/test_atomic_array.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_atomic_array.nc.dmr
@@ -51,7 +51,7 @@
     </Opaque>
     <Enum name="primary_cloud" enum="/cloud_class_t">
         <Dim name="/d5"/>
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_atomic_array.syn.dmr b/dap4_test/dmrtestfiles/test_atomic_array.syn.dmr
index 5d7e2a4..a539d8d 100644
--- a/dap4_test/dmrtestfiles/test_atomic_array.syn.dmr
+++ b/dap4_test/dmrtestfiles/test_atomic_array.syn.dmr
@@ -51,7 +51,7 @@
     </Opaque>
     <Enum name="primary_cloud" enum="/cloud_class_t">
         <Dim name="/d5"/>
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_atomic_types.nc.dmr b/dap4_test/dmrtestfiles/test_atomic_types.nc.dmr
index 249b4bb..e34b9e6 100644
--- a/dap4_test/dmrtestfiles/test_atomic_types.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_atomic_types.nc.dmr
@@ -33,12 +33,12 @@
     <String name="vs"/>
     <Opaque name="vo" _edu.ucar.opaque.size="8"/>
     <Enum name="primary_cloud" enum="/cloud_class_t">
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
     <Enum name="secondary_cloud" enum="/cloud_class_t">
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_atomic_types.syn.dmr b/dap4_test/dmrtestfiles/test_atomic_types.syn.dmr
index 36cc7d1..ac11cb2 100644
--- a/dap4_test/dmrtestfiles/test_atomic_types.syn.dmr
+++ b/dap4_test/dmrtestfiles/test_atomic_types.syn.dmr
@@ -33,12 +33,12 @@
     <String name="vs"/>
     <Opaque name="vo"/>
     <Enum name="primary_cloud" enum="/cloud_class_t">
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
     <Enum name="secondary_cloud" enum="/cloud_class_t">
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_enum.nc.dmr b/dap4_test/dmrtestfiles/test_enum.nc.dmr
index ef25fa7..456ef68 100644
--- a/dap4_test/dmrtestfiles/test_enum.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_enum.nc.dmr
@@ -20,7 +20,7 @@
         <EnumConst name="Missing" value="127"/>
     </Enumeration>
     <Enum name="primary_cloud" enum="/cloud_class_t">
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_enum_2.nc.dmr b/dap4_test/dmrtestfiles/test_enum_2.nc.dmr
index a5c0d1d..ea663f8 100644
--- a/dap4_test/dmrtestfiles/test_enum_2.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_enum_2.nc.dmr
@@ -24,7 +24,7 @@
     </Attribute>
     <Group name="h">
         <Enum name="primary_cloud" enum="/cloud_class_t">
-            <Attribute name="_FillValue" type="String">
+            <Attribute name="_FillValue" type="/cloud_class_t">
                 <Value value="Missing"/>
             </Attribute>
         </Enum>
diff --git a/dap4_test/dmrtestfiles/test_enum_array.4.nc.dmr b/dap4_test/dmrtestfiles/test_enum_array.4.nc.dmr
index 3c0d9f9..aee224f 100644
--- a/dap4_test/dmrtestfiles/test_enum_array.4.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_enum_array.4.nc.dmr
@@ -21,7 +21,7 @@
     </Enumeration>
     <Enum name="primary_cloud" enum="/cloud_class_t">
         <Dim size="2"/>
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_enum_array.nc.dmr b/dap4_test/dmrtestfiles/test_enum_array.nc.dmr
index fcfa9ac..1899edf 100644
--- a/dap4_test/dmrtestfiles/test_enum_array.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_enum_array.nc.dmr
@@ -22,7 +22,7 @@
     </Enumeration>
     <Enum name="primary_cloud" enum="/cloud_class_t">
         <Dim name="/d5"/>
-        <Attribute name="_FillValue" type="String">
+        <Attribute name="_FillValue" type="/cloud_class_t">
             <Value value="Missing"/>
         </Attribute>
     </Enum>
diff --git a/dap4_test/dmrtestfiles/test_struct1.nc.dmr b/dap4_test/dmrtestfiles/test_struct1.nc.dmr
index 4dd5100..95b9d84 100644
--- a/dap4_test/dmrtestfiles/test_struct1.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_struct1.nc.dmr
@@ -8,8 +8,6 @@
     <Structure name="s">
         <Int32 name="x"/>
         <Int32 name="y"/>
-        <Map name="/s.x"/>
-        <Map name="/s.y"/>
     </Structure>
     <Attribute name="_DAP4_Little_Endian" type="UInt8">
         <Value value="1"/>
diff --git a/dap4_test/dmrtestfiles/test_struct_array.6.nc.dmr b/dap4_test/dmrtestfiles/test_struct_array.6.nc.dmr
index 978d4e6..914753b 100644
--- a/dap4_test/dmrtestfiles/test_struct_array.6.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_struct_array.6.nc.dmr
@@ -10,8 +10,6 @@
         <Int32 name="y"/>
         <Dim size="2"/>
         <Dim size="2"/>
-        <Map name="/s.x"/>
-        <Map name="/s.y"/>
     </Structure>
     <Attribute name="_dap4.ce" type="String">
         <Value value="/s[0:2:3][0:1]"/>
diff --git a/dap4_test/dmrtestfiles/test_struct_array.nc.dmr b/dap4_test/dmrtestfiles/test_struct_array.nc.dmr
index 3984fce..4441452 100644
--- a/dap4_test/dmrtestfiles/test_struct_array.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_struct_array.nc.dmr
@@ -12,8 +12,6 @@
         <Int32 name="y"/>
         <Dim name="/dx"/>
         <Dim name="/dy"/>
-        <Map name="/s.x"/>
-        <Map name="/s.y"/>
     </Structure>
     <Attribute name="_DAP4_Little_Endian" type="UInt8">
         <Value value="1"/>
diff --git a/dap4_test/dmrtestfiles/test_struct_nested.nc.dmr b/dap4_test/dmrtestfiles/test_struct_nested.nc.dmr
index b15e6f4..d9c7588 100644
--- a/dap4_test/dmrtestfiles/test_struct_nested.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_struct_nested.nc.dmr
@@ -14,8 +14,6 @@
             <Int32 name="x"/>
             <Int32 name="y"/>
         </Structure>
-        <Map name="/x.field1.x"/>
-        <Map name="/x.field1.y"/>
     </Structure>
     <Attribute name="_DAP4_Little_Endian" type="UInt8">
         <Value value="1"/>
diff --git a/dap4_test/dmrtestfiles/test_struct_type.nc.dmr b/dap4_test/dmrtestfiles/test_struct_type.nc.dmr
index 1d45e0a..d926dfc 100644
--- a/dap4_test/dmrtestfiles/test_struct_type.nc.dmr
+++ b/dap4_test/dmrtestfiles/test_struct_type.nc.dmr
@@ -8,8 +8,6 @@
     <Structure name="s">
         <Int32 name="x"/>
         <Int32 name="y"/>
-        <Map name="/s.x"/>
-        <Map name="/s.y"/>
     </Structure>
     <Attribute name="_DAP4_Little_Endian" type="UInt8">
         <Value value="1"/>
diff --git a/dap4_test/nctestfiles/CMakeLists.txt b/dap4_test/nctestfiles/CMakeLists.txt
index d46021e..2332d8f 100644
--- a/dap4_test/nctestfiles/CMakeLists.txt
+++ b/dap4_test/nctestfiles/CMakeLists.txt
@@ -2,5 +2,5 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
 
 FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
-SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
+SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt)
 ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
diff --git a/dap4_test/nctestfiles/test_atomic_array.nc b/dap4_test/nctestfiles/test_atomic_array.nc
index b8b9272..076337b 100644
Binary files a/dap4_test/nctestfiles/test_atomic_array.nc and b/dap4_test/nctestfiles/test_atomic_array.nc differ
diff --git a/dap4_test/nctestfiles/test_atomic_types.nc b/dap4_test/nctestfiles/test_atomic_types.nc
index dc66596..335845c 100644
Binary files a/dap4_test/nctestfiles/test_atomic_types.nc and b/dap4_test/nctestfiles/test_atomic_types.nc differ
diff --git a/dap4_test/nctestfiles/test_unlim1.nc b/dap4_test/nctestfiles/test_unlim1.nc
index 45b8ea8..c9f5d85 100644
Binary files a/dap4_test/nctestfiles/test_unlim1.nc and b/dap4_test/nctestfiles/test_unlim1.nc differ
diff --git a/dap4_test/test_data.sh b/dap4_test/test_data.sh
index 277c1df..750a62a 100755
--- a/dap4_test/test_data.sh
+++ b/dap4_test/test_data.sh
@@ -5,6 +5,8 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 
 . ${srcdir}/d4test_common.sh
 
+echo "test_data.sh:"
+
 cd ${DAPTESTFILES}
 F=`ls -1 *.dap | sed -e 's/[.]dap//g' | tr '\r\n' '  '`
 cd $WD
diff --git a/dap4_test/test_meta.sh b/dap4_test/test_meta.sh
index d659fdc..86b2b09 100755
--- a/dap4_test/test_meta.sh
+++ b/dap4_test/test_meta.sh
@@ -5,6 +5,8 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 
 . ${srcdir}/d4test_common.sh
 
+echo "test_meta.sh:"
+
 cd ${DMRTESTFILES}
 F=`ls -1 *.dmr | sed -e 's/[.]dmr//g' | tr '\r\n' '  '`
 cd $WD
@@ -15,7 +17,7 @@ STEM=`echo $f | cut -d. -f 1`
 if test -e ${CDLTESTFILES}/${STEM}.cdl ; then
   CDL="${CDL} ${STEM}"
 else
-  echo "Not found: ${CDLTESTFILES}/${STEM}.cdl"
+  echo "Not found: ${CDLTESTFILES}/${STEM}.cdl; ignored"
 fi
 done
 
diff --git a/dap4_test/test_parse.sh b/dap4_test/test_parse.sh
index a21aea5..2b75fc1 100755
--- a/dap4_test/test_parse.sh
+++ b/dap4_test/test_parse.sh
@@ -5,6 +5,8 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 
 . ${srcdir}/d4test_common.sh
 
+echo "test_parse.sh:"
+
 cd ${DMRTESTFILES}
 F=`ls -1 *.dmr | sed -e 's/[.]dmr//' |tr '\r\n' '  '`
 cd $WD
diff --git a/dap4_test/test_raw.sh b/dap4_test/test_raw.sh
index 5d0c270..38df2e4 100755
--- a/dap4_test/test_raw.sh
+++ b/dap4_test/test_raw.sh
@@ -5,6 +5,8 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 
 . ${srcdir}/d4test_common.sh
 
+echo "test_raw.sh:"
+
 # Compute the set of testfiles
 PUSHD ${srcdir}/daptestfiles
 F=`ls -1d *.dap`
diff --git a/dap4_test/test_remote.sh b/dap4_test/test_remote.sh
index e37ea00..d4ea148 100755
--- a/dap4_test/test_remote.sh
+++ b/dap4_test/test_remote.sh
@@ -5,6 +5,8 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 
 . ${srcdir}/d4test_common.sh
 
+echo "test_remote.sh:"
+
 #BIG=1
 #NOCSUM=1
 
diff --git a/depcomp b/depcomp
index fc98710..b39f98f 100755
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2013-05-30.07; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 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
@@ -786,6 +786,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/docs/Doxyfile.developer b/docs/Doxyfile.developer
index df79acb..68e8b66 100644
--- 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.5.0-rc1
+PROJECT_NUMBER         = 4.5.0-rc2
 
 # 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/Makefile.am b/docs/Makefile.am
index 4d8f7e5..fcf6be6 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -10,7 +10,7 @@ EXTRA_DIST = netcdf.m4 DoxygenLayout.xml Doxyfile.in footer.html \
     architecture.dox internal.dox windows-binaries.md \
     building-with-cmake.md CMakeLists.txt \
     groups.dox install.md notes.md install-fortran.md \
-    all-error-codes.md cmake_faq.md credits.md software.md \
+    all-error-codes.md cmake_faq.md credits.md \
     auth.html obsolete/fan_utils.html bestpractices.md
 
 # Turn off parallel builds in this directory.
diff --git a/docs/Makefile.in b/docs/Makefile.in
index ea06621..31c6362 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -370,7 +370,7 @@ EXTRA_DIST = netcdf.m4 DoxygenLayout.xml Doxyfile.in footer.html \
     architecture.dox internal.dox windows-binaries.md \
     building-with-cmake.md CMakeLists.txt \
     groups.dox install.md notes.md install-fortran.md \
-    all-error-codes.md cmake_faq.md credits.md software.md \
+    all-error-codes.md cmake_faq.md credits.md \
     auth.html obsolete/fan_utils.html bestpractices.md
 
 
diff --git a/docs/images/Makefile.in b/docs/images/Makefile.in
index d39305b..01a5d7c 100644
--- a/docs/images/Makefile.in
+++ b/docs/images/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/docs/install.md b/docs/install.md
index fd70e05..ad1299a 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -118,7 +118,7 @@ Next, specify where you want to install HDF5 in another shell variable, for exam
 ~~~~{.py}
     $ # Build and install HDF5
     $ H5DIR=/usr/local
-    $ ./configure --with-zlib=${ZDIR} --prefix=${H5DIR}
+    $ ./configure --with-zlib=${ZDIR} --prefix=${H5DIR} --eanble-hl
     $ make check
     $ make install   # or sudo make install, if root permissions required
 ~~~~
diff --git a/docs/software.md b/docs/software.md
deleted file mode 100644
index ac42931..0000000
--- a/docs/software.md
+++ /dev/null
@@ -1,2580 +0,0 @@
-Software for Manipulating or Displaying NetCDF Data {#software}
-===================================================
-
-[TOC]
-
-This document provides references to software packages that may be used for manipulating or displaying [netCDF](/software/netcdf/) data. We include information about both freely-available and licensed (commercial) software that can be used with netCDF data. We rely on developers to help keep this list up-to-date. If you know of corrections or additions, please [send them to us (mailto:support at unidata.ucar.edu). Where practical, we would like to include WWW links to information about thes [...]
-
-Other useful guides to utilities that can handle netCDF data include ARM's list of [ARM-tested netCDF data tools](http://science.arm.gov/%7ecflynn/ARM_Tested_Tools/), which includes some downloadable binaries and the NOAA Geophysical Fluid Dynamics Laboratory [guide to netCDF utilities](http://nomads.gfdl.noaa.gov/sandbox/products/vis/data/netcdf/GFDL_VG_NetCDF_Utils.html).
-
-------------------------------------------------------------------------
-
-
-Freely Available Software {#freely}
-=========================
-
-ANDX and ANAX {#ANDX}
-------------------------------------
-
-The ARM Program has developed [ANDX (ARM NetCDF Data eXtract)](http://engineering.arm.gov/~sbeus/andx-web/html/), a command-line utility designed for routine examination and extraction of data from netcdf files. Data can be displayed graphically (line-plot, scatter-plot, overlay, color-intensity, etc.) or extracted as ASCII data. Whether displayed graphically or extracted as ASCII, results can be saved to disk or viewed on screen.
-
-[ANAX (ARM NetCDF ASCII eXtract)](http://science.arm.gov/~cflynn/ARM_Tested_Tools/) is a scaled-down version of ANDX -- it is designed to only extract ASCII data. All features of ANDX pertaining to non-graphic data extraction are included in ANAX.
-
-ANTS {#ANTS}
----------------------------
-
-The ARM Program has developed [ANTS (ARM NetCDF Tool Suite)](http://science.arm.gov/~cflynn/ANTS/), a collection of netCDF tools and utilities providing various means of creating and modifying netcdf files. ANTS is based on nctools written by Chuck Denham. The utilities within nctools were modified to compile with version 3.5 of the netCDF library, the command syntax was modified for consistency with other tools, and changes were made to accommodate ARM standard netCDF.
-
-The original functions from nctools were intended mainly for the creation, definition, and copying of fundamental netCDF elements. ARM added others which focus on manipulation of data within existing netCDF files. Additional functions have special support for multi-dimensional data such as "slicing" cross sections from multi-dimensional variable data or joining lesser-dimensional fields to form multi-dimensional structures. Functions have been added to support execution of arithmetic and [...]
-
-Essentially every type of netCDF library function call is exercised in ANTS. In this way then, this open-source collection of tools also represents a library of coding examples for fundamental netCDF tasks. See the [website](http://science.arm.gov/~cflynn/ANTS/) for more information.
-
-ARGOS {#ARGOS}
------------------------------
-
-[ARGOS](http://www.lapeth.ethz.ch/argos/index.html) (interActive thRee-dimensional Graphics ObServatory) is a new IDL-based interactive 3D visualization tool, developed by [David N. Bresch](http://www.lapeth.ethz.ch/~david/index.html) and [Mark A. Liniger](http://www.lapeth.ethz.ch/~mark/index.html) at the Institute for Atmospheric Science at the Swiss Federal Institute of Technology, ETH, Zürich.
-
-A highly optimized graphical user interface allows quick and elegant creation of even complex 3D graphics (volume rendering, isosurfaces,...), including Z-buffered overlays (with hidden lines), light and data shading, Xray images, 3D trajectories, animations and virtual flights around your data, all documented in a full on-line [html-help](http://www.lapeth.ethz.ch/argos/argos_general.html). The netCDF data format is preferred, but any other format can be read by providing an IDL (or FOR [...]
-
-Information about [copyright and licensing conditions](http://www.lapeth.ethz.ch/argos/argos_copyright.html) are available. For further information and installation, please E-mail to: bresch at atmos.umnw.ethz.ch
-
-CDAT {#CDAT}
----------------------------
-
-The [Climate Data Analysis Tool (CDAT)](http://cdat.sf.net), developed
-by the [Program for Climate Model Diagnosis and Intercomparison
-(PCMDI)](http://www-pcmdi.llnl.gov/) at Lawrence Livermore National
-Laboratory, provides the capabilities needed to analyze model data,
-perform complex mathematical calculations, and graphically display the
-results. It provides the necessary tools to diagnose, validate, and
-intercompare large observational and global climate model data sets.
-It includes the ability to ingest large climate datasets in netCDF, HDF,
-DRS, and GrADS/GRIB format; the Visualization and Computation System
-(VCS) module, visually displays and animates ingested or created data;
-and the Library of AMIP Data Transmission Standards (LATS) module
-outputs data in the machine-independent netCDF or GrADS/GRIB file
-formats.
-
-In addition, the Command Line Interface (CLI) module allows CDAT to
-receive argument and function input via the command line, and the
-Graphical User Interface (GUI) allows CDAT to receive argument and
-function input via a point-and-click environment.
-
-The software, which runs as a standalone process or within PCMDI's
-Visualization and Computation System (VCS), provides climate scientists
-with an easy and fast method to read different file formats, and to
-analyze and graphically display climate data in an integrated fashion.
-CDAT includes a set of pre-defined functions to allow the user to
-manipulate the data and send the output to a file which can be viewed as
-an image, or as a collection of images in an animation. The software has
-a gradual learning curve, allowing the novice user to quickly obtain
-useful results.
-
-CDFconvert {#CDFconvert}
----------------------------------------
-
-The [MRG CDFconvert
-package](http://www.atmos.albany.edu/facstaff/rmctc/cdf_cvt/) provided
-by the Mesoscale Research Group, McGill University/SUNY Albany, is
-designed to address data conversion issues for gridded datasets stored
-under the
-[COARDS](http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html)
-convention. CDFconvert converts regular Cylindrical Equidistant
-(Lat/Long) and Gaussian (Spherical) netCDF grids into either the
-Canadian [RPN Standard
-File](http://www.cmc.ec.gc.ca/rpn/modcom/si/libraries/rmnlib/fstd/index.html)
-or [GEMPAK](/software/gempak/index.html) file formats. MRG CDFconvert
-has the flexibility to handle netCDF files generated by a number of
-sources, including NCEP and ECMWF. User-definable conversion tables make
-the extension of the package to different datasets possible.
-
-cdfsync {#cdfsync}
----------------------------------
-
-Joe Sirott of NOAA's Pacific Marine Environmental Laboratory has
-developed cdfsync, a program that allows users to rapidly synchronize a
-set of netCDF files over a network. Fast synchronization times are
-achieved by only transmitting the differences between files. It is built
-on the Open Source [rsync](http://samba.anu.edu.au/rsync/) program, but
-contains a number of optimizations including:
-
--   Special handling of netCDF files for faster synchronization
-    calculations
--   Much faster updates of large numbers of small netCDF files
--   In-place updates of large netCDF files
-
-The latest version should run on Linux variants and Solaris.
-
-More information is available at the [cdfsync
-website](http://www.epic.noaa.gov/epic/software/cdfsync/).
-
-CDO (Climate Data Operators) {#CDO}
---------------------------------------------------
-
-Uwe Schulzweida at the Max Planck Institute for Meteorology has
-developed [CDO](http://code.zmaw.de/projects/cdo), a collection of
-Operators to manipulate and analyze Climate Data files. Supported file
-formats include netCDF and GRIB. There are more than 350 operators
-available. The following table provides a brief overview of the main
-categories.
-
--   File information (info, sinfo, diff, ...)
--   File operations (copy, cat, merge, split\*, ...)
--   Selection (selcode, selvar, sellevel, seltimestep, ...)
--   Missing values (setctomiss, setmisstoc, setrtomiss)
--   Arithmetic (add, sub, mul, div, ...)
--   Mathematical functions (sqrt, exp, log, sin, cos, ...)
--   Comparison (eq, ne, le, lt, ge, gt, ...)
--   Conditions (ifthen, ifnotthen, ifthenc, ifnotthenc)
--   Field statistics (fldsum, fldavg, fldstd, fldmin, fldmax, ...)
--   Vertical statistics (vertsum, vertavg, vertstd, vertmin, ...)
--   Time range statistics (timavg, yearavg, monavg, dayavg, ...)
--   Field interpolation (remapbil, remapcon, remapdis, ...)
--   Vertical interpolation (ml2pl, ml2hl)
--   Time interpolation (inttime, intyear)
-
-As an example of use of CDO, converting from GRIB to netCDF can be as
-simple as
-
-        cdo -f nc copy file.grb file.nc
-
-or with relative time axis (for usage with GrADS)
-        cdo -r -f nc copy file.grb file.nc
-
-or using ECMWF reanalysis on a reduced grid
-        cdo -R -f nc copy file.grb file.nc
-
-More information is available on the [CDO
-homepage](http://code.zmaw.de/projects/cdo).
-
-CIDS Tools {#CIDS_Tools}
----------------------------------------
-
-The Center for Clouds Chemistry and Climate
-([C4](http://www-c4.ucsd.edu/)) Integrated Data Systems
-([CIDS](http://www-c4.ucsd.edu/~cids/)) group has developed several
-useful netCDF utilities:
--   cdf2idl: Writes an IDL script to read a NetCDF file.
--   cdf2c: Writes C code to read a NetCDF file.
--   cdf2fortran: Writes FORTRAN source code to read a NetCDF file.
--   cdf2asc: Dumps NetCDF data to an ASCII file.
-
-The source for these utilities can be downloaded from [CIDS NetCDF
-Visualization Tools
-site](http://www-c4.ucsd.edu/~cids/software/visual.html).
-
-CSIRO MATLAB/netCDF interface {#CSIRO-MATLAB}
-------------------------------------------------------------
-
-The [CSIRO MATLAB/netCDF interface](http://www.marine.csiro.au/sw/matlab-netcdf.html) is now
-available from the [CSIRO Marine Laboratories](http://www.marine.csiro.au).
-The CSIRO MATLAB/netCDF interface is run from within MATLAB and has a
-simple syntax. It has options for automatically handling missing values,
-scale factors, and permutation of hyperslabs. It is, however, limited to
-retrieving data from, and information about, existing netCDF files.
-
-The basis of the interface is a machine-dependent mex-file called
-mexcdf53. Rather than call the mex-file directly users are advised to
-employ both [Chuck Denham's netCDF toolbox](#NC4ML5) and the CSIRO
-MATLAB/netCDF interface described here. For read-only access to existing
-netCDF data, the CSIRO interface has a simpler syntax than the netCDF
-Toolbox, but the latter may also be used to create and manipulate netCDF
-variables and datasets.
-
-EPIC {#EPIC}
----------------------------
-
-NOAA's Pacific Marine Environmental Laboratory
-([PMEL](http://www.pmel.noaa.gov/)) has developed the
-[EPIC](http://www.pmel.noaa.gov/epic/) software package for
-oceanographic data. EPIC provides graphical display and data field
-manipulation for multi-dimensional netCDF files (up to 4 dimensions).
-PMEL has been using this software on Unix and VMS several years. At
-present, they have:
-
--   a data file I/O library (
-    [epslib](http://www.pmel.noaa.gov/epic/eps-manual/epslib_toc.html),
-    which is layered on top of the netCDF library).
--   epslib allows transparent access to multiple data file formats
--   a [MATLAB MexEPS
-    interface](http://www.epic.noaa.gov/epic/software/mexeps.htm) for
-    using any supported EPIC file with MATLAB
--   [suite of EPIC
-    programs](http://www.epic.noaa.gov/epic/software/ep_programs.htm)
-    for graphics and analysis of hydrographic profile data and time
-    series data.
-
-This software was developed on Sun/Unix and is also supported for
-DEC/Ultrix and VAX/VMS as a system for data management, display and
-analysis system for observational oceanographic time series and
-hydrographic data. The EPIC software includes over 50 programs for
-oceanographic display and analysis, as well as utilities for putting
-in-situ or observational data on-line (with on-the-fly graphics and data
-download) on the WWW.
-The developers are interested in coordinating with others who may be
-developing oceanographic software for use with netCDF files. The EPIC
-software is available via anonymous FTP from ftp.noaapmel.gov in the
-epic/ and /eps directories. To obtain the EPIC software, please see Web
-pages at <http://www.pmel.noaa.gov/epic/download/index.html>. For
-information about EPIC, please see the Web pages at
-<http://www.pmel.noaa.gov/epic/index.html>. Contact epic at pmel.noaa.gov,
-or Nancy Soreide, nns at noaapmel.gov, for more information.
-
-Excel Use
-------------------------------------
-
-Several packages are available for accessing netCDF data from Microsoft
-Excel, including the [netcdf4excel](#netcdf4excel) add-in for Excel, and
-a [Scientific Dataset (SDS) Library](#SDS) that supports a DataSetEditor
-add-in for Excel to view and modify various forms of data, including
-netCDF.
-
-EzGet {#EzGet}
------------------------------
-
-A FORTRAN library called
-[EzGet](http://www-pcmdi.llnl.gov/ktaylor/ezget/ezget.html) has been
-developed at [PCMDI](http://www-pcmdi.llnl.gov/PCMDI.html) to facilitate
-retrieval of modeled and observed climate data stored in popular formats
-including [DRS](http://www-pcmdi.llnl.gov/drach/DRS.html),
-[netCDF](/software/netcdf/), [GrADS](http://grads.iges.org/grads), and,
-if a control file is supplied,
-[GRIB](ftp://nic.fb4.noaa.gov/pub/nws/nmc/docs/gribed1/). You can
-specify how the data should be structured and whether it should undergo
-a grid transformation before you receive it, even when you know little
-about the original structure of the stored data (e.g., its original
-dimension order, grid, and domain).
-The EzGet library comprises a set of subroutines that can be linked to
-any FORTRAN program. EzGet reads files through the
-[cdunif](http://www-pcmdi.llnl.gov/drach/cdunif.html) interface, but use
-of EzGet does not require familiarity with cdunif. The main advantages
-of using EzGet instead of the lower level cdunif library include:
-
--   Substantial error trapping capabilities and detailed error messages
--   Versatile capability of conveniently selecting data from specified
-    regions (e.g., oceans, North America, all land areas north of 45
-    degrees latitude, etc.)
--   Ability to map data to a new grid at the time it is retrieved by
-    EzGet
--   Automatic creation of \`\`weights'' for use in subsequent averaging
-    or masking of data
--   Increased control in specifying the domain of the data to be
-    retrieved.
-
-For more information about EzGet, including instructions for downloading
-the documentation or software, see the EzGet home page at
-<http://www-pcmdi.llnl.gov/ktaylor/ezget/ezget.html>. For questions or
-comments on EzGet, contact Karl Taylor (taylor13 at llnl.gov).
-
-FAN
--------------------------
-
-[FAN (File Array Notation)](fan_utils.html) is Harvey
-Davies' package for extracting and manipulating array data from netCDF
-files. The package includes the three utilities nc2text, text2nc, and
-ncrob for printing selected data from netCDF arrays, copying ASCII data
-into netCDF arrays, and performing various operations (sum, mean, max,
-min, product, ...) on netCDF arrays. A library (fanlib) is also included
-that supports the use of FAN from C programs. The package is available
-via anonymous FTP from
-<ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/fan.tar.Z>. Questions and
-comments may be sent to Harvey Davies, harvey.davies at csiro.au.
-
-FERRET {#FERRET}
--------------------------------
-
-[FERRET](http://ferret.wrc.noaa.gov/Ferret/) is an interactive computer
-visualization and analysis environment designed to meet the needs of
-oceanographers and meteorologists analyzing large and complex gridded
-data sets. It is available by anonymous ftp from abyss.pmel.noaa.gov for
-a number of computer systems: SUN (Solaris and SUNOS), DECstation
-(Ultrix and OSF/1), SGI, VAX/VMS and Macintosh (limited support), and
-IBM RS-6000 (soon to be released).
-FERRET offers a Mathematica-like approach to analysis; new variables may
-be defined interactively as mathematical expressions involving data set
-variables. Calculations may be applied over arbitrarily shaped regions.
-Fully documented graphics are produced with a single command. Graphics
-styles included line plots, scatter plots, contour plots, color-filled
-contour plots, vector plots, wire frame plots, etc. Detailed controls
-over plot characteristics, page layout and overlays are provided. NetCDF
-is supported both as an input and an output format.
-
-Many excellent software packages have been developed recently for
-scientific visualization. The features that make FERRET distinctive
-among these packages are Mathematica-like flexibility, geophysical
-formatting (latitude/longitude/date), "intelligent" connection to its
-data base, special memory management for very large calculations, and
-symmetrical processing in 4 dimensions. Contact Steve Hankin,
-hankin at noaapmel.gov, for more information.
-
-Fimex {#fimex}
------------------------------
-
-Heiko Klein (Norwegian Meteorological Institute) has developed the
-[fimex](https://wiki.met.no/fimex/start) (File Interpolation,
-Manipulation, and EXtraction) C++ library for gridded geospatial data.
-It converts between several data formats (currently netCDF, NcML, GRIB1
-or GRIB2, and felt). Fimex also enables you to change the projection and
-interpolation of scalar and vector grids, to subset the gridded data,
-and to extract only parts of the files. Fimex supports a growing list of
-other [features](https://wiki.met.no/fimex/features), including support
-for most NcML features and for netCDF-4 compression.
-
-For simple usage, Fimex also comes with the command line program fimex.
-
-Documentation and downloads are available from the [fimex web
-site](http://wiki.met.no/fimex/).
-
-FWTools (GIS Binary Kit for Windows and Linux) {#fwtools}
-------------------------------------------------------------------------
-
-[FWTools](http://fwtools.maptools.org/) is Frank Warmerdam's set of Open
-Source GIS binaries for Windows (win32) and Linux (x86 32bit) systems.
-The kits are intended to be easy for end users to install and get going
-with, and include OpenEV, GDAL, MapServer, PROJ.4 and OGDI as well as
-some supporting components. FWTools aims to track the latest development
-versions of the packages included as opposed to official releases, "to
-give folks a chance to use the *latest and greatest*".
-
-GDAL {#GDAL}
----------------------------
-
-Frank Warmerdam's [GDAL](http://www.remotesensing.org/gdal/index.html)
-is a translator library for raster geospatial data formats that is
-released under an X/MIT style Open Source license. As a library, it
-presents a [single abstract data
-model](http://www.remotesensing.org/gdal/gdal_datamodel.html) to the
-calling application for all supported formats. The related
-[OGR](http://www.remotesensing.org/gdal/ogr) library (which lives within
-the GDAL source tree) provides a similar capability for simple features
-vector data.
-
-GDAL is in active use in several projects, and includes roughly 40
-format drivers, including a translator for netCDF (read/write). Other
-translators include GeoTIFF (read/write), Erdas Imagine (read/write),
-ESRI .BIL (read), .aux labeled raw (read/write), DTED (read), SDTS DEM
-(read), CEOS (read), JPEG (read/write), PNG (read/write), Geosoft GXF
-(read) and Arc/Info Binary Grid (read). A full list is available in
-[Supported
-Formats](http://www.remotesensing.org/gdal/formats_list.html).
-
-GDAL has recently included support for the netCDF-4 enhanced data model
-and netCDF-4 format, as well as improved support for recent additions to
-the CF conventions.
-
-As an example of the use of GDAL, converting an ArcInfo ASCII grid to
-netCDF (GMT conventions) as easy as:
-
-       gdal_translate arc_ascii.grd -of GMT gmt_grid.nc
-
-GDL (GNU Data Language) {#GDL}
----------------------------------------------
-
-[GDL](http://gnudatalanguage.sourceforge.net/) is a free implementation
-of most of the programming language supported by [IDL](#IDL)
-(Interactive Data Language). GDL supports the netCDF-3 API.
-
-Gfdnavi (Geophysical fluid data navigator) {#Gfdnavi}
---------------------------------------------------------------------
-
-[Gfdnavi](http://www.gfd-dennou.org/arch/davis/gfdnavi/index.en.htm) is
-a web-based tool to archive, share, distribute, analyze, and visualize
-geophysical fluid data and knowledge. The software is under development
-by members of the GFD Dennou Club, including T. Horinouchi (RISH, Kyoto
-U.), S. Nishizawa (RIMS, Kyoto U.), and colleagues. Gfdnavi uses a
-metadata database for managing and analyzing data and visualizations. It
-also permits publishing data for web access and will soon support access
-to data on other Gfdnavi servers. Web service APIs are now under
-development. A presentation [Introducing
-Gfdnavi](http://www.gfd-dennou.org/arch/davis/gfdnavi/presen/2007-03-05_GfdnaviIntro.En/pub/)
-describes the architecture and shows examples of use.
-
-Gfdnavi is dependent on two technologies:
-
--   [Ruby on Rails](http://www.rubyonrails.com/), a framework for web
-    applications, and
--   [the Dennou Ruby Project](http://ruby.gfd-dennou.org/), a collection
-    of tools for geophysical data. These tools include
-    [GPhys](http://ruby.gfd-dennou.org/products/gphys/) software to
-    handle GRIB, GrADS, and netCDF data uniformly.
-
-As an example of this technology, Takuji Kubota has established [a
-Gfdnavi server](http://www.gsmap.aero.osakafu-u.ac.jp/gfdnavi/) for the
-Global Satellite Mapping of Precipitation
-([GSMaP](http://www.radar.aero.osakafu-u.ac.jp/~gsmap/index_english.html))
-project.
-
-GMT {#GMT}
--------------------------
-
-[GMT](http://gmt.soest.hawaii.edu/) (Generic Mapping Tools) is an open
-source collection of about 60 tools for manipulating geographic and
-Cartesian data sets (including filtering, trend fitting, gridding,
-projecting, etc.) and producing Encapsulated PostScript File (EPS)
-illustrations ranging from simple x-y plots via contour maps to
-artificially illuminated surfaces and 3-D perspective views. GMT
-supports 30 map projections and transformations and comes with support
-data such as coastlines, rivers, and political boundaries. GMT is
-developed and maintained by Paul Wessel and Walter H. F. Smith with help
-from a global set of volunteers, and is supported by the National
-Science Foundation. It is released under the GNU General Public License.
-
-The package can access COARDS-compliant netCDF grids as well as ASCII,
-native binary, or user-defined formats. The GMT package is available via
-anonymous ftp from several servers; see
-[gmt.soest.hawaii.edu](http://gmt.soest.hawaii.edu) for installation
-information.
-
-Grace {#Grace}
------------------------------
-
-[Grace](http://plasma-gate.weizmann.ac.il/Grace/) is a tool to make
-two-dimensional plots of scientific data, including 1D netCDF variables.
-It runs under the X Window System and OSF Motif (recent versions of
-LessTif are, by and large, fine, too). Grace runs on practically any
-version of Unix. As well, it has been successfully ported to VMS, OS/2
-and Win9\*/NT (some functionality may be missing, though). Grace is a
-descendant of ACE/gr.
-A few features of Grace are:
-
--   User defined scaling, tick marks, labels, symbols, line styles,
-    colors.
--   Batch mode for unattended plotting.
--   Read and write parameters used during a session.
--   Regressions, splines, running averages, DFT/FFT,
-    cross/auto-correlation, ...
--   Support for dynamic module loading.
--   Hardcopy support for PostScript, PDF, GIF, and PNM formats.
--   Device-independent Type1 font rastering.
--   Ability to read or write netCDF data.
-
-GrADS {#GrADS}
------------------------------
-
-[GrADS](http://grads.iges.org/grads/grads.html) (Grid Analysis and
-Display System) is an interactive desktop tool from
-[COLA/IGES](http://grads.iges.org/cola.html) that is currently in use
-worldwide for the analysis and display of earth science data. GrADS is
-implemented on all commonly available UNIX workstations, Apple
-Macintosh, and DOS or Linux based PCs, and is freely available via
-anonymous ftp. GrADS provides an integrated environment for access,
-manipulation, and display of earth science data in several forms,
-including GRIB and netCDF. For more information, see the [GrADS User's
-Guide](http://grads.iges.org/grads/gadoc/users.html).
-
-Gri
--------------------------
-
-Gri is an extensible plotting language for producing scientific graphs,
-such as x-y plots, contour plots, and image plots. Dan Kelley of
-Dalhousie University is the author of Gri, which can read data from
-netCDF files as well as ASCII and native binary data. For more
-information on Gri, see the URL <http://gri.sourceforge.net/>.
-
-GXSM {#GXSM}
----------------------------
-
-The GXSM is the Gnome X Scanning Microscopy project, it is a bit more
-than just a piece of software (the GXSM itself), there is full hardware
-support for DSP cards including open source DSP software and a growing
-set of SPM related electronics. For more information, see
-<http://gxsm.sourceforge.net/>.
-
-HDF interface {#HDF_interface}
----------------------------------------------
-
-The National Center for Supercomputing Applications (NCSA) has added the
-netCDF interface to their [Hierarchical Data Format
-(HDF)](http://hdf.ncsa.uiuc.edu/) software. HDF is an extensible data
-format for self-describing files. A substantial set of applications and
-utilities based on HDF is available; these support raster-image
-manipulation and display and browsing through multidimensional
-scientific data. An implementation is now available that provides the
-netCDF interface to HDF. With this software, it is possible to use the
-netCDF calling interface to place data into an HDF file. The netCDF
-calling interface has not changed and netCDF files stored in XDR format
-are readable, so existing programs and data will still be usable
-(although programs will need to be relinked to the new library). There
-is currently no support for the mixing of HDF and netCDF structures. For
-example, a raster image can exist in the same file as a netCDF object,
-but you have to use the Raster Image interface to read the image and the
-netCDF interface to read the netCDF object. The other HDF interfaces are
-currently being modified to allow multi-file access, closer integration
-with the netCDF interface will probably be delayed until the end of that
-project.
-Eventually, it will be possible to integrate netCDF objects with the
-rest of the HDF tool suite. Such an integration will then allow tools
-written for netCDF and tools written for HDF to both interact
-intelligently with the new data files.
-
-HDF-EOS to netCDF converter {#HDF-EOS}
------------------------------------------------------
-
-The Goddard Earth Sciences Data and Information Services Center ([GES
-DISC](http://disc.gsfc.nasa.gov)) has developed an on-the-fly HDF-EOS to
-netCDF/CF converter for the following products, making them easier to
-use in the [Unidata IDV](#IDV) and
-[McIDAS-V](http://www.ssec.wisc.edu/mcidas/software/v/):
-
--   AIRS Level 2 (scene) profiles of moisture, air temperature and trace
-    gases
--   AIRS Level 3 (global grid) profiles of moisture, air temperature and
-    trace gases
--   OMI UV-B at the surface
--   TOMS ozone and aerosols
-
-[Instructions](http://disc.gsfc.nasa.gov/services/NetCDFConversionforIDVandMcIDAS-V.shtml)
-are available for searching and converting these data. More information
-on AIRS products is available at
-<http://disc.gsfc.nasa.gov/AIRS/index.html>.
-
-HIPHOP {#HIPHOP}
--------------------------------
-
-[HIPHOP](http://www.knmi.nl/onderzk/atmosam/English/Service/hiphop/hiphop.html),
-developed by Dominik Brunner, is a widget based IDL application that
-largely facilitates the visualization and analysis of 2D, 3D, and 4D
-atmospheric science data, in particular atmospheric tracer distributions
-and meteorological fields.
-Graphical output of (atmospheric model) data can be quickly generated in
-a large number of different ways, including horizontal maps at selected
-model or pressure levels, vertical north-south, east-west, or slant
-cross-sections (including zonal averages), time slices, animations, etc.
-It also allows mathematical operations on the existing fields to
-generate new fields for further analysis, and it can be run as a batch
-application.
-
-The program handles data in netCDF, HDF and GRIB format. Interfaces to
-other data formats (e.g. ASCII and binary data) can be added easily.
-
-Beginning with Version 4.0, it also supports the ability to overlay
-meteorological fields on a number of different satellite images, and to
-draw air parcel trajectories.
-
-Hyperslab OPerator Suite (HOPS) {#HOPS}
----------------------------------------------------------------------------------
-
-Hyperslab OPerator Suite
-([HOPS](http://www.cgd.ucar.edu/gds/svn/hyperslab.html)), developed by
-R. Saravanan at NCAR, is a bilingual, multi-platform software package
-for processing data in netCDF files conforming to the NCAR-CCM format or
-the NCAR Ocean Model format. HOPS is implemented in [IDL](#IDL), the
-widely-used commercial interpreted language, and also in
-[Yorick](ftp://ftp-icf.llnl.gov/pub/Yorick/), a public-domain
-interpreted language that is freely available from the Lawrence
-Livermore National Laboratory. The IDL version of HOPS should run on any
-platform supported by IDL. The Yorick version too runs on most common
-UNIX platforms, such as Sun, SGI, Cray, and LINUX computers.
-HOPS is not a monolithic program, but a suite of operators that act on
-data units called "hyperslabs". The design of HOPS is object-oriented,
-rather than procedure-oriented; the operators treat the numeric data and
-the associated meta-data (like coordinate information) as a single
-object.
-
-Note that HOPS is not a general purpose netCDF utility and works only
-for the NCAR CSM netCDF formats. For more information, check the [HOPS
-home page](http://www.cgd.ucar.edu/gds/svn/hyperslab.html).
-
-iCDF (imports chromatographic netCDF data into MATLAB) {#iCDF}
------------------------------------------------------------------------------
-
-Klavs M. Sørensen, Thomas Skov and Rasmus Bro (Faculty of Life Sciences,
-University of Copenhagen) have developed
-[iCDF](http://www.models.life.ku.dk/source/iCDF/index.asp), a free and
-documented toolbox for importing chromatographic data in the
-netCDF-based format that most manufacturers of chromatographic software
-support.
-
-The iCDF software is currently for XC-MS data (X: GC, LC, HPLC), but
-soon it will be able to import data using other detectors as well. It
-can be used to open netCDF files from many different instruments (e.g.
-Agilent, Bruker) and many chromatographic software packages (e.g.
-ChemStation).
-
-For more information, see the paper
-
-> Skov T and Bro R. (2008) Solving fundamental problems in
-> chromatographic analysis Analytical and Bioanalytical Chemistry, 390
-> (1): 281-285.
-
-IDV (Integrated Data Viewer) {#IDV}
---------------------------------------------------
-
-Unidata's [Integrated Data Viewer (IDV)](/software/idv/) is a Java
-application (for Java 1.4 or later) that can be used to display a
-variety of netCDF files, particularly well formatted, geolocated
-datasets. Features include:
-
--   Access to local and remote netCDF files and a variety of [other data
-    formats](/software/idv/docs/userguide/data/DataSources.html)
--   Slicing and probing of multidimensional data
--   Support for netCDF conventions (CF, COARDS, NUWG, AWIPS)
--   InstallAnywhere installers for easy download and installation
--   Save display state to a bundle for easy recreation of views
--   Support for non-gridded data through the [Common Data Model
-    (CDM)](/software/netcdf-java/CDM/)
-
-The IDV uses the [VisAD Java
-library](http://www.ssec.wisc.edu/~billh/visad.html) for interactive and
-collaborative visualization and analysis and the [netCDF Java
-library](/software/netcdf-java/) for reading and manipulating netCDF
-files.
-
-Ingrid {#Ingrid}
--------------------------------
-
-[Ingrid](http://ingrid.ldgo.columbia.edu/), by M. Benno Blumenthal
-\<benno at ldeo.columbia.edu\>, is designed to manipulate large datasets
-and model input/output. It can read data from its data catalog, a netCDF
-file, or a directly attached model, and output the data, either by
-feeding it to a model, creating a netCDF file, or creating plots and
-other representations of the data.
-
-Ingrid has a number of filters which allow simple data manipulations,
-such as adding two datasets together, smoothing, averaging, and
-regridding to a new coordinate. In addition to netCDF, it also reads
-HDF, CDF, VOGL, and SGI GL.
-
-Ingrid is currently running as a WWW daemon that can be accessed through
-<http://rainbow.ldgo.columbia.edu/datacatalog.html> to see some of its
-capabilities on a climate data catalog maintained by the [Climate
-Group](http://rainbow.ldeo.columbia.edu/) of the [Lamont-Doherty Earth
-Observatory](http://www.ldeo.columbia.edu/) of Columbia University. To
-quote the introduction:
-
-> The Data Catalog is both a catalog and a library of datasets, i.e. it
-> both helps you figure out which data you want, and helps you work with
-> the data. The interface allows you to make plots, tables, and files
-> from any dataset, its subsets, or processed versions thereof.
->
-> This data server is designed to make data accessible to people using
-> WWW clients (viewers) and to serve as a data resource for WWW
-> documents. Since most documents cannot use raw data, the server is
-> able to deliver the data in a variety of ways: as data files (netCDF
-> and HDF), as tables (html), and in a variety of plots (line, contour,
-> color, vector) and plot formats (PostScript and gif). Processing of
-> the data, particularly averaging, can be requested as well.
->
-> The Data Viewer in particular demonstrates the power of the Ingrid
-> daemon.
-
-Ingrid currently runs on Linux, for which binaries are available. CVS
-access to the current source can be arranged.
-
- Intel Array Visualizer {#IntelArrayVisualizer}
---------------------------------------------------------------
-
-The [Intel® Array
-Visualizer](http://www.intel.com/cd/software/products/asmo-na/eng/compilers/226277.htm)
-and Intel® Array Viewer are available as [free
-downloads](http://www.intel.com/cd/software/products/asmo-na/eng/compilers/226277.htm)
-for Windows platforms. They offer an application and a set of software
-tools and components, which include C, Fortran, and .Net libraries, for
-developing scientific visualization applications and for creating
-interactive graphs of array data in various formats, including HDF and
-netCDF.
-
-IVE {#IVE}
--------------------------
-
-[IVE (Interactive Visualization
-Environment)](http://www.atmos.washington.edu/ive/) is a software
-package designed to interactively display and analyze gridded data. IVE
-assumes the data to be displayed are contained in one- two-, three- or
-four-dimensional arrays. By default, the numbers within these arrays are
-assumed to represent grid point values of some field variable (such as
-pressure) on a rectangular evenly spaced grid. IVE is, nevertheless,
-capable of displaying data on arbitrary curvilinear grids.
-
-If the data points are not evenly spaced on a rectangular grid, IVE must
-be informed of the grid structure, either by specifying "attributes" in
-the data input or by specifying the coordinate transform in a user
-supplied subroutine. Stretched rectangular grids (which occur when the
-stretching along a given coordinate is a function only of the value of
-that coordinate) can be accommodated by specifying one-dimensional
-arrays containing the grid-point locations along the stretched
-coordinate as part of the IVE input data. Staggered meshes can also be
-accommodated by setting "attributes" in the input data. The structure of
-more complicated curvilinear grids must be communicated to IVE via user
-supplied "transforms," which define the mapping between physical space
-and the array indices.
-
-Since four-dimensional data cannot be directly displayed on a flat
-computer screen, it is necessary to reduced the dimensionality of the
-data before it is displayed. One of IVE's primary capabilities involves
-dimension reduction or "data slicing." IVE allows the user to display
-lower-dimensional subsets of the data by fixing a coordinate or by
-averaging over the coordinate.
-
-IVE currently has the capability to display
-
--   scalar fields as
-    -   2D scalar plots
-    -   1D scalar plots
-    -   vertical soundings
-    -   a single point value
--   vector fields as 2D vector plots
-
-IVE lets you overlay plots, loop plots, and control a wide variety of
-display parameters.
-
-IVE also can perform algebraic computations on the gridded data and can
-calculate derivatives. More complicated computations can be performed in
-user supplied subroutines.
-
-IVE uses NetCDF for the data input format, and uses the [NCAR Graphics
-Library](http://ngwww.ucar.edu/ng/) to produce graphical output. IVE is
-[available](http://www.atmos.washington.edu/ive/getting.html) as source
-via anonymous ftp; and as binary on request for licensees of NCAR
-graphics.
-
-JSON format with the ncdump-json utility {#JSON}
----------------------------------------------------------------
-
-Josep Llodrà has developed a program to output the contents of a
-netCDF-3 or netCDF-4 file in JSON (JavaScript Object Notation). It is
-based on Unidata's NCDUMP utility, and it keeps the original ncdump
-functionality, unless the "-j" option is used to specify JSON output.
-
-The program and source are available from
-<https://github.com/jllodra/ncdump-json> .
-
-Java interface {#Java_interface}
------------------------------------------------
-
-The [NetCDF-Java 4.2 Library](/software/netcdf-java/) is a Java
-interface to netCDF files, as well as to many other types of scientific
-data formats. It is freely available and the source code is released
-under the (MIT-style) netCDF C library license. Previous versions use
-the GNU Lesser General Public License (LGPL).
-
-The library implements a Common Data Model
-([CDM](/software/netcdf-java/CDM/)), a generalization of the netCDF,
-OpenDAP and HDF5 data models. The library is a prototype for the
-netCDF-4 project, which provides a C language API for the "data access
-layer" of the CDM, on top of the HDF5 file format. The NetCDF-Java
-library is a 100% Java framework for *reading* netCDF and other file
-formats into the CDM, as well as *writing* to the netCDF-3 file format.
-The library also implements
-[NcML](http://www.unidata.ucar.edu/software/netcdf/ncml/), which allows
-you to add metadata to CDM datasets, as well as to create virtual
-datasets through aggregation.
-
-Kst (2D plotting tool) {#KST}
---------------------------------------------
-
-[Kst](http://kst-plot.kde.org) is an open-source, cross-platform 2D
-plotting tool focused on performance and ease of use. Packages for
-Windows, various Linux distributions and Mac OS X are
-[available](http://sourceforge.net/projects/kst/files/), as well as the
-complete source code and CMake-based build files. A more detailed
-presentation of Kst can be found on the web page at
-<http://kst-plot.kde.org>, including numerous screenshots and all the
-useful download links.
-
-Kst is characterized by the following features:
-
--   Outstanding performance: curves with millions of points are no
-    problem
--   Plotting of live streams
--   Out-of-the box support for a variety of formats (currently ASCII,
-    netCDF, dirfile, Qimage-supported types, fits images)
--   User-friendly with a modern and consistent user interface
--   A set of unique tools to boost efficiency, including a data import
-    wizard, capacity to edit multiple objects at once or the "Change
-    Data File" tool to compare multiple experiments easily
--   An active community
--   Easily expandable for new data formats or data analysis algorithms
-    thanks to a plugin-based architecture
--   Available on Windows, Linux, and Mac OSX
-
-Labview interface {#Labview-API}
------------------------------------------------
-
-A netCDF Labview interface, implemented in the Labview programming
-language is available. The software includes A graphical user interface
-for editing netCDF data and conversion to other data formats. The
-package was developed and is maintained by L. F. Hwang of Sun Yat-sen
-University in China. For more information and to download the source
-code, see the [NetCDFLabview web
-site](https://sourceforge.net/projects/netcdflabview/).
-
-MBDyn (MultiBody Dynamics) #{MBDyn}
---------------------------------------------------
-
-[MBDyn](http://www.aero.polimi.it/~mbdyn/) is an open-source MultiBody
-Dynamics analysis system developed at the Dipartimento di Ingegneria
-Aerospaziale of the University "Politecnico di Milano", Italy. It uses
-netCDF as its primary output format.
-
-MBDyn features the integrated multidisciplinary analysis of multibody,
-multiphysics systems, including nonlinear mechanics of rigid and
-flexible constrained bodies, smart materials, electric networks, active
-control, hydraulic networks, essential fixed-wing and rotorcraft
-aerodynamics. It allows users to simulate the behavior of heterogeneous
-mechanical, aero-servo-elastic systems based on first principles
-equations. It is being actively developed and used in the aerospace and
-automotive fields for dynamics analysis and simulation of complex
-systems. Dynamic linking of user-defined modules is heavily exploited to
-let users extend the feature library.
-
-Max_diff_nc ${Maxdiffnc}
--------------------------------------------
-
-This is a program which compares two NetCDF files. Variables with the
-same ID in the two files are assumed to be of the same type and have the
-same shape. For each such couple of variables, the program computes the
-maximum of the absolute value of the difference, and the maximum of the
-absolute value of the relative difference. The program also tells you at
-what location (the subscript list of the array) the maximum difference
-is reached.
-
-The web page for this program is:
-<http://web.lmd.jussieu.fr/~lglmd/Max_diff_nc>
-
-This is a freely available tool.
-
-MeteoExplorer {#MeteoExplorer}
----------------------------------------------
-
-[MeteoExplorer](http://www.eastmodelsoft.com/index_en.htm), developed by
-Lianqing Yu at China Meteorological Administration, is a cross-platform
-software application for analyzing and rendering atmospheric science and
-geoscience data. It supports popular data formats including WMO
-GRIB1/GRIB2, NetCDF, and MICAPS, and provides basic GIS functionalities.
-Developed with C++, Meteo Explorer targets multiple computing platforms
-including Microsoft Windows, GNU Linux, and SGI IRIX operating systems.
-
-The primary features include:
-
--   Graphics layer management (navigation and animation)
--   Objective analysis of physical elements in surface or upperair
-    soundings data
--   Isoline analysis and shading of grid field
--   Streamline analysis of wind field
--   Computation of physics elements
--   NetCDF data process and display
--   GRIB1/GRIB2 data process and display
--   MICAPS data process and display
--   Satellite nephogram data display and animation, support AWX, GPF and
-    HDF format
--   Interactive composition of synoptic chart (command undo/redo,
-    automatic save)
--   Map zoom, pan, projection and clipping
--   Full screen display and zoom to area
--   Quick navigation via thumbnail view of graphics layers
--   Save screen shot as image file (support formats: BMP, JPG, PNG)
--   Vector graphics exported to clipboard or saved as EMF file (Windows
-    version only)
--   Remote desktop connection support
--   System configuration (dynamic menu)
--   Fast switch of user interface language on the fly
-
-For more information, please visit [MeteoExplorer's home
-page](http://www.eastmodelsoft.com/software/mexplorer.htm) or contact
-the support staff via meteoexplorer at hotmail.com .
-
-MeteoInfo {#MeteoInfo}
--------------------------------------
-
-For better cross-platform support,
-[MeteoInfo](http://www.meteothinker.com) has recently been re-developed
-using Unidata's NetCDF Java library. MeteoInfo is GIS software for
-visualization and analysis of spatial and meteorological data. The Java
-edition can be run in Windows, Mac OS, Linux, and Unix systems. The
-Groovy script engine was coupled in the software, so users can write
-Groovy script to run the software automatically for analysis with
-complex steps.
-
-Download: <http://www.meteothinker.com/>
-
-Java 6 is needed to run the software.
-
-MexEPS {#MexEPS}
--------------------------------
-
-[PMEL](http://www.pmel.noaa.gov/) has developed a MATLAB interface,
-[MexEPS](http://www.epic.noaa.gov/epic/software/mexeps.htm), which
-supports several netCDF file conventions, including [those adopted by
-PMEL](ftp://ftp.unidata.ucar.edu/pub/netcdf/Conventions/PMEL-EPIC/).
-Many styles of time axes are supported and time manipulation routines
-ease the use of the time axis in MATLAB. The MexEPS package supports the
-following data formats:
--   reading, writing and editing netCDF files;
--   reading and writing Classic EPIC files
--   reading formatted ASCII files
-
-It includes:
--   VARIABLE, AXIS, ATTRIBUTE manipulation routines
--   TIME manipulation
-    -   TIME enters MATLAB as YYMMDDhhmmss.fff
-    -   Can be converted to netCDF udunits time convention (e.g. days
-        *since* 1990-01-01 00:00:00)
--   [MATLAB help](ftp://ftp.pmel.noaa.gov/eps/mexeps/help-m/) and
-    [example scripts](ftp://ftp.pmel.noaa.gov/eps/mexeps/examples/)
-    using MexEPS
--   **ASCII2MAT** mexFunction, which reads a formatted file into MATLAB
-    as a matrix
-
-The MexEPS package is freely available in PMEL's anonymous ftp directory
-<ftp://ftp.pmel.noaa.gov/eps/mexeps/>
-
-If you have any questions or comments, please contact the author, Willa
-Zhu [(willa at pmel.noaa.gov)](mailto:willa at pmel.noaa.gov) or Nancy Soreide
-(nns at pmel.noaa.gov).
-
-MEXNC and SNCTOOLS {#MEXNC}
-------------------------------------------
-
-John Evans of Rutgers University maintains MEXNC and developed SNCTOOLS.
-[MEXNC](http://mexcdf.sourceforge.net/) is a mexfile interface to NetCDF
-files for MATLAB that has roughly a one-to-one equivalence with the C
-API for netCDF.
-[SNCTOOLS](http://mexcdf.sourceforge.net/tutorial/index.html) is a set
-of higher-level m-files that sit atop MEXNC, shielding the user from
-such low level netCDF details as file IDs, variable IDs, and dimension
-IDs. The general philosophy behind SNCTOOLS is providing the ability to
-read and write data without trying to invent a new syntax.
-
-Mirone (Windows MATLAB-based display) {#Mirone}
---------------------------------------------------------------
-
-Joaquim Luis of Universidade do Algarve has developed
-[Mirone](http://w3.ualg.pt/~jluis/mirone/), a Windows MATLAB-based
-framework tool that allows the display and manipulation of a large
-number of grid/images formats through its interface with the
-[GDAL](http://remotesensing.org/gdal/) library. Its main purpose is to
-provide users with an easy-to-use graphical interface to manipulate
-[GMT](http://gmt.soest.hawaii.edu/) grids. In addition it offers a wide
-range of tools dedicated to topics in the earth sciences, including
-tools for multibeam mission planning, elastic deformation studies,
-tsunami propagation modeling, earth magnetic field computations and
-magnetic Parker inversions, Euler rotations and poles computations,
-plate tectonic reconstructions, and seismicity and focal mechanism
-plotting. The high quality mapping and cartographic capabilities for
-which GMT is renowned is guaranteed through Mirone's ability to
-automatically generate GMT cshell scripts and dos batch files.
-
-Although Mirone is written in MATLAB, a stand-alone version to run under
-Windows is also provided. Regrettably this version is not as efficient
-as the native MATLAB code but provides a solution for users that don't
-have MATLAB.
-
-Also see\
- J. F. Luis. Mirone: A multi-purpose tool for exploring grid data.
-Computers & Geosciences, 33, 31-41, 2007.
-
-ncBrowse {#ncBrowse}
------------------------------------
-
-Donald Denbo of NOAA's Pacific Marine Environmental Laboratory has
-developed and made available
-[ncBrowse](http://www.epic.noaa.gov/java/ncBrowse), a Java application
-(JDK1.2) that provides flexible, interactive graphical displays of data
-and attributes from a wide range of netCDF data file conventions.
-Features include:
-
--   Designed to work with arbitrary netCDF files.
--   Browses file using the EPIC and COARDS conventions.
--   Provides a "tree" view of the netCDF file.
--   Handles character variables.
--   Handles dimensions without an associated variable.
--   Uses sgt graphics to perform 1 and 2 dimensional cuts through data.
--   Save to file single variable as a "cdl" text file.
--   InstallAnywhere scripts for UNIX, Win32, and MacOS.
--   Currently uses Java 2 and Swing.
-
-ncBrowse will run on any UNIX or Windows machine with a Java 2 (JDK1.2)
-virtual machine installed. Automated installation scripts are available
-for Windows and UNIX. Additional information on ncBrowse and download
-instructions are available at <http://www.epic.noaa.gov/java/ncBrowse>.
-
-Questions and suggestions should be directed to
-\<[dwd at pmel.noaa.gov\>](mailto:dwd at pmel.noaa.gov). If you have problems
-reading a netCDF file with ncBrowse, please send him a copy of the file
-and he'll get ncBrowse to read it!
-
-nccmp {#nccmp}
------------------------------
-
-Remik Ziemlinski of the NOAA Geophysical Fluid Dynamics Laboratory has
-developed [nccmp](http://nccmp.sourceforge.net/), a tool to compare two
-netCDF files. It can use MPI, include/exclude specific variables or
-metadata and operates quickly. Highly recommended for regression testing
-with large datasets. See the Web site <http://nccmp.sourceforge.net/>
-for more information.
-
-NCL {#NCL}
--------------------------
-
-The [NCAR Command Language (NCL)](http://www.ncl.ucar.edu/) is an
-intepreted programming language for scientific data analysis and
-visualization developed and maintained in NCAR's [Computational and
-Information Systems Laboratory](http://www.cisl.ucar.edu/).
-
-NCL has many features common to modern programming languages, including
-types, variables, operators, expressions, conditional statements, loops,
-and functions and procedures. NCL also has features that are not found
-in other programming languages, including those that handle the
-manipulation of metadata, the configuration of visualizations, the
-import of data from a variety of data formats, and an algebra that
-supports array operations.
-
-NCL has robust file input and output capabilities. It allows different
-datasets of different formats (netCDF, netCDF-4 classic, HDF4, HDF4-EOS,
-GRIB-1, and GRIB-2) to be imported into one uniform and consistent data
-manipulation environment, which internally is the netCDF data format.
-NCL doesn't place any restrictions or conventions on the organization of
-input netCDF files.
-
-NCL comes with many useful built-in functions and procedures for
-processing and manipulating data. There are over 600 functions and
-procedures that include routines for use specifically with climate and
-model data, empirical orthogonal functions, Fourier coefficients,
-wavelets, singular value decomposition, 1-, 2-, and 3-dimensional
-interpolation, approximation, and regridding, and computer analysis of
-scalar and vector global geophysical quantities.
-
-The visualizations are publication-quality and highly customizable, with
-hundreds of options available for tweaking the looks of your graphics.
-NCL can generate contours, XY plots, vectors, streamlines, and can
-overlay these plots on many different map projections. There are also
-specialized functions for generating histograms, wind roses, meteograms,
-skew-T plots, weather maps.
-
-Included with the software are two command line tools: "ncl\_convert2nc"
-for converting GRIB-1/2 or HDF files to netCDF files, and
-"ncl\_filedump" which will dump the contents of a file format that NCL
-recognizes (netCDF, GRIB-1/2, HDF, etc).
-
-NCL is available under an open source license or in binary form for
-several popular UNIX platforms, including (but not limited to) Linux,
-MacOSX, and Windows/Cygwin.
-
-Documentation and additional information on NCL are available from the
-[NCL website](http://www.ncl.ucar.edu/), which contains hundreds of
-[application examples](http://www.ncl.ucar.edu/Applications/) for one to
-download. You can also contact Mary Haley, at <haley at ucar.edu> for more
-information.
-
-NCO {#NCO}
--------------------------
-
-[NCO](http://nco.sourceforge.net) (netCDF operators) is a package of
-command line operators that work on generic netCDF or HDF4 files:
--   ncap2 - arithmetic processor
--   ncatted - attribute editor
--   ncbo - binary operator
--   ncdiff - differencer
--   ncea - ensemble averager
--   ncecat - ensemble concatenator
--   ncflint - file interpolator
--   ncks - kitchen sink (extract, cut, paste, print data)
--   ncpdq - permute dimensions quickly
--   ncra - running averager
--   ncrcat - record concatenator
--   ncrename - renamer
--   ncwa - weighted averager
-
-All operators may now be [OPeNDAP](http://www.opendap.org) clients. OPeNDAP
-enables network transparent data access to any OPeNDAP server. Thus
-OPeNDAP-enabled NCO can operate on remote files accessible through any
-OPeNDAP server without transferring the files. Only the required data
-(e.g., the variable or hyperslab specified) are transferred.
-
-The source code is freely available from the [NCO home
-page](http://nco.sourceforge.net/), as is the NCO User's Guide.
-
-For more information, contact the author, Charlie Zender.
-
-ncregrid {#ncregrid}
------------------------------------
-
-Patrick Jöckel of the Max Planck Institute for Chemistry has developed
-**ncregrid**, a tool (written in FORTRAN-90) for data transfer of
-gridded 2- and 3-dimensional (spatial) geophysical/geochemical scalar
-fields between grids of different resolutions. The algorithm handles
-data on rectangular latitude/longitude grids (not necessarily evenly
-spaced) and vertical pressure hybrid grids of arbitrary resolution. The
-input/output data format is netCDF. ncregrid is freely available without
-any warranty under the GNU public license (GPL). ncregrid can be used as
-a "stand-alone" program, and/or linked as an interface to a model, in
-order to re-grid automatically the input from an arbitrary grid space
-onto the required grid resolution.
-
-More information is available on the web-page:
-<http://www.mpch-mainz.mpg.de/~joeckel/ncregrid/index.html>.
-
-nctoolbox (a MATLAB common data model interface) {#nctoolbox}
-----------------------------------------------------------------------------
-
-[nctoolbox](http://nctoolbox.github.io/nctoolbox/) is a MATLAB interface
-that provides read-only access to [Common Data
-Model](/software/netcdf-java/CDM/index.html) datasets. Under the hood,
-nctoolbox uses Unidata's NetCDF-Java as the data access layer. This
-allows nctoolbox to access to netCDF, OPeNDAP, HDF5, GRIB, GRIB2, HDF4,
-and many (15+) other file formats and services using the same API. It
-works with MATLAB 2008a and later. The nctoolbox software was developed
-by Brian Schlining (MBARI), Rich Signell (USGS), Sachin Kumar Bhate
-(freelance), and Alex Crosby (RPS/ASA).
-
-ncdx {#ncdx}
----------------------------
-
-Patrick Jöckel of the Max Planck Institute for Chemistry has developed
-**ncdx**, a tool (written in FORTRAN-90) that scans a netCDF file and
-makes it [OpenDX](#OpenDX) compliant. ncdx is freely available without
-any warranty under the GNU public license (GPL). More information is
-available on the web-page:
-<http://www.mpch-mainz.mpg.de/~joeckel/ncdx/index.html>.
-
-ncensemble {#ncensemble}
----------------------------------------
-
-Alan Iwi, of Rutherford Appleton Laboratory, offers this command line
-ensemble statistics utility. More information is available on the
-web-page: <http://home.badc.rl.ac.uk/iwi/ncensemble/>.
-
-ncview {#ncview}
--------------------------------
-
-[Ncview](http://meteora.ucsd.edu/~pierce/ncview_home_page.html) is a
-visual browser for netCDF files. Typically you would use ncview to get a
-quick and easy, push-button look at your netCDF files. You can view
-simple movies of the data, view along various dimensions, take a look at
-the actual data values, change color maps, invert the data, etc. It runs
-on UNIX platforms under X11, R4 or higher. For more information, check
-out the [README](http://meteora.ucsd.edu/~pierce/docs/ncview.README)
-file; you can also see a representative [screen
-image](http://meteora.ucsd.edu/~pierce/docs/ncview.gif) (GIF, 66K) of
-ncview in action.
-The source may be downloaded from <ftp://cirrus.ucsd.edu/pub/ncview/>.
-For more information, please contact the author, David W. Pierce at
-<dpierce at ucsd.edu>.
-
-netcdf4-js {#netcdf4-js}
--------------------------------
-[netcdf4-js](https://www.npmjs.com/package/netcdf4) is a NodeJS addon for reading and writing the files in the Network Common Data Form (NetCDF) version <= 4, built upon the C-library for netcdf. It isavailable from npmjs at the link above, or directly from the [GitHub Repository](https://github.com/swillner/netcdf4-js).
-
-NetCDF Toolbox for MATLAB-5 {#matlab5}
-----------------------------------------------------
-
-The [NetCDF Toolbox for MATLAB-5](http://mexcdf.sourceforge.net/),
-originally developed by Charles R. Denham, combined netCDF-3 with
-[MATLAB](http://www.mathworks.com/products/matlab/) to form an interface
-that used MATLAB operator-syntax for arithmetic, logical, and
-subscripting operations on netCDF entities. The NetCDF Toolbox is in
-bug-fix-only mode, and is maintained by John.G.Evans.NE at gmail.com, on
-the [MEXNC, SNCTOOLS, and the NetCDF Toolbox](http://mexcdf.sf.net) web
-page.
-
-ncvtk {#ncvtk}
------------------------------
-
-[Ncvtk](http://ncvtk.sourceforge.net/) is a program for exploring
-planetary data stored in a NetCDF file. The NetCDF file should loosely
-follow the [CF metadata
-conventions](http://www.cgd.ucar.edu/cms/eaton/cf-metadata/).
-
-Ncvtk was designed from the ground up with the aim of offering a high
-degree of interactivity to scientists who have a need to explore
-structured, three-dimensional, time-dependent climate data on the
-sphere. A graphical user interface allows users to interact with their
-data via color/transparency/contour/vector plots, apply vertical slices,
-probe data, apply an external sun light, overlay hydrographic and
-geopolitical data, rotate, zoom, etc. with minimal fuss.
-
-Ncvtk is written in python and is based on the [Visualization Toolkit
-(VTK)](http://public.kitware.com/VTK/). Like python and VTK, Ncvtk is
-highly portable and known to run on Windows and Linux (i386, ia64,
-EMT64) platforms. More information about Ncvtk is available at
-<http://ncvtk.sourceforge.net>.
-
-Ivan Shmakov's netcdf tools {#netcdf_tools}
-----------------------------------------------------------
-
-The NetCDF tools is a free software package consisting of a few tools
-operating on NetCDF and, by utilizing the compatibility API, HDF4 files,
-which are intended to be usable from Shell scripts.
-
-The currently packaged tools are:
-
--   a couple of simple shell wrappers over the respective NetCDF
-    functions (ncattget and ncattput);
--   a more sophisticated ncget tool.
-
-The ncget tool implements functionalilty that is similar to hdp dumpsds
-(for NetCDF, which lacks such a tool), or complements it in the case of
-HDF4. It can be seen as a complement to the ncdump tool (included in
-both the NetCDF and HDF4 distributions) as well.
-
-This tool allows a selected part of a NetCDF variable or an HDF4
-scientific data set (SDS) to be extracted in either an ASCII or binary
-form, applying the transformation specified by the usual scale\_factor
-and add\_offset attributes. It allows one to feed the data contained in
-NetCDF variables (or HDF4 SDS) to the tools designed to operate on
-either ASCII (text) or raw (binary) data.
-
-This version of the package is the first one to be announced to the
-public. It has some known bugs and limitations, but it's proved to be
-quite usable. A [project
-page](http://freshmeat.net/projects/netcdf-tools) on freshmeat.net. The
-[source](http://waterlily.siamics.net/~ivan/src/netcdf-tools-0.1-rc1.tar.gz)
-is also available.
-
-netcdf4excel (add-in for MS Excel) {#netcdf4excel}
------------------------------------------------------------------
-
-Alexander Bruhns has developed [a netCDF add-in written in Visual Basic
-for MS Excel](http://code.google.com/p/netcdf4excel/). This add-in
-simplifies the use of NetCDF data in Excel, providing a ready to use
-solution for manipulating this type of data.
-
-For developers, the open-source (GPL V3 license) can be downloaded
-directly or checked out with Mercurial.
-
-The add-in is written in VBA 6.0 (so it won't work with Office 2010 64
-bits) and is designed for Excel 2007 running with the Microsoft Windows
-operating system. It supports opening netCDF classic format data with
-Excel for read or write access.
-
-More details are available on the [netcdf4excel web
-site](http://code.google.com/p/netcdf4excel/).
-
-NetCDF95 alternative Fortran API {#netcdf95}
------------------------------------------------------------
-
-Lionel Guez has developed and made feely available
-[NetCDF95](http://web.lmd.jussieu.fr/~lglmd/NetCDF95), a new alternative
-Fortran interface to the NetCDF library. Compared to the
-Unidata-provided Fortran 90 netCDF interface, the NetCDF95 interface is
-meant to be easier to use and more secure.
-
-Objective-C API {#Objective-C}
----------------------------------------------
-
-Tom Moore has an Objective-C API, available here:
-[www.paleoterra.com/software](http://www.paleoterra.com/software). The
-netCDF Framework is an open source (Argonne Open Source License) MacOSX
-application framework that provides an Objective-C interface to the NCAR
-netCDF library version 3. The framework is available both as source code
-and universal compiles (works on both PPC and Intel macs). The source
-code has also been compiled by users for the GNUStep environment.
-Version 2 of the framework will provide classes for accessing multiple
-netCDF files, working with in-memory data slabs using standard notation,
-and some support for multithreading.
-
-### Mark Tracy's Objective-C API
-
-Mark Tracy has written [NetcdfStep](http://www.mt-se.com/nc_1.html), an
-Objective-C API for netCDF that uses Objective-C Foundation Classes.
-
-NetcdfStep is framework for using the netCDF library in object-oriented
-programming with Objective-C. It now supports the full functionality of
-netCDF 3.6.2.
-
-A [complete Mac OS X
-distribution](http://www.mt-se.com/pub/NetcdfStep-1.0.2.zip) including
-pre-built static library and [online
-documentation](http://www.mt-se.com/netcdfstep_doc/) are available.
-Applications linked to this framework have no external dependencies
-(other than Mac OS X itself). A [source-code only
-distribution](http://www.mt-se.com/pub/NetcdfStep-GNUstep-0.6.1.tar.gz)
-synced up to version 0.6.1 is available for GNUstep for use on Linux and
-other Unix platforms.
-
-Octave interface {#NCMEX}
-----------------------------------------
-
-The ARM Program has contributed NCMEX for Octave, a port of Chuck
-Denham's MATLAB NCMEX to [Octave](http://www.octave.org). The calling
-syntax is identical, so scripts using NCMEX in MATLAB should in theory
-be portable to Octave. In order to build NCMEX, a compiled C NetCDF
-library must already be installed.
-
-In addition to the base NetCDF library interface, this package includes
-a simple toolbox to automate the reading and writing of NetCDf files
-within Octave using NCMEX. These tools as well as the source for NCMEX
-are available from
-<http://engineering.arm.gov/~sbeus/octavex/octavex.tar> (NOTE: this .tar
-file contains other Octave extension functions besides NCMEX.)
-
-Also see [Octcdf](http://ocgmod1.marine.usf.edu/octcdf/), a netCDF
-toolbox for Octave.
-
-For installation instructions, see the README file inside the .tar file.
-
-Octave interface (Barth) {#Octave}
--------------------------------------------------
-
-Alexander Barth has contributed the following:
-
-Octcdf is a netCDF toolbox for [Octave](http://www.octave.org/) which
-uses the same operator syntax as the [matlab netCDF
-toolbox](http://mexcdf.sourceforge.net/netcdf_toolbox.html) of Charles
-R. Denham. NetCDF dimensions, attributes and variables are Octave
-objects and can be accessed, sliced and changed just as regular
-variables. Unlike most netCDF toolboxes for matlab, it does not depend
-on the NCMEX wrapper around the netCDF interface. This octave toolbox is
-written in C++ calling directly the netCDF library. The octcdf toolbox
-can also be used to download data from an OpenDAP server. The octcdf
-source code is available at
-<http://modb.oce.ulg.ac.be/mediawiki/index.php/NetCDF_toolbox_for_Octave>.
-It was also included in the Octave Repository
-[octave-forge](http://octave.sourceforge.net/).
-
-OPeNDAP (formerly DODS) {#OPeNDAP}
--------------------------------------------------
-
-The [OPeNDAP](http://opendap.org/) (formerly known as DODS) is an
-Open-source Project for a Network Data Access Protocol that makes local
-data and subsets of local data accessible to remote locations
-independent of the local storage format. OPeNDAP also provides tools for
-transforming existing applications into OPeNDAP clients, enabling them
-to remotely access OPeNDAP served data. OPeNDAP is based on existing
-data access tools; rather than developing a self contained system, it
-makes extensive use of existing data access APIs.
-
-OPeNDAP can be used to make netCDF data files available over the
-Internet and it can also be used to adapt existing software which use
-the netCDF API (by re-linking) to read data served by an OPeNDAP data
-server. In principle, any program written using netCDF can be adapted to
-read data from an OPeNDAP server - in other words any program which uses
-netCDF can become a client in the OPeNDAP client-server system. Included
-in the source and binary distributions are two freely available programs
-that have already been modified (re-linked).
-
-With a client program accessing data from a netCDF server, it is
-possible to access a small subset of a large dataset over the Internet
-without copying the entire dataset (as you would have to do with FTP or
-AFS). The client can see changes to the netCDF dataset, e.g. when new
-records are added (which would not be possible with FTP). Finally, the
-client can also access cross-sections of variable data without paging
-large amounts of data across the network (as you would have to do with
-NFS, for example).
-
-OPeNDAP software is freely available in both source form or binary form
-for selected platforms.
-
-OpenDX {#OpenDX}
--------------------------------
-
-[OpenDX](http://www.opendx.org/about.html) (formerly IBM Data Explorer,
-also known as simply DX) is a general-purpose software package for data
-visualization and analysis. It employs a data-flow driven client-server
-execution model and provides a graphical program editor that allows the
-user to create a visualization using a point and click interface.
-DX runs on 7 major UNIX platforms as well as Windows 95/NT and is
-designed to take full advantage of multi-processor systems from IBM, SGI
-and Sun.
-
-DX is built upon an internal data model, which describes and provides
-uniform access services for any data brought into, generated by, or
-exported from the software. This data model supports a number of
-different classes of scientific data, which can be described by their
-shape (size and number of dimensions), rank (e.g., scalar, vector,
-tensor), type (float, integer, byte, etc. or real, complex, quaternion),
-where the data are located in space (positions), how the locations are
-related to each other (connections), aggregates or groups (e.g.,
-hierarchies, series, composites, multizone grids, etc.). It also
-supports those entities required for graphics and imaging operations
-within the context of Data Explorer. Regular and irregular, deformed or
-curvilinear, structured and unstructured data as well as "missing" or
-invalid data are supported.
-
-The details of the data model are hidden at the user level. As a result
-DX operations or modules are polymorphic and appear typeless. The DX
-Import module, which reads data for use within Data Explorer directly
-utilizes data in netCDF as well as other formats (e.g., HDF, CDF). One
-or more variables may be selected as well as step(s) of a time series.
-Data in conventional netCDFs are directly imported. Since the DX data
-model is more comprehensive than the netCDF data model, a methodology to
-extend netCDF via attribute conventions (e.g., for unstructured meshes,
-non-scalar data and hierarchies) for use with Data Explorer is
-available.
-
-DX supports a number of realization techniques for generating renderable
-geometry from data. These include color and opacity mapping (e.g., for
-surface and volume rendering), contours and isosurfaces, histograms,
-two-dimensional and three-dimensional plotting, surface deformation,
-etc. for scalar data. For vector data, arrow plots, streamlines,
-streaklines, etc. are provided. Realizations may be annotated with
-ribbons, tubes, axes, glyphs, text and display of data locations, meshes
-and boundaries. Data probing, picking, arbitrary surface and volume
-sampling, and arbitrary cutting/mapping planes are supported.
-
-DX supports a number of non-graphical functions such as point-wise
-mathematical expressions (e.g., arithmetic, transcendental, boolean,
-type conversion, etc.), univariate statistics and image processing
-(e.g., transformation, filter, warp, edge detection, convolution,
-equalization, blending, morphological operations, etc.). Field/vector
-operations such as divergence, gradient and curl, dot and cross
-products, etc. are provided. Non-gridded or scattered data may be
-interpolated to an arbitrary grid or triangulated, depending on the
-analysis requirements. The length, area or volume of various geometries
-may also be computed. Tools for data manipulation such as removal of
-data points, subsetting by position, sub/supersampling, grid
-construction, mapping, interpolation, regridding, transposition, etc.
-are available.
-
-Tools for doing cartographic projections and registration as well as
-earth, space and environmental sciences examples are available at
-Cornell University via info.tc.cornell.edu. Also see the [ncdx](#ncdx)
-tool for making netCDF files OpenDX compliant.
-
-Panoply {#Panoply}
----------------------------------
-
-[Panoply](http://www.giss.nasa.gov/tools/panoply/) is an application
-that plots geo-gridded and other arrays from netCDF, HDF, GRIB, and
-other datasets. Features include:
-
--   Slice and plot geo-gridded latitude-longitude, latitude-vertical,
-    longitude-vertical, or time-latitude arrays from larger
-    multidimensional variables.
--   Two arrays may be combined in one plot by differencing, summing, or
-    averaging.
--   Lon-lat data may be plotted as global maps (using any of over 75 map
-    projections) or as zonal average plots.
--   Overlay continent outlines or masks on lon-lat plots.
--   Use your favorite CPT, GGR, PAL, or ACT color table for scale
-    colorbar.
--   Save plots to disk in GIF, JPEG, PNG or TIFF bitmap images or as PDF
-    or PostScript graphics files.
--   Export lon-lat map plots in KMZ format.
--   Export animations as AVI or MOV video or as a collection of
-    invididual frame images.
--   Explore remote THREDDS and OpenDAP catalogs and open datasets served
-    from them.
-
-Panoply requires that your computer have a Java SE 6 runtime
-environment, or better, installed.
-
-Panoply is developed at the NASA Goddard Institute for Space Studies.
-Questions and suggestions should be directed to [Dr. Robert B.
-Schmunk](http://www.giss.nasa.gov/staff/rschmunk.html).
-
-Parallel-NetCDF {#Parallel-NetCDF}
--------------------------------------------------
-
-A group of researchers at Northwestern University and Argonne National
-Laboratory (Jianwei Li, Wei-keng Liao, Alok Choudhary, Robert Ross,
-Rajeev Thakur, William Gropp, and Rob Latham) have designed and
-implemented a new [parallel interface for writing and reading netCDF
-data](http://www.mcs.anl.gov/parallel-netcdf/), tailored for use on high
-performance platforms with parallel I/O. The implementation builds on
-the MPI-IO interface, providing portability to most platforms in use and
-allowing users to leverage the many optimizations built into MPI-IO
-implementations. Testing so far has been on Linux platforms with ROMIO
-and IBM SP machines using IBM's MPI.
-
-Documentation and code for Parallel-NetCDF is now available for testing.
-Although a few interfaces are not implemented yet, the current
-implementation is complete enough to provide significant I/O performance
-improvements on parallel platforms, as described in a [technical
-report](ftp://info.mcs.anl.gov/pub/tech_reports/reports/P1048.pdf).
-Users are invited to test Parallel-NetCDF in their applications.
-
-Paraview and vtkCSCSNetCDF {#Paraview}
------------------------------------------------------
-
-<http://www.paraview.org/>
-
-ParaView is an application designed with the need to visualize large
-data sets in mind. The goals of the ParaView project include the
-following:
-
--   Develop an open-source, multi-platform visualization application.
--   Support distributed computation models to process large data sets.
--   Create an open, flexible, and intuitive user interface.
--   Develop an extensible architecture based on open standards.
-
-ParaView runs on distributed and shared memory parallel as well as
-single processor systems and has been successfully tested on Windows,
-Linux and various Unix workstations and clusters. Under the hood,
-ParaView uses the Visualization Toolkit as the data processing and
-rendering engine and has a user interface written using a unique blend
-of Tcl/Tk and C++.
-
-A vtk/ParaView reader for netCDF files can be found here.
-
-Perl interfaces {#Perl}
---------------------------------------
-
-There are two netCDF interfaces for Perl:
--   [PDL::NetCDF](http://search.cpan.org/~dhunt/PDL-NetCDF-4.05/netcdf.pd),
-    Doug Hunt's perl interface which uses the PDL (perl data language)
-    extension.
--   [NetCDFPerl](/software/netcdf-perl/), Steve Emmerson's extension
-    module, based on version 2 of the netCDF package. Uses perl lists
-    for representing netCDF variables.
-
-PolyPaint+ {#PolyPaint}
----------------------------------------
-
-[PolyPaint+](http://lasp.colorado.edu/polypaint/home.html) is an
-interactive scientific visualization tool that displays complex
-structures within three-dimensional data fields. It provides both color
-shaded-surface display and simple volumetric rendering in either index
-or true color. For shaded surface rendering, the PolyPaint+ routines
-first compute the polygon set that describes a desired surface within
-the 3D data volume. These polygons are then rendered as continuously
-shaded surfaces. PolyPaint+ contains a wide variety of options that
-control lighting, viewing, and shading. Objects rendered volumetrically
-may be viewed along with shaded surfaces. Additional data sets can be
-overlaid on shaded surfaces by color coding the data according to a
-specified color ramp. 3D visualizations can be viewed in stereo for
-added depth perspective.
-Currently supported 3D visualizations are the following:
-
--   Shaded isosurface
--   Transparent contour shells or isosurfaces at varying levels
--   Volumetric or density plot
--   Planes
--   Contour ribbons
--   Topographic surface from 2D geographic data sets
-
-3D data volumes may be sliced in the X, Y, or Z plane using an
-interactive cutting plane. A cross section of the data volume can be
-viewed in a 2D window as a 2D contour plot, a vector plot, a raster
-image or a combination of these options superimposed. Map outlines can
-be used as a background for 2D cross section plots of geographic data.
-All data is projected according to the coordinates specified by the user
-for the cross section window.
-
-The user interface provides direct manipulation tools for specifying the
-eye position, center of view, light sources, and color ramps. Subsetting
-of data can be done easily by selecting the data by index or geographic
-coordinate. On-line contextual help provides easy access to more detail
-about the software. Tutorials which range from very simple
-visualizations to complex combinations of data sets provide the user
-with a quick learning tool.
-
-Currently PolyPaint+ accepts only data which is in the NetCDF file
-format. A file conversion utility which converts from raw binary data to
-netCDf is a part of the application.
-
-PolyPaint+ is a joint effort of the University of Colorado and NCAR
-(National Center for Atmospheric Research) funded by the NASA AISRP
-program. A beta version of PolyPaint+ is currently available free of
-charge using FTP or for a nominal fee which would cover tape
-distribution. A license agreement must be signed in order to use it.
-
-You may order by...
-
--   TELEPHONE : 303-492-7289 (Margi Klemp) : 303-497-8159 (Bill Boyd)
--   U.S. MAIL :
-
-                Margi Klemp
-                University of Colorado / LASP
-                1234 Innovation Dr.
-                Boulder, CO 80303
-                USA
-
--   E-MAIL : margi at aries.colorado.edu
-
-Pomegranate {#Pomegranate}
------------------------------------------
-
-The P9E Team at NASA JPL has developed
-[Pomegranate](http://pomegranate.jpl.nasa.gov/), a python application
-that "webifies" science data files. Supported formats include netCDF,
-HDF4, HDF5, GRIB and FITS.
-
-Pomegranate can be installed on web servers as either a WSGI or CGI
-application to provide webification (w10n) services. To learn more about
-w10n of science data files, please visit <http://webification.org/>. A
-brief [help](http://pomegranate.jpl.nasa.gov/test/help.txt) document
-describes how to use the [demo
-directory](http://pomegranate.jpl.nasa.gov/test) to browse or download
-metadata or data in netCDF, JSON, or other formats by clicking on data
-folder and document icons.
-
-Pomegranate can also be used as a standalone library or command line
-application. This greatly simplifies the retrieval of metadata and data
-from files in supported formats.
-
-Pomegranate is open source software and can be downloaded from
-<http://www.openchannelsoftware.com/projects/Pomegranate/>.
-
-PyNGL and PyNIO {#PyNGL}
----------------------------------------
-
-NCAR's Computational and Information Systems Laboratory has developed
-[PyNGL](http://www.pyngl.ucar.edu/), a python package for scientific
-visualization and data analysis and
-[PyNIO](http://www.pyngl.ucar.edu/Nio.shtml), a Python package
-supporting access to a variety of data formats using an interface
-modelled on netCDF.
-
-Python interfaces {#Python}
-------------------------------------------
-
-Python is an interpreted, object-oriented language that is supported on
-a wide range of hardware and operating systems. Python information and
-sources can be obtained from <http://www.python.org/>. There are now
-several netCDF interfaces for Python.
-
-Jeff Whitaker of the NOAA Earth System Research Lab has developed a
-netCDF-4 module for python: <http://code.google.com/p/netcdf4-python/>.
-Most new features of netCDF-4 are implemented, such as multiple
-unlimited dimensions, groups and zlib data compression. All the new
-numeric data types (such as 64-bit and unsigned integer types) are
-implemented. Compound and variable length (vlen) data types are
-supported, but the enum and opaque data types are not. Mixtures of
-compound and vlen data types (compound types containing vlens, and vlens
-containing compound types) are not supported.
-
-[xray](#xray) is a higher-level interface that uses netcdf4-python
-internally to implement a pandas-like package for N-D labelled arrays
-for scientific data.
-
-André Gosselin of the Institut Maurice-Lamontagne, Péches & Océans
-Canada, has implemented pycdf, a new Python interface to the netCDF
-library. It is available from <http://pysclint.sourceforge.net/pycdf/>,
-where you will find the install files, installation instructions,
-extensive documentation in text and html format, and examples. pycdf
-requires the Numeric python package, and installs through the simple
-"python setyp.py install" command.
-
-Bill Noon (noon at snow.cit.cornell.edu) has implemented another netCDF
-Python module that allows easy creation, access, and browsing of netCDF
-data. The bindings also use the [udunits library](/software/udunits/) to
-do unit conversions. More information and source for Noon's Python
-netCDF module are available from
-<http://snow.cit.cornell.edu/noon/ncmodule.html>.
-
-The package from Konrad Hinsen has been integrated into his
-[ScientificPython](https://sourcesup.cru.fr/projects/scientific-py/)
-package.
-
-Dave Brown of NCAR's Computational and Information Systems Laboratory
-has developed [PyNIO](http://www.pyngl.ucar.edu/Nio.shtml), a Python
-package that allows read and/or write access to a variety of data
-formats using an interface modelled on netCDF. Currently supported
-formats include netCDF, HDF4, GRIB1 and GRIB2 (read only), and HDF-EOS 2
-Grid and Swath data (read only).
-
-Vicente Galiano of Miguel Hernandez University has developed a Python
-interface to PnetCDF. This Python's package called "PyPnetCDF" allows
-access to NetCDF files using MPI and the library pnetCDF developed by
-http://www.mcs.anl.gov/parallel-netcdf/. The tools are very similar to
-Konrad Hinsen's NetCDF package to Python but can read and write in a
-parallel way. For more information, see:
-<http://www.pyacts.org/pypnetcdf>.
-
-Pupynere (PUre PYthon NEtcdf REader) Roberto
-De Almeida has developed
-[pupynere](http://pypi.python.org/pypi/pupynere/), a PUre PYthon NEtcdf
-REader that allows read-access to netCDF files using the same syntax as
-the Scientific.IO.NetCDF Python module. Even though it's written in
-Python, the module is up to 40% faster than Scientific.IO.NetCDF and
-pynetcdf.
-
-R interface {#R}
--------------------------------
-
-The R Project for Statistical Computing has developed
-[R](http://www.R-project.org/), a language and environment for
-statistical computing and graphics. It provides a wide variety of
-statistical and graphical techniques, including linear and nonlinear
-modelling, statistical tests, time series analysis, classification, and
-clustering.
-
-David Pierce has contributed the [ncdf4
-package](http://cran.r-project.org/web/packages/ncdf4/index.html) for
-reading netCDF data into R and for creating new netCDF dimensions,
-variables, and files, or manipulating existing netCDF files from R.
-
-Pavel Michna has contributed another package,
-[RNetCDF](http://cran.r-project.org/web/packages/RNetCDF/index.html),
-that also provides access to netCDF data and to udunits calendar
-functions from R.
-
-Robert Hijmans (with additional contributors) has created the [R raster
-package](http://cran.r-project.org/web/packages/raster/index.html) for
-geographic data analysis and modeling. The raster package can be used
-for reading, writing, manipulating, analyzing and modeling gridded
-spatial data. The package is especially useful for large datasets that
-don't fit into memory, because data is processed in chunks. See
-[Introduction to the 'raster'
-package](http://cran.r-project.org/web/packages/raster/vignettes/Raster.pdf)
-for more information.
-
-Quantum GIS (QGIS) {#QGIS}
------------------------------------------
-
-[Quantum GIS](http://www.qgis.org/) (QGIS) is an Open Source Geographic Information System (GIS) licensed under the GNU General Public License. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). It runs on Linux, Unix, Mac OSX, and Windows and supports numerous vector, raster, and database formats and functionalities. QGIS supports a desktop, browser, server, and client for viewing, editing, analysis, serving, and accessing data. Its server complies with the OG [...]
-
-QGIS also supports displaying netCDF using the [Crayfish plugin in QGIS](http://www.lutraconsulting.co.uk/blog/2016/04/14/crayfish-2-2/).  The project repository may be found [here](https://github.com/lutraconsulting/qgis-crayfish-plugin).
-
-Ruby interface {#Ruby}
--------------------------------------
-
-A group at the Research Institute for Sustainable Humanosphere (RISH) of
-Kyoto University has developed a [netCDF interface for
-Ruby](http://www.gfd-dennou.org/arch/ruby/products/ruby-netcdf/), an
-interpreted, object-oriented scripting language. This interface is
-intended to cover all the functionality of the C library for netCDF.
-Also available are combination functions such as iterators (which offer
-abstract ways to scan files and variables). Numeric arrays are handled
-by the "NArray" multi-dimensional array class, which is becoming the de
-facto standard multi-dimensional array for Ruby. See also the Ruby-based
-[GPhys software and Gfdnavi tool](#Gfdnavi) for accessing GRIB, GrADS,
-and netCDF data uniformly.
-
-More information about Ruby is available from the [Ruby web
-site](http://www.ruby-lang.org/).
-
-Scientific DataSet (SDS) Library {#SDS}
-------------------------------------------------------
-
-The [Scientific DataSet Library and Tools
-project](http://sds.codeplex.com), developed jointly by Microsoft
-Research Cambridge and Moscow State University, is aimed at manipulation
-and visualization of multidimensional data sets.
-
-Scientific DataSet (or SDS in short) is a .NET class library for
-manipulating scientific data and their metadata. SDS provides a unified
-API for convenient access to various data storages. Three types of
-storages are supported by the first release: NetCDF files, CSV text
-files and volatile in-memory datasets. SDS uses native NetCDF library
-built from version 4.0.1 both for 32 and 64-bit Windows platforms. New
-storage types can be added to SDS infractructure as plugins. Support for
-accessing TIFF image files from SDS as 2D arrays will be available soon
-as a separate CodePlex project.
-
-Three applications are built on top of SDS:
-
--   sds command line utility. It allows users to examine data set
-    schema, copy data sets, modify their metadata.
--   DataSetViewer application for visualization of data sets.
-    DataSetViewer is both a standalone application and Windows
-    Presentation Foundation Control that can be built into your
-    applications. DataSetViewer has support for interactive slicing of
-    multidimensional data along any dimension.
--   DataSetEditor add-in for Microsoft Office Excel. DataSetEditor
-    provides ability to view and modify the contents of any data set as
-    Excel worksheets.
-
-You can read the Getting Started document at
-<http://sds.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=127282>
-for a more detailed introduction to the Scientific DataSet software. A
-Windows Installation package for SDS binaries along with DataSet Viewer
-and DataSet Editor are available also. You can also build core class
-libraries and the sds utility under Mono. You may use, copy, and
-reproduce this software for any non-commercial purpose. For further
-details see license at <http://sds.codeplex.com/license>.
-
-The SDS project is in beta phase and keeps evolving. You are welcome to
-join discussions or report issues at the CodePlex site:
-<http://sds.codeplex.com>.
-
-sciNetCDF {#scinetcdf}
--------------------------------------------------------------
-[sciNetCDF](https://atoms.scilab.org/toolboxes/scinetcdf)
-
-In the context of the IASI-NG project, CNES is responsible for the development
-of a Scilab/NetCDF4 interface, which CNES wanted to make available to the entire
-scientific community.
-
-The toolbox sciNetCDF is the result of this collaboration. It can read and write
-NetCDF files of any version (version 4 of the format is used by default for
-writing).
-
-The toolbox provides high level functions to read/write NetCDF files natively in
-Scilab in a friendly manner (data is converted automatically from Scilab to
-NetCDF and inversely).
-These functions are:
-- nccreate
-- ncwrite
-- ncread
-- ncwriteatt
-- ncreadatt
-- ncdisp
-
-It provides also a low level interface to all the NetCDF C library functions
-
-
-Apache Spatial Information System (SIS) {#SIS}
--------------------------------------------------------------
-
-[Apache Spatial Information System
-(SIS)](https://builds.apache.org/job/sis-trunk/site/index.html) is a
-Java library for developing geospatial applications. SIS enables
-representation of coordinates for searching, data clustering, archiving,
-or any other relevant spatial needs. The library is an implementation of
-GeoAPI 3.0 interfaces and can be used for desktop or server
-applications.
-
-SIS provides data structures for geographic data and associated metadata
-along with methods to manipulate those data structures. The SIS metadata
-module forms the base of the library and enables the creation of
-metadata objects which comply with the ISO 19115 metadata model and
-which can be read from or written to ISO 19139 compliant XML documents.
-The SIS referencing module will enable the construction of geodetic data
-structures for geospatial referencing based on the ISO 19111 model such
-as axis, projection and coordinate reference system definitions, along
-with the associated operations which enable the mathematical conversion
-of coordinates between different systems of reference. The SIS storage
-modules will provide a common approach to the reading and writing of
-grid coverages applicable to simple imagery and multidimensional data
-structures.
-
-SIS supports creating ISO 19115 metadata from metadata in a netCDF store
-from a given file, URL, stream, or NetcdfFile object. SIS netCDF storage
-is intended to be a bridge between NetCDF Climate and Forecast (CF)
-conventions and ISO 19115 metadata.
-
-SIS is under development as an Apache project. Release 0.3 is currently
-available for download.
-
-Tcl/Tk interfaces {#TclTk}
-------------------------------------------
-
-Dan Schmitt has developed [cdftcl](http://cnrit.tamu.edu/rsg/cdftcl/), a
-[Tcl/Tk](http://www.scriptics.com/) interface for netCDF. It allows the
-use of "wildcards" (\*) or ranges (1-4) in the subscript notation, and
-use of name references instead of variable IDs. Contact dan at computer.org
-for more information.
-
-Tcl-nap {#Tcl-nap}
----------------------------------
-
-[Tcl-nap](http://tcl-nap.sourceforge.net) (n-dimensional array
-processor) is a loadable extension of Tcl which provides a powerful and
-efficient facility for processing data in the form of n-dimensional
-arrays. It has been designed to provide an array-processing facility
-with much of the functionality of languages such as
-[APL](http://www.acm.org/sigapl/), Fortran-90, [IDL](#IDL),
-[J](http://www.jsoftware.com/), [matlab](http://www.mathworks.com), and
-[octave](http://www.octave.org/).
-
-Support is provided for data based on n-dimensional grids, where the
-dimensions correspond to continuous spatial coordinates. There are
-interfaces to the HDF and netCDF file formats commonly used for such
-data, especially in Earth sciences such as Oceanography and Meteorology.
-
-The internal data structure is called a NAO (n-dimensional array object)
-and contains similar information to that of HDF SDSs and netCDF
-variables.
-
-Tcl-nap was developed as part of the [CSIRO CAPS
-project](http://www.dar.csiro.au/rs/avhrr_processing_software.htm), but
-can be loaded and used without the (satellite oriented) CAPS extension.
-
-Visual Basic and VB.net interfaces {#VB}
--------------------------------------------------------
-
-Carsten Wieczorrek has developed code in VB 6 to export chromatographic
-data into the netcdf/ANDI format. The application writes netCDF files
-that can be read by CHROMELEON, for example. For others interested in
-programming with netcdf.dll from VB 6, see Wieczorrek's web page on
-[netCDF and VB 6.0](http://www.mn-net.com/netcdf_vb6) and for VB.net,
-see [netCDF and VB.net](http://www.mn-net.com/netcdf_vbnet).
-
-VisAD {#VisAD}
------------------------------
-
-[VisAD](http://www.ssec.wisc.edu/~billh/visad.html) is a Java class
-library for interactive and collaborative visualization and analysis of
-numerical data. It combines:
--   The use of pure Java for platform independence and to support data
-    sharing and real-time collaboration among geographically distributed
-    users. Support for distributed computing is integrated at the lowest
-    levels of the system using Java RMI distributed objects.
--   A general mathematical data model that can be adapted to virtually
-    any numerical data, that supports data sharing among different
-    users, different data sources and different scientific disciplines,
-    and that provides transparent access to data independent of storage
-    format and location (i.e., memory, disk or remote). The data model
-    has been adapted to netCDF, FITS, HDF-EOS, McIDAS, Vis5D, GIF and
-    JPEG file formats.
--   A general display model that supports interactive 3-D, data fusion,
-    multiple data views, direct manipulation, collaboration, and virtual
-    reality. The display model has been adapted to Java3D and Java2D and
-    used in an ImmersaDesk virtual reality display.
--   Data analysis and computation integrated with visualization to
-    support computational steering and other complex interaction modes.
--   Support for two distinct communities: developers who create domain-
-    specific systems based on VisAD, and users of those domain-specific
-    systems. VisAD is designed to support a wide variety of user
-    interfaces, ranging from simple data browser applets to complex
-    applications that allow groups of scientists to collaboratively
-    develop data analysis algorithms.
--   Developer extensibility in as many ways as possible.
-
-VisAD was written by programmers at the [SSEC Visualization
-Project](http://www.ssec.wisc.edu/~billh/vis.html) at the University of
-Wisconsin-Madison [Space Science and Engineering
-Center](http://www.ssec.wisc.edu/), and the [Unidata Program
-Center](/index.html).
-
-WebWinds {#WebWinds}
------------------------------------
-
-[WebWinds](http://www.openchannelsoftware.com/projects/WebWinds/) is a
-free Java-based science visualization and analysis package. In addition
-to several new analysis tools, the current fourth version does automatic
-scripting. This allows
-
-1.  a user to rapidly and automatically create and store a session,
-    either for his own use, or for use by a collaborator on another
-    machine;
-2.  a data provider to automatically create a specialized analysis
-    environment which can be downloaded (as a small script file) along
-    with a dataset from a Website; and
-3.  realtime collaboration or sharing of sessions over (even
-    low-bandwidth) networks, including the Internet.
-
-This scripting requires no knowledge of the scripting language syntax.
-Several sample script files are included with the distribution.
-
-In addition, this version contains a capability to geo-reference some
-data and to read ASCII data in tabular format. Also new is the ability
-to output data in numerical form (e.g. NetCDF) and a context sensitive,
-integrated help system.
-
-As with earlier versions, data in several different formats, including
-NetCDF, can be read in easily from your local machine or from the Web.
-In addition, most data can be subset or subsampled on load, making it
-possible to visualize very large multidimensional and/or multispectral
-datasets. The package includes several step-by-step examples.
-Installation of the software (including Java) on the PC or Mac is a
-process requiring one file to be downloaded and opened. If you need help
-getting started, a remote tutorial is available once you've downloaded
-the package.
-
-WebWinds is \`point and click' rather than language driven and it runs
-well on Unix, Windows (95/98/NT) and Mac platforms. It currently
-requires JDK 1.1. To download a copy of this release, go to
-<http://www.sci-conservices.com/rel4/webpage/wwhome.html>
-
-xray (Python N-D labelled arrays) {#xray}
---------------------------------------------------------
-
-[xray](http://xray.readthedocs.org/en/stable/index.html) is an open
-source project and Python package that aims to bring the labeled data
-power of [pandas](http://pandas.pydata.org/) to the physical sciences,
-by providing N-dimensional variants of the core pandas data structures,
-Series and DataFrame: the xray DataArray and Dataset.
-
-xray adopts the [Common Data
-Model](http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/CDM)
-for self-describing scientific data in widespread use in the Earth
-sciences (e.g., netCDF and OPeNDAP): xray.Dataset is an in-memory
-representation of a netCDF file.
-
-xray is being developed by Stephan Hoyer, Alex Kleeman, and [other
-contributors](https://github.com/xray/xray/graphs/contributors).
-
-Zebra {#Zebra}
------------------------------
-
-[Zebra](http://www.atd.ucar.edu/rdp/zebra.html) (formerly named Zeb) is
-a system for data ingest, storage, integration and display, designed to
-operate in both real time and postprocessing modes. Zebra was developed
-by Jonathan Corbet and others in NCAR's [Research Data
-Program](http://www.atd.ucar.edu/rdp/rdp_home.html).
-Zebra's primary use is for the superpositioning of observational data
-sets (such as those collected by satellite, radar, mesonet and aircraft)
-and analysis products (such as model results, dual-Doppler synthesis or
-algorithm output). Data may be overlaid on a variety of display types,
-including constant altitude planes, vertical cross-sections, X-Y graphs,
-Skew-T plots and time-height profiles. The fields for display, color
-tables, contour intervals and various other display options are defined
-using an icon based user-interface. This highly flexible system allows
-scientific investigators to interactively superimpose and highlight
-diverse data sets; thus aiding data interpretation.
-
-Data handling capabilities permit external analysis programs to be
-easily linked with display and data storage processes. The data store
-accepts incoming data, stores it on disk, and makes it available to
-processes which need it. An application library is available for data
-handling. The library functions allow data storage, retrieval and
-queries using a single applications interface, regardless of the data's
-source and organization. NetCDF data that conforms to Zebra conventions
-is supported by this interface.
-
-Zebra is currently available to the university research community
-through the NCAR/ATD Research Data Program. Email requests to
-rdp-support at atd.ucar.edu. More information is on the web page
-http://www.atd.ucar.edu/rdp/zebra.html.
-
-------------------------------------------------------------------------
-
-User-Contributed Software {#user}
-================================================
-
-Unidata makes available a separate
-[catalog](/software/netcdf/Contrib.html) to a
-[directory](ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/) of freely
-available, user-contributed software and documentation related to the
-netCDF library. This software may be retrieved by anonymous FTP. We
-haven't necessarily used or tested this software; we make it available
-"as is".
-
-The criteria for inclusion in the netcdf/contrib/ directory of
-user-contributed software are:
-
--   General usefulness to a significant part of the netCDF community
--   Small size
--   Infrequent need for updates
--   Free availability
-
-------------------------------------------------------------------------
-
-Commercial or Licensed Packages {#commercial}
-===============================
-
-ASA ViewNcDap {#ViewNcDap}
------------------------------------------
-
-Applied Science Associates, Inc. has made the ASA View NC/Dap
-application freely available for
-[download](http://www.asascience.com/downloads). ViewNcDap is a
-stand-alone research-based tool (with included demonstration data) that
-allows a user to visualize four dimensional NetCDF and OPeNDAP data.
-ViewNcDap is a Windows application that includes temporal/time step
-functionality for viewing animations of data that include temporal
-information. The application may be used to visualize a variety of
-time-varying geospatial scientific data in a simple map framework. It
-handles CF conventions and includes some aliasing features that could
-permit additional formats to be read. It should not be considered a GIS
-system, but is used to quickly preview a variety of data on a simple
-map. Data may also be filtered and saved to a local netCDF file.
-
-Avizo {#Avizo}
------------------------------
-
-[Avizo](http://www.avizo3d.com/) software is a powerful tool for 3D data
-visualization and analysis. It offers a comprehensive feature set that
-addresses visualization, processing, analysis, communication and
-presentation. [Avizo Green
-Edition](http://www.vsg3d.com/vsg_prod_avizo_green.php) includes an
-advanced set of features dedicated to climate, oceanography,
-environmental or earth-mapped data. It provides high-level support for
-the netCDF format, a dedicated Earth visualization module, and a set of
-advanced geographical projections applicable to a wide range of fast 2D
-and 3D data representations.
-
-For more information, see [www.avizo3d.com](http://www.avizo3d.com/).
-
-AVS {#AVS}
--------------------------
-
-[AVS](ftp://testavs.ncsc.org/avs/Info/WHAT_IS_AVS) (Application
-Visualization System) is a visualization application software and
-development environment. An AVS module has been written that allows
-multi-dimensional netCDF data sets to read into AVS as uniform or
-rectilinear field files. The AVS user can point and click to specify the
-name of the variable in the selected netCDF file, as well as selecting
-the hyperslab. If 1D coordinate variables exist (a variable that has the
-same name as a dimension) then the coordinate variable will be used to
-specify the coordinates of resulting rectilinear field file. If no
-coordinate variable exists, then the resulting field file will be
-uniform. Once in AVS, there are hundreds of analysis and display modules
-available for image processing, isosurface rendering, arbitrary slicing,
-alpha blending, streamline and vorticity calculation, particle
-advection, etc. AVS runs on many different platforms (Stardent, DEC,
-Cray, Convex, E and S, SET, Sun, IBM, SGI, HP, FPS and WaveTracer), and
-it has a flexible data model capable of handling multidimensional data
-on non-Cartesian grids.
-The module source code and documentation is available from the
-[International AVS Center](http://iac.ncsc.org/), in the
-<ftp://testavs.ncsc.org/avs/AVS5/Module_Src/data_input/read_netcdf/>
-directory.
-
-See also the information on [DDI](#DDI) for another way to use netCDF
-data with AVS.
-
-Barrodale UFI {#BCS-UFI}
----------------------------------------
-
-[Barrodale Computing Services Ltd.](http://www.barrodale.com) (BCS) has
-developed a product that addresses one of the main objections heard from
-"technologists" (e.g., scientists, engineers, and other researchers) who
-avoid using databases to manage their data: "my very large data files
-are too cumbersome/difficult/slow/costly to load into a database". In
-addition to netCDF, these files come in a variety of formats (HDF5,
-GRIB, NITFS, FITS, etc.).
-
-This BCS product is called the [Universal File Interface
-(UFI)](http://www.barrodale.com/bcs/universal-file-interface-ufi); it's
-a database extension based on the IBM Informix Virtual Table Interface
-(VTI). *(Please continue reading even if you don't have Informix running
-on your system, because IBM has just made available, at no charge, the
-[Innovator-C
-Edition](http://www-01.ibm.com/software/data/informix/innovator-c-edition/)
-of Informix.)* A demo that uses UFI to access wind speeds can be seen
-[here](http://www.barrodale.com/bcs/universal-file-interface-animation).
-
-VTI is a technology that supports making external datasets appear as
-tables to SQL queries and statements. UFI is a BCS database extension
-for delivering the contents of external data files as though they were
-rows in a database table. UFI makes a file look like a set of database
-tables, so "UFI managed tables" are actually virtual database tables.
-Consequently, users of UFI can perform SQL queries on their files
-without having to first load them into a database.
-
-DioVISTA/Storm {#DioVISTAStorm}
------------------------------------------------
-
-[DioVISTA/Storm](http://www.hitachi-power-solutions.com/products/product03/p03_61.html)
-is a commercial software package that visualizes content of netCDF files
-as a time series of grids, isosurfaces, and arrows on a 3D virtual
-earth. Its user interface is similar to standard 3D earth visualizing
-software. It displays OGC KML files, Shapefiles, and online map
-resources through OGC Web Tile Map Services (WTMS). It supports CF
-Conventions version 1.6 (lon-lat-alt-time axis and trajectory). Its
-first version was released on Aug 5 2014.
-
-Environmental WorkBench {#Environmental_WorkBench}
------------------------------------------------------------------
-
-[SuperComputer Systems Engineering and Services
-Company](http://www.ssesco.com/) (SSESCO) has developed the
-[Environmental WorkBench](http://www.ssesco.com/files/ewb.html) (EWB),
-an easy to use visualization and analysis application targeted at
-environmental data. The EWB currently has numerous users in the fields
-of meteorological research, air quality work, and groundwater
-remediation.
-EWB system features include:
-
--   Random access file structure using the netCDF-based public domain
-    MeRAF file system with support for gridded, discrete (non-grid-based
-    observation), and particle types
--   Support for geo-referenced or Cartesian coordinate systems
--   Object oriented Graphical User Interface (GUI) that is very easy to
-    use
--   Tools for converting model and observational data sets and data
-    writers to netCDF
--   Interactive rotation/translation of scenes in 3D space
--   Time sequencing controls to step forward/backward, animate
-    sequentially, or go to a chosen time step; including multiple
-    asynchronous or non-uniform time steps
--   Interactive slicers to select cross sections through 3D data sets
--   Display operators available on the slices, including
-    -   Contour lines with selectable contour levels
-    -   Color shading by data value with variable transparency level
-    -   Arrow and streamline representation for vector quantities
-    -   Positional reference lines at user selected intervals
-    -   Color coded shapes at each grid node
--   Multiple 3D isosurfaces at selected parameters and values with
-    variable transparency
--   Display of particle positions with coloring by type, height, and
-    source
--   Display of discrete data using colored spheres and labels for scalar
-    data and arrows for vectors (with arrowheads or meteorological
-    style)
--   Multiple user definable color maps to which isosurface and colored
-    field shading may be separately assigned
--   On screen annotation for generation of report ready figures
--   Image export in any of the common image formats (gif, tiff,
-    encapsulated postscript, etc.)
--   Graceful handling of missing or bad data values by all the graphics
-    rendering routines
--   Automatic data synchronization to allow automatic screen updating as
-    new data arrives in real-time from a model or set of sensors
--   Two and three dimensional interpolation from scattered observations
-    to a grid, using the Natural Neighbor Method. This robust volume
-    based method yields results far superior to distance weighting
-    schemes.
-
-Systems currently supported include Win95, WinNT, OS/2, IBM RS/6000,
-Silicon Graphics, HP and SUN workstations.
-
-SSESCO has implemented a meta-file layer on top of the netCDF library,
-called MeRAF. It handles multiple netCDF files as well as automatic
-max-min calculations, time-varying gridded, particle, and discrete data,
-logical groupings for discrete data, and an overall simplified and
-flexible interface for storing scientific data. MeRAF is being used by
-the DOE at the Hanford-Meteorological Site for observational data and
-will be used for their weather-modeling.
-
-ESRI {#ESRI}
----------------------------
-
-[ESRI ArcGIS](http://www.esri.com/software/arcgis/index.html) version
-9.2 and later support [accessing netCDF time-based and multidimensional
-data](http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=An_overview_of_data_support_in_ArcGIS)
-that follows CF or COARDS conventions for associating spatial locations
-with data. A selected slice of netCDF data may be displayed in ArcGIS as
-a raster layer, feature layer, or table. You can also drag a netCDF file
-from Windows Explorer and drop it in an ESRI application such as ArcMap.
-
-FME {#FME}
--------------------------
-
-[FME](http://www.safe.com/fme), developed by [Safe Software
-Inc.](http://www.safe.com), is a tool for transforming data for exchange
-between over [300 different formats and
-models](http://www.safe.com/fme/format-search/), including netCDF. FME's
-read and write support for netCDF allows users to move data into the
-netCDF common standard, regardless of its source, and conversely enables
-end-users to consume netCDF data for use in their preferred systems. For
-more information visit <http://www.safe.com/fme>.
-
-HDF Explorer {#HDF-Explorer}
--------------------------------------------
-
-[HDF Explorer](http://www.space-research.org/) is a data visualization
-program that reads the HDF, HDF5 and netCDF data file formats (including
-netCDF classic format data). HDF Explorer runs in the Microsoft Windows
-operating systems.
-
-HDF Explorer offers a simple yet powerful interface for the
-visualization of HDF and netCDF data. The data is just a click of the
-mouse away. Data is first viewed in a tree-like interface, and then
-optionally loaded and visualized in a variety of ways. HDF Explorer
-features include fast access to data, grid, scalar and vector views. It
-also allows exporting your data either as an ASCII text file or a bitmap
-image.
-
-IDL Interface {#IDL}
------------------------------------
-
-[IDL](http://www.exelisvis.com/ProductsServices/IDL.aspx) (Interactive
-Data Language) is a scientific computing environment, developed and
-supported by [Excelis Visual Information
-Solutions](http://www.exelisvis.com/), that combines mathematics,
-advanced data visualization, scientific graphics, and a graphical user
-interface toolkit to analyze and visualize scientific data. Designed for
-use by scientists and scientific application developers, IDL's
-array-oriented, fourth-generation programming language allows you to
-prototype and develop complete applications. IDL now supports data in
-netCDF format.
-As an example, here is how to read data from a netCDF variable named GP
-in a file named "data/aprin.nc" into an IDL variable named gp using the
-IDL language:
-
-       id = ncdf_open('data/april.nc')
-        ncdf_varget,id, ncdf_varid( id, 'GP'), gp
-
-Now you can visualize the data in the gp variable in a large variety of
-ways and use it in other computations in IDL. You can FTP a demo version
-of IDL, including the netCDF interface, by following the instructions in
-pub/idl/README available via anonymous FTP from gateway.rsinc.com or
-boulder.colorado.edu.
-Other software packages that use or interoperate with IDL to access
-netCDF data includes [ARGOS](#ARGOS), [CIDS Tools](#CIDS_Tools),
-[DDI](#DDI), [HIPHOP](#HIPHOP), [Hyperslab OPerator Suite
-(HOPS)](Hyperslab_OPerator_Suite_(HOPS)), and [Noesys](Noesys).
-
-InterFormat {#InterFormat}
------------------------------------------
-
-[InterFormat](http://www.radio-logic.com/) is a medical image format
-conversion program with both Motif and character interfaces. InterFormat
-can automatically identify and convert most popular medical image
-formats and write output files in many standard medical image formats,
-or in formats such as netCDF that are suitable for input to leading
-scientific visualization packages. InterFormat runs on UNIX
-workstations; a version for OpenVMS is also available. A separate
-external module for [IBM Data Explorer](#OpenDX) is available for use in
-IBM Data Explorer's Visual Program Editor.
-For more details about the formats handled, program features, and
-pricing, see the Radio-Logic web site at
-[\<http://www.radio-logic.com\>](http://www.radio-logic.com).
-
-IRIS Explorer Module {#IRIS_Explorer_Module}
------------------------------------------------------------
-
-The Atmospheric and Oceanic Sciences Group at the National Center for
-Supercomputing Applications (NCSA) and the Mesoscale Dynamics and
-Precipitation Branch at NASA-Goddard Space Flight Center have developed
-the NCSA PATHFINDER module set for [IRIS
-Explorer](http://www.nag.co.uk:70/1h/Welcome_IEC). Two of the modules,
-[ReadDFG](http://redrock.ncsa.uiuc.edu/PATHFINDER/pathrel2/explorer/ReadDFG/ReadDFG.html)
-(to output Grids), and
-[ReadDF](http://redrock.ncsa.uiuc.edu/PATHFINDER/pathrel2/explorer/ReadDF/ReadDF.html)
-(to output Lattices) are capable of reading from NCSA HDF files,
-MFHDF/3.3 files, and Unidata netCDF files. A user-friendly interface
-provides control and information about the contents of the files.
-
-For ReadDF, the format translation is handled transparently. Up to five
-unique lattices may be generated from the file (as these files can
-contain multiple data fields) using a single module. A variety of
-dimensionalities and data types are supported also. Multiple variables
-may be combined in a single lattice to generate vector data. All three
-Explorer coordinate systems are supported.
-
-With ReadDFG, user selected variables from the file are output in up to
-five PATHFINDER grids. Each grid can consist of scalar data from one
-variable or vector data from multiple variables. Coordinate information
-from the file is also included in the grids. Any number of dimensions in
-any of the Explorer coordinate types are supported.
-
-For more information on the NCSA PATHFINDER project and other available
-modules, visit the WWW/Mosaic PATHFINDER Home Page at
-<http://redrock.ncsa.uiuc.edu/PATHFINDER/pathrel2/top/top.html> The
-ReadDF module may be downloaded either via the WWW server or anonymous
-ftp at redrock.ncsa.uiuc.edu in the /pub/PATHFINDER directory. For more
-information please send email to: pathfinder at redrock.ncsa.uiuc.edu
-
-See also the information on [DDI](#DDI) for another way to use netCDF
-data with IRIS Explorer.
-
-LeoNetCDF {#LeoNetCDF}
--------------------------------------
-
-[LeoNetCDF](http://www.leokrut.com/leonetcdf.html) is a Windows
-application (Windows95/NT and higher) for editing netCDF files. It can
-display content of netCDF files in tree style control and permits
-editing its parameters in a standard Windows interface environment.
-
-Mathematica {#Mathematica}
------------------------------------------
-
-[Mathematica](http://www.wolfram.com/products/mathematica/index.html) is
-a technical computing environment that provides advanced numerical and
-symbolic computation and visualization. As of version 6, Mathematica
-adds classic [netCDF
-data](http://reference.wolfram.com/mathematica/ref/format/NetCDF.html)
-to the many forms of data it can import, export, and visualize.
-
-MATLAB {#MATLAB}
--------------------------------
-
-[MATLAB](http://www.mathworks.com/products/matlab/) is an integrated
-technical computing environment that combines numeric computation,
-advanced graphics and visualization, and a high-level programming
-language. Versions 7.7 and later of MATLAB have built-in support for
-reading and writing netCDF data. MATLAB version 2012a includes the
-netCDF 4.1.2 library with OPeNDAP client support turned on, so remote
-access to netCDF and other data formats supported by OPeNDAP servers is
-available.
-For earlier versions, several freely-available software packages that
-implement a MATLAB/netCDF interface are available:
-[nctoolbox](#nctoolbox), [NetCDF Toolbox for MATLAB-5](#NC4ML5),
-[MexEPS](#MexEPS), the [CSIRO MATLAB/netCDF interface](#CSIRO-MATLAB),
-[NetCDF
-reader](http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15177&objectType=file),
-and [fanmat](/software/netcdf/Contrib.html).
-
-
-
-Noesys {#Neosys}
--------------------------------
-
-[Noesys](http://www.rsinc.com/NOeSYS/index.cfm) is software for desktop
-science data access and visualization. Available for both Windows and
-Power Macintosh platforms, Noesys allows users to access, process,
-organize and visualize large amounts of technical data.
-Noesys can be used to:
-
--   Access and organize complex technical data
--   Export data objects to text and binary
--   View and edit large multidimensional data sets (up to 7D) in a
-    spreadsheet-like environment
--   Manipulate and process data using
-    [IDL®](http://www.exelisvis.com/ProductsServices/IDL.aspx), the
-    Interactive Data Language, from Research Systems, Inc.
--   Interactively visualize column, matrix, and volumetric data sets
--   Image global datasets as various map projections
--   Create various projections from partial data or partial projections
-    from global data (Windows only)
--   View and Edit HDF-EOS grid object data
--   Subset datasets and data tables with a GUI dialog
--   Change and save the number format of datasets and data table fields
--   Drag and Drop HDF objects between files to organize or subset files
--   Attach text annotations directly to the data file
--   Add new data objects to files and create hierarchical groups
--   Edit or create new color palettes
--   Generate publication-quality graphics for data presentation
-
-Noesys has an interface to IDL®, allowing data to move back and forth
-between Noesys and IDL with the click of a mouse. Noesys includes the
-visual data analysis tools, Transform, T3D and Plot, for menu driven
-plotting, rendering, and image analysis. Noesys can import HDF, HDF-EOS,
-netCDF, ASCII, Binary, DTED, GeoTIFF, SDTS, TIFF, PICT, and BMP files,
-create annotations, macros, images, projections and color palettes
-specific to the data and save it the result as an HDF file. Noesys also
-includes an HDF-EOS Grid Editor. Noesys runs on Windows 95/98 & NT and
-Power Macintosh OS. More details and information about ordering Noesys
-are available from
-[\<http://www.rsinc.com/NOeSYS/index.cfm\>](http://www.rsinc.com/NOeSYS/index.cfm).
-
-Origin {#Origin}
--------------------------------
-
-Ryan Toomey reports:
-
-Our website is <http://www.originlab.com/>
-
-A general description of Origin: Origin includes a suite of features
-that cater to the needs of scientists and engineers alike. Multi-sheet
-workbooks, publication-quality graphics, and standardized analysis tools
-provide a tightly integrated workspace for you to import data, create
-and annotate graphs, explore and analyze data, and publish your work. To
-ensure that Origin meets your data analysis requirements, intuitive
-tools for advanced statistics, regression, nonlinear curve fitting,
-signal processing, image processing and peak analysis are built-in.
-Since any analysis operation can be set to automatically recalculate,
-you can reuse your projects as templates for future work, thereby
-simplifying your daily routine.
-
-A general description of OriginPro: OriginPro offers all of the features
-of Origin plus extended analysis tools for statistics, 3D fitting, image
-processing and signal processing.
-
-A general description of OriginLab Corporation: "OriginLab Corporation
-produces professional data analysis and graphing software for scientists
-and engineers. Our products are designed to be easy-to-use, yet have the
-power and versatility to provide for the most demanding user."
-
-PPLUS {#PPLUS}
------------------------------
-
-[Plot-Plus (PPLUS)](http://dwd6.home.mindspring.com/) is a general
-purpose scientific graphics package, which is used in several PMEL
-applications. It will read most standard ascii or binary files, as well
-as netCDF file format, which used by the TOGA-TAO Project and the EPIC
-system for management display and analysis. PPLUS is an interactive,
-command driven, scientific graphics package which includes features such
-as Mercator projection, Polar Stereographic projection, color or gray
-scale area-fill contour plotting, and support for many devices:
-X-windows, PostScript, HP, Tektronix, and others. This powerful and
-flexible package recognizes netCDF data format, and it can extract axis
-lables and graph titles from the data files. The user can customize a
-plots, or combine several plots into a composite. Plots are of
-publication quality. The PPLUS graphics package is used for all the TAO
-workstation displays, including the animations. The animations are
-created by generating a PPLUS plot for each frame, transforming the
-PPLUS metacode files into HDF format with the PPLUS m2hdf filter, and
-then displaying the resulting bit maps as an animation with the
-XDataSlice utility, which is freely available on Internet from the
-National Center for Supercomputing Applications, at
-anonymous at ftp.ncsa.uiuc.edu (141.142.20.50). There is also a new m2gif
-utility which produces GIF files from PPLUS metacode files.
-PPLUS is supported for most Unix systems and for VAX/VMS, and is in use
-at many oceanographic institutes in the US (e.g., (PMEL, Harvard, WHOI,
-Scripps, NCAR, NASA, University of Rhode Island, University of Oregon,
-Texas A&M...) and also internationally (Japan, Germany, Australia,
-Korea...).
-
-Plot Plus is now available at no charge. It does require licensing on a
-per computer basis, but the license is at no cost. For more information
-about licensing, see
-[http://dwd6.home.mindspring.com/pplus_license.html/](http://dwd6.home.mindspring.com/pplus_license.html);
-source and documentation are available via anonymous FTP from
-<ftp://ftp.halcyon.com/pub/users/dwd/pplus1_3_2.tar.gz> and
-<ftp://ftp.pmel.noaa.gov/epic/manual-dir/pplus.pdf>.
-
-        Email:      plot_plus at halcyon.com
-        Postal mail:    c/o Donald Denbo
-                2138 N 186th St
-                Shoreline, WA 98133
-        Fax and Voice:  (206) 366-0624
-
-PV-Wave {#PV-Wave}
----------------------------------
-
-[PV-Wave](http://www.vni.com/products/wave/index.html) is a software
-environment from [Visual Numerics](http://www.vni.com/) for solving
-problems requiring the application of graphics, mathematics, numerics
-and statistics to data and equations.
-PV-WAVE uses a fourth generation language (4GL) that analyzes and
-displays data as you enter commands. PV-WAVE includes integrated
-graphics, numerics, data I/O, and data management. The latest version of
-PV-Wave supports data access in numerous formats, including netCDF.
-
-See also the information on [DDI](#DDI) for another way to use netCDF
-data with PV-Wave.
-
-Slicer Dicer {#SlicerDicer}
-------------------------------------------
-
-[Slicer Dicer](http://www.slicerdicer.com/) is a volumetric data
-visualization tool, currently available for Windows and under
-development for other platforms. The Slicer Dicer Web site includes a
-complete list of features, an on-line user's guide, and examples of
-Slicer Dicer output. Visualizations features include:
--   Perspective view of data rendered on interactively selected
-    orthogonal slices, oblique slices, blocks (arbitrary rectilinear
-    sub-volumes), cutouts, isosurfaces, and projected volumes (projected
-    maximum, minimum, maximum absolute, or minimum absolute).
--   Optional annotations: caption, axes ticks and labels (default
-    "pretty" ticks, or override to place ticks where you want them),
-    color legend, data-cube outline.
--   Animation modes: slices, space, time (any parametric dimension),
-    transparency, oblique slice orientation, rotation. Built-in
-    animation viewer supports speed and image size controls,
-    single-step, forward, backward, loop, and back-and-forth modes.
--   Select color scale from 25+ built in color tables, or import from
-    palette file. Any data level or range of levels can be painted with
-    an arbitrary color.
--   Any data level or range of levels can be rendered as either opaque
-    or transparent.
-
-Surfer {#Surfer}
-------------------------------------------
-
-[Surfer](http://www.goldensoftware.com/products/surfer) is a 3D
-visualization, contouring, and surface modeling package that runs
-under Microsoft Windows. Surfer is useful for terrain modeling,
-bathymetric modeling, landscape visualization, surface analysis,
-contour mapping, watershed and 3D surface mapping, gridding,
-volumetrics, and more. A sophisticated interpolation engine transforms
-XYZ data into publication-quality maps. Surfer imports from and
-exports to a multitude of file formats, including NetCDF grids.
-
-vGeo {#vGeo}
----------------------------
-
-[vGeo](http://www.vrco.com/products/vgeo/vgeo.html) (Virtual Global
-Explorer and Observatory) is an end-user product from
-[VRCO](http://www.vrco.com/) designed to import and visualize multiple
-disparate data sets, including computer simulations, observed
-measurements, images, model objects, and more. vGeo is available for
-IRIX, Linux and Windows platforms and supports displays ranging from
-desktop monitors to multi-walled projection systems. It accepts data in
-a variety of formats, including netCDF, and allows the user to specify
-how multiple files and variables are mapped into a data source. 3D
-graphics are built from the underlying data in real-time, and the user
-has interactive control of graphics, navigation, animation, and more.
-
-VISAGE and Decimate {#VISAGE_and_Decimate}
----------------------------------------------------------
-
-[VISAGE](http://www.crd.ge.com/esl/cgsp/projects/visage/)
-(VISualization, Animation, and Graphics Environment) is a turnkey 3D
-visualization system developed at General Electric Corporate Research
-and Development, (Schroeder, WJ et al, "VISAGE: An Object-Oriented
-Scientific Visualization System", Proceedings of Visualization \`92
-Conference). VISAGE is designed to interface with a wide variety of
-data, and uses netCDF as the preferred format.
-
-VISAGE is used at GE Corporate R & D, GE Aircraft Engine, GE Canada, GE
-Power Generation, as well as ETH Zurich, Switzerland, MQS In Chieti,
-Italy, and Rensselaer Polytechnic Institute in Troy, New York.
-
-GE has another application called "Decimate" that does polygon
-reduction/decimation (Schroeder,WJ et al, "Decimation of Triangle
-Meshes", Proceedings of SIGGRAPH \`92). This application uses netCDF as
-a preferred format. Decimate is currently licensed to Cyberware, Inc.,
-makers of 3D laser digitizing hardware. Decimate is currently bundled
-with the scanners, and will soon be available as a commercial product.
-
-Voyager {#Voyager}
----------------------------------
-
-[Makai Voyager](http://voyager.makai.com/), developed by Makai Ocean
-Engineering, Inc., is 3D/4D geospatial visualization software that
-enables users to import, fuse, view, and analyze large earth, ocean, and
-atmosphere scientific data as it is collected or simulated in a global
-geo-referenced GIS platform. The key differentiator of Makai Voyager is
-its level-of-detail (LOD) technology that enables users to stream big
-data rapidly over a network or the web.
-
-Features in Makai Voyager Version 1.2 include:
-
--   Preprocessing LiDAR, GIS, & volumetric data from common formats into
-    streamable files
--   Volume rendering for large 4D (3D + time) data, such as NetCDF
--   Analysis tools and customizable graphs
--   WMS and other streamable formats
-
-Individual or group licenses are available for Windows (32- and 64-bit),
-Linux, and Mac OS X. A full-featured 30-day trial version of Makai
-Voyager is [available for download](http://voyager.makai.com).
diff --git a/docs/windows-binaries.md b/docs/windows-binaries.md
index 4b0cae3..bebfa7b 100644
--- a/docs/windows-binaries.md
+++ b/docs/windows-binaries.md
@@ -32,14 +32,14 @@ The included dependencies and versions are as follows:
 * `libcurl`: 7.35.0
 * `zlib`:    1.2.8
 
-## Latest Release (netCDF-C 4.5.0-rc1) {#msvc-latest-release}
+## Latest Release (netCDF-C 4.5.0-rc2) {#msvc-latest-release}
 
 Configuration		| 32-bit 						| 64-bit |
 :-------------------|:--------							|:-------|
-netCDF 3		| [netCDF4.5.0-rc1-NC3-32.exe][r1]		| [netCDF4.5.0-rc1-NC3-64.exe][r6]
-netCDF3+DAP		| [netCDF4.5.0-rc1-NC3-DAP-32.exe][r2]	| [netCDF4.5.0-rc1-NC3-DAP-64.exe][r6]
-netCDF4			| [netCDF4.5.0-rc1-NC4-32.exe][r3]		| [netCDF4.5.0-rc1-NC4-64.exe][r7]
-netCDF4+DAP		| [netCDF4.5.0-rc1-NC4-DAP-32.exe][r4]	| [netCDF4.5.0-rc1-NC4-DAP-64.exe][r8]
+netCDF 3		| [netCDF4.5.0-rc2-NC3-32.exe][r1]		| [netCDF4.5.0-rc2-NC3-64.exe][r6]
+netCDF3+DAP		| [netCDF4.5.0-rc2-NC3-DAP-32.exe][r2]	| [netCDF4.5.0-rc2-NC3-DAP-64.exe][r6]
+netCDF4			| [netCDF4.5.0-rc2-NC4-32.exe][r3]		| [netCDF4.5.0-rc2-NC4-64.exe][r7]
+netCDF4+DAP		| [netCDF4.5.0-rc2-NC4-DAP-32.exe][r4]	| [netCDF4.5.0-rc2-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.5.0-rc1-NC3-32.exe
-[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC3-DAP-32.exe
-[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC4-32.exe
-[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC4-DAP-32.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC3-64.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC3-DAP-64.exe
-[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC4-64.exe
-[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc1-NC4-DAP-64.exe
+[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC3-32.exe
+[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC3-DAP-32.exe
+[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC4-32.exe
+[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC4-DAP-32.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC3-64.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC3-DAP-64.exe
+[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC4-64.exe
+[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.5.0-rc2-NC4-DAP-64.exe
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in
index b5be590..6bc305c 100644
--- a/examples/C/Makefile.in
+++ b/examples/C/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/examples/CDL/Makefile.in b/examples/CDL/Makefile.in
index bc5fd49..e295081 100644
--- a/examples/CDL/Makefile.in
+++ b/examples/CDL/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 01901dd..753cc7d 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/h5_test/Makefile.in b/h5_test/Makefile.in
index f266281..e94d847 100644
--- a/h5_test/Makefile.in
+++ b/h5_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/h5_test/run_par_tests.sh b/h5_test/run_par_tests.sh
index 84ea3f0..ee0b8c7 100755
--- a/h5_test/run_par_tests.sh
+++ b/h5_test/run_par_tests.sh
@@ -8,8 +8,8 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 # $Id: run_par_tests.sh,v 1.2 2007/12/20 16:25:26 ed Exp $
 
 # Even for successful runs, mpiexec seems to set a non-zero return
-# code!  
-#set -e
+# code!
+set -e
 echo ""
 echo "Testing parallel I/O with HDF5..."
 
diff --git a/h5_test/tst_h_dimscales.c b/h5_test/tst_h_dimscales.c
index b16a1ae..73c817d 100644
--- a/h5_test/tst_h_dimscales.c
+++ b/h5_test/tst_h_dimscales.c
@@ -16,7 +16,7 @@
 #define STR_LEN 255
 #define MAX_DIMS 255
 
-herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid, 
+herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid,
 		     void *visitor_data)
 {
    char name1[STR_LEN], name2[STR_LEN];
@@ -30,9 +30,9 @@ herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid,
 /*    printf("name of dsid: %s\n", name2); */
 
    if (H5Gget_objinfo(did, ".", 1, &statbuf) < 0) ERR;
-/*   printf("statbuf.fileno = %d statbuf.objno = %d\n", 
+/*   printf("statbuf.fileno = %d statbuf.objno = %d\n",
      statbuf.fileno, statbuf.objno);*/
-   
+
    return 0;
 }
 
@@ -47,7 +47,7 @@ rec_scan_group(hid_t grpid)
    int num_scales;
    hsize_t dims[MAX_DIMS], max_dims[MAX_DIMS];
    int ndims, d;
-   
+
    /* Loop through datasets to find variables. */
    if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR;
    for (i=0; i<num_obj; i++)
@@ -56,7 +56,7 @@ rec_scan_group(hid_t grpid)
        * the object. */
       if ((obj_class = H5Gget_objtype_by_idx(grpid, i)) < 0) ERR;
       if (H5Gget_objname_by_idx(grpid, i, obj_name, STR_LEN) < 0) ERR;
-      /*printf("\nEncountered: HDF5 object obj_class %d obj_name %s\n", 
+      /*printf("\nEncountered: HDF5 object obj_class %d obj_name %s\n",
 	obj_class, obj_name);*/
 
       /* Deal with groups and datasets, ignore the rest. */
@@ -86,7 +86,7 @@ rec_scan_group(hid_t grpid)
 	    else
 	    {
 	       int visitor_data = 0;
-		  
+
 	       /* Here's how to get the number of scales attached
 		* to the dataset's dimension 0. */
 	       if ((num_scales = H5DSget_num_scales(datasetid, 0)) < 0) ERR;
@@ -136,34 +136,34 @@ main()
       hsize_t dimscale_dims[1] = {DIM1_LEN};
 
       /* 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;
-      
+
       /* Create our dimension scale. Use the built-in NAME attribute
        * on the dimscale. */
-      if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims, 
+      if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims,
 					       dimscale_dims)) < 0) ERR;
-      if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, 
+      if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT,
 				  dimscale_spaceid, H5P_DEFAULT)) < 0) ERR;
       if (H5DSset_scale(dimscaleid, NAME_ATTRIBUTE) < 0) ERR;
 
       /* Create a 1D variable which uses the dimscale. Attach a label
        * to this scale. */
       if ((var1_spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
-      if ((var1_datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT, 
+      if ((var1_datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT,
 				      var1_spaceid, H5P_DEFAULT)) < 0) ERR;
       if (H5DSattach_scale(var1_datasetid, dimscaleid, 0) < 0) ERR;
       if (H5DSset_label(var1_datasetid, 0, FIFTIES_SONG) < 0) ERR;
 
       /* Create a 1D variabls that doesn't use the dimension scale. */
-      if ((var2_datasetid = H5Dcreate(grpid, VAR2_NAME, H5T_NATIVE_INT, 
+      if ((var2_datasetid = H5Dcreate(grpid, VAR2_NAME, H5T_NATIVE_INT,
 				      var1_spaceid, H5P_DEFAULT)) < 0) ERR;
 
       /* Create a 2D dataset which uses the scale for one of its
        * dimensions. */
       if ((var3_spaceid = H5Screate_simple(2, dims, dims)) < 0) ERR;
-      if ((var3_datasetid = H5Dcreate(grpid, VAR3_NAME, H5T_NATIVE_INT, 
+      if ((var3_datasetid = H5Dcreate(grpid, VAR3_NAME, H5T_NATIVE_INT,
 				      var3_spaceid, H5P_DEFAULT)) < 0) ERR;
       if (H5DSattach_scale(var3_datasetid, dimscaleid, 0) < 0) ERR;
 
@@ -199,7 +199,7 @@ main()
       /* Reopen the file and group. */
       if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR;
       if ((grpid = H5Gopen(fileid, GRP_NAME)) < 0) ERR;
-      
+
       /* Loop through datasets to find variables. */
       if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR;
       for (i=0; i<num_obj; i++)
@@ -224,7 +224,7 @@ main()
 	       {
 		  H5Dclose(datasetid);
 	       }
-	       
+
 	       if ((datasetid = H5Dopen(grpid, obj_name)) < 0) ERR;
 	       if ((is_scale = H5DSis_scale(datasetid)) < 0) ERR;
 	       if (is_scale && strcmp(obj_name, DIMSCALE_NAME)) ERR;
@@ -234,7 +234,7 @@ main()
 
 		  /* A dimscale comes with a NAME attribute, in
 		   * addition to its real name. */
-		  if (H5DSget_scale_name(datasetid, nom_de_quincey, 
+		  if (H5DSget_scale_name(datasetid, nom_de_quincey,
 					 STR_LEN) < 0) ERR;
 		  if (strcmp(nom_de_quincey, NAME_ATTRIBUTE)) ERR;
 
@@ -254,7 +254,7 @@ main()
 		  if (strcmp(obj_name, VAR1_NAME) == 0 && num_scales != 1) ERR;
 		  if (strcmp(obj_name, VAR2_NAME) == 0 && num_scales > 0) ERR;
 		  if (strcmp(obj_name, VAR3_NAME) == 0 && num_scales != 1) ERR;
-		  
+
 		  /* There's also a label for dimension 0 of var1. */
 		  if (strcmp(obj_name, VAR1_NAME) == 0)
 		  {
@@ -292,15 +292,15 @@ main()
       int v;
 
       /* 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;
-      
+
       /* Create our dimension scale. Use the built-in NAME attribute
        * on the dimscale. */
-      if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims, 
+      if ((dimscale_spaceid = H5Screate_simple(1, dimscale_dims,
 					       dimscale_dims)) < 0) ERR;
-      if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, 
+      if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT,
 				  dimscale_spaceid, H5P_DEFAULT)) < 0) ERR;
       if (H5DSset_scale(dimscaleid, NAME_ATTRIBUTE) < 0) ERR;
 
@@ -309,7 +309,7 @@ main()
       for (v = 0; v < NUM_DATASETS; v++)
       {
 	 sprintf(var_name, "var_%d", v);
-	 if ((var1_datasetid[v] = H5Dcreate(grpid, var_name, H5T_NATIVE_INT, 
+	 if ((var1_datasetid[v] = H5Dcreate(grpid, var_name, H5T_NATIVE_INT,
 					    var1_spaceid, H5P_DEFAULT)) < 0) ERR;
 	 if (H5DSattach_scale(var1_datasetid[v], dimscaleid, 0) < 0) ERR;
       }
@@ -332,7 +332,7 @@ main()
       hsize_t dims[1] = {1}, maxdims[1] = {H5S_UNLIMITED};
 
       /* Create file and 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;
 
@@ -343,12 +343,12 @@ main()
       if (H5Pset_chunk(cparmsid, 1, dims) < 0) ERR;
 
       /* Create our dimension scale, as an unlimited dataset. */
-      if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT, 
+      if ((dimscaleid = H5Dcreate(grpid, DIMSCALE_NAME, H5T_NATIVE_INT,
 				  spaceid, cparmsid)) < 0) ERR;
       if (H5DSset_scale(dimscaleid, NAME_ATTRIBUTE) < 0) ERR;
 
       /* Create a variable which uses it. */
-      if ((datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT, 
+      if ((datasetid = H5Dcreate(grpid, VAR1_NAME, H5T_NATIVE_INT,
 				 spaceid, cparmsid)) < 0) ERR;
       if (H5DSattach_scale(datasetid, dimscaleid, 0) < 0) ERR;
       if (H5DSset_label(datasetid, 0, "dimension label") < 0) ERR;
@@ -367,7 +367,7 @@ main()
 
    {
       hid_t fileid, grpid, spaceid = 0, datasetid = 0;
-      hsize_t num_obj, i;
+      hsize_t volatile num_obj, i;
       int obj_class;
       char obj_name[STR_LEN + 1];
       htri_t is_scale;
@@ -377,7 +377,7 @@ main()
       /* Reopen the file and group. */
       if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR;
       if ((grpid = H5Gopen(fileid, GRP_NAME)) < 0) ERR;
-      
+
       /* Loop through datasets to find variables. */
       if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR;
       for (i=0; i<num_obj; i++)
@@ -401,7 +401,7 @@ main()
 		  H5Dclose(datasetid);
 		  datasetid = 0;
 	       }
-	       
+
 	       /* Open the dataset. */
 	       if ((datasetid = H5Dopen(grpid, obj_name)) < 0) ERR;
 
@@ -434,9 +434,9 @@ main()
 		  if (num_scales != 1) ERR;
 
 		  /* Go through all dimscales for this var and learn about them. */
-		  if (H5DSiterate_scales(datasetid, 0, NULL, alien_visitor, 
+		  if (H5DSiterate_scales(datasetid, 0, NULL, alien_visitor,
 					 &visitor_data) < 0) ERR;
-		  
+
 		  /* There's also a label for dimension 0. */
 		  if (H5DSget_label(datasetid, 0, label, STR_LEN) < 0) ERR;
 
@@ -464,7 +464,7 @@ main()
 
    {
 #define NDIMS 3
-#define TIME_DIM 0      
+#define TIME_DIM 0
 #define LAT_DIM 1
 #define LON_DIM 2
 #define LAT_LEN 2
@@ -569,7 +569,7 @@ main()
       /* Reopen the file and group. */
       if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR;
       if ((grpid = H5Gopen(fileid, GRP_NAME)) < 0) ERR;
-      
+
       /* Loop through datasets to find variables. */
       if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR;
       for (i=0; i<num_obj; i++)
@@ -602,15 +602,15 @@ main()
 
 		  /* A dimscale comes with a NAME attribute, in
 		   * addition to its real name. */
-		  if (H5DSget_scale_name(datasetid, nom_de_quincey, 
+		  if (H5DSget_scale_name(datasetid, nom_de_quincey,
 					 STR_LEN) < 0) ERR;
-		  /*printf("found scale %s, NAME %s id 0x%x\n", obj_name, 
+		  /*printf("found scale %s, NAME %s id 0x%x\n", obj_name,
 		    nom_de_quincey, datasetid);*/
 
 		  /* Check size depending on name. */
 		  if ((!strcmp(obj_name, LAT_NAME) && dims[TIME_DIM] != LAT_LEN) ||
 		      (!strcmp(obj_name, LON_NAME) && dims[TIME_DIM] != LON_LEN) ||
-		      (!strcmp(obj_name, TIME_NAME) && 
+		      (!strcmp(obj_name, TIME_NAME) &&
 		       max_dims[TIME_DIM] != H5S_UNLIMITED)) ERR;
 
 	       }
@@ -618,9 +618,9 @@ main()
 	       {
 		  char label[STR_LEN+1];
 		  int visitor_data = 0;
-		  
+
 		  /* SHould have these dimensions... */
-		  if (dims[TIME_DIM] != 0 || dims[LAT_DIM] != LAT_LEN || 
+		  if (dims[TIME_DIM] != 0 || dims[LAT_DIM] != LAT_LEN ||
 		      dims[LON_DIM] != LON_LEN) ERR;
 		  if (max_dims[TIME_DIM] != H5S_UNLIMITED) ERR;
 
@@ -636,7 +636,7 @@ main()
 		     if (H5DSiterate_scales(datasetid, d, NULL, alien_visitor,
 					    &visitor_data) < 0) ERR;
 		  /*printf("visitor_data: 0x%x\n", visitor_data);*/
-		  
+
 		  /* There's also a label for each dimension. */
 		  if (H5DSget_label(datasetid, 0, label, STR_LEN) < 0) ERR;
 		  if (strcmp(label, TIME_NAME)) ERR;
@@ -673,7 +673,7 @@ main()
 #define SMELLINESS_NAME "Smelliness"
 #define DISTANCE_NAME "Distance"
 #define TIME_NAME "Time"
-#define TIME_DIM 0      
+#define TIME_DIM 0
 #define SMELLINESS_DIM 1
 #define DISTANCE_DIM 2
 #define GOAT_NAME "Billy_goat_gruff"
@@ -773,7 +773,7 @@ main()
       /* If we can't scan the group, crash into a flaming heap of
        * smoking, smoldering rubbish. */
       if (rec_scan_group(grpid)) ERR;
-      
+
       /* Close up the shop. */
       if (H5Gclose(grpid) < 0 ||
 	  H5Fclose(fileid) < 0) ERR;
@@ -783,4 +783,3 @@ main()
 #endif
    FINAL_RESULTS;
 }
-
diff --git a/h5_test/tst_h_enums.c b/h5_test/tst_h_enums.c
index bde07c5..08906df 100644
--- a/h5_test/tst_h_enums.c
+++ b/h5_test/tst_h_enums.c
@@ -8,6 +8,7 @@
 */
 #include "h5_err_macros.h"
 #include <hdf5.h>
+#include "config.h"
 
 #define FILE_NAME "tst_h_enums.h5"
 #define DIM1_LEN 12
@@ -49,11 +50,11 @@ main()
       short data_in[DIM1_LEN];
       int i;
       short val[NUM_VALS];
-      char love_how[NUM_VALS][STR_LEN + 1] = {"Depth", "Bredth", 
-						  "Height", "Level", 
-						  "Freely", "Purely", 
-						  "Passionately", "Lost", 
-						  "Breath", "Smiles", 
+      char love_how[NUM_VALS][STR_LEN + 1] = {"Depth", "Breadth",
+						  "Height", "Level",
+						  "Freely", "Purely",
+						  "Passionately", "Lost",
+						  "Breath", "Smiles",
 						  "Tears", "After Death"};
 /*      H5T_class_t type_class;*/
       size_t size;
@@ -62,18 +63,18 @@ main()
       char *member_name;
       htri_t types_equal;
       hid_t base_hdf_typeid;
-	 
-      
+
+
       for (i=0; i < NUM_VALS; i++)
 	 val[i] = i*2;
       for (i=0; i < DIM1_LEN; i++)
 	 data[i] = i*2;
-      
+
       /* Open 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 ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR;
-      
+
       /* Create enum type. */
       /* Both methods do the same thing, but Quincey says to prefer
        * H5Tcreate_enum. */
@@ -83,7 +84,7 @@ main()
       /* Insert some values. */
       for (i=0; i<NUM_VALS; i++)
 	 if (H5Tenum_insert(typeid, love_how[i], &val[i]) < 0) ERR;
-      
+
       /* Write an attribute of this type. */
       if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR;
       if ((attid = H5Acreate(grpid, ATT_NAME, typeid, spaceid,
@@ -94,10 +95,10 @@ main()
       if (H5Aclose(attid) < 0 ||
 	  H5Tclose(typeid) < 0 ||
 	  H5Gclose(grpid) < 0 ||
-	  H5Fclose(fileid) < 0) ERR; 
+	  H5Fclose(fileid) < 0) ERR;
 
       /* Reopen the file. */
-      if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, 
+      if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR,
 			    H5P_DEFAULT)) < 0) ERR;
       if ((grpid = H5Gopen(fileid, GRP_NAME)) < 0) ERR;
 
@@ -112,7 +113,7 @@ main()
       if ((base_hdf_typeid = H5Tget_super(typeid)) < 0) ERR;
       if ((types_equal = H5Tequal(base_hdf_typeid, H5T_NATIVE_SHORT)) < 0) ERR;
       if (!types_equal) ERR;
-      
+
       /* Check each value and number in the enum. */
       for (i=0; i < NUM_VALS; i++)
       {
@@ -120,7 +121,11 @@ main()
 	 if (the_value != val[i]) ERR;
 	 member_name = H5Tget_member_name(typeid, i);
 	 if (strcmp(member_name, love_how[i])) ERR;
-	 free(member_name);
+#ifdef HDF5_HAS_H5FREE
+	 H5free_memory(member_name);
+#else
+     free(member_name);
+#endif
       }
 
       /* Now read the data in the attribute and make sure it's what we
@@ -133,13 +138,13 @@ main()
       if (H5Aclose(attid) < 0 ||
 	  H5Tclose(typeid) < 0 ||
 	  H5Gclose(grpid) < 0 ||
-	  H5Fclose(fileid) < 0) ERR; 
+	  H5Fclose(fileid) < 0) ERR;
    }
    SUMMARIZE_ERR;
 
    printf("*** Checking HDF5 enum type missing values...");
    {
-#define NUM_LANG 4      
+#define NUM_LANG 4
 #define VAR_LANG_NAME "Programming_Language"
 #define FV_NAME "_FillValue"
 #define GRP_NAME2 "NetCDF_Programming"
@@ -165,39 +170,39 @@ main()
       val[1] = Fortran;
       val[2] = CPP;
       val[3] = MISSING;
-	 
+
       /* Open 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 ((grpid = H5Gcreate(fileid, GRP_NAME2, 0)) < 0) ERR;
-      
+
       /* Create enum type. */
       if ((typeid =  H5Tenum_create(H5T_NATIVE_SHORT)) < 0) ERR;
 
       /* Insert some values. */
       for (i=0; i<NUM_LANG; i++)
 	 if (H5Tenum_insert(typeid, lang[i], &val[i]) < 0) ERR;
-      
+
       /* Create a dataset of this enum type, with fill value. */
       if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR;
       if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
       if (H5Pset_fill_value(plistid, typeid, &fill_value) < 0) ERR;
-      if ((datasetid = H5Dcreate(grpid, VAR_LANG_NAME, typeid, 
+      if ((datasetid = H5Dcreate(grpid, VAR_LANG_NAME, typeid,
 				 spaceid, plistid)) < 0) ERR;
 
       /* Create a netCDFstyle _FillValue attribute, though it will be
        * ignored by HDF5. */
       if ((att_spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
-      if ((attid = H5Acreate(grpid, FV_NAME, typeid, att_spaceid, 
+      if ((attid = H5Acreate(grpid, FV_NAME, typeid, att_spaceid,
 			     H5P_DEFAULT)) < 0) ERR;
       if (H5Awrite(attid, typeid, &fill_value) < 0) ERR;
 
       /* Write one value, the rest will end up set to MISSING. */
       if ((mem_spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
       if ((file_spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR;
-      if (H5Sselect_hyperslab(file_spaceid, H5S_SELECT_SET, 
+      if (H5Sselect_hyperslab(file_spaceid, H5S_SELECT_SET,
 			      start, NULL, count, NULL) < 0) ERR;
-      if (H5Dwrite(datasetid, typeid, mem_spaceid, file_spaceid, 
+      if (H5Dwrite(datasetid, typeid, mem_spaceid, file_spaceid,
 		   H5P_DEFAULT, &data_point) < 0) ERR;
 
       /* Close everything. */
@@ -209,7 +214,7 @@ main()
 	  H5Pclose(plistid) < 0 ||
 	  H5Tclose(typeid) < 0 ||
 	  H5Gclose(grpid) < 0 ||
-	  H5Fclose(fileid) < 0) ERR; 
+	  H5Fclose(fileid) < 0) ERR;
 
       /* Reopen the file. */
       if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR;
@@ -226,7 +231,7 @@ main()
       if ((base_hdf_typeid = H5Tget_super(typeid)) < 0) ERR;
       if ((types_equal = H5Tequal(base_hdf_typeid, H5T_NATIVE_SHORT)) < 0) ERR;
       if (!types_equal) ERR;
-      
+
       /* Check each value and number in the enum. */
       for (i=0; i < NUM_LANG; i++)
       {
@@ -234,7 +239,11 @@ main()
 	 if (the_value != val[i]) ERR;
 	 member_name = H5Tget_member_name(typeid, i);
 	 if (strcmp(member_name, lang[i])) ERR;
-	 free(member_name);
+#ifdef HDF5_HAS_H5FREE
+	 H5free_memory(member_name);
+#else
+     free(member_name);
+#endif
       }
 
       /* Now read the data in the dataset and make sure it's what we
@@ -260,12 +269,12 @@ main()
 /* #define GRP_NAME3 "STOP!" */
 
 /*       hid_t fileid, grpid,  typeid; */
-      
+
 /*       /\* Open file. *\/ */
 /*       if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,  */
 /* 			      H5P_DEFAULT)) < 0) ERR; */
 /*       if ((grpid = H5Gcreate(fileid, GRP_NAME3, 0)) < 0) ERR; */
-      
+
 /*       /\* Create enum type. *\/ */
 /*       if ((typeid =  H5Tenum_create(H5T_NATIVE_SHORT)) < 0) ERR; */
 
diff --git a/include/Makefile.in b/include/Makefile.in
index 4495abf..8baca2a 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/include/nc4internal.h b/include/nc4internal.h
index 1aa6068..aec7cb0 100644
--- a/include/nc4internal.h
+++ b/include/nc4internal.h
@@ -66,6 +66,9 @@ typedef enum {VAR, DIM, ATT} NC_OBJ_T;
 #define X_LONG_MIN	X_INT_MIN
 #define X_LONG_MAX	X_INT_MAX
 #define X_UINT_MAX	4294967295U
+#define X_INT64_MIN	(-9223372036854775807LL-1LL)
+#define X_INT64_MAX	9223372036854775807LL
+#define X_UINT64_MAX	18446744073709551615ULL
 #ifdef WIN32 /* Windows, of course, has to be a *little* different. */
 #define X_FLOAT_MAX	3.402823466e+38f
 #else
diff --git a/include/nctime.h b/include/nctime.h
index 7f0d291..13e80de 100644
--- a/include/nctime.h
+++ b/include/nctime.h
@@ -4,6 +4,9 @@
  *   $Id: nctime.h,v 1.6 2010/03/18 19:24:26 russ Exp $
  *********************************************************************/
 
+#ifndef _NCTIME_H
+#define _NCTIME_H
+
 struct bounds_node{
     int ncid;	  /* group (or file) in which variable with associated
 		   * bounds variable resides */
@@ -14,7 +17,7 @@ struct bounds_node{
 
 typedef struct bounds_node bounds_node_t;
 
-/* 
+/*
  * This code was extracted with permission from the CDMS time
  * conversion and arithmetic routines developed by Bob Drach, Lawrence
  * Livermore National Laboratory as part of the cdtime library.
@@ -158,4 +161,4 @@ extern int cdParseRelunits(cdCalenType timetype, char* relunits, cdUnitTime* uni
 #endif /* DLL Considerations. */
 
 
-
+#endif /* ifdef */
diff --git a/include/ncutf8.h b/include/ncutf8.h
index 4ddbf75..fca22ca 100644
--- a/include/ncutf8.h
+++ b/include/ncutf8.h
@@ -6,6 +6,8 @@
 #ifndef NCUTF8_H
 #define NCUTF8_H 1
 
+#include "ncexternl.h"
+
 /* Provide a wrapper around whatever utf8 library we use. */
 
 /*
@@ -15,7 +17,7 @@
  * NC_ENOMEM -- out of memory
  * NC_EBADNAME-- not valid utf8
  */
-extern int nc_utf8_validate(const unsigned char * name);
+EXTERNL int nc_utf8_validate(const unsigned char * name);
 
 /*
  * Apply NFC normalization to a string.
@@ -28,7 +30,19 @@ extern int nc_utf8_validate(const unsigned char * name);
  * NC_ENOMEM -- out of memory
  * NC_EBADNAME -- other failure
  */
-extern int nc_utf8_normalize(const unsigned char* str, unsigned char** normalp);
+EXTERNL int nc_utf8_normalize(const unsigned char* str, unsigned char** normalp);
 
-#endif /*NCUTF8_H*/
+/*
+ * Convert a normalized utf8 string to utf16. This is approximate
+ * because it just does the truncation version of conversion for
+ * each 32-bit codepoint to get the corresponding utf16.
+ * Return codes:
+ * NC_NOERR -- success
+ * NC_ENOMEM -- out of memory
+ * NC_EINVAL -- invalid argument or internal error
+ * NC_EBADNAME-- not valid utf16
+ */
 
+EXTERNL int nc_utf8_to_utf16(const unsigned char* s8, unsigned short** utf16p, size_t* lenp);
+
+#endif /*NCUTF8_H*/
diff --git a/include/ncwinpath.h b/include/ncwinpath.h
index 0960011..28e9058 100644
--- a/include/ncwinpath.h
+++ b/include/ncwinpath.h
@@ -10,15 +10,16 @@
 #include <stdio.h>
 #include "ncexternl.h"
 
+#ifndef WINPATH
 #ifdef _MSC_VER
 #define WINPATH 1
 #endif
 #ifdef __MINGW32__
 #define WINPATH 1
 #endif
+#endif
 
-
-/* path converter */
+/* Path Converter */
 EXTERNL char* NCpathcvt(const char* path);
 
 #ifdef WINPATH
diff --git a/include/netcdf.h b/include/netcdf.h
index 176c791..cbdd185 100644
--- a/include/netcdf.h
+++ b/include/netcdf.h
@@ -101,9 +101,6 @@ extern "C" {
 #define NC_MAX_INT64 (9223372036854775807LL)
 #define NC_MIN_INT64 (-9223372036854775807LL-1)
 #define NC_MAX_UINT64 (18446744073709551615ULL)
-#define X_INT64_MAX     (9223372036854775807LL)
-#define X_INT64_MIN     (-X_INT64_MAX - 1)
-#define X_UINT64_MAX    (18446744073709551615ULL)
 /**@}*/
 
 /** Name of fill value attribute.  If you wish a variable to use a
diff --git a/install-sh b/install-sh
index 0b0fdcb..0360b79 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2013-12-25.23; # UTC
+scriptversion=2016-01-11.22; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -496,6 +496,6 @@ done
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/libdap2/Makefile.in b/libdap2/Makefile.in
index 6a83f8e..8af356b 100644
--- a/libdap2/Makefile.in
+++ b/libdap2/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/libdap2/dapattr.c b/libdap2/dapattr.c
index 87dd643..4bd39c2 100644
--- a/libdap2/dapattr.c
+++ b/libdap2/dapattr.c
@@ -87,16 +87,20 @@ fprintf(stderr,"%s.dimname=%s\n",node->ocname,node->dodsspecial.dimname);
 		    } else node->dodsspecial.dimname = NULL;
 		} else if(strcmp(ocname,"DODS.Unlimited_Dimension")==0
 		   || strcmp(ocname,"DODS_EXTRA.Unlimited_Dimension")==0) {
-		    if(values != NULL) {
-		        if(nccomm->cdf.recorddimname != NULL)
+		    char* val0 = NULL;
+		    if(values != NULL)
+			val0 = values[0];
+		    if(val0 != NULL) {
+		        if(nccomm->cdf.recorddimname != NULL) {
+                            if(strcmp(nccomm->cdf.recorddimname,val0)!=0)
 		            nclog(NCLOGWARN,"Duplicate DODS_EXTRA:Unlimited_Dimension specifications");
-			else
+			} else {
 		            nccomm->cdf.recorddimname = nulldup(values[0]);
 #ifdef DEBUG
 fprintf(stderr,"%s.Unlimited_Dimension=%s\n",node->ocname,nccomm->cdf.recorddimname);
 #endif
+			}
 		    }
-
 		}
 	    }
 	    /* clean up */
@@ -115,7 +119,13 @@ done:
     return THROW(ncstat);
 }
 
-/* Build an NCattribute */
+/*
+Build an NCattribute
+from a DAP attribute.
+As of Jun 27, 2017, we modify
+to suppress nul characters and terminate
+the name at the first nul.
+*/
 static NCerror
 buildattribute(char* name, nc_type ptype,
                size_t nvalues, char** values, NCattribute** attp)
@@ -130,9 +140,10 @@ buildattribute(char* name, nc_type ptype,
     att->etype = ptype;
 
     att->values = nclistnew();
-    for(i=0;i<nvalues;i++)
-	nclistpush(att->values,(void*)nulldup(values[i]));
-
+    for(i=0;i<nvalues;i++) {
+	char* copy = nulldup(values[i]);
+	nclistpush(att->values,(void*)copy);
+    }
     if(attp) *attp = att;
     else
       free(att);
@@ -399,14 +410,19 @@ fprintf(stderr,"%s.dimname=%s\n",dds->ocname,dds->dodsspecial.dimname);
 #endif
 		    } else dds->dodsspecial.dimname = NULL;
 		} else if(strcmp(dodsname,"Unlimited_Dimension")==0) {
-		    if(nccomm->cdf.recorddimname != NULL) {
-		        nclog(NCLOGWARN,"Duplicate DODS_EXTRA:Unlimited_Dimension specifications");
-		    } else if(nclistlength(stringvalues) > 0) {
-		        char* stringval = (char*)nclistget(stringvalues,0);
-			nccomm->cdf.recorddimname = nulldup(stringval);
+		    char* stringval = NULL;
+		    if(nclistlength(stringvalues) > 0)
+	                stringval = (char*)nclistget(stringvalues,0);
+		    if(stringval != NULL) {
+		        if(nccomm->cdf.recorddimname != NULL) {
+			   if(strcmp(stringval,nccomm->cdf.recorddimname) != 0)
+		            nclog(NCLOGWARN,"Duplicate DODS_EXTRA:Unlimited_Dimension specifications");
+		        } else {
+			    nccomm->cdf.recorddimname = nulldup(stringval);
 #ifdef DEBUG
 fprintf(stderr,"%s.Unlimited_Dimension=%s\n",dds->ocname,nccomm->cdf.recorddimname);
 #endif
+		        }
 		    }
 		} /* else ignore */
 	        nullfree(dodsname);
diff --git a/libdap2/dapcvt.c b/libdap2/dapcvt.c
index 64ecdb6..65cc692 100644
--- a/libdap2/dapcvt.c
+++ b/libdap2/dapcvt.c
@@ -209,17 +209,16 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
 
 	ok = 0;
 	switch (etype) {
-	case NC_BYTE: {
+	case NC_BYTE: { /* Note that in DAP2, this is unsigned 8-bit integer */
+	    /*Needs special handling because Windows sscanf does not do %hhd*/
 	    char* p = (char*)dstmem;
-#ifdef _MSC_VER
 	    int ival;
 	    ok = sscanf(s,"%d%n",&ival,&nread);
+#ifdef _MSC_VER
 	    _ASSERTE(_CrtCheckMemory());
-	    if(ival < NC_MIN_BYTE || ival > NC_MAX_BYTE) ok = 0;
-	    *p = (char)ival;
-#else	
-	   ok = sscanf(s,"%hhu%n",p,&nread);
 #endif
+	    if(ival < 0 || ival > NC_MAX_UBYTE) ok = 0;
+	    *p = (char)ival;
 	    } break;
 	case NC_CHAR: {
 	    signed char* p = (signed char*)dstmem;
diff --git a/libdap2/dapdebug.c b/libdap2/dapdebug.c
index 558b653..e9b504f 100644
--- a/libdap2/dapdebug.c
+++ b/libdap2/dapdebug.c
@@ -14,12 +14,16 @@ int ncdap3debug = 0;
 #ifdef CATCHERROR
 /* Place breakpoint here to catch errors close to where they occur*/
 int
-dapbreakpoint(int err) {return err;}
+dapbreakpoint(int err)
+{
+    return err;
+}
 
 int
-dapthrow(int err)
+dapthrow(int err, int lineno, const char* filename)
 {
     if(err == 0) return err;
+    fprintf(stderr,"$dapthrow: err=%d line=%d file=%s\n",err,lineno,filename); fflush(stderr);
     return dapbreakpoint(err);
 }
 #endif
diff --git a/libdap2/dapdebug.h b/libdap2/dapdebug.h
index b54306b..dde23e5 100644
--- a/libdap2/dapdebug.h
+++ b/libdap2/dapdebug.h
@@ -27,7 +27,7 @@
 
 #undef PARSEDEBUG
 /* Warning: setting CATCHERROR has significant performance impact */
-#define CATCHERROR
+#undef CATCHERROR
 
 #include <stdarg.h>
 #include <assert.h>
@@ -51,11 +51,11 @@ extern int dappanic(const char* fmt, ...);
 
 #ifdef CATCHERROR
 /* Place breakpoint on dapbreakpoint to catch errors close to where they occur*/
-#define THROW(e) dapthrow(e)
-#define THROWCHK(e) (void)dapthrow(e)
+#define THROW(e) dapthrow(e,__LINE__,__FILE__)
+#define THROWCHK(e) (void)dapthrow(e,__LINE__,__FILE__)
 
 extern int dapbreakpoint(int err);
-extern int dapthrow(int err);
+extern int dapthrow(int err, int lineno, const char* filename);
 #else
 #define THROW(e) (e)
 #define THROWCHK(e)
diff --git a/libdap2/nccommon.h b/libdap2/nccommon.h
index 2f12376..f0694dd 100644
--- a/libdap2/nccommon.h
+++ b/libdap2/nccommon.h
@@ -112,6 +112,7 @@ typedef struct NCCDF {
     size_t smallsizelimit; /* what constitutes a small object? */
     size_t totalestimatedsize;
     const char* separator; /* constant; do not free */
+    /* Following fields should be set from the unconstrained dds only */
     /* global string dimension */
     struct CDFnode* globalstringdim;
     char* recorddimname; /* From DODS_EXTRA */
@@ -125,7 +126,11 @@ typedef struct NCDAPCOMMON {
     NCCDF cdf;
     NCOC oc;
     NCCONTROLS controls; /* Control flags and parameters */
-    int nc3id; /* nc3 file ncid used to hold metadata */
+    struct {
+	int realfile; /* 1 => we created actual temp file */
+	char* filename; /* of the substrate file */
+        int nc3id; /* substrate nc4 file ncid used to hold metadata; not same as external id  */
+    } substrate;
 } NCDAPCOMMON;
 
 /**************************************************/
@@ -305,6 +310,6 @@ extern int nc__opendap(void);
 
 #define getncid(drno) (((NC*)drno)->ext_ncid)
 #define getdap(drno) ((NCDAPCOMMON*)((NC*)drno)->dispatchdata)
-#define getnc3id(drno) (getdap(drno)->nc3id)
+#define getnc3id(drno) (getdap(drno)->substrate.nc3id)
 
 #endif /*NCCOMMON_H*/
diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c
index cfd5040..b6db0c8 100644
--- a/libdap2/ncd2dispatch.c
+++ b/libdap2/ncd2dispatch.c
@@ -6,6 +6,9 @@
 #include "dapincludes.h"
 #include "ncd2dispatch.h"
 #include "ncoffsets.h"
+#ifdef DEBUG2
+#include "dapdump.h"
+#endif
 
 #ifdef _MSC_VER
 #include <crtdbg.h>
@@ -280,7 +283,7 @@ NCD2_get_vars(int ncid, int varid,
 
 /* See ncd2dispatch.c for other version */
 int
-NCD2_open(const char * path, int mode,
+NCD2_open(const char* path, int mode,
                int basepe, size_t *chunksizehintp,
  	       int useparallel, void* mpidata,
                NC_Dispatch* dispatch, NC* drno)
@@ -292,13 +295,15 @@ NCD2_open(const char * path, int mode,
     int nc3id = -1;
 
     if(path == NULL)
-	return NC_EDAPURL;
-    if(dispatch == NULL) PANIC("NCD3_open: no dispatch table");
+	{ncstat = NC_EDAPURL; goto done;}
+    if(dispatch == NULL)
+	PANIC("NCD3_open: no dispatch table");
 
     /* Setup our NC and NCDAPCOMMON state*/
 
     dapcomm = (NCDAPCOMMON*)calloc(1,sizeof(NCDAPCOMMON));
-    if(dapcomm == NULL) {ncstat = NC_ENOMEM; goto done;}
+    if(dapcomm == NULL)
+	{ncstat = NC_ENOMEM; goto done;}
 
     NCD2_DATA_SET(drno,dapcomm);
     drno->int_ncid = nc__pseudofd(); /* create a unique id */
@@ -361,26 +366,34 @@ NCD2_open(const char * path, int mode,
         /* Create fake file name: exact name must be unique,
            but is otherwise irrelevant because we are using NC_DISKLESS
         */
-        snprintf(tmpname,sizeof(tmpname),"%d",drno->int_ncid);
+        snprintf(tmpname,sizeof(tmpname),"tmp_%d",drno->int_ncid);
 
         /* Now, use the file to create the hidden, in-memory netcdf file.
 	   We want this hidden file to always be NC_CLASSIC, so we need to
            force default format temporarily in case user changed it.
+	   If diskless is enabled, then create file in-memory, else
+           create an actual temporary file in the file system.
 	*/
 	{
 	    int new = 0; /* format netcdf-3 */
 	    int old = 0;
+	    int ncflags = NC_CLOBBER|NC_CLASSIC_MODEL;
+#ifdef USE_DISKLESS
+	    ncflags |= NC_DISKLESS;
+#endif
 	    nc_set_default_format(new,&old); /* save and change */
-            ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&nc3id);
+            ncstat = nc_create(tmpname,ncflags,&nc3id);
 	    nc_set_default_format(old,&new); /* restore */
+	    dapcomm->substrate.realfile = ((ncflags & NC_DISKLESS) != 0);
+	    dapcomm->substrate.filename = strdup(tmpname);
+	    if(tmpname == NULL) ncstat = NC_ENOMEM;
+	    dapcomm->substrate.nc3id = nc3id;
 	}
         if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
-	dapcomm->nc3id = nc3id;
 	/* Avoid fill */
 	nc_set_fill(nc3id,NC_NOFILL,NULL);
 
     }
-
     dapcomm->oc.dapconstraint = (DCEconstraint*)dcecreate(CES_CONSTRAINT);
     dapcomm->oc.dapconstraint->projections = nclistnew();
     dapcomm->oc.dapconstraint->selections = nclistnew();
@@ -670,7 +683,7 @@ builddims(NCDAPCOMMON* dapcomm)
     if(dapcomm->cdf.recorddim != NULL) {
 	CDFnode* unlimited = dapcomm->cdf.recorddim;
 	definename = getdefinename(unlimited);
-        ncstat = nc_def_dim(dapcomm->nc3id,
+        ncstat = nc_def_dim(dapcomm->substrate.nc3id,
 			definename,
 			NC_UNLIMITED,
 			&unlimited->ncid);
@@ -678,7 +691,7 @@ builddims(NCDAPCOMMON* dapcomm)
         if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
 
         /* get the id for the substrate */
-        ncstat = NC_check_id(dapcomm->nc3id,&ncsub);
+        ncstat = NC_check_id(dapcomm->substrate.nc3id,&ncsub);
         if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
 #if 0
 	nc3sub = (NC3_INFO*)&ncsub->dispatchdata;
@@ -697,7 +710,7 @@ builddims(NCDAPCOMMON* dapcomm)
 fprintf(stderr,"define: dim: %s=%ld\n",dim->ncfullname,(long)dim->dim.declsize);
 #endif
 	definename = getdefinename(dim);
-        ncstat = nc_def_dim(dapcomm->nc3id,definename,dim->dim.declsize,&dimid);
+        ncstat = nc_def_dim(dapcomm->substrate.nc3id,definename,dim->dim.declsize,&dimid);
         if(ncstat != NC_NOERR) {
           THROWCHK(ncstat); nullfree(definename); goto done;
 	}
@@ -769,7 +782,7 @@ fprintf(stderr,"[%ld]",dim->dim.declsize);
  }
 fprintf(stderr,"\n");
 #endif
-        ncstat = nc_def_var(dapcomm->nc3id,
+        ncstat = nc_def_var(dapcomm->substrate.nc3id,
 		        definename,
                         var->externaltype,
                         ncrank,
@@ -830,7 +843,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
 	    }
 	}
         if(ncbyteslength(buf) > 0) {
-            ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_sequence_dimensions",
+            ncstat = nc_put_att_text(dapcomm->substrate.nc3id,NC_GLOBAL,"_sequence_dimensions",
 	           ncbyteslength(buf),ncbytescontents(buf));
 	}
     }
@@ -841,12 +854,12 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
 
     if(dapparamcheck(dapcomm,"show","translate")) {
         /* Add a global attribute to show the translation */
-        ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_translate",
+        ncstat = nc_put_att_text(dapcomm->substrate.nc3id,NC_GLOBAL,"_translate",
 	           strlen("netcdf-3"),"netcdf-3");
     }
     if(dapparamcheck(dapcomm,"show","url")) {
 	if(dapcomm->oc.rawurltext != NULL)
-            ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_url",
+            ncstat = nc_put_att_text(dapcomm->substrate.nc3id,NC_GLOBAL,"_url",
 				       strlen(dapcomm->oc.rawurltext),dapcomm->oc.rawurltext);
     }
     if(dapparamcheck(dapcomm,"show","dds")) {
@@ -857,7 +870,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
 	    /* replace newlines with spaces*/
 	    nltxt = nulldup(txt);
 	    for(p=nltxt;*p;p++) {if(*p == '\n' || *p == '\r' || *p == '\t') {*p = ' ';}};
-            ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_dds",strlen(nltxt),nltxt);
+            ncstat = nc_put_att_text(dapcomm->substrate.nc3id,NC_GLOBAL,"_dds",strlen(nltxt),nltxt);
 	    nullfree(nltxt);
 	}
     }
@@ -868,7 +881,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
 	if(txt != NULL) {
 	    nltxt = nulldup(txt);
 	    for(p=nltxt;*p;p++) {if(*p == '\n' || *p == '\r' || *p == '\t') {*p = ' ';}};
-            ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_das",strlen(nltxt),nltxt);
+            ncstat = nc_put_att_text(dapcomm->substrate.nc3id,NC_GLOBAL,"_das",strlen(nltxt),nltxt);
 	    nullfree(nltxt);
 	}
     }
@@ -910,9 +923,9 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
 	}
         dapexpandescapes(newstring);
 	if(newstring[0]=='\0')
-	    ncstat = nc_put_att_text(dapcomm->nc3id,varid,att->name,1,newstring);
+	    ncstat = nc_put_att_text(dapcomm->substrate.nc3id,varid,att->name,1,newstring);
 	else
-	    ncstat = nc_put_att_text(dapcomm->nc3id,varid,att->name,strlen(newstring),newstring);
+	    ncstat = nc_put_att_text(dapcomm->substrate.nc3id,varid,att->name,strlen(newstring),newstring);
 	free(newstring);
         if(ncstat) goto done;
     } else {
@@ -942,7 +955,7 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
 	_ASSERTE(_CrtCheckMemory());
 #endif
     if(ncstat) {nullfree(mem); goto done;}
-    ncstat = nc_put_att(dapcomm->nc3id,varid,att->name,atype,nvalues,mem);
+    ncstat = nc_put_att(dapcomm->substrate.nc3id,varid,att->name,atype,nvalues,mem);
 #ifdef _MSC_VER
 	_ASSERTE(_CrtCheckMemory());
 #endif
@@ -1761,6 +1774,11 @@ freeNCDAPCOMMON(NCDAPCOMMON* dapcomm)
     dcefree((DCEnode*)dapcomm->oc.dapconstraint);
     dapcomm->oc.dapconstraint = NULL;
 
+    /* Note that the ncio layer will figure out that the tmp file needs to be deleted,
+       so we do not have to do it.
+    */
+    nullfree(dapcomm->substrate.filename); /* always reclaim */
+
     free(dapcomm);
 
     return NC_NOERR;
@@ -2020,7 +2038,7 @@ fetchpatternmetadata(NCDAPCOMMON* dapcomm)
         if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
     }
 
-#ifdef DEBUG
+#ifdef DEBUG2
 fprintf(stderr,"full pattern:\n%s",dumptree(dapcomm->cdf.fullddsroot));
 #endif
 
@@ -2061,7 +2079,7 @@ fetchconstrainedmetadata(NCDAPCOMMON* dapcomm)
             if(ncstat) goto fail;
 	}
 
-#ifdef DEBUG
+#ifdef DEBUG2
 fprintf(stderr,"constrained:\n%s",dumptree(dapcomm->cdf.ddsroot));
 #endif
 
@@ -2071,7 +2089,6 @@ fprintf(stderr,"constrained:\n%s",dumptree(dapcomm->cdf.ddsroot));
                                dapcomm->oc.ocdasroot);
             if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto fail;}
 	}
-
         /* map the constrained DDS to the unconstrained DDS */
         ncstat = mapnodes(dapcomm->cdf.ddsroot,dapcomm->cdf.fullddsroot);
         if(ncstat) goto fail;
diff --git a/libdap4/Makefile.in b/libdap4/Makefile.in
index f19f98c..8ae31f3 100644
--- a/libdap4/Makefile.in
+++ b/libdap4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/libdap4/d4file.c b/libdap4/d4file.c
index 6a27caf..62f6a6e 100644
--- a/libdap4/d4file.c
+++ b/libdap4/d4file.c
@@ -9,7 +9,7 @@
 #include "d4read.h"
 #include "d4curlfunctions.h"
 
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _MSC_VER
 #include <process.h>
 #include <direct.h>
 #endif
@@ -29,6 +29,7 @@ static void freeInfo(NCD4INFO*);
 static int paramcheck(NCD4INFO*, const char* key, const char* subkey);
 static const char* getparam(NCD4INFO* info, const char* key);
 static int set_curl_properties(NCD4INFO*);
+static void d4removecookies(const char* path);
 
 /**************************************************/
 /* Constants */
@@ -93,34 +94,46 @@ NCD4_open(const char * path, int mode,
 	else
             snprintf(tmpname,sizeof(tmpname),"tmp_%d",nc->int_ncid);
 
-        /* Now, use the file to create the hidden, in-memory netcdf file.
+        /* Now, use the file to create the hidden substrate netcdf file.
 	   We want this hidden file to always be NC_NETCDF4, so we need to
            force default format temporarily in case user changed it.
+	   If diskless is enabled, then create file in-memory, else
+           create an actual temporary file in the file system.
 	*/
 	{
 	    int new = NC_NETCDF4;
 	    int old = 0;
-	    int ncflags = NC_DISKLESS|NC_NETCDF4|NC_CLOBBER;
-
-	    if(FLAGSET(d4info->controls.debugflags,NCF_DEBUG_COPY))
+	    int ncid = 0;
+	    int ncflags = NC_NETCDF4|NC_CLOBBER;
+#ifdef USE_DISKLESS
+	    ncflags |= NC_DISKLESS;
+#endif
+	    if(FLAGSET(d4info->controls.debugflags,NCF_DEBUG_COPY)) {
+		/* Cause data to be dumped to real file */
 		ncflags |= NC_WRITE;
-	    
+		ncflags &= ~(NC_DISKLESS); /* use real file */
+	    }
 	    nc_set_default_format(new,&old); /* save and change */
-            ret = nc_create(tmpname,ncflags,&d4info->substrate.nc4id);
+            ret = nc_create(tmpname,ncflags,&ncid);
+
 	    nc_set_default_format(old,&new); /* restore */
+	    d4info->substrate.realfile = ((ncflags & NC_DISKLESS) == 0);
+	    d4info->substrate.filename = strdup(tmpname);
+	    if(tmpname == NULL) ret = NC_ENOMEM;
+	    d4info->substrate.nc4id = ncid;
 	}
-        if(ret != NC_NOERR) goto done;
+    if(ret != NC_NOERR) goto done;
 	/* Avoid fill */
 	nc_set_fill(getnc4id(nc),NC_NOFILL,NULL);
     }
 
     /* Turn on logging; only do this after oc_open*/
     if((value = ncurilookup(d4info->uri,"log")) != NULL) {
-	ncloginit();
-        if(nclogopen(value))
+      ncloginit();
+      if(nclogopen(value))
 	    ncsetlogging(1);
-	ncloginit();
-        if(nclogopen(value))
+      ncloginit();
+      if(nclogopen(value))
 	    ncsetlogging(1);
     }
 
@@ -133,7 +146,7 @@ NCD4_open(const char * path, int mode,
 	/* create the connection */
         if((ret=NCD4_curlopen(&curl))!= NC_NOERR) goto done;
 	d4info->curl->curl = curl;
-        if((ret=set_curl_properties(d4info))!= NC_NOERR) goto done;	
+        if((ret=set_curl_properties(d4info))!= NC_NOERR) goto done;
         /* Set the one-time curl flags */
         if((ret=NCD4_set_flags_perlink(d4info))!= NC_NOERR) goto done;
 #if 1 /* temporarily make per-link */
@@ -280,9 +293,23 @@ freeInfo(NCD4INFO* d4info)
     nullfree(d4info->data.ondiskfilename);
     if(d4info->data.ondiskfile != NULL)
 	fclose(d4info->data.ondiskfile);
-    nullfree(d4info->substrate.filename);
+    if(d4info->substrate.realfile
+	&& !FLAGSET(d4info->controls.debugflags,NCF_DEBUG_COPY)) {
+	/* We used real file, so we need to delete the temp file
+           unless we are debugging.
+	   Assume caller has done nc_close|nc_abort on the ncid.
+           Note that in theory, this should not be necessary since
+           AFAIK the substrate file is still in def mode, and
+           when aborted, it should be deleted. But that is not working
+           for some reason, so we delete it ourselves.
+	*/
+	if(d4info->substrate.filename != NULL) {
+	    unlink(d4info->substrate.filename);
+	}
+    }
+    nullfree(d4info->substrate.filename); /* always reclaim */
     NCD4_reclaimMeta(d4info->substrate.metadata);
-    free(d4info);    
+    free(d4info);
 }
 
 static void
@@ -294,7 +321,6 @@ freeCurl(NCD4curl* curl)
     nullfree(curl->errdata.code);
     nullfree(curl->errdata.message);
     nullfree(curl->curlflags.useragent);
-    nullfree(curl->curlflags.cookiejar);
     nullfree(curl->curlflags.netrc);
     nullfree(curl->ssl.certificate);
     nullfree(curl->ssl.key);
@@ -304,6 +330,9 @@ freeCurl(NCD4curl* curl)
     nullfree(curl->proxy.host);
     nullfree(curl->proxy.userpwd);
     nullfree(curl->creds.userpwd);
+    if(curl->curlflags.createdflags & COOKIECREATED)
+        d4removecookies(curl->curlflags.cookiejar);
+    nullfree(curl->curlflags.cookiejar);
 }
 
 /* Define the set of protocols known to be constrainable */
@@ -353,32 +382,28 @@ set_curl_properties(NCD4INFO* d4info)
 
     if(d4info->curl->curlflags.cookiejar == NULL) {
 	/* If no cookie file was defined, define a default */
-	char tmp[4096+1];
         int ok;
-#if defined(_WIN32) || defined(_WIN64)
-	int pid = _getpid();
-#else
-	pid_t pid = getpid();
-#endif
-	snprintf(tmp,sizeof(tmp)-1,"%s/%s.%ld/",NCD4_globalstate->tempdir,"netcdf",(long)pid);
-
-#if defined(_WIN32) || defined(_WIN64)
-	ok = _mkdir(tmp);
-#else
-	ok = mkdir(tmp,S_IRUSR | S_IWUSR | S_IXUSR);
-#endif
-	if(ok != 0 && errno != EEXIST) {
-	    fprintf(stderr,"Cannot create cookie directory\n");
-	    goto fail;
-	}
+        char* path = NULL;
+        char* name = NULL;
+        int len;
 	errno = 0;
 	/* Create the unique cookie file name */
-	ok = NCD4_mktmp(tmp,&d4info->curl->curlflags.cookiejar);
-	d4info->curl->curlflags.createdflags |= COOKIECREATED;
+        len =
+	  strlen(NCD4_globalstate->tempdir)
+	  + 1 /* '/' */
+	  + strlen("ncd4cookies");
+        path = (char*)malloc(len+1);
+        if(path == NULL) return NC_ENOMEM;
+	snprintf(path,len,"%s/nc4cookies",NCD4_globalstate->tempdir);
+	/* Create the unique cookie file name */
+        ok = NCD4_mktmp(path,&name);
+        free(path);
 	if(ok != NC_NOERR && errno != EEXIST) {
 	    fprintf(stderr,"Cannot create cookie file\n");
 	    goto fail;
 	}
+	d4info->curl->curlflags.cookiejar = name;
+	d4info->curl->curlflags.createdflags |= COOKIECREATED;
 	errno = 0;
     }
     assert(d4info->curl->curlflags.cookiejar != NULL);
@@ -446,7 +471,7 @@ applyclientparamcontrols(NCD4INFO* info)
 }
 
 static void
-applyclientmetacontrols(NCD4meta* meta)    
+applyclientmetacontrols(NCD4meta* meta)
 {
     NCD4INFO* info = meta->controller;
     const char* value = getparam(info,"checksummode");
@@ -489,3 +514,13 @@ getparam(NCD4INFO* info, const char* key)
 	return NULL;
     return value;
 }
+
+static void
+d4removecookies(const char* path)
+{
+#ifdef _MSC_VER
+    DeleteFile(path);
+#else
+    remove(path);
+#endif
+}
diff --git a/libdap4/d4read.c b/libdap4/d4read.c
index e3b02c5..51f21a4 100644
--- a/libdap4/d4read.c
+++ b/libdap4/d4read.c
@@ -49,16 +49,16 @@ NCD4_readDAP(NCD4INFO* state, int flags)
             ncurisetconstraints(url,state->constraint);
 #endif
 	    readurl = ncuribuild(url,NULL,".dods",NCURISVC);
-	    if(readurl == NULL) 
+	    if(readurl == NULL)
 		return THROW(NC_ENOMEM);
-            if (state->debug > 0) 
+            if (state->debug > 0)
                 {fprintf(stderr, "fetch url=%s\n", readurl);fflush(stderr);}
             stat = NCD4_fetchurl_file(state->curl, readurl, state->data.ondiskfile,
                                    &state->data.datasize, &lastmod);
             nullfree(readurl);
             if(stat == NC_NOERR)
                 state->data.daplastmodified = lastmod;
-            if (state->debug > 0) 
+            if (state->debug > 0)
                 {fprintf(stderr,"fetch complete\n"); fflush(stderr);}
         }
     }
@@ -167,7 +167,7 @@ readfile(const NCURI* uri, const char* suffix, NCbytes* packet)
 #ifdef O_BINARY
     flags |= O_BINARY;
 #endif
-fprintf(stderr,"XXX: flags=0x%x file=%s\n",flags,filename);
+
     fd = NCopen2(filename,flags);
     if(fd < 0) {
 	nclog(NCLOGERR,"open failed:%s",filename);
diff --git a/libdap4/d4util.c b/libdap4/d4util.c
index 4f8f694..1f09cea 100644
--- a/libdap4/d4util.c
+++ b/libdap4/d4util.c
@@ -207,7 +207,7 @@ backslashEscape(const char* s)
 }
 
 /* Parse an fqn into a sequence of names;
-   initially using '/', then '.' */
+   using '/', and then (conditionally) '.' */
 int
 NCD4_parseFQN(const char* fqn0, NClist* pieces)
 {
@@ -239,6 +239,7 @@ NCD4_parseFQN(const char* fqn0, NClist* pieces)
 	    break;
 	}
     }
+#ifdef ALLOWFIELDMAPS
     /* Step 2, walk the final piece to break up based on '.' */
     for(p=start;*p;) {
 	switch(*p) {
@@ -255,6 +256,7 @@ NCD4_parseFQN(const char* fqn0, NClist* pieces)
 	    break;
 	}
     }
+#endif
     count++; /* acct for last piece */
     /* Step 3: capture and de-scape the pieces */
     for(p=fqn;count > 0;count--) {
diff --git a/libdap4/ncd4types.h b/libdap4/ncd4types.h
index 531f4e3..d77578a 100644
--- a/libdap4/ncd4types.h
+++ b/libdap4/ncd4types.h
@@ -13,6 +13,12 @@ are defined here.
 
 #undef COMPILEBYDEFAULT
 
+/*
+Control if struct fields can be map targets.
+Currently turned off because semantics are unclear.
+*/
+#undef ALLOWFIELDMAPS
+
 #define long64 long long
 #define ncerror int
 
@@ -217,7 +223,8 @@ typedef struct NCD4serial {
 /* This will be passed out of the parse */
 struct NCD4meta {
     NCD4INFO* controller;
-    int ncid; /* root ncid of the substrate netcdf-4 file; copy of NCD4parse argument*/
+    int ncid; /* root ncid of the substrate netcdf-4 file;
+		 warning: copy of NCD4Info.substrate.nc4id */
     NCD4node* root;
     NCD4mode  mode; /* Are we reading DMR (only) or DAP (includes DMR) */
     NClist* allnodes; /*list<NCD4node>*/
@@ -345,6 +352,7 @@ struct NCD4INFO {
         long daplastmodified;
     } data;
     struct {
+	int realfile; /* 1 => we created actual temp file */
 	char* filename; /* of the substrate file */
         int nc4id; /* substrate nc4 file ncid used to hold metadata; not same as external id  */
 	NCD4meta* metadata;
diff --git a/libdispatch/Makefile.in b/libdispatch/Makefile.in
index b116b6e..ca8a2f4 100644
--- a/libdispatch/Makefile.in
+++ b/libdispatch/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c
index 3e22ae5..2ac53d9 100644
--- a/libdispatch/dfile.c
+++ b/libdispatch/dfile.c
@@ -118,9 +118,11 @@ done:
 /*!
 Given an existing file, figure out its format
 and return that format value (NC_FORMATX_XXX)
-in model arg.
+in model arg. Assume any path conversion was
+already performed at a higher level.
 */
-static int NC_check_file_type(const char *path, int flags, void *parameters,
+static int
+NC_check_file_type(const char *path, int flags, void *parameters,
 		   int* model, int* version)
 {
    char magic[MAGIC_NUMBER_LEN];
@@ -139,6 +141,7 @@ static int NC_check_file_type(const char *path, int flags, void *parameters,
     } else {/* presumably a real file */
        /* Get the 4-byte magic from the beginning of the file. Don't use posix
         * for parallel, use the MPI functions instead. */
+
 #ifdef USE_PARALLEL
 	if (use_parallel) {
 	    MPI_File fh;
@@ -169,19 +172,18 @@ static int NC_check_file_type(const char *path, int flags, void *parameters,
 #else
           struct stat st;
 #endif
-
-	    if(path == NULL || strlen(path)==0)
+          if(path == NULL || strlen(path)==0)
 		{status = NC_EINVAL; goto done;}
 
-	    if (!(fp = fopen(path, "r")))
+	  if (!(fp = fopen(path, "r")))
 		{status = errno; goto done;}
 
 #ifdef HAVE_SYS_STAT_H
-	    /* The file must be at least MAGIC_NUMBER_LEN in size,
+	  /* The file must be at least MAGIC_NUMBER_LEN in size,
 	       or otherwise the following fread will exhibit unexpected
   	       behavior. */
 
-        /* Windows and fstat have some issues, this will work around that. */
+          /* Windows and fstat have some issues, this will work around that. */
 #ifdef HAVE_FILE_LENGTH_I64
           if((file_len = _filelengthi64(fileno(fp))) < 0) {
             fclose(fp);
@@ -189,7 +191,6 @@ static int NC_check_file_type(const char *path, int flags, void *parameters,
             goto done;
           }
 
-
           if(file_len < MAGIC_NUMBER_LEN) {
             fclose(fp);
             status = NC_ENOTNC;
@@ -1659,6 +1660,10 @@ NC_create(const char *path0, int cmode, size_t initialsz,
 	 return stat;
    }
 
+#ifndef USE_DISKLESS
+   cmode &= (~ NC_DISKLESS); /* Force off */
+#endif
+
 #ifdef WINPATH
    /* Need to do path conversion */
    path = NCpathcvt(path0);
@@ -1811,8 +1816,8 @@ NC_open(const char *path0, int cmode,
    int stat = NC_NOERR;
    NC* ncp = NULL;
    NC_Dispatch* dispatcher = NULL;
-   int inmemory = ((cmode & NC_INMEMORY) == NC_INMEMORY);
-   int diskless = ((cmode & NC_DISKLESS) == NC_DISKLESS);
+   int inmemory = 0;
+   int diskless = 0;
    /* Need pieces of information for now to decide model*/
    int model = 0;
    int isurl = 0;
@@ -1826,10 +1831,22 @@ NC_open(const char *path0, int cmode,
       if(stat) return stat;
    }
 
+   /* Attempt to do file path conversion: note that this will do
+      nothing if path is a 'file:...' url, so it will need to be
+      repeated in protocol code: libdap2 and libdap4
+    */
+
+#ifndef USE_DISKLESS
+   /* Clean up cmode */
+   cmode &= (~ NC_DISKLESS);
+#endif
+
+   inmemory = ((cmode & NC_INMEMORY) == NC_INMEMORY);
+   diskless = ((cmode & NC_DISKLESS) == NC_DISKLESS);
+
+
 #ifdef WINPATH
-   /* Need to do path conversion */
    path = NCpathcvt(path0);
-fprintf(stderr,"XXX: path0=%s path=%s\n",path0,path); fflush(stderr);
 #else
    path = nulldup(path0);
 #endif
diff --git a/libdispatch/dutf8.c b/libdispatch/dutf8.c
index 0ff99de..08bea64 100644
--- a/libdispatch/dutf8.c
+++ b/libdispatch/dutf8.c
@@ -4,6 +4,12 @@
  */
 
 #include "config.h"
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 #include "netcdf.h"
 #include "ncutf8.h"
 #include "utf8proc.h"
@@ -23,13 +29,13 @@ int nc_utf8_validate(const unsigned char* name)
 {
     int ncstat = NC_NOERR;
     const nc_utf8proc_uint8_t *str;
-    nc_utf8proc_ssize_t strlen = -1;
+    nc_utf8proc_ssize_t nchars = -1;
     nc_utf8proc_int32_t codepoint;
     nc_utf8proc_ssize_t count;
 
     str = (const nc_utf8proc_uint8_t*)name;
     while(*str) {
-        count = nc_utf8proc_iterate(str,strlen,&codepoint);
+        count = nc_utf8proc_iterate(str,nchars,&codepoint);
 	if(count < 0) {
 	    switch (count) {
 	    case UTF8PROC_ERROR_NOMEM:
@@ -94,3 +100,73 @@ nc_utf8_normalize(const unsigned char* utf8, unsigned char** normalp)
 done:
     return ncstat;
 }
+
+/*
+ * Convert a normalized utf8 string to utf16. This is approximate
+ * because it just does the truncation version of conversion for
+ * each 32-bit codepoint to get the corresponding utf16.
+ * Return codes:
+ * NC_NOERR -- success
+ * NC_ENOMEM -- out of memory
+ * NC_EINVAL -- invalid argument or internal error
+ * NC_EBADNAME-- not valid utf16
+ */
+
+int nc_utf8_to_utf16(const unsigned char* s8, unsigned short** utf16p, size_t* len16p)
+{
+    int ncstat = NC_NOERR;
+    const nc_utf8proc_uint8_t *str;
+    nc_utf8proc_ssize_t nchars = -1;
+    nc_utf8proc_int32_t codepoint;
+    nc_utf8proc_ssize_t count;
+    size_t len8, len16;
+    unsigned short* utf16;
+    unsigned short* p16;
+
+    len8 = strlen((char*)s8);
+    utf16 = (unsigned short*)malloc(sizeof(unsigned short)*(len8+1));
+    if(utf16 == NULL) {
+	ncstat = NC_ENOMEM;
+	goto done;
+    }
+    str = (const nc_utf8proc_uint8_t*)s8;
+    /* Walk the string and convert each codepoint */
+    p16 = utf16;
+    len16 = 0;
+    while(*str) {
+        count = nc_utf8proc_iterate(str,nchars,&codepoint);
+	if(count < 0) {
+	    switch (count) {
+	    case UTF8PROC_ERROR_NOMEM:
+	    case UTF8PROC_ERROR_OVERFLOW:
+		ncstat = NC_ENOMEM;
+		break;
+	    case UTF8PROC_ERROR_INVALIDOPTS:
+		ncstat = NC_EINVAL;
+		break;
+	    case UTF8PROC_ERROR_INVALIDUTF8:
+	    case UTF8PROC_ERROR_NOTASSIGNED:
+	    default:
+		ncstat = NC_EBADNAME;
+		break;
+	    }
+	    goto done;
+	} else { /* move to next char */
+	    /* Complain if top 16 bits not zero */
+	    if((codepoint & 0x0000FFFF) != 0) {
+		ncstat = NC_EBADNAME;
+		goto done;
+	    }
+	    /* Truncate codepoint to 16 bits and store */
+	    *p16++ = (unsigned short)(codepoint & 0x0000FFFF);
+	    str += count;
+	    len16++;
+	}
+    }
+    *p16++ = (unsigned short)0;
+    if(utf16p) *utf16p = utf16;
+    if(len16p) *len16p = len16;
+done:
+    if(ncstat) free(utf16);
+    return ncstat;
+}
diff --git a/libdispatch/dwinpath.c b/libdispatch/dwinpath.c
index 6595336..f14a8b6 100644
--- a/libdispatch/dwinpath.c
+++ b/libdispatch/dwinpath.c
@@ -18,6 +18,8 @@
 #include "ncexternl.h"
 #include "ncwinpath.h"
 
+#undef PATHFORMAT
+
 /*
 Code to provide some path conversion code so that
 cygwin and (some) mingw paths can be passed to open/fopen
@@ -38,6 +40,8 @@ static char* windrive = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 static size_t cdlen = 10; /* strlen("/cygdrive/") */
 
+static int pathdebug = -1;
+
 EXTERNL
 char* /* caller frees */
 NCpathcvt(const char* path)
@@ -47,7 +51,14 @@ NCpathcvt(const char* path)
     char* q;
     size_t pathlen;
 
-    if(path == NULL) return NULL; /* defensive driving */
+    if(path == NULL) goto done; /* defensive driving */
+
+    /* Check for path debug env vars */
+    if(pathdebug < 0) {
+	const char* s = getenv("NCPATHDEBUG");
+        pathdebug = (s == NULL ? 0 : 1);
+    }
+
     pathlen = strlen(path);
 
     /* 1. look for MSYS path /D/... */
@@ -57,7 +68,7 @@ NCpathcvt(const char* path)
 	&& (path[2] == '/' || path[2] == '\\' || path[2] == '\0')) {
 	/* Assume this is a mingw path */
 	outpath = (char*)malloc(pathlen+3); /* conservative */
-	if(outpath == NULL) return NULL;
+	if(outpath == NULL) goto done;
 	q = outpath;
 	*q++ = path[1];
 	*q++ = ':';
@@ -76,8 +87,8 @@ NCpathcvt(const char* path)
 	    || path[cdlen+1] == '\0')) {
 	/* Assume this is a cygwin path */
 	outpath = (char*)malloc(pathlen+1); /* conservative */
-	if(outpath == NULL) return NULL;
-	outpath[0] = path[cdlen];
+	if(outpath == NULL) goto done;
+	outpath[0] = path[cdlen]; /* drive letter */
 	outpath[1] = ':';
 	strcpy(&outpath[2],&path[cdlen+1]);
 	if(strlen(outpath) == 2)
@@ -99,12 +110,31 @@ NCpathcvt(const char* path)
     goto done;
 
 slashtrans:
-    /* In all #1 or #2 cases, translate '/' -> '\\' */
+      /* In order to help debugging, and if not using MSC_VER or MINGW,
+	 convert back slashes to forward, else convert forward to back
+      */
     p = outpath;
+    /* In all #1 or #2 cases, translate '/' -> '\\' */
     for(;*p;p++) {
 	if(*p == '/') {*p = '\\';}
     }
+#ifdef PATHFORMAT
+#ifndef _MSC_VER
+	p = outpath;
+        /* Convert '\' back to '/' */
+        for(;*p;p++) {
+            if(*p == '\\') {*p = '/';}
+	}
+    }
+#endif /*!_MSC_VER*/
+#endif /*PATHFORMAT*/
+
 done:
+    if(pathdebug) {
+        fprintf(stderr,"XXXX: inpath=|%s| outpath=|%s|\n",
+            path?path:"NULL",outpath?outpath:"NULL");
+        fflush(stderr);
+    }
     return outpath;
 }
 
@@ -120,8 +150,6 @@ NCfopen(const char* path, const char* flags)
 {
     FILE* f = NULL;
     char* cvtname = NCpathcvt(path);
-fprintf(stderr,"XXXX: path=|%s| cvtpath=|%s|\n",path,cvtname?cvtname:"null");
-fflush(stderr);
     if(cvtname == NULL) return NULL;
     f = fopen(cvtname,flags);
     free(cvtname);    
@@ -133,10 +161,8 @@ int
 NCopen3(const char* path, int flags, int mode)
 {
     int fd = -1;
-    fprintf(stderr,"XXXX: path=|%s|\n",path);
     fflush(stderr);
     char* cvtname = NCpathcvt(path);
-    fprintf(stderr,"XXXX: path=|%s| cvtpath=|%s|\n",path,cvtname?cvtname:"null");
     fflush(stderr);
     if(cvtname == NULL) return -1;
     fd = open(cvtname,flags,mode);
diff --git a/libdispatch/ncuri.c b/libdispatch/ncuri.c
index 2d922ce..7acf16e 100644
--- a/libdispatch/ncuri.c
+++ b/libdispatch/ncuri.c
@@ -19,6 +19,9 @@
 
 #define NCURIDEBUG
 
+/* Extra debug info */
+#undef NCXDEBUG
+
 #ifdef NCURIDEBUG
 #define THROW(n) {ret=(n); goto done;}
 #else
@@ -314,10 +317,7 @@ ncuriparse(const char* uri0, NCURI** durip)
 	    if(strlen(pp)==0)
 		{THROW(NCU_EUSRPWD);} /* we have empty password */
 	    tmp.password = pp;	    
-	    /* compress usr+pwd out of tmp.host */
-	    rem = strlen(newhost);
-	    memmove(tmp.host,newhost,rem);
-	    tmp.host[rem] = EOFCHAR;
+	    tmp.host = newhost;
 	}
 	/* Breakup host into host + port */
 	pp = tmp.host;
diff --git a/libdispatch/test_ncuri.c b/libdispatch/test_ncuri.c
index dcf9ad3..957b41a 100644
--- a/libdispatch/test_ncuri.c
+++ b/libdispatch/test_ncuri.c
@@ -35,11 +35,13 @@ static Test TESTS[] = {
 {"[dap4]http://localhost:8081/x#show=fetch&log","http://localhost:8081/x#dap4&show=fetch&log"},
 /* suffix param tests with constraint*/
 {"http://localhost:8081/x?dap4.ce=x#dap4&show=fetch&log","http://localhost:8081/x?dap4.ce=x#dap4&show=fetch&log"},
+/* Test embedded user+pwd */
+{"http://tiggeUser:tigge@localhost:8081/thredds/dodsC/restrict/testData.nc",
+ "http://tiggeUser:tigge@localhost:8081/thredds/dodsC/restrict/testData.nc"},
 /* Misc. */
 {"http://localhost","http://localhost/"},
 {"http:///x","http:///x"},
 {"file:///home/osboxes/git/dap4/dap4_test/daptestfiles/test_anon_dim.2.syn#dap4&debug=copy&substratename=./results/test_anon_dim.2.syn.nc","file:///home/osboxes/git/dap4/dap4_test/daptestfiles/test_anon_dim.2.syn#dap4&debug=copy&substratename=./results/test_anon_dim.2.syn.nc"},
-
 {NULL,NULL}
 };
 
diff --git a/libdispatch/test_pathcvt.c b/libdispatch/test_pathcvt.c
index 14959d6..e277e92 100644
--- a/libdispatch/test_pathcvt.c
+++ b/libdispatch/test_pathcvt.c
@@ -12,7 +12,6 @@ Test the NCpathcvt
 #include <string.h>
 #include "ncwinpath.h"
 
-#undef WINDEBUG
 #undef VERBOSE
 
 typedef struct Test {
diff --git a/libdispatch/utf8proc.h b/libdispatch/utf8proc.h
index cee9882..ceea425 100644
--- a/libdispatch/utf8proc.h
+++ b/libdispatch/utf8proc.h
@@ -77,6 +77,7 @@
 /** @} */
 
 #include <stdlib.h>
+#include "ncexternl.h"
 
 #if defined(_MSC_VER) && _MSC_VER < 1800
 // MSVC prior to 2013 lacked stdbool.h and inttypes.h
@@ -120,20 +121,6 @@ typedef bool nc_utf8proc_bool;
 #endif
 #include <limits.h>
 
-#ifndef UTF8PROC_EXPORTS
-#ifdef _WIN32
-#  ifdef UTF8PROC_EXPORTS
-#    define UTF8PROC_DLLEXPORT __declspec(dllexport)
-#  else
-#    define UTF8PROC_DLLEXPORT __declspec(dllimport)
-#  endif
-#elif __GNUC__ >= 4
-#  define UTF8PROC_DLLEXPORT __attribute__ ((visibility("default")))
-#else
-#  define UTF8PROC_DLLEXPORT
-#endif
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -418,7 +405,7 @@ const char *nc_utf8proc_errmsg(nc_utf8proc_ssize_t errcode);
  * In case of success, the number of bytes read is returned; otherwise, a
  * negative error code is returned.
  */
-UTF8PROC_DLLEXPORT nc_utf8proc_ssize_t nc_utf8proc_iterate(const nc_utf8proc_uint8_t *str, nc_utf8proc_ssize_t strlen, nc_utf8proc_int32_t *codepoint_ref);
+EXTERNL nc_utf8proc_ssize_t nc_utf8proc_iterate(const nc_utf8proc_uint8_t *str, nc_utf8proc_ssize_t strlen, nc_utf8proc_int32_t *codepoint_ref);
 
 /**
  * Check if a codepoint is valid (regardless of whether it has been
@@ -685,13 +672,13 @@ nc_utf8proc_ssize_t nc_utf8proc_map_custom(
  */
 /** @{ */
 /** NFD normalization (@ref UTF8PROC_DECOMPOSE). */
-UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFD(const nc_utf8proc_uint8_t *str);
+EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFD(const nc_utf8proc_uint8_t *str);
 /** NFC normalization (@ref UTF8PROC_COMPOSE). */
-UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFC(const nc_utf8proc_uint8_t *str);
+EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFC(const nc_utf8proc_uint8_t *str);
 /** NFKD normalization (@ref UTF8PROC_DECOMPOSE and @ref UTF8PROC_COMPAT). */
-UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFKD(const nc_utf8proc_uint8_t *str);
+EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFKD(const nc_utf8proc_uint8_t *str);
 /** NFKC normalization (@ref UTF8PROC_COMPOSE and @ref UTF8PROC_COMPAT). */
-UTF8PROC_DLLEXPORT nc_utf8proc_uint8_t *nc_utf8proc_NFKC(const nc_utf8proc_uint8_t *str);
+EXTERNL nc_utf8proc_uint8_t *nc_utf8proc_NFKC(const nc_utf8proc_uint8_t *str);
 /** @} */
 
 #ifdef __cplusplus
diff --git a/liblib/Makefile.am b/liblib/Makefile.am
index 5c0949d..0a7b344 100644
--- a/liblib/Makefile.am
+++ b/liblib/Makefile.am
@@ -70,6 +70,11 @@ libnetcdf_la_LIBADD += ${top_builddir}/libsrc4/libnetcdf4.la
 
 endif #USE_NETCDF4
 
+if ISCYGWIN
+# Force binary mode for file read/write
+AM_LDFLAGS += -lbinmode
+endif
+
 # We need at least one source file
 libnetcdf_la_SOURCES = nc_initialize.c
 EXTRA_DIST=CMakeLists.txt
diff --git a/liblib/Makefile.in b/liblib/Makefile.in
index 660e7e1..b3d8f34 100644
--- a/liblib/Makefile.in
+++ b/liblib/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -130,6 +130,12 @@ target_triplet = @target@
 # NetCDF-4 ...
 @USE_NETCDF4_TRUE at am__append_12 = -I${top_srcdir}/libsrc4
 @USE_NETCDF4_TRUE at am__append_13 = ${top_builddir}/libsrc4/libnetcdf4.la
+
+# Not ready for prime time yet
+# libnetcdf_la_LIBADD += ${top_builddir}/libdiskless/libdiskless.la
+
+# Force binary mode for file read/write
+ at ISCYGWIN_TRUE@am__append_14 = -lbinmode
 subdir = liblib
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -256,7 +262,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) \
 	$(am__append_6) $(am__append_8) $(am__append_10) \
 	$(am__append_12)
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AM_LDFLAGS = 
+AM_LDFLAGS = $(am__append_14)
 AR = @AR@
 AS = @AS@
 AUTOCONF = @AUTOCONF@
@@ -447,9 +453,6 @@ libnetcdf_la_LIBADD = $(am__append_5) \
 	$(am__append_9) $(am__append_11) $(am__append_13)
 CLEANFILES = 
 
-# Not ready for prime time yet
-# libnetcdf_la_LIBADD += ${top_builddir}/libdiskless/libdiskless.la
-
 # We need at least one source file
 libnetcdf_la_SOURCES = nc_initialize.c
 EXTRA_DIST = CMakeLists.txt
diff --git a/liblib/nc_initialize.c b/liblib/nc_initialize.c
index cd03f82..30da3e2 100644
--- a/liblib/nc_initialize.c
+++ b/liblib/nc_initialize.c
@@ -35,6 +35,11 @@ extern int NCP_initialize(void);
 extern int NCP_finalize(void);
 #endif
 
+#ifdef _MSC_VER
+#include <io.h>
+#include <fcntl.h>
+#endif
+
 int NC_argc = 1;
 char* NC_argv[] = {"nc_initialize",NULL};
 
@@ -59,6 +64,11 @@ nc_initialize()
     NC_initialized = 1;
     NC_finalized = 0;
 
+#ifdef _MSC_VER
+    /* Force binary mode */
+    _set_fmode(_O_BINARY);
+#endif
+
     /* Do general initialization */
     if((stat = NCDISPATCH_initialize())) goto done;
 
diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am
index ab15840..ce48785 100644
--- a/libsrc/Makefile.am
+++ b/libsrc/Makefile.am
@@ -47,7 +47,7 @@ EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
 
 # This tells make how to turn .m4 files into .c files.
 .m4.c:
-	m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< > $@
+	m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< > $(top_srcdir)/libsrc/$@
 
 # The C API man page.
 man_MANS = netcdf.3
diff --git a/libsrc/Makefile.in b/libsrc/Makefile.in
index 0f0c4bd..02b54b3 100644
--- a/libsrc/Makefile.in
+++ b/libsrc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -923,7 +923,7 @@ uninstall-man: uninstall-man3
 
 # This tells make how to turn .m4 files into .c files.
 .m4.c:
-	m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< > $@
+	m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< > $(top_srcdir)/libsrc/$@
 
 # This rule generates the C manpage.
 netcdf.3: $(top_srcdir)/docs/netcdf.m4
diff --git a/libsrc/nc3internal.c b/libsrc/nc3internal.c
index 3363828..03a4835 100644
--- a/libsrc/nc3internal.c
+++ b/libsrc/nc3internal.c
@@ -1113,7 +1113,7 @@ NC3_open(const char * path, int ioflags,
 
 #if defined(LOCKNUMREC) /* && _CRAYMPP */
 	if (status = NC_init_pe(nc3, basepe)) {
-		return status;
+	    goto unwind_alloc;
 	}
 #else
 	/*
@@ -1121,9 +1121,11 @@ NC3_open(const char * path, int ioflags,
 	 */
 	if(basepe != 0) {
         if(nc3) free(nc3);
-        return NC_EINVAL;
+        status = NC_EINVAL;
+	goto unwind_alloc;
     }
 #endif
+
         status = ncio_open(path, ioflags, 0, 0, &nc3->chunk, parameters,
 			       &nc3->nciop, NULL);
 	if(status)
diff --git a/libsrc/ncx.c b/libsrc/ncx.c
index a30fe4f..6033f8d 100644
--- a/libsrc/ncx.c
+++ b/libsrc/ncx.c
@@ -2251,7 +2251,11 @@ get_ix_int(const void *xp, ix_int *ip)
 {
 	const uchar *cp = (const uchar *) xp;
 
+#if INT_MAX  >= X_INT_MAX
+	*ip = (ix_int)((unsigned)(*cp++) << 24);
+#else
 	*ip = *cp++ << 24;
+#endif
 #if SIZEOF_IX_INT > X_SIZEOF_INT
 	if (*ip & 0x80000000)
 	{
@@ -2277,142 +2281,14 @@ put_ix_int(void *xp, const ix_int *ip)
 
 #if X_SIZEOF_INT != SIZEOF_INT
 static int
-#line 1027
-ncx_get_int_int(const void *xp, int *ip)
-#line 1027
-{
-#line 1027
-    int err=NC_NOERR;
-#line 1027
-#if SIZEOF_IX_INT == SIZEOF_INT && IX_INT_MAX == INT_MAX
-#line 1027
-    get_ix_int(xp, (ix_int *)ip);
-#line 1027
-#else
-#line 1027
-    ix_int xx;
-#line 1027
-    get_ix_int(xp, &xx);
-#line 1027
-
-#line 1027
-#if IX_INT_MAX > INT_MAX
-#line 1027
-    if (xx > INT_MAX || xx < INT_MIN) {
-#line 1027
-
-#line 1027
-        err = NC_ERANGE;
-#line 1027
-    }
-#line 1027
-#endif
-#line 1027
-
-#line 1027
-
-#line 1027
-    *ip = (int) xx;
-#line 1027
-#endif
-#line 1027
-    return err;
-#line 1027
-}
-#line 1027
-
-#endif
-static int
-#line 1029
-ncx_get_int_schar(const void *xp, schar *ip)
-#line 1029
-{
-#line 1029
-    int err=NC_NOERR;
-#line 1029
-    ix_int xx;
-#line 1029
-    get_ix_int(xp, &xx);
-#line 1029
-
-#line 1029
-#if IX_INT_MAX > SCHAR_MAX
-#line 1029
-    if (xx > SCHAR_MAX || xx < SCHAR_MIN) {
-#line 1029
-
-#line 1029
-        err = NC_ERANGE;
-#line 1029
-    }
-#line 1029
-#endif
-#line 1029
-
-#line 1029
-
-#line 1029
-    *ip = (schar) xx;
-#line 1029
-    return err;
-#line 1029
-}
-#line 1029
-
-static int
-#line 1030
-ncx_get_int_short(const void *xp, short *ip)
-#line 1030
-{
-#line 1030
-    int err=NC_NOERR;
-#line 1030
-#if SIZEOF_IX_INT == SIZEOF_SHORT && IX_INT_MAX == SHORT_MAX
-#line 1030
-    get_ix_int(xp, (ix_int *)ip);
-#line 1030
-#else
-#line 1030
-    ix_int xx;
-#line 1030
-    get_ix_int(xp, &xx);
-#line 1030
-
-#line 1030
-#if IX_INT_MAX > SHORT_MAX
-#line 1030
-    if (xx > SHORT_MAX || xx < SHORT_MIN) {
-#line 1030
-
-#line 1030
-        err = NC_ERANGE;
-#line 1030
-    }
-#line 1030
-#endif
-#line 1030
-
-#line 1030
-
-#line 1030
-    *ip = (short) xx;
-#line 1030
-#endif
-#line 1030
-    return err;
-#line 1030
-}
-#line 1030
-
-static int
 #line 1031
-ncx_get_int_long(const void *xp, long *ip)
+ncx_get_int_int(const void *xp, int *ip)
 #line 1031
 {
 #line 1031
     int err=NC_NOERR;
 #line 1031
-#if SIZEOF_IX_INT == SIZEOF_LONG && IX_INT_MAX == LONG_MAX
+#if SIZEOF_IX_INT == SIZEOF_INT && IX_INT_MAX == INT_MAX
 #line 1031
     get_ix_int(xp, (ix_int *)ip);
 #line 1031
@@ -2424,9 +2300,9 @@ ncx_get_int_long(const void *xp, long *ip)
 #line 1031
 
 #line 1031
-#if IX_INT_MAX > LONG_MAX
+#if IX_INT_MAX > INT_MAX
 #line 1031
-    if (xx > LONG_MAX || xx < LONG_MIN) {
+    if (xx > INT_MAX || xx < INT_MIN) {
 #line 1031
 
 #line 1031
@@ -2440,7 +2316,7 @@ ncx_get_int_long(const void *xp, long *ip)
 #line 1031
 
 #line 1031
-    *ip = (long) xx;
+    *ip = (int) xx;
 #line 1031
 #endif
 #line 1031
@@ -2449,54 +2325,10 @@ ncx_get_int_long(const void *xp, long *ip)
 }
 #line 1031
 
-static int
-#line 1032
-ncx_get_int_longlong(const void *xp, longlong *ip)
-#line 1032
-{
-#line 1032
-    int err=NC_NOERR;
-#line 1032
-#if SIZEOF_IX_INT == SIZEOF_LONGLONG && IX_INT_MAX == LONGLONG_MAX
-#line 1032
-    get_ix_int(xp, (ix_int *)ip);
-#line 1032
-#else
-#line 1032
-    ix_int xx;
-#line 1032
-    get_ix_int(xp, &xx);
-#line 1032
-
-#line 1032
-#if IX_INT_MAX > LONGLONG_MAX
-#line 1032
-    if (xx > LONGLONG_MAX || xx < LONGLONG_MIN) {
-#line 1032
-
-#line 1032
-        err = NC_ERANGE;
-#line 1032
-    }
-#line 1032
-#endif
-#line 1032
-
-#line 1032
-
-#line 1032
-    *ip = (longlong) xx;
-#line 1032
 #endif
-#line 1032
-    return err;
-#line 1032
-}
-#line 1032
-
 static int
 #line 1033
-ncx_get_int_ushort(const void *xp, ushort *ip)
+ncx_get_int_schar(const void *xp, schar *ip)
 #line 1033
 {
 #line 1033
@@ -2508,9 +2340,9 @@ ncx_get_int_ushort(const void *xp, ushort *ip)
 #line 1033
 
 #line 1033
-#if IX_INT_MAX > USHORT_MAX
+#if IX_INT_MAX > SCHAR_MAX
 #line 1033
-    if (xx > USHORT_MAX) {
+    if (xx > SCHAR_MAX || xx < SCHAR_MIN) {
 #line 1033
 
 #line 1033
@@ -2522,15 +2354,9 @@ ncx_get_int_ushort(const void *xp, ushort *ip)
 #line 1033
 
 #line 1033
-    if (xx < 0) {
-#line 1033
 
 #line 1033
-        err = NC_ERANGE; /* because ip is unsigned */
-#line 1033
-    }
-#line 1033
-    *ip = (ushort) xx;
+    *ip = (schar) xx;
 #line 1033
     return err;
 #line 1033
@@ -2539,21 +2365,27 @@ ncx_get_int_ushort(const void *xp, ushort *ip)
 
 static int
 #line 1034
-ncx_get_int_uchar(const void *xp, uchar *ip)
+ncx_get_int_short(const void *xp, short *ip)
 #line 1034
 {
 #line 1034
     int err=NC_NOERR;
 #line 1034
+#if SIZEOF_IX_INT == SIZEOF_SHORT && IX_INT_MAX == SHORT_MAX
+#line 1034
+    get_ix_int(xp, (ix_int *)ip);
+#line 1034
+#else
+#line 1034
     ix_int xx;
 #line 1034
     get_ix_int(xp, &xx);
 #line 1034
 
 #line 1034
-#if IX_INT_MAX > UCHAR_MAX
+#if IX_INT_MAX > SHORT_MAX
 #line 1034
-    if (xx > UCHAR_MAX) {
+    if (xx > SHORT_MAX || xx < SHORT_MIN) {
 #line 1034
 
 #line 1034
@@ -2565,15 +2397,11 @@ ncx_get_int_uchar(const void *xp, uchar *ip)
 #line 1034
 
 #line 1034
-    if (xx < 0) {
-#line 1034
 
 #line 1034
-        err = NC_ERANGE; /* because ip is unsigned */
-#line 1034
-    }
+    *ip = (short) xx;
 #line 1034
-    *ip = (uchar) xx;
+#endif
 #line 1034
     return err;
 #line 1034
@@ -2582,21 +2410,27 @@ ncx_get_int_uchar(const void *xp, uchar *ip)
 
 static int
 #line 1035
-ncx_get_int_uint(const void *xp, uint *ip)
+ncx_get_int_long(const void *xp, long *ip)
 #line 1035
 {
 #line 1035
     int err=NC_NOERR;
 #line 1035
+#if SIZEOF_IX_INT == SIZEOF_LONG && IX_INT_MAX == LONG_MAX
+#line 1035
+    get_ix_int(xp, (ix_int *)ip);
+#line 1035
+#else
+#line 1035
     ix_int xx;
 #line 1035
     get_ix_int(xp, &xx);
 #line 1035
 
 #line 1035
-#if IX_INT_MAX > UINT_MAX
+#if IX_INT_MAX > LONG_MAX
 #line 1035
-    if (xx > UINT_MAX) {
+    if (xx > LONG_MAX || xx < LONG_MIN) {
 #line 1035
 
 #line 1035
@@ -2608,15 +2442,11 @@ ncx_get_int_uint(const void *xp, uint *ip)
 #line 1035
 
 #line 1035
-    if (xx < 0) {
-#line 1035
 
 #line 1035
-        err = NC_ERANGE; /* because ip is unsigned */
-#line 1035
-    }
+    *ip = (long) xx;
 #line 1035
-    *ip = (uint) xx;
+#endif
 #line 1035
     return err;
 #line 1035
@@ -2625,21 +2455,27 @@ ncx_get_int_uint(const void *xp, uint *ip)
 
 static int
 #line 1036
-ncx_get_int_ulonglong(const void *xp, ulonglong *ip)
+ncx_get_int_longlong(const void *xp, longlong *ip)
 #line 1036
 {
 #line 1036
     int err=NC_NOERR;
 #line 1036
+#if SIZEOF_IX_INT == SIZEOF_LONGLONG && IX_INT_MAX == LONGLONG_MAX
+#line 1036
+    get_ix_int(xp, (ix_int *)ip);
+#line 1036
+#else
+#line 1036
     ix_int xx;
 #line 1036
     get_ix_int(xp, &xx);
 #line 1036
 
 #line 1036
-#if IX_INT_MAX > ULONGLONG_MAX
+#if IX_INT_MAX > LONGLONG_MAX
 #line 1036
-    if (xx > ULONGLONG_MAX) {
+    if (xx > LONGLONG_MAX || xx < LONGLONG_MIN) {
 #line 1036
 
 #line 1036
@@ -2651,15 +2487,11 @@ ncx_get_int_ulonglong(const void *xp, ulonglong *ip)
 #line 1036
 
 #line 1036
-    if (xx < 0) {
-#line 1036
 
 #line 1036
-        err = NC_ERANGE; /* because ip is unsigned */
-#line 1036
-    }
+    *ip = (longlong) xx;
 #line 1036
-    *ip = (ulonglong) xx;
+#endif
 #line 1036
     return err;
 #line 1036
@@ -2668,49 +2500,221 @@ ncx_get_int_ulonglong(const void *xp, ulonglong *ip)
 
 static int
 #line 1037
-ncx_get_int_float(const void *xp, float *ip)
+ncx_get_int_ushort(const void *xp, ushort *ip)
 #line 1037
 {
 #line 1037
-	ix_int xx;
+    int err=NC_NOERR;
 #line 1037
-	get_ix_int(xp, &xx);
+    ix_int xx;
 #line 1037
-	*ip = (float)xx;
+    get_ix_int(xp, &xx);
 #line 1037
-	return NC_NOERR;
+
+#line 1037
+#if IX_INT_MAX > USHORT_MAX
+#line 1037
+    if (xx > USHORT_MAX) {
+#line 1037
+
+#line 1037
+        err = NC_ERANGE;
+#line 1037
+    }
+#line 1037
+#endif
+#line 1037
+
+#line 1037
+    if (xx < 0) {
+#line 1037
+
+#line 1037
+        err = NC_ERANGE; /* because ip is unsigned */
+#line 1037
+    }
+#line 1037
+    *ip = (ushort) xx;
+#line 1037
+    return err;
 #line 1037
 }
 #line 1037
 
 static int
 #line 1038
-ncx_get_int_double(const void *xp, double *ip)
+ncx_get_int_uchar(const void *xp, uchar *ip)
 #line 1038
 {
 #line 1038
-	ix_int xx;
+    int err=NC_NOERR;
 #line 1038
-	get_ix_int(xp, &xx);
+    ix_int xx;
 #line 1038
-	*ip = (double)xx;
+    get_ix_int(xp, &xx);
 #line 1038
-	return NC_NOERR;
+
 #line 1038
-}
+#if IX_INT_MAX > UCHAR_MAX
+#line 1038
+    if (xx > UCHAR_MAX) {
 #line 1038
 
+#line 1038
+        err = NC_ERANGE;
+#line 1038
+    }
+#line 1038
+#endif
+#line 1038
+
+#line 1038
+    if (xx < 0) {
+#line 1038
+
+#line 1038
+        err = NC_ERANGE; /* because ip is unsigned */
+#line 1038
+    }
+#line 1038
+    *ip = (uchar) xx;
+#line 1038
+    return err;
+#line 1038
+}
+#line 1038
 
 static int
-ncx_put_int_schar(void *xp, const schar *ip, void *fillp)
+#line 1039
+ncx_get_int_uint(const void *xp, uint *ip)
+#line 1039
 {
-	uchar *cp = (uchar *) xp;
-	if (*ip & 0x80)
-	{
-		*cp++ = 0xff;
-		*cp++ = 0xff;
-		*cp++ = 0xff;
-	}
+#line 1039
+    int err=NC_NOERR;
+#line 1039
+    ix_int xx;
+#line 1039
+    get_ix_int(xp, &xx);
+#line 1039
+
+#line 1039
+#if IX_INT_MAX > UINT_MAX
+#line 1039
+    if (xx > UINT_MAX) {
+#line 1039
+
+#line 1039
+        err = NC_ERANGE;
+#line 1039
+    }
+#line 1039
+#endif
+#line 1039
+
+#line 1039
+    if (xx < 0) {
+#line 1039
+
+#line 1039
+        err = NC_ERANGE; /* because ip is unsigned */
+#line 1039
+    }
+#line 1039
+    *ip = (uint) xx;
+#line 1039
+    return err;
+#line 1039
+}
+#line 1039
+
+static int
+#line 1040
+ncx_get_int_ulonglong(const void *xp, ulonglong *ip)
+#line 1040
+{
+#line 1040
+    int err=NC_NOERR;
+#line 1040
+    ix_int xx;
+#line 1040
+    get_ix_int(xp, &xx);
+#line 1040
+
+#line 1040
+#if IX_INT_MAX > ULONGLONG_MAX
+#line 1040
+    if (xx > ULONGLONG_MAX) {
+#line 1040
+
+#line 1040
+        err = NC_ERANGE;
+#line 1040
+    }
+#line 1040
+#endif
+#line 1040
+
+#line 1040
+    if (xx < 0) {
+#line 1040
+
+#line 1040
+        err = NC_ERANGE; /* because ip is unsigned */
+#line 1040
+    }
+#line 1040
+    *ip = (ulonglong) xx;
+#line 1040
+    return err;
+#line 1040
+}
+#line 1040
+
+static int
+#line 1041
+ncx_get_int_float(const void *xp, float *ip)
+#line 1041
+{
+#line 1041
+	ix_int xx;
+#line 1041
+	get_ix_int(xp, &xx);
+#line 1041
+	*ip = (float)xx;
+#line 1041
+	return NC_NOERR;
+#line 1041
+}
+#line 1041
+
+static int
+#line 1042
+ncx_get_int_double(const void *xp, double *ip)
+#line 1042
+{
+#line 1042
+	ix_int xx;
+#line 1042
+	get_ix_int(xp, &xx);
+#line 1042
+	*ip = (double)xx;
+#line 1042
+	return NC_NOERR;
+#line 1042
+}
+#line 1042
+
+
+static int
+ncx_put_int_schar(void *xp, const schar *ip, void *fillp)
+{
+	uchar *cp = (uchar *) xp;
+	if (*ip & 0x80)
+	{
+		*cp++ = 0xff;
+		*cp++ = 0xff;
+		*cp++ = 0xff;
+	}
 	else
 	{
 		*cp++ = 0x00;
@@ -2734,344 +2738,344 @@ ncx_put_int_uchar(void *xp, const uchar *ip, void *fillp)
 
 #if X_SIZEOF_INT != SIZEOF_INT
 static int
-#line 1072
+#line 1076
 ncx_put_int_int(void *xp, const int *ip, void *fillp)
-#line 1072
+#line 1076
 {
-#line 1072
+#line 1076
     int err=NC_NOERR;
-#line 1072
+#line 1076
 #if SIZEOF_IX_INT == SIZEOF_INT && IX_INT_MAX == INT_MAX
-#line 1072
+#line 1076
     put_ix_int(xp, (const ix_int *)ip);
-#line 1072
+#line 1076
 #else
-#line 1072
+#line 1076
     ix_int xx = NC_FILL_INT;
-#line 1072
+#line 1076
 
-#line 1072
+#line 1076
 #if IX_INT_MAX < INT_MAX
-#line 1072
+#line 1076
     if (*ip > IX_INT_MAX || *ip < X_INT_MIN) {
-#line 1072
+#line 1076
         
-#line 1072
+#line 1076
         err = NC_ERANGE;
-#line 1072
+#line 1076
     } 
-#line 1072
+#line 1076
 #endif
-#line 1072
+#line 1076
         xx = (ix_int)*ip;
-#line 1072
+#line 1076
 
-#line 1072
+#line 1076
     put_ix_int(xp, &xx);
-#line 1072
+#line 1076
 #endif
-#line 1072
+#line 1076
     return err;
-#line 1072
+#line 1076
 }
-#line 1072
+#line 1076
 
 #endif
 static int
-#line 1074
+#line 1078
 ncx_put_int_short(void *xp, const short *ip, void *fillp)
-#line 1074
+#line 1078
 {
-#line 1074
+#line 1078
     int err=NC_NOERR;
-#line 1074
+#line 1078
 #if SIZEOF_IX_INT == SIZEOF_SHORT && IX_INT_MAX == SHORT_MAX
-#line 1074
+#line 1078
     put_ix_int(xp, (const ix_int *)ip);
-#line 1074
+#line 1078
 #else
-#line 1074
+#line 1078
     ix_int xx = NC_FILL_INT;
-#line 1074
+#line 1078
 
-#line 1074
+#line 1078
 #if IX_INT_MAX < SHORT_MAX
-#line 1074
+#line 1078
     if (*ip > IX_INT_MAX || *ip < X_INT_MIN) {
-#line 1074
+#line 1078
         
-#line 1074
+#line 1078
         err = NC_ERANGE;
-#line 1074
+#line 1078
     } 
-#line 1074
+#line 1078
 #endif
-#line 1074
+#line 1078
         xx = (ix_int)*ip;
-#line 1074
+#line 1078
 
-#line 1074
+#line 1078
     put_ix_int(xp, &xx);
-#line 1074
+#line 1078
 #endif
-#line 1074
+#line 1078
     return err;
-#line 1074
+#line 1078
 }
-#line 1074
+#line 1078
 
 static int
-#line 1075
+#line 1079
 ncx_put_int_long(void *xp, const long *ip, void *fillp)
-#line 1075
+#line 1079
 {
-#line 1075
+#line 1079
     int err=NC_NOERR;
-#line 1075
+#line 1079
 #if SIZEOF_IX_INT == SIZEOF_LONG && IX_INT_MAX == LONG_MAX
-#line 1075
+#line 1079
     put_ix_int(xp, (const ix_int *)ip);
-#line 1075
+#line 1079
 #else
-#line 1075
+#line 1079
     ix_int xx = NC_FILL_INT;
-#line 1075
+#line 1079
 
-#line 1075
+#line 1079
 #if IX_INT_MAX < LONG_MAX
-#line 1075
+#line 1079
     if (*ip > IX_INT_MAX || *ip < X_INT_MIN) {
-#line 1075
+#line 1079
         
-#line 1075
+#line 1079
         err = NC_ERANGE;
-#line 1075
+#line 1079
     } 
-#line 1075
+#line 1079
 #endif
-#line 1075
+#line 1079
         xx = (ix_int)*ip;
-#line 1075
+#line 1079
 
-#line 1075
+#line 1079
     put_ix_int(xp, &xx);
-#line 1075
+#line 1079
 #endif
-#line 1075
+#line 1079
     return err;
-#line 1075
+#line 1079
 }
-#line 1075
+#line 1079
 
 static int
-#line 1076
+#line 1080
 ncx_put_int_longlong(void *xp, const longlong *ip, void *fillp)
-#line 1076
+#line 1080
 {
-#line 1076
+#line 1080
     int err=NC_NOERR;
-#line 1076
+#line 1080
 #if SIZEOF_IX_INT == SIZEOF_LONGLONG && IX_INT_MAX == LONGLONG_MAX
-#line 1076
+#line 1080
     put_ix_int(xp, (const ix_int *)ip);
-#line 1076
+#line 1080
 #else
-#line 1076
+#line 1080
     ix_int xx = NC_FILL_INT;
-#line 1076
+#line 1080
 
-#line 1076
+#line 1080
 #if IX_INT_MAX < LONGLONG_MAX
-#line 1076
+#line 1080
     if (*ip > IX_INT_MAX || *ip < X_INT_MIN) {
-#line 1076
+#line 1080
         
-#line 1076
+#line 1080
         err = NC_ERANGE;
-#line 1076
+#line 1080
     } 
-#line 1076
+#line 1080
 #endif
-#line 1076
+#line 1080
         xx = (ix_int)*ip;
-#line 1076
+#line 1080
 
-#line 1076
+#line 1080
     put_ix_int(xp, &xx);
-#line 1076
+#line 1080
 #endif
-#line 1076
+#line 1080
     return err;
-#line 1076
+#line 1080
 }
-#line 1076
+#line 1080
 
 static int
-#line 1077
+#line 1081
 ncx_put_int_ushort(void *xp, const ushort *ip, void *fillp)
-#line 1077
+#line 1081
 {
-#line 1077
+#line 1081
     int err=NC_NOERR;
-#line 1077
+#line 1081
     ix_int xx = NC_FILL_INT;
-#line 1077
+#line 1081
 
-#line 1077
+#line 1081
 #if IX_INT_MAX < USHORT_MAX
-#line 1077
+#line 1081
     if (*ip > IX_INT_MAX) {
-#line 1077
+#line 1081
         
-#line 1077
+#line 1081
         err = NC_ERANGE;
-#line 1077
+#line 1081
     } 
-#line 1077
+#line 1081
 #endif
-#line 1077
+#line 1081
         xx = (ix_int)*ip;
-#line 1077
+#line 1081
 
-#line 1077
+#line 1081
     put_ix_int(xp, &xx);
-#line 1077
+#line 1081
     return err;
-#line 1077
+#line 1081
 }
-#line 1077
+#line 1081
 
 static int
-#line 1078
+#line 1082
 ncx_put_int_uint(void *xp, const uint *ip, void *fillp)
-#line 1078
+#line 1082
 {
-#line 1078
+#line 1082
     int err=NC_NOERR;
-#line 1078
+#line 1082
     ix_int xx = NC_FILL_INT;
-#line 1078
+#line 1082
 
-#line 1078
+#line 1082
 #if IX_INT_MAX < UINT_MAX
-#line 1078
+#line 1082
     if (*ip > IX_INT_MAX) {
-#line 1078
+#line 1082
         
-#line 1078
+#line 1082
         err = NC_ERANGE;
-#line 1078
+#line 1082
     } 
-#line 1078
+#line 1082
 #endif
-#line 1078
+#line 1082
         xx = (ix_int)*ip;
-#line 1078
+#line 1082
 
-#line 1078
+#line 1082
     put_ix_int(xp, &xx);
-#line 1078
+#line 1082
     return err;
-#line 1078
+#line 1082
 }
-#line 1078
+#line 1082
 
 static int
-#line 1079
+#line 1083
 ncx_put_int_ulonglong(void *xp, const ulonglong *ip, void *fillp)
-#line 1079
+#line 1083
 {
-#line 1079
+#line 1083
     int err=NC_NOERR;
-#line 1079
+#line 1083
     ix_int xx = NC_FILL_INT;
-#line 1079
+#line 1083
 
-#line 1079
+#line 1083
 #if IX_INT_MAX < ULONGLONG_MAX
-#line 1079
+#line 1083
     if (*ip > IX_INT_MAX) {
-#line 1079
+#line 1083
         
-#line 1079
+#line 1083
         err = NC_ERANGE;
-#line 1079
+#line 1083
     } 
-#line 1079
+#line 1083
 #endif
-#line 1079
+#line 1083
         xx = (ix_int)*ip;
-#line 1079
+#line 1083
 
-#line 1079
+#line 1083
     put_ix_int(xp, &xx);
-#line 1079
+#line 1083
     return err;
-#line 1079
+#line 1083
 }
-#line 1079
+#line 1083
 
 static int
-#line 1080
+#line 1084
 ncx_put_int_float(void *xp, const float *ip, void *fillp)
-#line 1080
+#line 1084
 {
-#line 1080
+#line 1084
     int err=NC_NOERR;
-#line 1080
+#line 1084
     ix_int xx = NC_FILL_INT;
-#line 1080
+#line 1084
 
-#line 1080
+#line 1084
     if (*ip > (double)X_INT_MAX || *ip < (double)X_INT_MIN) {
-#line 1080
+#line 1084
         
-#line 1080
+#line 1084
         err = NC_ERANGE;
-#line 1080
+#line 1084
     } 
-#line 1080
+#line 1084
         xx = (ix_int)*ip;
-#line 1080
+#line 1084
 
-#line 1080
+#line 1084
     put_ix_int(xp, &xx);
-#line 1080
+#line 1084
     return err;
-#line 1080
+#line 1084
 }
-#line 1080
+#line 1084
 
 static int
-#line 1081
+#line 1085
 ncx_put_int_double(void *xp, const double *ip, void *fillp)
-#line 1081
+#line 1085
 {
-#line 1081
+#line 1085
     int err=NC_NOERR;
-#line 1081
+#line 1085
     ix_int xx = NC_FILL_INT;
-#line 1081
+#line 1085
 
-#line 1081
+#line 1085
     if (*ip > X_INT_MAX || *ip < X_INT_MIN) {
-#line 1081
+#line 1085
         
-#line 1081
+#line 1085
         err = NC_ERANGE;
-#line 1081
+#line 1085
     } 
-#line 1081
+#line 1085
         xx = (ix_int)*ip;
-#line 1081
+#line 1085
 
-#line 1081
+#line 1085
     put_ix_int(xp, &xx);
-#line 1081
+#line 1085
     return err;
-#line 1081
+#line 1085
 }
-#line 1081
+#line 1085
 
 
 
@@ -3118,405 +3122,405 @@ put_ix_uint(void *xp, const ix_uint *ip)
 
 #if X_SIZEOF_UINT != SIZEOF_UINT
 static int
-#line 1126
+#line 1130
 ncx_get_uint_uint(const void *xp, uint *ip)
-#line 1126
+#line 1130
 {
-#line 1126
+#line 1130
     int err=NC_NOERR;
-#line 1126
+#line 1130
 #if SIZEOF_IX_UINT == SIZEOF_UINT && IX_UINT_MAX == UINT_MAX
-#line 1126
+#line 1130
     get_ix_uint(xp, (ix_uint *)ip);
-#line 1126
+#line 1130
 #else
-#line 1126
+#line 1130
     ix_uint xx;
-#line 1126
+#line 1130
     get_ix_uint(xp, &xx);
-#line 1126
+#line 1130
 
-#line 1126
+#line 1130
 #if IX_UINT_MAX > UINT_MAX
-#line 1126
+#line 1130
     if (xx > UINT_MAX) {
-#line 1126
+#line 1130
 
-#line 1126
+#line 1130
         err = NC_ERANGE;
-#line 1126
+#line 1130
     }
-#line 1126
+#line 1130
 #endif
-#line 1126
+#line 1130
 
-#line 1126
+#line 1130
 
-#line 1126
+#line 1130
     *ip = (uint) xx;
-#line 1126
+#line 1130
 #endif
-#line 1126
+#line 1130
     return err;
-#line 1126
+#line 1130
 }
-#line 1126
+#line 1130
 
 #endif
 
 static int
-#line 1129
+#line 1133
 ncx_get_uint_schar(const void *xp, schar *ip)
-#line 1129
+#line 1133
 {
-#line 1129
+#line 1133
     int err=NC_NOERR;
-#line 1129
+#line 1133
     ix_uint xx;
-#line 1129
+#line 1133
     get_ix_uint(xp, &xx);
-#line 1129
+#line 1133
 
-#line 1129
+#line 1133
 #if IX_UINT_MAX > SCHAR_MAX
-#line 1129
+#line 1133
     if (xx > SCHAR_MAX) {
-#line 1129
+#line 1133
 
-#line 1129
+#line 1133
         err = NC_ERANGE;
-#line 1129
+#line 1133
     }
-#line 1129
+#line 1133
 #endif
-#line 1129
+#line 1133
 
-#line 1129
+#line 1133
 
-#line 1129
+#line 1133
     *ip = (schar) xx;
-#line 1129
+#line 1133
     return err;
-#line 1129
+#line 1133
 }
-#line 1129
+#line 1133
 
 static int
-#line 1130
+#line 1134
 ncx_get_uint_short(const void *xp, short *ip)
-#line 1130
+#line 1134
 {
-#line 1130
+#line 1134
     int err=NC_NOERR;
-#line 1130
+#line 1134
     ix_uint xx;
-#line 1130
+#line 1134
     get_ix_uint(xp, &xx);
-#line 1130
+#line 1134
 
-#line 1130
+#line 1134
 #if IX_UINT_MAX > SHORT_MAX
-#line 1130
+#line 1134
     if (xx > SHORT_MAX) {
-#line 1130
+#line 1134
 
-#line 1130
+#line 1134
         err = NC_ERANGE;
-#line 1130
+#line 1134
     }
-#line 1130
+#line 1134
 #endif
-#line 1130
+#line 1134
 
-#line 1130
+#line 1134
 
-#line 1130
+#line 1134
     *ip = (short) xx;
-#line 1130
+#line 1134
     return err;
-#line 1130
+#line 1134
 }
-#line 1130
+#line 1134
 
 static int
-#line 1131
+#line 1135
 ncx_get_uint_int(const void *xp, int *ip)
-#line 1131
+#line 1135
 {
-#line 1131
+#line 1135
     int err=NC_NOERR;
-#line 1131
+#line 1135
     ix_uint xx;
-#line 1131
+#line 1135
     get_ix_uint(xp, &xx);
-#line 1131
+#line 1135
 
-#line 1131
+#line 1135
 #if IX_UINT_MAX > INT_MAX
-#line 1131
+#line 1135
     if (xx > INT_MAX) {
-#line 1131
+#line 1135
 
-#line 1131
+#line 1135
         err = NC_ERANGE;
-#line 1131
+#line 1135
     }
-#line 1131
+#line 1135
 #endif
-#line 1131
+#line 1135
 
-#line 1131
+#line 1135
 
-#line 1131
+#line 1135
     *ip = (int) xx;
-#line 1131
+#line 1135
     return err;
-#line 1131
+#line 1135
 }
-#line 1131
+#line 1135
 
 static int
-#line 1132
+#line 1136
 ncx_get_uint_long(const void *xp, long *ip)
-#line 1132
+#line 1136
 {
-#line 1132
+#line 1136
     int err=NC_NOERR;
-#line 1132
+#line 1136
     ix_uint xx;
-#line 1132
+#line 1136
     get_ix_uint(xp, &xx);
-#line 1132
+#line 1136
 
-#line 1132
+#line 1136
 #if IX_UINT_MAX > LONG_MAX
-#line 1132
+#line 1136
     if (xx > LONG_MAX) {
-#line 1132
+#line 1136
 
-#line 1132
+#line 1136
         err = NC_ERANGE;
-#line 1132
+#line 1136
     }
-#line 1132
+#line 1136
 #endif
-#line 1132
+#line 1136
 
-#line 1132
+#line 1136
 
-#line 1132
+#line 1136
     *ip = (long) xx;
-#line 1132
+#line 1136
     return err;
-#line 1132
+#line 1136
 }
-#line 1132
+#line 1136
 
 static int
-#line 1133
+#line 1137
 ncx_get_uint_longlong(const void *xp, longlong *ip)
-#line 1133
+#line 1137
 {
-#line 1133
+#line 1137
     int err=NC_NOERR;
-#line 1133
+#line 1137
     ix_uint xx;
-#line 1133
+#line 1137
     get_ix_uint(xp, &xx);
-#line 1133
+#line 1137
 
-#line 1133
+#line 1137
 #if IX_UINT_MAX > LONGLONG_MAX
-#line 1133
+#line 1137
     if (xx > LONGLONG_MAX) {
-#line 1133
+#line 1137
 
-#line 1133
+#line 1137
         err = NC_ERANGE;
-#line 1133
+#line 1137
     }
-#line 1133
+#line 1137
 #endif
-#line 1133
+#line 1137
 
-#line 1133
+#line 1137
 
-#line 1133
+#line 1137
     *ip = (longlong) xx;
-#line 1133
+#line 1137
     return err;
-#line 1133
+#line 1137
 }
-#line 1133
+#line 1137
 
 static int
-#line 1134
+#line 1138
 ncx_get_uint_ushort(const void *xp, ushort *ip)
-#line 1134
+#line 1138
 {
-#line 1134
+#line 1138
     int err=NC_NOERR;
-#line 1134
+#line 1138
 #if SIZEOF_IX_UINT == SIZEOF_USHORT && IX_UINT_MAX == USHORT_MAX
-#line 1134
+#line 1138
     get_ix_uint(xp, (ix_uint *)ip);
-#line 1134
+#line 1138
 #else
-#line 1134
+#line 1138
     ix_uint xx;
-#line 1134
+#line 1138
     get_ix_uint(xp, &xx);
-#line 1134
+#line 1138
 
-#line 1134
+#line 1138
 #if IX_UINT_MAX > USHORT_MAX
-#line 1134
+#line 1138
     if (xx > USHORT_MAX) {
-#line 1134
+#line 1138
 
-#line 1134
+#line 1138
         err = NC_ERANGE;
-#line 1134
+#line 1138
     }
-#line 1134
+#line 1138
 #endif
-#line 1134
+#line 1138
 
-#line 1134
+#line 1138
 
-#line 1134
+#line 1138
     *ip = (ushort) xx;
-#line 1134
+#line 1138
 #endif
-#line 1134
+#line 1138
     return err;
-#line 1134
+#line 1138
 }
-#line 1134
+#line 1138
 
 static int
-#line 1135
+#line 1139
 ncx_get_uint_uchar(const void *xp, uchar *ip)
-#line 1135
+#line 1139
 {
-#line 1135
+#line 1139
     int err=NC_NOERR;
-#line 1135
+#line 1139
 #if SIZEOF_IX_UINT == SIZEOF_UCHAR && IX_UINT_MAX == UCHAR_MAX
-#line 1135
+#line 1139
     get_ix_uint(xp, (ix_uint *)ip);
-#line 1135
+#line 1139
 #else
-#line 1135
+#line 1139
     ix_uint xx;
-#line 1135
+#line 1139
     get_ix_uint(xp, &xx);
-#line 1135
+#line 1139
 
-#line 1135
+#line 1139
 #if IX_UINT_MAX > UCHAR_MAX
-#line 1135
+#line 1139
     if (xx > UCHAR_MAX) {
-#line 1135
+#line 1139
 
-#line 1135
+#line 1139
         err = NC_ERANGE;
-#line 1135
+#line 1139
     }
-#line 1135
+#line 1139
 #endif
-#line 1135
+#line 1139
 
-#line 1135
+#line 1139
 
-#line 1135
+#line 1139
     *ip = (uchar) xx;
-#line 1135
+#line 1139
 #endif
-#line 1135
+#line 1139
     return err;
-#line 1135
+#line 1139
 }
-#line 1135
+#line 1139
 
 static int
-#line 1136
+#line 1140
 ncx_get_uint_ulonglong(const void *xp, ulonglong *ip)
-#line 1136
+#line 1140
 {
-#line 1136
+#line 1140
     int err=NC_NOERR;
-#line 1136
+#line 1140
 #if SIZEOF_IX_UINT == SIZEOF_ULONGLONG && IX_UINT_MAX == ULONGLONG_MAX
-#line 1136
+#line 1140
     get_ix_uint(xp, (ix_uint *)ip);
-#line 1136
+#line 1140
 #else
-#line 1136
+#line 1140
     ix_uint xx;
-#line 1136
+#line 1140
     get_ix_uint(xp, &xx);
-#line 1136
+#line 1140
 
-#line 1136
+#line 1140
 #if IX_UINT_MAX > ULONGLONG_MAX
-#line 1136
+#line 1140
     if (xx > ULONGLONG_MAX) {
-#line 1136
+#line 1140
 
-#line 1136
+#line 1140
         err = NC_ERANGE;
-#line 1136
+#line 1140
     }
-#line 1136
+#line 1140
 #endif
-#line 1136
+#line 1140
 
-#line 1136
+#line 1140
 
-#line 1136
+#line 1140
     *ip = (ulonglong) xx;
-#line 1136
+#line 1140
 #endif
-#line 1136
+#line 1140
     return err;
-#line 1136
+#line 1140
 }
-#line 1136
+#line 1140
 
 static int
-#line 1137
+#line 1141
 ncx_get_uint_float(const void *xp, float *ip)
-#line 1137
+#line 1141
 {
-#line 1137
+#line 1141
 	ix_uint xx;
-#line 1137
+#line 1141
 	get_ix_uint(xp, &xx);
-#line 1137
+#line 1141
 	*ip = (float)xx;
-#line 1137
+#line 1141
 	return NC_NOERR;
-#line 1137
+#line 1141
 }
-#line 1137
+#line 1141
 
 static int
-#line 1138
+#line 1142
 ncx_get_uint_double(const void *xp, double *ip)
-#line 1138
+#line 1142
 {
-#line 1138
+#line 1142
 	ix_uint xx;
-#line 1138
+#line 1142
 	get_ix_uint(xp, &xx);
-#line 1138
+#line 1142
 	*ip = (double)xx;
-#line 1138
+#line 1142
 	return NC_NOERR;
-#line 1138
+#line 1142
 }
-#line 1138
+#line 1142
 
 
 static int
@@ -3524,7 +3528,7 @@ ncx_put_uint_schar(void *xp, const schar *ip, void *fillp)
 {
     uchar *cp;
     if (*ip < 0) {
-#line 1149
+#line 1153
 
         return NC_ERANGE;
     }
@@ -3551,369 +3555,369 @@ ncx_put_uint_uchar(void *xp, const uchar *ip, void *fillp)
 
 #if X_SIZEOF_UINT != SIZEOF_UINT
 static int
-#line 1174
+#line 1178
 ncx_put_uint_uint(void *xp, const uint *ip, void *fillp)
-#line 1174
+#line 1178
 {
-#line 1174
+#line 1178
     int err=NC_NOERR;
-#line 1174
+#line 1178
 #if SIZEOF_IX_UINT == SIZEOF_UINT && IX_UINT_MAX == UINT_MAX
-#line 1174
+#line 1178
     put_ix_uint(xp, (const ix_uint *)ip);
-#line 1174
+#line 1178
 #else
-#line 1174
+#line 1178
     ix_uint xx = NC_FILL_UINT;
-#line 1174
+#line 1178
 
-#line 1174
+#line 1178
 #if IX_UINT_MAX < UINT_MAX
-#line 1174
+#line 1178
     if (*ip > IX_UINT_MAX) {
-#line 1174
+#line 1178
         
-#line 1174
+#line 1178
         err = NC_ERANGE;
-#line 1174
+#line 1178
     } 
-#line 1174
+#line 1178
 #endif
-#line 1174
+#line 1178
         xx = (ix_uint)*ip;
-#line 1174
+#line 1178
 
-#line 1174
+#line 1178
     put_ix_uint(xp, &xx);
-#line 1174
+#line 1178
 #endif
-#line 1174
+#line 1178
     return err;
-#line 1174
+#line 1178
 }
-#line 1174
+#line 1178
 
 #endif
 
 static int
-#line 1177
+#line 1181
 ncx_put_uint_short(void *xp, const short *ip, void *fillp)
-#line 1177
+#line 1181
 {
-#line 1177
+#line 1181
     int err=NC_NOERR;
-#line 1177
+#line 1181
     ix_uint xx = NC_FILL_UINT;
-#line 1177
+#line 1181
 
-#line 1177
+#line 1181
 #if IX_UINT_MAX < SHORT_MAX
-#line 1177
+#line 1181
     if (*ip > IX_UINT_MAX) {
-#line 1177
+#line 1181
         
-#line 1177
+#line 1181
         err = NC_ERANGE;
-#line 1177
+#line 1181
     } 
-#line 1177
+#line 1181
 #endif
-#line 1177
+#line 1181
     if (*ip < 0) {
-#line 1177
+#line 1181
         
-#line 1177
+#line 1181
         err = NC_ERANGE; /* because xp is unsigned */
-#line 1177
+#line 1181
     } 
-#line 1177
+#line 1181
         xx = (ix_uint)*ip;
-#line 1177
+#line 1181
 
-#line 1177
+#line 1181
     put_ix_uint(xp, &xx);
-#line 1177
+#line 1181
     return err;
-#line 1177
+#line 1181
 }
-#line 1177
+#line 1181
 
 static int
-#line 1178
+#line 1182
 ncx_put_uint_int(void *xp, const int *ip, void *fillp)
-#line 1178
+#line 1182
 {
-#line 1178
+#line 1182
     int err=NC_NOERR;
-#line 1178
+#line 1182
     ix_uint xx = NC_FILL_UINT;
-#line 1178
+#line 1182
 
-#line 1178
+#line 1182
 #if IX_UINT_MAX < INT_MAX
-#line 1178
+#line 1182
     if (*ip > IX_UINT_MAX) {
-#line 1178
+#line 1182
         
-#line 1178
+#line 1182
         err = NC_ERANGE;
-#line 1178
+#line 1182
     } 
-#line 1178
+#line 1182
 #endif
-#line 1178
+#line 1182
     if (*ip < 0) {
-#line 1178
+#line 1182
         
-#line 1178
+#line 1182
         err = NC_ERANGE; /* because xp is unsigned */
-#line 1178
+#line 1182
     } 
-#line 1178
+#line 1182
         xx = (ix_uint)*ip;
-#line 1178
+#line 1182
 
-#line 1178
+#line 1182
     put_ix_uint(xp, &xx);
-#line 1178
+#line 1182
     return err;
-#line 1178
+#line 1182
 }
-#line 1178
+#line 1182
 
 static int
-#line 1179
+#line 1183
 ncx_put_uint_long(void *xp, const long *ip, void *fillp)
-#line 1179
+#line 1183
 {
-#line 1179
+#line 1183
     int err=NC_NOERR;
-#line 1179
+#line 1183
     ix_uint xx = NC_FILL_UINT;
-#line 1179
+#line 1183
 
-#line 1179
+#line 1183
 #if IX_UINT_MAX < LONG_MAX
-#line 1179
+#line 1183
     if (*ip > IX_UINT_MAX) {
-#line 1179
+#line 1183
         
-#line 1179
+#line 1183
         err = NC_ERANGE;
-#line 1179
+#line 1183
     } 
-#line 1179
+#line 1183
 #endif
-#line 1179
+#line 1183
     if (*ip < 0) {
-#line 1179
+#line 1183
         
-#line 1179
+#line 1183
         err = NC_ERANGE; /* because xp is unsigned */
-#line 1179
+#line 1183
     } 
-#line 1179
+#line 1183
         xx = (ix_uint)*ip;
-#line 1179
+#line 1183
 
-#line 1179
+#line 1183
     put_ix_uint(xp, &xx);
-#line 1179
+#line 1183
     return err;
-#line 1179
+#line 1183
 }
-#line 1179
+#line 1183
 
 static int
-#line 1180
+#line 1184
 ncx_put_uint_longlong(void *xp, const longlong *ip, void *fillp)
-#line 1180
+#line 1184
 {
-#line 1180
+#line 1184
     int err=NC_NOERR;
-#line 1180
+#line 1184
     ix_uint xx = NC_FILL_UINT;
-#line 1180
+#line 1184
 
-#line 1180
+#line 1184
 #if IX_UINT_MAX < LONGLONG_MAX
-#line 1180
+#line 1184
     if (*ip > IX_UINT_MAX) {
-#line 1180
+#line 1184
         
-#line 1180
+#line 1184
         err = NC_ERANGE;
-#line 1180
+#line 1184
     } 
-#line 1180
+#line 1184
 #endif
-#line 1180
+#line 1184
     if (*ip < 0) {
-#line 1180
+#line 1184
         
-#line 1180
+#line 1184
         err = NC_ERANGE; /* because xp is unsigned */
-#line 1180
+#line 1184
     } 
-#line 1180
+#line 1184
         xx = (ix_uint)*ip;
-#line 1180
+#line 1184
 
-#line 1180
+#line 1184
     put_ix_uint(xp, &xx);
-#line 1180
+#line 1184
     return err;
-#line 1180
+#line 1184
 }
-#line 1180
+#line 1184
 
 static int
-#line 1181
+#line 1185
 ncx_put_uint_ushort(void *xp, const ushort *ip, void *fillp)
-#line 1181
+#line 1185
 {
-#line 1181
+#line 1185
     int err=NC_NOERR;
-#line 1181
+#line 1185
 #if SIZEOF_IX_UINT == SIZEOF_USHORT && IX_UINT_MAX == USHORT_MAX
-#line 1181
+#line 1185
     put_ix_uint(xp, (const ix_uint *)ip);
-#line 1181
+#line 1185
 #else
-#line 1181
+#line 1185
     ix_uint xx = NC_FILL_UINT;
-#line 1181
+#line 1185
 
-#line 1181
+#line 1185
 #if IX_UINT_MAX < USHORT_MAX
-#line 1181
+#line 1185
     if (*ip > IX_UINT_MAX) {
-#line 1181
+#line 1185
         
-#line 1181
+#line 1185
         err = NC_ERANGE;
-#line 1181
+#line 1185
     } 
-#line 1181
+#line 1185
 #endif
-#line 1181
+#line 1185
         xx = (ix_uint)*ip;
-#line 1181
+#line 1185
 
-#line 1181
+#line 1185
     put_ix_uint(xp, &xx);
-#line 1181
+#line 1185
 #endif
-#line 1181
+#line 1185
     return err;
-#line 1181
+#line 1185
 }
-#line 1181
+#line 1185
 
 static int
-#line 1182
+#line 1186
 ncx_put_uint_ulonglong(void *xp, const ulonglong *ip, void *fillp)
-#line 1182
+#line 1186
 {
-#line 1182
+#line 1186
     int err=NC_NOERR;
-#line 1182
+#line 1186
 #if SIZEOF_IX_UINT == SIZEOF_ULONGLONG && IX_UINT_MAX == ULONGLONG_MAX
-#line 1182
+#line 1186
     put_ix_uint(xp, (const ix_uint *)ip);
-#line 1182
+#line 1186
 #else
-#line 1182
+#line 1186
     ix_uint xx = NC_FILL_UINT;
-#line 1182
+#line 1186
 
-#line 1182
+#line 1186
 #if IX_UINT_MAX < ULONGLONG_MAX
-#line 1182
+#line 1186
     if (*ip > IX_UINT_MAX) {
-#line 1182
+#line 1186
         
-#line 1182
+#line 1186
         err = NC_ERANGE;
-#line 1182
+#line 1186
     } 
-#line 1182
+#line 1186
 #endif
-#line 1182
+#line 1186
         xx = (ix_uint)*ip;
-#line 1182
+#line 1186
 
-#line 1182
+#line 1186
     put_ix_uint(xp, &xx);
-#line 1182
+#line 1186
 #endif
-#line 1182
+#line 1186
     return err;
-#line 1182
+#line 1186
 }
-#line 1182
+#line 1186
 
 static int
-#line 1183
+#line 1187
 ncx_put_uint_float(void *xp, const float *ip, void *fillp)
-#line 1183
+#line 1187
 {
-#line 1183
+#line 1187
     int err=NC_NOERR;
-#line 1183
+#line 1187
     ix_uint xx = NC_FILL_UINT;
-#line 1183
+#line 1187
 
-#line 1183
+#line 1187
     if (*ip > (double)X_UINT_MAX || *ip < 0) {
-#line 1183
+#line 1187
         
-#line 1183
+#line 1187
         err = NC_ERANGE;
-#line 1183
+#line 1187
     } 
-#line 1183
+#line 1187
         xx = (ix_uint)*ip;
-#line 1183
+#line 1187
 
-#line 1183
+#line 1187
     put_ix_uint(xp, &xx);
-#line 1183
+#line 1187
     return err;
-#line 1183
+#line 1187
 }
-#line 1183
+#line 1187
 
 static int
-#line 1184
+#line 1188
 ncx_put_uint_double(void *xp, const double *ip, void *fillp)
-#line 1184
+#line 1188
 {
-#line 1184
+#line 1188
     int err=NC_NOERR;
-#line 1184
+#line 1188
     ix_uint xx = NC_FILL_UINT;
-#line 1184
+#line 1188
 
-#line 1184
+#line 1188
     if (*ip > X_UINT_MAX || *ip < 0) {
-#line 1184
+#line 1188
         
-#line 1184
+#line 1188
         err = NC_ERANGE;
-#line 1184
+#line 1188
     } 
-#line 1184
+#line 1188
         xx = (ix_uint)*ip;
-#line 1184
+#line 1188
 
-#line 1184
+#line 1188
     put_ix_uint(xp, &xx);
-#line 1184
+#line 1188
     return err;
-#line 1184
+#line 1188
 }
-#line 1184
+#line 1188
 
 
 
@@ -3976,196 +3980,196 @@ static struct sgl_limits min = {
 	{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }		/* Min IEEE */
 };
 
-#line 1298
+#line 1302
 static void
 get_ix_float(const void *xp, float *ip)
 {
 		struct vax_single *const vsp = (struct vax_single *) ip;
-#line 1301
+#line 1305
 		const struct ieee_single *const isp =
-#line 1301
+#line 1305
 			 (const struct ieee_single *) xp;
-#line 1301
+#line 1305
 		unsigned exp = isp->exp_hi << 1 | isp->exp_lo;
-#line 1301
+#line 1305
 
-#line 1301
+#line 1305
 		switch(exp) {
-#line 1301
+#line 1305
 		case 0 :
-#line 1301
+#line 1305
 			/* ieee subnormal */
-#line 1301
+#line 1305
 			if (isp->mant_hi == min.ieee.mant_hi
-#line 1301
+#line 1305
 				&& isp->mant_lo_hi == min.ieee.mant_lo_hi
-#line 1301
+#line 1305
 				&& isp->mant_lo_lo == min.ieee.mant_lo_lo)
-#line 1301
+#line 1305
 			{
-#line 1301
+#line 1305
 				*vsp = min.s;
-#line 1301
+#line 1305
 			}
-#line 1301
+#line 1305
 			else
-#line 1301
+#line 1305
 			{
-#line 1301
+#line 1305
 				unsigned mantissa = (isp->mant_hi << 16)
-#line 1301
+#line 1305
 					 | isp->mant_lo_hi << 8
-#line 1301
+#line 1305
 					 | isp->mant_lo_lo;
-#line 1301
+#line 1305
 				unsigned tmp = mantissa >> 20;
-#line 1301
+#line 1305
 				if (tmp >= 4) {
-#line 1301
+#line 1305
 					vsp->exp = 2;
-#line 1301
+#line 1305
 				} else if (tmp >= 2) {
-#line 1301
+#line 1305
 					vsp->exp = 1;
-#line 1301
+#line 1305
 				} else {
-#line 1301
+#line 1305
 					*vsp = min.s;
-#line 1301
+#line 1305
 					break;
-#line 1301
+#line 1305
 				} /* else */
-#line 1301
+#line 1305
 				tmp = mantissa - (1 << (20 + vsp->exp ));
-#line 1301
+#line 1305
 				tmp <<= 3 - vsp->exp;
-#line 1301
+#line 1305
 				vsp->mantissa2 = tmp;
-#line 1301
+#line 1305
 				vsp->mantissa1 = (tmp >> 16);
-#line 1301
+#line 1305
 			}
-#line 1301
+#line 1305
 			break;
-#line 1301
+#line 1305
 		case 0xfe :
-#line 1301
+#line 1305
 		case 0xff :
-#line 1301
+#line 1305
 			*vsp = max.s;
-#line 1301
+#line 1305
 			break;
-#line 1301
+#line 1305
 		default :
-#line 1301
+#line 1305
 			vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
-#line 1301
+#line 1305
 			vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo;
-#line 1301
+#line 1305
 			vsp->mantissa1 = isp->mant_hi;
-#line 1301
+#line 1305
 		}
-#line 1301
+#line 1305
 
-#line 1301
+#line 1305
 		vsp->sign = isp->sign;
-#line 1301
+#line 1305
 
 }
 
-#line 1355
+#line 1359
 
 static void
 put_ix_float(void *xp, const float *ip)
 {
 		const struct vax_single *const vsp =
-#line 1359
+#line 1363
 			 (const struct vax_single *)ip;
-#line 1359
+#line 1363
 		struct ieee_single *const isp = (struct ieee_single *) xp;
-#line 1359
+#line 1363
 
-#line 1359
+#line 1363
 		switch(vsp->exp){
-#line 1359
+#line 1363
 		case 0 :
-#line 1359
+#line 1363
 			/* all vax float with zero exponent map to zero */
-#line 1359
+#line 1363
 			*isp = min.ieee;
-#line 1359
+#line 1363
 			break;
-#line 1359
+#line 1363
 		case 2 :
-#line 1359
+#line 1363
 		case 1 :
-#line 1359
+#line 1363
 		{
-#line 1359
+#line 1363
 			/* These will map to subnormals */
-#line 1359
+#line 1363
 			unsigned mantissa = (vsp->mantissa1 << 16)
-#line 1359
+#line 1363
 					 | vsp->mantissa2;
-#line 1359
+#line 1363
 			mantissa >>= 3 - vsp->exp;
-#line 1359
+#line 1363
 			mantissa += (1 << (20 + vsp->exp));
-#line 1359
+#line 1363
 			isp->mant_lo_lo = mantissa;
-#line 1359
+#line 1363
 			isp->mant_lo_hi = mantissa >> 8;
-#line 1359
+#line 1363
 			isp->mant_hi = mantissa >> 16;
-#line 1359
+#line 1363
 			isp->exp_lo = 0;
-#line 1359
+#line 1363
 			isp->exp_hi = 0;
-#line 1359
+#line 1363
 		}
-#line 1359
+#line 1363
 			break;
-#line 1359
+#line 1363
 		case 0xff : /* max.s.exp */
-#line 1359
+#line 1363
 			if (vsp->mantissa2 == max.s.mantissa2 &&
-#line 1359
+#line 1363
 			    vsp->mantissa1 == max.s.mantissa1)
-#line 1359
+#line 1363
 			{
-#line 1359
+#line 1363
 				/* map largest vax float to ieee infinity */
-#line 1359
+#line 1363
 				*isp = max.ieee;
-#line 1359
+#line 1363
 				break;
-#line 1359
+#line 1363
 			} /* else, fall thru */
-#line 1359
+#line 1363
 		default :
-#line 1359
+#line 1363
 		{
-#line 1359
+#line 1363
 			unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
-#line 1359
+#line 1363
 			isp->exp_hi = exp >> 1;
-#line 1359
+#line 1363
 			isp->exp_lo = exp;
-#line 1359
+#line 1363
 			isp->mant_lo_lo = vsp->mantissa2;
-#line 1359
+#line 1363
 			isp->mant_lo_hi = vsp->mantissa2 >> 8;
-#line 1359
+#line 1363
 			isp->mant_hi = vsp->mantissa1;
-#line 1359
+#line 1363
 		}
-#line 1359
+#line 1363
 		}
-#line 1359
+#line 1363
 
-#line 1359
+#line 1363
 		isp->sign = vsp->sign;
-#line 1359
+#line 1363
 
 }
 
@@ -4225,7 +4229,7 @@ static const int cs_ieis_bias = 0x4000 - 0x7f;
 
 static const int cs_id_bias = 0x4000 - 0x3ff;
 
-#line 1494
+#line 1498
 
 static void
 get_ix_float(const void *xp, float *ip)
@@ -4235,86 +4239,86 @@ get_ix_float(const void *xp, float *ip)
 	{
 		const ieee_single_hi *isp = (const ieee_single_hi *) xp;
 		cray_single *csp = (cray_single *) ip;
-#line 1502
+#line 1506
 
-#line 1502
+#line 1506
 		if (isp->exp == 0)
-#line 1502
+#line 1506
 		{
-#line 1502
+#line 1506
 			/* ieee subnormal */
-#line 1502
+#line 1506
 			*ip = (double)isp->mant;
-#line 1502
+#line 1506
 			if (isp->mant != 0)
-#line 1502
+#line 1506
 			{
-#line 1502
+#line 1506
 				csp->exp -= (ieee_single_bias + 22);
-#line 1502
+#line 1506
 			}
-#line 1502
+#line 1506
 		}
-#line 1502
+#line 1506
 		else
-#line 1502
+#line 1506
 		{
-#line 1502
+#line 1506
 			csp->exp  = isp->exp + cs_ieis_bias + 1;
-#line 1502
+#line 1506
 			csp->mant = isp->mant << (48 - 1 - 23);
-#line 1502
+#line 1506
 			csp->mant |= (1 << (48 - 1));
-#line 1502
+#line 1506
 		}
-#line 1502
+#line 1506
 		csp->sign = isp->sign;
-#line 1502
+#line 1506
 
-#line 1502
+#line 1506
 
 	}
 	else
 	{
 		const ieee_single_lo *isp = (const ieee_single_lo *) xp;
 		cray_single *csp = (cray_single *) ip;
-#line 1507
+#line 1511
 
-#line 1507
+#line 1511
 		if (isp->exp == 0)
-#line 1507
+#line 1511
 		{
-#line 1507
+#line 1511
 			/* ieee subnormal */
-#line 1507
+#line 1511
 			*ip = (double)isp->mant;
-#line 1507
+#line 1511
 			if (isp->mant != 0)
-#line 1507
+#line 1511
 			{
-#line 1507
+#line 1511
 				csp->exp -= (ieee_single_bias + 22);
-#line 1507
+#line 1511
 			}
-#line 1507
+#line 1511
 		}
-#line 1507
+#line 1511
 		else
-#line 1507
+#line 1511
 		{
-#line 1507
+#line 1511
 			csp->exp  = isp->exp + cs_ieis_bias + 1;
-#line 1507
+#line 1511
 			csp->mant = isp->mant << (48 - 1 - 23);
-#line 1507
+#line 1511
 			csp->mant |= (1 << (48 - 1));
-#line 1507
+#line 1511
 		}
-#line 1507
+#line 1511
 		csp->sign = isp->sign;
-#line 1507
+#line 1511
 
-#line 1507
+#line 1511
 
 	}
 }
@@ -4326,182 +4330,182 @@ put_ix_float(void *xp, const float *ip)
 	{
 		ieee_single_hi *isp = (ieee_single_hi*)xp;
 	const cray_single *csp = (const cray_single *) ip;
-#line 1517
+#line 1521
 	int ieee_exp = csp->exp - cs_ieis_bias -1;
-#line 1517
+#line 1521
 
-#line 1517
+#line 1521
 	isp->sign = csp->sign;
-#line 1517
+#line 1521
 
-#line 1517
+#line 1521
 	if (ieee_exp >= 0xff)
-#line 1517
+#line 1521
 	{
-#line 1517
+#line 1521
 		/* NC_ERANGE => ieee Inf */
-#line 1517
+#line 1521
 		isp->exp = 0xff;
-#line 1517
+#line 1521
 		isp->mant = 0x0;
-#line 1517
+#line 1521
 	}
-#line 1517
+#line 1521
 	else if (ieee_exp > 0)
-#line 1517
+#line 1521
 	{
-#line 1517
+#line 1521
 		/* normal ieee representation */
-#line 1517
+#line 1521
 		isp->exp  = ieee_exp;
-#line 1517
+#line 1521
 		/* assumes cray rep is in normal form */
-#line 1517
+#line 1521
 		assert(csp->mant & 0x800000000000);
-#line 1517
+#line 1521
 		isp->mant = (((csp->mant << 1) &
-#line 1517
+#line 1521
 				0xffffffffffff) >> (48 - 23));
-#line 1517
+#line 1521
 	}
-#line 1517
+#line 1521
 	else if (ieee_exp > -23)
-#line 1517
+#line 1521
 	{
-#line 1517
+#line 1521
 		/* ieee subnormal, right shift */
-#line 1517
+#line 1521
 		const int rshift = (48 - 23 - ieee_exp);
-#line 1517
+#line 1521
 
-#line 1517
+#line 1521
 		isp->mant = csp->mant >> rshift;
-#line 1517
+#line 1521
 
-#line 1517
+#line 1521
 #if 0
-#line 1517
+#line 1521
 		if (csp->mant & (1 << (rshift -1)))
-#line 1517
+#line 1521
 		{
-#line 1517
+#line 1521
 			/* round up */
-#line 1517
+#line 1521
 			isp->mant++;
-#line 1517
+#line 1521
 		}
-#line 1517
+#line 1521
 #endif
-#line 1517
+#line 1521
 
-#line 1517
+#line 1521
 		isp->exp  = 0;
-#line 1517
+#line 1521
 	}
-#line 1517
+#line 1521
 	else
-#line 1517
+#line 1521
 	{
-#line 1517
+#line 1521
 		/* smaller than ieee can represent */
-#line 1517
+#line 1521
 		isp->exp = 0;
-#line 1517
+#line 1521
 		isp->mant = 0;
-#line 1517
+#line 1521
 	}
-#line 1517
+#line 1521
 
 	}
 	else
 	{
 		ieee_single_lo *isp = (ieee_single_lo*)xp;
 	const cray_single *csp = (const cray_single *) ip;
-#line 1522
+#line 1526
 	int ieee_exp = csp->exp - cs_ieis_bias -1;
-#line 1522
+#line 1526
 
-#line 1522
+#line 1526
 	isp->sign = csp->sign;
-#line 1522
+#line 1526
 
-#line 1522
+#line 1526
 	if (ieee_exp >= 0xff)
-#line 1522
+#line 1526
 	{
-#line 1522
+#line 1526
 		/* NC_ERANGE => ieee Inf */
-#line 1522
+#line 1526
 		isp->exp = 0xff;
-#line 1522
+#line 1526
 		isp->mant = 0x0;
-#line 1522
+#line 1526
 	}
-#line 1522
+#line 1526
 	else if (ieee_exp > 0)
-#line 1522
+#line 1526
 	{
-#line 1522
+#line 1526
 		/* normal ieee representation */
-#line 1522
+#line 1526
 		isp->exp  = ieee_exp;
-#line 1522
+#line 1526
 		/* assumes cray rep is in normal form */
-#line 1522
+#line 1526
 		assert(csp->mant & 0x800000000000);
-#line 1522
+#line 1526
 		isp->mant = (((csp->mant << 1) &
-#line 1522
+#line 1526
 				0xffffffffffff) >> (48 - 23));
-#line 1522
+#line 1526
 	}
-#line 1522
+#line 1526
 	else if (ieee_exp > -23)
-#line 1522
+#line 1526
 	{
-#line 1522
+#line 1526
 		/* ieee subnormal, right shift */
-#line 1522
+#line 1526
 		const int rshift = (48 - 23 - ieee_exp);
-#line 1522
+#line 1526
 
-#line 1522
+#line 1526
 		isp->mant = csp->mant >> rshift;
-#line 1522
+#line 1526
 
-#line 1522
+#line 1526
 #if 0
-#line 1522
+#line 1526
 		if (csp->mant & (1 << (rshift -1)))
-#line 1522
+#line 1526
 		{
-#line 1522
+#line 1526
 			/* round up */
-#line 1522
+#line 1526
 			isp->mant++;
-#line 1522
+#line 1526
 		}
-#line 1522
+#line 1526
 #endif
-#line 1522
+#line 1526
 
-#line 1522
+#line 1526
 		isp->exp  = 0;
-#line 1522
+#line 1526
 	}
-#line 1522
+#line 1526
 	else
-#line 1522
+#line 1526
 	{
-#line 1522
+#line 1526
 		/* smaller than ieee can represent */
-#line 1522
+#line 1526
 		isp->exp = 0;
-#line 1522
+#line 1526
 		isp->mant = 0;
-#line 1522
+#line 1526
 	}
-#line 1522
+#line 1526
 
 	}
 }
@@ -4590,252 +4594,252 @@ ncx_get_float_float(const void *xp, float *ip, void *fillp)
 #define ix_float float
 
 static int
-#line 1609
+#line 1613
 ncx_get_float_schar(const void *xp, schar *ip)
-#line 1609
+#line 1613
 {
-#line 1609
+#line 1613
 	ix_float xx;
-#line 1609
+#line 1613
 	get_ix_float(xp, &xx);
-#line 1609
+#line 1613
 	if (xx > (double)SCHAR_MAX || xx < (double)SCHAR_MIN) {
-#line 1609
+#line 1613
             
-#line 1609
+#line 1613
             return NC_ERANGE;
-#line 1609
+#line 1613
         }
-#line 1609
+#line 1613
 	*ip = (schar)xx;
-#line 1609
+#line 1613
 	return NC_NOERR;
-#line 1609
+#line 1613
 }
-#line 1609
+#line 1613
 
 static int
-#line 1610
+#line 1614
 ncx_get_float_short(const void *xp, short *ip)
-#line 1610
+#line 1614
 {
-#line 1610
+#line 1614
 	ix_float xx;
-#line 1610
+#line 1614
 	get_ix_float(xp, &xx);
-#line 1610
+#line 1614
 	if (xx > (double)SHORT_MAX || xx < (double)SHORT_MIN) {
-#line 1610
+#line 1614
             
-#line 1610
+#line 1614
             return NC_ERANGE;
-#line 1610
+#line 1614
         }
-#line 1610
+#line 1614
 	*ip = (short)xx;
-#line 1610
+#line 1614
 	return NC_NOERR;
-#line 1610
+#line 1614
 }
-#line 1610
+#line 1614
 
 static int
-#line 1611
+#line 1615
 ncx_get_float_int(const void *xp, int *ip)
-#line 1611
+#line 1615
 {
-#line 1611
+#line 1615
 	ix_float xx;
-#line 1611
+#line 1615
 	get_ix_float(xp, &xx);
-#line 1611
+#line 1615
 	if (xx > (double)INT_MAX || xx < (double)INT_MIN) {
-#line 1611
+#line 1615
             
-#line 1611
+#line 1615
             return NC_ERANGE;
-#line 1611
+#line 1615
         }
-#line 1611
+#line 1615
 	*ip = (int)xx;
-#line 1611
+#line 1615
 	return NC_NOERR;
-#line 1611
+#line 1615
 }
-#line 1611
+#line 1615
 
 static int
-#line 1612
+#line 1616
 ncx_get_float_long(const void *xp, long *ip)
-#line 1612
+#line 1616
 {
-#line 1612
+#line 1616
 	ix_float xx;
-#line 1612
+#line 1616
 	get_ix_float(xp, &xx);
-#line 1612
+#line 1616
 	if (xx > (double)LONG_MAX || xx < (double)LONG_MIN) {
-#line 1612
+#line 1616
             
-#line 1612
+#line 1616
             return NC_ERANGE;
-#line 1612
+#line 1616
         }
-#line 1612
+#line 1616
 	*ip = (long)xx;
-#line 1612
+#line 1616
 	return NC_NOERR;
-#line 1612
+#line 1616
 }
-#line 1612
+#line 1616
 
 static int
-#line 1613
+#line 1617
 ncx_get_float_double(const void *xp, double *ip)
-#line 1613
+#line 1617
 {
-#line 1613
+#line 1617
 	ix_float xx;
-#line 1613
+#line 1617
 	get_ix_float(xp, &xx);
-#line 1613
+#line 1617
 	*ip = (double)xx;
-#line 1613
+#line 1617
 	return NC_NOERR;
-#line 1613
+#line 1617
 }
-#line 1613
+#line 1617
 
 static int
-#line 1614
+#line 1618
 ncx_get_float_longlong(const void *xp, longlong *ip)
-#line 1614
+#line 1618
 {
-#line 1614
+#line 1618
 	ix_float xx;
-#line 1614
+#line 1618
 	get_ix_float(xp, &xx);
-#line 1614
+#line 1618
 	if (xx == LONGLONG_MAX)      *ip = LONGLONG_MAX;
-#line 1614
+#line 1618
 	else if (xx == LONGLONG_MIN) *ip = LONGLONG_MIN;
-#line 1614
+#line 1618
 	else if (xx > (double)LONGLONG_MAX || xx < (double)LONGLONG_MIN) {
-#line 1614
+#line 1618
             
-#line 1614
+#line 1618
             return NC_ERANGE;
-#line 1614
+#line 1618
         }
-#line 1614
+#line 1618
 	else *ip = (longlong)xx;
-#line 1614
+#line 1618
 	return NC_NOERR;
-#line 1614
+#line 1618
 }
-#line 1614
+#line 1618
 
 static int
-#line 1615
+#line 1619
 ncx_get_float_uchar(const void *xp, uchar *ip)
-#line 1615
+#line 1619
 {
-#line 1615
+#line 1619
 	ix_float xx;
-#line 1615
+#line 1619
 	get_ix_float(xp, &xx);
-#line 1615
+#line 1619
 	if (xx > (double)UCHAR_MAX || xx < 0) {
-#line 1615
+#line 1619
             
-#line 1615
+#line 1619
             return NC_ERANGE;
-#line 1615
+#line 1619
         }
-#line 1615
+#line 1619
 	*ip = (uchar)xx;
-#line 1615
+#line 1619
 	return NC_NOERR;
-#line 1615
+#line 1619
 }
-#line 1615
+#line 1619
 
 static int
-#line 1616
+#line 1620
 ncx_get_float_ushort(const void *xp, ushort *ip)
-#line 1616
+#line 1620
 {
-#line 1616
+#line 1620
 	ix_float xx;
-#line 1616
+#line 1620
 	get_ix_float(xp, &xx);
-#line 1616
+#line 1620
 	if (xx > (double)USHORT_MAX || xx < 0) {
-#line 1616
+#line 1620
             
-#line 1616
+#line 1620
             return NC_ERANGE;
-#line 1616
+#line 1620
         }
-#line 1616
+#line 1620
 	*ip = (ushort)xx;
-#line 1616
+#line 1620
 	return NC_NOERR;
-#line 1616
+#line 1620
 }
-#line 1616
+#line 1620
 
 static int
-#line 1617
+#line 1621
 ncx_get_float_uint(const void *xp, uint *ip)
-#line 1617
+#line 1621
 {
-#line 1617
+#line 1621
 	ix_float xx;
-#line 1617
+#line 1621
 	get_ix_float(xp, &xx);
-#line 1617
+#line 1621
 	if (xx > (double)UINT_MAX || xx < 0) {
-#line 1617
+#line 1621
             
-#line 1617
+#line 1621
             return NC_ERANGE;
-#line 1617
+#line 1621
         }
-#line 1617
+#line 1621
 	*ip = (uint)xx;
-#line 1617
+#line 1621
 	return NC_NOERR;
-#line 1617
+#line 1621
 }
-#line 1617
+#line 1621
 
 static int
-#line 1618
+#line 1622
 ncx_get_float_ulonglong(const void *xp, ulonglong *ip)
-#line 1618
+#line 1622
 {
-#line 1618
+#line 1622
 	ix_float xx;
-#line 1618
+#line 1622
 	get_ix_float(xp, &xx);
-#line 1618
+#line 1622
 	if (xx == ULONGLONG_MAX)      *ip = ULONGLONG_MAX;
-#line 1618
+#line 1622
 	else if (xx > (double)ULONGLONG_MAX || xx < 0) {
-#line 1618
+#line 1622
             
-#line 1618
+#line 1622
             return NC_ERANGE;
-#line 1618
+#line 1622
         }
-#line 1618
+#line 1622
 	else *ip = (ulonglong)xx;
-#line 1618
+#line 1622
 	return NC_NOERR;
-#line 1618
+#line 1622
 }
-#line 1618
+#line 1622
 
 
 #if X_SIZEOF_FLOAT != SIZEOF_FLOAT || defined(NO_IEEE_FLOAT)
@@ -4858,108 +4862,8 @@ ncx_put_float_float(void *xp, const float *ip, void *fillp)
 #endif
 
 static int
-#line 1639
-ncx_put_float_schar(void *xp, const schar *ip, void *fillp)
-#line 1639
-{
-#line 1639
-    int err=NC_NOERR;
-#line 1639
-    ix_float xx = NC_FILL_FLOAT;
-#line 1639
-
-#line 1639
-    
-#line 1639
-        xx = (ix_float)*ip;
-#line 1639
-
-#line 1639
-    put_ix_float(xp, &xx);
-#line 1639
-    return err;
-#line 1639
-}
-#line 1639
-
-static int
-#line 1640
-ncx_put_float_short(void *xp, const short *ip, void *fillp)
-#line 1640
-{
-#line 1640
-    int err=NC_NOERR;
-#line 1640
-    ix_float xx = NC_FILL_FLOAT;
-#line 1640
-
-#line 1640
-    
-#line 1640
-        xx = (ix_float)*ip;
-#line 1640
-
-#line 1640
-    put_ix_float(xp, &xx);
-#line 1640
-    return err;
-#line 1640
-}
-#line 1640
-
-static int
-#line 1641
-ncx_put_float_int(void *xp, const int *ip, void *fillp)
-#line 1641
-{
-#line 1641
-    int err=NC_NOERR;
-#line 1641
-    ix_float xx = NC_FILL_FLOAT;
-#line 1641
-
-#line 1641
-    
-#line 1641
-        xx = (ix_float)*ip;
-#line 1641
-
-#line 1641
-    put_ix_float(xp, &xx);
-#line 1641
-    return err;
-#line 1641
-}
-#line 1641
-
-static int
-#line 1642
-ncx_put_float_long(void *xp, const long *ip, void *fillp)
-#line 1642
-{
-#line 1642
-    int err=NC_NOERR;
-#line 1642
-    ix_float xx = NC_FILL_FLOAT;
-#line 1642
-
-#line 1642
-    
-#line 1642
-        xx = (ix_float)*ip;
-#line 1642
-
-#line 1642
-    put_ix_float(xp, &xx);
-#line 1642
-    return err;
-#line 1642
-}
-#line 1642
-
-static int
 #line 1643
-ncx_put_float_double(void *xp, const double *ip, void *fillp)
+ncx_put_float_schar(void *xp, const schar *ip, void *fillp)
 #line 1643
 {
 #line 1643
@@ -4969,13 +4873,7 @@ ncx_put_float_double(void *xp, const double *ip, void *fillp)
 #line 1643
 
 #line 1643
-    if (*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN) {
-#line 1643
-        
-#line 1643
-        err = NC_ERANGE;
-#line 1643
-    } 
+    
 #line 1643
         xx = (ix_float)*ip;
 #line 1643
@@ -4990,7 +4888,7 @@ ncx_put_float_double(void *xp, const double *ip, void *fillp)
 
 static int
 #line 1644
-ncx_put_float_longlong(void *xp, const longlong *ip, void *fillp)
+ncx_put_float_short(void *xp, const short *ip, void *fillp)
 #line 1644
 {
 #line 1644
@@ -5015,7 +4913,7 @@ ncx_put_float_longlong(void *xp, const longlong *ip, void *fillp)
 
 static int
 #line 1645
-ncx_put_float_uchar(void *xp, const uchar *ip, void *fillp)
+ncx_put_float_int(void *xp, const int *ip, void *fillp)
 #line 1645
 {
 #line 1645
@@ -5040,7 +4938,7 @@ ncx_put_float_uchar(void *xp, const uchar *ip, void *fillp)
 
 static int
 #line 1646
-ncx_put_float_ushort(void *xp, const ushort *ip, void *fillp)
+ncx_put_float_long(void *xp, const long *ip, void *fillp)
 #line 1646
 {
 #line 1646
@@ -5065,7 +4963,7 @@ ncx_put_float_ushort(void *xp, const ushort *ip, void *fillp)
 
 static int
 #line 1647
-ncx_put_float_uint(void *xp, const uint *ip, void *fillp)
+ncx_put_float_double(void *xp, const double *ip, void *fillp)
 #line 1647
 {
 #line 1647
@@ -5075,7 +4973,13 @@ ncx_put_float_uint(void *xp, const uint *ip, void *fillp)
 #line 1647
 
 #line 1647
-    
+    if (*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN) {
+#line 1647
+        
+#line 1647
+        err = NC_ERANGE;
+#line 1647
+    } 
 #line 1647
         xx = (ix_float)*ip;
 #line 1647
@@ -5090,7 +4994,7 @@ ncx_put_float_uint(void *xp, const uint *ip, void *fillp)
 
 static int
 #line 1648
-ncx_put_float_ulonglong(void *xp, const ulonglong *ip, void *fillp)
+ncx_put_float_longlong(void *xp, const longlong *ip, void *fillp)
 #line 1648
 {
 #line 1648
@@ -5113,6 +5017,106 @@ ncx_put_float_ulonglong(void *xp, const ulonglong *ip, void *fillp)
 }
 #line 1648
 
+static int
+#line 1649
+ncx_put_float_uchar(void *xp, const uchar *ip, void *fillp)
+#line 1649
+{
+#line 1649
+    int err=NC_NOERR;
+#line 1649
+    ix_float xx = NC_FILL_FLOAT;
+#line 1649
+
+#line 1649
+    
+#line 1649
+        xx = (ix_float)*ip;
+#line 1649
+
+#line 1649
+    put_ix_float(xp, &xx);
+#line 1649
+    return err;
+#line 1649
+}
+#line 1649
+
+static int
+#line 1650
+ncx_put_float_ushort(void *xp, const ushort *ip, void *fillp)
+#line 1650
+{
+#line 1650
+    int err=NC_NOERR;
+#line 1650
+    ix_float xx = NC_FILL_FLOAT;
+#line 1650
+
+#line 1650
+    
+#line 1650
+        xx = (ix_float)*ip;
+#line 1650
+
+#line 1650
+    put_ix_float(xp, &xx);
+#line 1650
+    return err;
+#line 1650
+}
+#line 1650
+
+static int
+#line 1651
+ncx_put_float_uint(void *xp, const uint *ip, void *fillp)
+#line 1651
+{
+#line 1651
+    int err=NC_NOERR;
+#line 1651
+    ix_float xx = NC_FILL_FLOAT;
+#line 1651
+
+#line 1651
+    
+#line 1651
+        xx = (ix_float)*ip;
+#line 1651
+
+#line 1651
+    put_ix_float(xp, &xx);
+#line 1651
+    return err;
+#line 1651
+}
+#line 1651
+
+static int
+#line 1652
+ncx_put_float_ulonglong(void *xp, const ulonglong *ip, void *fillp)
+#line 1652
+{
+#line 1652
+    int err=NC_NOERR;
+#line 1652
+    ix_float xx = NC_FILL_FLOAT;
+#line 1652
+
+#line 1652
+    
+#line 1652
+        xx = (ix_float)*ip;
+#line 1652
+
+#line 1652
+    put_ix_float(xp, &xx);
+#line 1652
+    return err;
+#line 1652
+}
+#line 1652
+
 
 
 /* external NC_DOUBLE -------------------------------------------------------*/
@@ -5178,218 +5182,218 @@ static const struct dbl_limits {
 };
 
 
-#line 1762
+#line 1766
 static void
 get_ix_double(const void *xp, double *ip)
 {
 	struct vax_double *const vdp =
-#line 1765
+#line 1769
 			 (struct vax_double *)ip;
-#line 1765
+#line 1769
 	const struct ieee_double *const idp =
-#line 1765
+#line 1769
 			 (const struct ieee_double *) xp;
-#line 1765
+#line 1769
 	{
-#line 1765
+#line 1769
 		const struct dbl_limits *lim;
-#line 1765
+#line 1769
 		int ii;
-#line 1765
+#line 1769
 		for (ii = 0, lim = dbl_limits;
-#line 1765
+#line 1769
 			ii < sizeof(dbl_limits)/sizeof(struct dbl_limits);
-#line 1765
+#line 1769
 			ii++, lim++)
-#line 1765
+#line 1769
 		{
-#line 1765
+#line 1769
 			if ((idp->mant_lo == lim->ieee.mant_lo)
-#line 1765
+#line 1769
 				&& (idp->mant_4 == lim->ieee.mant_4)
-#line 1765
+#line 1769
 				&& (idp->mant_5 == lim->ieee.mant_5)
-#line 1765
+#line 1769
 				&& (idp->mant_6 == lim->ieee.mant_6)
-#line 1765
+#line 1769
 				&& (idp->exp_lo == lim->ieee.exp_lo)
-#line 1765
+#line 1769
 				&& (idp->exp_hi == lim->ieee.exp_hi)
-#line 1765
+#line 1769
 				)
-#line 1765
+#line 1769
 			{
-#line 1765
+#line 1769
 				*vdp = lim->d;
-#line 1765
+#line 1769
 				goto doneit;
-#line 1765
+#line 1769
 			}
-#line 1765
+#line 1769
 		}
-#line 1765
+#line 1769
 	}
-#line 1765
+#line 1769
 	{
-#line 1765
+#line 1769
 		unsigned exp = idp->exp_hi << 4 | idp->exp_lo;
-#line 1765
+#line 1769
 		vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
-#line 1765
+#line 1769
 	}
-#line 1765
+#line 1769
 	{
-#line 1765
+#line 1769
 		unsigned mant_hi = ((idp->mant_6 << 16)
-#line 1765
+#line 1769
 				 | (idp->mant_5 << 8)
-#line 1765
+#line 1769
 				 | idp->mant_4);
-#line 1765
+#line 1769
 		unsigned mant_lo = SWAP4(idp->mant_lo);
-#line 1765
+#line 1769
 		vdp->mantissa1 = (mant_hi >> 13);
-#line 1765
+#line 1769
 		vdp->mantissa2 = ((mant_hi & MASK(13)) << 3)
-#line 1765
+#line 1769
 				| (mant_lo >> 29);
-#line 1765
+#line 1769
 		vdp->mantissa3 = (mant_lo >> 13);
-#line 1765
+#line 1769
 		vdp->mantissa4 = (mant_lo << 3);
-#line 1765
+#line 1769
 	}
-#line 1765
+#line 1769
 	doneit:
-#line 1765
+#line 1769
 		vdp->sign = idp->sign;
-#line 1765
+#line 1769
 
 }
 
 
-#line 1835
+#line 1839
 static void
 put_ix_double(void *xp, const double *ip)
 {
 	const struct vax_double *const vdp =
-#line 1838
+#line 1842
 			(const struct vax_double *)ip;
-#line 1838
+#line 1842
 	struct ieee_double *const idp =
-#line 1838
+#line 1842
 			 (struct ieee_double *) xp;
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 	if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) &&
-#line 1838
+#line 1842
 		(vdp->mantissa3 == dbl_limits[0].d.mantissa3) &&
-#line 1838
+#line 1842
 		(vdp->mantissa2 == dbl_limits[0].d.mantissa2) &&
-#line 1838
+#line 1842
 		(vdp->mantissa1 == dbl_limits[0].d.mantissa1) &&
-#line 1838
+#line 1842
 		(vdp->exp == dbl_limits[0].d.exp))
-#line 1838
+#line 1842
 	{
-#line 1838
+#line 1842
 		*idp = dbl_limits[0].ieee;
-#line 1838
+#line 1842
 		goto shipit;
-#line 1838
+#line 1842
 	}
-#line 1838
+#line 1842
 	if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) &&
-#line 1838
+#line 1842
 		(vdp->mantissa3 == dbl_limits[1].d.mantissa3) &&
-#line 1838
+#line 1842
 		(vdp->mantissa2 == dbl_limits[1].d.mantissa2) &&
-#line 1838
+#line 1842
 		(vdp->mantissa1 == dbl_limits[1].d.mantissa1) &&
-#line 1838
+#line 1842
 		(vdp->exp == dbl_limits[1].d.exp))
-#line 1838
+#line 1842
 	{
-#line 1838
+#line 1842
 		*idp = dbl_limits[1].ieee;
-#line 1838
+#line 1842
 		goto shipit;
-#line 1838
+#line 1842
 	}
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 	{
-#line 1838
+#line 1842
 		unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 		unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) |
-#line 1838
+#line 1842
 			(vdp->mantissa3 << 13) |
-#line 1838
+#line 1842
 			((vdp->mantissa4 >> 3) & MASK(13));
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 		unsigned mant_hi = (vdp->mantissa1 << 13)
-#line 1838
+#line 1842
 				 | (vdp->mantissa2 >> 3);
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 		if ((vdp->mantissa4 & 7) > 4)
-#line 1838
+#line 1842
 		{
-#line 1838
+#line 1842
 			/* round up */
-#line 1838
+#line 1842
 			mant_lo++;
-#line 1838
+#line 1842
 			if (mant_lo == 0)
-#line 1838
+#line 1842
 			{
-#line 1838
+#line 1842
 				mant_hi++;
-#line 1838
+#line 1842
 				if (mant_hi > 0xffffff)
-#line 1838
+#line 1842
 				{
-#line 1838
+#line 1842
 					mant_hi = 0;
-#line 1838
+#line 1842
 					exp++;
-#line 1838
+#line 1842
 				}
-#line 1838
+#line 1842
 			}
-#line 1838
+#line 1842
 		}
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 		idp->mant_lo = SWAP4(mant_lo);
-#line 1838
+#line 1842
 		idp->mant_6 = mant_hi >> 16;
-#line 1838
+#line 1842
 		idp->mant_5 = (mant_hi & 0xff00) >> 8;
-#line 1838
+#line 1842
 		idp->mant_4 = mant_hi;
-#line 1838
+#line 1842
 		idp->exp_hi = exp >> 4;
-#line 1838
+#line 1842
 		idp->exp_lo = exp;
-#line 1838
+#line 1842
 	}
-#line 1838
+#line 1842
 
-#line 1838
+#line 1842
 	shipit:
-#line 1838
+#line 1842
 		idp->sign = vdp->sign;
-#line 1838
+#line 1842
 
 }
 
@@ -5483,235 +5487,235 @@ put_ix_double(void *xp, const double *ip)
 #define ix_double double
 
 static int
-#line 1930
+#line 1934
 ncx_get_double_schar(const void *xp, schar *ip)
-#line 1930
+#line 1934
 {
-#line 1930
+#line 1934
 	ix_double xx;
-#line 1930
+#line 1934
 	get_ix_double(xp, &xx);
-#line 1930
+#line 1934
 	if (xx > (double)SCHAR_MAX || xx < (double)SCHAR_MIN) {
-#line 1930
+#line 1934
             
-#line 1930
+#line 1934
             return NC_ERANGE;
-#line 1930
+#line 1934
         }
-#line 1930
+#line 1934
 	*ip = (schar)xx;
-#line 1930
+#line 1934
 	return NC_NOERR;
-#line 1930
+#line 1934
 }
-#line 1930
+#line 1934
 
 static int
-#line 1931
+#line 1935
 ncx_get_double_short(const void *xp, short *ip)
-#line 1931
+#line 1935
 {
-#line 1931
+#line 1935
 	ix_double xx;
-#line 1931
+#line 1935
 	get_ix_double(xp, &xx);
-#line 1931
+#line 1935
 	if (xx > (double)SHORT_MAX || xx < (double)SHORT_MIN) {
-#line 1931
+#line 1935
             
-#line 1931
+#line 1935
             return NC_ERANGE;
-#line 1931
+#line 1935
         }
-#line 1931
+#line 1935
 	*ip = (short)xx;
-#line 1931
+#line 1935
 	return NC_NOERR;
-#line 1931
+#line 1935
 }
-#line 1931
+#line 1935
 
 static int
-#line 1932
+#line 1936
 ncx_get_double_int(const void *xp, int *ip)
-#line 1932
+#line 1936
 {
-#line 1932
+#line 1936
 	ix_double xx;
-#line 1932
+#line 1936
 	get_ix_double(xp, &xx);
-#line 1932
+#line 1936
 	if (xx > (double)INT_MAX || xx < (double)INT_MIN) {
-#line 1932
+#line 1936
             
-#line 1932
+#line 1936
             return NC_ERANGE;
-#line 1932
+#line 1936
         }
-#line 1932
+#line 1936
 	*ip = (int)xx;
-#line 1932
+#line 1936
 	return NC_NOERR;
-#line 1932
+#line 1936
 }
-#line 1932
+#line 1936
 
 static int
-#line 1933
+#line 1937
 ncx_get_double_long(const void *xp, long *ip)
-#line 1933
+#line 1937
 {
-#line 1933
+#line 1937
 	ix_double xx;
-#line 1933
+#line 1937
 	get_ix_double(xp, &xx);
-#line 1933
+#line 1937
 	if (xx > (double)LONG_MAX || xx < (double)LONG_MIN) {
-#line 1933
+#line 1937
             
-#line 1933
+#line 1937
             return NC_ERANGE;
-#line 1933
+#line 1937
         }
-#line 1933
+#line 1937
 	*ip = (long)xx;
-#line 1933
+#line 1937
 	return NC_NOERR;
-#line 1933
+#line 1937
 }
-#line 1933
+#line 1937
 
 static int
-#line 1934
+#line 1938
 ncx_get_double_longlong(const void *xp, longlong *ip)
-#line 1934
+#line 1938
 {
-#line 1934
+#line 1938
 	ix_double xx;
-#line 1934
+#line 1938
 	get_ix_double(xp, &xx);
-#line 1934
+#line 1938
 	if (xx == LONGLONG_MAX)      *ip = LONGLONG_MAX;
-#line 1934
+#line 1938
 	else if (xx == LONGLONG_MIN) *ip = LONGLONG_MIN;
-#line 1934
+#line 1938
 	else if (xx > (double)LONGLONG_MAX || xx < (double)LONGLONG_MIN) {
-#line 1934
+#line 1938
             
-#line 1934
+#line 1938
             return NC_ERANGE;
-#line 1934
+#line 1938
         }
-#line 1934
+#line 1938
 	else *ip = (longlong)xx;
-#line 1934
+#line 1938
 	return NC_NOERR;
-#line 1934
+#line 1938
 }
-#line 1934
+#line 1938
 
 static int
-#line 1935
+#line 1939
 ncx_get_double_uchar(const void *xp, uchar *ip)
-#line 1935
+#line 1939
 {
-#line 1935
+#line 1939
 	ix_double xx;
-#line 1935
+#line 1939
 	get_ix_double(xp, &xx);
-#line 1935
+#line 1939
 	if (xx > (double)UCHAR_MAX || xx < 0) {
-#line 1935
+#line 1939
             
-#line 1935
+#line 1939
             return NC_ERANGE;
-#line 1935
+#line 1939
         }
-#line 1935
+#line 1939
 	*ip = (uchar)xx;
-#line 1935
+#line 1939
 	return NC_NOERR;
-#line 1935
+#line 1939
 }
-#line 1935
+#line 1939
 
 static int
-#line 1936
+#line 1940
 ncx_get_double_ushort(const void *xp, ushort *ip)
-#line 1936
+#line 1940
 {
-#line 1936
+#line 1940
 	ix_double xx;
-#line 1936
+#line 1940
 	get_ix_double(xp, &xx);
-#line 1936
+#line 1940
 	if (xx > (double)USHORT_MAX || xx < 0) {
-#line 1936
+#line 1940
             
-#line 1936
+#line 1940
             return NC_ERANGE;
-#line 1936
+#line 1940
         }
-#line 1936
+#line 1940
 	*ip = (ushort)xx;
-#line 1936
+#line 1940
 	return NC_NOERR;
-#line 1936
+#line 1940
 }
-#line 1936
+#line 1940
 
 static int
-#line 1937
+#line 1941
 ncx_get_double_uint(const void *xp, uint *ip)
-#line 1937
+#line 1941
 {
-#line 1937
+#line 1941
 	ix_double xx;
-#line 1937
+#line 1941
 	get_ix_double(xp, &xx);
-#line 1937
+#line 1941
 	if (xx > (double)UINT_MAX || xx < 0) {
-#line 1937
+#line 1941
             
-#line 1937
+#line 1941
             return NC_ERANGE;
-#line 1937
+#line 1941
         }
-#line 1937
+#line 1941
 	*ip = (uint)xx;
-#line 1937
+#line 1941
 	return NC_NOERR;
-#line 1937
+#line 1941
 }
-#line 1937
+#line 1941
 
 static int
-#line 1938
+#line 1942
 ncx_get_double_ulonglong(const void *xp, ulonglong *ip)
-#line 1938
+#line 1942
 {
-#line 1938
+#line 1942
 	ix_double xx;
-#line 1938
+#line 1942
 	get_ix_double(xp, &xx);
-#line 1938
+#line 1942
 	if (xx == ULONGLONG_MAX)      *ip = ULONGLONG_MAX;
-#line 1938
+#line 1942
 	else if (xx > (double)ULONGLONG_MAX || xx < 0) {
-#line 1938
+#line 1942
             
-#line 1938
+#line 1942
             return NC_ERANGE;
-#line 1938
+#line 1942
         }
-#line 1938
+#line 1942
 	else *ip = (ulonglong)xx;
-#line 1938
+#line 1942
 	return NC_NOERR;
-#line 1938
+#line 1942
 }
-#line 1938
+#line 1942
 
 
 static int
@@ -5742,108 +5746,8 @@ ncx_get_double_double(const void *xp, double *ip, void *fillp)
 #endif
 
 static int
-#line 1967
-ncx_put_double_schar(void *xp, const schar *ip, void *fillp)
-#line 1967
-{
-#line 1967
-    int err=NC_NOERR;
-#line 1967
-    ix_double xx = NC_FILL_DOUBLE;
-#line 1967
-
-#line 1967
-    
-#line 1967
-        xx = (ix_double)*ip;
-#line 1967
-
-#line 1967
-    put_ix_double(xp, &xx);
-#line 1967
-    return err;
-#line 1967
-}
-#line 1967
-
-static int
-#line 1968
-ncx_put_double_uchar(void *xp, const uchar *ip, void *fillp)
-#line 1968
-{
-#line 1968
-    int err=NC_NOERR;
-#line 1968
-    ix_double xx = NC_FILL_DOUBLE;
-#line 1968
-
-#line 1968
-    
-#line 1968
-        xx = (ix_double)*ip;
-#line 1968
-
-#line 1968
-    put_ix_double(xp, &xx);
-#line 1968
-    return err;
-#line 1968
-}
-#line 1968
-
-static int
-#line 1969
-ncx_put_double_short(void *xp, const short *ip, void *fillp)
-#line 1969
-{
-#line 1969
-    int err=NC_NOERR;
-#line 1969
-    ix_double xx = NC_FILL_DOUBLE;
-#line 1969
-
-#line 1969
-    
-#line 1969
-        xx = (ix_double)*ip;
-#line 1969
-
-#line 1969
-    put_ix_double(xp, &xx);
-#line 1969
-    return err;
-#line 1969
-}
-#line 1969
-
-static int
-#line 1970
-ncx_put_double_ushort(void *xp, const ushort *ip, void *fillp)
-#line 1970
-{
-#line 1970
-    int err=NC_NOERR;
-#line 1970
-    ix_double xx = NC_FILL_DOUBLE;
-#line 1970
-
-#line 1970
-    
-#line 1970
-        xx = (ix_double)*ip;
-#line 1970
-
-#line 1970
-    put_ix_double(xp, &xx);
-#line 1970
-    return err;
-#line 1970
-}
-#line 1970
-
-static int
 #line 1971
-ncx_put_double_int(void *xp, const int *ip, void *fillp)
+ncx_put_double_schar(void *xp, const schar *ip, void *fillp)
 #line 1971
 {
 #line 1971
@@ -5868,7 +5772,7 @@ ncx_put_double_int(void *xp, const int *ip, void *fillp)
 
 static int
 #line 1972
-ncx_put_double_long(void *xp, const long *ip, void *fillp)
+ncx_put_double_uchar(void *xp, const uchar *ip, void *fillp)
 #line 1972
 {
 #line 1972
@@ -5893,7 +5797,7 @@ ncx_put_double_long(void *xp, const long *ip, void *fillp)
 
 static int
 #line 1973
-ncx_put_double_uint(void *xp, const uint *ip, void *fillp)
+ncx_put_double_short(void *xp, const short *ip, void *fillp)
 #line 1973
 {
 #line 1973
@@ -5918,7 +5822,7 @@ ncx_put_double_uint(void *xp, const uint *ip, void *fillp)
 
 static int
 #line 1974
-ncx_put_double_longlong(void *xp, const longlong *ip, void *fillp)
+ncx_put_double_ushort(void *xp, const ushort *ip, void *fillp)
 #line 1974
 {
 #line 1974
@@ -5943,7 +5847,7 @@ ncx_put_double_longlong(void *xp, const longlong *ip, void *fillp)
 
 static int
 #line 1975
-ncx_put_double_ulonglong(void *xp, const ulonglong *ip, void *fillp)
+ncx_put_double_int(void *xp, const int *ip, void *fillp)
 #line 1975
 {
 #line 1975
@@ -5966,6 +5870,106 @@ ncx_put_double_ulonglong(void *xp, const ulonglong *ip, void *fillp)
 }
 #line 1975
 
+static int
+#line 1976
+ncx_put_double_long(void *xp, const long *ip, void *fillp)
+#line 1976
+{
+#line 1976
+    int err=NC_NOERR;
+#line 1976
+    ix_double xx = NC_FILL_DOUBLE;
+#line 1976
+
+#line 1976
+    
+#line 1976
+        xx = (ix_double)*ip;
+#line 1976
+
+#line 1976
+    put_ix_double(xp, &xx);
+#line 1976
+    return err;
+#line 1976
+}
+#line 1976
+
+static int
+#line 1977
+ncx_put_double_uint(void *xp, const uint *ip, void *fillp)
+#line 1977
+{
+#line 1977
+    int err=NC_NOERR;
+#line 1977
+    ix_double xx = NC_FILL_DOUBLE;
+#line 1977
+
+#line 1977
+    
+#line 1977
+        xx = (ix_double)*ip;
+#line 1977
+
+#line 1977
+    put_ix_double(xp, &xx);
+#line 1977
+    return err;
+#line 1977
+}
+#line 1977
+
+static int
+#line 1978
+ncx_put_double_longlong(void *xp, const longlong *ip, void *fillp)
+#line 1978
+{
+#line 1978
+    int err=NC_NOERR;
+#line 1978
+    ix_double xx = NC_FILL_DOUBLE;
+#line 1978
+
+#line 1978
+    
+#line 1978
+        xx = (ix_double)*ip;
+#line 1978
+
+#line 1978
+    put_ix_double(xp, &xx);
+#line 1978
+    return err;
+#line 1978
+}
+#line 1978
+
+static int
+#line 1979
+ncx_put_double_ulonglong(void *xp, const ulonglong *ip, void *fillp)
+#line 1979
+{
+#line 1979
+    int err=NC_NOERR;
+#line 1979
+    ix_double xx = NC_FILL_DOUBLE;
+#line 1979
+
+#line 1979
+    
+#line 1979
+        xx = (ix_double)*ip;
+#line 1979
+
+#line 1979
+    put_ix_double(xp, &xx);
+#line 1979
+    return err;
+#line 1979
+}
+#line 1979
+
 
 static int
 ncx_put_double_float(void *xp, const float *ip, void *fillp)
@@ -6055,562 +6059,440 @@ put_ix_int64(void *xp, const ix_int64 *ip)
 
 #if X_SIZEOF_INT64 != SIZEOF_LONGLONG
 static int
-#line 2064
+#line 2068
 ncx_get_longlong_longlong(const void *xp, longlong *ip)
-#line 2064
+#line 2068
 {
-#line 2064
+#line 2068
     int err=NC_NOERR;
-#line 2064
+#line 2068
 #if SIZEOF_IX_INT64 == SIZEOF_LONGLONG && IX_INT64_MAX == LONGLONG_MAX
-#line 2064
+#line 2068
     get_ix_int64(xp, (ix_int64 *)ip);
-#line 2064
+#line 2068
 #else
-#line 2064
+#line 2068
     ix_int64 xx;
-#line 2064
+#line 2068
     get_ix_int64(xp, &xx);
-#line 2064
+#line 2068
 
-#line 2064
+#line 2068
 #if IX_INT64_MAX > LONGLONG_MAX
-#line 2064
+#line 2068
     if (xx > LONGLONG_MAX || xx < LONGLONG_MIN) {
-#line 2064
+#line 2068
 
-#line 2064
+#line 2068
         err = NC_ERANGE;
-#line 2064
+#line 2068
     }
-#line 2064
+#line 2068
 #endif
-#line 2064
+#line 2068
 
-#line 2064
+#line 2068
 
-#line 2064
+#line 2068
     *ip = (longlong) xx;
-#line 2064
+#line 2068
 #endif
-#line 2064
+#line 2068
     return err;
-#line 2064
+#line 2068
 }
-#line 2064
+#line 2068
 
 #endif
 static int
-#line 2066
+#line 2070
 ncx_get_longlong_schar(const void *xp, schar *ip)
-#line 2066
+#line 2070
 {
-#line 2066
+#line 2070
     int err=NC_NOERR;
-#line 2066
+#line 2070
     ix_int64 xx;
-#line 2066
+#line 2070
     get_ix_int64(xp, &xx);
-#line 2066
+#line 2070
 
-#line 2066
+#line 2070
 #if IX_INT64_MAX > SCHAR_MAX
-#line 2066
+#line 2070
     if (xx > SCHAR_MAX || xx < SCHAR_MIN) {
-#line 2066
+#line 2070
 
-#line 2066
+#line 2070
         err = NC_ERANGE;
-#line 2066
+#line 2070
     }
-#line 2066
+#line 2070
 #endif
-#line 2066
+#line 2070
 
-#line 2066
+#line 2070
 
-#line 2066
+#line 2070
     *ip = (schar) xx;
-#line 2066
+#line 2070
     return err;
-#line 2066
+#line 2070
 }
-#line 2066
+#line 2070
 
 static int
-#line 2067
+#line 2071
 ncx_get_longlong_short(const void *xp, short *ip)
-#line 2067
+#line 2071
 {
-#line 2067
+#line 2071
     int err=NC_NOERR;
-#line 2067
+#line 2071
 #if SIZEOF_IX_INT64 == SIZEOF_SHORT && IX_INT64_MAX == SHORT_MAX
-#line 2067
+#line 2071
     get_ix_int64(xp, (ix_int64 *)ip);
-#line 2067
+#line 2071
 #else
-#line 2067
+#line 2071
     ix_int64 xx;
-#line 2067
+#line 2071
     get_ix_int64(xp, &xx);
-#line 2067
+#line 2071
 
-#line 2067
+#line 2071
 #if IX_INT64_MAX > SHORT_MAX
-#line 2067
+#line 2071
     if (xx > SHORT_MAX || xx < SHORT_MIN) {
-#line 2067
+#line 2071
 
-#line 2067
+#line 2071
         err = NC_ERANGE;
-#line 2067
+#line 2071
     }
-#line 2067
+#line 2071
 #endif
-#line 2067
+#line 2071
 
-#line 2067
+#line 2071
 
-#line 2067
+#line 2071
     *ip = (short) xx;
-#line 2067
+#line 2071
 #endif
-#line 2067
+#line 2071
     return err;
-#line 2067
+#line 2071
 }
-#line 2067
+#line 2071
 
 static int
-#line 2068
+#line 2072
 ncx_get_longlong_int(const void *xp, int *ip)
-#line 2068
+#line 2072
 {
-#line 2068
+#line 2072
     int err=NC_NOERR;
-#line 2068
+#line 2072
 #if SIZEOF_IX_INT64 == SIZEOF_INT && IX_INT64_MAX == INT_MAX
-#line 2068
+#line 2072
     get_ix_int64(xp, (ix_int64 *)ip);
-#line 2068
+#line 2072
 #else
-#line 2068
+#line 2072
     ix_int64 xx;
-#line 2068
+#line 2072
     get_ix_int64(xp, &xx);
-#line 2068
+#line 2072
 
-#line 2068
+#line 2072
 #if IX_INT64_MAX > INT_MAX
-#line 2068
+#line 2072
     if (xx > INT_MAX || xx < INT_MIN) {
-#line 2068
+#line 2072
 
-#line 2068
+#line 2072
         err = NC_ERANGE;
-#line 2068
+#line 2072
     }
-#line 2068
+#line 2072
 #endif
-#line 2068
+#line 2072
 
-#line 2068
+#line 2072
 
-#line 2068
+#line 2072
     *ip = (int) xx;
-#line 2068
+#line 2072
 #endif
-#line 2068
+#line 2072
     return err;
-#line 2068
+#line 2072
 }
-#line 2068
+#line 2072
 
 static int
-#line 2069
+#line 2073
 ncx_get_longlong_long(const void *xp, long *ip)
-#line 2069
+#line 2073
 {
-#line 2069
+#line 2073
     int err=NC_NOERR;
-#line 2069
+#line 2073
 #if SIZEOF_IX_INT64 == SIZEOF_LONG && IX_INT64_MAX == LONG_MAX
-#line 2069
+#line 2073
     get_ix_int64(xp, (ix_int64 *)ip);
-#line 2069
+#line 2073
 #else
-#line 2069
+#line 2073
     ix_int64 xx;
-#line 2069
+#line 2073
     get_ix_int64(xp, &xx);
-#line 2069
+#line 2073
 
-#line 2069
+#line 2073
 #if IX_INT64_MAX > LONG_MAX
-#line 2069
+#line 2073
     if (xx > LONG_MAX || xx < LONG_MIN) {
-#line 2069
+#line 2073
 
-#line 2069
+#line 2073
         err = NC_ERANGE;
-#line 2069
+#line 2073
     }
-#line 2069
+#line 2073
 #endif
-#line 2069
+#line 2073
 
-#line 2069
+#line 2073
 
-#line 2069
+#line 2073
     *ip = (long) xx;
-#line 2069
+#line 2073
 #endif
-#line 2069
+#line 2073
     return err;
-#line 2069
+#line 2073
 }
-#line 2069
+#line 2073
 
 static int
-#line 2070
+#line 2074
 ncx_get_longlong_ushort(const void *xp, ushort *ip)
-#line 2070
+#line 2074
 {
-#line 2070
+#line 2074
     int err=NC_NOERR;
-#line 2070
+#line 2074
     ix_int64 xx;
-#line 2070
+#line 2074
     get_ix_int64(xp, &xx);
-#line 2070
+#line 2074
 
-#line 2070
+#line 2074
 #if IX_INT64_MAX > USHORT_MAX
-#line 2070
+#line 2074
     if (xx > USHORT_MAX) {
-#line 2070
+#line 2074
 
-#line 2070
+#line 2074
         err = NC_ERANGE;
-#line 2070
+#line 2074
     }
-#line 2070
+#line 2074
 #endif
-#line 2070
+#line 2074
 
-#line 2070
+#line 2074
     if (xx < 0) {
-#line 2070
+#line 2074
 
-#line 2070
+#line 2074
         err = NC_ERANGE; /* because ip is unsigned */
-#line 2070
+#line 2074
     }
-#line 2070
+#line 2074
     *ip = (ushort) xx;
-#line 2070
+#line 2074
     return err;
-#line 2070
+#line 2074
 }
-#line 2070
+#line 2074
 
 static int
-#line 2071
+#line 2075
 ncx_get_longlong_uchar(const void *xp, uchar *ip)
-#line 2071
+#line 2075
 {
-#line 2071
+#line 2075
     int err=NC_NOERR;
-#line 2071
+#line 2075
     ix_int64 xx;
-#line 2071
+#line 2075
     get_ix_int64(xp, &xx);
-#line 2071
+#line 2075
 
-#line 2071
+#line 2075
 #if IX_INT64_MAX > UCHAR_MAX
-#line 2071
+#line 2075
     if (xx > UCHAR_MAX) {
-#line 2071
+#line 2075
 
-#line 2071
+#line 2075
         err = NC_ERANGE;
-#line 2071
+#line 2075
     }
-#line 2071
+#line 2075
 #endif
-#line 2071
+#line 2075
 
-#line 2071
+#line 2075
     if (xx < 0) {
-#line 2071
+#line 2075
 
-#line 2071
+#line 2075
         err = NC_ERANGE; /* because ip is unsigned */
-#line 2071
+#line 2075
     }
-#line 2071
+#line 2075
     *ip = (uchar) xx;
-#line 2071
+#line 2075
     return err;
-#line 2071
+#line 2075
 }
-#line 2071
+#line 2075
 
 static int
-#line 2072
+#line 2076
 ncx_get_longlong_uint(const void *xp, uint *ip)
-#line 2072
+#line 2076
 {
-#line 2072
+#line 2076
     int err=NC_NOERR;
-#line 2072
+#line 2076
     ix_int64 xx;
-#line 2072
+#line 2076
     get_ix_int64(xp, &xx);
-#line 2072
+#line 2076
 
-#line 2072
+#line 2076
 #if IX_INT64_MAX > UINT_MAX
-#line 2072
+#line 2076
     if (xx > UINT_MAX) {
-#line 2072
+#line 2076
 
-#line 2072
+#line 2076
         err = NC_ERANGE;
-#line 2072
+#line 2076
     }
-#line 2072
+#line 2076
 #endif
-#line 2072
+#line 2076
 
-#line 2072
+#line 2076
     if (xx < 0) {
-#line 2072
+#line 2076
 
-#line 2072
+#line 2076
         err = NC_ERANGE; /* because ip is unsigned */
-#line 2072
+#line 2076
     }
-#line 2072
+#line 2076
     *ip = (uint) xx;
-#line 2072
+#line 2076
     return err;
-#line 2072
+#line 2076
 }
-#line 2072
+#line 2076
 
 static int
-#line 2073
+#line 2077
 ncx_get_longlong_ulonglong(const void *xp, ulonglong *ip)
-#line 2073
+#line 2077
 {
-#line 2073
+#line 2077
     int err=NC_NOERR;
-#line 2073
+#line 2077
     ix_int64 xx;
-#line 2073
+#line 2077
     get_ix_int64(xp, &xx);
-#line 2073
+#line 2077
 
-#line 2073
+#line 2077
 #if IX_INT64_MAX > ULONGLONG_MAX
-#line 2073
+#line 2077
     if (xx > ULONGLONG_MAX) {
-#line 2073
+#line 2077
 
-#line 2073
+#line 2077
         err = NC_ERANGE;
-#line 2073
+#line 2077
     }
-#line 2073
+#line 2077
 #endif
-#line 2073
+#line 2077
 
-#line 2073
+#line 2077
     if (xx < 0) {
-#line 2073
+#line 2077
 
-#line 2073
+#line 2077
         err = NC_ERANGE; /* because ip is unsigned */
-#line 2073
+#line 2077
     }
-#line 2073
+#line 2077
     *ip = (ulonglong) xx;
-#line 2073
+#line 2077
     return err;
-#line 2073
+#line 2077
 }
-#line 2073
+#line 2077
 
 static int
-#line 2074
+#line 2078
 ncx_get_longlong_float(const void *xp, float *ip)
-#line 2074
+#line 2078
 {
-#line 2074
+#line 2078
 	ix_int64 xx;
-#line 2074
+#line 2078
 	get_ix_int64(xp, &xx);
-#line 2074
+#line 2078
 	*ip = (float)xx;
-#line 2074
+#line 2078
 	return NC_NOERR;
-#line 2074
+#line 2078
 }
-#line 2074
+#line 2078
 
 static int
-#line 2075
+#line 2079
 ncx_get_longlong_double(const void *xp, double *ip)
-#line 2075
+#line 2079
 {
-#line 2075
+#line 2079
 	ix_int64 xx;
-#line 2075
+#line 2079
 	get_ix_int64(xp, &xx);
-#line 2075
+#line 2079
 	*ip = (double)xx;
-#line 2075
+#line 2079
 	return NC_NOERR;
-#line 2075
+#line 2079
 }
-#line 2075
+#line 2079
 
 
 #if X_SIZEOF_INT64 != SIZEOF_LONGLONG
 static int
-#line 2078
-ncx_put_longlong_longlong(void *xp, const longlong *ip, void *fillp)
-#line 2078
-{
-#line 2078
-    int err=NC_NOERR;
-#line 2078
-#if SIZEOF_IX_INT64 == SIZEOF_LONGLONG && IX_INT64_MAX == LONGLONG_MAX
-#line 2078
-    put_ix_int64(xp, (const ix_int64 *)ip);
-#line 2078
-#else
-#line 2078
-    ix_int64 xx = NC_FILL_INT64;
-#line 2078
-
-#line 2078
-#if IX_INT64_MAX < LONGLONG_MAX
-#line 2078
-    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
-#line 2078
-        
-#line 2078
-        err = NC_ERANGE;
-#line 2078
-    } 
-#line 2078
-#endif
-#line 2078
-        xx = (ix_int64)*ip;
-#line 2078
-
-#line 2078
-    put_ix_int64(xp, &xx);
-#line 2078
-#endif
-#line 2078
-    return err;
-#line 2078
-}
-#line 2078
-
-#endif
-static int
-#line 2080
-ncx_put_longlong_schar(void *xp, const schar *ip, void *fillp)
-#line 2080
-{
-#line 2080
-    int err=NC_NOERR;
-#line 2080
-    ix_int64 xx = NC_FILL_INT64;
-#line 2080
-
-#line 2080
-#if IX_INT64_MAX < SCHAR_MAX
-#line 2080
-    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
-#line 2080
-        
-#line 2080
-        err = NC_ERANGE;
-#line 2080
-    } 
-#line 2080
-#endif
-#line 2080
-        xx = (ix_int64)*ip;
-#line 2080
-
-#line 2080
-    put_ix_int64(xp, &xx);
-#line 2080
-    return err;
-#line 2080
-}
-#line 2080
-
-static int
-#line 2081
-ncx_put_longlong_short(void *xp, const short *ip, void *fillp)
-#line 2081
-{
-#line 2081
-    int err=NC_NOERR;
-#line 2081
-#if SIZEOF_IX_INT64 == SIZEOF_SHORT && IX_INT64_MAX == SHORT_MAX
-#line 2081
-    put_ix_int64(xp, (const ix_int64 *)ip);
-#line 2081
-#else
-#line 2081
-    ix_int64 xx = NC_FILL_INT64;
-#line 2081
-
-#line 2081
-#if IX_INT64_MAX < SHORT_MAX
-#line 2081
-    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
-#line 2081
-        
-#line 2081
-        err = NC_ERANGE;
-#line 2081
-    } 
-#line 2081
-#endif
-#line 2081
-        xx = (ix_int64)*ip;
-#line 2081
-
-#line 2081
-    put_ix_int64(xp, &xx);
-#line 2081
-#endif
-#line 2081
-    return err;
-#line 2081
-}
-#line 2081
-
-static int
 #line 2082
-ncx_put_longlong_int(void *xp, const int *ip, void *fillp)
+ncx_put_longlong_longlong(void *xp, const longlong *ip, void *fillp)
 #line 2082
 {
 #line 2082
     int err=NC_NOERR;
 #line 2082
-#if SIZEOF_IX_INT64 == SIZEOF_INT && IX_INT64_MAX == INT_MAX
+#if SIZEOF_IX_INT64 == SIZEOF_LONGLONG && IX_INT64_MAX == LONGLONG_MAX
 #line 2082
     put_ix_int64(xp, (const ix_int64 *)ip);
 #line 2082
@@ -6620,7 +6502,7 @@ ncx_put_longlong_int(void *xp, const int *ip, void *fillp)
 #line 2082
 
 #line 2082
-#if IX_INT64_MAX < INT_MAX
+#if IX_INT64_MAX < LONGLONG_MAX
 #line 2082
     if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
 #line 2082
@@ -6645,52 +6527,10 @@ ncx_put_longlong_int(void *xp, const int *ip, void *fillp)
 }
 #line 2082
 
-static int
-#line 2083
-ncx_put_longlong_long(void *xp, const long *ip, void *fillp)
-#line 2083
-{
-#line 2083
-    int err=NC_NOERR;
-#line 2083
-#if SIZEOF_IX_INT64 == SIZEOF_LONG && IX_INT64_MAX == LONG_MAX
-#line 2083
-    put_ix_int64(xp, (const ix_int64 *)ip);
-#line 2083
-#else
-#line 2083
-    ix_int64 xx = NC_FILL_INT64;
-#line 2083
-
-#line 2083
-#if IX_INT64_MAX < LONG_MAX
-#line 2083
-    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
-#line 2083
-        
-#line 2083
-        err = NC_ERANGE;
-#line 2083
-    } 
-#line 2083
-#endif
-#line 2083
-        xx = (ix_int64)*ip;
-#line 2083
-
-#line 2083
-    put_ix_int64(xp, &xx);
-#line 2083
 #endif
-#line 2083
-    return err;
-#line 2083
-}
-#line 2083
-
 static int
 #line 2084
-ncx_put_longlong_ushort(void *xp, const ushort *ip, void *fillp)
+ncx_put_longlong_schar(void *xp, const schar *ip, void *fillp)
 #line 2084
 {
 #line 2084
@@ -6700,9 +6540,9 @@ ncx_put_longlong_ushort(void *xp, const ushort *ip, void *fillp)
 #line 2084
 
 #line 2084
-#if IX_INT64_MAX < USHORT_MAX
+#if IX_INT64_MAX < SCHAR_MAX
 #line 2084
-    if (*ip > IX_INT64_MAX) {
+    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
 #line 2084
         
 #line 2084
@@ -6725,19 +6565,25 @@ ncx_put_longlong_ushort(void *xp, const ushort *ip, void *fillp)
 
 static int
 #line 2085
-ncx_put_longlong_uchar(void *xp, const uchar *ip, void *fillp)
+ncx_put_longlong_short(void *xp, const short *ip, void *fillp)
 #line 2085
 {
 #line 2085
     int err=NC_NOERR;
 #line 2085
+#if SIZEOF_IX_INT64 == SIZEOF_SHORT && IX_INT64_MAX == SHORT_MAX
+#line 2085
+    put_ix_int64(xp, (const ix_int64 *)ip);
+#line 2085
+#else
+#line 2085
     ix_int64 xx = NC_FILL_INT64;
 #line 2085
 
 #line 2085
-#if IX_INT64_MAX < UCHAR_MAX
+#if IX_INT64_MAX < SHORT_MAX
 #line 2085
-    if (*ip > IX_INT64_MAX) {
+    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
 #line 2085
         
 #line 2085
@@ -6753,6 +6599,8 @@ ncx_put_longlong_uchar(void *xp, const uchar *ip, void *fillp)
 #line 2085
     put_ix_int64(xp, &xx);
 #line 2085
+#endif
+#line 2085
     return err;
 #line 2085
 }
@@ -6760,19 +6608,25 @@ ncx_put_longlong_uchar(void *xp, const uchar *ip, void *fillp)
 
 static int
 #line 2086
-ncx_put_longlong_uint(void *xp, const uint *ip, void *fillp)
+ncx_put_longlong_int(void *xp, const int *ip, void *fillp)
 #line 2086
 {
 #line 2086
     int err=NC_NOERR;
 #line 2086
+#if SIZEOF_IX_INT64 == SIZEOF_INT && IX_INT64_MAX == INT_MAX
+#line 2086
+    put_ix_int64(xp, (const ix_int64 *)ip);
+#line 2086
+#else
+#line 2086
     ix_int64 xx = NC_FILL_INT64;
 #line 2086
 
 #line 2086
-#if IX_INT64_MAX < UINT_MAX
+#if IX_INT64_MAX < INT_MAX
 #line 2086
-    if (*ip > IX_INT64_MAX) {
+    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
 #line 2086
         
 #line 2086
@@ -6788,6 +6642,8 @@ ncx_put_longlong_uint(void *xp, const uint *ip, void *fillp)
 #line 2086
     put_ix_int64(xp, &xx);
 #line 2086
+#endif
+#line 2086
     return err;
 #line 2086
 }
@@ -6795,19 +6651,25 @@ ncx_put_longlong_uint(void *xp, const uint *ip, void *fillp)
 
 static int
 #line 2087
-ncx_put_longlong_ulonglong(void *xp, const ulonglong *ip, void *fillp)
+ncx_put_longlong_long(void *xp, const long *ip, void *fillp)
 #line 2087
 {
 #line 2087
     int err=NC_NOERR;
 #line 2087
+#if SIZEOF_IX_INT64 == SIZEOF_LONG && IX_INT64_MAX == LONG_MAX
+#line 2087
+    put_ix_int64(xp, (const ix_int64 *)ip);
+#line 2087
+#else
+#line 2087
     ix_int64 xx = NC_FILL_INT64;
 #line 2087
 
 #line 2087
-#if IX_INT64_MAX < ULONGLONG_MAX
+#if IX_INT64_MAX < LONG_MAX
 #line 2087
-    if (*ip > IX_INT64_MAX) {
+    if (*ip > IX_INT64_MAX || *ip < X_INT64_MIN) {
 #line 2087
         
 #line 2087
@@ -6823,6 +6685,8 @@ ncx_put_longlong_ulonglong(void *xp, const ulonglong *ip, void *fillp)
 #line 2087
     put_ix_int64(xp, &xx);
 #line 2087
+#endif
+#line 2087
     return err;
 #line 2087
 }
@@ -6830,7 +6694,7 @@ ncx_put_longlong_ulonglong(void *xp, const ulonglong *ip, void *fillp)
 
 static int
 #line 2088
-ncx_put_longlong_float(void *xp, const float *ip, void *fillp)
+ncx_put_longlong_ushort(void *xp, const ushort *ip, void *fillp)
 #line 2088
 {
 #line 2088
@@ -6840,7 +6704,9 @@ ncx_put_longlong_float(void *xp, const float *ip, void *fillp)
 #line 2088
 
 #line 2088
-    if (*ip > (double)X_INT64_MAX || *ip < (double)X_INT64_MIN) {
+#if IX_INT64_MAX < USHORT_MAX
+#line 2088
+    if (*ip > IX_INT64_MAX) {
 #line 2088
         
 #line 2088
@@ -6848,6 +6714,8 @@ ncx_put_longlong_float(void *xp, const float *ip, void *fillp)
 #line 2088
     } 
 #line 2088
+#endif
+#line 2088
         xx = (ix_int64)*ip;
 #line 2088
 
@@ -6861,7 +6729,7 @@ ncx_put_longlong_float(void *xp, const float *ip, void *fillp)
 
 static int
 #line 2089
-ncx_put_longlong_double(void *xp, const double *ip, void *fillp)
+ncx_put_longlong_uchar(void *xp, const uchar *ip, void *fillp)
 #line 2089
 {
 #line 2089
@@ -6871,7 +6739,9 @@ ncx_put_longlong_double(void *xp, const double *ip, void *fillp)
 #line 2089
 
 #line 2089
-    if (*ip > X_INT64_MAX || *ip < X_INT64_MIN) {
+#if IX_INT64_MAX < UCHAR_MAX
+#line 2089
+    if (*ip > IX_INT64_MAX) {
 #line 2089
         
 #line 2089
@@ -6879,6 +6749,8 @@ ncx_put_longlong_double(void *xp, const double *ip, void *fillp)
 #line 2089
     } 
 #line 2089
+#endif
+#line 2089
         xx = (ix_int64)*ip;
 #line 2089
 
@@ -6890,6 +6762,138 @@ ncx_put_longlong_double(void *xp, const double *ip, void *fillp)
 }
 #line 2089
 
+static int
+#line 2090
+ncx_put_longlong_uint(void *xp, const uint *ip, void *fillp)
+#line 2090
+{
+#line 2090
+    int err=NC_NOERR;
+#line 2090
+    ix_int64 xx = NC_FILL_INT64;
+#line 2090
+
+#line 2090
+#if IX_INT64_MAX < UINT_MAX
+#line 2090
+    if (*ip > IX_INT64_MAX) {
+#line 2090
+        
+#line 2090
+        err = NC_ERANGE;
+#line 2090
+    } 
+#line 2090
+#endif
+#line 2090
+        xx = (ix_int64)*ip;
+#line 2090
+
+#line 2090
+    put_ix_int64(xp, &xx);
+#line 2090
+    return err;
+#line 2090
+}
+#line 2090
+
+static int
+#line 2091
+ncx_put_longlong_ulonglong(void *xp, const ulonglong *ip, void *fillp)
+#line 2091
+{
+#line 2091
+    int err=NC_NOERR;
+#line 2091
+    ix_int64 xx = NC_FILL_INT64;
+#line 2091
+
+#line 2091
+#if IX_INT64_MAX < ULONGLONG_MAX
+#line 2091
+    if (*ip > IX_INT64_MAX) {
+#line 2091
+        
+#line 2091
+        err = NC_ERANGE;
+#line 2091
+    } 
+#line 2091
+#endif
+#line 2091
+        xx = (ix_int64)*ip;
+#line 2091
+
+#line 2091
+    put_ix_int64(xp, &xx);
+#line 2091
+    return err;
+#line 2091
+}
+#line 2091
+
+static int
+#line 2092
+ncx_put_longlong_float(void *xp, const float *ip, void *fillp)
+#line 2092
+{
+#line 2092
+    int err=NC_NOERR;
+#line 2092
+    ix_int64 xx = NC_FILL_INT64;
+#line 2092
+
+#line 2092
+    if (*ip > (double)X_INT64_MAX || *ip < (double)X_INT64_MIN) {
+#line 2092
+        
+#line 2092
+        err = NC_ERANGE;
+#line 2092
+    } 
+#line 2092
+        xx = (ix_int64)*ip;
+#line 2092
+
+#line 2092
+    put_ix_int64(xp, &xx);
+#line 2092
+    return err;
+#line 2092
+}
+#line 2092
+
+static int
+#line 2093
+ncx_put_longlong_double(void *xp, const double *ip, void *fillp)
+#line 2093
+{
+#line 2093
+    int err=NC_NOERR;
+#line 2093
+    ix_int64 xx = NC_FILL_INT64;
+#line 2093
+
+#line 2093
+    if (*ip > X_INT64_MAX || *ip < X_INT64_MIN) {
+#line 2093
+        
+#line 2093
+        err = NC_ERANGE;
+#line 2093
+    } 
+#line 2093
+        xx = (ix_int64)*ip;
+#line 2093
+
+#line 2093
+    put_ix_int64(xp, &xx);
+#line 2093
+    return err;
+#line 2093
+}
+#line 2093
+
 
 
 /* external NC_UINT64 -------------------------------------------------------*/
@@ -6943,550 +6947,426 @@ put_ix_uint64(void *xp, const ix_uint64 *ip)
 
 #if X_SIZEOF_UINT64 != SIZEOF_ULONGLONG
 static int
-#line 2142
+#line 2146
 ncx_get_ulonglong_ulonglong(const void *xp, ulonglong *ip)
-#line 2142
+#line 2146
 {
-#line 2142
+#line 2146
     int err=NC_NOERR;
-#line 2142
+#line 2146
 #if SIZEOF_IX_UINT64 == SIZEOF_ULONGLONG && IX_UINT64_MAX == ULONGLONG_MAX
-#line 2142
+#line 2146
     get_ix_uint64(xp, (ix_uint64 *)ip);
-#line 2142
+#line 2146
 #else
-#line 2142
+#line 2146
     ix_uint64 xx;
-#line 2142
+#line 2146
     get_ix_uint64(xp, &xx);
-#line 2142
+#line 2146
 
-#line 2142
+#line 2146
 #if IX_UINT64_MAX > ULONGLONG_MAX
-#line 2142
+#line 2146
     if (xx > ULONGLONG_MAX) {
-#line 2142
+#line 2146
 
-#line 2142
+#line 2146
         err = NC_ERANGE;
-#line 2142
+#line 2146
     }
-#line 2142
+#line 2146
 #endif
-#line 2142
+#line 2146
 
-#line 2142
+#line 2146
 
-#line 2142
+#line 2146
     *ip = (ulonglong) xx;
-#line 2142
+#line 2146
 #endif
-#line 2142
+#line 2146
     return err;
-#line 2142
+#line 2146
 }
-#line 2142
+#line 2146
 
 #endif
 static int
-#line 2144
+#line 2148
 ncx_get_ulonglong_schar(const void *xp, schar *ip)
-#line 2144
+#line 2148
 {
-#line 2144
+#line 2148
     int err=NC_NOERR;
-#line 2144
+#line 2148
     ix_uint64 xx;
-#line 2144
+#line 2148
     get_ix_uint64(xp, &xx);
-#line 2144
+#line 2148
 
-#line 2144
+#line 2148
 #if IX_UINT64_MAX > SCHAR_MAX
-#line 2144
+#line 2148
     if (xx > SCHAR_MAX) {
-#line 2144
+#line 2148
 
-#line 2144
+#line 2148
         err = NC_ERANGE;
-#line 2144
+#line 2148
     }
-#line 2144
+#line 2148
 #endif
-#line 2144
+#line 2148
 
-#line 2144
+#line 2148
 
-#line 2144
+#line 2148
     *ip = (schar) xx;
-#line 2144
+#line 2148
     return err;
-#line 2144
+#line 2148
 }
-#line 2144
+#line 2148
 
 static int
-#line 2145
+#line 2149
 ncx_get_ulonglong_short(const void *xp, short *ip)
-#line 2145
+#line 2149
 {
-#line 2145
+#line 2149
     int err=NC_NOERR;
-#line 2145
+#line 2149
     ix_uint64 xx;
-#line 2145
+#line 2149
     get_ix_uint64(xp, &xx);
-#line 2145
+#line 2149
 
-#line 2145
+#line 2149
 #if IX_UINT64_MAX > SHORT_MAX
-#line 2145
+#line 2149
     if (xx > SHORT_MAX) {
-#line 2145
+#line 2149
 
-#line 2145
+#line 2149
         err = NC_ERANGE;
-#line 2145
+#line 2149
     }
-#line 2145
+#line 2149
 #endif
-#line 2145
+#line 2149
 
-#line 2145
+#line 2149
 
-#line 2145
+#line 2149
     *ip = (short) xx;
-#line 2145
+#line 2149
     return err;
-#line 2145
+#line 2149
 }
-#line 2145
+#line 2149
 
 static int
-#line 2146
+#line 2150
 ncx_get_ulonglong_int(const void *xp, int *ip)
-#line 2146
+#line 2150
 {
-#line 2146
+#line 2150
     int err=NC_NOERR;
-#line 2146
+#line 2150
     ix_uint64 xx;
-#line 2146
+#line 2150
     get_ix_uint64(xp, &xx);
-#line 2146
+#line 2150
 
-#line 2146
+#line 2150
 #if IX_UINT64_MAX > INT_MAX
-#line 2146
+#line 2150
     if (xx > INT_MAX) {
-#line 2146
+#line 2150
 
-#line 2146
+#line 2150
         err = NC_ERANGE;
-#line 2146
+#line 2150
     }
-#line 2146
+#line 2150
 #endif
-#line 2146
+#line 2150
 
-#line 2146
+#line 2150
 
-#line 2146
+#line 2150
     *ip = (int) xx;
-#line 2146
+#line 2150
     return err;
-#line 2146
+#line 2150
 }
-#line 2146
+#line 2150
 
 static int
-#line 2147
+#line 2151
 ncx_get_ulonglong_long(const void *xp, long *ip)
-#line 2147
+#line 2151
 {
-#line 2147
+#line 2151
     int err=NC_NOERR;
-#line 2147
+#line 2151
     ix_uint64 xx;
-#line 2147
+#line 2151
     get_ix_uint64(xp, &xx);
-#line 2147
+#line 2151
 
-#line 2147
+#line 2151
 #if IX_UINT64_MAX > LONG_MAX
-#line 2147
+#line 2151
     if (xx > LONG_MAX) {
-#line 2147
+#line 2151
 
-#line 2147
+#line 2151
         err = NC_ERANGE;
-#line 2147
+#line 2151
     }
-#line 2147
+#line 2151
 #endif
-#line 2147
+#line 2151
 
-#line 2147
+#line 2151
 
-#line 2147
+#line 2151
     *ip = (long) xx;
-#line 2147
+#line 2151
     return err;
-#line 2147
+#line 2151
 }
-#line 2147
+#line 2151
 
 static int
-#line 2148
+#line 2152
 ncx_get_ulonglong_longlong(const void *xp, longlong *ip)
-#line 2148
+#line 2152
 {
-#line 2148
+#line 2152
     int err=NC_NOERR;
-#line 2148
+#line 2152
     ix_uint64 xx;
-#line 2148
+#line 2152
     get_ix_uint64(xp, &xx);
-#line 2148
+#line 2152
 
-#line 2148
+#line 2152
 #if IX_UINT64_MAX > LONGLONG_MAX
-#line 2148
+#line 2152
     if (xx > LONGLONG_MAX) {
-#line 2148
+#line 2152
 
-#line 2148
+#line 2152
         err = NC_ERANGE;
-#line 2148
+#line 2152
     }
-#line 2148
+#line 2152
 #endif
-#line 2148
+#line 2152
 
-#line 2148
+#line 2152
 
-#line 2148
+#line 2152
     *ip = (longlong) xx;
-#line 2148
+#line 2152
     return err;
-#line 2148
+#line 2152
 }
-#line 2148
+#line 2152
 
 static int
-#line 2149
+#line 2153
 ncx_get_ulonglong_ushort(const void *xp, ushort *ip)
-#line 2149
+#line 2153
 {
-#line 2149
+#line 2153
     int err=NC_NOERR;
-#line 2149
+#line 2153
 #if SIZEOF_IX_UINT64 == SIZEOF_USHORT && IX_UINT64_MAX == USHORT_MAX
-#line 2149
+#line 2153
     get_ix_uint64(xp, (ix_uint64 *)ip);
-#line 2149
+#line 2153
 #else
-#line 2149
+#line 2153
     ix_uint64 xx;
-#line 2149
+#line 2153
     get_ix_uint64(xp, &xx);
-#line 2149
+#line 2153
 
-#line 2149
+#line 2153
 #if IX_UINT64_MAX > USHORT_MAX
-#line 2149
+#line 2153
     if (xx > USHORT_MAX) {
-#line 2149
+#line 2153
 
-#line 2149
+#line 2153
         err = NC_ERANGE;
-#line 2149
+#line 2153
     }
-#line 2149
+#line 2153
 #endif
-#line 2149
+#line 2153
 
-#line 2149
+#line 2153
 
-#line 2149
+#line 2153
     *ip = (ushort) xx;
-#line 2149
+#line 2153
 #endif
-#line 2149
+#line 2153
     return err;
-#line 2149
+#line 2153
 }
-#line 2149
+#line 2153
 
 static int
-#line 2150
+#line 2154
 ncx_get_ulonglong_uchar(const void *xp, uchar *ip)
-#line 2150
+#line 2154
 {
-#line 2150
+#line 2154
     int err=NC_NOERR;
-#line 2150
+#line 2154
 #if SIZEOF_IX_UINT64 == SIZEOF_UCHAR && IX_UINT64_MAX == UCHAR_MAX
-#line 2150
+#line 2154
     get_ix_uint64(xp, (ix_uint64 *)ip);
-#line 2150
+#line 2154
 #else
-#line 2150
+#line 2154
     ix_uint64 xx;
-#line 2150
+#line 2154
     get_ix_uint64(xp, &xx);
-#line 2150
+#line 2154
 
-#line 2150
+#line 2154
 #if IX_UINT64_MAX > UCHAR_MAX
-#line 2150
+#line 2154
     if (xx > UCHAR_MAX) {
-#line 2150
+#line 2154
 
-#line 2150
+#line 2154
         err = NC_ERANGE;
-#line 2150
+#line 2154
     }
-#line 2150
+#line 2154
 #endif
-#line 2150
+#line 2154
 
-#line 2150
+#line 2154
 
-#line 2150
+#line 2154
     *ip = (uchar) xx;
-#line 2150
+#line 2154
 #endif
-#line 2150
+#line 2154
     return err;
-#line 2150
+#line 2154
 }
-#line 2150
+#line 2154
 
 static int
-#line 2151
+#line 2155
 ncx_get_ulonglong_uint(const void *xp, uint *ip)
-#line 2151
+#line 2155
 {
-#line 2151
+#line 2155
     int err=NC_NOERR;
-#line 2151
+#line 2155
 #if SIZEOF_IX_UINT64 == SIZEOF_UINT && IX_UINT64_MAX == UINT_MAX
-#line 2151
+#line 2155
     get_ix_uint64(xp, (ix_uint64 *)ip);
-#line 2151
+#line 2155
 #else
-#line 2151
+#line 2155
     ix_uint64 xx;
-#line 2151
+#line 2155
     get_ix_uint64(xp, &xx);
-#line 2151
+#line 2155
 
-#line 2151
+#line 2155
 #if IX_UINT64_MAX > UINT_MAX
-#line 2151
+#line 2155
     if (xx > UINT_MAX) {
-#line 2151
+#line 2155
 
-#line 2151
+#line 2155
         err = NC_ERANGE;
-#line 2151
+#line 2155
     }
-#line 2151
+#line 2155
 #endif
-#line 2151
+#line 2155
 
-#line 2151
+#line 2155
 
-#line 2151
+#line 2155
     *ip = (uint) xx;
-#line 2151
+#line 2155
 #endif
-#line 2151
+#line 2155
     return err;
-#line 2151
+#line 2155
 }
-#line 2151
+#line 2155
 
 static int
-#line 2152
+#line 2156
 ncx_get_ulonglong_float(const void *xp, float *ip)
-#line 2152
+#line 2156
 {
-#line 2152
+#line 2156
 	ix_uint64 xx;
-#line 2152
+#line 2156
 	get_ix_uint64(xp, &xx);
-#line 2152
+#line 2156
 	*ip = (float)xx;
-#line 2152
+#line 2156
 	return NC_NOERR;
-#line 2152
+#line 2156
 }
-#line 2152
+#line 2156
 
 static int
-#line 2153
+#line 2157
 ncx_get_ulonglong_double(const void *xp, double *ip)
-#line 2153
+#line 2157
 {
-#line 2153
+#line 2157
 	ix_uint64 xx;
-#line 2153
+#line 2157
 	get_ix_uint64(xp, &xx);
-#line 2153
+#line 2157
 	*ip = (double)xx;
-#line 2153
+#line 2157
 	return NC_NOERR;
-#line 2153
+#line 2157
 }
-#line 2153
+#line 2157
 
 
 #if X_SIZEOF_UINT64 != SIZEOF_ULONGLONG
 static int
-#line 2156
+#line 2160
 ncx_put_ulonglong_ulonglong(void *xp, const ulonglong *ip, void *fillp)
-#line 2156
+#line 2160
 {
-#line 2156
-    int err=NC_NOERR;
-#line 2156
-#if SIZEOF_IX_UINT64 == SIZEOF_ULONGLONG && IX_UINT64_MAX == ULONGLONG_MAX
-#line 2156
-    put_ix_uint64(xp, (const ix_uint64 *)ip);
-#line 2156
-#else
-#line 2156
-    ix_uint64 xx = NC_FILL_UINT64;
-#line 2156
-
-#line 2156
-#if IX_UINT64_MAX < ULONGLONG_MAX
-#line 2156
-    if (*ip > IX_UINT64_MAX) {
-#line 2156
-        
-#line 2156
-        err = NC_ERANGE;
-#line 2156
-    } 
-#line 2156
-#endif
-#line 2156
-        xx = (ix_uint64)*ip;
-#line 2156
-
-#line 2156
-    put_ix_uint64(xp, &xx);
-#line 2156
-#endif
-#line 2156
-    return err;
-#line 2156
-}
-#line 2156
-
-#endif
-static int
-#line 2158
-ncx_put_ulonglong_schar(void *xp, const schar *ip, void *fillp)
-#line 2158
-{
-#line 2158
-    int err=NC_NOERR;
-#line 2158
-    ix_uint64 xx = NC_FILL_UINT64;
-#line 2158
-
-#line 2158
-#if IX_UINT64_MAX < SCHAR_MAX
-#line 2158
-    if (*ip > IX_UINT64_MAX) {
-#line 2158
-        
-#line 2158
-        err = NC_ERANGE;
-#line 2158
-    } 
-#line 2158
-#endif
-#line 2158
-    if (*ip < 0) {
-#line 2158
-        
-#line 2158
-        err = NC_ERANGE; /* because xp is unsigned */
-#line 2158
-    } 
-#line 2158
-        xx = (ix_uint64)*ip;
-#line 2158
-
-#line 2158
-    put_ix_uint64(xp, &xx);
-#line 2158
-    return err;
-#line 2158
-}
-#line 2158
-
-static int
-#line 2159
-ncx_put_ulonglong_short(void *xp, const short *ip, void *fillp)
-#line 2159
-{
-#line 2159
+#line 2160
     int err=NC_NOERR;
-#line 2159
-    ix_uint64 xx = NC_FILL_UINT64;
-#line 2159
-
-#line 2159
-#if IX_UINT64_MAX < SHORT_MAX
-#line 2159
-    if (*ip > IX_UINT64_MAX) {
-#line 2159
-        
-#line 2159
-        err = NC_ERANGE;
-#line 2159
-    } 
-#line 2159
-#endif
-#line 2159
-    if (*ip < 0) {
-#line 2159
-        
-#line 2159
-        err = NC_ERANGE; /* because xp is unsigned */
-#line 2159
-    } 
-#line 2159
-        xx = (ix_uint64)*ip;
-#line 2159
-
-#line 2159
-    put_ix_uint64(xp, &xx);
-#line 2159
-    return err;
-#line 2159
-}
-#line 2159
-
-static int
 #line 2160
-ncx_put_ulonglong_int(void *xp, const int *ip, void *fillp)
+#if SIZEOF_IX_UINT64 == SIZEOF_ULONGLONG && IX_UINT64_MAX == ULONGLONG_MAX
 #line 2160
-{
+    put_ix_uint64(xp, (const ix_uint64 *)ip);
 #line 2160
-    int err=NC_NOERR;
+#else
 #line 2160
     ix_uint64 xx = NC_FILL_UINT64;
 #line 2160
 
 #line 2160
-#if IX_UINT64_MAX < INT_MAX
+#if IX_UINT64_MAX < ULONGLONG_MAX
 #line 2160
     if (*ip > IX_UINT64_MAX) {
 #line 2160
@@ -7498,71 +7378,23 @@ ncx_put_ulonglong_int(void *xp, const int *ip, void *fillp)
 #line 2160
 #endif
 #line 2160
-    if (*ip < 0) {
-#line 2160
-        
-#line 2160
-        err = NC_ERANGE; /* because xp is unsigned */
-#line 2160
-    } 
-#line 2160
         xx = (ix_uint64)*ip;
 #line 2160
 
 #line 2160
     put_ix_uint64(xp, &xx);
 #line 2160
+#endif
+#line 2160
     return err;
 #line 2160
 }
 #line 2160
 
-static int
-#line 2161
-ncx_put_ulonglong_long(void *xp, const long *ip, void *fillp)
-#line 2161
-{
-#line 2161
-    int err=NC_NOERR;
-#line 2161
-    ix_uint64 xx = NC_FILL_UINT64;
-#line 2161
-
-#line 2161
-#if IX_UINT64_MAX < LONG_MAX
-#line 2161
-    if (*ip > IX_UINT64_MAX) {
-#line 2161
-        
-#line 2161
-        err = NC_ERANGE;
-#line 2161
-    } 
-#line 2161
 #endif
-#line 2161
-    if (*ip < 0) {
-#line 2161
-        
-#line 2161
-        err = NC_ERANGE; /* because xp is unsigned */
-#line 2161
-    } 
-#line 2161
-        xx = (ix_uint64)*ip;
-#line 2161
-
-#line 2161
-    put_ix_uint64(xp, &xx);
-#line 2161
-    return err;
-#line 2161
-}
-#line 2161
-
 static int
 #line 2162
-ncx_put_ulonglong_longlong(void *xp, const longlong *ip, void *fillp)
+ncx_put_ulonglong_schar(void *xp, const schar *ip, void *fillp)
 #line 2162
 {
 #line 2162
@@ -7572,7 +7404,7 @@ ncx_put_ulonglong_longlong(void *xp, const longlong *ip, void *fillp)
 #line 2162
 
 #line 2162
-#if IX_UINT64_MAX < LONGLONG_MAX
+#if IX_UINT64_MAX < SCHAR_MAX
 #line 2162
     if (*ip > IX_UINT64_MAX) {
 #line 2162
@@ -7605,23 +7437,17 @@ ncx_put_ulonglong_longlong(void *xp, const longlong *ip, void *fillp)
 
 static int
 #line 2163
-ncx_put_ulonglong_uchar(void *xp, const uchar *ip, void *fillp)
+ncx_put_ulonglong_short(void *xp, const short *ip, void *fillp)
 #line 2163
 {
 #line 2163
     int err=NC_NOERR;
 #line 2163
-#if SIZEOF_IX_UINT64 == SIZEOF_UCHAR && IX_UINT64_MAX == UCHAR_MAX
-#line 2163
-    put_ix_uint64(xp, (const ix_uint64 *)ip);
-#line 2163
-#else
-#line 2163
     ix_uint64 xx = NC_FILL_UINT64;
 #line 2163
 
 #line 2163
-#if IX_UINT64_MAX < UCHAR_MAX
+#if IX_UINT64_MAX < SHORT_MAX
 #line 2163
     if (*ip > IX_UINT64_MAX) {
 #line 2163
@@ -7633,14 +7459,20 @@ ncx_put_ulonglong_uchar(void *xp, const uchar *ip, void *fillp)
 #line 2163
 #endif
 #line 2163
+    if (*ip < 0) {
+#line 2163
+        
+#line 2163
+        err = NC_ERANGE; /* because xp is unsigned */
+#line 2163
+    } 
+#line 2163
         xx = (ix_uint64)*ip;
 #line 2163
 
 #line 2163
     put_ix_uint64(xp, &xx);
 #line 2163
-#endif
-#line 2163
     return err;
 #line 2163
 }
@@ -7648,23 +7480,17 @@ ncx_put_ulonglong_uchar(void *xp, const uchar *ip, void *fillp)
 
 static int
 #line 2164
-ncx_put_ulonglong_ushort(void *xp, const ushort *ip, void *fillp)
+ncx_put_ulonglong_int(void *xp, const int *ip, void *fillp)
 #line 2164
 {
 #line 2164
     int err=NC_NOERR;
 #line 2164
-#if SIZEOF_IX_UINT64 == SIZEOF_USHORT && IX_UINT64_MAX == USHORT_MAX
-#line 2164
-    put_ix_uint64(xp, (const ix_uint64 *)ip);
-#line 2164
-#else
-#line 2164
     ix_uint64 xx = NC_FILL_UINT64;
 #line 2164
 
 #line 2164
-#if IX_UINT64_MAX < USHORT_MAX
+#if IX_UINT64_MAX < INT_MAX
 #line 2164
     if (*ip > IX_UINT64_MAX) {
 #line 2164
@@ -7676,14 +7502,20 @@ ncx_put_ulonglong_ushort(void *xp, const ushort *ip, void *fillp)
 #line 2164
 #endif
 #line 2164
+    if (*ip < 0) {
+#line 2164
+        
+#line 2164
+        err = NC_ERANGE; /* because xp is unsigned */
+#line 2164
+    } 
+#line 2164
         xx = (ix_uint64)*ip;
 #line 2164
 
 #line 2164
     put_ix_uint64(xp, &xx);
 #line 2164
-#endif
-#line 2164
     return err;
 #line 2164
 }
@@ -7691,23 +7523,17 @@ ncx_put_ulonglong_ushort(void *xp, const ushort *ip, void *fillp)
 
 static int
 #line 2165
-ncx_put_ulonglong_uint(void *xp, const uint *ip, void *fillp)
+ncx_put_ulonglong_long(void *xp, const long *ip, void *fillp)
 #line 2165
 {
 #line 2165
     int err=NC_NOERR;
 #line 2165
-#if SIZEOF_IX_UINT64 == SIZEOF_UINT && IX_UINT64_MAX == UINT_MAX
-#line 2165
-    put_ix_uint64(xp, (const ix_uint64 *)ip);
-#line 2165
-#else
-#line 2165
     ix_uint64 xx = NC_FILL_UINT64;
 #line 2165
 
 #line 2165
-#if IX_UINT64_MAX < UINT_MAX
+#if IX_UINT64_MAX < LONG_MAX
 #line 2165
     if (*ip > IX_UINT64_MAX) {
 #line 2165
@@ -7719,14 +7545,20 @@ ncx_put_ulonglong_uint(void *xp, const uint *ip, void *fillp)
 #line 2165
 #endif
 #line 2165
+    if (*ip < 0) {
+#line 2165
+        
+#line 2165
+        err = NC_ERANGE; /* because xp is unsigned */
+#line 2165
+    } 
+#line 2165
         xx = (ix_uint64)*ip;
 #line 2165
 
 #line 2165
     put_ix_uint64(xp, &xx);
 #line 2165
-#endif
-#line 2165
     return err;
 #line 2165
 }
@@ -7734,7 +7566,7 @@ ncx_put_ulonglong_uint(void *xp, const uint *ip, void *fillp)
 
 static int
 #line 2166
-ncx_put_ulonglong_float(void *xp, const float *ip, void *fillp)
+ncx_put_ulonglong_longlong(void *xp, const longlong *ip, void *fillp)
 #line 2166
 {
 #line 2166
@@ -7744,7 +7576,9 @@ ncx_put_ulonglong_float(void *xp, const float *ip, void *fillp)
 #line 2166
 
 #line 2166
-    if (*ip > (double)X_UINT64_MAX || *ip < 0) {
+#if IX_UINT64_MAX < LONGLONG_MAX
+#line 2166
+    if (*ip > IX_UINT64_MAX) {
 #line 2166
         
 #line 2166
@@ -7752,6 +7586,16 @@ ncx_put_ulonglong_float(void *xp, const float *ip, void *fillp)
 #line 2166
     } 
 #line 2166
+#endif
+#line 2166
+    if (*ip < 0) {
+#line 2166
+        
+#line 2166
+        err = NC_ERANGE; /* because xp is unsigned */
+#line 2166
+    } 
+#line 2166
         xx = (ix_uint64)*ip;
 #line 2166
 
@@ -7765,17 +7609,25 @@ ncx_put_ulonglong_float(void *xp, const float *ip, void *fillp)
 
 static int
 #line 2167
-ncx_put_ulonglong_double(void *xp, const double *ip, void *fillp)
+ncx_put_ulonglong_uchar(void *xp, const uchar *ip, void *fillp)
 #line 2167
 {
 #line 2167
     int err=NC_NOERR;
 #line 2167
+#if SIZEOF_IX_UINT64 == SIZEOF_UCHAR && IX_UINT64_MAX == UCHAR_MAX
+#line 2167
+    put_ix_uint64(xp, (const ix_uint64 *)ip);
+#line 2167
+#else
+#line 2167
     ix_uint64 xx = NC_FILL_UINT64;
 #line 2167
 
 #line 2167
-    if (*ip > X_UINT64_MAX || *ip < 0) {
+#if IX_UINT64_MAX < UCHAR_MAX
+#line 2167
+    if (*ip > IX_UINT64_MAX) {
 #line 2167
         
 #line 2167
@@ -7783,35 +7635,187 @@ ncx_put_ulonglong_double(void *xp, const double *ip, void *fillp)
 #line 2167
     } 
 #line 2167
+#endif
+#line 2167
         xx = (ix_uint64)*ip;
 #line 2167
 
 #line 2167
     put_ix_uint64(xp, &xx);
 #line 2167
+#endif
+#line 2167
     return err;
 #line 2167
 }
 #line 2167
 
+static int
+#line 2168
+ncx_put_ulonglong_ushort(void *xp, const ushort *ip, void *fillp)
+#line 2168
+{
+#line 2168
+    int err=NC_NOERR;
+#line 2168
+#if SIZEOF_IX_UINT64 == SIZEOF_USHORT && IX_UINT64_MAX == USHORT_MAX
+#line 2168
+    put_ix_uint64(xp, (const ix_uint64 *)ip);
+#line 2168
+#else
+#line 2168
+    ix_uint64 xx = NC_FILL_UINT64;
+#line 2168
 
+#line 2168
+#if IX_UINT64_MAX < USHORT_MAX
+#line 2168
+    if (*ip > IX_UINT64_MAX) {
+#line 2168
+        
+#line 2168
+        err = NC_ERANGE;
+#line 2168
+    } 
+#line 2168
+#endif
+#line 2168
+        xx = (ix_uint64)*ip;
+#line 2168
 
-/* x_size_t */
-
-#if SIZEOF_SIZE_T < X_SIZEOF_SIZE_T
-#error "x_size_t implementation"
-/* netcdf requires size_t which can hold a values from 0 to 2^32 -1 */
+#line 2168
+    put_ix_uint64(xp, &xx);
+#line 2168
 #endif
+#line 2168
+    return err;
+#line 2168
+}
+#line 2168
 
-int
-ncx_put_size_t(void **xpp, const size_t *ulp)
+static int
+#line 2169
+ncx_put_ulonglong_uint(void *xp, const uint *ip, void *fillp)
+#line 2169
 {
-	/* similar to put_ix_int() */
-	uchar *cp = (uchar *) *xpp;
-	assert(*ulp <= X_SIZE_MAX);
+#line 2169
+    int err=NC_NOERR;
+#line 2169
+#if SIZEOF_IX_UINT64 == SIZEOF_UINT && IX_UINT64_MAX == UINT_MAX
+#line 2169
+    put_ix_uint64(xp, (const ix_uint64 *)ip);
+#line 2169
+#else
+#line 2169
+    ix_uint64 xx = NC_FILL_UINT64;
+#line 2169
 
-	*cp++ = (uchar)((*ulp) >> 24);
-	*cp++ = (uchar)(((*ulp) & 0x00ff0000) >> 16);
+#line 2169
+#if IX_UINT64_MAX < UINT_MAX
+#line 2169
+    if (*ip > IX_UINT64_MAX) {
+#line 2169
+        
+#line 2169
+        err = NC_ERANGE;
+#line 2169
+    } 
+#line 2169
+#endif
+#line 2169
+        xx = (ix_uint64)*ip;
+#line 2169
+
+#line 2169
+    put_ix_uint64(xp, &xx);
+#line 2169
+#endif
+#line 2169
+    return err;
+#line 2169
+}
+#line 2169
+
+static int
+#line 2170
+ncx_put_ulonglong_float(void *xp, const float *ip, void *fillp)
+#line 2170
+{
+#line 2170
+    int err=NC_NOERR;
+#line 2170
+    ix_uint64 xx = NC_FILL_UINT64;
+#line 2170
+
+#line 2170
+    if (*ip > (double)X_UINT64_MAX || *ip < 0) {
+#line 2170
+        
+#line 2170
+        err = NC_ERANGE;
+#line 2170
+    } 
+#line 2170
+        xx = (ix_uint64)*ip;
+#line 2170
+
+#line 2170
+    put_ix_uint64(xp, &xx);
+#line 2170
+    return err;
+#line 2170
+}
+#line 2170
+
+static int
+#line 2171
+ncx_put_ulonglong_double(void *xp, const double *ip, void *fillp)
+#line 2171
+{
+#line 2171
+    int err=NC_NOERR;
+#line 2171
+    ix_uint64 xx = NC_FILL_UINT64;
+#line 2171
+
+#line 2171
+    if (*ip > X_UINT64_MAX || *ip < 0) {
+#line 2171
+        
+#line 2171
+        err = NC_ERANGE;
+#line 2171
+    } 
+#line 2171
+        xx = (ix_uint64)*ip;
+#line 2171
+
+#line 2171
+    put_ix_uint64(xp, &xx);
+#line 2171
+    return err;
+#line 2171
+}
+#line 2171
+
+
+
+/* x_size_t */
+
+#if SIZEOF_SIZE_T < X_SIZEOF_SIZE_T
+#error "x_size_t implementation"
+/* netcdf requires size_t which can hold a values from 0 to 2^32 -1 */
+#endif
+
+int
+ncx_put_size_t(void **xpp, const size_t *ulp)
+{
+	/* similar to put_ix_int() */
+	uchar *cp = (uchar *) *xpp;
+	assert(*ulp <= X_SIZE_MAX);
+
+	*cp++ = (uchar)((*ulp) >> 24);
+	*cp++ = (uchar)(((*ulp) & 0x00ff0000) >> 16);
 	*cp++ = (uchar)(((*ulp) & 0x0000ff00) >>  8);
 	*cp   = (uchar)((*ulp) & 0x000000ff);
 
@@ -7825,7 +7829,7 @@ ncx_get_size_t(const void **xpp,  size_t *ulp)
 	/* similar to get_ix_int */
 	const uchar *cp = (const uchar *) *xpp;
 
-	*ulp  = (unsigned)(*cp++ << 24);
+	*ulp  = (unsigned)(*cp++) << 24;
 	*ulp |= (*cp++ << 16);
 	*ulp |= (*cp++ << 8);
 	*ulp |= *cp;
@@ -8046,155 +8050,29 @@ ncx_put_uint64(void **xpp, const unsigned long long ip)
 /*
  * Aggregate numeric conversion functions.
  */
-#line 2423
+#line 2427
 
-#line 2822
+#line 2826
 
-#line 2828
+#line 2832
 
 /* schar ---------------------------------------------------------------------*/
 
-#line 2832
+#line 2836
 int
 ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
 {
 		(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 2835
-	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 2835
-	return NC_NOERR;
-#line 2835
-
-}
-int
-#line 2837
-ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 2837
-{
-#line 2837
-    int status = NC_NOERR;
-#line 2837
-    schar *xp = (schar *)(*xpp);
-#line 2837
-
-#line 2837
-    while (nelems-- != 0) {
-#line 2837
-        
-#line 2837
-        if (*xp < 0) {
-#line 2837
-            
-#line 2837
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2837
-            
-#line 2837
-        }
-#line 2837
-        *tp++ = (uchar) (signed) (*xp++);  /* type cast from schar to uchar */
-#line 2837
-    }
-#line 2837
-
-#line 2837
-    *xpp = (const void *)xp;
-#line 2837
-    return status;
-#line 2837
-}
-#line 2837
-
-int
-#line 2838
-ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp)
-#line 2838
-{
-#line 2838
-    int status = NC_NOERR;
-#line 2838
-    schar *xp = (schar *)(*xpp);
-#line 2838
-
-#line 2838
-    while (nelems-- != 0) {
-#line 2838
-        
-#line 2838
-        *tp++ = (short)  (*xp++);  /* type cast from schar to short */
-#line 2838
-    }
-#line 2838
-
-#line 2838
-    *xpp = (const void *)xp;
-#line 2838
-    return status;
-#line 2838
-}
-#line 2838
-
-int
-#line 2839
-ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp)
-#line 2839
-{
-#line 2839
-    int status = NC_NOERR;
-#line 2839
-    schar *xp = (schar *)(*xpp);
-#line 2839
-
-#line 2839
-    while (nelems-- != 0) {
-#line 2839
-        
-#line 2839
-        *tp++ = (int)  (*xp++);  /* type cast from schar to int */
-#line 2839
-    }
-#line 2839
-
-#line 2839
-    *xpp = (const void *)xp;
 #line 2839
-    return status;
+	*xpp = (void *)((char *)(*xpp) + nelems);
 #line 2839
-}
+	return NC_NOERR;
 #line 2839
 
-int
-#line 2840
-ncx_getn_schar_long(const void **xpp, size_t nelems, long *tp)
-#line 2840
-{
-#line 2840
-    int status = NC_NOERR;
-#line 2840
-    schar *xp = (schar *)(*xpp);
-#line 2840
-
-#line 2840
-    while (nelems-- != 0) {
-#line 2840
-        
-#line 2840
-        *tp++ = (long)  (*xp++);  /* type cast from schar to long */
-#line 2840
-    }
-#line 2840
-
-#line 2840
-    *xpp = (const void *)xp;
-#line 2840
-    return status;
-#line 2840
 }
-#line 2840
-
 int
 #line 2841
-ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
+ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 2841
 {
 #line 2841
@@ -8208,7 +8086,17 @@ ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
 #line 2841
         
 #line 2841
-        *tp++ = (float)  (*xp++);  /* type cast from schar to float */
+        if (*xp < 0) {
+#line 2841
+            
+#line 2841
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2841
+            
+#line 2841
+        }
+#line 2841
+        *tp++ = (uchar) (signed) (*xp++);  /* type cast from schar to uchar */
 #line 2841
     }
 #line 2841
@@ -8223,7 +8111,7 @@ ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
 
 int
 #line 2842
-ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
+ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp)
 #line 2842
 {
 #line 2842
@@ -8237,7 +8125,7 @@ ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
 #line 2842
         
 #line 2842
-        *tp++ = (double)  (*xp++);  /* type cast from schar to double */
+        *tp++ = (short)  (*xp++);  /* type cast from schar to short */
 #line 2842
     }
 #line 2842
@@ -8252,7 +8140,7 @@ ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 2843
-ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp)
 #line 2843
 {
 #line 2843
@@ -8266,7 +8154,7 @@ ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 2843
         
 #line 2843
-        *tp++ = (longlong)  (*xp++);  /* type cast from schar to longlong */
+        *tp++ = (int)  (*xp++);  /* type cast from schar to int */
 #line 2843
     }
 #line 2843
@@ -8281,7 +8169,7 @@ ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 2844
-ncx_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
+ncx_getn_schar_long(const void **xpp, size_t nelems, long *tp)
 #line 2844
 {
 #line 2844
@@ -8295,17 +8183,7 @@ ncx_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 2844
         
 #line 2844
-        if (*xp < 0) {
-#line 2844
-            
-#line 2844
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2844
-            
-#line 2844
-        }
-#line 2844
-        *tp++ = (ushort) (signed) (*xp++);  /* type cast from schar to ushort */
+        *tp++ = (long)  (*xp++);  /* type cast from schar to long */
 #line 2844
     }
 #line 2844
@@ -8320,7 +8198,7 @@ ncx_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
 
 int
 #line 2845
-ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
 #line 2845
 {
 #line 2845
@@ -8334,17 +8212,7 @@ ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
 #line 2845
         
 #line 2845
-        if (*xp < 0) {
-#line 2845
-            
-#line 2845
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2845
-            
-#line 2845
-        }
-#line 2845
-        *tp++ = (uint) (signed) (*xp++);  /* type cast from schar to uint */
+        *tp++ = (float)  (*xp++);  /* type cast from schar to float */
 #line 2845
     }
 #line 2845
@@ -8359,7 +8227,7 @@ ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 2846
-ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
 #line 2846
 {
 #line 2846
@@ -8373,17 +8241,7 @@ ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 2846
         
 #line 2846
-        if (*xp < 0) {
-#line 2846
-            
-#line 2846
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2846
-            
-#line 2846
-        }
-#line 2846
-        *tp++ = (ulonglong) (signed) (*xp++);  /* type cast from schar to ulonglong */
+        *tp++ = (double)  (*xp++);  /* type cast from schar to double */
 #line 2846
     }
 #line 2846
@@ -8396,192 +8254,180 @@ ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 }
 #line 2846
 
-
-#line 2849
 int
-ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2847
+ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2847
 {
-		size_t rndup = nelems % X_ALIGN;
-#line 2852
-
-#line 2852
-	if (rndup)
-#line 2852
-		rndup = X_ALIGN - rndup;
-#line 2852
-
-#line 2852
-	(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 2852
-	*xpp = (void *)((char *)(*xpp) + nelems + rndup);
-#line 2852
+#line 2847
+    int status = NC_NOERR;
+#line 2847
+    schar *xp = (schar *)(*xpp);
+#line 2847
 
-#line 2852
-	return NC_NOERR;
-#line 2852
+#line 2847
+    while (nelems-- != 0) {
+#line 2847
+        
+#line 2847
+        *tp++ = (longlong)  (*xp++);  /* type cast from schar to longlong */
+#line 2847
+    }
+#line 2847
 
+#line 2847
+    *xpp = (const void *)xp;
+#line 2847
+    return status;
+#line 2847
 }
+#line 2847
+
 int
-#line 2854
-ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 2854
+#line 2848
+ncx_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2848
 {
-#line 2854
+#line 2848
     int status = NC_NOERR;
-#line 2854
-    size_t rndup = nelems % X_ALIGN;
-#line 2854
-    schar *xp = (schar *) *xpp;
-#line 2854
-
-#line 2854
-    if (rndup)
-#line 2854
-        rndup = X_ALIGN - rndup;
-#line 2854
+#line 2848
+    schar *xp = (schar *)(*xpp);
+#line 2848
 
-#line 2854
+#line 2848
     while (nelems-- != 0) {
-#line 2854
+#line 2848
         
-#line 2854
+#line 2848
         if (*xp < 0) {
-#line 2854
+#line 2848
             
-#line 2854
+#line 2848
             status = NC_ERANGE; /* because tp is unsigned */
-#line 2854
+#line 2848
             
-#line 2854
+#line 2848
         }
-#line 2854
-        *tp++ = (uchar) (signed) (*xp++);  /* type cast from schar to uchar */
-#line 2854
+#line 2848
+        *tp++ = (ushort) (signed) (*xp++);  /* type cast from schar to ushort */
+#line 2848
     }
-#line 2854
+#line 2848
 
-#line 2854
-    *xpp = (void *)(xp + rndup);
-#line 2854
+#line 2848
+    *xpp = (const void *)xp;
+#line 2848
     return status;
-#line 2854
+#line 2848
 }
-#line 2854
+#line 2848
 
 int
-#line 2855
-ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp)
-#line 2855
+#line 2849
+ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2849
 {
-#line 2855
+#line 2849
     int status = NC_NOERR;
-#line 2855
-    size_t rndup = nelems % X_ALIGN;
-#line 2855
-    schar *xp = (schar *) *xpp;
-#line 2855
-
-#line 2855
-    if (rndup)
-#line 2855
-        rndup = X_ALIGN - rndup;
-#line 2855
+#line 2849
+    schar *xp = (schar *)(*xpp);
+#line 2849
 
-#line 2855
+#line 2849
     while (nelems-- != 0) {
-#line 2855
+#line 2849
         
-#line 2855
-        *tp++ = (short)  (*xp++);  /* type cast from schar to short */
-#line 2855
+#line 2849
+        if (*xp < 0) {
+#line 2849
+            
+#line 2849
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2849
+            
+#line 2849
+        }
+#line 2849
+        *tp++ = (uint) (signed) (*xp++);  /* type cast from schar to uint */
+#line 2849
     }
-#line 2855
+#line 2849
 
-#line 2855
-    *xpp = (void *)(xp + rndup);
-#line 2855
+#line 2849
+    *xpp = (const void *)xp;
+#line 2849
     return status;
-#line 2855
+#line 2849
 }
-#line 2855
+#line 2849
 
 int
-#line 2856
-ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp)
-#line 2856
+#line 2850
+ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2850
 {
-#line 2856
+#line 2850
     int status = NC_NOERR;
-#line 2856
-    size_t rndup = nelems % X_ALIGN;
-#line 2856
-    schar *xp = (schar *) *xpp;
-#line 2856
-
-#line 2856
-    if (rndup)
-#line 2856
-        rndup = X_ALIGN - rndup;
-#line 2856
+#line 2850
+    schar *xp = (schar *)(*xpp);
+#line 2850
 
-#line 2856
+#line 2850
     while (nelems-- != 0) {
-#line 2856
+#line 2850
         
-#line 2856
-        *tp++ = (int)  (*xp++);  /* type cast from schar to int */
-#line 2856
+#line 2850
+        if (*xp < 0) {
+#line 2850
+            
+#line 2850
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2850
+            
+#line 2850
+        }
+#line 2850
+        *tp++ = (ulonglong) (signed) (*xp++);  /* type cast from schar to ulonglong */
+#line 2850
     }
-#line 2856
+#line 2850
 
-#line 2856
-    *xpp = (void *)(xp + rndup);
-#line 2856
+#line 2850
+    *xpp = (const void *)xp;
+#line 2850
     return status;
-#line 2856
+#line 2850
 }
-#line 2856
+#line 2850
+
 
+#line 2853
 int
-#line 2857
-ncx_pad_getn_schar_long(const void **xpp, size_t nelems, long *tp)
-#line 2857
+ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
 {
-#line 2857
-    int status = NC_NOERR;
-#line 2857
-    size_t rndup = nelems % X_ALIGN;
-#line 2857
-    schar *xp = (schar *) *xpp;
-#line 2857
+		size_t rndup = nelems % X_ALIGN;
+#line 2856
 
-#line 2857
-    if (rndup)
-#line 2857
-        rndup = X_ALIGN - rndup;
-#line 2857
+#line 2856
+	if (rndup)
+#line 2856
+		rndup = X_ALIGN - rndup;
+#line 2856
 
-#line 2857
-    while (nelems-- != 0) {
-#line 2857
-        
-#line 2857
-        *tp++ = (long)  (*xp++);  /* type cast from schar to long */
-#line 2857
-    }
-#line 2857
+#line 2856
+	(void) memcpy(tp, *xpp, (size_t)nelems);
+#line 2856
+	*xpp = (void *)((char *)(*xpp) + nelems + rndup);
+#line 2856
 
-#line 2857
-    *xpp = (void *)(xp + rndup);
-#line 2857
-    return status;
-#line 2857
-}
-#line 2857
+#line 2856
+	return NC_NOERR;
+#line 2856
 
+}
 int
 #line 2858
-ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
+ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 2858
 {
 #line 2858
@@ -8603,7 +8449,17 @@ ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
 #line 2858
         
 #line 2858
-        *tp++ = (float)  (*xp++);  /* type cast from schar to float */
+        if (*xp < 0) {
+#line 2858
+            
+#line 2858
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2858
+            
+#line 2858
+        }
+#line 2858
+        *tp++ = (uchar) (signed) (*xp++);  /* type cast from schar to uchar */
 #line 2858
     }
 #line 2858
@@ -8618,7 +8474,7 @@ ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
 
 int
 #line 2859
-ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
+ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp)
 #line 2859
 {
 #line 2859
@@ -8640,7 +8496,7 @@ ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
 #line 2859
         
 #line 2859
-        *tp++ = (double)  (*xp++);  /* type cast from schar to double */
+        *tp++ = (short)  (*xp++);  /* type cast from schar to short */
 #line 2859
     }
 #line 2859
@@ -8655,7 +8511,7 @@ ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 2860
-ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp)
 #line 2860
 {
 #line 2860
@@ -8677,7 +8533,7 @@ ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 2860
         
 #line 2860
-        *tp++ = (longlong)  (*xp++);  /* type cast from schar to longlong */
+        *tp++ = (int)  (*xp++);  /* type cast from schar to int */
 #line 2860
     }
 #line 2860
@@ -8692,7 +8548,7 @@ ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 2861
-ncx_pad_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
+ncx_pad_getn_schar_long(const void **xpp, size_t nelems, long *tp)
 #line 2861
 {
 #line 2861
@@ -8714,17 +8570,7 @@ ncx_pad_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 2861
         
 #line 2861
-        if (*xp < 0) {
-#line 2861
-            
-#line 2861
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2861
-            
-#line 2861
-        }
-#line 2861
-        *tp++ = (ushort) (signed) (*xp++);  /* type cast from schar to ushort */
+        *tp++ = (long)  (*xp++);  /* type cast from schar to long */
 #line 2861
     }
 #line 2861
@@ -8739,7 +8585,7 @@ ncx_pad_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
 
 int
 #line 2862
-ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
 #line 2862
 {
 #line 2862
@@ -8761,17 +8607,7 @@ ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
 #line 2862
         
 #line 2862
-        if (*xp < 0) {
-#line 2862
-            
-#line 2862
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2862
-            
-#line 2862
-        }
-#line 2862
-        *tp++ = (uint) (signed) (*xp++);  /* type cast from schar to uint */
+        *tp++ = (float)  (*xp++);  /* type cast from schar to float */
 #line 2862
     }
 #line 2862
@@ -8786,7 +8622,7 @@ ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 2863
-ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
 #line 2863
 {
 #line 2863
@@ -8808,17 +8644,7 @@ ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 2863
         
 #line 2863
-        if (*xp < 0) {
-#line 2863
-            
-#line 2863
-            status = NC_ERANGE; /* because tp is unsigned */
-#line 2863
-            
-#line 2863
-        }
-#line 2863
-        *tp++ = (ulonglong) (signed) (*xp++);  /* type cast from schar to ulonglong */
+        *tp++ = (double)  (*xp++);  /* type cast from schar to double */
 #line 2863
     }
 #line 2863
@@ -8831,172 +8657,202 @@ ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 }
 #line 2863
 
-
-#line 2866
-int
-ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-{
-		(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 2869
-	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 2869
-
-#line 2869
-	return NC_NOERR;
-#line 2869
-
-}
 int
-#line 2871
-ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 2871
+#line 2864
+ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2864
 {
-#line 2871
+#line 2864
     int status = NC_NOERR;
-#line 2871
+#line 2864
+    size_t rndup = nelems % X_ALIGN;
+#line 2864
     schar *xp = (schar *) *xpp;
-#line 2871
+#line 2864
+
+#line 2864
+    if (rndup)
+#line 2864
+        rndup = X_ALIGN - rndup;
+#line 2864
 
-#line 2871
+#line 2864
     while (nelems-- != 0) {
-#line 2871
-        if (*tp > (uchar)X_SCHAR_MAX ) {
-#line 2871
-            
-#line 2871
-            status = NC_ERANGE;
-#line 2871
-            
-#line 2871
-        }
-#line 2871
-        *xp++ = (schar)  *tp++; /* type cast from uchar to schar */
-#line 2871
+#line 2864
+        
+#line 2864
+        *tp++ = (longlong)  (*xp++);  /* type cast from schar to longlong */
+#line 2864
     }
-#line 2871
+#line 2864
 
-#line 2871
-    *xpp = (void *)xp;
-#line 2871
+#line 2864
+    *xpp = (void *)(xp + rndup);
+#line 2864
     return status;
-#line 2871
+#line 2864
 }
-#line 2871
+#line 2864
 
 int
-#line 2872
-ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 2872
+#line 2865
+ncx_pad_getn_schar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2865
 {
-#line 2872
+#line 2865
     int status = NC_NOERR;
-#line 2872
+#line 2865
+    size_t rndup = nelems % X_ALIGN;
+#line 2865
     schar *xp = (schar *) *xpp;
-#line 2872
+#line 2865
+
+#line 2865
+    if (rndup)
+#line 2865
+        rndup = X_ALIGN - rndup;
+#line 2865
 
-#line 2872
+#line 2865
     while (nelems-- != 0) {
-#line 2872
-        if (*tp > (short)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
-#line 2872
+#line 2865
+        
+#line 2865
+        if (*xp < 0) {
+#line 2865
             
-#line 2872
-            status = NC_ERANGE;
-#line 2872
+#line 2865
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2865
             
-#line 2872
+#line 2865
         }
-#line 2872
-        *xp++ = (schar)  *tp++; /* type cast from short to schar */
-#line 2872
+#line 2865
+        *tp++ = (ushort) (signed) (*xp++);  /* type cast from schar to ushort */
+#line 2865
     }
-#line 2872
+#line 2865
 
-#line 2872
-    *xpp = (void *)xp;
-#line 2872
+#line 2865
+    *xpp = (void *)(xp + rndup);
+#line 2865
     return status;
-#line 2872
+#line 2865
 }
-#line 2872
+#line 2865
 
 int
-#line 2873
-ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 2873
+#line 2866
+ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2866
 {
-#line 2873
+#line 2866
     int status = NC_NOERR;
-#line 2873
+#line 2866
+    size_t rndup = nelems % X_ALIGN;
+#line 2866
     schar *xp = (schar *) *xpp;
-#line 2873
+#line 2866
 
-#line 2873
+#line 2866
+    if (rndup)
+#line 2866
+        rndup = X_ALIGN - rndup;
+#line 2866
+
+#line 2866
     while (nelems-- != 0) {
-#line 2873
-        if (*tp > (int)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
-#line 2873
+#line 2866
+        
+#line 2866
+        if (*xp < 0) {
+#line 2866
             
-#line 2873
-            status = NC_ERANGE;
-#line 2873
+#line 2866
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2866
             
-#line 2873
+#line 2866
         }
-#line 2873
-        *xp++ = (schar)  *tp++; /* type cast from int to schar */
-#line 2873
+#line 2866
+        *tp++ = (uint) (signed) (*xp++);  /* type cast from schar to uint */
+#line 2866
     }
-#line 2873
+#line 2866
 
-#line 2873
-    *xpp = (void *)xp;
-#line 2873
+#line 2866
+    *xpp = (void *)(xp + rndup);
+#line 2866
     return status;
-#line 2873
+#line 2866
 }
-#line 2873
+#line 2866
 
 int
-#line 2874
-ncx_putn_schar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 2874
+#line 2867
+ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2867
 {
-#line 2874
+#line 2867
     int status = NC_NOERR;
-#line 2874
+#line 2867
+    size_t rndup = nelems % X_ALIGN;
+#line 2867
     schar *xp = (schar *) *xpp;
-#line 2874
+#line 2867
+
+#line 2867
+    if (rndup)
+#line 2867
+        rndup = X_ALIGN - rndup;
+#line 2867
 
-#line 2874
+#line 2867
     while (nelems-- != 0) {
-#line 2874
-        if (*tp > (long)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
-#line 2874
+#line 2867
+        
+#line 2867
+        if (*xp < 0) {
+#line 2867
             
-#line 2874
-            status = NC_ERANGE;
-#line 2874
+#line 2867
+            status = NC_ERANGE; /* because tp is unsigned */
+#line 2867
             
-#line 2874
+#line 2867
         }
-#line 2874
-        *xp++ = (schar)  *tp++; /* type cast from long to schar */
-#line 2874
+#line 2867
+        *tp++ = (ulonglong) (signed) (*xp++);  /* type cast from schar to ulonglong */
+#line 2867
     }
-#line 2874
+#line 2867
 
-#line 2874
-    *xpp = (void *)xp;
-#line 2874
+#line 2867
+    *xpp = (void *)(xp + rndup);
+#line 2867
     return status;
-#line 2874
+#line 2867
 }
-#line 2874
+#line 2867
+
+
+#line 2870
+int
+ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
+{
+		(void) memcpy(*xpp, tp, (size_t)nelems);
+#line 2873
+	*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2873
+
+#line 2873
+	return NC_NOERR;
+#line 2873
 
+}
 int
 #line 2875
-ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
+ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 2875
 {
 #line 2875
@@ -9008,7 +8864,7 @@ ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 2875
     while (nelems-- != 0) {
 #line 2875
-        if (*tp > (float)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+        if (*tp > (uchar)X_SCHAR_MAX ) {
 #line 2875
             
 #line 2875
@@ -9018,7 +8874,7 @@ ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 2875
         }
 #line 2875
-        *xp++ = (schar)  *tp++; /* type cast from float to schar */
+        *xp++ = (schar)  *tp++; /* type cast from uchar to schar */
 #line 2875
     }
 #line 2875
@@ -9033,7 +8889,7 @@ ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 
 int
 #line 2876
-ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 2876
 {
 #line 2876
@@ -9045,7 +8901,7 @@ ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 2876
     while (nelems-- != 0) {
 #line 2876
-        if (*tp > (double)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+        if (*tp > (short)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2876
             
 #line 2876
@@ -9055,7 +8911,7 @@ ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 2876
         }
 #line 2876
-        *xp++ = (schar)  *tp++; /* type cast from double to schar */
+        *xp++ = (schar)  *tp++; /* type cast from short to schar */
 #line 2876
     }
 #line 2876
@@ -9070,7 +8926,7 @@ ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 
 int
 #line 2877
-ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 2877
 {
 #line 2877
@@ -9082,7 +8938,7 @@ ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 #line 2877
     while (nelems-- != 0) {
 #line 2877
-        if (*tp > (longlong)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+        if (*tp > (int)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2877
             
 #line 2877
@@ -9092,7 +8948,7 @@ ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 #line 2877
         }
 #line 2877
-        *xp++ = (schar)  *tp++; /* type cast from longlong to schar */
+        *xp++ = (schar)  *tp++; /* type cast from int to schar */
 #line 2877
     }
 #line 2877
@@ -9107,7 +8963,7 @@ ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 
 int
 #line 2878
-ncx_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_putn_schar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 2878
 {
 #line 2878
@@ -9119,7 +8975,7 @@ ncx_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 2878
     while (nelems-- != 0) {
 #line 2878
-        if (*tp > (ushort)X_SCHAR_MAX ) {
+        if (*tp > (long)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2878
             
 #line 2878
@@ -9129,7 +8985,7 @@ ncx_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 2878
         }
 #line 2878
-        *xp++ = (schar)  *tp++; /* type cast from ushort to schar */
+        *xp++ = (schar)  *tp++; /* type cast from long to schar */
 #line 2878
     }
 #line 2878
@@ -9144,7 +9000,7 @@ ncx_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 
 int
 #line 2879
-ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 2879
 {
 #line 2879
@@ -9156,7 +9012,7 @@ ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 2879
     while (nelems-- != 0) {
 #line 2879
-        if (*tp > (uint)X_SCHAR_MAX ) {
+        if (*tp > (float)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2879
             
 #line 2879
@@ -9166,7 +9022,7 @@ ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 2879
         }
 #line 2879
-        *xp++ = (schar)  *tp++; /* type cast from uint to schar */
+        *xp++ = (schar)  *tp++; /* type cast from float to schar */
 #line 2879
     }
 #line 2879
@@ -9181,7 +9037,7 @@ ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 2880
-ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 2880
 {
 #line 2880
@@ -9193,7 +9049,7 @@ ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 #line 2880
     while (nelems-- != 0) {
 #line 2880
-        if (*tp > (ulonglong)X_SCHAR_MAX ) {
+        if (*tp > (double)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2880
             
 #line 2880
@@ -9203,7 +9059,7 @@ ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 #line 2880
         }
 #line 2880
-        *xp++ = (schar)  *tp++; /* type cast from ulonglong to schar */
+        *xp++ = (schar)  *tp++; /* type cast from double to schar */
 #line 2880
     }
 #line 2880
@@ -9216,266 +9072,194 @@ ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 }
 #line 2880
 
-
-#line 2883
-int
-ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-{
-		size_t rndup = nelems % X_ALIGN;
-#line 2886
-
-#line 2886
-	if (rndup)
-#line 2886
-		rndup = X_ALIGN - rndup;
-#line 2886
-
-#line 2886
-	(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 2886
-	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 2886
-
-#line 2886
-	if (rndup)
-#line 2886
-	{
-#line 2886
-		(void) memcpy(*xpp, nada, (size_t)rndup);
-#line 2886
-		*xpp = (void *)((char *)(*xpp) + rndup);
-#line 2886
-	}
-#line 2886
-
-#line 2886
-	return NC_NOERR;
-#line 2886
-
-}
 int
-#line 2888
-ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 2888
+#line 2881
+ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 2881
 {
-#line 2888
+#line 2881
     int status = NC_NOERR;
-#line 2888
-    size_t rndup = nelems % X_ALIGN;
-#line 2888
+#line 2881
     schar *xp = (schar *) *xpp;
-#line 2888
+#line 2881
 
-#line 2888
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 2888
-
-#line 2888
+#line 2881
     while (nelems-- != 0) {
-#line 2888
-        if (*tp > (uchar)X_SCHAR_MAX ) {
-#line 2888
+#line 2881
+        if (*tp > (longlong)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+#line 2881
             
-#line 2888
+#line 2881
             status = NC_ERANGE;
-#line 2888
+#line 2881
             
-#line 2888
+#line 2881
         }
-#line 2888
-        *xp++ = (schar)  *tp++; /* type cast from uchar to schar */
-#line 2888
-    }
-#line 2888
-
-#line 2888
-
-#line 2888
-    if (rndup) {
-#line 2888
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 2888
-        xp += rndup;
-#line 2888
+#line 2881
+        *xp++ = (schar)  *tp++; /* type cast from longlong to schar */
+#line 2881
     }
-#line 2888
+#line 2881
 
-#line 2888
+#line 2881
     *xpp = (void *)xp;
-#line 2888
+#line 2881
     return status;
-#line 2888
+#line 2881
 }
-#line 2888
+#line 2881
 
 int
-#line 2889
-ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 2889
+#line 2882
+ncx_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 2882
 {
-#line 2889
+#line 2882
     int status = NC_NOERR;
-#line 2889
-    size_t rndup = nelems % X_ALIGN;
-#line 2889
+#line 2882
     schar *xp = (schar *) *xpp;
-#line 2889
-
-#line 2889
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 2889
+#line 2882
 
-#line 2889
+#line 2882
     while (nelems-- != 0) {
-#line 2889
-        if (*tp > (short)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
-#line 2889
+#line 2882
+        if (*tp > (ushort)X_SCHAR_MAX ) {
+#line 2882
             
-#line 2889
+#line 2882
             status = NC_ERANGE;
-#line 2889
+#line 2882
             
-#line 2889
+#line 2882
         }
-#line 2889
-        *xp++ = (schar)  *tp++; /* type cast from short to schar */
-#line 2889
-    }
-#line 2889
-
-#line 2889
-
-#line 2889
-    if (rndup) {
-#line 2889
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 2889
-        xp += rndup;
-#line 2889
+#line 2882
+        *xp++ = (schar)  *tp++; /* type cast from ushort to schar */
+#line 2882
     }
-#line 2889
+#line 2882
 
-#line 2889
+#line 2882
     *xpp = (void *)xp;
-#line 2889
+#line 2882
     return status;
-#line 2889
+#line 2882
 }
-#line 2889
+#line 2882
 
 int
-#line 2890
-ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 2890
+#line 2883
+ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 2883
 {
-#line 2890
+#line 2883
     int status = NC_NOERR;
-#line 2890
-    size_t rndup = nelems % X_ALIGN;
-#line 2890
+#line 2883
     schar *xp = (schar *) *xpp;
-#line 2890
-
-#line 2890
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 2890
+#line 2883
 
-#line 2890
+#line 2883
     while (nelems-- != 0) {
-#line 2890
-        if (*tp > (int)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
-#line 2890
+#line 2883
+        if (*tp > (uint)X_SCHAR_MAX ) {
+#line 2883
             
-#line 2890
+#line 2883
             status = NC_ERANGE;
-#line 2890
+#line 2883
             
-#line 2890
+#line 2883
         }
-#line 2890
-        *xp++ = (schar)  *tp++; /* type cast from int to schar */
-#line 2890
-    }
-#line 2890
-
-#line 2890
-
-#line 2890
-    if (rndup) {
-#line 2890
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 2890
-        xp += rndup;
-#line 2890
+#line 2883
+        *xp++ = (schar)  *tp++; /* type cast from uint to schar */
+#line 2883
     }
-#line 2890
+#line 2883
 
-#line 2890
+#line 2883
     *xpp = (void *)xp;
-#line 2890
+#line 2883
     return status;
-#line 2890
+#line 2883
 }
-#line 2890
+#line 2883
 
 int
-#line 2891
-ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 2891
+#line 2884
+ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+#line 2884
 {
-#line 2891
+#line 2884
     int status = NC_NOERR;
-#line 2891
-    size_t rndup = nelems % X_ALIGN;
-#line 2891
+#line 2884
     schar *xp = (schar *) *xpp;
-#line 2891
-
-#line 2891
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 2891
+#line 2884
 
-#line 2891
+#line 2884
     while (nelems-- != 0) {
-#line 2891
-        if (*tp > (long)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
-#line 2891
+#line 2884
+        if (*tp > (ulonglong)X_SCHAR_MAX ) {
+#line 2884
             
-#line 2891
+#line 2884
             status = NC_ERANGE;
-#line 2891
+#line 2884
             
-#line 2891
+#line 2884
         }
-#line 2891
-        *xp++ = (schar)  *tp++; /* type cast from long to schar */
-#line 2891
-    }
-#line 2891
-
-#line 2891
-
-#line 2891
-    if (rndup) {
-#line 2891
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 2891
-        xp += rndup;
-#line 2891
+#line 2884
+        *xp++ = (schar)  *tp++; /* type cast from ulonglong to schar */
+#line 2884
     }
-#line 2891
+#line 2884
 
-#line 2891
+#line 2884
     *xpp = (void *)xp;
-#line 2891
+#line 2884
     return status;
-#line 2891
+#line 2884
 }
-#line 2891
+#line 2884
+
+
+#line 2887
+int
+ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
+{
+		size_t rndup = nelems % X_ALIGN;
+#line 2890
+
+#line 2890
+	if (rndup)
+#line 2890
+		rndup = X_ALIGN - rndup;
+#line 2890
+
+#line 2890
+	(void) memcpy(*xpp, tp, (size_t)nelems);
+#line 2890
+	*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2890
+
+#line 2890
+	if (rndup)
+#line 2890
+	{
+#line 2890
+		(void) memcpy(*xpp, nada, (size_t)rndup);
+#line 2890
+		*xpp = (void *)((char *)(*xpp) + rndup);
+#line 2890
+	}
+#line 2890
+
+#line 2890
+	return NC_NOERR;
+#line 2890
 
+}
 int
 #line 2892
-ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
+ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 2892
 {
 #line 2892
@@ -9493,7 +9277,7 @@ ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp
 #line 2892
     while (nelems-- != 0) {
 #line 2892
-        if (*tp > (float)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+        if (*tp > (uchar)X_SCHAR_MAX ) {
 #line 2892
             
 #line 2892
@@ -9503,7 +9287,7 @@ ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp
 #line 2892
         }
 #line 2892
-        *xp++ = (schar)  *tp++; /* type cast from float to schar */
+        *xp++ = (schar)  *tp++; /* type cast from uchar to schar */
 #line 2892
     }
 #line 2892
@@ -9530,7 +9314,7 @@ ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp
 
 int
 #line 2893
-ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 2893
 {
 #line 2893
@@ -9548,7 +9332,7 @@ ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fil
 #line 2893
     while (nelems-- != 0) {
 #line 2893
-        if (*tp > (double)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+        if (*tp > (short)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2893
             
 #line 2893
@@ -9558,7 +9342,7 @@ ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fil
 #line 2893
         }
 #line 2893
-        *xp++ = (schar)  *tp++; /* type cast from double to schar */
+        *xp++ = (schar)  *tp++; /* type cast from short to schar */
 #line 2893
     }
 #line 2893
@@ -9585,7 +9369,7 @@ ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fil
 
 int
 #line 2894
-ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 2894
 {
 #line 2894
@@ -9603,7 +9387,7 @@ ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void
 #line 2894
     while (nelems-- != 0) {
 #line 2894
-        if (*tp > (longlong)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+        if (*tp > (int)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2894
             
 #line 2894
@@ -9613,7 +9397,7 @@ ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void
 #line 2894
         }
 #line 2894
-        *xp++ = (schar)  *tp++; /* type cast from longlong to schar */
+        *xp++ = (schar)  *tp++; /* type cast from int to schar */
 #line 2894
     }
 #line 2894
@@ -9640,7 +9424,7 @@ ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void
 
 int
 #line 2895
-ncx_pad_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 2895
 {
 #line 2895
@@ -9658,7 +9442,7 @@ ncx_pad_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 #line 2895
     while (nelems-- != 0) {
 #line 2895
-        if (*tp > (ushort)X_SCHAR_MAX ) {
+        if (*tp > (long)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2895
             
 #line 2895
@@ -9668,7 +9452,7 @@ ncx_pad_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 #line 2895
         }
 #line 2895
-        *xp++ = (schar)  *tp++; /* type cast from ushort to schar */
+        *xp++ = (schar)  *tp++; /* type cast from long to schar */
 #line 2895
     }
 #line 2895
@@ -9695,7 +9479,7 @@ ncx_pad_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 
 int
 #line 2896
-ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 2896
 {
 #line 2896
@@ -9713,7 +9497,7 @@ ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 2896
     while (nelems-- != 0) {
 #line 2896
-        if (*tp > (uint)X_SCHAR_MAX ) {
+        if (*tp > (float)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2896
             
 #line 2896
@@ -9723,7 +9507,7 @@ ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 2896
         }
 #line 2896
-        *xp++ = (schar)  *tp++; /* type cast from uint to schar */
+        *xp++ = (schar)  *tp++; /* type cast from float to schar */
 #line 2896
     }
 #line 2896
@@ -9750,7 +9534,7 @@ ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 2897
-ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 2897
 {
 #line 2897
@@ -9768,7 +9552,7 @@ ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 #line 2897
     while (nelems-- != 0) {
 #line 2897
-        if (*tp > (ulonglong)X_SCHAR_MAX ) {
+        if (*tp > (double)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
 #line 2897
             
 #line 2897
@@ -9778,7 +9562,7 @@ ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 #line 2897
         }
 #line 2897
-        *xp++ = (schar)  *tp++; /* type cast from ulonglong to schar */
+        *xp++ = (schar)  *tp++; /* type cast from double to schar */
 #line 2897
     }
 #line 2897
@@ -9803,159 +9587,263 @@ ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 }
 #line 2897
 
-
-
-/* uchar ---------------------------------------------------------------------*/
-#line 2903
 int
-ncx_getn_uchar_schar(const void **xpp, size_t nelems, schar *tp)
+#line 2898
+ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 2898
 {
+#line 2898
     int status = NC_NOERR;
-    uchar *xp = (uchar *)(*xpp);
+#line 2898
+    size_t rndup = nelems % X_ALIGN;
+#line 2898
+    schar *xp = (schar *) *xpp;
+#line 2898
+
+#line 2898
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 2898
 
+#line 2898
     while (nelems-- != 0) {
-        if (*xp > SCHAR_MAX) {
-            *tp = NC_FILL_BYTE;
-       	    status = NC_ERANGE;
+#line 2898
+        if (*tp > (longlong)X_SCHAR_MAX || *tp < X_SCHAR_MIN) {
+#line 2898
             
+#line 2898
+            status = NC_ERANGE;
+#line 2898
+            
+#line 2898
         }
-	*tp++ = (schar) *xp++; /* type cast from uchar to schar */
+#line 2898
+        *xp++ = (schar)  *tp++; /* type cast from longlong to schar */
+#line 2898
     }
+#line 2898
 
-    *xpp = (const void *)xp;
+#line 2898
+
+#line 2898
+    if (rndup) {
+#line 2898
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 2898
+        xp += rndup;
+#line 2898
+    }
+#line 2898
+
+#line 2898
+    *xpp = (void *)xp;
+#line 2898
     return status;
+#line 2898
 }
-#line 2922
-int
-ncx_getn_uchar_uchar(const void **xpp, size_t nelems, uchar *tp)
-{
-		(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 2925
-	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 2925
-	return NC_NOERR;
-#line 2925
+#line 2898
 
-}
 int
-#line 2927
-ncx_getn_uchar_short(const void **xpp, size_t nelems, short *tp)
-#line 2927
+#line 2899
+ncx_pad_putn_schar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 2899
 {
-#line 2927
+#line 2899
     int status = NC_NOERR;
-#line 2927
-    uchar *xp = (uchar *)(*xpp);
-#line 2927
+#line 2899
+    size_t rndup = nelems % X_ALIGN;
+#line 2899
+    schar *xp = (schar *) *xpp;
+#line 2899
 
-#line 2927
+#line 2899
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 2899
+
+#line 2899
     while (nelems-- != 0) {
-#line 2927
-        
-#line 2927
-        *tp++ = (short)  (*xp++);  /* type cast from uchar to short */
-#line 2927
+#line 2899
+        if (*tp > (ushort)X_SCHAR_MAX ) {
+#line 2899
+            
+#line 2899
+            status = NC_ERANGE;
+#line 2899
+            
+#line 2899
+        }
+#line 2899
+        *xp++ = (schar)  *tp++; /* type cast from ushort to schar */
+#line 2899
     }
-#line 2927
+#line 2899
 
-#line 2927
-    *xpp = (const void *)xp;
-#line 2927
+#line 2899
+
+#line 2899
+    if (rndup) {
+#line 2899
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 2899
+        xp += rndup;
+#line 2899
+    }
+#line 2899
+
+#line 2899
+    *xpp = (void *)xp;
+#line 2899
     return status;
-#line 2927
+#line 2899
 }
-#line 2927
+#line 2899
 
 int
-#line 2928
-ncx_getn_uchar_int(const void **xpp, size_t nelems, int *tp)
-#line 2928
+#line 2900
+ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 2900
 {
-#line 2928
+#line 2900
     int status = NC_NOERR;
-#line 2928
-    uchar *xp = (uchar *)(*xpp);
-#line 2928
+#line 2900
+    size_t rndup = nelems % X_ALIGN;
+#line 2900
+    schar *xp = (schar *) *xpp;
+#line 2900
+
+#line 2900
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 2900
 
-#line 2928
+#line 2900
     while (nelems-- != 0) {
-#line 2928
-        
-#line 2928
-        *tp++ = (int)  (*xp++);  /* type cast from uchar to int */
-#line 2928
+#line 2900
+        if (*tp > (uint)X_SCHAR_MAX ) {
+#line 2900
+            
+#line 2900
+            status = NC_ERANGE;
+#line 2900
+            
+#line 2900
+        }
+#line 2900
+        *xp++ = (schar)  *tp++; /* type cast from uint to schar */
+#line 2900
     }
-#line 2928
+#line 2900
 
-#line 2928
-    *xpp = (const void *)xp;
-#line 2928
+#line 2900
+
+#line 2900
+    if (rndup) {
+#line 2900
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 2900
+        xp += rndup;
+#line 2900
+    }
+#line 2900
+
+#line 2900
+    *xpp = (void *)xp;
+#line 2900
     return status;
-#line 2928
+#line 2900
 }
-#line 2928
+#line 2900
 
 int
-#line 2929
-ncx_getn_uchar_long(const void **xpp, size_t nelems, long *tp)
-#line 2929
+#line 2901
+ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+#line 2901
 {
-#line 2929
+#line 2901
     int status = NC_NOERR;
-#line 2929
-    uchar *xp = (uchar *)(*xpp);
-#line 2929
+#line 2901
+    size_t rndup = nelems % X_ALIGN;
+#line 2901
+    schar *xp = (schar *) *xpp;
+#line 2901
 
-#line 2929
+#line 2901
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 2901
+
+#line 2901
     while (nelems-- != 0) {
-#line 2929
-        
-#line 2929
-        *tp++ = (long)  (*xp++);  /* type cast from uchar to long */
-#line 2929
+#line 2901
+        if (*tp > (ulonglong)X_SCHAR_MAX ) {
+#line 2901
+            
+#line 2901
+            status = NC_ERANGE;
+#line 2901
+            
+#line 2901
+        }
+#line 2901
+        *xp++ = (schar)  *tp++; /* type cast from ulonglong to schar */
+#line 2901
     }
-#line 2929
+#line 2901
 
-#line 2929
-    *xpp = (const void *)xp;
-#line 2929
+#line 2901
+
+#line 2901
+    if (rndup) {
+#line 2901
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 2901
+        xp += rndup;
+#line 2901
+    }
+#line 2901
+
+#line 2901
+    *xpp = (void *)xp;
+#line 2901
     return status;
-#line 2929
+#line 2901
 }
-#line 2929
+#line 2901
+
+
 
+/* uchar ---------------------------------------------------------------------*/
+#line 2907
 int
-#line 2930
-ncx_getn_uchar_float(const void **xpp, size_t nelems, float *tp)
-#line 2930
+ncx_getn_uchar_schar(const void **xpp, size_t nelems, schar *tp)
 {
-#line 2930
     int status = NC_NOERR;
-#line 2930
     uchar *xp = (uchar *)(*xpp);
-#line 2930
 
-#line 2930
     while (nelems-- != 0) {
-#line 2930
-        
-#line 2930
-        *tp++ = (float)  (*xp++);  /* type cast from uchar to float */
-#line 2930
+        if (*xp > SCHAR_MAX) {
+            *tp = NC_FILL_BYTE;
+       	    status = NC_ERANGE;
+            
+        }
+	*tp++ = (schar) *xp++; /* type cast from uchar to schar */
     }
-#line 2930
 
-#line 2930
     *xpp = (const void *)xp;
-#line 2930
     return status;
-#line 2930
 }
-#line 2930
+#line 2926
+int
+ncx_getn_uchar_uchar(const void **xpp, size_t nelems, uchar *tp)
+{
+		(void) memcpy(tp, *xpp, (size_t)nelems);
+#line 2929
+	*xpp = (void *)((char *)(*xpp) + nelems);
+#line 2929
+	return NC_NOERR;
+#line 2929
 
+}
 int
 #line 2931
-ncx_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
+ncx_getn_uchar_short(const void **xpp, size_t nelems, short *tp)
 #line 2931
 {
 #line 2931
@@ -9969,7 +9857,7 @@ ncx_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
 #line 2931
         
 #line 2931
-        *tp++ = (double)  (*xp++);  /* type cast from uchar to double */
+        *tp++ = (short)  (*xp++);  /* type cast from uchar to short */
 #line 2931
     }
 #line 2931
@@ -9984,7 +9872,7 @@ ncx_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 2932
-ncx_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_getn_uchar_int(const void **xpp, size_t nelems, int *tp)
 #line 2932
 {
 #line 2932
@@ -9998,7 +9886,7 @@ ncx_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 2932
         
 #line 2932
-        *tp++ = (longlong)  (*xp++);  /* type cast from uchar to longlong */
+        *tp++ = (int)  (*xp++);  /* type cast from uchar to int */
 #line 2932
     }
 #line 2932
@@ -10013,7 +9901,7 @@ ncx_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 2933
-ncx_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
+ncx_getn_uchar_long(const void **xpp, size_t nelems, long *tp)
 #line 2933
 {
 #line 2933
@@ -10027,7 +9915,7 @@ ncx_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 2933
         
 #line 2933
-        *tp++ = (ushort)  (*xp++);  /* type cast from uchar to ushort */
+        *tp++ = (long)  (*xp++);  /* type cast from uchar to long */
 #line 2933
     }
 #line 2933
@@ -10042,7 +9930,7 @@ ncx_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
 
 int
 #line 2934
-ncx_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_getn_uchar_float(const void **xpp, size_t nelems, float *tp)
 #line 2934
 {
 #line 2934
@@ -10056,7 +9944,7 @@ ncx_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
 #line 2934
         
 #line 2934
-        *tp++ = (uint)  (*xp++);  /* type cast from uchar to uint */
+        *tp++ = (float)  (*xp++);  /* type cast from uchar to float */
 #line 2934
     }
 #line 2934
@@ -10071,7 +9959,7 @@ ncx_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 2935
-ncx_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
 #line 2935
 {
 #line 2935
@@ -10085,7 +9973,7 @@ ncx_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 2935
         
 #line 2935
-        *tp++ = (ulonglong)  (*xp++);  /* type cast from uchar to ulonglong */
+        *tp++ = (double)  (*xp++);  /* type cast from uchar to double */
 #line 2935
     }
 #line 2935
@@ -10098,8 +9986,124 @@ ncx_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 }
 #line 2935
 
+int
+#line 2936
+ncx_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2936
+{
+#line 2936
+    int status = NC_NOERR;
+#line 2936
+    uchar *xp = (uchar *)(*xpp);
+#line 2936
+
+#line 2936
+    while (nelems-- != 0) {
+#line 2936
+        
+#line 2936
+        *tp++ = (longlong)  (*xp++);  /* type cast from uchar to longlong */
+#line 2936
+    }
+#line 2936
+
+#line 2936
+    *xpp = (const void *)xp;
+#line 2936
+    return status;
+#line 2936
+}
+#line 2936
+
+int
+#line 2937
+ncx_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2937
+{
+#line 2937
+    int status = NC_NOERR;
+#line 2937
+    uchar *xp = (uchar *)(*xpp);
+#line 2937
+
+#line 2937
+    while (nelems-- != 0) {
+#line 2937
+        
+#line 2937
+        *tp++ = (ushort)  (*xp++);  /* type cast from uchar to ushort */
+#line 2937
+    }
+#line 2937
+
+#line 2937
+    *xpp = (const void *)xp;
+#line 2937
+    return status;
+#line 2937
+}
+#line 2937
+
+int
+#line 2938
+ncx_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2938
+{
+#line 2938
+    int status = NC_NOERR;
+#line 2938
+    uchar *xp = (uchar *)(*xpp);
+#line 2938
+
+#line 2938
+    while (nelems-- != 0) {
+#line 2938
+        
+#line 2938
+        *tp++ = (uint)  (*xp++);  /* type cast from uchar to uint */
+#line 2938
+    }
+#line 2938
 
 #line 2938
+    *xpp = (const void *)xp;
+#line 2938
+    return status;
+#line 2938
+}
+#line 2938
+
+int
+#line 2939
+ncx_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2939
+{
+#line 2939
+    int status = NC_NOERR;
+#line 2939
+    uchar *xp = (uchar *)(*xpp);
+#line 2939
+
+#line 2939
+    while (nelems-- != 0) {
+#line 2939
+        
+#line 2939
+        *tp++ = (ulonglong)  (*xp++);  /* type cast from uchar to ulonglong */
+#line 2939
+    }
+#line 2939
+
+#line 2939
+    *xpp = (const void *)xp;
+#line 2939
+    return status;
+#line 2939
+}
+#line 2939
+
+
+#line 2942
 int
 ncx_pad_getn_uchar_schar(const void **xpp, size_t nelems, schar *tp)
 {
@@ -10121,204 +10125,56 @@ ncx_pad_getn_uchar_schar(const void **xpp, size_t nelems, schar *tp)
     *xpp = (void *)(xp + rndup);
     return status;
 }
-#line 2960
+#line 2964
 int
 ncx_pad_getn_uchar_uchar(const void **xpp, size_t nelems, uchar *tp)
 {
 		size_t rndup = nelems % X_ALIGN;
-#line 2963
+#line 2967
 
-#line 2963
+#line 2967
 	if (rndup)
-#line 2963
+#line 2967
 		rndup = X_ALIGN - rndup;
-#line 2963
+#line 2967
 
-#line 2963
+#line 2967
 	(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 2963
+#line 2967
 	*xpp = (void *)((char *)(*xpp) + nelems + rndup);
-#line 2963
+#line 2967
 
-#line 2963
+#line 2967
 	return NC_NOERR;
-#line 2963
+#line 2967
 
 }
 int
-#line 2965
+#line 2969
 ncx_pad_getn_uchar_short(const void **xpp, size_t nelems, short *tp)
-#line 2965
+#line 2969
 {
-#line 2965
+#line 2969
     int status = NC_NOERR;
-#line 2965
+#line 2969
     size_t rndup = nelems % X_ALIGN;
-#line 2965
+#line 2969
     uchar *xp = (uchar *) *xpp;
-#line 2965
+#line 2969
 
-#line 2965
+#line 2969
     if (rndup)
-#line 2965
+#line 2969
         rndup = X_ALIGN - rndup;
-#line 2965
+#line 2969
 
-#line 2965
+#line 2969
     while (nelems-- != 0) {
-#line 2965
+#line 2969
         
-#line 2965
+#line 2969
         *tp++ = (short)  (*xp++);  /* type cast from uchar to short */
-#line 2965
-    }
-#line 2965
-
-#line 2965
-    *xpp = (void *)(xp + rndup);
-#line 2965
-    return status;
-#line 2965
-}
-#line 2965
-
-int
-#line 2966
-ncx_pad_getn_uchar_int(const void **xpp, size_t nelems, int *tp)
-#line 2966
-{
-#line 2966
-    int status = NC_NOERR;
-#line 2966
-    size_t rndup = nelems % X_ALIGN;
-#line 2966
-    uchar *xp = (uchar *) *xpp;
-#line 2966
-
-#line 2966
-    if (rndup)
-#line 2966
-        rndup = X_ALIGN - rndup;
-#line 2966
-
-#line 2966
-    while (nelems-- != 0) {
-#line 2966
-        
-#line 2966
-        *tp++ = (int)  (*xp++);  /* type cast from uchar to int */
-#line 2966
-    }
-#line 2966
-
-#line 2966
-    *xpp = (void *)(xp + rndup);
-#line 2966
-    return status;
-#line 2966
-}
-#line 2966
-
-int
-#line 2967
-ncx_pad_getn_uchar_long(const void **xpp, size_t nelems, long *tp)
-#line 2967
-{
-#line 2967
-    int status = NC_NOERR;
-#line 2967
-    size_t rndup = nelems % X_ALIGN;
-#line 2967
-    uchar *xp = (uchar *) *xpp;
-#line 2967
-
-#line 2967
-    if (rndup)
-#line 2967
-        rndup = X_ALIGN - rndup;
-#line 2967
-
-#line 2967
-    while (nelems-- != 0) {
-#line 2967
-        
-#line 2967
-        *tp++ = (long)  (*xp++);  /* type cast from uchar to long */
-#line 2967
-    }
-#line 2967
-
-#line 2967
-    *xpp = (void *)(xp + rndup);
-#line 2967
-    return status;
-#line 2967
-}
-#line 2967
-
-int
-#line 2968
-ncx_pad_getn_uchar_float(const void **xpp, size_t nelems, float *tp)
-#line 2968
-{
-#line 2968
-    int status = NC_NOERR;
-#line 2968
-    size_t rndup = nelems % X_ALIGN;
-#line 2968
-    uchar *xp = (uchar *) *xpp;
-#line 2968
-
-#line 2968
-    if (rndup)
-#line 2968
-        rndup = X_ALIGN - rndup;
-#line 2968
-
-#line 2968
-    while (nelems-- != 0) {
-#line 2968
-        
-#line 2968
-        *tp++ = (float)  (*xp++);  /* type cast from uchar to float */
-#line 2968
-    }
-#line 2968
-
-#line 2968
-    *xpp = (void *)(xp + rndup);
-#line 2968
-    return status;
-#line 2968
-}
-#line 2968
-
-int
-#line 2969
-ncx_pad_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
-#line 2969
-{
-#line 2969
-    int status = NC_NOERR;
-#line 2969
-    size_t rndup = nelems % X_ALIGN;
-#line 2969
-    uchar *xp = (uchar *) *xpp;
-#line 2969
-
-#line 2969
-    if (rndup)
-#line 2969
-        rndup = X_ALIGN - rndup;
-#line 2969
-
-#line 2969
-    while (nelems-- != 0) {
-#line 2969
-        
-#line 2969
-        *tp++ = (double)  (*xp++);  /* type cast from uchar to double */
-#line 2969
+#line 2969
     }
 #line 2969
 
@@ -10332,7 +10188,7 @@ ncx_pad_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 2970
-ncx_pad_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_pad_getn_uchar_int(const void **xpp, size_t nelems, int *tp)
 #line 2970
 {
 #line 2970
@@ -10354,7 +10210,7 @@ ncx_pad_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 2970
         
 #line 2970
-        *tp++ = (longlong)  (*xp++);  /* type cast from uchar to longlong */
+        *tp++ = (int)  (*xp++);  /* type cast from uchar to int */
 #line 2970
     }
 #line 2970
@@ -10369,7 +10225,7 @@ ncx_pad_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 2971
-ncx_pad_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
+ncx_pad_getn_uchar_long(const void **xpp, size_t nelems, long *tp)
 #line 2971
 {
 #line 2971
@@ -10391,7 +10247,7 @@ ncx_pad_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 2971
         
 #line 2971
-        *tp++ = (ushort)  (*xp++);  /* type cast from uchar to ushort */
+        *tp++ = (long)  (*xp++);  /* type cast from uchar to long */
 #line 2971
     }
 #line 2971
@@ -10406,7 +10262,7 @@ ncx_pad_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
 
 int
 #line 2972
-ncx_pad_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_pad_getn_uchar_float(const void **xpp, size_t nelems, float *tp)
 #line 2972
 {
 #line 2972
@@ -10428,7 +10284,7 @@ ncx_pad_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
 #line 2972
         
 #line 2972
-        *tp++ = (uint)  (*xp++);  /* type cast from uchar to uint */
+        *tp++ = (float)  (*xp++);  /* type cast from uchar to float */
 #line 2972
     }
 #line 2972
@@ -10443,7 +10299,7 @@ ncx_pad_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 2973
-ncx_pad_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_pad_getn_uchar_double(const void **xpp, size_t nelems, double *tp)
 #line 2973
 {
 #line 2973
@@ -10465,7 +10321,7 @@ ncx_pad_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 2973
         
 #line 2973
-        *tp++ = (ulonglong)  (*xp++);  /* type cast from uchar to ulonglong */
+        *tp++ = (double)  (*xp++);  /* type cast from uchar to double */
 #line 2973
     }
 #line 2973
@@ -10478,191 +10334,191 @@ ncx_pad_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 }
 #line 2973
 
-
-#line 2976
 int
-ncx_putn_uchar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
+#line 2974
+ncx_pad_getn_uchar_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 2974
 {
+#line 2974
     int status = NC_NOERR;
+#line 2974
+    size_t rndup = nelems % X_ALIGN;
+#line 2974
     uchar *xp = (uchar *) *xpp;
+#line 2974
 
+#line 2974
+    if (rndup)
+#line 2974
+        rndup = X_ALIGN - rndup;
+#line 2974
+
+#line 2974
     while (nelems-- != 0) {
-        if (*tp < 0) {
-            
-            status = NC_ERANGE;
-            
-        }
-        *xp++ = (uchar) (signed) *tp++; /* type cast from schar to uchar */
+#line 2974
+        
+#line 2974
+        *tp++ = (longlong)  (*xp++);  /* type cast from uchar to longlong */
+#line 2974
     }
+#line 2974
 
-    *xpp = (void *)xp;
+#line 2974
+    *xpp = (void *)(xp + rndup);
+#line 2974
     return status;
+#line 2974
 }
-#line 2995
-int
-ncx_putn_uchar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-{
-		(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 2998
-	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 2998
-
-#line 2998
-	return NC_NOERR;
-#line 2998
+#line 2974
 
-}
 int
-#line 3000
-ncx_putn_uchar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3000
+#line 2975
+ncx_pad_getn_uchar_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 2975
 {
-#line 3000
+#line 2975
     int status = NC_NOERR;
-#line 3000
+#line 2975
+    size_t rndup = nelems % X_ALIGN;
+#line 2975
     uchar *xp = (uchar *) *xpp;
-#line 3000
+#line 2975
 
-#line 3000
+#line 2975
+    if (rndup)
+#line 2975
+        rndup = X_ALIGN - rndup;
+#line 2975
+
+#line 2975
     while (nelems-- != 0) {
-#line 3000
-        if (*tp > (short)X_UCHAR_MAX || *tp < 0) {
-#line 3000
-            
-#line 3000
-            status = NC_ERANGE;
-#line 3000
-            
-#line 3000
-        }
-#line 3000
-        *xp++ = (uchar) (signed) *tp++; /* type cast from short to uchar */
-#line 3000
+#line 2975
+        
+#line 2975
+        *tp++ = (ushort)  (*xp++);  /* type cast from uchar to ushort */
+#line 2975
     }
-#line 3000
+#line 2975
 
-#line 3000
-    *xpp = (void *)xp;
-#line 3000
+#line 2975
+    *xpp = (void *)(xp + rndup);
+#line 2975
     return status;
-#line 3000
+#line 2975
 }
-#line 3000
+#line 2975
 
 int
-#line 3001
-ncx_putn_uchar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3001
+#line 2976
+ncx_pad_getn_uchar_uint(const void **xpp, size_t nelems, uint *tp)
+#line 2976
 {
-#line 3001
+#line 2976
     int status = NC_NOERR;
-#line 3001
+#line 2976
+    size_t rndup = nelems % X_ALIGN;
+#line 2976
     uchar *xp = (uchar *) *xpp;
-#line 3001
+#line 2976
+
+#line 2976
+    if (rndup)
+#line 2976
+        rndup = X_ALIGN - rndup;
+#line 2976
 
-#line 3001
+#line 2976
     while (nelems-- != 0) {
-#line 3001
-        if (*tp > (int)X_UCHAR_MAX || *tp < 0) {
-#line 3001
-            
-#line 3001
-            status = NC_ERANGE;
-#line 3001
-            
-#line 3001
-        }
-#line 3001
-        *xp++ = (uchar) (signed) *tp++; /* type cast from int to uchar */
-#line 3001
+#line 2976
+        
+#line 2976
+        *tp++ = (uint)  (*xp++);  /* type cast from uchar to uint */
+#line 2976
     }
-#line 3001
+#line 2976
 
-#line 3001
-    *xpp = (void *)xp;
-#line 3001
+#line 2976
+    *xpp = (void *)(xp + rndup);
+#line 2976
     return status;
-#line 3001
+#line 2976
 }
-#line 3001
+#line 2976
 
 int
-#line 3002
-ncx_putn_uchar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3002
+#line 2977
+ncx_pad_getn_uchar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 2977
 {
-#line 3002
+#line 2977
     int status = NC_NOERR;
-#line 3002
+#line 2977
+    size_t rndup = nelems % X_ALIGN;
+#line 2977
     uchar *xp = (uchar *) *xpp;
-#line 3002
+#line 2977
 
-#line 3002
+#line 2977
+    if (rndup)
+#line 2977
+        rndup = X_ALIGN - rndup;
+#line 2977
+
+#line 2977
     while (nelems-- != 0) {
-#line 3002
-        if (*tp > (long)X_UCHAR_MAX || *tp < 0) {
-#line 3002
-            
-#line 3002
-            status = NC_ERANGE;
-#line 3002
-            
-#line 3002
-        }
-#line 3002
-        *xp++ = (uchar) (signed) *tp++; /* type cast from long to uchar */
-#line 3002
+#line 2977
+        
+#line 2977
+        *tp++ = (ulonglong)  (*xp++);  /* type cast from uchar to ulonglong */
+#line 2977
     }
-#line 3002
+#line 2977
 
-#line 3002
-    *xpp = (void *)xp;
-#line 3002
+#line 2977
+    *xpp = (void *)(xp + rndup);
+#line 2977
     return status;
-#line 3002
+#line 2977
 }
-#line 3002
+#line 2977
+
 
+#line 2980
 int
-#line 3003
-ncx_putn_uchar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3003
+ncx_putn_uchar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
 {
-#line 3003
     int status = NC_NOERR;
-#line 3003
     uchar *xp = (uchar *) *xpp;
-#line 3003
 
-#line 3003
     while (nelems-- != 0) {
-#line 3003
-        if (*tp > (float)X_UCHAR_MAX || *tp < 0) {
-#line 3003
+        if (*tp < 0) {
             
-#line 3003
             status = NC_ERANGE;
-#line 3003
             
-#line 3003
         }
-#line 3003
-        *xp++ = (uchar) (signed) *tp++; /* type cast from float to uchar */
-#line 3003
+        *xp++ = (uchar) (signed) *tp++; /* type cast from schar to uchar */
     }
-#line 3003
 
-#line 3003
     *xpp = (void *)xp;
-#line 3003
     return status;
-#line 3003
 }
-#line 3003
+#line 2999
+int
+ncx_putn_uchar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+{
+		(void) memcpy(*xpp, tp, (size_t)nelems);
+#line 3002
+	*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3002
+
+#line 3002
+	return NC_NOERR;
+#line 3002
 
+}
 int
 #line 3004
-ncx_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_putn_uchar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 3004
 {
 #line 3004
@@ -10674,7 +10530,7 @@ ncx_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3004
     while (nelems-- != 0) {
 #line 3004
-        if (*tp > (double)X_UCHAR_MAX || *tp < 0) {
+        if (*tp > (short)X_UCHAR_MAX || *tp < 0) {
 #line 3004
             
 #line 3004
@@ -10684,7 +10540,7 @@ ncx_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3004
         }
 #line 3004
-        *xp++ = (uchar) (signed) *tp++; /* type cast from double to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from short to uchar */
 #line 3004
     }
 #line 3004
@@ -10699,7 +10555,7 @@ ncx_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 
 int
 #line 3005
-ncx_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_putn_uchar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3005
 {
 #line 3005
@@ -10711,7 +10567,7 @@ ncx_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 #line 3005
     while (nelems-- != 0) {
 #line 3005
-        if (*tp > (longlong)X_UCHAR_MAX || *tp < 0) {
+        if (*tp > (int)X_UCHAR_MAX || *tp < 0) {
 #line 3005
             
 #line 3005
@@ -10721,7 +10577,7 @@ ncx_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 #line 3005
         }
 #line 3005
-        *xp++ = (uchar) (signed) *tp++; /* type cast from longlong to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from int to uchar */
 #line 3005
     }
 #line 3005
@@ -10736,7 +10592,7 @@ ncx_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 
 int
 #line 3006
-ncx_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_putn_uchar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3006
 {
 #line 3006
@@ -10748,7 +10604,7 @@ ncx_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 3006
     while (nelems-- != 0) {
 #line 3006
-        if (*tp > (ushort)X_UCHAR_MAX ) {
+        if (*tp > (long)X_UCHAR_MAX || *tp < 0) {
 #line 3006
             
 #line 3006
@@ -10758,7 +10614,7 @@ ncx_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 3006
         }
 #line 3006
-        *xp++ = (uchar)  *tp++; /* type cast from ushort to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from long to uchar */
 #line 3006
     }
 #line 3006
@@ -10773,7 +10629,7 @@ ncx_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 
 int
 #line 3007
-ncx_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_putn_uchar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3007
 {
 #line 3007
@@ -10785,7 +10641,7 @@ ncx_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3007
     while (nelems-- != 0) {
 #line 3007
-        if (*tp > (uint)X_UCHAR_MAX ) {
+        if (*tp > (float)X_UCHAR_MAX || *tp < 0) {
 #line 3007
             
 #line 3007
@@ -10795,7 +10651,7 @@ ncx_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3007
         }
 #line 3007
-        *xp++ = (uchar)  *tp++; /* type cast from uint to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from float to uchar */
 #line 3007
     }
 #line 3007
@@ -10810,7 +10666,7 @@ ncx_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 3008
-ncx_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3008
 {
 #line 3008
@@ -10822,7 +10678,7 @@ ncx_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 #line 3008
     while (nelems-- != 0) {
 #line 3008
-        if (*tp > (ulonglong)X_UCHAR_MAX ) {
+        if (*tp > (double)X_UCHAR_MAX || *tp < 0) {
 #line 3008
             
 #line 3008
@@ -10832,7 +10688,7 @@ ncx_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 #line 3008
         }
 #line 3008
-        *xp++ = (uchar)  *tp++; /* type cast from ulonglong to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from double to uchar */
 #line 3008
     }
 #line 3008
@@ -10845,293 +10701,221 @@ ncx_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 }
 #line 3008
 
-
-#line 3011
 int
-ncx_pad_putn_uchar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
+#line 3009
+ncx_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 3009
 {
+#line 3009
     int status = NC_NOERR;
-    size_t rndup = nelems % X_ALIGN;
+#line 3009
     uchar *xp = (uchar *) *xpp;
+#line 3009
 
-    if (rndup) rndup = X_ALIGN - rndup;
-
+#line 3009
     while (nelems-- != 0) {
-        if (*tp < 0) {
+#line 3009
+        if (*tp > (longlong)X_UCHAR_MAX || *tp < 0) {
+#line 3009
             
+#line 3009
             status = NC_ERANGE;
+#line 3009
             
+#line 3009
         }
-        *xp++ = (uchar) (signed) *tp++; /* type cast from schar to uchar */
-    }
-
-    if (rndup) {
-        (void) memcpy(xp, nada, (size_t)rndup);
-        xp += rndup;
+#line 3009
+        *xp++ = (uchar) (signed) *tp++; /* type cast from longlong to uchar */
+#line 3009
     }
+#line 3009
 
+#line 3009
     *xpp = (void *)xp;
+#line 3009
     return status;
+#line 3009
 }
-#line 3038
-int
-ncx_pad_putn_uchar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-{
-		size_t rndup = nelems % X_ALIGN;
-#line 3041
-
-#line 3041
-	if (rndup)
-#line 3041
-		rndup = X_ALIGN - rndup;
-#line 3041
-
-#line 3041
-	(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 3041
-	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3041
-
-#line 3041
-	if (rndup)
-#line 3041
-	{
-#line 3041
-		(void) memcpy(*xpp, nada, (size_t)rndup);
-#line 3041
-		*xpp = (void *)((char *)(*xpp) + rndup);
-#line 3041
-	}
-#line 3041
-
-#line 3041
-	return NC_NOERR;
-#line 3041
+#line 3009
 
-}
 int
-#line 3043
-ncx_pad_putn_uchar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3043
+#line 3010
+ncx_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 3010
 {
-#line 3043
+#line 3010
     int status = NC_NOERR;
-#line 3043
-    size_t rndup = nelems % X_ALIGN;
-#line 3043
+#line 3010
     uchar *xp = (uchar *) *xpp;
-#line 3043
+#line 3010
 
-#line 3043
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 3043
-
-#line 3043
+#line 3010
     while (nelems-- != 0) {
-#line 3043
-        if (*tp > (short)X_UCHAR_MAX || *tp < 0) {
-#line 3043
+#line 3010
+        if (*tp > (ushort)X_UCHAR_MAX ) {
+#line 3010
             
-#line 3043
+#line 3010
             status = NC_ERANGE;
-#line 3043
+#line 3010
             
-#line 3043
+#line 3010
         }
-#line 3043
-        *xp++ = (uchar) (signed) *tp++; /* type cast from short to uchar */
-#line 3043
-    }
-#line 3043
-
-#line 3043
-
-#line 3043
-    if (rndup) {
-#line 3043
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 3043
-        xp += rndup;
-#line 3043
+#line 3010
+        *xp++ = (uchar)  *tp++; /* type cast from ushort to uchar */
+#line 3010
     }
-#line 3043
+#line 3010
 
-#line 3043
+#line 3010
     *xpp = (void *)xp;
-#line 3043
+#line 3010
     return status;
-#line 3043
+#line 3010
 }
-#line 3043
+#line 3010
 
 int
-#line 3044
-ncx_pad_putn_uchar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3044
+#line 3011
+ncx_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 3011
 {
-#line 3044
+#line 3011
     int status = NC_NOERR;
-#line 3044
-    size_t rndup = nelems % X_ALIGN;
-#line 3044
+#line 3011
     uchar *xp = (uchar *) *xpp;
-#line 3044
-
-#line 3044
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 3044
+#line 3011
 
-#line 3044
+#line 3011
     while (nelems-- != 0) {
-#line 3044
-        if (*tp > (int)X_UCHAR_MAX || *tp < 0) {
-#line 3044
+#line 3011
+        if (*tp > (uint)X_UCHAR_MAX ) {
+#line 3011
             
-#line 3044
+#line 3011
             status = NC_ERANGE;
-#line 3044
+#line 3011
             
-#line 3044
+#line 3011
         }
-#line 3044
-        *xp++ = (uchar) (signed) *tp++; /* type cast from int to uchar */
-#line 3044
-    }
-#line 3044
-
-#line 3044
-
-#line 3044
-    if (rndup) {
-#line 3044
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 3044
-        xp += rndup;
-#line 3044
+#line 3011
+        *xp++ = (uchar)  *tp++; /* type cast from uint to uchar */
+#line 3011
     }
-#line 3044
+#line 3011
 
-#line 3044
+#line 3011
     *xpp = (void *)xp;
-#line 3044
+#line 3011
     return status;
-#line 3044
+#line 3011
 }
-#line 3044
+#line 3011
 
 int
-#line 3045
-ncx_pad_putn_uchar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3045
+#line 3012
+ncx_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+#line 3012
 {
-#line 3045
+#line 3012
     int status = NC_NOERR;
-#line 3045
-    size_t rndup = nelems % X_ALIGN;
-#line 3045
+#line 3012
     uchar *xp = (uchar *) *xpp;
-#line 3045
-
-#line 3045
-    if (rndup) rndup = X_ALIGN - rndup;
-#line 3045
+#line 3012
 
-#line 3045
+#line 3012
     while (nelems-- != 0) {
-#line 3045
-        if (*tp > (long)X_UCHAR_MAX || *tp < 0) {
-#line 3045
+#line 3012
+        if (*tp > (ulonglong)X_UCHAR_MAX ) {
+#line 3012
             
-#line 3045
+#line 3012
             status = NC_ERANGE;
-#line 3045
+#line 3012
             
-#line 3045
+#line 3012
         }
-#line 3045
-        *xp++ = (uchar) (signed) *tp++; /* type cast from long to uchar */
-#line 3045
-    }
-#line 3045
-
-#line 3045
-
-#line 3045
-    if (rndup) {
-#line 3045
-        (void) memcpy(xp, nada, (size_t)rndup);
-#line 3045
-        xp += rndup;
-#line 3045
+#line 3012
+        *xp++ = (uchar)  *tp++; /* type cast from ulonglong to uchar */
+#line 3012
     }
-#line 3045
+#line 3012
 
-#line 3045
+#line 3012
     *xpp = (void *)xp;
-#line 3045
+#line 3012
     return status;
-#line 3045
+#line 3012
 }
-#line 3045
+#line 3012
+
 
+#line 3015
 int
-#line 3046
-ncx_pad_putn_uchar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3046
+ncx_pad_putn_uchar_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
 {
-#line 3046
     int status = NC_NOERR;
-#line 3046
     size_t rndup = nelems % X_ALIGN;
-#line 3046
     uchar *xp = (uchar *) *xpp;
-#line 3046
 
-#line 3046
     if (rndup) rndup = X_ALIGN - rndup;
-#line 3046
 
-#line 3046
     while (nelems-- != 0) {
-#line 3046
-        if (*tp > (float)X_UCHAR_MAX || *tp < 0) {
-#line 3046
+        if (*tp < 0) {
             
-#line 3046
             status = NC_ERANGE;
-#line 3046
             
-#line 3046
         }
-#line 3046
-        *xp++ = (uchar) (signed) *tp++; /* type cast from float to uchar */
-#line 3046
+        *xp++ = (uchar) (signed) *tp++; /* type cast from schar to uchar */
     }
-#line 3046
 
-#line 3046
-
-#line 3046
     if (rndup) {
-#line 3046
         (void) memcpy(xp, nada, (size_t)rndup);
-#line 3046
         xp += rndup;
-#line 3046
     }
-#line 3046
 
-#line 3046
     *xpp = (void *)xp;
-#line 3046
     return status;
-#line 3046
 }
-#line 3046
+#line 3042
+int
+ncx_pad_putn_uchar_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+{
+		size_t rndup = nelems % X_ALIGN;
+#line 3045
+
+#line 3045
+	if (rndup)
+#line 3045
+		rndup = X_ALIGN - rndup;
+#line 3045
+
+#line 3045
+	(void) memcpy(*xpp, tp, (size_t)nelems);
+#line 3045
+	*xpp = (void *)((char *)(*xpp) + nelems);
+#line 3045
+
+#line 3045
+	if (rndup)
+#line 3045
+	{
+#line 3045
+		(void) memcpy(*xpp, nada, (size_t)rndup);
+#line 3045
+		*xpp = (void *)((char *)(*xpp) + rndup);
+#line 3045
+	}
+#line 3045
+
+#line 3045
+	return NC_NOERR;
+#line 3045
 
+}
 int
 #line 3047
-ncx_pad_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_pad_putn_uchar_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 3047
 {
 #line 3047
@@ -11149,7 +10933,7 @@ ncx_pad_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fil
 #line 3047
     while (nelems-- != 0) {
 #line 3047
-        if (*tp > (double)X_UCHAR_MAX || *tp < 0) {
+        if (*tp > (short)X_UCHAR_MAX || *tp < 0) {
 #line 3047
             
 #line 3047
@@ -11159,7 +10943,7 @@ ncx_pad_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fil
 #line 3047
         }
 #line 3047
-        *xp++ = (uchar) (signed) *tp++; /* type cast from double to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from short to uchar */
 #line 3047
     }
 #line 3047
@@ -11186,7 +10970,7 @@ ncx_pad_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fil
 
 int
 #line 3048
-ncx_pad_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_pad_putn_uchar_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3048
 {
 #line 3048
@@ -11204,7 +10988,7 @@ ncx_pad_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void
 #line 3048
     while (nelems-- != 0) {
 #line 3048
-        if (*tp > (longlong)X_UCHAR_MAX || *tp < 0) {
+        if (*tp > (int)X_UCHAR_MAX || *tp < 0) {
 #line 3048
             
 #line 3048
@@ -11214,7 +10998,7 @@ ncx_pad_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void
 #line 3048
         }
 #line 3048
-        *xp++ = (uchar) (signed) *tp++; /* type cast from longlong to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from int to uchar */
 #line 3048
     }
 #line 3048
@@ -11241,7 +11025,7 @@ ncx_pad_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void
 
 int
 #line 3049
-ncx_pad_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_pad_putn_uchar_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3049
 {
 #line 3049
@@ -11259,7 +11043,7 @@ ncx_pad_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 #line 3049
     while (nelems-- != 0) {
 #line 3049
-        if (*tp > (ushort)X_UCHAR_MAX ) {
+        if (*tp > (long)X_UCHAR_MAX || *tp < 0) {
 #line 3049
             
 #line 3049
@@ -11269,7 +11053,7 @@ ncx_pad_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 #line 3049
         }
 #line 3049
-        *xp++ = (uchar)  *tp++; /* type cast from ushort to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from long to uchar */
 #line 3049
     }
 #line 3049
@@ -11296,7 +11080,7 @@ ncx_pad_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 
 int
 #line 3050
-ncx_pad_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_pad_putn_uchar_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3050
 {
 #line 3050
@@ -11314,7 +11098,7 @@ ncx_pad_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3050
     while (nelems-- != 0) {
 #line 3050
-        if (*tp > (uint)X_UCHAR_MAX ) {
+        if (*tp > (float)X_UCHAR_MAX || *tp < 0) {
 #line 3050
             
 #line 3050
@@ -11324,7 +11108,7 @@ ncx_pad_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3050
         }
 #line 3050
-        *xp++ = (uchar)  *tp++; /* type cast from uint to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from float to uchar */
 #line 3050
     }
 #line 3050
@@ -11351,7 +11135,7 @@ ncx_pad_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 3051
-ncx_pad_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_pad_putn_uchar_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3051
 {
 #line 3051
@@ -11369,7 +11153,7 @@ ncx_pad_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 #line 3051
     while (nelems-- != 0) {
 #line 3051
-        if (*tp > (ulonglong)X_UCHAR_MAX ) {
+        if (*tp > (double)X_UCHAR_MAX || *tp < 0) {
 #line 3051
             
 #line 3051
@@ -11379,7 +11163,7 @@ ncx_pad_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 #line 3051
         }
 #line 3051
-        *xp++ = (uchar)  *tp++; /* type cast from ulonglong to uchar */
+        *xp++ = (uchar) (signed) *tp++; /* type cast from double to uchar */
 #line 3051
     }
 #line 3051
@@ -11404,16 +11188,236 @@ ncx_pad_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 }
 #line 3051
 
+int
+#line 3052
+ncx_pad_putn_uchar_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 3052
+{
+#line 3052
+    int status = NC_NOERR;
+#line 3052
+    size_t rndup = nelems % X_ALIGN;
+#line 3052
+    uchar *xp = (uchar *) *xpp;
+#line 3052
+
+#line 3052
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 3052
 
-/* short ---------------------------------------------------------------------*/
+#line 3052
+    while (nelems-- != 0) {
+#line 3052
+        if (*tp > (longlong)X_UCHAR_MAX || *tp < 0) {
+#line 3052
+            
+#line 3052
+            status = NC_ERANGE;
+#line 3052
+            
+#line 3052
+        }
+#line 3052
+        *xp++ = (uchar) (signed) *tp++; /* type cast from longlong to uchar */
+#line 3052
+    }
+#line 3052
+
+#line 3052
+
+#line 3052
+    if (rndup) {
+#line 3052
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 3052
+        xp += rndup;
+#line 3052
+    }
+#line 3052
+
+#line 3052
+    *xpp = (void *)xp;
+#line 3052
+    return status;
+#line 3052
+}
+#line 3052
 
-#if X_SIZEOF_SHORT == SIZEOF_SHORT
-/* optimized version */
 int
-ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
+#line 3053
+ncx_pad_putn_uchar_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 3053
 {
-#ifdef WORDS_BIGENDIAN
-	(void) memcpy(tp, *xpp, (size_t)nelems * SIZEOF_SHORT);
+#line 3053
+    int status = NC_NOERR;
+#line 3053
+    size_t rndup = nelems % X_ALIGN;
+#line 3053
+    uchar *xp = (uchar *) *xpp;
+#line 3053
+
+#line 3053
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 3053
+
+#line 3053
+    while (nelems-- != 0) {
+#line 3053
+        if (*tp > (ushort)X_UCHAR_MAX ) {
+#line 3053
+            
+#line 3053
+            status = NC_ERANGE;
+#line 3053
+            
+#line 3053
+        }
+#line 3053
+        *xp++ = (uchar)  *tp++; /* type cast from ushort to uchar */
+#line 3053
+    }
+#line 3053
+
+#line 3053
+
+#line 3053
+    if (rndup) {
+#line 3053
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 3053
+        xp += rndup;
+#line 3053
+    }
+#line 3053
+
+#line 3053
+    *xpp = (void *)xp;
+#line 3053
+    return status;
+#line 3053
+}
+#line 3053
+
+int
+#line 3054
+ncx_pad_putn_uchar_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 3054
+{
+#line 3054
+    int status = NC_NOERR;
+#line 3054
+    size_t rndup = nelems % X_ALIGN;
+#line 3054
+    uchar *xp = (uchar *) *xpp;
+#line 3054
+
+#line 3054
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 3054
+
+#line 3054
+    while (nelems-- != 0) {
+#line 3054
+        if (*tp > (uint)X_UCHAR_MAX ) {
+#line 3054
+            
+#line 3054
+            status = NC_ERANGE;
+#line 3054
+            
+#line 3054
+        }
+#line 3054
+        *xp++ = (uchar)  *tp++; /* type cast from uint to uchar */
+#line 3054
+    }
+#line 3054
+
+#line 3054
+
+#line 3054
+    if (rndup) {
+#line 3054
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 3054
+        xp += rndup;
+#line 3054
+    }
+#line 3054
+
+#line 3054
+    *xpp = (void *)xp;
+#line 3054
+    return status;
+#line 3054
+}
+#line 3054
+
+int
+#line 3055
+ncx_pad_putn_uchar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+#line 3055
+{
+#line 3055
+    int status = NC_NOERR;
+#line 3055
+    size_t rndup = nelems % X_ALIGN;
+#line 3055
+    uchar *xp = (uchar *) *xpp;
+#line 3055
+
+#line 3055
+    if (rndup) rndup = X_ALIGN - rndup;
+#line 3055
+
+#line 3055
+    while (nelems-- != 0) {
+#line 3055
+        if (*tp > (ulonglong)X_UCHAR_MAX ) {
+#line 3055
+            
+#line 3055
+            status = NC_ERANGE;
+#line 3055
+            
+#line 3055
+        }
+#line 3055
+        *xp++ = (uchar)  *tp++; /* type cast from ulonglong to uchar */
+#line 3055
+    }
+#line 3055
+
+#line 3055
+
+#line 3055
+    if (rndup) {
+#line 3055
+        (void) memcpy(xp, nada, (size_t)rndup);
+#line 3055
+        xp += rndup;
+#line 3055
+    }
+#line 3055
+
+#line 3055
+    *xpp = (void *)xp;
+#line 3055
+    return status;
+#line 3055
+}
+#line 3055
+
+
+/* short ---------------------------------------------------------------------*/
+
+#if X_SIZEOF_SHORT == SIZEOF_SHORT
+/* optimized version */
+int
+ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
+{
+#ifdef WORDS_BIGENDIAN
+	(void) memcpy(tp, *xpp, (size_t)nelems * SIZEOF_SHORT);
 # else
 	swapn2b(tp, *xpp, nelems);
 # endif
@@ -11422,1705 +11426,1533 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
 }
 #else
 int
-#line 3069
+#line 3073
 ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
-#line 3069
+#line 3073
 {
-#line 3069
+#line 3073
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3069
+#line 3073
 
-#line 3069
+#line 3073
  /* basic algorithm is:
-#line 3069
+#line 3073
   *   - ensure sane alignment of input data
-#line 3069
+#line 3073
   *   - copy (conversion happens automatically) input data
-#line 3069
+#line 3073
   *     to output
-#line 3069
+#line 3073
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3069
+#line 3073
   *     at next location for converted output
-#line 3069
+#line 3073
   */
-#line 3069
+#line 3073
   long i, j, ni;
-#line 3069
+#line 3073
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3069
+#line 3073
   short *xp;
-#line 3069
+#line 3073
   int nrange = 0;         /* number of range errors */
-#line 3069
+#line 3073
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3069
+#line 3073
   long cxp = (long) *((char**)xpp);
-#line 3069
+#line 3073
 
-#line 3069
+#line 3073
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3069
+#line 3073
   /* sjl: manually stripmine so we can limit amount of
-#line 3069
+#line 3073
    * vector work space reserved to LOOPCNT elements. Also
-#line 3069
+#line 3073
    * makes vectorisation easy */
-#line 3069
+#line 3073
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3069
+#line 3073
     ni=Min(nelems-j,LOOPCNT);
-#line 3069
+#line 3073
     if (realign) {
-#line 3069
+#line 3073
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3069
+#line 3073
       xp = tmp;
-#line 3069
+#line 3073
     } else {
-#line 3069
+#line 3073
       xp = (short *) *xpp;
-#line 3069
+#line 3073
     }
-#line 3069
+#line 3073
    /* copy the next block */
-#line 3069
+#line 3073
 #pragma cdir loopcnt=LOOPCNT
-#line 3069
+#line 3073
 #pragma cdir shortloop
-#line 3069
+#line 3073
     for (i=0; i<ni; i++) {
-#line 3069
+#line 3073
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3069
+#line 3073
      /* test for range errors (not always needed but do it anyway) */
-#line 3069
+#line 3073
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3069
+#line 3073
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3069
+#line 3073
       nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
-#line 3069
+#line 3073
     }
-#line 3069
+#line 3073
    /* update xpp and tp */
-#line 3069
+#line 3073
     if (realign) xp = (short *) *xpp;
-#line 3069
+#line 3073
     xp += ni;
-#line 3069
+#line 3073
     tp += ni;
-#line 3069
+#line 3073
     *xpp = (void*)xp;
-#line 3069
+#line 3073
   }
-#line 3069
+#line 3073
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3069
+#line 3073
 
-#line 3069
+#line 3073
 #else   /* not SX */
-#line 3069
+#line 3073
 	const char *xp = (const char *) *xpp;
-#line 3069
+#line 3073
 	int status = NC_NOERR;
-#line 3069
+#line 3073
 
-#line 3069
+#line 3073
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3069
+#line 3073
 	{
-#line 3069
+#line 3073
 		const int lstatus = ncx_get_short_short(xp, tp);
-#line 3069
+#line 3073
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3069
+#line 3073
 			status = lstatus;
-#line 3069
+#line 3073
 	}
-#line 3069
+#line 3073
 
-#line 3069
+#line 3073
 	*xpp = (const void *)xp;
-#line 3069
+#line 3073
 	return status;
-#line 3069
+#line 3073
 #endif
-#line 3069
+#line 3073
 }
-#line 3069
+#line 3073
 
 #endif
 int
-#line 3071
+#line 3075
 ncx_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3071
+#line 3075
 {
-#line 3071
+#line 3075
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3071
+#line 3075
 
-#line 3071
+#line 3075
  /* basic algorithm is:
-#line 3071
+#line 3075
   *   - ensure sane alignment of input data
-#line 3071
+#line 3075
   *   - copy (conversion happens automatically) input data
-#line 3071
+#line 3075
   *     to output
-#line 3071
+#line 3075
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3071
+#line 3075
   *     at next location for converted output
-#line 3071
+#line 3075
   */
-#line 3071
+#line 3075
   long i, j, ni;
-#line 3071
+#line 3075
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3071
+#line 3075
   short *xp;
-#line 3071
+#line 3075
   int nrange = 0;         /* number of range errors */
-#line 3071
+#line 3075
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3071
+#line 3075
   long cxp = (long) *((char**)xpp);
-#line 3071
+#line 3075
 
-#line 3071
+#line 3075
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3071
+#line 3075
   /* sjl: manually stripmine so we can limit amount of
-#line 3071
+#line 3075
    * vector work space reserved to LOOPCNT elements. Also
-#line 3071
+#line 3075
    * makes vectorisation easy */
-#line 3071
+#line 3075
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3071
+#line 3075
     ni=Min(nelems-j,LOOPCNT);
-#line 3071
+#line 3075
     if (realign) {
-#line 3071
+#line 3075
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3071
+#line 3075
       xp = tmp;
-#line 3071
+#line 3075
     } else {
-#line 3071
+#line 3075
       xp = (short *) *xpp;
-#line 3071
+#line 3075
     }
-#line 3071
+#line 3075
    /* copy the next block */
-#line 3071
+#line 3075
 #pragma cdir loopcnt=LOOPCNT
-#line 3071
+#line 3075
 #pragma cdir shortloop
-#line 3071
+#line 3075
     for (i=0; i<ni; i++) {
-#line 3071
+#line 3075
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3071
+#line 3075
      /* test for range errors (not always needed but do it anyway) */
-#line 3071
+#line 3075
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3071
+#line 3075
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3071
+#line 3075
       nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
-#line 3071
+#line 3075
     }
-#line 3071
+#line 3075
    /* update xpp and tp */
-#line 3071
+#line 3075
     if (realign) xp = (short *) *xpp;
-#line 3071
+#line 3075
     xp += ni;
-#line 3071
+#line 3075
     tp += ni;
-#line 3071
+#line 3075
     *xpp = (void*)xp;
-#line 3071
+#line 3075
   }
-#line 3071
+#line 3075
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3071
+#line 3075
 
-#line 3071
+#line 3075
 #else   /* not SX */
-#line 3071
+#line 3075
 	const char *xp = (const char *) *xpp;
-#line 3071
+#line 3075
 	int status = NC_NOERR;
-#line 3071
+#line 3075
 
-#line 3071
+#line 3075
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3071
+#line 3075
 	{
-#line 3071
+#line 3075
 		const int lstatus = ncx_get_short_schar(xp, tp);
-#line 3071
+#line 3075
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3071
+#line 3075
 			status = lstatus;
-#line 3071
+#line 3075
 	}
-#line 3071
+#line 3075
 
-#line 3071
+#line 3075
 	*xpp = (const void *)xp;
-#line 3071
+#line 3075
 	return status;
-#line 3071
+#line 3075
 #endif
-#line 3071
+#line 3075
 }
-#line 3071
+#line 3075
 
 int
-#line 3072
+#line 3076
 ncx_getn_short_int(const void **xpp, size_t nelems, int *tp)
-#line 3072
+#line 3076
 {
-#line 3072
+#line 3076
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3072
+#line 3076
 
-#line 3072
+#line 3076
  /* basic algorithm is:
-#line 3072
+#line 3076
   *   - ensure sane alignment of input data
-#line 3072
+#line 3076
   *   - copy (conversion happens automatically) input data
-#line 3072
+#line 3076
   *     to output
-#line 3072
+#line 3076
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3072
+#line 3076
   *     at next location for converted output
-#line 3072
+#line 3076
   */
-#line 3072
+#line 3076
   long i, j, ni;
-#line 3072
+#line 3076
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3072
+#line 3076
   short *xp;
-#line 3072
+#line 3076
   int nrange = 0;         /* number of range errors */
-#line 3072
+#line 3076
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3072
+#line 3076
   long cxp = (long) *((char**)xpp);
-#line 3072
+#line 3076
 
-#line 3072
+#line 3076
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3072
+#line 3076
   /* sjl: manually stripmine so we can limit amount of
-#line 3072
+#line 3076
    * vector work space reserved to LOOPCNT elements. Also
-#line 3072
+#line 3076
    * makes vectorisation easy */
-#line 3072
+#line 3076
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3072
+#line 3076
     ni=Min(nelems-j,LOOPCNT);
-#line 3072
+#line 3076
     if (realign) {
-#line 3072
+#line 3076
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3072
+#line 3076
       xp = tmp;
-#line 3072
+#line 3076
     } else {
-#line 3072
+#line 3076
       xp = (short *) *xpp;
-#line 3072
+#line 3076
     }
-#line 3072
+#line 3076
    /* copy the next block */
-#line 3072
+#line 3076
 #pragma cdir loopcnt=LOOPCNT
-#line 3072
+#line 3076
 #pragma cdir shortloop
-#line 3072
+#line 3076
     for (i=0; i<ni; i++) {
-#line 3072
+#line 3076
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3072
+#line 3076
      /* test for range errors (not always needed but do it anyway) */
-#line 3072
+#line 3076
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3072
+#line 3076
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3072
+#line 3076
       nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
-#line 3072
+#line 3076
     }
-#line 3072
+#line 3076
    /* update xpp and tp */
-#line 3072
+#line 3076
     if (realign) xp = (short *) *xpp;
-#line 3072
+#line 3076
     xp += ni;
-#line 3072
+#line 3076
     tp += ni;
-#line 3072
+#line 3076
     *xpp = (void*)xp;
-#line 3072
+#line 3076
   }
-#line 3072
+#line 3076
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3072
+#line 3076
 
-#line 3072
+#line 3076
 #else   /* not SX */
-#line 3072
+#line 3076
 	const char *xp = (const char *) *xpp;
-#line 3072
+#line 3076
 	int status = NC_NOERR;
-#line 3072
+#line 3076
 
-#line 3072
+#line 3076
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3072
+#line 3076
 	{
-#line 3072
+#line 3076
 		const int lstatus = ncx_get_short_int(xp, tp);
-#line 3072
+#line 3076
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3072
+#line 3076
 			status = lstatus;
-#line 3072
+#line 3076
 	}
-#line 3072
+#line 3076
 
-#line 3072
+#line 3076
 	*xpp = (const void *)xp;
-#line 3072
+#line 3076
 	return status;
-#line 3072
+#line 3076
 #endif
-#line 3072
+#line 3076
 }
-#line 3072
+#line 3076
 
 int
-#line 3073
+#line 3077
 ncx_getn_short_long(const void **xpp, size_t nelems, long *tp)
-#line 3073
+#line 3077
 {
-#line 3073
+#line 3077
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3073
+#line 3077
 
-#line 3073
+#line 3077
  /* basic algorithm is:
-#line 3073
+#line 3077
   *   - ensure sane alignment of input data
-#line 3073
+#line 3077
   *   - copy (conversion happens automatically) input data
-#line 3073
+#line 3077
   *     to output
-#line 3073
+#line 3077
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3073
+#line 3077
   *     at next location for converted output
-#line 3073
+#line 3077
   */
-#line 3073
+#line 3077
   long i, j, ni;
-#line 3073
+#line 3077
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3073
+#line 3077
   short *xp;
-#line 3073
+#line 3077
   int nrange = 0;         /* number of range errors */
-#line 3073
+#line 3077
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3073
+#line 3077
   long cxp = (long) *((char**)xpp);
-#line 3073
+#line 3077
 
-#line 3073
+#line 3077
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3073
+#line 3077
   /* sjl: manually stripmine so we can limit amount of
-#line 3073
+#line 3077
    * vector work space reserved to LOOPCNT elements. Also
-#line 3073
+#line 3077
    * makes vectorisation easy */
-#line 3073
+#line 3077
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3073
+#line 3077
     ni=Min(nelems-j,LOOPCNT);
-#line 3073
+#line 3077
     if (realign) {
-#line 3073
+#line 3077
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3073
+#line 3077
       xp = tmp;
-#line 3073
+#line 3077
     } else {
-#line 3073
+#line 3077
       xp = (short *) *xpp;
-#line 3073
+#line 3077
     }
-#line 3073
+#line 3077
    /* copy the next block */
-#line 3073
+#line 3077
 #pragma cdir loopcnt=LOOPCNT
-#line 3073
+#line 3077
 #pragma cdir shortloop
-#line 3073
+#line 3077
     for (i=0; i<ni; i++) {
-#line 3073
+#line 3077
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3073
+#line 3077
      /* test for range errors (not always needed but do it anyway) */
-#line 3073
+#line 3077
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3073
+#line 3077
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3073
+#line 3077
       nrange += xp[i] > LONG_MAX || xp[i] < LONG_MIN;
-#line 3073
+#line 3077
     }
-#line 3073
+#line 3077
    /* update xpp and tp */
-#line 3073
+#line 3077
     if (realign) xp = (short *) *xpp;
-#line 3073
+#line 3077
     xp += ni;
-#line 3073
+#line 3077
     tp += ni;
-#line 3073
+#line 3077
     *xpp = (void*)xp;
-#line 3073
+#line 3077
   }
-#line 3073
+#line 3077
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3073
+#line 3077
 
-#line 3073
+#line 3077
 #else   /* not SX */
-#line 3073
+#line 3077
 	const char *xp = (const char *) *xpp;
-#line 3073
+#line 3077
 	int status = NC_NOERR;
-#line 3073
+#line 3077
 
-#line 3073
+#line 3077
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3073
+#line 3077
 	{
-#line 3073
+#line 3077
 		const int lstatus = ncx_get_short_long(xp, tp);
-#line 3073
+#line 3077
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3073
+#line 3077
 			status = lstatus;
-#line 3073
+#line 3077
 	}
-#line 3073
+#line 3077
 
-#line 3073
+#line 3077
 	*xpp = (const void *)xp;
-#line 3073
+#line 3077
 	return status;
-#line 3073
+#line 3077
 #endif
-#line 3073
+#line 3077
 }
-#line 3073
+#line 3077
 
 int
-#line 3074
+#line 3078
 ncx_getn_short_float(const void **xpp, size_t nelems, float *tp)
-#line 3074
+#line 3078
 {
-#line 3074
+#line 3078
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3074
+#line 3078
 
-#line 3074
+#line 3078
  /* basic algorithm is:
-#line 3074
+#line 3078
   *   - ensure sane alignment of input data
-#line 3074
+#line 3078
   *   - copy (conversion happens automatically) input data
-#line 3074
+#line 3078
   *     to output
-#line 3074
+#line 3078
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3074
+#line 3078
   *     at next location for converted output
-#line 3074
+#line 3078
   */
-#line 3074
+#line 3078
   long i, j, ni;
-#line 3074
+#line 3078
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3074
+#line 3078
   short *xp;
-#line 3074
+#line 3078
   int nrange = 0;         /* number of range errors */
-#line 3074
+#line 3078
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3074
+#line 3078
   long cxp = (long) *((char**)xpp);
-#line 3074
+#line 3078
 
-#line 3074
+#line 3078
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3074
+#line 3078
   /* sjl: manually stripmine so we can limit amount of
-#line 3074
+#line 3078
    * vector work space reserved to LOOPCNT elements. Also
-#line 3074
+#line 3078
    * makes vectorisation easy */
-#line 3074
+#line 3078
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3074
+#line 3078
     ni=Min(nelems-j,LOOPCNT);
-#line 3074
+#line 3078
     if (realign) {
-#line 3074
+#line 3078
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3074
+#line 3078
       xp = tmp;
-#line 3074
+#line 3078
     } else {
-#line 3074
+#line 3078
       xp = (short *) *xpp;
-#line 3074
+#line 3078
     }
-#line 3074
+#line 3078
    /* copy the next block */
-#line 3074
+#line 3078
 #pragma cdir loopcnt=LOOPCNT
-#line 3074
+#line 3078
 #pragma cdir shortloop
-#line 3074
+#line 3078
     for (i=0; i<ni; i++) {
-#line 3074
+#line 3078
       tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
-#line 3074
+#line 3078
      /* test for range errors (not always needed but do it anyway) */
-#line 3074
+#line 3078
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3074
+#line 3078
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3074
+#line 3078
       nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
-#line 3074
+#line 3078
     }
-#line 3074
+#line 3078
    /* update xpp and tp */
-#line 3074
+#line 3078
     if (realign) xp = (short *) *xpp;
-#line 3074
+#line 3078
     xp += ni;
-#line 3074
+#line 3078
     tp += ni;
-#line 3074
+#line 3078
     *xpp = (void*)xp;
-#line 3074
+#line 3078
   }
-#line 3074
+#line 3078
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3074
+#line 3078
 
-#line 3074
+#line 3078
 #else   /* not SX */
-#line 3074
+#line 3078
 	const char *xp = (const char *) *xpp;
-#line 3074
+#line 3078
 	int status = NC_NOERR;
-#line 3074
+#line 3078
 
-#line 3074
+#line 3078
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3074
+#line 3078
 	{
-#line 3074
+#line 3078
 		const int lstatus = ncx_get_short_float(xp, tp);
-#line 3074
+#line 3078
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3074
+#line 3078
 			status = lstatus;
-#line 3074
+#line 3078
 	}
-#line 3074
+#line 3078
 
-#line 3074
+#line 3078
 	*xpp = (const void *)xp;
-#line 3074
+#line 3078
 	return status;
-#line 3074
+#line 3078
 #endif
-#line 3074
+#line 3078
 }
-#line 3074
+#line 3078
 
 int
-#line 3075
+#line 3079
 ncx_getn_short_double(const void **xpp, size_t nelems, double *tp)
-#line 3075
+#line 3079
 {
-#line 3075
+#line 3079
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3075
+#line 3079
 
-#line 3075
+#line 3079
  /* basic algorithm is:
-#line 3075
+#line 3079
   *   - ensure sane alignment of input data
-#line 3075
+#line 3079
   *   - copy (conversion happens automatically) input data
-#line 3075
+#line 3079
   *     to output
-#line 3075
+#line 3079
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3075
+#line 3079
   *     at next location for converted output
-#line 3075
+#line 3079
   */
-#line 3075
+#line 3079
   long i, j, ni;
-#line 3075
+#line 3079
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3075
+#line 3079
   short *xp;
-#line 3075
+#line 3079
   int nrange = 0;         /* number of range errors */
-#line 3075
+#line 3079
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3075
+#line 3079
   long cxp = (long) *((char**)xpp);
-#line 3075
+#line 3079
 
-#line 3075
+#line 3079
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3075
+#line 3079
   /* sjl: manually stripmine so we can limit amount of
-#line 3075
+#line 3079
    * vector work space reserved to LOOPCNT elements. Also
-#line 3075
+#line 3079
    * makes vectorisation easy */
-#line 3075
+#line 3079
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3075
+#line 3079
     ni=Min(nelems-j,LOOPCNT);
-#line 3075
+#line 3079
     if (realign) {
-#line 3075
+#line 3079
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3075
+#line 3079
       xp = tmp;
-#line 3075
+#line 3079
     } else {
-#line 3075
+#line 3079
       xp = (short *) *xpp;
-#line 3075
+#line 3079
     }
-#line 3075
+#line 3079
    /* copy the next block */
-#line 3075
+#line 3079
 #pragma cdir loopcnt=LOOPCNT
-#line 3075
+#line 3079
 #pragma cdir shortloop
-#line 3075
+#line 3079
     for (i=0; i<ni; i++) {
-#line 3075
+#line 3079
       tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
-#line 3075
+#line 3079
      /* test for range errors (not always needed but do it anyway) */
-#line 3075
+#line 3079
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3075
+#line 3079
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3075
+#line 3079
       nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
-#line 3075
+#line 3079
     }
-#line 3075
+#line 3079
    /* update xpp and tp */
-#line 3075
+#line 3079
     if (realign) xp = (short *) *xpp;
-#line 3075
+#line 3079
     xp += ni;
-#line 3075
+#line 3079
     tp += ni;
-#line 3075
+#line 3079
     *xpp = (void*)xp;
-#line 3075
+#line 3079
   }
-#line 3075
+#line 3079
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3075
+#line 3079
 
-#line 3075
+#line 3079
 #else   /* not SX */
-#line 3075
+#line 3079
 	const char *xp = (const char *) *xpp;
-#line 3075
+#line 3079
 	int status = NC_NOERR;
-#line 3075
+#line 3079
 
-#line 3075
+#line 3079
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3075
+#line 3079
 	{
-#line 3075
+#line 3079
 		const int lstatus = ncx_get_short_double(xp, tp);
-#line 3075
+#line 3079
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3075
+#line 3079
 			status = lstatus;
-#line 3075
+#line 3079
 	}
-#line 3075
+#line 3079
 
-#line 3075
+#line 3079
 	*xpp = (const void *)xp;
-#line 3075
+#line 3079
 	return status;
-#line 3075
+#line 3079
 #endif
-#line 3075
+#line 3079
 }
-#line 3075
+#line 3079
 
 int
-#line 3076
+#line 3080
 ncx_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3076
+#line 3080
 {
-#line 3076
+#line 3080
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3076
+#line 3080
 
-#line 3076
+#line 3080
  /* basic algorithm is:
-#line 3076
+#line 3080
   *   - ensure sane alignment of input data
-#line 3076
+#line 3080
   *   - copy (conversion happens automatically) input data
-#line 3076
+#line 3080
   *     to output
-#line 3076
+#line 3080
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3076
+#line 3080
   *     at next location for converted output
-#line 3076
+#line 3080
   */
-#line 3076
+#line 3080
   long i, j, ni;
-#line 3076
+#line 3080
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3076
+#line 3080
   short *xp;
-#line 3076
+#line 3080
   int nrange = 0;         /* number of range errors */
-#line 3076
+#line 3080
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3076
+#line 3080
   long cxp = (long) *((char**)xpp);
-#line 3076
+#line 3080
 
-#line 3076
+#line 3080
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3076
+#line 3080
   /* sjl: manually stripmine so we can limit amount of
-#line 3076
+#line 3080
    * vector work space reserved to LOOPCNT elements. Also
-#line 3076
+#line 3080
    * makes vectorisation easy */
-#line 3076
+#line 3080
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3076
+#line 3080
     ni=Min(nelems-j,LOOPCNT);
-#line 3076
+#line 3080
     if (realign) {
-#line 3076
+#line 3080
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3076
+#line 3080
       xp = tmp;
-#line 3076
+#line 3080
     } else {
-#line 3076
+#line 3080
       xp = (short *) *xpp;
-#line 3076
+#line 3080
     }
-#line 3076
+#line 3080
    /* copy the next block */
-#line 3076
+#line 3080
 #pragma cdir loopcnt=LOOPCNT
-#line 3076
+#line 3080
 #pragma cdir shortloop
-#line 3076
+#line 3080
     for (i=0; i<ni; i++) {
-#line 3076
+#line 3080
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3076
+#line 3080
      /* test for range errors (not always needed but do it anyway) */
-#line 3076
+#line 3080
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3076
+#line 3080
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3076
+#line 3080
       nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
-#line 3076
+#line 3080
     }
-#line 3076
+#line 3080
    /* update xpp and tp */
-#line 3076
+#line 3080
     if (realign) xp = (short *) *xpp;
-#line 3076
+#line 3080
     xp += ni;
-#line 3076
+#line 3080
     tp += ni;
-#line 3076
+#line 3080
     *xpp = (void*)xp;
-#line 3076
+#line 3080
   }
-#line 3076
+#line 3080
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3076
+#line 3080
 
-#line 3076
+#line 3080
 #else   /* not SX */
-#line 3076
+#line 3080
 	const char *xp = (const char *) *xpp;
-#line 3076
+#line 3080
 	int status = NC_NOERR;
-#line 3076
+#line 3080
 
-#line 3076
+#line 3080
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3076
+#line 3080
 	{
-#line 3076
+#line 3080
 		const int lstatus = ncx_get_short_longlong(xp, tp);
-#line 3076
+#line 3080
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3076
+#line 3080
 			status = lstatus;
-#line 3076
+#line 3080
 	}
-#line 3076
+#line 3080
 
-#line 3076
+#line 3080
 	*xpp = (const void *)xp;
-#line 3076
+#line 3080
 	return status;
-#line 3076
+#line 3080
 #endif
-#line 3076
+#line 3080
 }
-#line 3076
+#line 3080
 
 int
-#line 3077
+#line 3081
 ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3077
+#line 3081
 {
-#line 3077
+#line 3081
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3077
+#line 3081
 
-#line 3077
+#line 3081
  /* basic algorithm is:
-#line 3077
+#line 3081
   *   - ensure sane alignment of input data
-#line 3077
+#line 3081
   *   - copy (conversion happens automatically) input data
-#line 3077
+#line 3081
   *     to output
-#line 3077
+#line 3081
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3077
+#line 3081
   *     at next location for converted output
-#line 3077
+#line 3081
   */
-#line 3077
+#line 3081
   long i, j, ni;
-#line 3077
+#line 3081
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3077
+#line 3081
   short *xp;
-#line 3077
+#line 3081
   int nrange = 0;         /* number of range errors */
-#line 3077
+#line 3081
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3077
+#line 3081
   long cxp = (long) *((char**)xpp);
-#line 3077
+#line 3081
 
-#line 3077
+#line 3081
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3077
+#line 3081
   /* sjl: manually stripmine so we can limit amount of
-#line 3077
+#line 3081
    * vector work space reserved to LOOPCNT elements. Also
-#line 3077
+#line 3081
    * makes vectorisation easy */
-#line 3077
+#line 3081
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3077
+#line 3081
     ni=Min(nelems-j,LOOPCNT);
-#line 3077
+#line 3081
     if (realign) {
-#line 3077
+#line 3081
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3077
+#line 3081
       xp = tmp;
-#line 3077
+#line 3081
     } else {
-#line 3077
+#line 3081
       xp = (short *) *xpp;
-#line 3077
+#line 3081
     }
-#line 3077
+#line 3081
    /* copy the next block */
-#line 3077
+#line 3081
 #pragma cdir loopcnt=LOOPCNT
-#line 3077
+#line 3081
 #pragma cdir shortloop
-#line 3077
+#line 3081
     for (i=0; i<ni; i++) {
-#line 3077
+#line 3081
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3077
+#line 3081
      /* test for range errors (not always needed but do it anyway) */
-#line 3077
+#line 3081
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3077
+#line 3081
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3077
+#line 3081
       nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
-#line 3077
+#line 3081
     }
-#line 3077
+#line 3081
    /* update xpp and tp */
-#line 3077
+#line 3081
     if (realign) xp = (short *) *xpp;
-#line 3077
+#line 3081
     xp += ni;
-#line 3077
+#line 3081
     tp += ni;
-#line 3077
+#line 3081
     *xpp = (void*)xp;
-#line 3077
+#line 3081
   }
-#line 3077
+#line 3081
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3077
+#line 3081
 
-#line 3077
+#line 3081
 #else   /* not SX */
-#line 3077
+#line 3081
 	const char *xp = (const char *) *xpp;
-#line 3077
+#line 3081
 	int status = NC_NOERR;
-#line 3077
+#line 3081
 
-#line 3077
+#line 3081
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3077
+#line 3081
 	{
-#line 3077
+#line 3081
 		const int lstatus = ncx_get_short_uchar(xp, tp);
-#line 3077
+#line 3081
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3077
+#line 3081
 			status = lstatus;
-#line 3077
+#line 3081
 	}
-#line 3077
+#line 3081
 
-#line 3077
+#line 3081
 	*xpp = (const void *)xp;
-#line 3077
+#line 3081
 	return status;
-#line 3077
+#line 3081
 #endif
-#line 3077
+#line 3081
 }
-#line 3077
+#line 3081
 
 int
-#line 3078
+#line 3082
 ncx_getn_short_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3078
+#line 3082
 {
-#line 3078
+#line 3082
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3078
+#line 3082
 
-#line 3078
+#line 3082
  /* basic algorithm is:
-#line 3078
+#line 3082
   *   - ensure sane alignment of input data
-#line 3078
+#line 3082
   *   - copy (conversion happens automatically) input data
-#line 3078
+#line 3082
   *     to output
-#line 3078
+#line 3082
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3078
+#line 3082
   *     at next location for converted output
-#line 3078
+#line 3082
   */
-#line 3078
+#line 3082
   long i, j, ni;
-#line 3078
+#line 3082
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3078
+#line 3082
   short *xp;
-#line 3078
+#line 3082
   int nrange = 0;         /* number of range errors */
-#line 3078
+#line 3082
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3078
+#line 3082
   long cxp = (long) *((char**)xpp);
-#line 3078
+#line 3082
 
-#line 3078
+#line 3082
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3078
+#line 3082
   /* sjl: manually stripmine so we can limit amount of
-#line 3078
+#line 3082
    * vector work space reserved to LOOPCNT elements. Also
-#line 3078
+#line 3082
    * makes vectorisation easy */
-#line 3078
+#line 3082
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3078
+#line 3082
     ni=Min(nelems-j,LOOPCNT);
-#line 3078
+#line 3082
     if (realign) {
-#line 3078
+#line 3082
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3078
+#line 3082
       xp = tmp;
-#line 3078
+#line 3082
     } else {
-#line 3078
+#line 3082
       xp = (short *) *xpp;
-#line 3078
+#line 3082
     }
-#line 3078
+#line 3082
    /* copy the next block */
-#line 3078
+#line 3082
 #pragma cdir loopcnt=LOOPCNT
-#line 3078
+#line 3082
 #pragma cdir shortloop
-#line 3078
+#line 3082
     for (i=0; i<ni; i++) {
-#line 3078
+#line 3082
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3078
+#line 3082
      /* test for range errors (not always needed but do it anyway) */
-#line 3078
+#line 3082
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3078
+#line 3082
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3078
+#line 3082
       nrange += xp[i] > USHORT_MAX || xp[i] < 0;
-#line 3078
+#line 3082
     }
-#line 3078
+#line 3082
    /* update xpp and tp */
-#line 3078
+#line 3082
     if (realign) xp = (short *) *xpp;
-#line 3078
+#line 3082
     xp += ni;
-#line 3078
+#line 3082
     tp += ni;
-#line 3078
+#line 3082
     *xpp = (void*)xp;
-#line 3078
+#line 3082
   }
-#line 3078
+#line 3082
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3078
+#line 3082
 
-#line 3078
+#line 3082
 #else   /* not SX */
-#line 3078
+#line 3082
 	const char *xp = (const char *) *xpp;
-#line 3078
+#line 3082
 	int status = NC_NOERR;
-#line 3078
+#line 3082
 
-#line 3078
+#line 3082
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3078
+#line 3082
 	{
-#line 3078
+#line 3082
 		const int lstatus = ncx_get_short_ushort(xp, tp);
-#line 3078
+#line 3082
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3078
+#line 3082
 			status = lstatus;
-#line 3078
+#line 3082
 	}
-#line 3078
+#line 3082
 
-#line 3078
+#line 3082
 	*xpp = (const void *)xp;
-#line 3078
+#line 3082
 	return status;
-#line 3078
+#line 3082
 #endif
-#line 3078
+#line 3082
 }
-#line 3078
+#line 3082
 
 int
-#line 3079
+#line 3083
 ncx_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3079
+#line 3083
 {
-#line 3079
+#line 3083
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3079
+#line 3083
 
-#line 3079
+#line 3083
  /* basic algorithm is:
-#line 3079
+#line 3083
   *   - ensure sane alignment of input data
-#line 3079
+#line 3083
   *   - copy (conversion happens automatically) input data
-#line 3079
+#line 3083
   *     to output
-#line 3079
+#line 3083
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3079
+#line 3083
   *     at next location for converted output
-#line 3079
+#line 3083
   */
-#line 3079
+#line 3083
   long i, j, ni;
-#line 3079
+#line 3083
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3079
+#line 3083
   short *xp;
-#line 3079
+#line 3083
   int nrange = 0;         /* number of range errors */
-#line 3079
+#line 3083
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3079
+#line 3083
   long cxp = (long) *((char**)xpp);
-#line 3079
+#line 3083
 
-#line 3079
+#line 3083
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3079
+#line 3083
   /* sjl: manually stripmine so we can limit amount of
-#line 3079
+#line 3083
    * vector work space reserved to LOOPCNT elements. Also
-#line 3079
+#line 3083
    * makes vectorisation easy */
-#line 3079
+#line 3083
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3079
+#line 3083
     ni=Min(nelems-j,LOOPCNT);
-#line 3079
+#line 3083
     if (realign) {
-#line 3079
+#line 3083
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3079
+#line 3083
       xp = tmp;
-#line 3079
+#line 3083
     } else {
-#line 3079
+#line 3083
       xp = (short *) *xpp;
-#line 3079
+#line 3083
     }
-#line 3079
+#line 3083
    /* copy the next block */
-#line 3079
+#line 3083
 #pragma cdir loopcnt=LOOPCNT
-#line 3079
+#line 3083
 #pragma cdir shortloop
-#line 3079
+#line 3083
     for (i=0; i<ni; i++) {
-#line 3079
+#line 3083
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3079
+#line 3083
      /* test for range errors (not always needed but do it anyway) */
-#line 3079
+#line 3083
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3079
+#line 3083
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3079
+#line 3083
       nrange += xp[i] > UINT_MAX || xp[i] < 0;
-#line 3079
+#line 3083
     }
-#line 3079
+#line 3083
    /* update xpp and tp */
-#line 3079
+#line 3083
     if (realign) xp = (short *) *xpp;
-#line 3079
+#line 3083
     xp += ni;
-#line 3079
+#line 3083
     tp += ni;
-#line 3079
+#line 3083
     *xpp = (void*)xp;
-#line 3079
+#line 3083
   }
-#line 3079
+#line 3083
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3079
+#line 3083
 
-#line 3079
+#line 3083
 #else   /* not SX */
-#line 3079
+#line 3083
 	const char *xp = (const char *) *xpp;
-#line 3079
+#line 3083
 	int status = NC_NOERR;
-#line 3079
+#line 3083
 
-#line 3079
+#line 3083
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3079
+#line 3083
 	{
-#line 3079
+#line 3083
 		const int lstatus = ncx_get_short_uint(xp, tp);
-#line 3079
+#line 3083
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3079
+#line 3083
 			status = lstatus;
-#line 3079
+#line 3083
 	}
-#line 3079
+#line 3083
 
-#line 3079
+#line 3083
 	*xpp = (const void *)xp;
-#line 3079
+#line 3083
 	return status;
-#line 3079
+#line 3083
 #endif
-#line 3079
+#line 3083
 }
-#line 3079
+#line 3083
 
 int
-#line 3080
+#line 3084
 ncx_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3080
+#line 3084
 {
-#line 3080
+#line 3084
 #if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3080
+#line 3084
 
-#line 3080
+#line 3084
  /* basic algorithm is:
-#line 3080
+#line 3084
   *   - ensure sane alignment of input data
-#line 3080
+#line 3084
   *   - copy (conversion happens automatically) input data
-#line 3080
+#line 3084
   *     to output
-#line 3080
+#line 3084
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3080
+#line 3084
   *     at next location for converted output
-#line 3080
+#line 3084
   */
-#line 3080
+#line 3084
   long i, j, ni;
-#line 3080
+#line 3084
   short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3080
+#line 3084
   short *xp;
-#line 3080
+#line 3084
   int nrange = 0;         /* number of range errors */
-#line 3080
+#line 3084
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3080
+#line 3084
   long cxp = (long) *((char**)xpp);
-#line 3080
+#line 3084
 
-#line 3080
+#line 3084
   realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3080
+#line 3084
   /* sjl: manually stripmine so we can limit amount of
-#line 3080
+#line 3084
    * vector work space reserved to LOOPCNT elements. Also
-#line 3080
+#line 3084
    * makes vectorisation easy */
-#line 3080
+#line 3084
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3080
+#line 3084
     ni=Min(nelems-j,LOOPCNT);
-#line 3080
+#line 3084
     if (realign) {
-#line 3080
+#line 3084
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_SHORT));
-#line 3080
+#line 3084
       xp = tmp;
-#line 3080
+#line 3084
     } else {
-#line 3080
+#line 3084
       xp = (short *) *xpp;
-#line 3080
+#line 3084
     }
-#line 3080
+#line 3084
    /* copy the next block */
-#line 3080
+#line 3084
 #pragma cdir loopcnt=LOOPCNT
-#line 3080
+#line 3084
 #pragma cdir shortloop
-#line 3080
+#line 3084
     for (i=0; i<ni; i++) {
-#line 3080
+#line 3084
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3080
+#line 3084
      /* test for range errors (not always needed but do it anyway) */
-#line 3080
+#line 3084
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3080
+#line 3084
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3080
+#line 3084
       nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
-#line 3080
+#line 3084
     }
-#line 3080
+#line 3084
    /* update xpp and tp */
-#line 3080
+#line 3084
     if (realign) xp = (short *) *xpp;
-#line 3080
+#line 3084
     xp += ni;
-#line 3080
+#line 3084
     tp += ni;
-#line 3080
+#line 3084
     *xpp = (void*)xp;
-#line 3080
+#line 3084
   }
-#line 3080
+#line 3084
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3080
+#line 3084
 
-#line 3080
+#line 3084
 #else   /* not SX */
-#line 3080
+#line 3084
 	const char *xp = (const char *) *xpp;
-#line 3080
+#line 3084
 	int status = NC_NOERR;
-#line 3080
+#line 3084
 
-#line 3080
+#line 3084
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3080
+#line 3084
 	{
-#line 3080
+#line 3084
 		const int lstatus = ncx_get_short_ulonglong(xp, tp);
-#line 3080
+#line 3084
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3080
+#line 3084
 			status = lstatus;
-#line 3080
+#line 3084
 	}
-#line 3080
+#line 3084
 
-#line 3080
+#line 3084
 	*xpp = (const void *)xp;
-#line 3080
+#line 3084
 	return status;
-#line 3080
+#line 3084
 #endif
-#line 3080
+#line 3084
 }
-#line 3080
+#line 3084
 
 
 int
-#line 3082
+#line 3086
 ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3082
+#line 3086
 {
-#line 3082
+#line 3086
 	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3082
+#line 3086
 
-#line 3082
+#line 3086
 	const char *xp = (const char *) *xpp;
-#line 3082
+#line 3086
 	int status = NC_NOERR;
-#line 3082
+#line 3086
 
-#line 3082
+#line 3086
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3082
+#line 3086
 	{
-#line 3082
+#line 3086
 		const int lstatus = ncx_get_short_schar(xp, tp);
-#line 3082
+#line 3086
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3082
+#line 3086
 			status = lstatus;
-#line 3082
+#line 3086
 	}
-#line 3082
+#line 3086
 
-#line 3082
+#line 3086
 	if (rndup != 0)
-#line 3082
+#line 3086
 		xp += X_SIZEOF_SHORT;
-#line 3082
+#line 3086
 
-#line 3082
+#line 3086
 	*xpp = (void *)xp;
-#line 3082
+#line 3086
 	return status;
-#line 3082
+#line 3086
 }
-#line 3082
+#line 3086
 
 int
-#line 3083
+#line 3087
 ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3083
+#line 3087
 {
-#line 3083
+#line 3087
 	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3083
+#line 3087
 
-#line 3083
+#line 3087
 	const char *xp = (const char *) *xpp;
-#line 3083
+#line 3087
 	int status = NC_NOERR;
-#line 3083
+#line 3087
 
-#line 3083
+#line 3087
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3083
+#line 3087
 	{
-#line 3083
+#line 3087
 		const int lstatus = ncx_get_short_uchar(xp, tp);
-#line 3083
+#line 3087
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3083
+#line 3087
 			status = lstatus;
-#line 3083
+#line 3087
 	}
-#line 3083
+#line 3087
 
-#line 3083
+#line 3087
 	if (rndup != 0)
-#line 3083
+#line 3087
 		xp += X_SIZEOF_SHORT;
-#line 3083
+#line 3087
 
-#line 3083
+#line 3087
 	*xpp = (void *)xp;
-#line 3083
+#line 3087
 	return status;
-#line 3083
+#line 3087
 }
-#line 3083
+#line 3087
 
 int
-#line 3084
+#line 3088
 ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *tp)
-#line 3084
+#line 3088
 {
-#line 3084
+#line 3088
 	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3084
+#line 3088
 
-#line 3084
+#line 3088
 	const char *xp = (const char *) *xpp;
-#line 3084
+#line 3088
 	int status = NC_NOERR;
-#line 3084
+#line 3088
 
-#line 3084
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3084
-	{
-#line 3084
-		const int lstatus = ncx_get_short_short(xp, tp);
-#line 3084
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3084
-			status = lstatus;
-#line 3084
-	}
-#line 3084
-
-#line 3084
-	if (rndup != 0)
-#line 3084
-		xp += X_SIZEOF_SHORT;
-#line 3084
-
-#line 3084
-	*xpp = (void *)xp;
-#line 3084
-	return status;
-#line 3084
-}
-#line 3084
-
-int
-#line 3085
-ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp)
-#line 3085
-{
-#line 3085
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3085
-
-#line 3085
-	const char *xp = (const char *) *xpp;
-#line 3085
-	int status = NC_NOERR;
-#line 3085
-
-#line 3085
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3085
-	{
-#line 3085
-		const int lstatus = ncx_get_short_int(xp, tp);
-#line 3085
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3085
-			status = lstatus;
-#line 3085
-	}
-#line 3085
-
-#line 3085
-	if (rndup != 0)
-#line 3085
-		xp += X_SIZEOF_SHORT;
-#line 3085
-
-#line 3085
-	*xpp = (void *)xp;
-#line 3085
-	return status;
-#line 3085
-}
-#line 3085
-
-int
-#line 3086
-ncx_pad_getn_short_long(const void **xpp, size_t nelems, long *tp)
-#line 3086
-{
-#line 3086
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3086
-
-#line 3086
-	const char *xp = (const char *) *xpp;
-#line 3086
-	int status = NC_NOERR;
-#line 3086
-
-#line 3086
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3086
-	{
-#line 3086
-		const int lstatus = ncx_get_short_long(xp, tp);
-#line 3086
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3086
-			status = lstatus;
-#line 3086
-	}
-#line 3086
-
-#line 3086
-	if (rndup != 0)
-#line 3086
-		xp += X_SIZEOF_SHORT;
-#line 3086
-
-#line 3086
-	*xpp = (void *)xp;
-#line 3086
-	return status;
-#line 3086
-}
-#line 3086
-
-int
-#line 3087
-ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp)
-#line 3087
-{
-#line 3087
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3087
-
-#line 3087
-	const char *xp = (const char *) *xpp;
-#line 3087
-	int status = NC_NOERR;
-#line 3087
-
-#line 3087
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3087
-	{
-#line 3087
-		const int lstatus = ncx_get_short_float(xp, tp);
-#line 3087
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3087
-			status = lstatus;
-#line 3087
-	}
-#line 3087
-
-#line 3087
-	if (rndup != 0)
-#line 3087
-		xp += X_SIZEOF_SHORT;
-#line 3087
-
-#line 3087
-	*xpp = (void *)xp;
-#line 3087
-	return status;
-#line 3087
-}
-#line 3087
-
-int
-#line 3088
-ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
-#line 3088
-{
-#line 3088
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3088
-
-#line 3088
-	const char *xp = (const char *) *xpp;
-#line 3088
-	int status = NC_NOERR;
-#line 3088
-
-#line 3088
+#line 3088
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
 #line 3088
 	{
 #line 3088
-		const int lstatus = ncx_get_short_double(xp, tp);
+		const int lstatus = ncx_get_short_short(xp, tp);
 #line 3088
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3088
@@ -13145,7 +12977,7 @@ ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 3089
-ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp)
 #line 3089
 {
 #line 3089
@@ -13163,7 +12995,7 @@ ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
 #line 3089
 	{
 #line 3089
-		const int lstatus = ncx_get_short_uint(xp, tp);
+		const int lstatus = ncx_get_short_int(xp, tp);
 #line 3089
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3089
@@ -13188,7 +13020,7 @@ ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 3090
-ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_pad_getn_short_long(const void **xpp, size_t nelems, long *tp)
 #line 3090
 {
 #line 3090
@@ -13206,7 +13038,7 @@ ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 3090
 	{
 #line 3090
-		const int lstatus = ncx_get_short_longlong(xp, tp);
+		const int lstatus = ncx_get_short_long(xp, tp);
 #line 3090
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3090
@@ -13231,7 +13063,7 @@ ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 3091
-ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp)
 #line 3091
 {
 #line 3091
@@ -13249,7 +13081,7 @@ ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 3091
 	{
 #line 3091
-		const int lstatus = ncx_get_short_ulonglong(xp, tp);
+		const int lstatus = ncx_get_short_float(xp, tp);
 #line 3091
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3091
@@ -13274,7 +13106,7 @@ ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 
 int
 #line 3092
-ncx_pad_getn_short_ushort(const void **xpp, size_t nelems, ushort *tp)
+ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
 #line 3092
 {
 #line 3092
@@ -13292,7 +13124,7 @@ ncx_pad_getn_short_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 3092
 	{
 #line 3092
-		const int lstatus = ncx_get_short_ushort(xp, tp);
+		const int lstatus = ncx_get_short_double(xp, tp);
 #line 3092
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3092
@@ -13315,442 +13147,196 @@ ncx_pad_getn_short_ushort(const void **xpp, size_t nelems, ushort *tp)
 }
 #line 3092
 
-
-#if X_SIZEOF_SHORT == SIZEOF_SHORT
-/* optimized version */
-int
-ncx_putn_short_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-{
-#ifdef WORDS_BIGENDIAN
-	(void) memcpy(*xpp, tp, (size_t)nelems * X_SIZEOF_SHORT);
-# else
-	swapn2b(*xpp, tp, nelems);
-# endif
-	*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_SHORT);
-	return NC_NOERR;
-}
-#else
 int
-#line 3108
-ncx_putn_short_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3108
+#line 3093
+ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3093
 {
-#line 3108
-#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3108
-
-#line 3108
- /* basic algorithm is:
-#line 3108
-  *   - ensure sane alignment of output data
-#line 3108
-  *   - copy (conversion happens automatically) input data
-#line 3108
-  *     to output
-#line 3108
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3108
-  *     at next location for converted output
-#line 3108
-  */
-#line 3108
-  long i, j, ni;
-#line 3108
-  short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3108
-  short *xp;
-#line 3108
-  int nrange = 0;         /* number of range errors */
-#line 3108
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3108
-  long cxp = (long) *((char**)xpp);
-#line 3108
-
-#line 3108
-  realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3108
-  /* sjl: manually stripmine so we can limit amount of
-#line 3108
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3108
-   * makes vectorisation easy */
-#line 3108
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3108
-    ni=Min(nelems-j,LOOPCNT);
-#line 3108
-    if (realign) {
-#line 3108
-      xp = tmp;
-#line 3108
-    } else {
-#line 3108
-      xp = (short *) *xpp;
-#line 3108
-    }
-#line 3108
-   /* copy the next block */
-#line 3108
-#pragma cdir loopcnt=LOOPCNT
-#line 3108
-#pragma cdir shortloop
-#line 3108
-    for (i=0; i<ni; i++) {
-#line 3108
-      /* the normal case: */
-#line 3108
-      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
-#line 3108
-     /* test for range errors (not always needed but do it anyway) */
-#line 3108
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3108
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3108
-      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
-#line 3108
-    }
-#line 3108
-   /* copy workspace back if necessary */
-#line 3108
-    if (realign) {
-#line 3108
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
-#line 3108
-      xp = (short *) *xpp;
-#line 3108
-    }
-#line 3108
-   /* update xpp and tp */
-#line 3108
-    xp += ni;
-#line 3108
-    tp += ni;
-#line 3108
-    *xpp = (void*)xp;
-#line 3108
-  }
-#line 3108
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3108
-
-#line 3108
-#else   /* not SX */
-#line 3108
+#line 3093
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3093
 
-#line 3108
-	char *xp = (char *) *xpp;
-#line 3108
+#line 3093
+	const char *xp = (const char *) *xpp;
+#line 3093
 	int status = NC_NOERR;
-#line 3108
+#line 3093
 
-#line 3108
+#line 3093
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3108
+#line 3093
 	{
-#line 3108
-		int lstatus = ncx_put_short_short(xp, tp, fillp);
-#line 3108
+#line 3093
+		const int lstatus = ncx_get_short_uint(xp, tp);
+#line 3093
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3108
+#line 3093
 			status = lstatus;
-#line 3108
+#line 3093
 	}
-#line 3108
+#line 3093
+
+#line 3093
+	if (rndup != 0)
+#line 3093
+		xp += X_SIZEOF_SHORT;
+#line 3093
 
-#line 3108
+#line 3093
 	*xpp = (void *)xp;
-#line 3108
+#line 3093
 	return status;
-#line 3108
-#endif
-#line 3108
+#line 3093
 }
-#line 3108
+#line 3093
 
-#endif
 int
-#line 3110
-ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3110
+#line 3094
+ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3094
 {
-#line 3110
-#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3110
+#line 3094
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3094
 
-#line 3110
- /* basic algorithm is:
-#line 3110
-  *   - ensure sane alignment of output data
-#line 3110
-  *   - copy (conversion happens automatically) input data
-#line 3110
-  *     to output
-#line 3110
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3110
-  *     at next location for converted output
-#line 3110
-  */
-#line 3110
-  long i, j, ni;
-#line 3110
-  short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3110
-  short *xp;
-#line 3110
-  int nrange = 0;         /* number of range errors */
-#line 3110
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3110
-  long cxp = (long) *((char**)xpp);
-#line 3110
-
-#line 3110
-  realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3110
-  /* sjl: manually stripmine so we can limit amount of
-#line 3110
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3110
-   * makes vectorisation easy */
-#line 3110
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3110
-    ni=Min(nelems-j,LOOPCNT);
-#line 3110
-    if (realign) {
-#line 3110
-      xp = tmp;
-#line 3110
-    } else {
-#line 3110
-      xp = (short *) *xpp;
-#line 3110
-    }
-#line 3110
-   /* copy the next block */
-#line 3110
-#pragma cdir loopcnt=LOOPCNT
-#line 3110
-#pragma cdir shortloop
-#line 3110
-    for (i=0; i<ni; i++) {
-#line 3110
-      /* the normal case: */
-#line 3110
-      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
-#line 3110
-     /* test for range errors (not always needed but do it anyway) */
-#line 3110
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3110
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3110
-      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
-#line 3110
-    }
-#line 3110
-   /* copy workspace back if necessary */
-#line 3110
-    if (realign) {
-#line 3110
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
-#line 3110
-      xp = (short *) *xpp;
-#line 3110
-    }
-#line 3110
-   /* update xpp and tp */
-#line 3110
-    xp += ni;
-#line 3110
-    tp += ni;
-#line 3110
-    *xpp = (void*)xp;
-#line 3110
-  }
-#line 3110
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3110
-
-#line 3110
-#else   /* not SX */
-#line 3110
-
-#line 3110
-	char *xp = (char *) *xpp;
-#line 3110
+#line 3094
+	const char *xp = (const char *) *xpp;
+#line 3094
 	int status = NC_NOERR;
-#line 3110
+#line 3094
 
-#line 3110
+#line 3094
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3110
+#line 3094
 	{
-#line 3110
-		int lstatus = ncx_put_short_schar(xp, tp, fillp);
-#line 3110
+#line 3094
+		const int lstatus = ncx_get_short_longlong(xp, tp);
+#line 3094
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3110
+#line 3094
 			status = lstatus;
-#line 3110
+#line 3094
 	}
-#line 3110
+#line 3094
 
-#line 3110
+#line 3094
+	if (rndup != 0)
+#line 3094
+		xp += X_SIZEOF_SHORT;
+#line 3094
+
+#line 3094
 	*xpp = (void *)xp;
-#line 3110
+#line 3094
 	return status;
-#line 3110
-#endif
-#line 3110
+#line 3094
 }
-#line 3110
+#line 3094
 
 int
-#line 3111
-ncx_putn_short_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3111
+#line 3095
+ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 3095
 {
-#line 3111
-#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3111
+#line 3095
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3095
 
-#line 3111
- /* basic algorithm is:
-#line 3111
-  *   - ensure sane alignment of output data
-#line 3111
-  *   - copy (conversion happens automatically) input data
-#line 3111
-  *     to output
-#line 3111
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3111
-  *     at next location for converted output
-#line 3111
-  */
-#line 3111
-  long i, j, ni;
-#line 3111
-  short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3111
-  short *xp;
-#line 3111
-  int nrange = 0;         /* number of range errors */
-#line 3111
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3111
-  long cxp = (long) *((char**)xpp);
-#line 3111
+#line 3095
+	const char *xp = (const char *) *xpp;
+#line 3095
+	int status = NC_NOERR;
+#line 3095
 
-#line 3111
-  realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3111
-  /* sjl: manually stripmine so we can limit amount of
-#line 3111
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3111
-   * makes vectorisation easy */
-#line 3111
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3111
-    ni=Min(nelems-j,LOOPCNT);
-#line 3111
-    if (realign) {
-#line 3111
-      xp = tmp;
-#line 3111
-    } else {
-#line 3111
-      xp = (short *) *xpp;
-#line 3111
-    }
-#line 3111
-   /* copy the next block */
-#line 3111
-#pragma cdir loopcnt=LOOPCNT
-#line 3111
-#pragma cdir shortloop
-#line 3111
-    for (i=0; i<ni; i++) {
-#line 3111
-      /* the normal case: */
-#line 3111
-      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
-#line 3111
-     /* test for range errors (not always needed but do it anyway) */
-#line 3111
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3111
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3111
-      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
-#line 3111
-    }
-#line 3111
-   /* copy workspace back if necessary */
-#line 3111
-    if (realign) {
-#line 3111
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
-#line 3111
-      xp = (short *) *xpp;
-#line 3111
-    }
-#line 3111
-   /* update xpp and tp */
-#line 3111
-    xp += ni;
-#line 3111
-    tp += ni;
-#line 3111
-    *xpp = (void*)xp;
-#line 3111
-  }
-#line 3111
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3111
+#line 3095
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 3095
+	{
+#line 3095
+		const int lstatus = ncx_get_short_ulonglong(xp, tp);
+#line 3095
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3095
+			status = lstatus;
+#line 3095
+	}
+#line 3095
 
-#line 3111
-#else   /* not SX */
-#line 3111
+#line 3095
+	if (rndup != 0)
+#line 3095
+		xp += X_SIZEOF_SHORT;
+#line 3095
 
-#line 3111
-	char *xp = (char *) *xpp;
-#line 3111
+#line 3095
+	*xpp = (void *)xp;
+#line 3095
+	return status;
+#line 3095
+}
+#line 3095
+
+int
+#line 3096
+ncx_pad_getn_short_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 3096
+{
+#line 3096
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3096
+
+#line 3096
+	const char *xp = (const char *) *xpp;
+#line 3096
 	int status = NC_NOERR;
-#line 3111
+#line 3096
 
-#line 3111
+#line 3096
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3111
+#line 3096
 	{
-#line 3111
-		int lstatus = ncx_put_short_int(xp, tp, fillp);
-#line 3111
+#line 3096
+		const int lstatus = ncx_get_short_ushort(xp, tp);
+#line 3096
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3111
+#line 3096
 			status = lstatus;
-#line 3111
+#line 3096
 	}
-#line 3111
+#line 3096
+
+#line 3096
+	if (rndup != 0)
+#line 3096
+		xp += X_SIZEOF_SHORT;
+#line 3096
 
-#line 3111
+#line 3096
 	*xpp = (void *)xp;
-#line 3111
+#line 3096
 	return status;
-#line 3111
-#endif
-#line 3111
+#line 3096
 }
-#line 3111
+#line 3096
 
+
+#if X_SIZEOF_SHORT == SIZEOF_SHORT
+/* optimized version */
+int
+ncx_putn_short_short(void **xpp, size_t nelems, const short *tp, void *fillp)
+{
+#ifdef WORDS_BIGENDIAN
+	(void) memcpy(*xpp, tp, (size_t)nelems * X_SIZEOF_SHORT);
+# else
+	swapn2b(*xpp, tp, nelems);
+# endif
+	*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_SHORT);
+	return NC_NOERR;
+}
+#else
 int
 #line 3112
-ncx_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
+ncx_putn_short_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 3112
 {
 #line 3112
@@ -13868,7 +13454,7 @@ ncx_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3112
 	{
 #line 3112
-		int lstatus = ncx_put_short_long(xp, tp, fillp);
+		int lstatus = ncx_put_short_short(xp, tp, fillp);
 #line 3112
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3112
@@ -13887,148 +13473,10 @@ ncx_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 }
 #line 3112
 
-int
-#line 3113
-ncx_putn_short_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3113
-{
-#line 3113
-#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
-#line 3113
-
-#line 3113
- /* basic algorithm is:
-#line 3113
-  *   - ensure sane alignment of output data
-#line 3113
-  *   - copy (conversion happens automatically) input data
-#line 3113
-  *     to output
-#line 3113
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3113
-  *     at next location for converted output
-#line 3113
-  */
-#line 3113
-  long i, j, ni;
-#line 3113
-  short tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3113
-  short *xp;
-#line 3113
-  int nrange = 0;         /* number of range errors */
-#line 3113
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3113
-  long cxp = (long) *((char**)xpp);
-#line 3113
-
-#line 3113
-  realign = (cxp & 7) % SIZEOF_SHORT;
-#line 3113
-  /* sjl: manually stripmine so we can limit amount of
-#line 3113
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3113
-   * makes vectorisation easy */
-#line 3113
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3113
-    ni=Min(nelems-j,LOOPCNT);
-#line 3113
-    if (realign) {
-#line 3113
-      xp = tmp;
-#line 3113
-    } else {
-#line 3113
-      xp = (short *) *xpp;
-#line 3113
-    }
-#line 3113
-   /* copy the next block */
-#line 3113
-#pragma cdir loopcnt=LOOPCNT
-#line 3113
-#pragma cdir shortloop
-#line 3113
-    for (i=0; i<ni; i++) {
-#line 3113
-      /* the normal case: */
-#line 3113
-      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
-#line 3113
-     /* test for range errors (not always needed but do it anyway) */
-#line 3113
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3113
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3113
-      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
-#line 3113
-    }
-#line 3113
-   /* copy workspace back if necessary */
-#line 3113
-    if (realign) {
-#line 3113
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
-#line 3113
-      xp = (short *) *xpp;
-#line 3113
-    }
-#line 3113
-   /* update xpp and tp */
-#line 3113
-    xp += ni;
-#line 3113
-    tp += ni;
-#line 3113
-    *xpp = (void*)xp;
-#line 3113
-  }
-#line 3113
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3113
-
-#line 3113
-#else   /* not SX */
-#line 3113
-
-#line 3113
-	char *xp = (char *) *xpp;
-#line 3113
-	int status = NC_NOERR;
-#line 3113
-
-#line 3113
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3113
-	{
-#line 3113
-		int lstatus = ncx_put_short_float(xp, tp, fillp);
-#line 3113
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3113
-			status = lstatus;
-#line 3113
-	}
-#line 3113
-
-#line 3113
-	*xpp = (void *)xp;
-#line 3113
-	return status;
-#line 3113
 #endif
-#line 3113
-}
-#line 3113
-
 int
 #line 3114
-ncx_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
 #line 3114
 {
 #line 3114
@@ -14146,7 +13594,7 @@ ncx_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3114
 	{
 #line 3114
-		int lstatus = ncx_put_short_double(xp, tp, fillp);
+		int lstatus = ncx_put_short_schar(xp, tp, fillp);
 #line 3114
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3114
@@ -14167,7 +13615,7 @@ ncx_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 
 int
 #line 3115
-ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_putn_short_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3115
 {
 #line 3115
@@ -14285,7 +13733,7 @@ ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 #line 3115
 	{
 #line 3115
-		int lstatus = ncx_put_short_longlong(xp, tp, fillp);
+		int lstatus = ncx_put_short_int(xp, tp, fillp);
 #line 3115
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3115
@@ -14306,7 +13754,7 @@ ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void *fil
 
 int
 #line 3116
-ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+ncx_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3116
 {
 #line 3116
@@ -14382,7 +13830,7 @@ ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3116
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3116
-      nrange += tp[i] > X_SHORT_MAX ;
+      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
 #line 3116
     }
 #line 3116
@@ -14424,7 +13872,7 @@ ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3116
 	{
 #line 3116
-		int lstatus = ncx_put_short_uchar(xp, tp, fillp);
+		int lstatus = ncx_put_short_long(xp, tp, fillp);
 #line 3116
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3116
@@ -14445,7 +13893,7 @@ ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 
 int
 #line 3117
-ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_putn_short_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3117
 {
 #line 3117
@@ -14521,7 +13969,7 @@ ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3117
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3117
-      nrange += tp[i] > X_SHORT_MAX ;
+      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
 #line 3117
     }
 #line 3117
@@ -14563,7 +14011,7 @@ ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3117
 	{
 #line 3117
-		int lstatus = ncx_put_short_uint(xp, tp, fillp);
+		int lstatus = ncx_put_short_float(xp, tp, fillp);
 #line 3117
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3117
@@ -14584,7 +14032,7 @@ ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 3118
-ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3118
 {
 #line 3118
@@ -14660,7 +14108,7 @@ ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 #line 3118
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3118
-      nrange += tp[i] > X_SHORT_MAX ;
+      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
 #line 3118
     }
 #line 3118
@@ -14702,7 +14150,7 @@ ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 #line 3118
 	{
 #line 3118
-		int lstatus = ncx_put_short_ulonglong(xp, tp, fillp);
+		int lstatus = ncx_put_short_double(xp, tp, fillp);
 #line 3118
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3118
@@ -14723,7 +14171,7 @@ ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *f
 
 int
 #line 3119
-ncx_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
 #line 3119
 {
 #line 3119
@@ -14799,7 +14247,7 @@ ncx_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 3119
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3119
-      nrange += tp[i] > X_SHORT_MAX ;
+      nrange += tp[i] > X_SHORT_MAX || tp[i] < X_SHORT_MIN;
 #line 3119
     }
 #line 3119
@@ -14841,7 +14289,7 @@ ncx_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 3119
 	{
 #line 3119
-		int lstatus = ncx_put_short_ushort(xp, tp, fillp);
+		int lstatus = ncx_put_short_longlong(xp, tp, fillp);
 #line 3119
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3119
@@ -14860,44 +14308,270 @@ ncx_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 }
 #line 3119
 
-
 int
-#line 3121
-ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3121
+#line 3120
+ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+#line 3120
 {
-#line 3121
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3120
+#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 3120
+
+#line 3120
+ /* basic algorithm is:
+#line 3120
+  *   - ensure sane alignment of output data
+#line 3120
+  *   - copy (conversion happens automatically) input data
+#line 3120
+  *     to output
+#line 3120
+  *   - update tp to point at next unconverted input, and xpp to point
+#line 3120
+  *     at next location for converted output
+#line 3120
+  */
+#line 3120
+  long i, j, ni;
+#line 3120
+  short tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3120
+  short *xp;
+#line 3120
+  int nrange = 0;         /* number of range errors */
+#line 3120
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3120
+  long cxp = (long) *((char**)xpp);
+#line 3120
+
+#line 3120
+  realign = (cxp & 7) % SIZEOF_SHORT;
+#line 3120
+  /* sjl: manually stripmine so we can limit amount of
+#line 3120
+   * vector work space reserved to LOOPCNT elements. Also
+#line 3120
+   * makes vectorisation easy */
+#line 3120
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3120
+    ni=Min(nelems-j,LOOPCNT);
+#line 3120
+    if (realign) {
+#line 3120
+      xp = tmp;
+#line 3120
+    } else {
+#line 3120
+      xp = (short *) *xpp;
+#line 3120
+    }
+#line 3120
+   /* copy the next block */
+#line 3120
+#pragma cdir loopcnt=LOOPCNT
+#line 3120
+#pragma cdir shortloop
+#line 3120
+    for (i=0; i<ni; i++) {
+#line 3120
+      /* the normal case: */
+#line 3120
+      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 3120
+     /* test for range errors (not always needed but do it anyway) */
+#line 3120
+     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3120
+     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3120
+      nrange += tp[i] > X_SHORT_MAX ;
+#line 3120
+    }
+#line 3120
+   /* copy workspace back if necessary */
+#line 3120
+    if (realign) {
+#line 3120
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
+#line 3120
+      xp = (short *) *xpp;
+#line 3120
+    }
+#line 3120
+   /* update xpp and tp */
+#line 3120
+    xp += ni;
+#line 3120
+    tp += ni;
+#line 3120
+    *xpp = (void*)xp;
+#line 3120
+  }
+#line 3120
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3120
+
+#line 3120
+#else   /* not SX */
+#line 3120
+
+#line 3120
+	char *xp = (char *) *xpp;
+#line 3120
+	int status = NC_NOERR;
+#line 3120
+
+#line 3120
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 3120
+	{
+#line 3120
+		int lstatus = ncx_put_short_uchar(xp, tp, fillp);
+#line 3120
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3120
+			status = lstatus;
+#line 3120
+	}
+#line 3120
+
+#line 3120
+	*xpp = (void *)xp;
+#line 3120
+	return status;
+#line 3120
+#endif
+#line 3120
+}
+#line 3120
+
+int
+#line 3121
+ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 3121
+{
+#line 3121
+#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
 #line 3121
 
 #line 3121
-	char *xp = (char *) *xpp;
+ /* basic algorithm is:
 #line 3121
-	int status = NC_NOERR;
+  *   - ensure sane alignment of output data
+#line 3121
+  *   - copy (conversion happens automatically) input data
+#line 3121
+  *     to output
+#line 3121
+  *   - update tp to point at next unconverted input, and xpp to point
+#line 3121
+  *     at next location for converted output
+#line 3121
+  */
+#line 3121
+  long i, j, ni;
+#line 3121
+  short tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3121
+  short *xp;
+#line 3121
+  int nrange = 0;         /* number of range errors */
+#line 3121
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3121
+  long cxp = (long) *((char**)xpp);
 #line 3121
 
 #line 3121
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+  realign = (cxp & 7) % SIZEOF_SHORT;
 #line 3121
-	{
+  /* sjl: manually stripmine so we can limit amount of
 #line 3121
-		int lstatus = ncx_put_short_schar(xp, tp, fillp);
+   * vector work space reserved to LOOPCNT elements. Also
 #line 3121
-		if (status == NC_NOERR) /* report the first encountered error */
+   * makes vectorisation easy */
 #line 3121
-			status = lstatus;
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
 #line 3121
-	}
+    ni=Min(nelems-j,LOOPCNT);
+#line 3121
+    if (realign) {
+#line 3121
+      xp = tmp;
+#line 3121
+    } else {
+#line 3121
+      xp = (short *) *xpp;
+#line 3121
+    }
+#line 3121
+   /* copy the next block */
+#line 3121
+#pragma cdir loopcnt=LOOPCNT
+#line 3121
+#pragma cdir shortloop
+#line 3121
+    for (i=0; i<ni; i++) {
+#line 3121
+      /* the normal case: */
+#line 3121
+      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 3121
+     /* test for range errors (not always needed but do it anyway) */
+#line 3121
+     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3121
+     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3121
+      nrange += tp[i] > X_SHORT_MAX ;
+#line 3121
+    }
+#line 3121
+   /* copy workspace back if necessary */
+#line 3121
+    if (realign) {
+#line 3121
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
+#line 3121
+      xp = (short *) *xpp;
+#line 3121
+    }
+#line 3121
+   /* update xpp and tp */
+#line 3121
+    xp += ni;
+#line 3121
+    tp += ni;
+#line 3121
+    *xpp = (void*)xp;
+#line 3121
+  }
+#line 3121
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
 #line 3121
 
 #line 3121
-	if (rndup != 0)
+#else   /* not SX */
+#line 3121
+
+#line 3121
+	char *xp = (char *) *xpp;
+#line 3121
+	int status = NC_NOERR;
+#line 3121
+
+#line 3121
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
 #line 3121
 	{
 #line 3121
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+		int lstatus = ncx_put_short_uint(xp, tp, fillp);
 #line 3121
-		xp += X_SIZEOF_SHORT;
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3121
+			status = lstatus;
 #line 3121
 	}
 #line 3121
@@ -14907,46 +14581,136 @@ ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp, void *fillp
 #line 3121
 	return status;
 #line 3121
+#endif
+#line 3121
 }
 #line 3121
 
 int
 #line 3122
-ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
 #line 3122
 {
 #line 3122
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
 #line 3122
 
 #line 3122
-	char *xp = (char *) *xpp;
+ /* basic algorithm is:
 #line 3122
-	int status = NC_NOERR;
+  *   - ensure sane alignment of output data
+#line 3122
+  *   - copy (conversion happens automatically) input data
+#line 3122
+  *     to output
+#line 3122
+  *   - update tp to point at next unconverted input, and xpp to point
+#line 3122
+  *     at next location for converted output
+#line 3122
+  */
+#line 3122
+  long i, j, ni;
+#line 3122
+  short tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3122
+  short *xp;
+#line 3122
+  int nrange = 0;         /* number of range errors */
+#line 3122
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3122
+  long cxp = (long) *((char**)xpp);
 #line 3122
 
 #line 3122
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+  realign = (cxp & 7) % SIZEOF_SHORT;
 #line 3122
-	{
+  /* sjl: manually stripmine so we can limit amount of
 #line 3122
-		int lstatus = ncx_put_short_uchar(xp, tp, fillp);
+   * vector work space reserved to LOOPCNT elements. Also
 #line 3122
-		if (status == NC_NOERR) /* report the first encountered error */
+   * makes vectorisation easy */
 #line 3122
-			status = lstatus;
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
 #line 3122
-	}
+    ni=Min(nelems-j,LOOPCNT);
+#line 3122
+    if (realign) {
+#line 3122
+      xp = tmp;
+#line 3122
+    } else {
+#line 3122
+      xp = (short *) *xpp;
+#line 3122
+    }
+#line 3122
+   /* copy the next block */
+#line 3122
+#pragma cdir loopcnt=LOOPCNT
+#line 3122
+#pragma cdir shortloop
+#line 3122
+    for (i=0; i<ni; i++) {
+#line 3122
+      /* the normal case: */
+#line 3122
+      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
+#line 3122
+     /* test for range errors (not always needed but do it anyway) */
+#line 3122
+     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
+#line 3122
+     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
+#line 3122
+      nrange += tp[i] > X_SHORT_MAX ;
+#line 3122
+    }
+#line 3122
+   /* copy workspace back if necessary */
+#line 3122
+    if (realign) {
+#line 3122
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
+#line 3122
+      xp = (short *) *xpp;
+#line 3122
+    }
+#line 3122
+   /* update xpp and tp */
+#line 3122
+    xp += ni;
+#line 3122
+    tp += ni;
+#line 3122
+    *xpp = (void*)xp;
+#line 3122
+  }
+#line 3122
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
 #line 3122
 
 #line 3122
-	if (rndup != 0)
+#else   /* not SX */
+#line 3122
+
+#line 3122
+	char *xp = (char *) *xpp;
+#line 3122
+	int status = NC_NOERR;
+#line 3122
+
+#line 3122
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
 #line 3122
 	{
 #line 3122
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+		int lstatus = ncx_put_short_ulonglong(xp, tp, fillp);
 #line 3122
-		xp += X_SIZEOF_SHORT;
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3122
+			status = lstatus;
 #line 3122
 	}
 #line 3122
@@ -14956,110 +14720,154 @@ ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp
 #line 3122
 	return status;
 #line 3122
+#endif
+#line 3122
 }
 #line 3122
 
 int
 #line 3123
-ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *tp, void *fillp)
+ncx_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 3123
+{
+#line 3123
+#if defined(_SX) && _SX != 0 && X_SIZEOF_SHORT == SIZEOF_SHORT
+#line 3123
+
+#line 3123
+ /* basic algorithm is:
+#line 3123
+  *   - ensure sane alignment of output data
+#line 3123
+  *   - copy (conversion happens automatically) input data
+#line 3123
+  *     to output
+#line 3123
+  *   - update tp to point at next unconverted input, and xpp to point
+#line 3123
+  *     at next location for converted output
+#line 3123
+  */
+#line 3123
+  long i, j, ni;
+#line 3123
+  short tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3123
+  short *xp;
+#line 3123
+  int nrange = 0;         /* number of range errors */
+#line 3123
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3123
+  long cxp = (long) *((char**)xpp);
+#line 3123
+
+#line 3123
+  realign = (cxp & 7) % SIZEOF_SHORT;
+#line 3123
+  /* sjl: manually stripmine so we can limit amount of
 #line 3123
-{
+   * vector work space reserved to LOOPCNT elements. Also
 #line 3123
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+   * makes vectorisation easy */
 #line 3123
-
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
 #line 3123
-	char *xp = (char *) *xpp;
+    ni=Min(nelems-j,LOOPCNT);
 #line 3123
-	int status = NC_NOERR;
+    if (realign) {
 #line 3123
-
+      xp = tmp;
 #line 3123
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+    } else {
 #line 3123
-	{
+      xp = (short *) *xpp;
 #line 3123
-		int lstatus = ncx_put_short_short(xp, tp, fillp);
+    }
 #line 3123
-		if (status == NC_NOERR) /* report the first encountered error */
+   /* copy the next block */
 #line 3123
-			status = lstatus;
+#pragma cdir loopcnt=LOOPCNT
 #line 3123
-	}
+#pragma cdir shortloop
 #line 3123
-
+    for (i=0; i<ni; i++) {
 #line 3123
-	if (rndup != 0)
+      /* the normal case: */
 #line 3123
-	{
+      xp[i] = (short) Max( X_SHORT_MIN, Min(X_SHORT_MAX, (short) tp[i]));
 #line 3123
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+     /* test for range errors (not always needed but do it anyway) */
 #line 3123
-		xp += X_SIZEOF_SHORT;
+     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
 #line 3123
-	}
+     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3123
-
+      nrange += tp[i] > X_SHORT_MAX ;
 #line 3123
-	*xpp = (void *)xp;
+    }
 #line 3123
-	return status;
+   /* copy workspace back if necessary */
 #line 3123
-}
+    if (realign) {
+#line 3123
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_SHORT);
+#line 3123
+      xp = (short *) *xpp;
+#line 3123
+    }
+#line 3123
+   /* update xpp and tp */
+#line 3123
+    xp += ni;
+#line 3123
+    tp += ni;
+#line 3123
+    *xpp = (void*)xp;
+#line 3123
+  }
+#line 3123
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
 #line 3123
 
-int
-#line 3124
-ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3124
-{
-#line 3124
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3124
+#line 3123
+#else   /* not SX */
+#line 3123
 
-#line 3124
+#line 3123
 	char *xp = (char *) *xpp;
-#line 3124
+#line 3123
 	int status = NC_NOERR;
-#line 3124
+#line 3123
 
-#line 3124
+#line 3123
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
-#line 3124
+#line 3123
 	{
-#line 3124
-		int lstatus = ncx_put_short_int(xp, tp, fillp);
-#line 3124
+#line 3123
+		int lstatus = ncx_put_short_ushort(xp, tp, fillp);
+#line 3123
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3124
+#line 3123
 			status = lstatus;
-#line 3124
-	}
-#line 3124
-
-#line 3124
-	if (rndup != 0)
-#line 3124
-	{
-#line 3124
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
-#line 3124
-		xp += X_SIZEOF_SHORT;
-#line 3124
+#line 3123
 	}
-#line 3124
+#line 3123
 
-#line 3124
+#line 3123
 	*xpp = (void *)xp;
-#line 3124
+#line 3123
 	return status;
-#line 3124
+#line 3123
+#endif
+#line 3123
 }
-#line 3124
+#line 3123
+
 
 int
 #line 3125
-ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
+ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
 #line 3125
 {
 #line 3125
@@ -15077,7 +14885,7 @@ ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3125
 	{
 #line 3125
-		int lstatus = ncx_put_short_long(xp, tp, fillp);
+		int lstatus = ncx_put_short_schar(xp, tp, fillp);
 #line 3125
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3125
@@ -15108,7 +14916,7 @@ ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 
 int
 #line 3126
-ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp, void *fillp)
+ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3126
 {
 #line 3126
@@ -15126,7 +14934,7 @@ ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp, void *fillp
 #line 3126
 	{
 #line 3126
-		int lstatus = ncx_put_short_float(xp, tp, fillp);
+		int lstatus = ncx_put_short_uchar(xp, tp, fillp);
 #line 3126
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3126
@@ -15157,7 +14965,7 @@ ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp, void *fillp
 
 int
 #line 3127
-ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 3127
 {
 #line 3127
@@ -15175,7 +14983,7 @@ ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fil
 #line 3127
 	{
 #line 3127
-		int lstatus = ncx_put_short_double(xp, tp, fillp);
+		int lstatus = ncx_put_short_short(xp, tp, fillp);
 #line 3127
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3127
@@ -15206,7 +15014,7 @@ ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fil
 
 int
 #line 3128
-ncx_pad_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3128
 {
 #line 3128
@@ -15224,7 +15032,7 @@ ncx_pad_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3128
 	{
 #line 3128
-		int lstatus = ncx_put_short_uint(xp, tp, fillp);
+		int lstatus = ncx_put_short_int(xp, tp, fillp);
 #line 3128
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3128
@@ -15255,7 +15063,7 @@ ncx_pad_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 3129
-ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3129
 {
 #line 3129
@@ -15273,7 +15081,7 @@ ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void
 #line 3129
 	{
 #line 3129
-		int lstatus = ncx_put_short_longlong(xp, tp, fillp);
+		int lstatus = ncx_put_short_long(xp, tp, fillp);
 #line 3129
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3129
@@ -15304,7 +15112,7 @@ ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void
 
 int
 #line 3130
-ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3130
 {
 #line 3130
@@ -15322,7 +15130,7 @@ ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 #line 3130
 	{
 #line 3130
-		int lstatus = ncx_put_short_ulonglong(xp, tp, fillp);
+		int lstatus = ncx_put_short_float(xp, tp, fillp);
 #line 3130
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3130
@@ -15353,7 +15161,7 @@ ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, voi
 
 int
 #line 3131
-ncx_pad_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3131
 {
 #line 3131
@@ -15371,7 +15179,7 @@ ncx_pad_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 #line 3131
 	{
 #line 3131
-		int lstatus = ncx_put_short_ushort(xp, tp, fillp);
+		int lstatus = ncx_put_short_double(xp, tp, fillp);
 #line 3131
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3131
@@ -15400,415 +15208,223 @@ ncx_pad_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fil
 }
 #line 3131
 
-
-
-/* ushort --------------------------------------------------------------------*/
-
-#if X_SIZEOF_USHORT == SIZEOF_USHORT
-/* optimized version */
-int
-ncx_getn_ushort_ushort(const void **xpp, size_t nelems, unsigned short *tp)
-{
-#ifdef WORDS_BIGENDIAN
-	(void) memcpy(tp, *xpp, (size_t)nelems * SIZEOF_USHORT);
-# else
-	swapn2b(tp, *xpp, nelems);
-# endif
-	*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_USHORT);
-	return NC_NOERR;
-}
-#else
-int
-#line 3150
-ncx_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3150
-{
-#line 3150
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#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
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3150
-  ushort *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_USHORT;
-#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, (size_t)(ni*SIZEOF_USHORT));
-#line 3150
-      xp = tmp;
-#line 3150
-    } else {
-#line 3150
-      xp = (ushort *) *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] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) 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] > USHORT_MAX ;
-#line 3150
-    }
-#line 3150
-   /* update xpp and tp */
-#line 3150
-    if (realign) xp = (ushort *) *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_USHORT, tp++)
-#line 3150
-	{
-#line 3150
-		const int lstatus = ncx_get_ushort_ushort(xp, tp);
-#line 3150
-		if (status == NC_NOERR) /* report the first encountered error */
-#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
-
-#endif
 int
-#line 3152
-ncx_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3152
+#line 3132
+ncx_pad_putn_short_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 3132
 {
-#line 3152
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#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
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3152
-  ushort *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 3132
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3132
 
-#line 3152
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#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, (size_t)(ni*SIZEOF_USHORT));
-#line 3152
-      xp = tmp;
-#line 3152
-    } else {
-#line 3152
-      xp = (ushort *) *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] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) 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] > SCHAR_MAX ;
-#line 3152
-    }
-#line 3152
-   /* update xpp and tp */
-#line 3152
-    if (realign) xp = (ushort *) *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 3132
+	char *xp = (char *) *xpp;
+#line 3132
+	int status = NC_NOERR;
+#line 3132
 
-#line 3152
-#else   /* not SX */
-#line 3152
-	const char *xp = (const char *) *xpp;
-#line 3152
+#line 3132
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 3132
+	{
+#line 3132
+		int lstatus = ncx_put_short_uint(xp, tp, fillp);
+#line 3132
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3132
+			status = lstatus;
+#line 3132
+	}
+#line 3132
+
+#line 3132
+	if (rndup != 0)
+#line 3132
+	{
+#line 3132
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+#line 3132
+		xp += X_SIZEOF_SHORT;
+#line 3132
+	}
+#line 3132
+
+#line 3132
+	*xpp = (void *)xp;
+#line 3132
+	return status;
+#line 3132
+}
+#line 3132
+
+int
+#line 3133
+ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 3133
+{
+#line 3133
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3133
+
+#line 3133
+	char *xp = (char *) *xpp;
+#line 3133
 	int status = NC_NOERR;
-#line 3152
+#line 3133
 
-#line 3152
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3152
+#line 3133
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 3133
 	{
-#line 3152
-		const int lstatus = ncx_get_ushort_schar(xp, tp);
-#line 3152
+#line 3133
+		int lstatus = ncx_put_short_longlong(xp, tp, fillp);
+#line 3133
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3152
+#line 3133
 			status = lstatus;
-#line 3152
+#line 3133
 	}
-#line 3152
+#line 3133
 
-#line 3152
-	*xpp = (const void *)xp;
-#line 3152
+#line 3133
+	if (rndup != 0)
+#line 3133
+	{
+#line 3133
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+#line 3133
+		xp += X_SIZEOF_SHORT;
+#line 3133
+	}
+#line 3133
+
+#line 3133
+	*xpp = (void *)xp;
+#line 3133
 	return status;
-#line 3152
-#endif
-#line 3152
+#line 3133
 }
-#line 3152
+#line 3133
 
 int
-#line 3153
-ncx_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
-#line 3153
+#line 3134
+ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+#line 3134
 {
-#line 3153
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#line 3153
+#line 3134
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3134
 
-#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
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3153
-  ushort *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 3134
+	char *xp = (char *) *xpp;
+#line 3134
+	int status = NC_NOERR;
+#line 3134
 
-#line 3153
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#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, (size_t)(ni*SIZEOF_USHORT));
-#line 3153
-      xp = tmp;
-#line 3153
-    } else {
-#line 3153
-      xp = (ushort *) *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] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) 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] > SHORT_MAX ;
-#line 3153
-    }
-#line 3153
-   /* update xpp and tp */
-#line 3153
-    if (realign) xp = (ushort *) *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 3134
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 3134
+	{
+#line 3134
+		int lstatus = ncx_put_short_ulonglong(xp, tp, fillp);
+#line 3134
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3134
+			status = lstatus;
+#line 3134
+	}
+#line 3134
 
-#line 3153
-#else   /* not SX */
-#line 3153
-	const char *xp = (const char *) *xpp;
-#line 3153
+#line 3134
+	if (rndup != 0)
+#line 3134
+	{
+#line 3134
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+#line 3134
+		xp += X_SIZEOF_SHORT;
+#line 3134
+	}
+#line 3134
+
+#line 3134
+	*xpp = (void *)xp;
+#line 3134
+	return status;
+#line 3134
+}
+#line 3134
+
+int
+#line 3135
+ncx_pad_putn_short_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 3135
+{
+#line 3135
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3135
+
+#line 3135
+	char *xp = (char *) *xpp;
+#line 3135
 	int status = NC_NOERR;
-#line 3153
+#line 3135
 
-#line 3153
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3153
+#line 3135
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
+#line 3135
 	{
-#line 3153
-		const int lstatus = ncx_get_ushort_short(xp, tp);
-#line 3153
+#line 3135
+		int lstatus = ncx_put_short_ushort(xp, tp, fillp);
+#line 3135
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3153
+#line 3135
 			status = lstatus;
-#line 3153
+#line 3135
 	}
-#line 3153
+#line 3135
 
-#line 3153
-	*xpp = (const void *)xp;
-#line 3153
+#line 3135
+	if (rndup != 0)
+#line 3135
+	{
+#line 3135
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_SHORT));
+#line 3135
+		xp += X_SIZEOF_SHORT;
+#line 3135
+	}
+#line 3135
+
+#line 3135
+	*xpp = (void *)xp;
+#line 3135
 	return status;
-#line 3153
-#endif
-#line 3153
+#line 3135
 }
-#line 3153
+#line 3135
+
+
+
+/* ushort --------------------------------------------------------------------*/
 
+#if X_SIZEOF_USHORT == SIZEOF_USHORT
+/* optimized version */
+int
+ncx_getn_ushort_ushort(const void **xpp, size_t nelems, unsigned short *tp)
+{
+#ifdef WORDS_BIGENDIAN
+	(void) memcpy(tp, *xpp, (size_t)nelems * SIZEOF_USHORT);
+# else
+	swapn2b(tp, *xpp, nelems);
+# endif
+	*xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_USHORT);
+	return NC_NOERR;
+}
+#else
 int
 #line 3154
-ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
+ncx_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 3154
 {
 #line 3154
@@ -15876,7 +15492,7 @@ ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
 #line 3154
     for (i=0; i<ni; i++) {
 #line 3154
-      tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
+      tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
 #line 3154
      /* test for range errors (not always needed but do it anyway) */
 #line 3154
@@ -15884,7 +15500,7 @@ ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
 #line 3154
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3154
-      nrange += xp[i] > INT_MAX ;
+      nrange += xp[i] > USHORT_MAX ;
 #line 3154
     }
 #line 3154
@@ -15916,7 +15532,7 @@ ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
 #line 3154
 	{
 #line 3154
-		const int lstatus = ncx_get_ushort_int(xp, tp);
+		const int lstatus = ncx_get_ushort_ushort(xp, tp);
 #line 3154
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3154
@@ -15935,138 +15551,10 @@ ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
 }
 #line 3154
 
-int
-#line 3155
-ncx_getn_ushort_long(const void **xpp, size_t nelems, long *tp)
-#line 3155
-{
-#line 3155
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#line 3155
-
-#line 3155
- /* basic algorithm is:
-#line 3155
-  *   - ensure sane alignment of input data
-#line 3155
-  *   - copy (conversion happens automatically) input data
-#line 3155
-  *     to output
-#line 3155
-  *   - update xpp to point at next unconverted input, and tp to point
-#line 3155
-  *     at next location for converted output
-#line 3155
-  */
-#line 3155
-  long i, j, ni;
-#line 3155
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3155
-  ushort *xp;
-#line 3155
-  int nrange = 0;         /* number of range errors */
-#line 3155
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3155
-  long cxp = (long) *((char**)xpp);
-#line 3155
-
-#line 3155
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#line 3155
-  /* sjl: manually stripmine so we can limit amount of
-#line 3155
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3155
-   * makes vectorisation easy */
-#line 3155
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3155
-    ni=Min(nelems-j,LOOPCNT);
-#line 3155
-    if (realign) {
-#line 3155
-      memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_USHORT));
-#line 3155
-      xp = tmp;
-#line 3155
-    } else {
-#line 3155
-      xp = (ushort *) *xpp;
-#line 3155
-    }
-#line 3155
-   /* copy the next block */
-#line 3155
-#pragma cdir loopcnt=LOOPCNT
-#line 3155
-#pragma cdir shortloop
-#line 3155
-    for (i=0; i<ni; i++) {
-#line 3155
-      tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3155
-     /* test for range errors (not always needed but do it anyway) */
-#line 3155
-     /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3155
-     /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3155
-      nrange += xp[i] > LONG_MAX ;
-#line 3155
-    }
-#line 3155
-   /* update xpp and tp */
-#line 3155
-    if (realign) xp = (ushort *) *xpp;
-#line 3155
-    xp += ni;
-#line 3155
-    tp += ni;
-#line 3155
-    *xpp = (void*)xp;
-#line 3155
-  }
-#line 3155
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3155
-
-#line 3155
-#else   /* not SX */
-#line 3155
-	const char *xp = (const char *) *xpp;
-#line 3155
-	int status = NC_NOERR;
-#line 3155
-
-#line 3155
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3155
-	{
-#line 3155
-		const int lstatus = ncx_get_ushort_long(xp, tp);
-#line 3155
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3155
-			status = lstatus;
-#line 3155
-	}
-#line 3155
-
-#line 3155
-	*xpp = (const void *)xp;
-#line 3155
-	return status;
-#line 3155
 #endif
-#line 3155
-}
-#line 3155
-
 int
 #line 3156
-ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
+ncx_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
 #line 3156
 {
 #line 3156
@@ -16134,7 +15622,7 @@ ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 #line 3156
     for (i=0; i<ni; i++) {
 #line 3156
-      tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
+      tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
 #line 3156
      /* test for range errors (not always needed but do it anyway) */
 #line 3156
@@ -16142,7 +15630,7 @@ ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 #line 3156
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3156
-      nrange += xp[i] > FLOAT_MAX ;
+      nrange += xp[i] > SCHAR_MAX ;
 #line 3156
     }
 #line 3156
@@ -16174,7 +15662,7 @@ ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 #line 3156
 	{
 #line 3156
-		const int lstatus = ncx_get_ushort_float(xp, tp);
+		const int lstatus = ncx_get_ushort_schar(xp, tp);
 #line 3156
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3156
@@ -16195,7 +15683,7 @@ ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 
 int
 #line 3157
-ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
+ncx_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
 #line 3157
 {
 #line 3157
@@ -16263,7 +15751,7 @@ ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 #line 3157
     for (i=0; i<ni; i++) {
 #line 3157
-      tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
+      tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
 #line 3157
      /* test for range errors (not always needed but do it anyway) */
 #line 3157
@@ -16271,7 +15759,7 @@ ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 #line 3157
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3157
-      nrange += xp[i] > DOUBLE_MAX ;
+      nrange += xp[i] > SHORT_MAX ;
 #line 3157
     }
 #line 3157
@@ -16303,7 +15791,7 @@ ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 #line 3157
 	{
 #line 3157
-		const int lstatus = ncx_get_ushort_double(xp, tp);
+		const int lstatus = ncx_get_ushort_short(xp, tp);
 #line 3157
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3157
@@ -16324,7 +15812,7 @@ ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 3158
-ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
 #line 3158
 {
 #line 3158
@@ -16392,7 +15880,7 @@ ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 3158
     for (i=0; i<ni; i++) {
 #line 3158
-      tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+      tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
 #line 3158
      /* test for range errors (not always needed but do it anyway) */
 #line 3158
@@ -16400,7 +15888,7 @@ ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 3158
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3158
-      nrange += xp[i] > LONGLONG_MAX ;
+      nrange += xp[i] > INT_MAX ;
 #line 3158
     }
 #line 3158
@@ -16432,7 +15920,7 @@ ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 3158
 	{
 #line 3158
-		const int lstatus = ncx_get_ushort_longlong(xp, tp);
+		const int lstatus = ncx_get_ushort_int(xp, tp);
 #line 3158
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3158
@@ -16453,7 +15941,7 @@ ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 3159
-ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
+ncx_getn_ushort_long(const void **xpp, size_t nelems, long *tp)
 #line 3159
 {
 #line 3159
@@ -16521,7 +16009,7 @@ ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 3159
     for (i=0; i<ni; i++) {
 #line 3159
-      tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+      tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
 #line 3159
      /* test for range errors (not always needed but do it anyway) */
 #line 3159
@@ -16529,7 +16017,7 @@ ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 3159
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3159
-      nrange += xp[i] > UCHAR_MAX ;
+      nrange += xp[i] > LONG_MAX ;
 #line 3159
     }
 #line 3159
@@ -16561,7 +16049,7 @@ ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 3159
 	{
 #line 3159
-		const int lstatus = ncx_get_ushort_uchar(xp, tp);
+		const int lstatus = ncx_get_ushort_long(xp, tp);
 #line 3159
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3159
@@ -16582,7 +16070,7 @@ ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 
 int
 #line 3160
-ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 #line 3160
 {
 #line 3160
@@ -16650,7 +16138,7 @@ ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
 #line 3160
     for (i=0; i<ni; i++) {
 #line 3160
-      tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+      tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
 #line 3160
      /* test for range errors (not always needed but do it anyway) */
 #line 3160
@@ -16658,7 +16146,7 @@ ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
 #line 3160
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3160
-      nrange += xp[i] > UINT_MAX ;
+      nrange += xp[i] > FLOAT_MAX ;
 #line 3160
     }
 #line 3160
@@ -16690,7 +16178,7 @@ ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
 #line 3160
 	{
 #line 3160
-		const int lstatus = ncx_get_ushort_uint(xp, tp);
+		const int lstatus = ncx_get_ushort_float(xp, tp);
 #line 3160
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3160
@@ -16711,7 +16199,7 @@ ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 3161
-ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 #line 3161
 {
 #line 3161
@@ -16779,7 +16267,7 @@ ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 3161
     for (i=0; i<ni; i++) {
 #line 3161
-      tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+      tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
 #line 3161
      /* test for range errors (not always needed but do it anyway) */
 #line 3161
@@ -16787,7 +16275,7 @@ ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 3161
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
 #line 3161
-      nrange += xp[i] > ULONGLONG_MAX ;
+      nrange += xp[i] > DOUBLE_MAX ;
 #line 3161
     }
 #line 3161
@@ -16819,7 +16307,7 @@ ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 3161
 	{
 #line 3161
-		const int lstatus = ncx_get_ushort_ulonglong(xp, tp);
+		const int lstatus = ncx_get_ushort_double(xp, tp);
 #line 3161
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3161
@@ -16838,17 +16326,235 @@ ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 }
 #line 3161
 
+int
+#line 3162
+ncx_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3162
+{
+#line 3162
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 3162
+
+#line 3162
+ /* basic algorithm is:
+#line 3162
+  *   - ensure sane alignment of input data
+#line 3162
+  *   - copy (conversion happens automatically) input data
+#line 3162
+  *     to output
+#line 3162
+  *   - update xpp to point at next unconverted input, and tp to point
+#line 3162
+  *     at next location for converted output
+#line 3162
+  */
+#line 3162
+  long i, j, ni;
+#line 3162
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3162
+  ushort *xp;
+#line 3162
+  int nrange = 0;         /* number of range errors */
+#line 3162
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3162
+  long cxp = (long) *((char**)xpp);
+#line 3162
+
+#line 3162
+  realign = (cxp & 7) % SIZEOF_USHORT;
+#line 3162
+  /* sjl: manually stripmine so we can limit amount of
+#line 3162
+   * vector work space reserved to LOOPCNT elements. Also
+#line 3162
+   * makes vectorisation easy */
+#line 3162
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3162
+    ni=Min(nelems-j,LOOPCNT);
+#line 3162
+    if (realign) {
+#line 3162
+      memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_USHORT));
+#line 3162
+      xp = tmp;
+#line 3162
+    } else {
+#line 3162
+      xp = (ushort *) *xpp;
+#line 3162
+    }
+#line 3162
+   /* copy the next block */
+#line 3162
+#pragma cdir loopcnt=LOOPCNT
+#line 3162
+#pragma cdir shortloop
+#line 3162
+    for (i=0; i<ni; i++) {
+#line 3162
+      tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
+#line 3162
+     /* test for range errors (not always needed but do it anyway) */
+#line 3162
+     /* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3162
+     /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3162
+      nrange += xp[i] > LONGLONG_MAX ;
+#line 3162
+    }
+#line 3162
+   /* update xpp and tp */
+#line 3162
+    if (realign) xp = (ushort *) *xpp;
+#line 3162
+    xp += ni;
+#line 3162
+    tp += ni;
+#line 3162
+    *xpp = (void*)xp;
+#line 3162
+  }
+#line 3162
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
+#line 3162
+
+#line 3162
+#else   /* not SX */
+#line 3162
+	const char *xp = (const char *) *xpp;
+#line 3162
+	int status = NC_NOERR;
+#line 3162
+
+#line 3162
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 3162
+	{
+#line 3162
+		const int lstatus = ncx_get_ushort_longlong(xp, tp);
+#line 3162
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3162
+			status = lstatus;
+#line 3162
+	}
+#line 3162
+
+#line 3162
+	*xpp = (const void *)xp;
+#line 3162
+	return status;
+#line 3162
+#endif
+#line 3162
+}
+#line 3162
 
 int
 #line 3163
-ncx_pad_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
+ncx_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 3163
 {
 #line 3163
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 3163
+
+#line 3163
+ /* basic algorithm is:
+#line 3163
+  *   - ensure sane alignment of input data
+#line 3163
+  *   - copy (conversion happens automatically) input data
+#line 3163
+  *     to output
+#line 3163
+  *   - update xpp to point at next unconverted input, and tp to point
+#line 3163
+  *     at next location for converted output
+#line 3163
+  */
+#line 3163
+  long i, j, ni;
+#line 3163
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3163
+  ushort *xp;
+#line 3163
+  int nrange = 0;         /* number of range errors */
+#line 3163
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3163
+  long cxp = (long) *((char**)xpp);
+#line 3163
+
+#line 3163
+  realign = (cxp & 7) % SIZEOF_USHORT;
+#line 3163
+  /* sjl: manually stripmine so we can limit amount of
+#line 3163
+   * vector work space reserved to LOOPCNT elements. Also
+#line 3163
+   * makes vectorisation easy */
+#line 3163
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3163
+    ni=Min(nelems-j,LOOPCNT);
+#line 3163
+    if (realign) {
+#line 3163
+      memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_USHORT));
+#line 3163
+      xp = tmp;
+#line 3163
+    } else {
+#line 3163
+      xp = (ushort *) *xpp;
+#line 3163
+    }
+#line 3163
+   /* copy the next block */
+#line 3163
+#pragma cdir loopcnt=LOOPCNT
+#line 3163
+#pragma cdir shortloop
+#line 3163
+    for (i=0; i<ni; i++) {
+#line 3163
+      tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
+#line 3163
+     /* test for range errors (not always needed but do it anyway) */
+#line 3163
+     /* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3163
+     /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3163
+      nrange += xp[i] > UCHAR_MAX ;
+#line 3163
+    }
+#line 3163
+   /* update xpp and tp */
+#line 3163
+    if (realign) xp = (ushort *) *xpp;
+#line 3163
+    xp += ni;
+#line 3163
+    tp += ni;
+#line 3163
+    *xpp = (void*)xp;
+#line 3163
+  }
+#line 3163
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
 #line 3163
 
 #line 3163
+#else   /* not SX */
+#line 3163
 	const char *xp = (const char *) *xpp;
 #line 3163
 	int status = NC_NOERR;
@@ -16859,7 +16565,7 @@ ncx_pad_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
 #line 3163
 	{
 #line 3163
-		const int lstatus = ncx_get_ushort_schar(xp, tp);
+		const int lstatus = ncx_get_ushort_uchar(xp, tp);
 #line 3163
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3163
@@ -16869,29 +16575,115 @@ ncx_pad_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
 #line 3163
 
 #line 3163
-	if (rndup != 0)
-#line 3163
-		xp += X_SIZEOF_USHORT;
-#line 3163
-
-#line 3163
-	*xpp = (void *)xp;
+	*xpp = (const void *)xp;
 #line 3163
 	return status;
 #line 3163
+#endif
+#line 3163
 }
 #line 3163
 
 int
 #line 3164
-ncx_pad_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
+ncx_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3164
+{
+#line 3164
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 3164
+
+#line 3164
+ /* basic algorithm is:
+#line 3164
+  *   - ensure sane alignment of input data
+#line 3164
+  *   - copy (conversion happens automatically) input data
+#line 3164
+  *     to output
+#line 3164
+  *   - update xpp to point at next unconverted input, and tp to point
+#line 3164
+  *     at next location for converted output
+#line 3164
+  */
+#line 3164
+  long i, j, ni;
+#line 3164
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3164
+  ushort *xp;
+#line 3164
+  int nrange = 0;         /* number of range errors */
+#line 3164
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3164
+  long cxp = (long) *((char**)xpp);
+#line 3164
+
+#line 3164
+  realign = (cxp & 7) % SIZEOF_USHORT;
+#line 3164
+  /* sjl: manually stripmine so we can limit amount of
+#line 3164
+   * vector work space reserved to LOOPCNT elements. Also
+#line 3164
+   * makes vectorisation easy */
+#line 3164
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3164
+    ni=Min(nelems-j,LOOPCNT);
+#line 3164
+    if (realign) {
+#line 3164
+      memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_USHORT));
+#line 3164
+      xp = tmp;
+#line 3164
+    } else {
+#line 3164
+      xp = (ushort *) *xpp;
+#line 3164
+    }
+#line 3164
+   /* copy the next block */
+#line 3164
+#pragma cdir loopcnt=LOOPCNT
+#line 3164
+#pragma cdir shortloop
+#line 3164
+    for (i=0; i<ni; i++) {
+#line 3164
+      tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
+#line 3164
+     /* test for range errors (not always needed but do it anyway) */
+#line 3164
+     /* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3164
+     /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3164
+      nrange += xp[i] > UINT_MAX ;
+#line 3164
+    }
+#line 3164
+   /* update xpp and tp */
 #line 3164
-{
+    if (realign) xp = (ushort *) *xpp;
 #line 3164
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+    xp += ni;
+#line 3164
+    tp += ni;
+#line 3164
+    *xpp = (void*)xp;
+#line 3164
+  }
+#line 3164
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
 #line 3164
 
 #line 3164
+#else   /* not SX */
+#line 3164
 	const char *xp = (const char *) *xpp;
 #line 3164
 	int status = NC_NOERR;
@@ -16902,7 +16694,7 @@ ncx_pad_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
 #line 3164
 	{
 #line 3164
-		const int lstatus = ncx_get_ushort_short(xp, tp);
+		const int lstatus = ncx_get_ushort_uint(xp, tp);
 #line 3164
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3164
@@ -16912,108 +16704,148 @@ ncx_pad_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
 #line 3164
 
 #line 3164
-	if (rndup != 0)
-#line 3164
-		xp += X_SIZEOF_USHORT;
-#line 3164
-
-#line 3164
-	*xpp = (void *)xp;
+	*xpp = (const void *)xp;
 #line 3164
 	return status;
 #line 3164
+#endif
+#line 3164
 }
 #line 3164
 
 int
 #line 3165
-ncx_pad_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
+ncx_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 3165
 {
 #line 3165
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
 #line 3165
 
 #line 3165
-	const char *xp = (const char *) *xpp;
+ /* basic algorithm is:
 #line 3165
-	int status = NC_NOERR;
+  *   - ensure sane alignment of input data
 #line 3165
-
+  *   - copy (conversion happens automatically) input data
 #line 3165
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+  *     to output
 #line 3165
-	{
+  *   - update xpp to point at next unconverted input, and tp to point
 #line 3165
-		const int lstatus = ncx_get_ushort_int(xp, tp);
+  *     at next location for converted output
 #line 3165
-		if (status == NC_NOERR) /* report the first encountered error */
+  */
 #line 3165
-			status = lstatus;
+  long i, j, ni;
 #line 3165
-	}
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
 #line 3165
-
+  ushort *xp;
 #line 3165
-	if (rndup != 0)
+  int nrange = 0;         /* number of range errors */
 #line 3165
-		xp += X_SIZEOF_USHORT;
+  int realign = 0;        /* "do we need to fix input data alignment?" */
+#line 3165
+  long cxp = (long) *((char**)xpp);
 #line 3165
 
 #line 3165
-	*xpp = (void *)xp;
+  realign = (cxp & 7) % SIZEOF_USHORT;
 #line 3165
-	return status;
+  /* sjl: manually stripmine so we can limit amount of
 #line 3165
-}
+   * vector work space reserved to LOOPCNT elements. Also
+#line 3165
+   * makes vectorisation easy */
+#line 3165
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
+#line 3165
+    ni=Min(nelems-j,LOOPCNT);
+#line 3165
+    if (realign) {
+#line 3165
+      memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_USHORT));
+#line 3165
+      xp = tmp;
+#line 3165
+    } else {
+#line 3165
+      xp = (ushort *) *xpp;
+#line 3165
+    }
+#line 3165
+   /* copy the next block */
+#line 3165
+#pragma cdir loopcnt=LOOPCNT
+#line 3165
+#pragma cdir shortloop
+#line 3165
+    for (i=0; i<ni; i++) {
+#line 3165
+      tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
+#line 3165
+     /* test for range errors (not always needed but do it anyway) */
+#line 3165
+     /* if xpp is unsigned, we need not check if xp[i] < _MIN */
+#line 3165
+     /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
+#line 3165
+      nrange += xp[i] > ULONGLONG_MAX ;
+#line 3165
+    }
+#line 3165
+   /* update xpp and tp */
+#line 3165
+    if (realign) xp = (ushort *) *xpp;
+#line 3165
+    xp += ni;
+#line 3165
+    tp += ni;
+#line 3165
+    *xpp = (void*)xp;
+#line 3165
+  }
+#line 3165
+  return nrange == 0 ? NC_NOERR : NC_ERANGE;
 #line 3165
 
-int
-#line 3166
-ncx_pad_getn_ushort_long(const void **xpp, size_t nelems, long *tp)
-#line 3166
-{
-#line 3166
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3166
-
-#line 3166
+#line 3165
+#else   /* not SX */
+#line 3165
 	const char *xp = (const char *) *xpp;
-#line 3166
+#line 3165
 	int status = NC_NOERR;
-#line 3166
+#line 3165
 
-#line 3166
+#line 3165
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3166
+#line 3165
 	{
-#line 3166
-		const int lstatus = ncx_get_ushort_long(xp, tp);
-#line 3166
+#line 3165
+		const int lstatus = ncx_get_ushort_ulonglong(xp, tp);
+#line 3165
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3166
+#line 3165
 			status = lstatus;
-#line 3166
+#line 3165
 	}
-#line 3166
-
-#line 3166
-	if (rndup != 0)
-#line 3166
-		xp += X_SIZEOF_USHORT;
-#line 3166
+#line 3165
 
-#line 3166
-	*xpp = (void *)xp;
-#line 3166
+#line 3165
+	*xpp = (const void *)xp;
+#line 3165
 	return status;
-#line 3166
+#line 3165
+#endif
+#line 3165
 }
-#line 3166
+#line 3165
+
 
 int
 #line 3167
-ncx_pad_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
+ncx_pad_getn_ushort_schar(const void **xpp, size_t nelems, schar *tp)
 #line 3167
 {
 #line 3167
@@ -17031,7 +16863,7 @@ ncx_pad_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 #line 3167
 	{
 #line 3167
-		const int lstatus = ncx_get_ushort_float(xp, tp);
+		const int lstatus = ncx_get_ushort_schar(xp, tp);
 #line 3167
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3167
@@ -17056,7 +16888,7 @@ ncx_pad_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 
 int
 #line 3168
-ncx_pad_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
+ncx_pad_getn_ushort_short(const void **xpp, size_t nelems, short *tp)
 #line 3168
 {
 #line 3168
@@ -17074,7 +16906,7 @@ ncx_pad_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 #line 3168
 	{
 #line 3168
-		const int lstatus = ncx_get_ushort_double(xp, tp);
+		const int lstatus = ncx_get_ushort_short(xp, tp);
 #line 3168
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3168
@@ -17099,7 +16931,7 @@ ncx_pad_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 
 int
 #line 3169
-ncx_pad_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
+ncx_pad_getn_ushort_int(const void **xpp, size_t nelems, int *tp)
 #line 3169
 {
 #line 3169
@@ -17117,7 +16949,7 @@ ncx_pad_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 3169
 	{
 #line 3169
-		const int lstatus = ncx_get_ushort_uchar(xp, tp);
+		const int lstatus = ncx_get_ushort_int(xp, tp);
 #line 3169
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3169
@@ -17142,7 +16974,7 @@ ncx_pad_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 
 int
 #line 3170
-ncx_pad_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
+ncx_pad_getn_ushort_long(const void **xpp, size_t nelems, long *tp)
 #line 3170
 {
 #line 3170
@@ -17160,7 +16992,7 @@ ncx_pad_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
 #line 3170
 	{
 #line 3170
-		const int lstatus = ncx_get_ushort_ushort(xp, tp);
+		const int lstatus = ncx_get_ushort_long(xp, tp);
 #line 3170
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3170
@@ -17185,7 +17017,7 @@ ncx_pad_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
 
 int
 #line 3171
-ncx_pad_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
+ncx_pad_getn_ushort_float(const void **xpp, size_t nelems, float *tp)
 #line 3171
 {
 #line 3171
@@ -17203,7 +17035,7 @@ ncx_pad_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
 #line 3171
 	{
 #line 3171
-		const int lstatus = ncx_get_ushort_uint(xp, tp);
+		const int lstatus = ncx_get_ushort_float(xp, tp);
 #line 3171
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3171
@@ -17228,7 +17060,7 @@ ncx_pad_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
 
 int
 #line 3172
-ncx_pad_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
+ncx_pad_getn_ushort_double(const void **xpp, size_t nelems, double *tp)
 #line 3172
 {
 #line 3172
@@ -17246,7 +17078,7 @@ ncx_pad_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
 #line 3172
 	{
 #line 3172
-		const int lstatus = ncx_get_ushort_longlong(xp, tp);
+		const int lstatus = ncx_get_ushort_double(xp, tp);
 #line 3172
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3172
@@ -17271,7 +17103,7 @@ ncx_pad_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
 
 int
 #line 3173
-ncx_pad_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+ncx_pad_getn_ushort_uchar(const void **xpp, size_t nelems, uchar *tp)
 #line 3173
 {
 #line 3173
@@ -17289,7 +17121,7 @@ ncx_pad_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 #line 3173
 	{
 #line 3173
-		const int lstatus = ncx_get_ushort_ulonglong(xp, tp);
+		const int lstatus = ncx_get_ushort_uchar(xp, tp);
 #line 3173
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3173
@@ -17312,442 +17144,196 @@ ncx_pad_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
 }
 #line 3173
 
-
-#if X_SIZEOF_USHORT == SIZEOF_USHORT
-/* optimized version */
-int
-ncx_putn_ushort_ushort(void **xpp, size_t nelems, const unsigned short *tp, void *fillp)
-{
-#ifdef WORDS_BIGENDIAN
-	(void) memcpy(*xpp, tp, (size_t)nelems * X_SIZEOF_USHORT);
-# else
-	swapn2b(*xpp, tp, nelems);
-# endif
-	*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_USHORT);
-	return NC_NOERR;
-}
-#else
 int
-#line 3189
-ncx_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3189
+#line 3174
+ncx_pad_getn_ushort_ushort(const void **xpp, size_t nelems, ushort *tp)
+#line 3174
 {
-#line 3189
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#line 3189
+#line 3174
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3174
 
-#line 3189
- /* basic algorithm is:
-#line 3189
-  *   - ensure sane alignment of output data
-#line 3189
-  *   - copy (conversion happens automatically) input data
-#line 3189
-  *     to output
-#line 3189
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3189
-  *     at next location for converted output
-#line 3189
-  */
-#line 3189
-  long i, j, ni;
-#line 3189
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3189
-  ushort *xp;
-#line 3189
-  int nrange = 0;         /* number of range errors */
-#line 3189
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3189
-  long cxp = (long) *((char**)xpp);
-#line 3189
+#line 3174
+	const char *xp = (const char *) *xpp;
+#line 3174
+	int status = NC_NOERR;
+#line 3174
 
-#line 3189
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#line 3189
-  /* sjl: manually stripmine so we can limit amount of
-#line 3189
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3189
-   * makes vectorisation easy */
-#line 3189
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3189
-    ni=Min(nelems-j,LOOPCNT);
-#line 3189
-    if (realign) {
-#line 3189
-      xp = tmp;
-#line 3189
-    } else {
-#line 3189
-      xp = (ushort *) *xpp;
-#line 3189
-    }
-#line 3189
-   /* copy the next block */
-#line 3189
-#pragma cdir loopcnt=LOOPCNT
-#line 3189
-#pragma cdir shortloop
-#line 3189
-    for (i=0; i<ni; i++) {
-#line 3189
-      /* the normal case: */
-#line 3189
-      xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
-#line 3189
-     /* test for range errors (not always needed but do it anyway) */
-#line 3189
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3189
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3189
-      nrange += tp[i] > X_USHORT_MAX ;
-#line 3189
-    }
-#line 3189
-   /* copy workspace back if necessary */
-#line 3189
-    if (realign) {
-#line 3189
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
-#line 3189
-      xp = (ushort *) *xpp;
-#line 3189
-    }
-#line 3189
-   /* update xpp and tp */
-#line 3189
-    xp += ni;
-#line 3189
-    tp += ni;
-#line 3189
-    *xpp = (void*)xp;
-#line 3189
-  }
-#line 3189
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3189
+#line 3174
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 3174
+	{
+#line 3174
+		const int lstatus = ncx_get_ushort_ushort(xp, tp);
+#line 3174
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3174
+			status = lstatus;
+#line 3174
+	}
+#line 3174
+
+#line 3174
+	if (rndup != 0)
+#line 3174
+		xp += X_SIZEOF_USHORT;
+#line 3174
+
+#line 3174
+	*xpp = (void *)xp;
+#line 3174
+	return status;
+#line 3174
+}
+#line 3174
 
-#line 3189
-#else   /* not SX */
-#line 3189
+int
+#line 3175
+ncx_pad_getn_ushort_uint(const void **xpp, size_t nelems, uint *tp)
+#line 3175
+{
+#line 3175
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3175
 
-#line 3189
-	char *xp = (char *) *xpp;
-#line 3189
+#line 3175
+	const char *xp = (const char *) *xpp;
+#line 3175
 	int status = NC_NOERR;
-#line 3189
+#line 3175
 
-#line 3189
+#line 3175
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3189
+#line 3175
 	{
-#line 3189
-		int lstatus = ncx_put_ushort_ushort(xp, tp, fillp);
-#line 3189
+#line 3175
+		const int lstatus = ncx_get_ushort_uint(xp, tp);
+#line 3175
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3189
+#line 3175
 			status = lstatus;
-#line 3189
+#line 3175
 	}
-#line 3189
+#line 3175
+
+#line 3175
+	if (rndup != 0)
+#line 3175
+		xp += X_SIZEOF_USHORT;
+#line 3175
 
-#line 3189
+#line 3175
 	*xpp = (void *)xp;
-#line 3189
+#line 3175
 	return status;
-#line 3189
-#endif
-#line 3189
+#line 3175
 }
-#line 3189
+#line 3175
 
-#endif
 int
-#line 3191
-ncx_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3191
+#line 3176
+ncx_pad_getn_ushort_longlong(const void **xpp, size_t nelems, longlong *tp)
+#line 3176
 {
-#line 3191
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#line 3191
-
-#line 3191
- /* basic algorithm is:
-#line 3191
-  *   - ensure sane alignment of output data
-#line 3191
-  *   - copy (conversion happens automatically) input data
-#line 3191
-  *     to output
-#line 3191
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3191
-  *     at next location for converted output
-#line 3191
-  */
-#line 3191
-  long i, j, ni;
-#line 3191
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3191
-  ushort *xp;
-#line 3191
-  int nrange = 0;         /* number of range errors */
-#line 3191
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3191
-  long cxp = (long) *((char**)xpp);
-#line 3191
-
-#line 3191
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#line 3191
-  /* sjl: manually stripmine so we can limit amount of
-#line 3191
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3191
-   * makes vectorisation easy */
-#line 3191
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3191
-    ni=Min(nelems-j,LOOPCNT);
-#line 3191
-    if (realign) {
-#line 3191
-      xp = tmp;
-#line 3191
-    } else {
-#line 3191
-      xp = (ushort *) *xpp;
-#line 3191
-    }
-#line 3191
-   /* copy the next block */
-#line 3191
-#pragma cdir loopcnt=LOOPCNT
-#line 3191
-#pragma cdir shortloop
-#line 3191
-    for (i=0; i<ni; i++) {
-#line 3191
-      /* the normal case: */
-#line 3191
-      xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
-#line 3191
-     /* test for range errors (not always needed but do it anyway) */
-#line 3191
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3191
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3191
-      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
-#line 3191
-    }
-#line 3191
-   /* copy workspace back if necessary */
-#line 3191
-    if (realign) {
-#line 3191
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
-#line 3191
-      xp = (ushort *) *xpp;
-#line 3191
-    }
-#line 3191
-   /* update xpp and tp */
-#line 3191
-    xp += ni;
-#line 3191
-    tp += ni;
-#line 3191
-    *xpp = (void*)xp;
-#line 3191
-  }
-#line 3191
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3191
-
-#line 3191
-#else   /* not SX */
-#line 3191
+#line 3176
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3176
 
-#line 3191
-	char *xp = (char *) *xpp;
-#line 3191
+#line 3176
+	const char *xp = (const char *) *xpp;
+#line 3176
 	int status = NC_NOERR;
-#line 3191
+#line 3176
 
-#line 3191
+#line 3176
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3191
+#line 3176
 	{
-#line 3191
-		int lstatus = ncx_put_ushort_schar(xp, tp, fillp);
-#line 3191
+#line 3176
+		const int lstatus = ncx_get_ushort_longlong(xp, tp);
+#line 3176
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3191
+#line 3176
 			status = lstatus;
-#line 3191
+#line 3176
 	}
-#line 3191
+#line 3176
 
-#line 3191
+#line 3176
+	if (rndup != 0)
+#line 3176
+		xp += X_SIZEOF_USHORT;
+#line 3176
+
+#line 3176
 	*xpp = (void *)xp;
-#line 3191
+#line 3176
 	return status;
-#line 3191
-#endif
-#line 3191
+#line 3176
 }
-#line 3191
+#line 3176
 
 int
-#line 3192
-ncx_putn_ushort_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3192
+#line 3177
+ncx_pad_getn_ushort_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
+#line 3177
 {
-#line 3192
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#line 3192
-
-#line 3192
- /* basic algorithm is:
-#line 3192
-  *   - ensure sane alignment of output data
-#line 3192
-  *   - copy (conversion happens automatically) input data
-#line 3192
-  *     to output
-#line 3192
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3192
-  *     at next location for converted output
-#line 3192
-  */
-#line 3192
-  long i, j, ni;
-#line 3192
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3192
-  ushort *xp;
-#line 3192
-  int nrange = 0;         /* number of range errors */
-#line 3192
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3192
-  long cxp = (long) *((char**)xpp);
-#line 3192
-
-#line 3192
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#line 3192
-  /* sjl: manually stripmine so we can limit amount of
-#line 3192
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3192
-   * makes vectorisation easy */
-#line 3192
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3192
-    ni=Min(nelems-j,LOOPCNT);
-#line 3192
-    if (realign) {
-#line 3192
-      xp = tmp;
-#line 3192
-    } else {
-#line 3192
-      xp = (ushort *) *xpp;
-#line 3192
-    }
-#line 3192
-   /* copy the next block */
-#line 3192
-#pragma cdir loopcnt=LOOPCNT
-#line 3192
-#pragma cdir shortloop
-#line 3192
-    for (i=0; i<ni; i++) {
-#line 3192
-      /* the normal case: */
-#line 3192
-      xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
-#line 3192
-     /* test for range errors (not always needed but do it anyway) */
-#line 3192
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3192
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3192
-      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
-#line 3192
-    }
-#line 3192
-   /* copy workspace back if necessary */
-#line 3192
-    if (realign) {
-#line 3192
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
-#line 3192
-      xp = (ushort *) *xpp;
-#line 3192
-    }
-#line 3192
-   /* update xpp and tp */
-#line 3192
-    xp += ni;
-#line 3192
-    tp += ni;
-#line 3192
-    *xpp = (void*)xp;
-#line 3192
-  }
-#line 3192
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3192
-
-#line 3192
-#else   /* not SX */
-#line 3192
+#line 3177
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3177
 
-#line 3192
-	char *xp = (char *) *xpp;
-#line 3192
+#line 3177
+	const char *xp = (const char *) *xpp;
+#line 3177
 	int status = NC_NOERR;
-#line 3192
+#line 3177
 
-#line 3192
+#line 3177
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3192
+#line 3177
 	{
-#line 3192
-		int lstatus = ncx_put_ushort_short(xp, tp, fillp);
-#line 3192
+#line 3177
+		const int lstatus = ncx_get_ushort_ulonglong(xp, tp);
+#line 3177
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3192
+#line 3177
 			status = lstatus;
-#line 3192
+#line 3177
 	}
-#line 3192
+#line 3177
+
+#line 3177
+	if (rndup != 0)
+#line 3177
+		xp += X_SIZEOF_USHORT;
+#line 3177
 
-#line 3192
+#line 3177
 	*xpp = (void *)xp;
-#line 3192
+#line 3177
 	return status;
-#line 3192
-#endif
-#line 3192
+#line 3177
 }
-#line 3192
+#line 3177
 
+
+#if X_SIZEOF_USHORT == SIZEOF_USHORT
+/* optimized version */
+int
+ncx_putn_ushort_ushort(void **xpp, size_t nelems, const unsigned short *tp, void *fillp)
+{
+#ifdef WORDS_BIGENDIAN
+	(void) memcpy(*xpp, tp, (size_t)nelems * X_SIZEOF_USHORT);
+# else
+	swapn2b(*xpp, tp, nelems);
+# endif
+	*xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_USHORT);
+	return NC_NOERR;
+}
+#else
 int
 #line 3193
-ncx_putn_ushort_int(void **xpp, size_t nelems, const int *tp, void *fillp)
+ncx_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
 #line 3193
 {
 #line 3193
@@ -17823,209 +17409,71 @@ ncx_putn_ushort_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3193
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3193
-      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
-#line 3193
-    }
-#line 3193
-   /* copy workspace back if necessary */
-#line 3193
-    if (realign) {
-#line 3193
-      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
-#line 3193
-      xp = (ushort *) *xpp;
-#line 3193
-    }
-#line 3193
-   /* update xpp and tp */
-#line 3193
-    xp += ni;
-#line 3193
-    tp += ni;
-#line 3193
-    *xpp = (void*)xp;
-#line 3193
-  }
-#line 3193
-  return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3193
-
-#line 3193
-#else   /* not SX */
-#line 3193
-
-#line 3193
-	char *xp = (char *) *xpp;
-#line 3193
-	int status = NC_NOERR;
-#line 3193
-
-#line 3193
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3193
-	{
-#line 3193
-		int lstatus = ncx_put_ushort_int(xp, tp, fillp);
-#line 3193
-		if (status == NC_NOERR) /* report the first encountered error */
-#line 3193
-			status = lstatus;
-#line 3193
-	}
-#line 3193
-
-#line 3193
-	*xpp = (void *)xp;
-#line 3193
-	return status;
-#line 3193
-#endif
-#line 3193
-}
+      nrange += tp[i] > X_USHORT_MAX ;
 #line 3193
-
-int
-#line 3194
-ncx_putn_ushort_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3194
-{
-#line 3194
-#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
-#line 3194
-
-#line 3194
- /* basic algorithm is:
-#line 3194
-  *   - ensure sane alignment of output data
-#line 3194
-  *   - copy (conversion happens automatically) input data
-#line 3194
-  *     to output
-#line 3194
-  *   - update tp to point at next unconverted input, and xpp to point
-#line 3194
-  *     at next location for converted output
-#line 3194
-  */
-#line 3194
-  long i, j, ni;
-#line 3194
-  ushort tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3194
-  ushort *xp;
-#line 3194
-  int nrange = 0;         /* number of range errors */
-#line 3194
-  int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3194
-  long cxp = (long) *((char**)xpp);
-#line 3194
-
-#line 3194
-  realign = (cxp & 7) % SIZEOF_USHORT;
-#line 3194
-  /* sjl: manually stripmine so we can limit amount of
-#line 3194
-   * vector work space reserved to LOOPCNT elements. Also
-#line 3194
-   * makes vectorisation easy */
-#line 3194
-  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3194
-    ni=Min(nelems-j,LOOPCNT);
-#line 3194
-    if (realign) {
-#line 3194
-      xp = tmp;
-#line 3194
-    } else {
-#line 3194
-      xp = (ushort *) *xpp;
-#line 3194
-    }
-#line 3194
-   /* copy the next block */
-#line 3194
-#pragma cdir loopcnt=LOOPCNT
-#line 3194
-#pragma cdir shortloop
-#line 3194
-    for (i=0; i<ni; i++) {
-#line 3194
-      /* the normal case: */
-#line 3194
-      xp[i] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) tp[i]));
-#line 3194
-     /* test for range errors (not always needed but do it anyway) */
-#line 3194
-     /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3194
-     /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3194
-      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
-#line 3194
     }
-#line 3194
+#line 3193
    /* copy workspace back if necessary */
-#line 3194
+#line 3193
     if (realign) {
-#line 3194
+#line 3193
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
-#line 3194
+#line 3193
       xp = (ushort *) *xpp;
-#line 3194
+#line 3193
     }
-#line 3194
+#line 3193
    /* update xpp and tp */
-#line 3194
+#line 3193
     xp += ni;
-#line 3194
+#line 3193
     tp += ni;
-#line 3194
+#line 3193
     *xpp = (void*)xp;
-#line 3194
+#line 3193
   }
-#line 3194
+#line 3193
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3194
+#line 3193
 
-#line 3194
+#line 3193
 #else   /* not SX */
-#line 3194
+#line 3193
 
-#line 3194
+#line 3193
 	char *xp = (char *) *xpp;
-#line 3194
+#line 3193
 	int status = NC_NOERR;
-#line 3194
+#line 3193
 
-#line 3194
+#line 3193
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3194
+#line 3193
 	{
-#line 3194
-		int lstatus = ncx_put_ushort_long(xp, tp, fillp);
-#line 3194
+#line 3193
+		int lstatus = ncx_put_ushort_ushort(xp, tp, fillp);
+#line 3193
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3194
+#line 3193
 			status = lstatus;
-#line 3194
+#line 3193
 	}
-#line 3194
+#line 3193
 
-#line 3194
+#line 3193
 	*xpp = (void *)xp;
-#line 3194
+#line 3193
 	return status;
-#line 3194
+#line 3193
 #endif
-#line 3194
+#line 3193
 }
-#line 3194
+#line 3193
 
+#endif
 int
 #line 3195
-ncx_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fillp)
+ncx_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
 #line 3195
 {
 #line 3195
@@ -18143,7 +17591,7 @@ ncx_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3195
 	{
 #line 3195
-		int lstatus = ncx_put_ushort_float(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_schar(xp, tp, fillp);
 #line 3195
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3195
@@ -18164,7 +17612,7 @@ ncx_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 
 int
 #line 3196
-ncx_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_putn_ushort_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 3196
 {
 #line 3196
@@ -18282,7 +17730,7 @@ ncx_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3196
 	{
 #line 3196
-		int lstatus = ncx_put_ushort_double(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_short(xp, tp, fillp);
 #line 3196
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3196
@@ -18303,7 +17751,7 @@ ncx_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 
 int
 #line 3197
-ncx_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_putn_ushort_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3197
 {
 #line 3197
@@ -18421,7 +17869,7 @@ ncx_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void *fi
 #line 3197
 	{
 #line 3197
-		int lstatus = ncx_put_ushort_longlong(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_int(xp, tp, fillp);
 #line 3197
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3197
@@ -18442,7 +17890,7 @@ ncx_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void *fi
 
 int
 #line 3198
-ncx_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+ncx_putn_ushort_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3198
 {
 #line 3198
@@ -18518,7 +17966,7 @@ ncx_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3198
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3198
-      nrange += tp[i] > X_USHORT_MAX ;
+      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
 #line 3198
     }
 #line 3198
@@ -18560,7 +18008,7 @@ ncx_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3198
 	{
 #line 3198
-		int lstatus = ncx_put_ushort_uchar(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_long(xp, tp, fillp);
 #line 3198
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3198
@@ -18581,7 +18029,7 @@ ncx_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 
 int
 #line 3199
-ncx_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3199
 {
 #line 3199
@@ -18657,7 +18105,7 @@ ncx_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3199
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3199
-      nrange += tp[i] > X_USHORT_MAX ;
+      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
 #line 3199
     }
 #line 3199
@@ -18699,7 +18147,7 @@ ncx_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3199
 	{
 #line 3199
-		int lstatus = ncx_put_ushort_uint(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_float(xp, tp, fillp);
 #line 3199
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3199
@@ -18720,7 +18168,7 @@ ncx_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 3200
-ncx_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3200
 {
 #line 3200
@@ -18796,7 +18244,7 @@ ncx_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *
 #line 3200
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
 #line 3200
-      nrange += tp[i] > X_USHORT_MAX ;
+      nrange += tp[i] > X_USHORT_MAX || tp[i] < 0;
 #line 3200
     }
 #line 3200
@@ -18838,7 +18286,7 @@ ncx_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *
 #line 3200
 	{
 #line 3200
-		int lstatus = ncx_put_ushort_ulonglong(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_double(xp, tp, fillp);
 #line 3200
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3200
@@ -18857,44 +18305,270 @@ ncx_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *
 }
 #line 3200
 
+int
+#line 3201
+ncx_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 3201
+{
+#line 3201
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
+#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
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3201
+  ushort *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_USHORT;
+#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 = (ushort *) *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] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) 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_USHORT_MAX || tp[i] < 0;
+#line 3201
+    }
+#line 3201
+   /* copy workspace back if necessary */
+#line 3201
+    if (realign) {
+#line 3201
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
+#line 3201
+      xp = (ushort *) *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_USHORT, tp++)
+#line 3201
+	{
+#line 3201
+		int lstatus = ncx_put_ushort_longlong(xp, tp, fillp);
+#line 3201
+		if (status == NC_NOERR) /* report the first encountered error */
+#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_pad_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
+ncx_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3202
 {
 #line 3202
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
 #line 3202
 
 #line 3202
-	char *xp = (char *) *xpp;
+ /* basic algorithm is:
 #line 3202
-	int status = NC_NOERR;
+  *   - 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
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3202
+  ushort *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
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+  realign = (cxp & 7) % SIZEOF_USHORT;
 #line 3202
-	{
+  /* sjl: manually stripmine so we can limit amount of
 #line 3202
-		int lstatus = ncx_put_ushort_schar(xp, tp, fillp);
+   * vector work space reserved to LOOPCNT elements. Also
 #line 3202
-		if (status == NC_NOERR) /* report the first encountered error */
+   * makes vectorisation easy */
 #line 3202
-			status = lstatus;
+  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 = (ushort *) *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] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) 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_USHORT_MAX ;
+#line 3202
+    }
+#line 3202
+   /* copy workspace back if necessary */
+#line 3202
+    if (realign) {
+#line 3202
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
+#line 3202
+      xp = (ushort *) *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
-	if (rndup != 0)
+#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_USHORT, tp++)
 #line 3202
 	{
 #line 3202
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+		int lstatus = ncx_put_ushort_uchar(xp, tp, fillp);
 #line 3202
-		xp += X_SIZEOF_USHORT;
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3202
+			status = lstatus;
 #line 3202
 	}
 #line 3202
@@ -18904,46 +18578,136 @@ ncx_pad_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp, void *fill
 #line 3202
 	return status;
 #line 3202
+#endif
+#line 3202
 }
 #line 3202
 
-int
+int
+#line 3203
+ncx_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 3203
+{
+#line 3203
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
+#line 3203
+
 #line 3203
-ncx_pad_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
+ /* basic algorithm is:
 #line 3203
-{
+  *   - ensure sane alignment of output data
 #line 3203
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+  *   - copy (conversion happens automatically) input data
 #line 3203
-
+  *     to output
 #line 3203
-	char *xp = (char *) *xpp;
+  *   - update tp to point at next unconverted input, and xpp to point
 #line 3203
-	int status = NC_NOERR;
+  *     at next location for converted output
+#line 3203
+  */
+#line 3203
+  long i, j, ni;
+#line 3203
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3203
+  ushort *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
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+  realign = (cxp & 7) % SIZEOF_USHORT;
 #line 3203
-	{
+  /* sjl: manually stripmine so we can limit amount of
 #line 3203
-		int lstatus = ncx_put_ushort_uchar(xp, tp, fillp);
+   * vector work space reserved to LOOPCNT elements. Also
 #line 3203
-		if (status == NC_NOERR) /* report the first encountered error */
+   * makes vectorisation easy */
 #line 3203
-			status = lstatus;
+  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 = (ushort *) *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] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) 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_USHORT_MAX ;
+#line 3203
+    }
+#line 3203
+   /* copy workspace back if necessary */
+#line 3203
+    if (realign) {
+#line 3203
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
+#line 3203
+      xp = (ushort *) *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
-	if (rndup != 0)
+#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_USHORT, tp++)
 #line 3203
 	{
 #line 3203
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+		int lstatus = ncx_put_ushort_uint(xp, tp, fillp);
 #line 3203
-		xp += X_SIZEOF_USHORT;
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3203
+			status = lstatus;
 #line 3203
 	}
 #line 3203
@@ -18953,110 +18717,154 @@ ncx_pad_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fill
 #line 3203
 	return status;
 #line 3203
+#endif
+#line 3203
 }
 #line 3203
 
 int
 #line 3204
-ncx_pad_putn_ushort_short(void **xpp, size_t nelems, const short *tp, void *fillp)
+ncx_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
 #line 3204
 {
 #line 3204
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#if defined(_SX) && _SX != 0 && X_SIZEOF_USHORT == SIZEOF_USHORT
 #line 3204
 
 #line 3204
-	char *xp = (char *) *xpp;
+ /* basic algorithm is:
 #line 3204
-	int status = NC_NOERR;
+  *   - ensure sane alignment of output data
 #line 3204
-
+  *   - copy (conversion happens automatically) input data
 #line 3204
-	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+  *     to output
 #line 3204
-	{
+  *   - update tp to point at next unconverted input, and xpp to point
 #line 3204
-		int lstatus = ncx_put_ushort_short(xp, tp, fillp);
+  *     at next location for converted output
 #line 3204
-		if (status == NC_NOERR) /* report the first encountered error */
+  */
 #line 3204
-			status = lstatus;
+  long i, j, ni;
 #line 3204
-	}
+  ushort tmp[LOOPCNT];        /* in case input is misaligned */
+#line 3204
+  ushort *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
-	if (rndup != 0)
+  realign = (cxp & 7) % SIZEOF_USHORT;
 #line 3204
-	{
+  /* sjl: manually stripmine so we can limit amount of
 #line 3204
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+   * vector work space reserved to LOOPCNT elements. Also
 #line 3204
-		xp += X_SIZEOF_USHORT;
+   * makes vectorisation easy */
 #line 3204
-	}
+  for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
 #line 3204
-
+    ni=Min(nelems-j,LOOPCNT);
 #line 3204
-	*xpp = (void *)xp;
+    if (realign) {
 #line 3204
-	return status;
+      xp = tmp;
 #line 3204
-}
+    } else {
+#line 3204
+      xp = (ushort *) *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] = (ushort) Max( X_USHORT_MIN, Min(X_USHORT_MAX, (ushort) 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_USHORT_MAX ;
+#line 3204
+    }
+#line 3204
+   /* copy workspace back if necessary */
+#line 3204
+    if (realign) {
+#line 3204
+      memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_USHORT);
+#line 3204
+      xp = (ushort *) *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
 
-int
-#line 3205
-ncx_pad_putn_ushort_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3205
-{
-#line 3205
-	const size_t rndup = nelems % X_SIZEOF_SHORT;
-#line 3205
+#line 3204
+#else   /* not SX */
+#line 3204
 
-#line 3205
+#line 3204
 	char *xp = (char *) *xpp;
-#line 3205
+#line 3204
 	int status = NC_NOERR;
-#line 3205
+#line 3204
 
-#line 3205
+#line 3204
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
-#line 3205
+#line 3204
 	{
-#line 3205
-		int lstatus = ncx_put_ushort_int(xp, tp, fillp);
-#line 3205
+#line 3204
+		int lstatus = ncx_put_ushort_ulonglong(xp, tp, fillp);
+#line 3204
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3205
+#line 3204
 			status = lstatus;
-#line 3205
-	}
-#line 3205
-
-#line 3205
-	if (rndup != 0)
-#line 3205
-	{
-#line 3205
-		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
-#line 3205
-		xp += X_SIZEOF_USHORT;
-#line 3205
+#line 3204
 	}
-#line 3205
+#line 3204
 
-#line 3205
+#line 3204
 	*xpp = (void *)xp;
-#line 3205
+#line 3204
 	return status;
-#line 3205
+#line 3204
+#endif
+#line 3204
 }
-#line 3205
+#line 3204
+
 
 int
 #line 3206
-ncx_pad_putn_ushort_long(void **xpp, size_t nelems, const long *tp, void *fillp)
+ncx_pad_putn_ushort_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
 #line 3206
 {
 #line 3206
@@ -19074,7 +18882,7 @@ ncx_pad_putn_ushort_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3206
 	{
 #line 3206
-		int lstatus = ncx_put_ushort_long(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_schar(xp, tp, fillp);
 #line 3206
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3206
@@ -19105,7 +18913,7 @@ ncx_pad_putn_ushort_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 
 int
 #line 3207
-ncx_pad_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fillp)
+ncx_pad_putn_ushort_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
 #line 3207
 {
 #line 3207
@@ -19123,7 +18931,7 @@ ncx_pad_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fill
 #line 3207
 	{
 #line 3207
-		int lstatus = ncx_put_ushort_float(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_uchar(xp, tp, fillp);
 #line 3207
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3207
@@ -19154,7 +18962,7 @@ ncx_pad_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fill
 
 int
 #line 3208
-ncx_pad_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fillp)
+ncx_pad_putn_ushort_short(void **xpp, size_t nelems, const short *tp, void *fillp)
 #line 3208
 {
 #line 3208
@@ -19172,7 +18980,7 @@ ncx_pad_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fi
 #line 3208
 	{
 #line 3208
-		int lstatus = ncx_put_ushort_double(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_short(xp, tp, fillp);
 #line 3208
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3208
@@ -19203,7 +19011,7 @@ ncx_pad_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fi
 
 int
 #line 3209
-ncx_pad_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+ncx_pad_putn_ushort_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 #line 3209
 {
 #line 3209
@@ -19221,7 +19029,7 @@ ncx_pad_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 #line 3209
 	{
 #line 3209
-		int lstatus = ncx_put_ushort_uint(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_int(xp, tp, fillp);
 #line 3209
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3209
@@ -19252,7 +19060,7 @@ ncx_pad_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
 
 int
 #line 3210
-ncx_pad_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+ncx_pad_putn_ushort_long(void **xpp, size_t nelems, const long *tp, void *fillp)
 #line 3210
 {
 #line 3210
@@ -19270,7 +19078,7 @@ ncx_pad_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void
 #line 3210
 	{
 #line 3210
-		int lstatus = ncx_put_ushort_longlong(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_long(xp, tp, fillp);
 #line 3210
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3210
@@ -19301,7 +19109,7 @@ ncx_pad_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void
 
 int
 #line 3211
-ncx_pad_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+ncx_pad_putn_ushort_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 #line 3211
 {
 #line 3211
@@ -19319,7 +19127,7 @@ ncx_pad_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, vo
 #line 3211
 	{
 #line 3211
-		int lstatus = ncx_put_ushort_ulonglong(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_float(xp, tp, fillp);
 #line 3211
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3211
@@ -19350,7 +19158,7 @@ ncx_pad_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, vo
 
 int
 #line 3212
-ncx_pad_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+ncx_pad_putn_ushort_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 #line 3212
 {
 #line 3212
@@ -19368,7 +19176,7 @@ ncx_pad_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp, void *fi
 #line 3212
 	{
 #line 3212
-		int lstatus = ncx_put_ushort_ushort(xp, tp, fillp);
+		int lstatus = ncx_put_ushort_double(xp, tp, fillp);
 #line 3212
 		if (status == NC_NOERR) /* report the first encountered error */
 #line 3212
@@ -19397,6 +19205,202 @@ ncx_pad_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp, void *fi
 }
 #line 3212
 
+int
+#line 3213
+ncx_pad_putn_ushort_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
+#line 3213
+{
+#line 3213
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3213
+
+#line 3213
+	char *xp = (char *) *xpp;
+#line 3213
+	int status = NC_NOERR;
+#line 3213
+
+#line 3213
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 3213
+	{
+#line 3213
+		int lstatus = ncx_put_ushort_uint(xp, tp, fillp);
+#line 3213
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3213
+			status = lstatus;
+#line 3213
+	}
+#line 3213
+
+#line 3213
+	if (rndup != 0)
+#line 3213
+	{
+#line 3213
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+#line 3213
+		xp += X_SIZEOF_USHORT;
+#line 3213
+	}
+#line 3213
+
+#line 3213
+	*xpp = (void *)xp;
+#line 3213
+	return status;
+#line 3213
+}
+#line 3213
+
+int
+#line 3214
+ncx_pad_putn_ushort_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
+#line 3214
+{
+#line 3214
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3214
+
+#line 3214
+	char *xp = (char *) *xpp;
+#line 3214
+	int status = NC_NOERR;
+#line 3214
+
+#line 3214
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 3214
+	{
+#line 3214
+		int lstatus = ncx_put_ushort_longlong(xp, tp, fillp);
+#line 3214
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3214
+			status = lstatus;
+#line 3214
+	}
+#line 3214
+
+#line 3214
+	if (rndup != 0)
+#line 3214
+	{
+#line 3214
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+#line 3214
+		xp += X_SIZEOF_USHORT;
+#line 3214
+	}
+#line 3214
+
+#line 3214
+	*xpp = (void *)xp;
+#line 3214
+	return status;
+#line 3214
+}
+#line 3214
+
+int
+#line 3215
+ncx_pad_putn_ushort_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
+#line 3215
+{
+#line 3215
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3215
+
+#line 3215
+	char *xp = (char *) *xpp;
+#line 3215
+	int status = NC_NOERR;
+#line 3215
+
+#line 3215
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 3215
+	{
+#line 3215
+		int lstatus = ncx_put_ushort_ulonglong(xp, tp, fillp);
+#line 3215
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3215
+			status = lstatus;
+#line 3215
+	}
+#line 3215
+
+#line 3215
+	if (rndup != 0)
+#line 3215
+	{
+#line 3215
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+#line 3215
+		xp += X_SIZEOF_USHORT;
+#line 3215
+	}
+#line 3215
+
+#line 3215
+	*xpp = (void *)xp;
+#line 3215
+	return status;
+#line 3215
+}
+#line 3215
+
+int
+#line 3216
+ncx_pad_putn_ushort_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
+#line 3216
+{
+#line 3216
+	const size_t rndup = nelems % X_SIZEOF_SHORT;
+#line 3216
+
+#line 3216
+	char *xp = (char *) *xpp;
+#line 3216
+	int status = NC_NOERR;
+#line 3216
+
+#line 3216
+	for( ; nelems != 0; nelems--, xp += X_SIZEOF_USHORT, tp++)
+#line 3216
+	{
+#line 3216
+		int lstatus = ncx_put_ushort_ushort(xp, tp, fillp);
+#line 3216
+		if (status == NC_NOERR) /* report the first encountered error */
+#line 3216
+			status = lstatus;
+#line 3216
+	}
+#line 3216
+
+#line 3216
+	if (rndup != 0)
+#line 3216
+	{
+#line 3216
+		(void) memcpy(xp, nada, (size_t)(X_SIZEOF_USHORT));
+#line 3216
+		xp += X_SIZEOF_USHORT;
+#line 3216
+	}
+#line 3216
+
+#line 3216
+	*xpp = (void *)xp;
+#line 3216
+	return status;
+#line 3216
+}
+#line 3216
+
 
 
 /* int -----------------------------------------------------------------------*/
@@ -19416,1424 +19420,1424 @@ ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
 }
 #else
 int
-#line 3231
+#line 3235
 ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
-#line 3231
+#line 3235
 {
-#line 3231
+#line 3235
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3231
+#line 3235
 
-#line 3231
+#line 3235
  /* basic algorithm is:
-#line 3231
+#line 3235
   *   - ensure sane alignment of input data
-#line 3231
+#line 3235
   *   - copy (conversion happens automatically) input data
-#line 3231
+#line 3235
   *     to output
-#line 3231
+#line 3235
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3231
+#line 3235
   *     at next location for converted output
-#line 3231
+#line 3235
   */
-#line 3231
+#line 3235
   long i, j, ni;
-#line 3231
+#line 3235
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3231
+#line 3235
   int *xp;
-#line 3231
+#line 3235
   int nrange = 0;         /* number of range errors */
-#line 3231
+#line 3235
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3231
+#line 3235
   long cxp = (long) *((char**)xpp);
-#line 3231
+#line 3235
 
-#line 3231
+#line 3235
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3231
+#line 3235
   /* sjl: manually stripmine so we can limit amount of
-#line 3231
+#line 3235
    * vector work space reserved to LOOPCNT elements. Also
-#line 3231
+#line 3235
    * makes vectorisation easy */
-#line 3231
+#line 3235
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3231
+#line 3235
     ni=Min(nelems-j,LOOPCNT);
-#line 3231
+#line 3235
     if (realign) {
-#line 3231
+#line 3235
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3231
+#line 3235
       xp = tmp;
-#line 3231
+#line 3235
     } else {
-#line 3231
+#line 3235
       xp = (int *) *xpp;
-#line 3231
+#line 3235
     }
-#line 3231
+#line 3235
    /* copy the next block */
-#line 3231
+#line 3235
 #pragma cdir loopcnt=LOOPCNT
-#line 3231
+#line 3235
 #pragma cdir shortloop
-#line 3231
+#line 3235
     for (i=0; i<ni; i++) {
-#line 3231
+#line 3235
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3231
+#line 3235
      /* test for range errors (not always needed but do it anyway) */
-#line 3231
+#line 3235
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3231
+#line 3235
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3231
+#line 3235
       nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
-#line 3231
+#line 3235
     }
-#line 3231
+#line 3235
    /* update xpp and tp */
-#line 3231
+#line 3235
     if (realign) xp = (int *) *xpp;
-#line 3231
+#line 3235
     xp += ni;
-#line 3231
+#line 3235
     tp += ni;
-#line 3231
+#line 3235
     *xpp = (void*)xp;
-#line 3231
+#line 3235
   }
-#line 3231
+#line 3235
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3231
+#line 3235
 
-#line 3231
+#line 3235
 #else   /* not SX */
-#line 3231
+#line 3235
 	const char *xp = (const char *) *xpp;
-#line 3231
+#line 3235
 	int status = NC_NOERR;
-#line 3231
+#line 3235
 
-#line 3231
+#line 3235
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3231
+#line 3235
 	{
-#line 3231
+#line 3235
 		const int lstatus = ncx_get_int_int(xp, tp);
-#line 3231
+#line 3235
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3231
+#line 3235
 			status = lstatus;
-#line 3231
+#line 3235
 	}
-#line 3231
+#line 3235
 
-#line 3231
+#line 3235
 	*xpp = (const void *)xp;
-#line 3231
+#line 3235
 	return status;
-#line 3231
+#line 3235
 #endif
-#line 3231
+#line 3235
 }
-#line 3231
+#line 3235
 
 #endif
 int
-#line 3233
+#line 3237
 ncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3233
+#line 3237
 {
-#line 3233
+#line 3237
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3233
+#line 3237
 
-#line 3233
+#line 3237
  /* basic algorithm is:
-#line 3233
+#line 3237
   *   - ensure sane alignment of input data
-#line 3233
+#line 3237
   *   - copy (conversion happens automatically) input data
-#line 3233
+#line 3237
   *     to output
-#line 3233
+#line 3237
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3233
+#line 3237
   *     at next location for converted output
-#line 3233
+#line 3237
   */
-#line 3233
+#line 3237
   long i, j, ni;
-#line 3233
+#line 3237
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3233
+#line 3237
   int *xp;
-#line 3233
+#line 3237
   int nrange = 0;         /* number of range errors */
-#line 3233
+#line 3237
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3233
+#line 3237
   long cxp = (long) *((char**)xpp);
-#line 3233
+#line 3237
 
-#line 3233
+#line 3237
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3233
+#line 3237
   /* sjl: manually stripmine so we can limit amount of
-#line 3233
+#line 3237
    * vector work space reserved to LOOPCNT elements. Also
-#line 3233
+#line 3237
    * makes vectorisation easy */
-#line 3233
+#line 3237
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3233
+#line 3237
     ni=Min(nelems-j,LOOPCNT);
-#line 3233
+#line 3237
     if (realign) {
-#line 3233
+#line 3237
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3233
+#line 3237
       xp = tmp;
-#line 3233
+#line 3237
     } else {
-#line 3233
+#line 3237
       xp = (int *) *xpp;
-#line 3233
+#line 3237
     }
-#line 3233
+#line 3237
    /* copy the next block */
-#line 3233
+#line 3237
 #pragma cdir loopcnt=LOOPCNT
-#line 3233
+#line 3237
 #pragma cdir shortloop
-#line 3233
+#line 3237
     for (i=0; i<ni; i++) {
-#line 3233
+#line 3237
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3233
+#line 3237
      /* test for range errors (not always needed but do it anyway) */
-#line 3233
+#line 3237
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3233
+#line 3237
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3233
+#line 3237
       nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
-#line 3233
+#line 3237
     }
-#line 3233
+#line 3237
    /* update xpp and tp */
-#line 3233
+#line 3237
     if (realign) xp = (int *) *xpp;
-#line 3233
+#line 3237
     xp += ni;
-#line 3233
+#line 3237
     tp += ni;
-#line 3233
+#line 3237
     *xpp = (void*)xp;
-#line 3233
+#line 3237
   }
-#line 3233
+#line 3237
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3233
+#line 3237
 
-#line 3233
+#line 3237
 #else   /* not SX */
-#line 3233
+#line 3237
 	const char *xp = (const char *) *xpp;
-#line 3233
+#line 3237
 	int status = NC_NOERR;
-#line 3233
+#line 3237
 
-#line 3233
+#line 3237
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3233
+#line 3237
 	{
-#line 3233
+#line 3237
 		const int lstatus = ncx_get_int_schar(xp, tp);
-#line 3233
+#line 3237
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3233
+#line 3237
 			status = lstatus;
-#line 3233
+#line 3237
 	}
-#line 3233
+#line 3237
 
-#line 3233
+#line 3237
 	*xpp = (const void *)xp;
-#line 3233
+#line 3237
 	return status;
-#line 3233
+#line 3237
 #endif
-#line 3233
+#line 3237
 }
-#line 3233
+#line 3237
 
 int
-#line 3234
+#line 3238
 ncx_getn_int_short(const void **xpp, size_t nelems, short *tp)
-#line 3234
+#line 3238
 {
-#line 3234
+#line 3238
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3234
+#line 3238
 
-#line 3234
+#line 3238
  /* basic algorithm is:
-#line 3234
+#line 3238
   *   - ensure sane alignment of input data
-#line 3234
+#line 3238
   *   - copy (conversion happens automatically) input data
-#line 3234
+#line 3238
   *     to output
-#line 3234
+#line 3238
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3234
+#line 3238
   *     at next location for converted output
-#line 3234
+#line 3238
   */
-#line 3234
+#line 3238
   long i, j, ni;
-#line 3234
+#line 3238
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3234
+#line 3238
   int *xp;
-#line 3234
+#line 3238
   int nrange = 0;         /* number of range errors */
-#line 3234
+#line 3238
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3234
+#line 3238
   long cxp = (long) *((char**)xpp);
-#line 3234
+#line 3238
 
-#line 3234
+#line 3238
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3234
+#line 3238
   /* sjl: manually stripmine so we can limit amount of
-#line 3234
+#line 3238
    * vector work space reserved to LOOPCNT elements. Also
-#line 3234
+#line 3238
    * makes vectorisation easy */
-#line 3234
+#line 3238
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3234
+#line 3238
     ni=Min(nelems-j,LOOPCNT);
-#line 3234
+#line 3238
     if (realign) {
-#line 3234
+#line 3238
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3234
+#line 3238
       xp = tmp;
-#line 3234
+#line 3238
     } else {
-#line 3234
+#line 3238
       xp = (int *) *xpp;
-#line 3234
+#line 3238
     }
-#line 3234
+#line 3238
    /* copy the next block */
-#line 3234
+#line 3238
 #pragma cdir loopcnt=LOOPCNT
-#line 3234
+#line 3238
 #pragma cdir shortloop
-#line 3234
+#line 3238
     for (i=0; i<ni; i++) {
-#line 3234
+#line 3238
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3234
+#line 3238
      /* test for range errors (not always needed but do it anyway) */
-#line 3234
+#line 3238
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3234
+#line 3238
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3234
+#line 3238
       nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
-#line 3234
+#line 3238
     }
-#line 3234
+#line 3238
    /* update xpp and tp */
-#line 3234
+#line 3238
     if (realign) xp = (int *) *xpp;
-#line 3234
+#line 3238
     xp += ni;
-#line 3234
+#line 3238
     tp += ni;
-#line 3234
+#line 3238
     *xpp = (void*)xp;
-#line 3234
+#line 3238
   }
-#line 3234
+#line 3238
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3234
+#line 3238
 
-#line 3234
+#line 3238
 #else   /* not SX */
-#line 3234
+#line 3238
 	const char *xp = (const char *) *xpp;
-#line 3234
+#line 3238
 	int status = NC_NOERR;
-#line 3234
+#line 3238
 
-#line 3234
+#line 3238
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3234
+#line 3238
 	{
-#line 3234
+#line 3238
 		const int lstatus = ncx_get_int_short(xp, tp);
-#line 3234
+#line 3238
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3234
+#line 3238
 			status = lstatus;
-#line 3234
+#line 3238
 	}
-#line 3234
+#line 3238
 
-#line 3234
+#line 3238
 	*xpp = (const void *)xp;
-#line 3234
+#line 3238
 	return status;
-#line 3234
+#line 3238
 #endif
-#line 3234
+#line 3238
 }
-#line 3234
+#line 3238
 
 int
-#line 3235
+#line 3239
 ncx_getn_int_long(const void **xpp, size_t nelems, long *tp)
-#line 3235
+#line 3239
 {
-#line 3235
+#line 3239
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3235
+#line 3239
 
-#line 3235
+#line 3239
  /* basic algorithm is:
-#line 3235
+#line 3239
   *   - ensure sane alignment of input data
-#line 3235
+#line 3239
   *   - copy (conversion happens automatically) input data
-#line 3235
+#line 3239
   *     to output
-#line 3235
+#line 3239
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3235
+#line 3239
   *     at next location for converted output
-#line 3235
+#line 3239
   */
-#line 3235
+#line 3239
   long i, j, ni;
-#line 3235
+#line 3239
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3235
+#line 3239
   int *xp;
-#line 3235
+#line 3239
   int nrange = 0;         /* number of range errors */
-#line 3235
+#line 3239
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3235
+#line 3239
   long cxp = (long) *((char**)xpp);
-#line 3235
+#line 3239
 
-#line 3235
+#line 3239
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3235
+#line 3239
   /* sjl: manually stripmine so we can limit amount of
-#line 3235
+#line 3239
    * vector work space reserved to LOOPCNT elements. Also
-#line 3235
+#line 3239
    * makes vectorisation easy */
-#line 3235
+#line 3239
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3235
+#line 3239
     ni=Min(nelems-j,LOOPCNT);
-#line 3235
+#line 3239
     if (realign) {
-#line 3235
+#line 3239
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3235
+#line 3239
       xp = tmp;
-#line 3235
+#line 3239
     } else {
-#line 3235
+#line 3239
       xp = (int *) *xpp;
-#line 3235
+#line 3239
     }
-#line 3235
+#line 3239
    /* copy the next block */
-#line 3235
+#line 3239
 #pragma cdir loopcnt=LOOPCNT
-#line 3235
+#line 3239
 #pragma cdir shortloop
-#line 3235
+#line 3239
     for (i=0; i<ni; i++) {
-#line 3235
+#line 3239
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3235
+#line 3239
      /* test for range errors (not always needed but do it anyway) */
-#line 3235
+#line 3239
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3235
+#line 3239
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3235
+#line 3239
       nrange += xp[i] > LONG_MAX || xp[i] < LONG_MIN;
-#line 3235
+#line 3239
     }
-#line 3235
+#line 3239
    /* update xpp and tp */
-#line 3235
+#line 3239
     if (realign) xp = (int *) *xpp;
-#line 3235
+#line 3239
     xp += ni;
-#line 3235
+#line 3239
     tp += ni;
-#line 3235
+#line 3239
     *xpp = (void*)xp;
-#line 3235
+#line 3239
   }
-#line 3235
+#line 3239
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3235
+#line 3239
 
-#line 3235
+#line 3239
 #else   /* not SX */
-#line 3235
+#line 3239
 	const char *xp = (const char *) *xpp;
-#line 3235
+#line 3239
 	int status = NC_NOERR;
-#line 3235
+#line 3239
 
-#line 3235
+#line 3239
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3235
+#line 3239
 	{
-#line 3235
+#line 3239
 		const int lstatus = ncx_get_int_long(xp, tp);
-#line 3235
+#line 3239
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3235
+#line 3239
 			status = lstatus;
-#line 3235
+#line 3239
 	}
-#line 3235
+#line 3239
 
-#line 3235
+#line 3239
 	*xpp = (const void *)xp;
-#line 3235
+#line 3239
 	return status;
-#line 3235
+#line 3239
 #endif
-#line 3235
+#line 3239
 }
-#line 3235
+#line 3239
 
 int
-#line 3236
+#line 3240
 ncx_getn_int_float(const void **xpp, size_t nelems, float *tp)
-#line 3236
+#line 3240
 {
-#line 3236
+#line 3240
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3236
+#line 3240
 
-#line 3236
+#line 3240
  /* basic algorithm is:
-#line 3236
+#line 3240
   *   - ensure sane alignment of input data
-#line 3236
+#line 3240
   *   - copy (conversion happens automatically) input data
-#line 3236
+#line 3240
   *     to output
-#line 3236
+#line 3240
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3236
+#line 3240
   *     at next location for converted output
-#line 3236
+#line 3240
   */
-#line 3236
+#line 3240
   long i, j, ni;
-#line 3236
+#line 3240
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3236
+#line 3240
   int *xp;
-#line 3236
+#line 3240
   int nrange = 0;         /* number of range errors */
-#line 3236
+#line 3240
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3236
+#line 3240
   long cxp = (long) *((char**)xpp);
-#line 3236
+#line 3240
 
-#line 3236
+#line 3240
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3236
+#line 3240
   /* sjl: manually stripmine so we can limit amount of
-#line 3236
+#line 3240
    * vector work space reserved to LOOPCNT elements. Also
-#line 3236
+#line 3240
    * makes vectorisation easy */
-#line 3236
+#line 3240
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3236
+#line 3240
     ni=Min(nelems-j,LOOPCNT);
-#line 3236
+#line 3240
     if (realign) {
-#line 3236
+#line 3240
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3236
+#line 3240
       xp = tmp;
-#line 3236
+#line 3240
     } else {
-#line 3236
+#line 3240
       xp = (int *) *xpp;
-#line 3236
+#line 3240
     }
-#line 3236
+#line 3240
    /* copy the next block */
-#line 3236
+#line 3240
 #pragma cdir loopcnt=LOOPCNT
-#line 3236
+#line 3240
 #pragma cdir shortloop
-#line 3236
+#line 3240
     for (i=0; i<ni; i++) {
-#line 3236
+#line 3240
       tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
-#line 3236
+#line 3240
      /* test for range errors (not always needed but do it anyway) */
-#line 3236
+#line 3240
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3236
+#line 3240
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3236
+#line 3240
       nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
-#line 3236
+#line 3240
     }
-#line 3236
+#line 3240
    /* update xpp and tp */
-#line 3236
+#line 3240
     if (realign) xp = (int *) *xpp;
-#line 3236
+#line 3240
     xp += ni;
-#line 3236
+#line 3240
     tp += ni;
-#line 3236
+#line 3240
     *xpp = (void*)xp;
-#line 3236
+#line 3240
   }
-#line 3236
+#line 3240
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3236
+#line 3240
 
-#line 3236
+#line 3240
 #else   /* not SX */
-#line 3236
+#line 3240
 	const char *xp = (const char *) *xpp;
-#line 3236
+#line 3240
 	int status = NC_NOERR;
-#line 3236
+#line 3240
 
-#line 3236
+#line 3240
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3236
+#line 3240
 	{
-#line 3236
+#line 3240
 		const int lstatus = ncx_get_int_float(xp, tp);
-#line 3236
+#line 3240
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3236
+#line 3240
 			status = lstatus;
-#line 3236
+#line 3240
 	}
-#line 3236
+#line 3240
 
-#line 3236
+#line 3240
 	*xpp = (const void *)xp;
-#line 3236
+#line 3240
 	return status;
-#line 3236
+#line 3240
 #endif
-#line 3236
+#line 3240
 }
-#line 3236
+#line 3240
 
 int
-#line 3237
+#line 3241
 ncx_getn_int_double(const void **xpp, size_t nelems, double *tp)
-#line 3237
+#line 3241
 {
-#line 3237
+#line 3241
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3237
+#line 3241
 
-#line 3237
+#line 3241
  /* basic algorithm is:
-#line 3237
+#line 3241
   *   - ensure sane alignment of input data
-#line 3237
+#line 3241
   *   - copy (conversion happens automatically) input data
-#line 3237
+#line 3241
   *     to output
-#line 3237
+#line 3241
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3237
+#line 3241
   *     at next location for converted output
-#line 3237
+#line 3241
   */
-#line 3237
+#line 3241
   long i, j, ni;
-#line 3237
+#line 3241
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3237
+#line 3241
   int *xp;
-#line 3237
+#line 3241
   int nrange = 0;         /* number of range errors */
-#line 3237
+#line 3241
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3237
+#line 3241
   long cxp = (long) *((char**)xpp);
-#line 3237
+#line 3241
 
-#line 3237
+#line 3241
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3237
+#line 3241
   /* sjl: manually stripmine so we can limit amount of
-#line 3237
+#line 3241
    * vector work space reserved to LOOPCNT elements. Also
-#line 3237
+#line 3241
    * makes vectorisation easy */
-#line 3237
+#line 3241
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3237
+#line 3241
     ni=Min(nelems-j,LOOPCNT);
-#line 3237
+#line 3241
     if (realign) {
-#line 3237
+#line 3241
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3237
+#line 3241
       xp = tmp;
-#line 3237
+#line 3241
     } else {
-#line 3237
+#line 3241
       xp = (int *) *xpp;
-#line 3237
+#line 3241
     }
-#line 3237
+#line 3241
    /* copy the next block */
-#line 3237
+#line 3241
 #pragma cdir loopcnt=LOOPCNT
-#line 3237
+#line 3241
 #pragma cdir shortloop
-#line 3237
+#line 3241
     for (i=0; i<ni; i++) {
-#line 3237
+#line 3241
       tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
-#line 3237
+#line 3241
      /* test for range errors (not always needed but do it anyway) */
-#line 3237
+#line 3241
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3237
+#line 3241
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3237
+#line 3241
       nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
-#line 3237
+#line 3241
     }
-#line 3237
+#line 3241
    /* update xpp and tp */
-#line 3237
+#line 3241
     if (realign) xp = (int *) *xpp;
-#line 3237
+#line 3241
     xp += ni;
-#line 3237
+#line 3241
     tp += ni;
-#line 3237
+#line 3241
     *xpp = (void*)xp;
-#line 3237
+#line 3241
   }
-#line 3237
+#line 3241
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3237
+#line 3241
 
-#line 3237
+#line 3241
 #else   /* not SX */
-#line 3237
+#line 3241
 	const char *xp = (const char *) *xpp;
-#line 3237
+#line 3241
 	int status = NC_NOERR;
-#line 3237
+#line 3241
 
-#line 3237
+#line 3241
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3237
+#line 3241
 	{
-#line 3237
+#line 3241
 		const int lstatus = ncx_get_int_double(xp, tp);
-#line 3237
+#line 3241
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3237
+#line 3241
 			status = lstatus;
-#line 3237
+#line 3241
 	}
-#line 3237
+#line 3241
 
-#line 3237
+#line 3241
 	*xpp = (const void *)xp;
-#line 3237
+#line 3241
 	return status;
-#line 3237
+#line 3241
 #endif
-#line 3237
+#line 3241
 }
-#line 3237
+#line 3241
 
 int
-#line 3238
+#line 3242
 ncx_getn_int_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3238
+#line 3242
 {
-#line 3238
+#line 3242
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3238
+#line 3242
 
-#line 3238
+#line 3242
  /* basic algorithm is:
-#line 3238
+#line 3242
   *   - ensure sane alignment of input data
-#line 3238
+#line 3242
   *   - copy (conversion happens automatically) input data
-#line 3238
+#line 3242
   *     to output
-#line 3238
+#line 3242
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3238
+#line 3242
   *     at next location for converted output
-#line 3238
+#line 3242
   */
-#line 3238
+#line 3242
   long i, j, ni;
-#line 3238
+#line 3242
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3238
+#line 3242
   int *xp;
-#line 3238
+#line 3242
   int nrange = 0;         /* number of range errors */
-#line 3238
+#line 3242
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3238
+#line 3242
   long cxp = (long) *((char**)xpp);
-#line 3238
+#line 3242
 
-#line 3238
+#line 3242
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3238
+#line 3242
   /* sjl: manually stripmine so we can limit amount of
-#line 3238
+#line 3242
    * vector work space reserved to LOOPCNT elements. Also
-#line 3238
+#line 3242
    * makes vectorisation easy */
-#line 3238
+#line 3242
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3238
+#line 3242
     ni=Min(nelems-j,LOOPCNT);
-#line 3238
+#line 3242
     if (realign) {
-#line 3238
+#line 3242
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3238
+#line 3242
       xp = tmp;
-#line 3238
+#line 3242
     } else {
-#line 3238
+#line 3242
       xp = (int *) *xpp;
-#line 3238
+#line 3242
     }
-#line 3238
+#line 3242
    /* copy the next block */
-#line 3238
+#line 3242
 #pragma cdir loopcnt=LOOPCNT
-#line 3238
+#line 3242
 #pragma cdir shortloop
-#line 3238
+#line 3242
     for (i=0; i<ni; i++) {
-#line 3238
+#line 3242
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3238
+#line 3242
      /* test for range errors (not always needed but do it anyway) */
-#line 3238
+#line 3242
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3238
+#line 3242
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3238
+#line 3242
       nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
-#line 3238
+#line 3242
     }
-#line 3238
+#line 3242
    /* update xpp and tp */
-#line 3238
+#line 3242
     if (realign) xp = (int *) *xpp;
-#line 3238
+#line 3242
     xp += ni;
-#line 3238
+#line 3242
     tp += ni;
-#line 3238
+#line 3242
     *xpp = (void*)xp;
-#line 3238
+#line 3242
   }
-#line 3238
+#line 3242
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3238
+#line 3242
 
-#line 3238
+#line 3242
 #else   /* not SX */
-#line 3238
+#line 3242
 	const char *xp = (const char *) *xpp;
-#line 3238
+#line 3242
 	int status = NC_NOERR;
-#line 3238
+#line 3242
 
-#line 3238
+#line 3242
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3238
+#line 3242
 	{
-#line 3238
+#line 3242
 		const int lstatus = ncx_get_int_longlong(xp, tp);
-#line 3238
+#line 3242
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3238
+#line 3242
 			status = lstatus;
-#line 3238
+#line 3242
 	}
-#line 3238
+#line 3242
 
-#line 3238
+#line 3242
 	*xpp = (const void *)xp;
-#line 3238
+#line 3242
 	return status;
-#line 3238
+#line 3242
 #endif
-#line 3238
+#line 3242
 }
-#line 3238
+#line 3242
 
 int
-#line 3239
+#line 3243
 ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3239
+#line 3243
 {
-#line 3239
+#line 3243
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3239
+#line 3243
 
-#line 3239
+#line 3243
  /* basic algorithm is:
-#line 3239
+#line 3243
   *   - ensure sane alignment of input data
-#line 3239
+#line 3243
   *   - copy (conversion happens automatically) input data
-#line 3239
+#line 3243
   *     to output
-#line 3239
+#line 3243
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3239
+#line 3243
   *     at next location for converted output
-#line 3239
+#line 3243
   */
-#line 3239
+#line 3243
   long i, j, ni;
-#line 3239
+#line 3243
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3239
+#line 3243
   int *xp;
-#line 3239
+#line 3243
   int nrange = 0;         /* number of range errors */
-#line 3239
+#line 3243
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3239
+#line 3243
   long cxp = (long) *((char**)xpp);
-#line 3239
+#line 3243
 
-#line 3239
+#line 3243
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3239
+#line 3243
   /* sjl: manually stripmine so we can limit amount of
-#line 3239
+#line 3243
    * vector work space reserved to LOOPCNT elements. Also
-#line 3239
+#line 3243
    * makes vectorisation easy */
-#line 3239
+#line 3243
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3239
+#line 3243
     ni=Min(nelems-j,LOOPCNT);
-#line 3239
+#line 3243
     if (realign) {
-#line 3239
+#line 3243
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3239
+#line 3243
       xp = tmp;
-#line 3239
+#line 3243
     } else {
-#line 3239
+#line 3243
       xp = (int *) *xpp;
-#line 3239
+#line 3243
     }
-#line 3239
+#line 3243
    /* copy the next block */
-#line 3239
+#line 3243
 #pragma cdir loopcnt=LOOPCNT
-#line 3239
+#line 3243
 #pragma cdir shortloop
-#line 3239
+#line 3243
     for (i=0; i<ni; i++) {
-#line 3239
+#line 3243
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3239
+#line 3243
      /* test for range errors (not always needed but do it anyway) */
-#line 3239
+#line 3243
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3239
+#line 3243
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3239
+#line 3243
       nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
-#line 3239
+#line 3243
     }
-#line 3239
+#line 3243
    /* update xpp and tp */
-#line 3239
+#line 3243
     if (realign) xp = (int *) *xpp;
-#line 3239
+#line 3243
     xp += ni;
-#line 3239
+#line 3243
     tp += ni;
-#line 3239
+#line 3243
     *xpp = (void*)xp;
-#line 3239
+#line 3243
   }
-#line 3239
+#line 3243
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3239
+#line 3243
 
-#line 3239
+#line 3243
 #else   /* not SX */
-#line 3239
+#line 3243
 	const char *xp = (const char *) *xpp;
-#line 3239
+#line 3243
 	int status = NC_NOERR;
-#line 3239
+#line 3243
 
-#line 3239
+#line 3243
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3239
+#line 3243
 	{
-#line 3239
+#line 3243
 		const int lstatus = ncx_get_int_uchar(xp, tp);
-#line 3239
+#line 3243
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3239
+#line 3243
 			status = lstatus;
-#line 3239
+#line 3243
 	}
-#line 3239
+#line 3243
 
-#line 3239
+#line 3243
 	*xpp = (const void *)xp;
-#line 3239
+#line 3243
 	return status;
-#line 3239
+#line 3243
 #endif
-#line 3239
+#line 3243
 }
-#line 3239
+#line 3243
 
 int
-#line 3240
+#line 3244
 ncx_getn_int_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3240
+#line 3244
 {
-#line 3240
+#line 3244
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3240
+#line 3244
 
-#line 3240
+#line 3244
  /* basic algorithm is:
-#line 3240
+#line 3244
   *   - ensure sane alignment of input data
-#line 3240
+#line 3244
   *   - copy (conversion happens automatically) input data
-#line 3240
+#line 3244
   *     to output
-#line 3240
+#line 3244
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3240
+#line 3244
   *     at next location for converted output
-#line 3240
+#line 3244
   */
-#line 3240
+#line 3244
   long i, j, ni;
-#line 3240
+#line 3244
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3240
+#line 3244
   int *xp;
-#line 3240
+#line 3244
   int nrange = 0;         /* number of range errors */
-#line 3240
+#line 3244
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3240
+#line 3244
   long cxp = (long) *((char**)xpp);
-#line 3240
+#line 3244
 
-#line 3240
+#line 3244
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3240
+#line 3244
   /* sjl: manually stripmine so we can limit amount of
-#line 3240
+#line 3244
    * vector work space reserved to LOOPCNT elements. Also
-#line 3240
+#line 3244
    * makes vectorisation easy */
-#line 3240
+#line 3244
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3240
+#line 3244
     ni=Min(nelems-j,LOOPCNT);
-#line 3240
+#line 3244
     if (realign) {
-#line 3240
+#line 3244
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3240
+#line 3244
       xp = tmp;
-#line 3240
+#line 3244
     } else {
-#line 3240
+#line 3244
       xp = (int *) *xpp;
-#line 3240
+#line 3244
     }
-#line 3240
+#line 3244
    /* copy the next block */
-#line 3240
+#line 3244
 #pragma cdir loopcnt=LOOPCNT
-#line 3240
+#line 3244
 #pragma cdir shortloop
-#line 3240
+#line 3244
     for (i=0; i<ni; i++) {
-#line 3240
+#line 3244
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3240
+#line 3244
      /* test for range errors (not always needed but do it anyway) */
-#line 3240
+#line 3244
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3240
+#line 3244
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3240
+#line 3244
       nrange += xp[i] > USHORT_MAX || xp[i] < 0;
-#line 3240
+#line 3244
     }
-#line 3240
+#line 3244
    /* update xpp and tp */
-#line 3240
+#line 3244
     if (realign) xp = (int *) *xpp;
-#line 3240
+#line 3244
     xp += ni;
-#line 3240
+#line 3244
     tp += ni;
-#line 3240
+#line 3244
     *xpp = (void*)xp;
-#line 3240
+#line 3244
   }
-#line 3240
+#line 3244
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3240
+#line 3244
 
-#line 3240
+#line 3244
 #else   /* not SX */
-#line 3240
+#line 3244
 	const char *xp = (const char *) *xpp;
-#line 3240
+#line 3244
 	int status = NC_NOERR;
-#line 3240
+#line 3244
 
-#line 3240
+#line 3244
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3240
+#line 3244
 	{
-#line 3240
+#line 3244
 		const int lstatus = ncx_get_int_ushort(xp, tp);
-#line 3240
+#line 3244
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3240
+#line 3244
 			status = lstatus;
-#line 3240
+#line 3244
 	}
-#line 3240
+#line 3244
 
-#line 3240
+#line 3244
 	*xpp = (const void *)xp;
-#line 3240
+#line 3244
 	return status;
-#line 3240
+#line 3244
 #endif
-#line 3240
+#line 3244
 }
-#line 3240
+#line 3244
 
 int
-#line 3241
+#line 3245
 ncx_getn_int_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3241
+#line 3245
 {
-#line 3241
+#line 3245
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3241
+#line 3245
 
-#line 3241
+#line 3245
  /* basic algorithm is:
-#line 3241
+#line 3245
   *   - ensure sane alignment of input data
-#line 3241
+#line 3245
   *   - copy (conversion happens automatically) input data
-#line 3241
+#line 3245
   *     to output
-#line 3241
+#line 3245
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3241
+#line 3245
   *     at next location for converted output
-#line 3241
+#line 3245
   */
-#line 3241
+#line 3245
   long i, j, ni;
-#line 3241
+#line 3245
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3241
+#line 3245
   int *xp;
-#line 3241
+#line 3245
   int nrange = 0;         /* number of range errors */
-#line 3241
+#line 3245
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3241
+#line 3245
   long cxp = (long) *((char**)xpp);
-#line 3241
+#line 3245
 
-#line 3241
+#line 3245
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3241
+#line 3245
   /* sjl: manually stripmine so we can limit amount of
-#line 3241
+#line 3245
    * vector work space reserved to LOOPCNT elements. Also
-#line 3241
+#line 3245
    * makes vectorisation easy */
-#line 3241
+#line 3245
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3241
+#line 3245
     ni=Min(nelems-j,LOOPCNT);
-#line 3241
+#line 3245
     if (realign) {
-#line 3241
+#line 3245
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3241
+#line 3245
       xp = tmp;
-#line 3241
+#line 3245
     } else {
-#line 3241
+#line 3245
       xp = (int *) *xpp;
-#line 3241
+#line 3245
     }
-#line 3241
+#line 3245
    /* copy the next block */
-#line 3241
+#line 3245
 #pragma cdir loopcnt=LOOPCNT
-#line 3241
+#line 3245
 #pragma cdir shortloop
-#line 3241
+#line 3245
     for (i=0; i<ni; i++) {
-#line 3241
+#line 3245
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3241
+#line 3245
      /* test for range errors (not always needed but do it anyway) */
-#line 3241
+#line 3245
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3241
+#line 3245
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3241
+#line 3245
       nrange += xp[i] > UINT_MAX || xp[i] < 0;
-#line 3241
+#line 3245
     }
-#line 3241
+#line 3245
    /* update xpp and tp */
-#line 3241
+#line 3245
     if (realign) xp = (int *) *xpp;
-#line 3241
+#line 3245
     xp += ni;
-#line 3241
+#line 3245
     tp += ni;
-#line 3241
+#line 3245
     *xpp = (void*)xp;
-#line 3241
+#line 3245
   }
-#line 3241
+#line 3245
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3241
+#line 3245
 
-#line 3241
+#line 3245
 #else   /* not SX */
-#line 3241
+#line 3245
 	const char *xp = (const char *) *xpp;
-#line 3241
+#line 3245
 	int status = NC_NOERR;
-#line 3241
+#line 3245
 
-#line 3241
+#line 3245
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3241
+#line 3245
 	{
-#line 3241
+#line 3245
 		const int lstatus = ncx_get_int_uint(xp, tp);
-#line 3241
+#line 3245
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3241
+#line 3245
 			status = lstatus;
-#line 3241
+#line 3245
 	}
-#line 3241
+#line 3245
 
-#line 3241
+#line 3245
 	*xpp = (const void *)xp;
-#line 3241
+#line 3245
 	return status;
-#line 3241
+#line 3245
 #endif
-#line 3241
+#line 3245
 }
-#line 3241
+#line 3245
 
 int
-#line 3242
+#line 3246
 ncx_getn_int_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3242
+#line 3246
 {
-#line 3242
+#line 3246
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3242
+#line 3246
 
-#line 3242
+#line 3246
  /* basic algorithm is:
-#line 3242
+#line 3246
   *   - ensure sane alignment of input data
-#line 3242
+#line 3246
   *   - copy (conversion happens automatically) input data
-#line 3242
+#line 3246
   *     to output
-#line 3242
+#line 3246
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3242
+#line 3246
   *     at next location for converted output
-#line 3242
+#line 3246
   */
-#line 3242
+#line 3246
   long i, j, ni;
-#line 3242
+#line 3246
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3242
+#line 3246
   int *xp;
-#line 3242
+#line 3246
   int nrange = 0;         /* number of range errors */
-#line 3242
+#line 3246
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3242
+#line 3246
   long cxp = (long) *((char**)xpp);
-#line 3242
+#line 3246
 
-#line 3242
+#line 3246
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3242
+#line 3246
   /* sjl: manually stripmine so we can limit amount of
-#line 3242
+#line 3246
    * vector work space reserved to LOOPCNT elements. Also
-#line 3242
+#line 3246
    * makes vectorisation easy */
-#line 3242
+#line 3246
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3242
+#line 3246
     ni=Min(nelems-j,LOOPCNT);
-#line 3242
+#line 3246
     if (realign) {
-#line 3242
+#line 3246
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT));
-#line 3242
+#line 3246
       xp = tmp;
-#line 3242
+#line 3246
     } else {
-#line 3242
+#line 3246
       xp = (int *) *xpp;
-#line 3242
+#line 3246
     }
-#line 3242
+#line 3246
    /* copy the next block */
-#line 3242
+#line 3246
 #pragma cdir loopcnt=LOOPCNT
-#line 3242
+#line 3246
 #pragma cdir shortloop
-#line 3242
+#line 3246
     for (i=0; i<ni; i++) {
-#line 3242
+#line 3246
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3242
+#line 3246
      /* test for range errors (not always needed but do it anyway) */
-#line 3242
+#line 3246
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3242
+#line 3246
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3242
+#line 3246
       nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
-#line 3242
+#line 3246
     }
-#line 3242
+#line 3246
    /* update xpp and tp */
-#line 3242
+#line 3246
     if (realign) xp = (int *) *xpp;
-#line 3242
+#line 3246
     xp += ni;
-#line 3242
+#line 3246
     tp += ni;
-#line 3242
+#line 3246
     *xpp = (void*)xp;
-#line 3242
+#line 3246
   }
-#line 3242
+#line 3246
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3242
+#line 3246
 
-#line 3242
+#line 3246
 #else   /* not SX */
-#line 3242
+#line 3246
 	const char *xp = (const char *) *xpp;
-#line 3242
+#line 3246
 	int status = NC_NOERR;
-#line 3242
+#line 3246
 
-#line 3242
+#line 3246
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3242
+#line 3246
 	{
-#line 3242
+#line 3246
 		const int lstatus = ncx_get_int_ulonglong(xp, tp);
-#line 3242
+#line 3246
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3242
+#line 3246
 			status = lstatus;
-#line 3242
+#line 3246
 	}
-#line 3242
+#line 3246
 
-#line 3242
+#line 3246
 	*xpp = (const void *)xp;
-#line 3242
+#line 3246
 	return status;
-#line 3242
+#line 3246
 #endif
-#line 3242
+#line 3246
 }
-#line 3242
+#line 3246
 
 
 #if X_SIZEOF_INT == SIZEOF_INT
@@ -20851,1532 +20855,1532 @@ ncx_putn_int_int(void **xpp, size_t nelems, const int *tp, void *fillp)
 }
 #else
 int
-#line 3258
+#line 3262
 ncx_putn_int_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3258
+#line 3262
 {
-#line 3258
+#line 3262
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3258
+#line 3262
 
-#line 3258
+#line 3262
  /* basic algorithm is:
-#line 3258
+#line 3262
   *   - ensure sane alignment of output data
-#line 3258
+#line 3262
   *   - copy (conversion happens automatically) input data
-#line 3258
+#line 3262
   *     to output
-#line 3258
+#line 3262
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3258
+#line 3262
   *     at next location for converted output
-#line 3258
+#line 3262
   */
-#line 3258
+#line 3262
   long i, j, ni;
-#line 3258
+#line 3262
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3258
+#line 3262
   int *xp;
-#line 3258
+#line 3262
   int nrange = 0;         /* number of range errors */
-#line 3258
+#line 3262
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3258
+#line 3262
   long cxp = (long) *((char**)xpp);
-#line 3258
+#line 3262
 
-#line 3258
+#line 3262
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3258
+#line 3262
   /* sjl: manually stripmine so we can limit amount of
-#line 3258
+#line 3262
    * vector work space reserved to LOOPCNT elements. Also
-#line 3258
+#line 3262
    * makes vectorisation easy */
-#line 3258
+#line 3262
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3258
+#line 3262
     ni=Min(nelems-j,LOOPCNT);
-#line 3258
+#line 3262
     if (realign) {
-#line 3258
+#line 3262
       xp = tmp;
-#line 3258
+#line 3262
     } else {
-#line 3258
+#line 3262
       xp = (int *) *xpp;
-#line 3258
+#line 3262
     }
-#line 3258
+#line 3262
    /* copy the next block */
-#line 3258
+#line 3262
 #pragma cdir loopcnt=LOOPCNT
-#line 3258
+#line 3262
 #pragma cdir shortloop
-#line 3258
+#line 3262
     for (i=0; i<ni; i++) {
-#line 3258
+#line 3262
       /* the normal case: */
-#line 3258
+#line 3262
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3258
+#line 3262
      /* test for range errors (not always needed but do it anyway) */
-#line 3258
+#line 3262
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3258
+#line 3262
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3258
+#line 3262
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3258
+#line 3262
     }
-#line 3258
+#line 3262
    /* copy workspace back if necessary */
-#line 3258
+#line 3262
     if (realign) {
-#line 3258
+#line 3262
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3258
+#line 3262
       xp = (int *) *xpp;
-#line 3258
+#line 3262
     }
-#line 3258
+#line 3262
    /* update xpp and tp */
-#line 3258
+#line 3262
     xp += ni;
-#line 3258
+#line 3262
     tp += ni;
-#line 3258
+#line 3262
     *xpp = (void*)xp;
-#line 3258
+#line 3262
   }
-#line 3258
+#line 3262
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3258
+#line 3262
 
-#line 3258
+#line 3262
 #else   /* not SX */
-#line 3258
+#line 3262
 
-#line 3258
+#line 3262
 	char *xp = (char *) *xpp;
-#line 3258
+#line 3262
 	int status = NC_NOERR;
-#line 3258
+#line 3262
 
-#line 3258
+#line 3262
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3258
+#line 3262
 	{
-#line 3258
+#line 3262
 		int lstatus = ncx_put_int_int(xp, tp, fillp);
-#line 3258
+#line 3262
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3258
+#line 3262
 			status = lstatus;
-#line 3258
+#line 3262
 	}
-#line 3258
+#line 3262
 
-#line 3258
+#line 3262
 	*xpp = (void *)xp;
-#line 3258
+#line 3262
 	return status;
-#line 3258
+#line 3262
 #endif
-#line 3258
+#line 3262
 }
-#line 3258
+#line 3262
 
 #endif
 int
-#line 3260
+#line 3264
 ncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3260
+#line 3264
 {
-#line 3260
+#line 3264
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3260
+#line 3264
 
-#line 3260
+#line 3264
  /* basic algorithm is:
-#line 3260
+#line 3264
   *   - ensure sane alignment of output data
-#line 3260
+#line 3264
   *   - copy (conversion happens automatically) input data
-#line 3260
+#line 3264
   *     to output
-#line 3260
+#line 3264
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3260
+#line 3264
   *     at next location for converted output
-#line 3260
+#line 3264
   */
-#line 3260
+#line 3264
   long i, j, ni;
-#line 3260
+#line 3264
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3260
+#line 3264
   int *xp;
-#line 3260
+#line 3264
   int nrange = 0;         /* number of range errors */
-#line 3260
+#line 3264
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3260
+#line 3264
   long cxp = (long) *((char**)xpp);
-#line 3260
+#line 3264
 
-#line 3260
+#line 3264
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3260
+#line 3264
   /* sjl: manually stripmine so we can limit amount of
-#line 3260
+#line 3264
    * vector work space reserved to LOOPCNT elements. Also
-#line 3260
+#line 3264
    * makes vectorisation easy */
-#line 3260
+#line 3264
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3260
+#line 3264
     ni=Min(nelems-j,LOOPCNT);
-#line 3260
+#line 3264
     if (realign) {
-#line 3260
+#line 3264
       xp = tmp;
-#line 3260
+#line 3264
     } else {
-#line 3260
+#line 3264
       xp = (int *) *xpp;
-#line 3260
+#line 3264
     }
-#line 3260
+#line 3264
    /* copy the next block */
-#line 3260
+#line 3264
 #pragma cdir loopcnt=LOOPCNT
-#line 3260
+#line 3264
 #pragma cdir shortloop
-#line 3260
+#line 3264
     for (i=0; i<ni; i++) {
-#line 3260
+#line 3264
       /* the normal case: */
-#line 3260
+#line 3264
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3260
+#line 3264
      /* test for range errors (not always needed but do it anyway) */
-#line 3260
+#line 3264
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3260
+#line 3264
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3260
+#line 3264
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3260
+#line 3264
     }
-#line 3260
+#line 3264
    /* copy workspace back if necessary */
-#line 3260
+#line 3264
     if (realign) {
-#line 3260
+#line 3264
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3260
+#line 3264
       xp = (int *) *xpp;
-#line 3260
+#line 3264
     }
-#line 3260
+#line 3264
    /* update xpp and tp */
-#line 3260
+#line 3264
     xp += ni;
-#line 3260
+#line 3264
     tp += ni;
-#line 3260
+#line 3264
     *xpp = (void*)xp;
-#line 3260
+#line 3264
   }
-#line 3260
+#line 3264
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3260
+#line 3264
 
-#line 3260
+#line 3264
 #else   /* not SX */
-#line 3260
+#line 3264
 
-#line 3260
+#line 3264
 	char *xp = (char *) *xpp;
-#line 3260
+#line 3264
 	int status = NC_NOERR;
-#line 3260
+#line 3264
 
-#line 3260
+#line 3264
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3260
+#line 3264
 	{
-#line 3260
+#line 3264
 		int lstatus = ncx_put_int_schar(xp, tp, fillp);
-#line 3260
+#line 3264
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3260
+#line 3264
 			status = lstatus;
-#line 3260
+#line 3264
 	}
-#line 3260
+#line 3264
 
-#line 3260
+#line 3264
 	*xpp = (void *)xp;
-#line 3260
+#line 3264
 	return status;
-#line 3260
+#line 3264
 #endif
-#line 3260
+#line 3264
 }
-#line 3260
+#line 3264
 
 int
-#line 3261
+#line 3265
 ncx_putn_int_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3261
+#line 3265
 {
-#line 3261
+#line 3265
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3261
+#line 3265
 
-#line 3261
+#line 3265
  /* basic algorithm is:
-#line 3261
+#line 3265
   *   - ensure sane alignment of output data
-#line 3261
+#line 3265
   *   - copy (conversion happens automatically) input data
-#line 3261
+#line 3265
   *     to output
-#line 3261
+#line 3265
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3261
+#line 3265
   *     at next location for converted output
-#line 3261
+#line 3265
   */
-#line 3261
+#line 3265
   long i, j, ni;
-#line 3261
+#line 3265
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3261
+#line 3265
   int *xp;
-#line 3261
+#line 3265
   int nrange = 0;         /* number of range errors */
-#line 3261
+#line 3265
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3261
+#line 3265
   long cxp = (long) *((char**)xpp);
-#line 3261
+#line 3265
 
-#line 3261
+#line 3265
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3261
+#line 3265
   /* sjl: manually stripmine so we can limit amount of
-#line 3261
+#line 3265
    * vector work space reserved to LOOPCNT elements. Also
-#line 3261
+#line 3265
    * makes vectorisation easy */
-#line 3261
+#line 3265
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3261
+#line 3265
     ni=Min(nelems-j,LOOPCNT);
-#line 3261
+#line 3265
     if (realign) {
-#line 3261
+#line 3265
       xp = tmp;
-#line 3261
+#line 3265
     } else {
-#line 3261
+#line 3265
       xp = (int *) *xpp;
-#line 3261
+#line 3265
     }
-#line 3261
+#line 3265
    /* copy the next block */
-#line 3261
+#line 3265
 #pragma cdir loopcnt=LOOPCNT
-#line 3261
+#line 3265
 #pragma cdir shortloop
-#line 3261
+#line 3265
     for (i=0; i<ni; i++) {
-#line 3261
+#line 3265
       /* the normal case: */
-#line 3261
+#line 3265
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3261
+#line 3265
      /* test for range errors (not always needed but do it anyway) */
-#line 3261
+#line 3265
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3261
+#line 3265
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3261
+#line 3265
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3261
+#line 3265
     }
-#line 3261
+#line 3265
    /* copy workspace back if necessary */
-#line 3261
+#line 3265
     if (realign) {
-#line 3261
+#line 3265
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3261
+#line 3265
       xp = (int *) *xpp;
-#line 3261
+#line 3265
     }
-#line 3261
+#line 3265
    /* update xpp and tp */
-#line 3261
+#line 3265
     xp += ni;
-#line 3261
+#line 3265
     tp += ni;
-#line 3261
+#line 3265
     *xpp = (void*)xp;
-#line 3261
+#line 3265
   }
-#line 3261
+#line 3265
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3261
+#line 3265
 
-#line 3261
+#line 3265
 #else   /* not SX */
-#line 3261
+#line 3265
 
-#line 3261
+#line 3265
 	char *xp = (char *) *xpp;
-#line 3261
+#line 3265
 	int status = NC_NOERR;
-#line 3261
+#line 3265
 
-#line 3261
+#line 3265
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3261
+#line 3265
 	{
-#line 3261
+#line 3265
 		int lstatus = ncx_put_int_short(xp, tp, fillp);
-#line 3261
+#line 3265
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3261
+#line 3265
 			status = lstatus;
-#line 3261
+#line 3265
 	}
-#line 3261
+#line 3265
 
-#line 3261
+#line 3265
 	*xpp = (void *)xp;
-#line 3261
+#line 3265
 	return status;
-#line 3261
+#line 3265
 #endif
-#line 3261
+#line 3265
 }
-#line 3261
+#line 3265
 
 int
-#line 3262
+#line 3266
 ncx_putn_int_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3262
+#line 3266
 {
-#line 3262
+#line 3266
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3262
+#line 3266
 
-#line 3262
+#line 3266
  /* basic algorithm is:
-#line 3262
+#line 3266
   *   - ensure sane alignment of output data
-#line 3262
+#line 3266
   *   - copy (conversion happens automatically) input data
-#line 3262
+#line 3266
   *     to output
-#line 3262
+#line 3266
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3262
+#line 3266
   *     at next location for converted output
-#line 3262
+#line 3266
   */
-#line 3262
+#line 3266
   long i, j, ni;
-#line 3262
+#line 3266
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3262
+#line 3266
   int *xp;
-#line 3262
+#line 3266
   int nrange = 0;         /* number of range errors */
-#line 3262
+#line 3266
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3262
+#line 3266
   long cxp = (long) *((char**)xpp);
-#line 3262
+#line 3266
 
-#line 3262
+#line 3266
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3262
+#line 3266
   /* sjl: manually stripmine so we can limit amount of
-#line 3262
+#line 3266
    * vector work space reserved to LOOPCNT elements. Also
-#line 3262
+#line 3266
    * makes vectorisation easy */
-#line 3262
+#line 3266
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3262
+#line 3266
     ni=Min(nelems-j,LOOPCNT);
-#line 3262
+#line 3266
     if (realign) {
-#line 3262
+#line 3266
       xp = tmp;
-#line 3262
+#line 3266
     } else {
-#line 3262
+#line 3266
       xp = (int *) *xpp;
-#line 3262
+#line 3266
     }
-#line 3262
+#line 3266
    /* copy the next block */
-#line 3262
+#line 3266
 #pragma cdir loopcnt=LOOPCNT
-#line 3262
+#line 3266
 #pragma cdir shortloop
-#line 3262
+#line 3266
     for (i=0; i<ni; i++) {
-#line 3262
+#line 3266
       /* the normal case: */
-#line 3262
+#line 3266
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3262
+#line 3266
      /* test for range errors (not always needed but do it anyway) */
-#line 3262
+#line 3266
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3262
+#line 3266
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3262
+#line 3266
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3262
+#line 3266
     }
-#line 3262
+#line 3266
    /* copy workspace back if necessary */
-#line 3262
+#line 3266
     if (realign) {
-#line 3262
+#line 3266
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3262
+#line 3266
       xp = (int *) *xpp;
-#line 3262
+#line 3266
     }
-#line 3262
+#line 3266
    /* update xpp and tp */
-#line 3262
+#line 3266
     xp += ni;
-#line 3262
+#line 3266
     tp += ni;
-#line 3262
+#line 3266
     *xpp = (void*)xp;
-#line 3262
+#line 3266
   }
-#line 3262
+#line 3266
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3262
+#line 3266
 
-#line 3262
+#line 3266
 #else   /* not SX */
-#line 3262
+#line 3266
 
-#line 3262
+#line 3266
 	char *xp = (char *) *xpp;
-#line 3262
+#line 3266
 	int status = NC_NOERR;
-#line 3262
+#line 3266
 
-#line 3262
+#line 3266
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3262
+#line 3266
 	{
-#line 3262
+#line 3266
 		int lstatus = ncx_put_int_long(xp, tp, fillp);
-#line 3262
+#line 3266
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3262
+#line 3266
 			status = lstatus;
-#line 3262
+#line 3266
 	}
-#line 3262
+#line 3266
 
-#line 3262
+#line 3266
 	*xpp = (void *)xp;
-#line 3262
+#line 3266
 	return status;
-#line 3262
+#line 3266
 #endif
-#line 3262
+#line 3266
 }
-#line 3262
+#line 3266
 
 int
-#line 3263
+#line 3267
 ncx_putn_int_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3263
+#line 3267
 {
-#line 3263
+#line 3267
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3263
+#line 3267
 
-#line 3263
+#line 3267
  /* basic algorithm is:
-#line 3263
+#line 3267
   *   - ensure sane alignment of output data
-#line 3263
+#line 3267
   *   - copy (conversion happens automatically) input data
-#line 3263
+#line 3267
   *     to output
-#line 3263
+#line 3267
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3263
+#line 3267
   *     at next location for converted output
-#line 3263
+#line 3267
   */
-#line 3263
+#line 3267
   long i, j, ni;
-#line 3263
+#line 3267
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3263
+#line 3267
   int *xp;
-#line 3263
+#line 3267
   double d;               /* special case for ncx_putn_int_float */
-#line 3263
+#line 3267
   int nrange = 0;         /* number of range errors */
-#line 3263
+#line 3267
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3263
+#line 3267
   long cxp = (long) *((char**)xpp);
-#line 3263
+#line 3267
 
-#line 3263
+#line 3267
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3263
+#line 3267
   /* sjl: manually stripmine so we can limit amount of
-#line 3263
+#line 3267
    * vector work space reserved to LOOPCNT elements. Also
-#line 3263
+#line 3267
    * makes vectorisation easy */
-#line 3263
+#line 3267
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3263
+#line 3267
     ni=Min(nelems-j,LOOPCNT);
-#line 3263
+#line 3267
     if (realign) {
-#line 3263
+#line 3267
       xp = tmp;
-#line 3263
+#line 3267
     } else {
-#line 3263
+#line 3267
       xp = (int *) *xpp;
-#line 3263
+#line 3267
     }
-#line 3263
+#line 3267
    /* copy the next block */
-#line 3263
+#line 3267
 #pragma cdir loopcnt=LOOPCNT
-#line 3263
+#line 3267
 #pragma cdir shortloop
-#line 3263
+#line 3267
     for (i=0; i<ni; i++) {
-#line 3263
+#line 3267
       /* for some reason int to float, for putn, requires a special case */
-#line 3263
+#line 3267
       d = tp[i];
-#line 3263
+#line 3267
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) d));
-#line 3263
+#line 3267
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3263
+#line 3267
     }
-#line 3263
+#line 3267
    /* copy workspace back if necessary */
-#line 3263
+#line 3267
     if (realign) {
-#line 3263
+#line 3267
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3263
+#line 3267
       xp = (int *) *xpp;
-#line 3263
+#line 3267
     }
-#line 3263
+#line 3267
    /* update xpp and tp */
-#line 3263
+#line 3267
     xp += ni;
-#line 3263
+#line 3267
     tp += ni;
-#line 3263
+#line 3267
     *xpp = (void*)xp;
-#line 3263
+#line 3267
   }
-#line 3263
+#line 3267
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3263
+#line 3267
 
-#line 3263
+#line 3267
 #else   /* not SX */
-#line 3263
+#line 3267
 
-#line 3263
+#line 3267
 	char *xp = (char *) *xpp;
-#line 3263
+#line 3267
 	int status = NC_NOERR;
-#line 3263
+#line 3267
 
-#line 3263
+#line 3267
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3263
+#line 3267
 	{
-#line 3263
+#line 3267
 		int lstatus = ncx_put_int_float(xp, tp, fillp);
-#line 3263
+#line 3267
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3263
+#line 3267
 			status = lstatus;
-#line 3263
+#line 3267
 	}
-#line 3263
+#line 3267
 
-#line 3263
+#line 3267
 	*xpp = (void *)xp;
-#line 3263
+#line 3267
 	return status;
-#line 3263
+#line 3267
 #endif
-#line 3263
+#line 3267
 }
-#line 3263
+#line 3267
 
 int
-#line 3264
+#line 3268
 ncx_putn_int_double(void **xpp, size_t nelems, const double *tp, void *fillp)
-#line 3264
+#line 3268
 {
-#line 3264
+#line 3268
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3264
+#line 3268
 
-#line 3264
+#line 3268
  /* basic algorithm is:
-#line 3264
+#line 3268
   *   - ensure sane alignment of output data
-#line 3264
+#line 3268
   *   - copy (conversion happens automatically) input data
-#line 3264
+#line 3268
   *     to output
-#line 3264
+#line 3268
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3264
+#line 3268
   *     at next location for converted output
-#line 3264
+#line 3268
   */
-#line 3264
+#line 3268
   long i, j, ni;
-#line 3264
+#line 3268
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3264
+#line 3268
   int *xp;
-#line 3264
+#line 3268
   int nrange = 0;         /* number of range errors */
-#line 3264
+#line 3268
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3264
+#line 3268
   long cxp = (long) *((char**)xpp);
-#line 3264
+#line 3268
 
-#line 3264
+#line 3268
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3264
+#line 3268
   /* sjl: manually stripmine so we can limit amount of
-#line 3264
+#line 3268
    * vector work space reserved to LOOPCNT elements. Also
-#line 3264
+#line 3268
    * makes vectorisation easy */
-#line 3264
+#line 3268
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3264
+#line 3268
     ni=Min(nelems-j,LOOPCNT);
-#line 3264
+#line 3268
     if (realign) {
-#line 3264
+#line 3268
       xp = tmp;
-#line 3264
+#line 3268
     } else {
-#line 3264
+#line 3268
       xp = (int *) *xpp;
-#line 3264
+#line 3268
     }
-#line 3264
+#line 3268
    /* copy the next block */
-#line 3264
+#line 3268
 #pragma cdir loopcnt=LOOPCNT
-#line 3264
+#line 3268
 #pragma cdir shortloop
-#line 3264
+#line 3268
     for (i=0; i<ni; i++) {
-#line 3264
+#line 3268
       /* the normal case: */
-#line 3264
+#line 3268
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3264
+#line 3268
      /* test for range errors (not always needed but do it anyway) */
-#line 3264
+#line 3268
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3264
+#line 3268
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3264
+#line 3268
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3264
+#line 3268
     }
-#line 3264
+#line 3268
    /* copy workspace back if necessary */
-#line 3264
+#line 3268
     if (realign) {
-#line 3264
+#line 3268
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3264
+#line 3268
       xp = (int *) *xpp;
-#line 3264
+#line 3268
     }
-#line 3264
+#line 3268
    /* update xpp and tp */
-#line 3264
+#line 3268
     xp += ni;
-#line 3264
+#line 3268
     tp += ni;
-#line 3264
+#line 3268
     *xpp = (void*)xp;
-#line 3264
+#line 3268
   }
-#line 3264
+#line 3268
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3264
+#line 3268
 
-#line 3264
+#line 3268
 #else   /* not SX */
-#line 3264
+#line 3268
 
-#line 3264
+#line 3268
 	char *xp = (char *) *xpp;
-#line 3264
+#line 3268
 	int status = NC_NOERR;
-#line 3264
+#line 3268
 
-#line 3264
+#line 3268
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3264
+#line 3268
 	{
-#line 3264
+#line 3268
 		int lstatus = ncx_put_int_double(xp, tp, fillp);
-#line 3264
+#line 3268
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3264
+#line 3268
 			status = lstatus;
-#line 3264
+#line 3268
 	}
-#line 3264
+#line 3268
 
-#line 3264
+#line 3268
 	*xpp = (void *)xp;
-#line 3264
+#line 3268
 	return status;
-#line 3264
+#line 3268
 #endif
-#line 3264
+#line 3268
 }
-#line 3264
+#line 3268
 
 int
-#line 3265
+#line 3269
 ncx_putn_int_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
-#line 3265
+#line 3269
 {
-#line 3265
+#line 3269
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3265
+#line 3269
 
-#line 3265
+#line 3269
  /* basic algorithm is:
-#line 3265
+#line 3269
   *   - ensure sane alignment of output data
-#line 3265
+#line 3269
   *   - copy (conversion happens automatically) input data
-#line 3265
+#line 3269
   *     to output
-#line 3265
+#line 3269
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3265
+#line 3269
   *     at next location for converted output
-#line 3265
+#line 3269
   */
-#line 3265
+#line 3269
   long i, j, ni;
-#line 3265
+#line 3269
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3265
+#line 3269
   int *xp;
-#line 3265
+#line 3269
   int nrange = 0;         /* number of range errors */
-#line 3265
+#line 3269
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3265
+#line 3269
   long cxp = (long) *((char**)xpp);
-#line 3265
+#line 3269
 
-#line 3265
+#line 3269
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3265
+#line 3269
   /* sjl: manually stripmine so we can limit amount of
-#line 3265
+#line 3269
    * vector work space reserved to LOOPCNT elements. Also
-#line 3265
+#line 3269
    * makes vectorisation easy */
-#line 3265
+#line 3269
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3265
+#line 3269
     ni=Min(nelems-j,LOOPCNT);
-#line 3265
+#line 3269
     if (realign) {
-#line 3265
+#line 3269
       xp = tmp;
-#line 3265
+#line 3269
     } else {
-#line 3265
+#line 3269
       xp = (int *) *xpp;
-#line 3265
+#line 3269
     }
-#line 3265
+#line 3269
    /* copy the next block */
-#line 3265
+#line 3269
 #pragma cdir loopcnt=LOOPCNT
-#line 3265
+#line 3269
 #pragma cdir shortloop
-#line 3265
+#line 3269
     for (i=0; i<ni; i++) {
-#line 3265
+#line 3269
       /* the normal case: */
-#line 3265
+#line 3269
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3265
+#line 3269
      /* test for range errors (not always needed but do it anyway) */
-#line 3265
+#line 3269
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3265
+#line 3269
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3265
+#line 3269
       nrange += tp[i] > X_INT_MAX || tp[i] < X_INT_MIN;
-#line 3265
+#line 3269
     }
-#line 3265
+#line 3269
    /* copy workspace back if necessary */
-#line 3265
+#line 3269
     if (realign) {
-#line 3265
+#line 3269
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3265
+#line 3269
       xp = (int *) *xpp;
-#line 3265
+#line 3269
     }
-#line 3265
+#line 3269
    /* update xpp and tp */
-#line 3265
+#line 3269
     xp += ni;
-#line 3265
+#line 3269
     tp += ni;
-#line 3265
+#line 3269
     *xpp = (void*)xp;
-#line 3265
+#line 3269
   }
-#line 3265
+#line 3269
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3265
+#line 3269
 
-#line 3265
+#line 3269
 #else   /* not SX */
-#line 3265
+#line 3269
 
-#line 3265
+#line 3269
 	char *xp = (char *) *xpp;
-#line 3265
+#line 3269
 	int status = NC_NOERR;
-#line 3265
+#line 3269
 
-#line 3265
+#line 3269
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3265
+#line 3269
 	{
-#line 3265
+#line 3269
 		int lstatus = ncx_put_int_longlong(xp, tp, fillp);
-#line 3265
+#line 3269
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3265
+#line 3269
 			status = lstatus;
-#line 3265
+#line 3269
 	}
-#line 3265
+#line 3269
 
-#line 3265
+#line 3269
 	*xpp = (void *)xp;
-#line 3265
+#line 3269
 	return status;
-#line 3265
+#line 3269
 #endif
-#line 3265
+#line 3269
 }
-#line 3265
+#line 3269
 
 int
-#line 3266
+#line 3270
 ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 3266
+#line 3270
 {
-#line 3266
+#line 3270
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3266
+#line 3270
 
-#line 3266
+#line 3270
  /* basic algorithm is:
-#line 3266
+#line 3270
   *   - ensure sane alignment of output data
-#line 3266
+#line 3270
   *   - copy (conversion happens automatically) input data
-#line 3266
+#line 3270
   *     to output
-#line 3266
+#line 3270
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3266
+#line 3270
   *     at next location for converted output
-#line 3266
+#line 3270
   */
-#line 3266
+#line 3270
   long i, j, ni;
-#line 3266
+#line 3270
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3266
+#line 3270
   int *xp;
-#line 3266
+#line 3270
   int nrange = 0;         /* number of range errors */
-#line 3266
+#line 3270
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3266
+#line 3270
   long cxp = (long) *((char**)xpp);
-#line 3266
+#line 3270
 
-#line 3266
+#line 3270
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3266
+#line 3270
   /* sjl: manually stripmine so we can limit amount of
-#line 3266
+#line 3270
    * vector work space reserved to LOOPCNT elements. Also
-#line 3266
+#line 3270
    * makes vectorisation easy */
-#line 3266
+#line 3270
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3266
+#line 3270
     ni=Min(nelems-j,LOOPCNT);
-#line 3266
+#line 3270
     if (realign) {
-#line 3266
+#line 3270
       xp = tmp;
-#line 3266
+#line 3270
     } else {
-#line 3266
+#line 3270
       xp = (int *) *xpp;
-#line 3266
+#line 3270
     }
-#line 3266
+#line 3270
    /* copy the next block */
-#line 3266
+#line 3270
 #pragma cdir loopcnt=LOOPCNT
-#line 3266
+#line 3270
 #pragma cdir shortloop
-#line 3266
+#line 3270
     for (i=0; i<ni; i++) {
-#line 3266
+#line 3270
       /* the normal case: */
-#line 3266
+#line 3270
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3266
+#line 3270
      /* test for range errors (not always needed but do it anyway) */
-#line 3266
+#line 3270
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3266
+#line 3270
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3266
+#line 3270
       nrange += tp[i] > X_INT_MAX ;
-#line 3266
+#line 3270
     }
-#line 3266
+#line 3270
    /* copy workspace back if necessary */
-#line 3266
+#line 3270
     if (realign) {
-#line 3266
+#line 3270
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3266
+#line 3270
       xp = (int *) *xpp;
-#line 3266
+#line 3270
     }
-#line 3266
+#line 3270
    /* update xpp and tp */
-#line 3266
+#line 3270
     xp += ni;
-#line 3266
+#line 3270
     tp += ni;
-#line 3266
+#line 3270
     *xpp = (void*)xp;
-#line 3266
+#line 3270
   }
-#line 3266
+#line 3270
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3266
+#line 3270
 
-#line 3266
+#line 3270
 #else   /* not SX */
-#line 3266
+#line 3270
 
-#line 3266
+#line 3270
 	char *xp = (char *) *xpp;
-#line 3266
+#line 3270
 	int status = NC_NOERR;
-#line 3266
+#line 3270
 
-#line 3266
+#line 3270
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3266
+#line 3270
 	{
-#line 3266
+#line 3270
 		int lstatus = ncx_put_int_uchar(xp, tp, fillp);
-#line 3266
+#line 3270
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3266
+#line 3270
 			status = lstatus;
-#line 3266
+#line 3270
 	}
-#line 3266
+#line 3270
 
-#line 3266
+#line 3270
 	*xpp = (void *)xp;
-#line 3266
+#line 3270
 	return status;
-#line 3266
+#line 3270
 #endif
-#line 3266
+#line 3270
 }
-#line 3266
+#line 3270
 
 int
-#line 3267
+#line 3271
 ncx_putn_int_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3267
+#line 3271
 {
-#line 3267
+#line 3271
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3267
+#line 3271
 
-#line 3267
+#line 3271
  /* basic algorithm is:
-#line 3267
+#line 3271
   *   - ensure sane alignment of output data
-#line 3267
+#line 3271
   *   - copy (conversion happens automatically) input data
-#line 3267
+#line 3271
   *     to output
-#line 3267
+#line 3271
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3267
+#line 3271
   *     at next location for converted output
-#line 3267
+#line 3271
   */
-#line 3267
+#line 3271
   long i, j, ni;
-#line 3267
+#line 3271
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3267
+#line 3271
   int *xp;
-#line 3267
+#line 3271
   int nrange = 0;         /* number of range errors */
-#line 3267
+#line 3271
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3267
+#line 3271
   long cxp = (long) *((char**)xpp);
-#line 3267
+#line 3271
 
-#line 3267
+#line 3271
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3267
+#line 3271
   /* sjl: manually stripmine so we can limit amount of
-#line 3267
+#line 3271
    * vector work space reserved to LOOPCNT elements. Also
-#line 3267
+#line 3271
    * makes vectorisation easy */
-#line 3267
+#line 3271
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3267
+#line 3271
     ni=Min(nelems-j,LOOPCNT);
-#line 3267
+#line 3271
     if (realign) {
-#line 3267
+#line 3271
       xp = tmp;
-#line 3267
+#line 3271
     } else {
-#line 3267
+#line 3271
       xp = (int *) *xpp;
-#line 3267
+#line 3271
     }
-#line 3267
+#line 3271
    /* copy the next block */
-#line 3267
+#line 3271
 #pragma cdir loopcnt=LOOPCNT
-#line 3267
+#line 3271
 #pragma cdir shortloop
-#line 3267
+#line 3271
     for (i=0; i<ni; i++) {
-#line 3267
+#line 3271
       /* the normal case: */
-#line 3267
+#line 3271
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3267
+#line 3271
      /* test for range errors (not always needed but do it anyway) */
-#line 3267
+#line 3271
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3267
+#line 3271
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3267
+#line 3271
       nrange += tp[i] > X_INT_MAX ;
-#line 3267
+#line 3271
     }
-#line 3267
+#line 3271
    /* copy workspace back if necessary */
-#line 3267
+#line 3271
     if (realign) {
-#line 3267
+#line 3271
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3267
+#line 3271
       xp = (int *) *xpp;
-#line 3267
+#line 3271
     }
-#line 3267
+#line 3271
    /* update xpp and tp */
-#line 3267
+#line 3271
     xp += ni;
-#line 3267
+#line 3271
     tp += ni;
-#line 3267
+#line 3271
     *xpp = (void*)xp;
-#line 3267
+#line 3271
   }
-#line 3267
+#line 3271
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3267
+#line 3271
 
-#line 3267
+#line 3271
 #else   /* not SX */
-#line 3267
+#line 3271
 
-#line 3267
+#line 3271
 	char *xp = (char *) *xpp;
-#line 3267
+#line 3271
 	int status = NC_NOERR;
-#line 3267
+#line 3271
 
-#line 3267
+#line 3271
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3267
+#line 3271
 	{
-#line 3267
+#line 3271
 		int lstatus = ncx_put_int_ushort(xp, tp, fillp);
-#line 3267
+#line 3271
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3267
+#line 3271
 			status = lstatus;
-#line 3267
+#line 3271
 	}
-#line 3267
+#line 3271
 
-#line 3267
+#line 3271
 	*xpp = (void *)xp;
-#line 3267
+#line 3271
 	return status;
-#line 3267
+#line 3271
 #endif
-#line 3267
+#line 3271
 }
-#line 3267
+#line 3271
 
 int
-#line 3268
+#line 3272
 ncx_putn_int_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
-#line 3268
+#line 3272
 {
-#line 3268
+#line 3272
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3268
+#line 3272
 
-#line 3268
+#line 3272
  /* basic algorithm is:
-#line 3268
+#line 3272
   *   - ensure sane alignment of output data
-#line 3268
+#line 3272
   *   - copy (conversion happens automatically) input data
-#line 3268
+#line 3272
   *     to output
-#line 3268
+#line 3272
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3268
+#line 3272
   *     at next location for converted output
-#line 3268
+#line 3272
   */
-#line 3268
+#line 3272
   long i, j, ni;
-#line 3268
+#line 3272
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3268
+#line 3272
   int *xp;
-#line 3268
+#line 3272
   int nrange = 0;         /* number of range errors */
-#line 3268
+#line 3272
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3268
+#line 3272
   long cxp = (long) *((char**)xpp);
-#line 3268
+#line 3272
 
-#line 3268
+#line 3272
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3268
+#line 3272
   /* sjl: manually stripmine so we can limit amount of
-#line 3268
+#line 3272
    * vector work space reserved to LOOPCNT elements. Also
-#line 3268
+#line 3272
    * makes vectorisation easy */
-#line 3268
+#line 3272
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3268
+#line 3272
     ni=Min(nelems-j,LOOPCNT);
-#line 3268
+#line 3272
     if (realign) {
-#line 3268
+#line 3272
       xp = tmp;
-#line 3268
+#line 3272
     } else {
-#line 3268
+#line 3272
       xp = (int *) *xpp;
-#line 3268
+#line 3272
     }
-#line 3268
+#line 3272
    /* copy the next block */
-#line 3268
+#line 3272
 #pragma cdir loopcnt=LOOPCNT
-#line 3268
+#line 3272
 #pragma cdir shortloop
-#line 3268
+#line 3272
     for (i=0; i<ni; i++) {
-#line 3268
+#line 3272
       /* the normal case: */
-#line 3268
+#line 3272
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3268
+#line 3272
      /* test for range errors (not always needed but do it anyway) */
-#line 3268
+#line 3272
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3268
+#line 3272
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3268
+#line 3272
       nrange += tp[i] > X_INT_MAX ;
-#line 3268
+#line 3272
     }
-#line 3268
+#line 3272
    /* copy workspace back if necessary */
-#line 3268
+#line 3272
     if (realign) {
-#line 3268
+#line 3272
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3268
+#line 3272
       xp = (int *) *xpp;
-#line 3268
+#line 3272
     }
-#line 3268
+#line 3272
    /* update xpp and tp */
-#line 3268
+#line 3272
     xp += ni;
-#line 3268
+#line 3272
     tp += ni;
-#line 3268
+#line 3272
     *xpp = (void*)xp;
-#line 3268
+#line 3272
   }
-#line 3268
+#line 3272
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3268
+#line 3272
 
-#line 3268
+#line 3272
 #else   /* not SX */
-#line 3268
+#line 3272
 
-#line 3268
+#line 3272
 	char *xp = (char *) *xpp;
-#line 3268
+#line 3272
 	int status = NC_NOERR;
-#line 3268
+#line 3272
 
-#line 3268
+#line 3272
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3268
+#line 3272
 	{
-#line 3268
+#line 3272
 		int lstatus = ncx_put_int_uint(xp, tp, fillp);
-#line 3268
+#line 3272
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3268
+#line 3272
 			status = lstatus;
-#line 3268
+#line 3272
 	}
-#line 3268
+#line 3272
 
-#line 3268
+#line 3272
 	*xpp = (void *)xp;
-#line 3268
+#line 3272
 	return status;
-#line 3268
+#line 3272
 #endif
-#line 3268
+#line 3272
 }
-#line 3268
+#line 3272
 
 int
-#line 3269
+#line 3273
 ncx_putn_int_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
-#line 3269
+#line 3273
 {
-#line 3269
+#line 3273
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT == SIZEOF_INT
-#line 3269
+#line 3273
 
-#line 3269
+#line 3273
  /* basic algorithm is:
-#line 3269
+#line 3273
   *   - ensure sane alignment of output data
-#line 3269
+#line 3273
   *   - copy (conversion happens automatically) input data
-#line 3269
+#line 3273
   *     to output
-#line 3269
+#line 3273
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3269
+#line 3273
   *     at next location for converted output
-#line 3269
+#line 3273
   */
-#line 3269
+#line 3273
   long i, j, ni;
-#line 3269
+#line 3273
   int tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3269
+#line 3273
   int *xp;
-#line 3269
+#line 3273
   int nrange = 0;         /* number of range errors */
-#line 3269
+#line 3273
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3269
+#line 3273
   long cxp = (long) *((char**)xpp);
-#line 3269
+#line 3273
 
-#line 3269
+#line 3273
   realign = (cxp & 7) % SIZEOF_INT;
-#line 3269
+#line 3273
   /* sjl: manually stripmine so we can limit amount of
-#line 3269
+#line 3273
    * vector work space reserved to LOOPCNT elements. Also
-#line 3269
+#line 3273
    * makes vectorisation easy */
-#line 3269
+#line 3273
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3269
+#line 3273
     ni=Min(nelems-j,LOOPCNT);
-#line 3269
+#line 3273
     if (realign) {
-#line 3269
+#line 3273
       xp = tmp;
-#line 3269
+#line 3273
     } else {
-#line 3269
+#line 3273
       xp = (int *) *xpp;
-#line 3269
+#line 3273
     }
-#line 3269
+#line 3273
    /* copy the next block */
-#line 3269
+#line 3273
 #pragma cdir loopcnt=LOOPCNT
-#line 3269
+#line 3273
 #pragma cdir shortloop
-#line 3269
+#line 3273
     for (i=0; i<ni; i++) {
-#line 3269
+#line 3273
       /* the normal case: */
-#line 3269
+#line 3273
       xp[i] = (int) Max( X_INT_MIN, Min(X_INT_MAX, (int) tp[i]));
-#line 3269
+#line 3273
      /* test for range errors (not always needed but do it anyway) */
-#line 3269
+#line 3273
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3269
+#line 3273
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3269
+#line 3273
       nrange += tp[i] > X_INT_MAX ;
-#line 3269
+#line 3273
     }
-#line 3269
+#line 3273
    /* copy workspace back if necessary */
-#line 3269
+#line 3273
     if (realign) {
-#line 3269
+#line 3273
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT);
-#line 3269
+#line 3273
       xp = (int *) *xpp;
-#line 3269
+#line 3273
     }
-#line 3269
+#line 3273
    /* update xpp and tp */
-#line 3269
+#line 3273
     xp += ni;
-#line 3269
+#line 3273
     tp += ni;
-#line 3269
+#line 3273
     *xpp = (void*)xp;
-#line 3269
+#line 3273
   }
-#line 3269
+#line 3273
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3269
+#line 3273
 
-#line 3269
+#line 3273
 #else   /* not SX */
-#line 3269
+#line 3273
 
-#line 3269
+#line 3273
 	char *xp = (char *) *xpp;
-#line 3269
+#line 3273
 	int status = NC_NOERR;
-#line 3269
+#line 3273
 
-#line 3269
+#line 3273
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
-#line 3269
+#line 3273
 	{
-#line 3269
+#line 3273
 		int lstatus = ncx_put_int_ulonglong(xp, tp, fillp);
-#line 3269
+#line 3273
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3269
+#line 3273
 			status = lstatus;
-#line 3269
+#line 3273
 	}
-#line 3269
+#line 3273
 
-#line 3269
+#line 3273
 	*xpp = (void *)xp;
-#line 3269
+#line 3273
 	return status;
-#line 3269
+#line 3273
 #endif
-#line 3269
+#line 3273
 }
-#line 3269
+#line 3273
 
 
 /* uint ----------------------------------------------------------------------*/
@@ -22396,1424 +22400,1424 @@ ncx_getn_uint_uint(const void **xpp, size_t nelems, unsigned int *tp)
 }
 #else
 int
-#line 3287
+#line 3291
 ncx_getn_uint_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3287
+#line 3291
 {
-#line 3287
+#line 3291
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3287
+#line 3291
 
-#line 3287
+#line 3291
  /* basic algorithm is:
-#line 3287
+#line 3291
   *   - ensure sane alignment of input data
-#line 3287
+#line 3291
   *   - copy (conversion happens automatically) input data
-#line 3287
+#line 3291
   *     to output
-#line 3287
+#line 3291
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3287
+#line 3291
   *     at next location for converted output
-#line 3287
+#line 3291
   */
-#line 3287
+#line 3291
   long i, j, ni;
-#line 3287
+#line 3291
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3287
+#line 3291
   uint *xp;
-#line 3287
+#line 3291
   int nrange = 0;         /* number of range errors */
-#line 3287
+#line 3291
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3287
+#line 3291
   long cxp = (long) *((char**)xpp);
-#line 3287
+#line 3291
 
-#line 3287
+#line 3291
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3287
+#line 3291
   /* sjl: manually stripmine so we can limit amount of
-#line 3287
+#line 3291
    * vector work space reserved to LOOPCNT elements. Also
-#line 3287
+#line 3291
    * makes vectorisation easy */
-#line 3287
+#line 3291
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3287
+#line 3291
     ni=Min(nelems-j,LOOPCNT);
-#line 3287
+#line 3291
     if (realign) {
-#line 3287
+#line 3291
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3287
+#line 3291
       xp = tmp;
-#line 3287
+#line 3291
     } else {
-#line 3287
+#line 3291
       xp = (uint *) *xpp;
-#line 3287
+#line 3291
     }
-#line 3287
+#line 3291
    /* copy the next block */
-#line 3287
+#line 3291
 #pragma cdir loopcnt=LOOPCNT
-#line 3287
+#line 3291
 #pragma cdir shortloop
-#line 3287
+#line 3291
     for (i=0; i<ni; i++) {
-#line 3287
+#line 3291
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3287
+#line 3291
      /* test for range errors (not always needed but do it anyway) */
-#line 3287
+#line 3291
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3287
+#line 3291
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3287
+#line 3291
       nrange += xp[i] > UINT_MAX ;
-#line 3287
+#line 3291
     }
-#line 3287
+#line 3291
    /* update xpp and tp */
-#line 3287
+#line 3291
     if (realign) xp = (uint *) *xpp;
-#line 3287
+#line 3291
     xp += ni;
-#line 3287
+#line 3291
     tp += ni;
-#line 3287
+#line 3291
     *xpp = (void*)xp;
-#line 3287
+#line 3291
   }
-#line 3287
+#line 3291
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3287
+#line 3291
 
-#line 3287
+#line 3291
 #else   /* not SX */
-#line 3287
+#line 3291
 	const char *xp = (const char *) *xpp;
-#line 3287
+#line 3291
 	int status = NC_NOERR;
-#line 3287
+#line 3291
 
-#line 3287
+#line 3291
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3287
+#line 3291
 	{
-#line 3287
+#line 3291
 		const int lstatus = ncx_get_uint_uint(xp, tp);
-#line 3287
+#line 3291
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3287
+#line 3291
 			status = lstatus;
-#line 3287
+#line 3291
 	}
-#line 3287
+#line 3291
 
-#line 3287
+#line 3291
 	*xpp = (const void *)xp;
-#line 3287
+#line 3291
 	return status;
-#line 3287
+#line 3291
 #endif
-#line 3287
+#line 3291
 }
-#line 3287
+#line 3291
 
 #endif
 int
-#line 3289
+#line 3293
 ncx_getn_uint_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3289
+#line 3293
 {
-#line 3289
+#line 3293
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3289
+#line 3293
 
-#line 3289
+#line 3293
  /* basic algorithm is:
-#line 3289
+#line 3293
   *   - ensure sane alignment of input data
-#line 3289
+#line 3293
   *   - copy (conversion happens automatically) input data
-#line 3289
+#line 3293
   *     to output
-#line 3289
+#line 3293
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3289
+#line 3293
   *     at next location for converted output
-#line 3289
+#line 3293
   */
-#line 3289
+#line 3293
   long i, j, ni;
-#line 3289
+#line 3293
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3289
+#line 3293
   uint *xp;
-#line 3289
+#line 3293
   int nrange = 0;         /* number of range errors */
-#line 3289
+#line 3293
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3289
+#line 3293
   long cxp = (long) *((char**)xpp);
-#line 3289
+#line 3293
 
-#line 3289
+#line 3293
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3289
+#line 3293
   /* sjl: manually stripmine so we can limit amount of
-#line 3289
+#line 3293
    * vector work space reserved to LOOPCNT elements. Also
-#line 3289
+#line 3293
    * makes vectorisation easy */
-#line 3289
+#line 3293
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3289
+#line 3293
     ni=Min(nelems-j,LOOPCNT);
-#line 3289
+#line 3293
     if (realign) {
-#line 3289
+#line 3293
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3289
+#line 3293
       xp = tmp;
-#line 3289
+#line 3293
     } else {
-#line 3289
+#line 3293
       xp = (uint *) *xpp;
-#line 3289
+#line 3293
     }
-#line 3289
+#line 3293
    /* copy the next block */
-#line 3289
+#line 3293
 #pragma cdir loopcnt=LOOPCNT
-#line 3289
+#line 3293
 #pragma cdir shortloop
-#line 3289
+#line 3293
     for (i=0; i<ni; i++) {
-#line 3289
+#line 3293
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3289
+#line 3293
      /* test for range errors (not always needed but do it anyway) */
-#line 3289
+#line 3293
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3289
+#line 3293
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3289
+#line 3293
       nrange += xp[i] > SCHAR_MAX ;
-#line 3289
+#line 3293
     }
-#line 3289
+#line 3293
    /* update xpp and tp */
-#line 3289
+#line 3293
     if (realign) xp = (uint *) *xpp;
-#line 3289
+#line 3293
     xp += ni;
-#line 3289
+#line 3293
     tp += ni;
-#line 3289
+#line 3293
     *xpp = (void*)xp;
-#line 3289
+#line 3293
   }
-#line 3289
+#line 3293
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3289
+#line 3293
 
-#line 3289
+#line 3293
 #else   /* not SX */
-#line 3289
+#line 3293
 	const char *xp = (const char *) *xpp;
-#line 3289
+#line 3293
 	int status = NC_NOERR;
-#line 3289
+#line 3293
 
-#line 3289
+#line 3293
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3289
+#line 3293
 	{
-#line 3289
+#line 3293
 		const int lstatus = ncx_get_uint_schar(xp, tp);
-#line 3289
+#line 3293
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3289
+#line 3293
 			status = lstatus;
-#line 3289
+#line 3293
 	}
-#line 3289
+#line 3293
 
-#line 3289
+#line 3293
 	*xpp = (const void *)xp;
-#line 3289
+#line 3293
 	return status;
-#line 3289
+#line 3293
 #endif
-#line 3289
+#line 3293
 }
-#line 3289
+#line 3293
 
 int
-#line 3290
+#line 3294
 ncx_getn_uint_short(const void **xpp, size_t nelems, short *tp)
-#line 3290
+#line 3294
 {
-#line 3290
+#line 3294
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3290
+#line 3294
 
-#line 3290
+#line 3294
  /* basic algorithm is:
-#line 3290
+#line 3294
   *   - ensure sane alignment of input data
-#line 3290
+#line 3294
   *   - copy (conversion happens automatically) input data
-#line 3290
+#line 3294
   *     to output
-#line 3290
+#line 3294
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3290
+#line 3294
   *     at next location for converted output
-#line 3290
+#line 3294
   */
-#line 3290
+#line 3294
   long i, j, ni;
-#line 3290
+#line 3294
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3290
+#line 3294
   uint *xp;
-#line 3290
+#line 3294
   int nrange = 0;         /* number of range errors */
-#line 3290
+#line 3294
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3290
+#line 3294
   long cxp = (long) *((char**)xpp);
-#line 3290
+#line 3294
 
-#line 3290
+#line 3294
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3290
+#line 3294
   /* sjl: manually stripmine so we can limit amount of
-#line 3290
+#line 3294
    * vector work space reserved to LOOPCNT elements. Also
-#line 3290
+#line 3294
    * makes vectorisation easy */
-#line 3290
+#line 3294
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3290
+#line 3294
     ni=Min(nelems-j,LOOPCNT);
-#line 3290
+#line 3294
     if (realign) {
-#line 3290
+#line 3294
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3290
+#line 3294
       xp = tmp;
-#line 3290
+#line 3294
     } else {
-#line 3290
+#line 3294
       xp = (uint *) *xpp;
-#line 3290
+#line 3294
     }
-#line 3290
+#line 3294
    /* copy the next block */
-#line 3290
+#line 3294
 #pragma cdir loopcnt=LOOPCNT
-#line 3290
+#line 3294
 #pragma cdir shortloop
-#line 3290
+#line 3294
     for (i=0; i<ni; i++) {
-#line 3290
+#line 3294
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3290
+#line 3294
      /* test for range errors (not always needed but do it anyway) */
-#line 3290
+#line 3294
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3290
+#line 3294
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3290
+#line 3294
       nrange += xp[i] > SHORT_MAX ;
-#line 3290
+#line 3294
     }
-#line 3290
+#line 3294
    /* update xpp and tp */
-#line 3290
+#line 3294
     if (realign) xp = (uint *) *xpp;
-#line 3290
+#line 3294
     xp += ni;
-#line 3290
+#line 3294
     tp += ni;
-#line 3290
+#line 3294
     *xpp = (void*)xp;
-#line 3290
+#line 3294
   }
-#line 3290
+#line 3294
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3290
+#line 3294
 
-#line 3290
+#line 3294
 #else   /* not SX */
-#line 3290
+#line 3294
 	const char *xp = (const char *) *xpp;
-#line 3290
+#line 3294
 	int status = NC_NOERR;
-#line 3290
+#line 3294
 
-#line 3290
+#line 3294
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3290
+#line 3294
 	{
-#line 3290
+#line 3294
 		const int lstatus = ncx_get_uint_short(xp, tp);
-#line 3290
+#line 3294
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3290
+#line 3294
 			status = lstatus;
-#line 3290
+#line 3294
 	}
-#line 3290
+#line 3294
 
-#line 3290
+#line 3294
 	*xpp = (const void *)xp;
-#line 3290
+#line 3294
 	return status;
-#line 3290
+#line 3294
 #endif
-#line 3290
+#line 3294
 }
-#line 3290
+#line 3294
 
 int
-#line 3291
+#line 3295
 ncx_getn_uint_int(const void **xpp, size_t nelems, int *tp)
-#line 3291
+#line 3295
 {
-#line 3291
+#line 3295
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3291
+#line 3295
 
-#line 3291
+#line 3295
  /* basic algorithm is:
-#line 3291
+#line 3295
   *   - ensure sane alignment of input data
-#line 3291
+#line 3295
   *   - copy (conversion happens automatically) input data
-#line 3291
+#line 3295
   *     to output
-#line 3291
+#line 3295
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3291
+#line 3295
   *     at next location for converted output
-#line 3291
+#line 3295
   */
-#line 3291
+#line 3295
   long i, j, ni;
-#line 3291
+#line 3295
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3291
+#line 3295
   uint *xp;
-#line 3291
+#line 3295
   int nrange = 0;         /* number of range errors */
-#line 3291
+#line 3295
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3291
+#line 3295
   long cxp = (long) *((char**)xpp);
-#line 3291
+#line 3295
 
-#line 3291
+#line 3295
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3291
+#line 3295
   /* sjl: manually stripmine so we can limit amount of
-#line 3291
+#line 3295
    * vector work space reserved to LOOPCNT elements. Also
-#line 3291
+#line 3295
    * makes vectorisation easy */
-#line 3291
+#line 3295
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3291
+#line 3295
     ni=Min(nelems-j,LOOPCNT);
-#line 3291
+#line 3295
     if (realign) {
-#line 3291
+#line 3295
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3291
+#line 3295
       xp = tmp;
-#line 3291
+#line 3295
     } else {
-#line 3291
+#line 3295
       xp = (uint *) *xpp;
-#line 3291
+#line 3295
     }
-#line 3291
+#line 3295
    /* copy the next block */
-#line 3291
+#line 3295
 #pragma cdir loopcnt=LOOPCNT
-#line 3291
+#line 3295
 #pragma cdir shortloop
-#line 3291
+#line 3295
     for (i=0; i<ni; i++) {
-#line 3291
+#line 3295
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3291
+#line 3295
      /* test for range errors (not always needed but do it anyway) */
-#line 3291
+#line 3295
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3291
+#line 3295
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3291
+#line 3295
       nrange += xp[i] > INT_MAX ;
-#line 3291
+#line 3295
     }
-#line 3291
+#line 3295
    /* update xpp and tp */
-#line 3291
+#line 3295
     if (realign) xp = (uint *) *xpp;
-#line 3291
+#line 3295
     xp += ni;
-#line 3291
+#line 3295
     tp += ni;
-#line 3291
+#line 3295
     *xpp = (void*)xp;
-#line 3291
+#line 3295
   }
-#line 3291
+#line 3295
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3291
+#line 3295
 
-#line 3291
+#line 3295
 #else   /* not SX */
-#line 3291
+#line 3295
 	const char *xp = (const char *) *xpp;
-#line 3291
+#line 3295
 	int status = NC_NOERR;
-#line 3291
+#line 3295
 
-#line 3291
+#line 3295
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3291
+#line 3295
 	{
-#line 3291
+#line 3295
 		const int lstatus = ncx_get_uint_int(xp, tp);
-#line 3291
+#line 3295
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3291
+#line 3295
 			status = lstatus;
-#line 3291
+#line 3295
 	}
-#line 3291
+#line 3295
 
-#line 3291
+#line 3295
 	*xpp = (const void *)xp;
-#line 3291
+#line 3295
 	return status;
-#line 3291
+#line 3295
 #endif
-#line 3291
+#line 3295
 }
-#line 3291
+#line 3295
 
 int
-#line 3292
+#line 3296
 ncx_getn_uint_long(const void **xpp, size_t nelems, long *tp)
-#line 3292
+#line 3296
 {
-#line 3292
+#line 3296
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3292
+#line 3296
 
-#line 3292
+#line 3296
  /* basic algorithm is:
-#line 3292
+#line 3296
   *   - ensure sane alignment of input data
-#line 3292
+#line 3296
   *   - copy (conversion happens automatically) input data
-#line 3292
+#line 3296
   *     to output
-#line 3292
+#line 3296
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3292
+#line 3296
   *     at next location for converted output
-#line 3292
+#line 3296
   */
-#line 3292
+#line 3296
   long i, j, ni;
-#line 3292
+#line 3296
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3292
+#line 3296
   uint *xp;
-#line 3292
+#line 3296
   int nrange = 0;         /* number of range errors */
-#line 3292
+#line 3296
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3292
+#line 3296
   long cxp = (long) *((char**)xpp);
-#line 3292
+#line 3296
 
-#line 3292
+#line 3296
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3292
+#line 3296
   /* sjl: manually stripmine so we can limit amount of
-#line 3292
+#line 3296
    * vector work space reserved to LOOPCNT elements. Also
-#line 3292
+#line 3296
    * makes vectorisation easy */
-#line 3292
+#line 3296
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3292
+#line 3296
     ni=Min(nelems-j,LOOPCNT);
-#line 3292
+#line 3296
     if (realign) {
-#line 3292
+#line 3296
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3292
+#line 3296
       xp = tmp;
-#line 3292
+#line 3296
     } else {
-#line 3292
+#line 3296
       xp = (uint *) *xpp;
-#line 3292
+#line 3296
     }
-#line 3292
+#line 3296
    /* copy the next block */
-#line 3292
+#line 3296
 #pragma cdir loopcnt=LOOPCNT
-#line 3292
+#line 3296
 #pragma cdir shortloop
-#line 3292
+#line 3296
     for (i=0; i<ni; i++) {
-#line 3292
+#line 3296
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3292
+#line 3296
      /* test for range errors (not always needed but do it anyway) */
-#line 3292
+#line 3296
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3292
+#line 3296
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3292
+#line 3296
       nrange += xp[i] > LONG_MAX ;
-#line 3292
+#line 3296
     }
-#line 3292
+#line 3296
    /* update xpp and tp */
-#line 3292
+#line 3296
     if (realign) xp = (uint *) *xpp;
-#line 3292
+#line 3296
     xp += ni;
-#line 3292
+#line 3296
     tp += ni;
-#line 3292
+#line 3296
     *xpp = (void*)xp;
-#line 3292
+#line 3296
   }
-#line 3292
+#line 3296
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3292
+#line 3296
 
-#line 3292
+#line 3296
 #else   /* not SX */
-#line 3292
+#line 3296
 	const char *xp = (const char *) *xpp;
-#line 3292
+#line 3296
 	int status = NC_NOERR;
-#line 3292
+#line 3296
 
-#line 3292
+#line 3296
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3292
+#line 3296
 	{
-#line 3292
+#line 3296
 		const int lstatus = ncx_get_uint_long(xp, tp);
-#line 3292
+#line 3296
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3292
+#line 3296
 			status = lstatus;
-#line 3292
+#line 3296
 	}
-#line 3292
+#line 3296
 
-#line 3292
+#line 3296
 	*xpp = (const void *)xp;
-#line 3292
+#line 3296
 	return status;
-#line 3292
+#line 3296
 #endif
-#line 3292
+#line 3296
 }
-#line 3292
+#line 3296
 
 int
-#line 3293
+#line 3297
 ncx_getn_uint_float(const void **xpp, size_t nelems, float *tp)
-#line 3293
+#line 3297
 {
-#line 3293
+#line 3297
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3293
+#line 3297
 
-#line 3293
+#line 3297
  /* basic algorithm is:
-#line 3293
+#line 3297
   *   - ensure sane alignment of input data
-#line 3293
+#line 3297
   *   - copy (conversion happens automatically) input data
-#line 3293
+#line 3297
   *     to output
-#line 3293
+#line 3297
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3293
+#line 3297
   *     at next location for converted output
-#line 3293
+#line 3297
   */
-#line 3293
+#line 3297
   long i, j, ni;
-#line 3293
+#line 3297
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3293
+#line 3297
   uint *xp;
-#line 3293
+#line 3297
   int nrange = 0;         /* number of range errors */
-#line 3293
+#line 3297
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3293
+#line 3297
   long cxp = (long) *((char**)xpp);
-#line 3293
+#line 3297
 
-#line 3293
+#line 3297
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3293
+#line 3297
   /* sjl: manually stripmine so we can limit amount of
-#line 3293
+#line 3297
    * vector work space reserved to LOOPCNT elements. Also
-#line 3293
+#line 3297
    * makes vectorisation easy */
-#line 3293
+#line 3297
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3293
+#line 3297
     ni=Min(nelems-j,LOOPCNT);
-#line 3293
+#line 3297
     if (realign) {
-#line 3293
+#line 3297
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3293
+#line 3297
       xp = tmp;
-#line 3293
+#line 3297
     } else {
-#line 3293
+#line 3297
       xp = (uint *) *xpp;
-#line 3293
+#line 3297
     }
-#line 3293
+#line 3297
    /* copy the next block */
-#line 3293
+#line 3297
 #pragma cdir loopcnt=LOOPCNT
-#line 3293
+#line 3297
 #pragma cdir shortloop
-#line 3293
+#line 3297
     for (i=0; i<ni; i++) {
-#line 3293
+#line 3297
       tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
-#line 3293
+#line 3297
      /* test for range errors (not always needed but do it anyway) */
-#line 3293
+#line 3297
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3293
+#line 3297
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3293
+#line 3297
       nrange += xp[i] > FLOAT_MAX ;
-#line 3293
+#line 3297
     }
-#line 3293
+#line 3297
    /* update xpp and tp */
-#line 3293
+#line 3297
     if (realign) xp = (uint *) *xpp;
-#line 3293
+#line 3297
     xp += ni;
-#line 3293
+#line 3297
     tp += ni;
-#line 3293
+#line 3297
     *xpp = (void*)xp;
-#line 3293
+#line 3297
   }
-#line 3293
+#line 3297
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3293
+#line 3297
 
-#line 3293
+#line 3297
 #else   /* not SX */
-#line 3293
+#line 3297
 	const char *xp = (const char *) *xpp;
-#line 3293
+#line 3297
 	int status = NC_NOERR;
-#line 3293
+#line 3297
 
-#line 3293
+#line 3297
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3293
+#line 3297
 	{
-#line 3293
+#line 3297
 		const int lstatus = ncx_get_uint_float(xp, tp);
-#line 3293
+#line 3297
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3293
+#line 3297
 			status = lstatus;
-#line 3293
+#line 3297
 	}
-#line 3293
+#line 3297
 
-#line 3293
+#line 3297
 	*xpp = (const void *)xp;
-#line 3293
+#line 3297
 	return status;
-#line 3293
+#line 3297
 #endif
-#line 3293
+#line 3297
 }
-#line 3293
+#line 3297
 
 int
-#line 3294
+#line 3298
 ncx_getn_uint_double(const void **xpp, size_t nelems, double *tp)
-#line 3294
+#line 3298
 {
-#line 3294
+#line 3298
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3294
+#line 3298
 
-#line 3294
+#line 3298
  /* basic algorithm is:
-#line 3294
+#line 3298
   *   - ensure sane alignment of input data
-#line 3294
+#line 3298
   *   - copy (conversion happens automatically) input data
-#line 3294
+#line 3298
   *     to output
-#line 3294
+#line 3298
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3294
+#line 3298
   *     at next location for converted output
-#line 3294
+#line 3298
   */
-#line 3294
+#line 3298
   long i, j, ni;
-#line 3294
+#line 3298
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3294
+#line 3298
   uint *xp;
-#line 3294
+#line 3298
   int nrange = 0;         /* number of range errors */
-#line 3294
+#line 3298
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3294
+#line 3298
   long cxp = (long) *((char**)xpp);
-#line 3294
+#line 3298
 
-#line 3294
+#line 3298
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3294
+#line 3298
   /* sjl: manually stripmine so we can limit amount of
-#line 3294
+#line 3298
    * vector work space reserved to LOOPCNT elements. Also
-#line 3294
+#line 3298
    * makes vectorisation easy */
-#line 3294
+#line 3298
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3294
+#line 3298
     ni=Min(nelems-j,LOOPCNT);
-#line 3294
+#line 3298
     if (realign) {
-#line 3294
+#line 3298
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3294
+#line 3298
       xp = tmp;
-#line 3294
+#line 3298
     } else {
-#line 3294
+#line 3298
       xp = (uint *) *xpp;
-#line 3294
+#line 3298
     }
-#line 3294
+#line 3298
    /* copy the next block */
-#line 3294
+#line 3298
 #pragma cdir loopcnt=LOOPCNT
-#line 3294
+#line 3298
 #pragma cdir shortloop
-#line 3294
+#line 3298
     for (i=0; i<ni; i++) {
-#line 3294
+#line 3298
       tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
-#line 3294
+#line 3298
      /* test for range errors (not always needed but do it anyway) */
-#line 3294
+#line 3298
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3294
+#line 3298
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3294
+#line 3298
       nrange += xp[i] > DOUBLE_MAX ;
-#line 3294
+#line 3298
     }
-#line 3294
+#line 3298
    /* update xpp and tp */
-#line 3294
+#line 3298
     if (realign) xp = (uint *) *xpp;
-#line 3294
+#line 3298
     xp += ni;
-#line 3294
+#line 3298
     tp += ni;
-#line 3294
+#line 3298
     *xpp = (void*)xp;
-#line 3294
+#line 3298
   }
-#line 3294
+#line 3298
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3294
+#line 3298
 
-#line 3294
+#line 3298
 #else   /* not SX */
-#line 3294
+#line 3298
 	const char *xp = (const char *) *xpp;
-#line 3294
+#line 3298
 	int status = NC_NOERR;
-#line 3294
+#line 3298
 
-#line 3294
+#line 3298
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3294
+#line 3298
 	{
-#line 3294
+#line 3298
 		const int lstatus = ncx_get_uint_double(xp, tp);
-#line 3294
+#line 3298
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3294
+#line 3298
 			status = lstatus;
-#line 3294
+#line 3298
 	}
-#line 3294
+#line 3298
 
-#line 3294
+#line 3298
 	*xpp = (const void *)xp;
-#line 3294
+#line 3298
 	return status;
-#line 3294
+#line 3298
 #endif
-#line 3294
+#line 3298
 }
-#line 3294
+#line 3298
 
 int
-#line 3295
+#line 3299
 ncx_getn_uint_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3295
+#line 3299
 {
-#line 3295
+#line 3299
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3295
+#line 3299
 
-#line 3295
+#line 3299
  /* basic algorithm is:
-#line 3295
+#line 3299
   *   - ensure sane alignment of input data
-#line 3295
+#line 3299
   *   - copy (conversion happens automatically) input data
-#line 3295
+#line 3299
   *     to output
-#line 3295
+#line 3299
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3295
+#line 3299
   *     at next location for converted output
-#line 3295
+#line 3299
   */
-#line 3295
+#line 3299
   long i, j, ni;
-#line 3295
+#line 3299
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3295
+#line 3299
   uint *xp;
-#line 3295
+#line 3299
   int nrange = 0;         /* number of range errors */
-#line 3295
+#line 3299
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3295
+#line 3299
   long cxp = (long) *((char**)xpp);
-#line 3295
+#line 3299
 
-#line 3295
+#line 3299
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3295
+#line 3299
   /* sjl: manually stripmine so we can limit amount of
-#line 3295
+#line 3299
    * vector work space reserved to LOOPCNT elements. Also
-#line 3295
+#line 3299
    * makes vectorisation easy */
-#line 3295
+#line 3299
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3295
+#line 3299
     ni=Min(nelems-j,LOOPCNT);
-#line 3295
+#line 3299
     if (realign) {
-#line 3295
+#line 3299
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3295
+#line 3299
       xp = tmp;
-#line 3295
+#line 3299
     } else {
-#line 3295
+#line 3299
       xp = (uint *) *xpp;
-#line 3295
+#line 3299
     }
-#line 3295
+#line 3299
    /* copy the next block */
-#line 3295
+#line 3299
 #pragma cdir loopcnt=LOOPCNT
-#line 3295
+#line 3299
 #pragma cdir shortloop
-#line 3295
+#line 3299
     for (i=0; i<ni; i++) {
-#line 3295
+#line 3299
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3295
+#line 3299
      /* test for range errors (not always needed but do it anyway) */
-#line 3295
+#line 3299
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3295
+#line 3299
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3295
+#line 3299
       nrange += xp[i] > LONGLONG_MAX ;
-#line 3295
+#line 3299
     }
-#line 3295
+#line 3299
    /* update xpp and tp */
-#line 3295
+#line 3299
     if (realign) xp = (uint *) *xpp;
-#line 3295
+#line 3299
     xp += ni;
-#line 3295
+#line 3299
     tp += ni;
-#line 3295
+#line 3299
     *xpp = (void*)xp;
-#line 3295
+#line 3299
   }
-#line 3295
+#line 3299
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3295
+#line 3299
 
-#line 3295
+#line 3299
 #else   /* not SX */
-#line 3295
+#line 3299
 	const char *xp = (const char *) *xpp;
-#line 3295
+#line 3299
 	int status = NC_NOERR;
-#line 3295
+#line 3299
 
-#line 3295
+#line 3299
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3295
+#line 3299
 	{
-#line 3295
+#line 3299
 		const int lstatus = ncx_get_uint_longlong(xp, tp);
-#line 3295
+#line 3299
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3295
+#line 3299
 			status = lstatus;
-#line 3295
+#line 3299
 	}
-#line 3295
+#line 3299
 
-#line 3295
+#line 3299
 	*xpp = (const void *)xp;
-#line 3295
+#line 3299
 	return status;
-#line 3295
+#line 3299
 #endif
-#line 3295
+#line 3299
 }
-#line 3295
+#line 3299
 
 int
-#line 3296
+#line 3300
 ncx_getn_uint_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3296
+#line 3300
 {
-#line 3296
+#line 3300
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3296
+#line 3300
 
-#line 3296
+#line 3300
  /* basic algorithm is:
-#line 3296
+#line 3300
   *   - ensure sane alignment of input data
-#line 3296
+#line 3300
   *   - copy (conversion happens automatically) input data
-#line 3296
+#line 3300
   *     to output
-#line 3296
+#line 3300
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3296
+#line 3300
   *     at next location for converted output
-#line 3296
+#line 3300
   */
-#line 3296
+#line 3300
   long i, j, ni;
-#line 3296
+#line 3300
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3296
+#line 3300
   uint *xp;
-#line 3296
+#line 3300
   int nrange = 0;         /* number of range errors */
-#line 3296
+#line 3300
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3296
+#line 3300
   long cxp = (long) *((char**)xpp);
-#line 3296
+#line 3300
 
-#line 3296
+#line 3300
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3296
+#line 3300
   /* sjl: manually stripmine so we can limit amount of
-#line 3296
+#line 3300
    * vector work space reserved to LOOPCNT elements. Also
-#line 3296
+#line 3300
    * makes vectorisation easy */
-#line 3296
+#line 3300
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3296
+#line 3300
     ni=Min(nelems-j,LOOPCNT);
-#line 3296
+#line 3300
     if (realign) {
-#line 3296
+#line 3300
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3296
+#line 3300
       xp = tmp;
-#line 3296
+#line 3300
     } else {
-#line 3296
+#line 3300
       xp = (uint *) *xpp;
-#line 3296
+#line 3300
     }
-#line 3296
+#line 3300
    /* copy the next block */
-#line 3296
+#line 3300
 #pragma cdir loopcnt=LOOPCNT
-#line 3296
+#line 3300
 #pragma cdir shortloop
-#line 3296
+#line 3300
     for (i=0; i<ni; i++) {
-#line 3296
+#line 3300
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3296
+#line 3300
      /* test for range errors (not always needed but do it anyway) */
-#line 3296
+#line 3300
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3296
+#line 3300
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3296
+#line 3300
       nrange += xp[i] > UCHAR_MAX ;
-#line 3296
+#line 3300
     }
-#line 3296
+#line 3300
    /* update xpp and tp */
-#line 3296
+#line 3300
     if (realign) xp = (uint *) *xpp;
-#line 3296
+#line 3300
     xp += ni;
-#line 3296
+#line 3300
     tp += ni;
-#line 3296
+#line 3300
     *xpp = (void*)xp;
-#line 3296
+#line 3300
   }
-#line 3296
+#line 3300
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3296
+#line 3300
 
-#line 3296
+#line 3300
 #else   /* not SX */
-#line 3296
+#line 3300
 	const char *xp = (const char *) *xpp;
-#line 3296
+#line 3300
 	int status = NC_NOERR;
-#line 3296
+#line 3300
 
-#line 3296
+#line 3300
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3296
+#line 3300
 	{
-#line 3296
+#line 3300
 		const int lstatus = ncx_get_uint_uchar(xp, tp);
-#line 3296
+#line 3300
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3296
+#line 3300
 			status = lstatus;
-#line 3296
+#line 3300
 	}
-#line 3296
+#line 3300
 
-#line 3296
+#line 3300
 	*xpp = (const void *)xp;
-#line 3296
+#line 3300
 	return status;
-#line 3296
+#line 3300
 #endif
-#line 3296
+#line 3300
 }
-#line 3296
+#line 3300
 
 int
-#line 3297
+#line 3301
 ncx_getn_uint_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3297
+#line 3301
 {
-#line 3297
+#line 3301
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3297
+#line 3301
 
-#line 3297
+#line 3301
  /* basic algorithm is:
-#line 3297
+#line 3301
   *   - ensure sane alignment of input data
-#line 3297
+#line 3301
   *   - copy (conversion happens automatically) input data
-#line 3297
+#line 3301
   *     to output
-#line 3297
+#line 3301
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3297
+#line 3301
   *     at next location for converted output
-#line 3297
+#line 3301
   */
-#line 3297
+#line 3301
   long i, j, ni;
-#line 3297
+#line 3301
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3297
+#line 3301
   uint *xp;
-#line 3297
+#line 3301
   int nrange = 0;         /* number of range errors */
-#line 3297
+#line 3301
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3297
+#line 3301
   long cxp = (long) *((char**)xpp);
-#line 3297
+#line 3301
 
-#line 3297
+#line 3301
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3297
+#line 3301
   /* sjl: manually stripmine so we can limit amount of
-#line 3297
+#line 3301
    * vector work space reserved to LOOPCNT elements. Also
-#line 3297
+#line 3301
    * makes vectorisation easy */
-#line 3297
+#line 3301
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3297
+#line 3301
     ni=Min(nelems-j,LOOPCNT);
-#line 3297
+#line 3301
     if (realign) {
-#line 3297
+#line 3301
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3297
+#line 3301
       xp = tmp;
-#line 3297
+#line 3301
     } else {
-#line 3297
+#line 3301
       xp = (uint *) *xpp;
-#line 3297
+#line 3301
     }
-#line 3297
+#line 3301
    /* copy the next block */
-#line 3297
+#line 3301
 #pragma cdir loopcnt=LOOPCNT
-#line 3297
+#line 3301
 #pragma cdir shortloop
-#line 3297
+#line 3301
     for (i=0; i<ni; i++) {
-#line 3297
+#line 3301
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3297
+#line 3301
      /* test for range errors (not always needed but do it anyway) */
-#line 3297
+#line 3301
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3297
+#line 3301
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3297
+#line 3301
       nrange += xp[i] > USHORT_MAX ;
-#line 3297
+#line 3301
     }
-#line 3297
+#line 3301
    /* update xpp and tp */
-#line 3297
+#line 3301
     if (realign) xp = (uint *) *xpp;
-#line 3297
+#line 3301
     xp += ni;
-#line 3297
+#line 3301
     tp += ni;
-#line 3297
+#line 3301
     *xpp = (void*)xp;
-#line 3297
+#line 3301
   }
-#line 3297
+#line 3301
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3297
+#line 3301
 
-#line 3297
+#line 3301
 #else   /* not SX */
-#line 3297
+#line 3301
 	const char *xp = (const char *) *xpp;
-#line 3297
+#line 3301
 	int status = NC_NOERR;
-#line 3297
+#line 3301
 
-#line 3297
+#line 3301
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3297
+#line 3301
 	{
-#line 3297
+#line 3301
 		const int lstatus = ncx_get_uint_ushort(xp, tp);
-#line 3297
+#line 3301
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3297
+#line 3301
 			status = lstatus;
-#line 3297
+#line 3301
 	}
-#line 3297
+#line 3301
 
-#line 3297
+#line 3301
 	*xpp = (const void *)xp;
-#line 3297
+#line 3301
 	return status;
-#line 3297
+#line 3301
 #endif
-#line 3297
+#line 3301
 }
-#line 3297
+#line 3301
 
 int
-#line 3298
+#line 3302
 ncx_getn_uint_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3298
+#line 3302
 {
-#line 3298
+#line 3302
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3298
+#line 3302
 
-#line 3298
+#line 3302
  /* basic algorithm is:
-#line 3298
+#line 3302
   *   - ensure sane alignment of input data
-#line 3298
+#line 3302
   *   - copy (conversion happens automatically) input data
-#line 3298
+#line 3302
   *     to output
-#line 3298
+#line 3302
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3298
+#line 3302
   *     at next location for converted output
-#line 3298
+#line 3302
   */
-#line 3298
+#line 3302
   long i, j, ni;
-#line 3298
+#line 3302
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3298
+#line 3302
   uint *xp;
-#line 3298
+#line 3302
   int nrange = 0;         /* number of range errors */
-#line 3298
+#line 3302
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3298
+#line 3302
   long cxp = (long) *((char**)xpp);
-#line 3298
+#line 3302
 
-#line 3298
+#line 3302
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3298
+#line 3302
   /* sjl: manually stripmine so we can limit amount of
-#line 3298
+#line 3302
    * vector work space reserved to LOOPCNT elements. Also
-#line 3298
+#line 3302
    * makes vectorisation easy */
-#line 3298
+#line 3302
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3298
+#line 3302
     ni=Min(nelems-j,LOOPCNT);
-#line 3298
+#line 3302
     if (realign) {
-#line 3298
+#line 3302
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT));
-#line 3298
+#line 3302
       xp = tmp;
-#line 3298
+#line 3302
     } else {
-#line 3298
+#line 3302
       xp = (uint *) *xpp;
-#line 3298
+#line 3302
     }
-#line 3298
+#line 3302
    /* copy the next block */
-#line 3298
+#line 3302
 #pragma cdir loopcnt=LOOPCNT
-#line 3298
+#line 3302
 #pragma cdir shortloop
-#line 3298
+#line 3302
     for (i=0; i<ni; i++) {
-#line 3298
+#line 3302
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3298
+#line 3302
      /* test for range errors (not always needed but do it anyway) */
-#line 3298
+#line 3302
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3298
+#line 3302
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3298
+#line 3302
       nrange += xp[i] > ULONGLONG_MAX ;
-#line 3298
+#line 3302
     }
-#line 3298
+#line 3302
    /* update xpp and tp */
-#line 3298
+#line 3302
     if (realign) xp = (uint *) *xpp;
-#line 3298
+#line 3302
     xp += ni;
-#line 3298
+#line 3302
     tp += ni;
-#line 3298
+#line 3302
     *xpp = (void*)xp;
-#line 3298
+#line 3302
   }
-#line 3298
+#line 3302
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3298
+#line 3302
 
-#line 3298
+#line 3302
 #else   /* not SX */
-#line 3298
+#line 3302
 	const char *xp = (const char *) *xpp;
-#line 3298
+#line 3302
 	int status = NC_NOERR;
-#line 3298
+#line 3302
 
-#line 3298
+#line 3302
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3298
+#line 3302
 	{
-#line 3298
+#line 3302
 		const int lstatus = ncx_get_uint_ulonglong(xp, tp);
-#line 3298
+#line 3302
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3298
+#line 3302
 			status = lstatus;
-#line 3298
+#line 3302
 	}
-#line 3298
+#line 3302
 
-#line 3298
+#line 3302
 	*xpp = (const void *)xp;
-#line 3298
+#line 3302
 	return status;
-#line 3298
+#line 3302
 #endif
-#line 3298
+#line 3302
 }
-#line 3298
+#line 3302
 
 
 #if X_SIZEOF_UINT == SIZEOF_UINT
@@ -23831,1534 +23835,1534 @@ ncx_putn_uint_uint(void **xpp, size_t nelems, const unsigned int *tp, void *fill
 }
 #else
 int
-#line 3314
+#line 3318
 ncx_putn_uint_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
-#line 3314
+#line 3318
 {
-#line 3314
+#line 3318
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3314
+#line 3318
 
-#line 3314
+#line 3318
  /* basic algorithm is:
-#line 3314
+#line 3318
   *   - ensure sane alignment of output data
-#line 3314
+#line 3318
   *   - copy (conversion happens automatically) input data
-#line 3314
+#line 3318
   *     to output
-#line 3314
+#line 3318
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3314
+#line 3318
   *     at next location for converted output
-#line 3314
+#line 3318
   */
-#line 3314
+#line 3318
   long i, j, ni;
-#line 3314
+#line 3318
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3314
+#line 3318
   uint *xp;
-#line 3314
+#line 3318
   int nrange = 0;         /* number of range errors */
-#line 3314
+#line 3318
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3314
+#line 3318
   long cxp = (long) *((char**)xpp);
-#line 3314
+#line 3318
 
-#line 3314
+#line 3318
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3314
+#line 3318
   /* sjl: manually stripmine so we can limit amount of
-#line 3314
+#line 3318
    * vector work space reserved to LOOPCNT elements. Also
-#line 3314
+#line 3318
    * makes vectorisation easy */
-#line 3314
+#line 3318
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3314
+#line 3318
     ni=Min(nelems-j,LOOPCNT);
-#line 3314
+#line 3318
     if (realign) {
-#line 3314
+#line 3318
       xp = tmp;
-#line 3314
+#line 3318
     } else {
-#line 3314
+#line 3318
       xp = (uint *) *xpp;
-#line 3314
+#line 3318
     }
-#line 3314
+#line 3318
    /* copy the next block */
-#line 3314
+#line 3318
 #pragma cdir loopcnt=LOOPCNT
-#line 3314
+#line 3318
 #pragma cdir shortloop
-#line 3314
+#line 3318
     for (i=0; i<ni; i++) {
-#line 3314
+#line 3318
       /* the normal case: */
-#line 3314
+#line 3318
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3314
+#line 3318
      /* test for range errors (not always needed but do it anyway) */
-#line 3314
+#line 3318
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3314
+#line 3318
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3314
+#line 3318
       nrange += tp[i] > X_UINT_MAX ;
-#line 3314
+#line 3318
     }
-#line 3314
+#line 3318
    /* copy workspace back if necessary */
-#line 3314
+#line 3318
     if (realign) {
-#line 3314
+#line 3318
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3314
+#line 3318
       xp = (uint *) *xpp;
-#line 3314
+#line 3318
     }
-#line 3314
+#line 3318
    /* update xpp and tp */
-#line 3314
+#line 3318
     xp += ni;
-#line 3314
+#line 3318
     tp += ni;
-#line 3314
+#line 3318
     *xpp = (void*)xp;
-#line 3314
+#line 3318
   }
-#line 3314
+#line 3318
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3314
+#line 3318
 
-#line 3314
+#line 3318
 #else   /* not SX */
-#line 3314
+#line 3318
 
-#line 3314
+#line 3318
 	char *xp = (char *) *xpp;
-#line 3314
+#line 3318
 	int status = NC_NOERR;
-#line 3314
+#line 3318
 
-#line 3314
+#line 3318
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3314
+#line 3318
 	{
-#line 3314
+#line 3318
 		int lstatus = ncx_put_uint_uint(xp, tp, fillp);
-#line 3314
+#line 3318
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3314
+#line 3318
 			status = lstatus;
-#line 3314
+#line 3318
 	}
-#line 3314
+#line 3318
 
-#line 3314
+#line 3318
 	*xpp = (void *)xp;
-#line 3314
+#line 3318
 	return status;
-#line 3314
+#line 3318
 #endif
-#line 3314
+#line 3318
 }
-#line 3314
+#line 3318
 
 #endif
 int
-#line 3316
+#line 3320
 ncx_putn_uint_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3316
+#line 3320
 {
-#line 3316
+#line 3320
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3316
+#line 3320
 
-#line 3316
+#line 3320
  /* basic algorithm is:
-#line 3316
+#line 3320
   *   - ensure sane alignment of output data
-#line 3316
+#line 3320
   *   - copy (conversion happens automatically) input data
-#line 3316
+#line 3320
   *     to output
-#line 3316
+#line 3320
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3316
+#line 3320
   *     at next location for converted output
-#line 3316
+#line 3320
   */
-#line 3316
+#line 3320
   long i, j, ni;
-#line 3316
+#line 3320
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3316
+#line 3320
   uint *xp;
-#line 3316
+#line 3320
   int nrange = 0;         /* number of range errors */
-#line 3316
+#line 3320
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3316
+#line 3320
   long cxp = (long) *((char**)xpp);
-#line 3316
+#line 3320
 
-#line 3316
+#line 3320
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3316
+#line 3320
   /* sjl: manually stripmine so we can limit amount of
-#line 3316
+#line 3320
    * vector work space reserved to LOOPCNT elements. Also
-#line 3316
+#line 3320
    * makes vectorisation easy */
-#line 3316
+#line 3320
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3316
+#line 3320
     ni=Min(nelems-j,LOOPCNT);
-#line 3316
+#line 3320
     if (realign) {
-#line 3316
+#line 3320
       xp = tmp;
-#line 3316
+#line 3320
     } else {
-#line 3316
+#line 3320
       xp = (uint *) *xpp;
-#line 3316
+#line 3320
     }
-#line 3316
+#line 3320
    /* copy the next block */
-#line 3316
+#line 3320
 #pragma cdir loopcnt=LOOPCNT
-#line 3316
+#line 3320
 #pragma cdir shortloop
-#line 3316
+#line 3320
     for (i=0; i<ni; i++) {
-#line 3316
+#line 3320
       /* the normal case: */
-#line 3316
+#line 3320
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3316
+#line 3320
      /* test for range errors (not always needed but do it anyway) */
-#line 3316
+#line 3320
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3316
+#line 3320
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3316
+#line 3320
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3316
+#line 3320
     }
-#line 3316
+#line 3320
    /* copy workspace back if necessary */
-#line 3316
+#line 3320
     if (realign) {
-#line 3316
+#line 3320
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3316
+#line 3320
       xp = (uint *) *xpp;
-#line 3316
+#line 3320
     }
-#line 3316
+#line 3320
    /* update xpp and tp */
-#line 3316
+#line 3320
     xp += ni;
-#line 3316
+#line 3320
     tp += ni;
-#line 3316
+#line 3320
     *xpp = (void*)xp;
-#line 3316
+#line 3320
   }
-#line 3316
+#line 3320
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3316
+#line 3320
 
-#line 3316
+#line 3320
 #else   /* not SX */
-#line 3316
+#line 3320
 
-#line 3316
+#line 3320
 	char *xp = (char *) *xpp;
-#line 3316
+#line 3320
 	int status = NC_NOERR;
-#line 3316
+#line 3320
 
-#line 3316
+#line 3320
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3316
+#line 3320
 	{
-#line 3316
+#line 3320
 		int lstatus = ncx_put_uint_schar(xp, tp, fillp);
-#line 3316
+#line 3320
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3316
+#line 3320
 			status = lstatus;
-#line 3316
+#line 3320
 	}
-#line 3316
+#line 3320
 
-#line 3316
+#line 3320
 	*xpp = (void *)xp;
-#line 3316
+#line 3320
 	return status;
-#line 3316
+#line 3320
 #endif
-#line 3316
+#line 3320
 }
-#line 3316
+#line 3320
 
 int
-#line 3317
+#line 3321
 ncx_putn_uint_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3317
+#line 3321
 {
-#line 3317
+#line 3321
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3317
+#line 3321
 
-#line 3317
+#line 3321
  /* basic algorithm is:
-#line 3317
+#line 3321
   *   - ensure sane alignment of output data
-#line 3317
+#line 3321
   *   - copy (conversion happens automatically) input data
-#line 3317
+#line 3321
   *     to output
-#line 3317
+#line 3321
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3317
+#line 3321
   *     at next location for converted output
-#line 3317
+#line 3321
   */
-#line 3317
+#line 3321
   long i, j, ni;
-#line 3317
+#line 3321
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3317
+#line 3321
   uint *xp;
-#line 3317
+#line 3321
   int nrange = 0;         /* number of range errors */
-#line 3317
+#line 3321
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3317
+#line 3321
   long cxp = (long) *((char**)xpp);
-#line 3317
+#line 3321
 
-#line 3317
+#line 3321
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3317
+#line 3321
   /* sjl: manually stripmine so we can limit amount of
-#line 3317
+#line 3321
    * vector work space reserved to LOOPCNT elements. Also
-#line 3317
+#line 3321
    * makes vectorisation easy */
-#line 3317
+#line 3321
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3317
+#line 3321
     ni=Min(nelems-j,LOOPCNT);
-#line 3317
+#line 3321
     if (realign) {
-#line 3317
+#line 3321
       xp = tmp;
-#line 3317
+#line 3321
     } else {
-#line 3317
+#line 3321
       xp = (uint *) *xpp;
-#line 3317
+#line 3321
     }
-#line 3317
+#line 3321
    /* copy the next block */
-#line 3317
+#line 3321
 #pragma cdir loopcnt=LOOPCNT
-#line 3317
+#line 3321
 #pragma cdir shortloop
-#line 3317
+#line 3321
     for (i=0; i<ni; i++) {
-#line 3317
+#line 3321
       /* the normal case: */
-#line 3317
+#line 3321
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3317
+#line 3321
      /* test for range errors (not always needed but do it anyway) */
-#line 3317
+#line 3321
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3317
+#line 3321
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3317
+#line 3321
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3317
+#line 3321
     }
-#line 3317
+#line 3321
    /* copy workspace back if necessary */
-#line 3317
+#line 3321
     if (realign) {
-#line 3317
+#line 3321
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3317
+#line 3321
       xp = (uint *) *xpp;
-#line 3317
+#line 3321
     }
-#line 3317
+#line 3321
    /* update xpp and tp */
-#line 3317
+#line 3321
     xp += ni;
-#line 3317
+#line 3321
     tp += ni;
-#line 3317
+#line 3321
     *xpp = (void*)xp;
-#line 3317
+#line 3321
   }
-#line 3317
+#line 3321
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3317
+#line 3321
 
-#line 3317
+#line 3321
 #else   /* not SX */
-#line 3317
+#line 3321
 
-#line 3317
+#line 3321
 	char *xp = (char *) *xpp;
-#line 3317
+#line 3321
 	int status = NC_NOERR;
-#line 3317
+#line 3321
 
-#line 3317
+#line 3321
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3317
+#line 3321
 	{
-#line 3317
+#line 3321
 		int lstatus = ncx_put_uint_short(xp, tp, fillp);
-#line 3317
+#line 3321
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3317
+#line 3321
 			status = lstatus;
-#line 3317
+#line 3321
 	}
-#line 3317
+#line 3321
 
-#line 3317
+#line 3321
 	*xpp = (void *)xp;
-#line 3317
+#line 3321
 	return status;
-#line 3317
+#line 3321
 #endif
-#line 3317
+#line 3321
 }
-#line 3317
+#line 3321
 
 int
-#line 3318
+#line 3322
 ncx_putn_uint_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3318
+#line 3322
 {
-#line 3318
+#line 3322
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3318
+#line 3322
 
-#line 3318
+#line 3322
  /* basic algorithm is:
-#line 3318
+#line 3322
   *   - ensure sane alignment of output data
-#line 3318
+#line 3322
   *   - copy (conversion happens automatically) input data
-#line 3318
+#line 3322
   *     to output
-#line 3318
+#line 3322
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3318
+#line 3322
   *     at next location for converted output
-#line 3318
+#line 3322
   */
-#line 3318
+#line 3322
   long i, j, ni;
-#line 3318
+#line 3322
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3318
+#line 3322
   uint *xp;
-#line 3318
+#line 3322
   int nrange = 0;         /* number of range errors */
-#line 3318
+#line 3322
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3318
+#line 3322
   long cxp = (long) *((char**)xpp);
-#line 3318
+#line 3322
 
-#line 3318
+#line 3322
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3318
+#line 3322
   /* sjl: manually stripmine so we can limit amount of
-#line 3318
+#line 3322
    * vector work space reserved to LOOPCNT elements. Also
-#line 3318
+#line 3322
    * makes vectorisation easy */
-#line 3318
+#line 3322
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3318
+#line 3322
     ni=Min(nelems-j,LOOPCNT);
-#line 3318
+#line 3322
     if (realign) {
-#line 3318
+#line 3322
       xp = tmp;
-#line 3318
+#line 3322
     } else {
-#line 3318
+#line 3322
       xp = (uint *) *xpp;
-#line 3318
+#line 3322
     }
-#line 3318
+#line 3322
    /* copy the next block */
-#line 3318
+#line 3322
 #pragma cdir loopcnt=LOOPCNT
-#line 3318
+#line 3322
 #pragma cdir shortloop
-#line 3318
+#line 3322
     for (i=0; i<ni; i++) {
-#line 3318
+#line 3322
       /* the normal case: */
-#line 3318
+#line 3322
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3318
+#line 3322
      /* test for range errors (not always needed but do it anyway) */
-#line 3318
+#line 3322
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3318
+#line 3322
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3318
+#line 3322
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3318
+#line 3322
     }
-#line 3318
+#line 3322
    /* copy workspace back if necessary */
-#line 3318
+#line 3322
     if (realign) {
-#line 3318
+#line 3322
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3318
+#line 3322
       xp = (uint *) *xpp;
-#line 3318
+#line 3322
     }
-#line 3318
+#line 3322
    /* update xpp and tp */
-#line 3318
+#line 3322
     xp += ni;
-#line 3318
+#line 3322
     tp += ni;
-#line 3318
+#line 3322
     *xpp = (void*)xp;
-#line 3318
+#line 3322
   }
-#line 3318
+#line 3322
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3318
+#line 3322
 
-#line 3318
+#line 3322
 #else   /* not SX */
-#line 3318
+#line 3322
 
-#line 3318
+#line 3322
 	char *xp = (char *) *xpp;
-#line 3318
+#line 3322
 	int status = NC_NOERR;
-#line 3318
+#line 3322
 
-#line 3318
+#line 3322
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3318
+#line 3322
 	{
-#line 3318
+#line 3322
 		int lstatus = ncx_put_uint_int(xp, tp, fillp);
-#line 3318
+#line 3322
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3318
+#line 3322
 			status = lstatus;
-#line 3318
+#line 3322
 	}
-#line 3318
+#line 3322
 
-#line 3318
+#line 3322
 	*xpp = (void *)xp;
-#line 3318
+#line 3322
 	return status;
-#line 3318
+#line 3322
 #endif
-#line 3318
+#line 3322
 }
-#line 3318
+#line 3322
 
 int
-#line 3319
+#line 3323
 ncx_putn_uint_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3319
+#line 3323
 {
-#line 3319
+#line 3323
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3319
+#line 3323
 
-#line 3319
+#line 3323
  /* basic algorithm is:
-#line 3319
+#line 3323
   *   - ensure sane alignment of output data
-#line 3319
+#line 3323
   *   - copy (conversion happens automatically) input data
-#line 3319
+#line 3323
   *     to output
-#line 3319
+#line 3323
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3319
+#line 3323
   *     at next location for converted output
-#line 3319
+#line 3323
   */
-#line 3319
+#line 3323
   long i, j, ni;
-#line 3319
+#line 3323
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3319
+#line 3323
   uint *xp;
-#line 3319
+#line 3323
   int nrange = 0;         /* number of range errors */
-#line 3319
+#line 3323
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3319
+#line 3323
   long cxp = (long) *((char**)xpp);
-#line 3319
+#line 3323
 
-#line 3319
+#line 3323
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3319
+#line 3323
   /* sjl: manually stripmine so we can limit amount of
-#line 3319
+#line 3323
    * vector work space reserved to LOOPCNT elements. Also
-#line 3319
+#line 3323
    * makes vectorisation easy */
-#line 3319
+#line 3323
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3319
+#line 3323
     ni=Min(nelems-j,LOOPCNT);
-#line 3319
+#line 3323
     if (realign) {
-#line 3319
+#line 3323
       xp = tmp;
-#line 3319
+#line 3323
     } else {
-#line 3319
+#line 3323
       xp = (uint *) *xpp;
-#line 3319
+#line 3323
     }
-#line 3319
+#line 3323
    /* copy the next block */
-#line 3319
+#line 3323
 #pragma cdir loopcnt=LOOPCNT
-#line 3319
+#line 3323
 #pragma cdir shortloop
-#line 3319
+#line 3323
     for (i=0; i<ni; i++) {
-#line 3319
+#line 3323
       /* the normal case: */
-#line 3319
+#line 3323
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3319
+#line 3323
      /* test for range errors (not always needed but do it anyway) */
-#line 3319
+#line 3323
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3319
+#line 3323
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3319
+#line 3323
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3319
+#line 3323
     }
-#line 3319
+#line 3323
    /* copy workspace back if necessary */
-#line 3319
+#line 3323
     if (realign) {
-#line 3319
+#line 3323
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3319
+#line 3323
       xp = (uint *) *xpp;
-#line 3319
+#line 3323
     }
-#line 3319
+#line 3323
    /* update xpp and tp */
-#line 3319
+#line 3323
     xp += ni;
-#line 3319
+#line 3323
     tp += ni;
-#line 3319
+#line 3323
     *xpp = (void*)xp;
-#line 3319
+#line 3323
   }
-#line 3319
+#line 3323
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3319
+#line 3323
 
-#line 3319
+#line 3323
 #else   /* not SX */
-#line 3319
+#line 3323
 
-#line 3319
+#line 3323
 	char *xp = (char *) *xpp;
-#line 3319
+#line 3323
 	int status = NC_NOERR;
-#line 3319
+#line 3323
 
-#line 3319
+#line 3323
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3319
+#line 3323
 	{
-#line 3319
+#line 3323
 		int lstatus = ncx_put_uint_long(xp, tp, fillp);
-#line 3319
+#line 3323
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3319
+#line 3323
 			status = lstatus;
-#line 3319
+#line 3323
 	}
-#line 3319
+#line 3323
 
-#line 3319
+#line 3323
 	*xpp = (void *)xp;
-#line 3319
+#line 3323
 	return status;
-#line 3319
+#line 3323
 #endif
-#line 3319
+#line 3323
 }
-#line 3319
+#line 3323
 
 int
-#line 3320
+#line 3324
 ncx_putn_uint_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3320
+#line 3324
 {
-#line 3320
+#line 3324
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3320
+#line 3324
 
-#line 3320
+#line 3324
  /* basic algorithm is:
-#line 3320
+#line 3324
   *   - ensure sane alignment of output data
-#line 3320
+#line 3324
   *   - copy (conversion happens automatically) input data
-#line 3320
+#line 3324
   *     to output
-#line 3320
+#line 3324
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3320
+#line 3324
   *     at next location for converted output
-#line 3320
+#line 3324
   */
-#line 3320
+#line 3324
   long i, j, ni;
-#line 3320
+#line 3324
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3320
+#line 3324
   uint *xp;
-#line 3320
+#line 3324
   int nrange = 0;         /* number of range errors */
-#line 3320
+#line 3324
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3320
+#line 3324
   long cxp = (long) *((char**)xpp);
-#line 3320
+#line 3324
 
-#line 3320
+#line 3324
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3320
+#line 3324
   /* sjl: manually stripmine so we can limit amount of
-#line 3320
+#line 3324
    * vector work space reserved to LOOPCNT elements. Also
-#line 3320
+#line 3324
    * makes vectorisation easy */
-#line 3320
+#line 3324
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3320
+#line 3324
     ni=Min(nelems-j,LOOPCNT);
-#line 3320
+#line 3324
     if (realign) {
-#line 3320
+#line 3324
       xp = tmp;
-#line 3320
+#line 3324
     } else {
-#line 3320
+#line 3324
       xp = (uint *) *xpp;
-#line 3320
+#line 3324
     }
-#line 3320
+#line 3324
    /* copy the next block */
-#line 3320
+#line 3324
 #pragma cdir loopcnt=LOOPCNT
-#line 3320
+#line 3324
 #pragma cdir shortloop
-#line 3320
+#line 3324
     for (i=0; i<ni; i++) {
-#line 3320
+#line 3324
       /* the normal case: */
-#line 3320
+#line 3324
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3320
+#line 3324
      /* test for range errors (not always needed but do it anyway) */
-#line 3320
+#line 3324
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3320
+#line 3324
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3320
+#line 3324
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3320
+#line 3324
     }
-#line 3320
+#line 3324
    /* copy workspace back if necessary */
-#line 3320
+#line 3324
     if (realign) {
-#line 3320
+#line 3324
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3320
+#line 3324
       xp = (uint *) *xpp;
-#line 3320
+#line 3324
     }
-#line 3320
+#line 3324
    /* update xpp and tp */
-#line 3320
+#line 3324
     xp += ni;
-#line 3320
+#line 3324
     tp += ni;
-#line 3320
+#line 3324
     *xpp = (void*)xp;
-#line 3320
+#line 3324
   }
-#line 3320
+#line 3324
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3320
+#line 3324
 
-#line 3320
+#line 3324
 #else   /* not SX */
-#line 3320
+#line 3324
 
-#line 3320
+#line 3324
 	char *xp = (char *) *xpp;
-#line 3320
+#line 3324
 	int status = NC_NOERR;
-#line 3320
+#line 3324
 
-#line 3320
+#line 3324
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3320
+#line 3324
 	{
-#line 3320
+#line 3324
 		int lstatus = ncx_put_uint_float(xp, tp, fillp);
-#line 3320
+#line 3324
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3320
+#line 3324
 			status = lstatus;
-#line 3320
+#line 3324
 	}
-#line 3320
+#line 3324
 
-#line 3320
+#line 3324
 	*xpp = (void *)xp;
-#line 3320
+#line 3324
 	return status;
-#line 3320
+#line 3324
 #endif
-#line 3320
+#line 3324
 }
-#line 3320
+#line 3324
 
 int
-#line 3321
+#line 3325
 ncx_putn_uint_double(void **xpp, size_t nelems, const double *tp, void *fillp)
-#line 3321
+#line 3325
 {
-#line 3321
+#line 3325
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3321
+#line 3325
 
-#line 3321
+#line 3325
  /* basic algorithm is:
-#line 3321
+#line 3325
   *   - ensure sane alignment of output data
-#line 3321
+#line 3325
   *   - copy (conversion happens automatically) input data
-#line 3321
+#line 3325
   *     to output
-#line 3321
+#line 3325
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3321
+#line 3325
   *     at next location for converted output
-#line 3321
+#line 3325
   */
-#line 3321
+#line 3325
   long i, j, ni;
-#line 3321
+#line 3325
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3321
+#line 3325
   uint *xp;
-#line 3321
+#line 3325
   int nrange = 0;         /* number of range errors */
-#line 3321
+#line 3325
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3321
+#line 3325
   long cxp = (long) *((char**)xpp);
-#line 3321
+#line 3325
 
-#line 3321
+#line 3325
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3321
+#line 3325
   /* sjl: manually stripmine so we can limit amount of
-#line 3321
+#line 3325
    * vector work space reserved to LOOPCNT elements. Also
-#line 3321
+#line 3325
    * makes vectorisation easy */
-#line 3321
+#line 3325
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3321
+#line 3325
     ni=Min(nelems-j,LOOPCNT);
-#line 3321
+#line 3325
     if (realign) {
-#line 3321
+#line 3325
       xp = tmp;
-#line 3321
+#line 3325
     } else {
-#line 3321
+#line 3325
       xp = (uint *) *xpp;
-#line 3321
+#line 3325
     }
-#line 3321
+#line 3325
    /* copy the next block */
-#line 3321
+#line 3325
 #pragma cdir loopcnt=LOOPCNT
-#line 3321
+#line 3325
 #pragma cdir shortloop
-#line 3321
+#line 3325
     for (i=0; i<ni; i++) {
-#line 3321
+#line 3325
       /* the normal case: */
-#line 3321
+#line 3325
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3321
+#line 3325
      /* test for range errors (not always needed but do it anyway) */
-#line 3321
+#line 3325
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3321
+#line 3325
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3321
+#line 3325
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3321
+#line 3325
     }
-#line 3321
+#line 3325
    /* copy workspace back if necessary */
-#line 3321
+#line 3325
     if (realign) {
-#line 3321
+#line 3325
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3321
+#line 3325
       xp = (uint *) *xpp;
-#line 3321
+#line 3325
     }
-#line 3321
+#line 3325
    /* update xpp and tp */
-#line 3321
+#line 3325
     xp += ni;
-#line 3321
+#line 3325
     tp += ni;
-#line 3321
+#line 3325
     *xpp = (void*)xp;
-#line 3321
+#line 3325
   }
-#line 3321
+#line 3325
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3321
+#line 3325
 
-#line 3321
+#line 3325
 #else   /* not SX */
-#line 3321
+#line 3325
 
-#line 3321
+#line 3325
 	char *xp = (char *) *xpp;
-#line 3321
+#line 3325
 	int status = NC_NOERR;
-#line 3321
+#line 3325
 
-#line 3321
+#line 3325
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3321
+#line 3325
 	{
-#line 3321
+#line 3325
 		int lstatus = ncx_put_uint_double(xp, tp, fillp);
-#line 3321
+#line 3325
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3321
+#line 3325
 			status = lstatus;
-#line 3321
+#line 3325
 	}
-#line 3321
+#line 3325
 
-#line 3321
+#line 3325
 	*xpp = (void *)xp;
-#line 3321
+#line 3325
 	return status;
-#line 3321
+#line 3325
 #endif
-#line 3321
+#line 3325
 }
-#line 3321
+#line 3325
 
 int
-#line 3322
+#line 3326
 ncx_putn_uint_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
-#line 3322
+#line 3326
 {
-#line 3322
+#line 3326
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3322
+#line 3326
 
-#line 3322
+#line 3326
  /* basic algorithm is:
-#line 3322
+#line 3326
   *   - ensure sane alignment of output data
-#line 3322
+#line 3326
   *   - copy (conversion happens automatically) input data
-#line 3322
+#line 3326
   *     to output
-#line 3322
+#line 3326
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3322
+#line 3326
   *     at next location for converted output
-#line 3322
+#line 3326
   */
-#line 3322
+#line 3326
   long i, j, ni;
-#line 3322
+#line 3326
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3322
+#line 3326
   uint *xp;
-#line 3322
+#line 3326
   int nrange = 0;         /* number of range errors */
-#line 3322
+#line 3326
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3322
+#line 3326
   long cxp = (long) *((char**)xpp);
-#line 3322
+#line 3326
 
-#line 3322
+#line 3326
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3322
+#line 3326
   /* sjl: manually stripmine so we can limit amount of
-#line 3322
+#line 3326
    * vector work space reserved to LOOPCNT elements. Also
-#line 3322
+#line 3326
    * makes vectorisation easy */
-#line 3322
+#line 3326
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3322
+#line 3326
     ni=Min(nelems-j,LOOPCNT);
-#line 3322
+#line 3326
     if (realign) {
-#line 3322
+#line 3326
       xp = tmp;
-#line 3322
+#line 3326
     } else {
-#line 3322
+#line 3326
       xp = (uint *) *xpp;
-#line 3322
+#line 3326
     }
-#line 3322
+#line 3326
    /* copy the next block */
-#line 3322
+#line 3326
 #pragma cdir loopcnt=LOOPCNT
-#line 3322
+#line 3326
 #pragma cdir shortloop
-#line 3322
+#line 3326
     for (i=0; i<ni; i++) {
-#line 3322
+#line 3326
       /* the normal case: */
-#line 3322
+#line 3326
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3322
+#line 3326
      /* test for range errors (not always needed but do it anyway) */
-#line 3322
+#line 3326
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3322
+#line 3326
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3322
+#line 3326
       nrange += tp[i] > X_UINT_MAX || tp[i] < 0;
-#line 3322
+#line 3326
     }
-#line 3322
+#line 3326
    /* copy workspace back if necessary */
-#line 3322
+#line 3326
     if (realign) {
-#line 3322
+#line 3326
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3322
+#line 3326
       xp = (uint *) *xpp;
-#line 3322
+#line 3326
     }
-#line 3322
+#line 3326
    /* update xpp and tp */
-#line 3322
+#line 3326
     xp += ni;
-#line 3322
+#line 3326
     tp += ni;
-#line 3322
+#line 3326
     *xpp = (void*)xp;
-#line 3322
+#line 3326
   }
-#line 3322
+#line 3326
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3322
+#line 3326
 
-#line 3322
+#line 3326
 #else   /* not SX */
-#line 3322
+#line 3326
 
-#line 3322
+#line 3326
 	char *xp = (char *) *xpp;
-#line 3322
+#line 3326
 	int status = NC_NOERR;
-#line 3322
+#line 3326
 
-#line 3322
+#line 3326
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3322
+#line 3326
 	{
-#line 3322
+#line 3326
 		int lstatus = ncx_put_uint_longlong(xp, tp, fillp);
-#line 3322
+#line 3326
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3322
+#line 3326
 			status = lstatus;
-#line 3322
+#line 3326
 	}
-#line 3322
+#line 3326
 
-#line 3322
+#line 3326
 	*xpp = (void *)xp;
-#line 3322
+#line 3326
 	return status;
-#line 3322
+#line 3326
 #endif
-#line 3322
+#line 3326
 }
-#line 3322
+#line 3326
 
 int
-#line 3323
+#line 3327
 ncx_putn_uint_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 3323
+#line 3327
 {
-#line 3323
+#line 3327
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3323
+#line 3327
 
-#line 3323
+#line 3327
  /* basic algorithm is:
-#line 3323
+#line 3327
   *   - ensure sane alignment of output data
-#line 3323
+#line 3327
   *   - copy (conversion happens automatically) input data
-#line 3323
+#line 3327
   *     to output
-#line 3323
+#line 3327
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3323
+#line 3327
   *     at next location for converted output
-#line 3323
+#line 3327
   */
-#line 3323
+#line 3327
   long i, j, ni;
-#line 3323
+#line 3327
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3323
+#line 3327
   uint *xp;
-#line 3323
+#line 3327
   int nrange = 0;         /* number of range errors */
-#line 3323
+#line 3327
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3323
+#line 3327
   long cxp = (long) *((char**)xpp);
-#line 3323
+#line 3327
 
-#line 3323
+#line 3327
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3323
+#line 3327
   /* sjl: manually stripmine so we can limit amount of
-#line 3323
+#line 3327
    * vector work space reserved to LOOPCNT elements. Also
-#line 3323
+#line 3327
    * makes vectorisation easy */
-#line 3323
+#line 3327
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3323
+#line 3327
     ni=Min(nelems-j,LOOPCNT);
-#line 3323
+#line 3327
     if (realign) {
-#line 3323
+#line 3327
       xp = tmp;
-#line 3323
+#line 3327
     } else {
-#line 3323
+#line 3327
       xp = (uint *) *xpp;
-#line 3323
+#line 3327
     }
-#line 3323
+#line 3327
    /* copy the next block */
-#line 3323
+#line 3327
 #pragma cdir loopcnt=LOOPCNT
-#line 3323
+#line 3327
 #pragma cdir shortloop
-#line 3323
+#line 3327
     for (i=0; i<ni; i++) {
-#line 3323
+#line 3327
       /* the normal case: */
-#line 3323
+#line 3327
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3323
+#line 3327
      /* test for range errors (not always needed but do it anyway) */
-#line 3323
+#line 3327
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3323
+#line 3327
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3323
+#line 3327
       nrange += tp[i] > X_UINT_MAX ;
-#line 3323
+#line 3327
     }
-#line 3323
+#line 3327
    /* copy workspace back if necessary */
-#line 3323
+#line 3327
     if (realign) {
-#line 3323
+#line 3327
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3323
+#line 3327
       xp = (uint *) *xpp;
-#line 3323
+#line 3327
     }
-#line 3323
+#line 3327
    /* update xpp and tp */
-#line 3323
+#line 3327
     xp += ni;
-#line 3323
+#line 3327
     tp += ni;
-#line 3323
+#line 3327
     *xpp = (void*)xp;
-#line 3323
+#line 3327
   }
-#line 3323
+#line 3327
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3323
+#line 3327
 
-#line 3323
+#line 3327
 #else   /* not SX */
-#line 3323
+#line 3327
 
-#line 3323
+#line 3327
 	char *xp = (char *) *xpp;
-#line 3323
+#line 3327
 	int status = NC_NOERR;
-#line 3323
+#line 3327
 
-#line 3323
+#line 3327
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3323
+#line 3327
 	{
-#line 3323
+#line 3327
 		int lstatus = ncx_put_uint_uchar(xp, tp, fillp);
-#line 3323
+#line 3327
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3323
+#line 3327
 			status = lstatus;
-#line 3323
+#line 3327
 	}
-#line 3323
+#line 3327
 
-#line 3323
+#line 3327
 	*xpp = (void *)xp;
-#line 3323
+#line 3327
 	return status;
-#line 3323
+#line 3327
 #endif
-#line 3323
+#line 3327
 }
-#line 3323
+#line 3327
 
 int
-#line 3324
+#line 3328
 ncx_putn_uint_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3324
+#line 3328
 {
-#line 3324
+#line 3328
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3324
+#line 3328
 
-#line 3324
+#line 3328
  /* basic algorithm is:
-#line 3324
+#line 3328
   *   - ensure sane alignment of output data
-#line 3324
+#line 3328
   *   - copy (conversion happens automatically) input data
-#line 3324
+#line 3328
   *     to output
-#line 3324
+#line 3328
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3324
+#line 3328
   *     at next location for converted output
-#line 3324
+#line 3328
   */
-#line 3324
+#line 3328
   long i, j, ni;
-#line 3324
+#line 3328
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3324
+#line 3328
   uint *xp;
-#line 3324
+#line 3328
   int nrange = 0;         /* number of range errors */
-#line 3324
+#line 3328
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3324
+#line 3328
   long cxp = (long) *((char**)xpp);
-#line 3324
+#line 3328
 
-#line 3324
+#line 3328
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3324
+#line 3328
   /* sjl: manually stripmine so we can limit amount of
-#line 3324
+#line 3328
    * vector work space reserved to LOOPCNT elements. Also
-#line 3324
+#line 3328
    * makes vectorisation easy */
-#line 3324
+#line 3328
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3324
+#line 3328
     ni=Min(nelems-j,LOOPCNT);
-#line 3324
+#line 3328
     if (realign) {
-#line 3324
+#line 3328
       xp = tmp;
-#line 3324
+#line 3328
     } else {
-#line 3324
+#line 3328
       xp = (uint *) *xpp;
-#line 3324
+#line 3328
     }
-#line 3324
+#line 3328
    /* copy the next block */
-#line 3324
+#line 3328
 #pragma cdir loopcnt=LOOPCNT
-#line 3324
+#line 3328
 #pragma cdir shortloop
-#line 3324
+#line 3328
     for (i=0; i<ni; i++) {
-#line 3324
+#line 3328
       /* the normal case: */
-#line 3324
+#line 3328
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3324
+#line 3328
      /* test for range errors (not always needed but do it anyway) */
-#line 3324
+#line 3328
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3324
+#line 3328
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3324
+#line 3328
       nrange += tp[i] > X_UINT_MAX ;
-#line 3324
+#line 3328
     }
-#line 3324
+#line 3328
    /* copy workspace back if necessary */
-#line 3324
+#line 3328
     if (realign) {
-#line 3324
+#line 3328
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3324
+#line 3328
       xp = (uint *) *xpp;
-#line 3324
+#line 3328
     }
-#line 3324
+#line 3328
    /* update xpp and tp */
-#line 3324
+#line 3328
     xp += ni;
-#line 3324
+#line 3328
     tp += ni;
-#line 3324
+#line 3328
     *xpp = (void*)xp;
-#line 3324
+#line 3328
   }
-#line 3324
+#line 3328
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3324
+#line 3328
 
-#line 3324
+#line 3328
 #else   /* not SX */
-#line 3324
+#line 3328
 
-#line 3324
+#line 3328
 	char *xp = (char *) *xpp;
-#line 3324
+#line 3328
 	int status = NC_NOERR;
-#line 3324
+#line 3328
 
-#line 3324
+#line 3328
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3324
+#line 3328
 	{
-#line 3324
+#line 3328
 		int lstatus = ncx_put_uint_ushort(xp, tp, fillp);
-#line 3324
+#line 3328
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3324
+#line 3328
 			status = lstatus;
-#line 3324
+#line 3328
 	}
-#line 3324
+#line 3328
 
-#line 3324
+#line 3328
 	*xpp = (void *)xp;
-#line 3324
+#line 3328
 	return status;
-#line 3324
+#line 3328
 #endif
-#line 3324
+#line 3328
 }
-#line 3324
+#line 3328
 
 int
-#line 3325
+#line 3329
 ncx_putn_uint_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
-#line 3325
+#line 3329
 {
-#line 3325
+#line 3329
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT == SIZEOF_UINT
-#line 3325
+#line 3329
 
-#line 3325
+#line 3329
  /* basic algorithm is:
-#line 3325
+#line 3329
   *   - ensure sane alignment of output data
-#line 3325
+#line 3329
   *   - copy (conversion happens automatically) input data
-#line 3325
+#line 3329
   *     to output
-#line 3325
+#line 3329
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3325
+#line 3329
   *     at next location for converted output
-#line 3325
+#line 3329
   */
-#line 3325
+#line 3329
   long i, j, ni;
-#line 3325
+#line 3329
   uint tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3325
+#line 3329
   uint *xp;
-#line 3325
+#line 3329
   int nrange = 0;         /* number of range errors */
-#line 3325
+#line 3329
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3325
+#line 3329
   long cxp = (long) *((char**)xpp);
-#line 3325
+#line 3329
 
-#line 3325
+#line 3329
   realign = (cxp & 7) % SIZEOF_UINT;
-#line 3325
+#line 3329
   /* sjl: manually stripmine so we can limit amount of
-#line 3325
+#line 3329
    * vector work space reserved to LOOPCNT elements. Also
-#line 3325
+#line 3329
    * makes vectorisation easy */
-#line 3325
+#line 3329
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3325
+#line 3329
     ni=Min(nelems-j,LOOPCNT);
-#line 3325
+#line 3329
     if (realign) {
-#line 3325
+#line 3329
       xp = tmp;
-#line 3325
+#line 3329
     } else {
-#line 3325
+#line 3329
       xp = (uint *) *xpp;
-#line 3325
+#line 3329
     }
-#line 3325
+#line 3329
    /* copy the next block */
-#line 3325
+#line 3329
 #pragma cdir loopcnt=LOOPCNT
-#line 3325
+#line 3329
 #pragma cdir shortloop
-#line 3325
+#line 3329
     for (i=0; i<ni; i++) {
-#line 3325
+#line 3329
       /* the normal case: */
-#line 3325
+#line 3329
       xp[i] = (uint) Max( X_UINT_MIN, Min(X_UINT_MAX, (uint) tp[i]));
-#line 3325
+#line 3329
      /* test for range errors (not always needed but do it anyway) */
-#line 3325
+#line 3329
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3325
+#line 3329
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3325
+#line 3329
       nrange += tp[i] > X_UINT_MAX ;
-#line 3325
+#line 3329
     }
-#line 3325
+#line 3329
    /* copy workspace back if necessary */
-#line 3325
+#line 3329
     if (realign) {
-#line 3325
+#line 3329
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT);
-#line 3325
+#line 3329
       xp = (uint *) *xpp;
-#line 3325
+#line 3329
     }
-#line 3325
+#line 3329
    /* update xpp and tp */
-#line 3325
+#line 3329
     xp += ni;
-#line 3325
+#line 3329
     tp += ni;
-#line 3325
+#line 3329
     *xpp = (void*)xp;
-#line 3325
+#line 3329
   }
-#line 3325
+#line 3329
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3325
+#line 3329
 
-#line 3325
+#line 3329
 #else   /* not SX */
-#line 3325
+#line 3329
 
-#line 3325
+#line 3329
 	char *xp = (char *) *xpp;
-#line 3325
+#line 3329
 	int status = NC_NOERR;
-#line 3325
+#line 3329
 
-#line 3325
+#line 3329
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT, tp++)
-#line 3325
+#line 3329
 	{
-#line 3325
+#line 3329
 		int lstatus = ncx_put_uint_ulonglong(xp, tp, fillp);
-#line 3325
+#line 3329
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3325
+#line 3329
 			status = lstatus;
-#line 3325
+#line 3329
 	}
-#line 3325
+#line 3329
 
-#line 3325
+#line 3329
 	*xpp = (void *)xp;
-#line 3325
+#line 3329
 	return status;
-#line 3325
+#line 3329
 #endif
-#line 3325
+#line 3329
 }
-#line 3325
+#line 3329
 
 
 
@@ -25386,95 +25390,95 @@ ncx_getn_float_float(const void **xpp, size_t nfloats, float *ip)
 	while (ip < end)
 	{
 		struct vax_single *const vsp = (struct vax_single *) ip;
-#line 3351
+#line 3355
 		const struct ieee_single *const isp =
-#line 3351
+#line 3355
 			 (const struct ieee_single *) (*xpp);
-#line 3351
+#line 3355
 		unsigned exp = isp->exp_hi << 1 | isp->exp_lo;
-#line 3351
+#line 3355
 
-#line 3351
+#line 3355
 		switch(exp) {
-#line 3351
+#line 3355
 		case 0 :
-#line 3351
+#line 3355
 			/* ieee subnormal */
-#line 3351
+#line 3355
 			if (isp->mant_hi == min.ieee.mant_hi
-#line 3351
+#line 3355
 				&& isp->mant_lo_hi == min.ieee.mant_lo_hi
-#line 3351
+#line 3355
 				&& isp->mant_lo_lo == min.ieee.mant_lo_lo)
-#line 3351
+#line 3355
 			{
-#line 3351
+#line 3355
 				*vsp = min.s;
-#line 3351
+#line 3355
 			}
-#line 3351
+#line 3355
 			else
-#line 3351
+#line 3355
 			{
-#line 3351
+#line 3355
 				unsigned mantissa = (isp->mant_hi << 16)
-#line 3351
+#line 3355
 					 | isp->mant_lo_hi << 8
-#line 3351
+#line 3355
 					 | isp->mant_lo_lo;
-#line 3351
+#line 3355
 				unsigned tmp = mantissa >> 20;
-#line 3351
+#line 3355
 				if (tmp >= 4) {
-#line 3351
+#line 3355
 					vsp->exp = 2;
-#line 3351
+#line 3355
 				} else if (tmp >= 2) {
-#line 3351
+#line 3355
 					vsp->exp = 1;
-#line 3351
+#line 3355
 				} else {
-#line 3351
+#line 3355
 					*vsp = min.s;
-#line 3351
+#line 3355
 					break;
-#line 3351
+#line 3355
 				} /* else */
-#line 3351
+#line 3355
 				tmp = mantissa - (1 << (20 + vsp->exp ));
-#line 3351
+#line 3355
 				tmp <<= 3 - vsp->exp;
-#line 3351
+#line 3355
 				vsp->mantissa2 = tmp;
-#line 3351
+#line 3355
 				vsp->mantissa1 = (tmp >> 16);
-#line 3351
+#line 3355
 			}
-#line 3351
+#line 3355
 			break;
-#line 3351
+#line 3355
 		case 0xfe :
-#line 3351
+#line 3355
 		case 0xff :
-#line 3351
+#line 3355
 			*vsp = max.s;
-#line 3351
+#line 3355
 			break;
-#line 3351
+#line 3355
 		default :
-#line 3351
+#line 3355
 			vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
-#line 3351
+#line 3355
 			vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo;
-#line 3351
+#line 3355
 			vsp->mantissa1 = isp->mant_hi;
-#line 3351
+#line 3355
 		}
-#line 3351
+#line 3355
 
-#line 3351
+#line 3355
 		vsp->sign = isp->sign;
-#line 3351
+#line 3355
 
 
 		ip++;
@@ -25502,1294 +25506,1294 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
 
 #endif
 int
-#line 3377
+#line 3381
 ncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3377
+#line 3381
 {
-#line 3377
+#line 3381
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3377
+#line 3381
 
-#line 3377
+#line 3381
  /* basic algorithm is:
-#line 3377
+#line 3381
   *   - ensure sane alignment of input data
-#line 3377
+#line 3381
   *   - copy (conversion happens automatically) input data
-#line 3377
+#line 3381
   *     to output
-#line 3377
+#line 3381
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3377
+#line 3381
   *     at next location for converted output
-#line 3377
+#line 3381
   */
-#line 3377
+#line 3381
   long i, j, ni;
-#line 3377
+#line 3381
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3377
+#line 3381
   float *xp;
-#line 3377
+#line 3381
   int nrange = 0;         /* number of range errors */
-#line 3377
+#line 3381
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3377
+#line 3381
   long cxp = (long) *((char**)xpp);
-#line 3377
+#line 3381
 
-#line 3377
+#line 3381
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3377
+#line 3381
   /* sjl: manually stripmine so we can limit amount of
-#line 3377
+#line 3381
    * vector work space reserved to LOOPCNT elements. Also
-#line 3377
+#line 3381
    * makes vectorisation easy */
-#line 3377
+#line 3381
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3377
+#line 3381
     ni=Min(nelems-j,LOOPCNT);
-#line 3377
+#line 3381
     if (realign) {
-#line 3377
+#line 3381
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3377
+#line 3381
       xp = tmp;
-#line 3377
+#line 3381
     } else {
-#line 3377
+#line 3381
       xp = (float *) *xpp;
-#line 3377
+#line 3381
     }
-#line 3377
+#line 3381
    /* copy the next block */
-#line 3377
+#line 3381
 #pragma cdir loopcnt=LOOPCNT
-#line 3377
+#line 3381
 #pragma cdir shortloop
-#line 3377
+#line 3381
     for (i=0; i<ni; i++) {
-#line 3377
+#line 3381
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3377
+#line 3381
      /* test for range errors (not always needed but do it anyway) */
-#line 3377
+#line 3381
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3377
+#line 3381
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3377
+#line 3381
       nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
-#line 3377
+#line 3381
     }
-#line 3377
+#line 3381
    /* update xpp and tp */
-#line 3377
+#line 3381
     if (realign) xp = (float *) *xpp;
-#line 3377
+#line 3381
     xp += ni;
-#line 3377
+#line 3381
     tp += ni;
-#line 3377
+#line 3381
     *xpp = (void*)xp;
-#line 3377
+#line 3381
   }
-#line 3377
+#line 3381
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3377
+#line 3381
 
-#line 3377
+#line 3381
 #else   /* not SX */
-#line 3377
+#line 3381
 	const char *xp = (const char *) *xpp;
-#line 3377
+#line 3381
 	int status = NC_NOERR;
-#line 3377
+#line 3381
 
-#line 3377
+#line 3381
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3377
+#line 3381
 	{
-#line 3377
+#line 3381
 		const int lstatus = ncx_get_float_schar(xp, tp);
-#line 3377
+#line 3381
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3377
+#line 3381
 			status = lstatus;
-#line 3377
+#line 3381
 	}
-#line 3377
+#line 3381
 
-#line 3377
+#line 3381
 	*xpp = (const void *)xp;
-#line 3377
+#line 3381
 	return status;
-#line 3377
+#line 3381
 #endif
-#line 3377
+#line 3381
 }
-#line 3377
+#line 3381
 
 int
-#line 3378
+#line 3382
 ncx_getn_float_short(const void **xpp, size_t nelems, short *tp)
-#line 3378
+#line 3382
 {
-#line 3378
+#line 3382
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3378
+#line 3382
 
-#line 3378
+#line 3382
  /* basic algorithm is:
-#line 3378
+#line 3382
   *   - ensure sane alignment of input data
-#line 3378
+#line 3382
   *   - copy (conversion happens automatically) input data
-#line 3378
+#line 3382
   *     to output
-#line 3378
+#line 3382
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3378
+#line 3382
   *     at next location for converted output
-#line 3378
+#line 3382
   */
-#line 3378
+#line 3382
   long i, j, ni;
-#line 3378
+#line 3382
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3378
+#line 3382
   float *xp;
-#line 3378
+#line 3382
   int nrange = 0;         /* number of range errors */
-#line 3378
+#line 3382
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3378
+#line 3382
   long cxp = (long) *((char**)xpp);
-#line 3378
+#line 3382
 
-#line 3378
+#line 3382
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3378
+#line 3382
   /* sjl: manually stripmine so we can limit amount of
-#line 3378
+#line 3382
    * vector work space reserved to LOOPCNT elements. Also
-#line 3378
+#line 3382
    * makes vectorisation easy */
-#line 3378
+#line 3382
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3378
+#line 3382
     ni=Min(nelems-j,LOOPCNT);
-#line 3378
+#line 3382
     if (realign) {
-#line 3378
+#line 3382
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3378
+#line 3382
       xp = tmp;
-#line 3378
+#line 3382
     } else {
-#line 3378
+#line 3382
       xp = (float *) *xpp;
-#line 3378
+#line 3382
     }
-#line 3378
+#line 3382
    /* copy the next block */
-#line 3378
+#line 3382
 #pragma cdir loopcnt=LOOPCNT
-#line 3378
+#line 3382
 #pragma cdir shortloop
-#line 3378
+#line 3382
     for (i=0; i<ni; i++) {
-#line 3378
+#line 3382
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3378
+#line 3382
      /* test for range errors (not always needed but do it anyway) */
-#line 3378
+#line 3382
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3378
+#line 3382
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3378
+#line 3382
       nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
-#line 3378
+#line 3382
     }
-#line 3378
+#line 3382
    /* update xpp and tp */
-#line 3378
+#line 3382
     if (realign) xp = (float *) *xpp;
-#line 3378
+#line 3382
     xp += ni;
-#line 3378
+#line 3382
     tp += ni;
-#line 3378
+#line 3382
     *xpp = (void*)xp;
-#line 3378
+#line 3382
   }
-#line 3378
+#line 3382
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3378
+#line 3382
 
-#line 3378
+#line 3382
 #else   /* not SX */
-#line 3378
+#line 3382
 	const char *xp = (const char *) *xpp;
-#line 3378
+#line 3382
 	int status = NC_NOERR;
-#line 3378
+#line 3382
 
-#line 3378
+#line 3382
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3378
+#line 3382
 	{
-#line 3378
+#line 3382
 		const int lstatus = ncx_get_float_short(xp, tp);
-#line 3378
+#line 3382
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3378
+#line 3382
 			status = lstatus;
-#line 3378
+#line 3382
 	}
-#line 3378
+#line 3382
 
-#line 3378
+#line 3382
 	*xpp = (const void *)xp;
-#line 3378
+#line 3382
 	return status;
-#line 3378
+#line 3382
 #endif
-#line 3378
+#line 3382
 }
-#line 3378
+#line 3382
 
 int
-#line 3379
+#line 3383
 ncx_getn_float_int(const void **xpp, size_t nelems, int *tp)
-#line 3379
+#line 3383
 {
-#line 3379
+#line 3383
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3379
+#line 3383
 
-#line 3379
+#line 3383
  /* basic algorithm is:
-#line 3379
+#line 3383
   *   - ensure sane alignment of input data
-#line 3379
+#line 3383
   *   - copy (conversion happens automatically) input data
-#line 3379
+#line 3383
   *     to output
-#line 3379
+#line 3383
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3379
+#line 3383
   *     at next location for converted output
-#line 3379
+#line 3383
   */
-#line 3379
+#line 3383
   long i, j, ni;
-#line 3379
+#line 3383
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3379
+#line 3383
   float *xp;
-#line 3379
+#line 3383
   int nrange = 0;         /* number of range errors */
-#line 3379
+#line 3383
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3379
+#line 3383
   long cxp = (long) *((char**)xpp);
-#line 3379
+#line 3383
 
-#line 3379
+#line 3383
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3379
+#line 3383
   /* sjl: manually stripmine so we can limit amount of
-#line 3379
+#line 3383
    * vector work space reserved to LOOPCNT elements. Also
-#line 3379
+#line 3383
    * makes vectorisation easy */
-#line 3379
+#line 3383
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3379
+#line 3383
     ni=Min(nelems-j,LOOPCNT);
-#line 3379
+#line 3383
     if (realign) {
-#line 3379
+#line 3383
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3379
+#line 3383
       xp = tmp;
-#line 3379
+#line 3383
     } else {
-#line 3379
+#line 3383
       xp = (float *) *xpp;
-#line 3379
+#line 3383
     }
-#line 3379
+#line 3383
    /* copy the next block */
-#line 3379
+#line 3383
 #pragma cdir loopcnt=LOOPCNT
-#line 3379
+#line 3383
 #pragma cdir shortloop
-#line 3379
+#line 3383
     for (i=0; i<ni; i++) {
-#line 3379
+#line 3383
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3379
+#line 3383
      /* test for range errors (not always needed but do it anyway) */
-#line 3379
+#line 3383
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3379
+#line 3383
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3379
+#line 3383
       nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
-#line 3379
+#line 3383
     }
-#line 3379
+#line 3383
    /* update xpp and tp */
-#line 3379
+#line 3383
     if (realign) xp = (float *) *xpp;
-#line 3379
+#line 3383
     xp += ni;
-#line 3379
+#line 3383
     tp += ni;
-#line 3379
+#line 3383
     *xpp = (void*)xp;
-#line 3379
+#line 3383
   }
-#line 3379
+#line 3383
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3379
+#line 3383
 
-#line 3379
+#line 3383
 #else   /* not SX */
-#line 3379
+#line 3383
 	const char *xp = (const char *) *xpp;
-#line 3379
+#line 3383
 	int status = NC_NOERR;
-#line 3379
+#line 3383
 
-#line 3379
+#line 3383
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3379
+#line 3383
 	{
-#line 3379
+#line 3383
 		const int lstatus = ncx_get_float_int(xp, tp);
-#line 3379
+#line 3383
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3379
+#line 3383
 			status = lstatus;
-#line 3379
+#line 3383
 	}
-#line 3379
+#line 3383
 
-#line 3379
+#line 3383
 	*xpp = (const void *)xp;
-#line 3379
+#line 3383
 	return status;
-#line 3379
+#line 3383
 #endif
-#line 3379
+#line 3383
 }
-#line 3379
+#line 3383
 
 int
-#line 3380
+#line 3384
 ncx_getn_float_long(const void **xpp, size_t nelems, long *tp)
-#line 3380
+#line 3384
 {
-#line 3380
+#line 3384
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3380
+#line 3384
 
-#line 3380
+#line 3384
  /* basic algorithm is:
-#line 3380
+#line 3384
   *   - ensure sane alignment of input data
-#line 3380
+#line 3384
   *   - copy (conversion happens automatically) input data
-#line 3380
+#line 3384
   *     to output
-#line 3380
+#line 3384
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3380
+#line 3384
   *     at next location for converted output
-#line 3380
+#line 3384
   */
-#line 3380
+#line 3384
   long i, j, ni;
-#line 3380
+#line 3384
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3380
+#line 3384
   float *xp;
-#line 3380
+#line 3384
   int nrange = 0;         /* number of range errors */
-#line 3380
+#line 3384
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3380
+#line 3384
   long cxp = (long) *((char**)xpp);
-#line 3380
+#line 3384
 
-#line 3380
+#line 3384
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3380
+#line 3384
   /* sjl: manually stripmine so we can limit amount of
-#line 3380
+#line 3384
    * vector work space reserved to LOOPCNT elements. Also
-#line 3380
+#line 3384
    * makes vectorisation easy */
-#line 3380
+#line 3384
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3380
+#line 3384
     ni=Min(nelems-j,LOOPCNT);
-#line 3380
+#line 3384
     if (realign) {
-#line 3380
+#line 3384
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3380
+#line 3384
       xp = tmp;
-#line 3380
+#line 3384
     } else {
-#line 3380
+#line 3384
       xp = (float *) *xpp;
-#line 3380
+#line 3384
     }
-#line 3380
+#line 3384
    /* copy the next block */
-#line 3380
+#line 3384
 #pragma cdir loopcnt=LOOPCNT
-#line 3380
+#line 3384
 #pragma cdir shortloop
-#line 3380
+#line 3384
     for (i=0; i<ni; i++) {
-#line 3380
+#line 3384
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3380
+#line 3384
      /* test for range errors (not always needed but do it anyway) */
-#line 3380
+#line 3384
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3380
+#line 3384
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3380
+#line 3384
       nrange += xp[i] > LONG_MAX || xp[i] < LONG_MIN;
-#line 3380
+#line 3384
     }
-#line 3380
+#line 3384
    /* update xpp and tp */
-#line 3380
+#line 3384
     if (realign) xp = (float *) *xpp;
-#line 3380
+#line 3384
     xp += ni;
-#line 3380
+#line 3384
     tp += ni;
-#line 3380
+#line 3384
     *xpp = (void*)xp;
-#line 3380
+#line 3384
   }
-#line 3380
+#line 3384
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3380
+#line 3384
 
-#line 3380
+#line 3384
 #else   /* not SX */
-#line 3380
+#line 3384
 	const char *xp = (const char *) *xpp;
-#line 3380
+#line 3384
 	int status = NC_NOERR;
-#line 3380
+#line 3384
 
-#line 3380
+#line 3384
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3380
+#line 3384
 	{
-#line 3380
+#line 3384
 		const int lstatus = ncx_get_float_long(xp, tp);
-#line 3380
+#line 3384
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3380
+#line 3384
 			status = lstatus;
-#line 3380
+#line 3384
 	}
-#line 3380
+#line 3384
 
-#line 3380
+#line 3384
 	*xpp = (const void *)xp;
-#line 3380
+#line 3384
 	return status;
-#line 3380
+#line 3384
 #endif
-#line 3380
+#line 3384
 }
-#line 3380
+#line 3384
 
 int
-#line 3381
+#line 3385
 ncx_getn_float_double(const void **xpp, size_t nelems, double *tp)
-#line 3381
+#line 3385
 {
-#line 3381
+#line 3385
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3381
+#line 3385
 
-#line 3381
+#line 3385
  /* basic algorithm is:
-#line 3381
+#line 3385
   *   - ensure sane alignment of input data
-#line 3381
+#line 3385
   *   - copy (conversion happens automatically) input data
-#line 3381
+#line 3385
   *     to output
-#line 3381
+#line 3385
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3381
+#line 3385
   *     at next location for converted output
-#line 3381
+#line 3385
   */
-#line 3381
+#line 3385
   long i, j, ni;
-#line 3381
+#line 3385
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3381
+#line 3385
   float *xp;
-#line 3381
+#line 3385
   int nrange = 0;         /* number of range errors */
-#line 3381
+#line 3385
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3381
+#line 3385
   long cxp = (long) *((char**)xpp);
-#line 3381
+#line 3385
 
-#line 3381
+#line 3385
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3381
+#line 3385
   /* sjl: manually stripmine so we can limit amount of
-#line 3381
+#line 3385
    * vector work space reserved to LOOPCNT elements. Also
-#line 3381
+#line 3385
    * makes vectorisation easy */
-#line 3381
+#line 3385
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3381
+#line 3385
     ni=Min(nelems-j,LOOPCNT);
-#line 3381
+#line 3385
     if (realign) {
-#line 3381
+#line 3385
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3381
+#line 3385
       xp = tmp;
-#line 3381
+#line 3385
     } else {
-#line 3381
+#line 3385
       xp = (float *) *xpp;
-#line 3381
+#line 3385
     }
-#line 3381
+#line 3385
    /* copy the next block */
-#line 3381
+#line 3385
 #pragma cdir loopcnt=LOOPCNT
-#line 3381
+#line 3385
 #pragma cdir shortloop
-#line 3381
+#line 3385
     for (i=0; i<ni; i++) {
-#line 3381
+#line 3385
       tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
-#line 3381
+#line 3385
      /* test for range errors (not always needed but do it anyway) */
-#line 3381
+#line 3385
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3381
+#line 3385
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3381
+#line 3385
       nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
-#line 3381
+#line 3385
     }
-#line 3381
+#line 3385
    /* update xpp and tp */
-#line 3381
+#line 3385
     if (realign) xp = (float *) *xpp;
-#line 3381
+#line 3385
     xp += ni;
-#line 3381
+#line 3385
     tp += ni;
-#line 3381
+#line 3385
     *xpp = (void*)xp;
-#line 3381
+#line 3385
   }
-#line 3381
+#line 3385
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3381
+#line 3385
 
-#line 3381
+#line 3385
 #else   /* not SX */
-#line 3381
+#line 3385
 	const char *xp = (const char *) *xpp;
-#line 3381
+#line 3385
 	int status = NC_NOERR;
-#line 3381
+#line 3385
 
-#line 3381
+#line 3385
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3381
+#line 3385
 	{
-#line 3381
+#line 3385
 		const int lstatus = ncx_get_float_double(xp, tp);
-#line 3381
+#line 3385
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3381
+#line 3385
 			status = lstatus;
-#line 3381
+#line 3385
 	}
-#line 3381
+#line 3385
 
-#line 3381
+#line 3385
 	*xpp = (const void *)xp;
-#line 3381
+#line 3385
 	return status;
-#line 3381
+#line 3385
 #endif
-#line 3381
+#line 3385
 }
-#line 3381
+#line 3385
 
 int
-#line 3382
+#line 3386
 ncx_getn_float_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3382
+#line 3386
 {
-#line 3382
+#line 3386
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3382
+#line 3386
 
-#line 3382
+#line 3386
  /* basic algorithm is:
-#line 3382
+#line 3386
   *   - ensure sane alignment of input data
-#line 3382
+#line 3386
   *   - copy (conversion happens automatically) input data
-#line 3382
+#line 3386
   *     to output
-#line 3382
+#line 3386
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3382
+#line 3386
   *     at next location for converted output
-#line 3382
+#line 3386
   */
-#line 3382
+#line 3386
   long i, j, ni;
-#line 3382
+#line 3386
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3382
+#line 3386
   float *xp;
-#line 3382
+#line 3386
   int nrange = 0;         /* number of range errors */
-#line 3382
+#line 3386
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3382
+#line 3386
   long cxp = (long) *((char**)xpp);
-#line 3382
+#line 3386
 
-#line 3382
+#line 3386
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3382
+#line 3386
   /* sjl: manually stripmine so we can limit amount of
-#line 3382
+#line 3386
    * vector work space reserved to LOOPCNT elements. Also
-#line 3382
+#line 3386
    * makes vectorisation easy */
-#line 3382
+#line 3386
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3382
+#line 3386
     ni=Min(nelems-j,LOOPCNT);
-#line 3382
+#line 3386
     if (realign) {
-#line 3382
+#line 3386
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3382
+#line 3386
       xp = tmp;
-#line 3382
+#line 3386
     } else {
-#line 3382
+#line 3386
       xp = (float *) *xpp;
-#line 3382
+#line 3386
     }
-#line 3382
+#line 3386
    /* copy the next block */
-#line 3382
+#line 3386
 #pragma cdir loopcnt=LOOPCNT
-#line 3382
+#line 3386
 #pragma cdir shortloop
-#line 3382
+#line 3386
     for (i=0; i<ni; i++) {
-#line 3382
+#line 3386
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3382
+#line 3386
      /* test for range errors (not always needed but do it anyway) */
-#line 3382
+#line 3386
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3382
+#line 3386
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3382
+#line 3386
       nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
-#line 3382
+#line 3386
     }
-#line 3382
+#line 3386
    /* update xpp and tp */
-#line 3382
+#line 3386
     if (realign) xp = (float *) *xpp;
-#line 3382
+#line 3386
     xp += ni;
-#line 3382
+#line 3386
     tp += ni;
-#line 3382
+#line 3386
     *xpp = (void*)xp;
-#line 3382
+#line 3386
   }
-#line 3382
+#line 3386
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3382
+#line 3386
 
-#line 3382
+#line 3386
 #else   /* not SX */
-#line 3382
+#line 3386
 	const char *xp = (const char *) *xpp;
-#line 3382
+#line 3386
 	int status = NC_NOERR;
-#line 3382
+#line 3386
 
-#line 3382
+#line 3386
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3382
+#line 3386
 	{
-#line 3382
+#line 3386
 		const int lstatus = ncx_get_float_longlong(xp, tp);
-#line 3382
+#line 3386
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3382
+#line 3386
 			status = lstatus;
-#line 3382
+#line 3386
 	}
-#line 3382
+#line 3386
 
-#line 3382
+#line 3386
 	*xpp = (const void *)xp;
-#line 3382
+#line 3386
 	return status;
-#line 3382
+#line 3386
 #endif
-#line 3382
+#line 3386
 }
-#line 3382
+#line 3386
 
 int
-#line 3383
+#line 3387
 ncx_getn_float_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3383
+#line 3387
 {
-#line 3383
+#line 3387
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3383
+#line 3387
 
-#line 3383
+#line 3387
  /* basic algorithm is:
-#line 3383
+#line 3387
   *   - ensure sane alignment of input data
-#line 3383
+#line 3387
   *   - copy (conversion happens automatically) input data
-#line 3383
+#line 3387
   *     to output
-#line 3383
+#line 3387
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3383
+#line 3387
   *     at next location for converted output
-#line 3383
+#line 3387
   */
-#line 3383
+#line 3387
   long i, j, ni;
-#line 3383
+#line 3387
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3383
+#line 3387
   float *xp;
-#line 3383
+#line 3387
   int nrange = 0;         /* number of range errors */
-#line 3383
+#line 3387
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3383
+#line 3387
   long cxp = (long) *((char**)xpp);
-#line 3383
+#line 3387
 
-#line 3383
+#line 3387
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3383
+#line 3387
   /* sjl: manually stripmine so we can limit amount of
-#line 3383
+#line 3387
    * vector work space reserved to LOOPCNT elements. Also
-#line 3383
+#line 3387
    * makes vectorisation easy */
-#line 3383
+#line 3387
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3383
+#line 3387
     ni=Min(nelems-j,LOOPCNT);
-#line 3383
+#line 3387
     if (realign) {
-#line 3383
+#line 3387
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3383
+#line 3387
       xp = tmp;
-#line 3383
+#line 3387
     } else {
-#line 3383
+#line 3387
       xp = (float *) *xpp;
-#line 3383
+#line 3387
     }
-#line 3383
+#line 3387
    /* copy the next block */
-#line 3383
+#line 3387
 #pragma cdir loopcnt=LOOPCNT
-#line 3383
+#line 3387
 #pragma cdir shortloop
-#line 3383
+#line 3387
     for (i=0; i<ni; i++) {
-#line 3383
+#line 3387
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3383
+#line 3387
      /* test for range errors (not always needed but do it anyway) */
-#line 3383
+#line 3387
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3383
+#line 3387
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3383
+#line 3387
       nrange += xp[i] > USHORT_MAX || xp[i] < 0;
-#line 3383
+#line 3387
     }
-#line 3383
+#line 3387
    /* update xpp and tp */
-#line 3383
+#line 3387
     if (realign) xp = (float *) *xpp;
-#line 3383
+#line 3387
     xp += ni;
-#line 3383
+#line 3387
     tp += ni;
-#line 3383
+#line 3387
     *xpp = (void*)xp;
-#line 3383
+#line 3387
   }
-#line 3383
+#line 3387
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3383
+#line 3387
 
-#line 3383
+#line 3387
 #else   /* not SX */
-#line 3383
+#line 3387
 	const char *xp = (const char *) *xpp;
-#line 3383
+#line 3387
 	int status = NC_NOERR;
-#line 3383
+#line 3387
 
-#line 3383
+#line 3387
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3383
+#line 3387
 	{
-#line 3383
+#line 3387
 		const int lstatus = ncx_get_float_ushort(xp, tp);
-#line 3383
+#line 3387
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3383
+#line 3387
 			status = lstatus;
-#line 3383
+#line 3387
 	}
-#line 3383
+#line 3387
 
-#line 3383
+#line 3387
 	*xpp = (const void *)xp;
-#line 3383
+#line 3387
 	return status;
-#line 3383
+#line 3387
 #endif
-#line 3383
+#line 3387
 }
-#line 3383
+#line 3387
 
 int
-#line 3384
+#line 3388
 ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3384
+#line 3388
 {
-#line 3384
+#line 3388
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3384
+#line 3388
 
-#line 3384
+#line 3388
  /* basic algorithm is:
-#line 3384
+#line 3388
   *   - ensure sane alignment of input data
-#line 3384
+#line 3388
   *   - copy (conversion happens automatically) input data
-#line 3384
+#line 3388
   *     to output
-#line 3384
+#line 3388
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3384
+#line 3388
   *     at next location for converted output
-#line 3384
+#line 3388
   */
-#line 3384
+#line 3388
   long i, j, ni;
-#line 3384
+#line 3388
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3384
+#line 3388
   float *xp;
-#line 3384
+#line 3388
   int nrange = 0;         /* number of range errors */
-#line 3384
+#line 3388
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3384
+#line 3388
   long cxp = (long) *((char**)xpp);
-#line 3384
+#line 3388
 
-#line 3384
+#line 3388
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3384
+#line 3388
   /* sjl: manually stripmine so we can limit amount of
-#line 3384
+#line 3388
    * vector work space reserved to LOOPCNT elements. Also
-#line 3384
+#line 3388
    * makes vectorisation easy */
-#line 3384
+#line 3388
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3384
+#line 3388
     ni=Min(nelems-j,LOOPCNT);
-#line 3384
+#line 3388
     if (realign) {
-#line 3384
+#line 3388
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3384
+#line 3388
       xp = tmp;
-#line 3384
+#line 3388
     } else {
-#line 3384
+#line 3388
       xp = (float *) *xpp;
-#line 3384
+#line 3388
     }
-#line 3384
+#line 3388
    /* copy the next block */
-#line 3384
+#line 3388
 #pragma cdir loopcnt=LOOPCNT
-#line 3384
+#line 3388
 #pragma cdir shortloop
-#line 3384
+#line 3388
     for (i=0; i<ni; i++) {
-#line 3384
+#line 3388
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3384
+#line 3388
      /* test for range errors (not always needed but do it anyway) */
-#line 3384
+#line 3388
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3384
+#line 3388
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3384
+#line 3388
       nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
-#line 3384
+#line 3388
     }
-#line 3384
+#line 3388
    /* update xpp and tp */
-#line 3384
+#line 3388
     if (realign) xp = (float *) *xpp;
-#line 3384
+#line 3388
     xp += ni;
-#line 3384
+#line 3388
     tp += ni;
-#line 3384
+#line 3388
     *xpp = (void*)xp;
-#line 3384
+#line 3388
   }
-#line 3384
+#line 3388
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3384
+#line 3388
 
-#line 3384
+#line 3388
 #else   /* not SX */
-#line 3384
+#line 3388
 	const char *xp = (const char *) *xpp;
-#line 3384
+#line 3388
 	int status = NC_NOERR;
-#line 3384
+#line 3388
 
-#line 3384
+#line 3388
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3384
+#line 3388
 	{
-#line 3384
+#line 3388
 		const int lstatus = ncx_get_float_uchar(xp, tp);
-#line 3384
+#line 3388
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3384
+#line 3388
 			status = lstatus;
-#line 3384
+#line 3388
 	}
-#line 3384
+#line 3388
 
-#line 3384
+#line 3388
 	*xpp = (const void *)xp;
-#line 3384
+#line 3388
 	return status;
-#line 3384
+#line 3388
 #endif
-#line 3384
+#line 3388
 }
-#line 3384
+#line 3388
 
 int
-#line 3385
+#line 3389
 ncx_getn_float_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3385
+#line 3389
 {
-#line 3385
+#line 3389
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3385
+#line 3389
 
-#line 3385
+#line 3389
  /* basic algorithm is:
-#line 3385
+#line 3389
   *   - ensure sane alignment of input data
-#line 3385
+#line 3389
   *   - copy (conversion happens automatically) input data
-#line 3385
+#line 3389
   *     to output
-#line 3385
+#line 3389
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3385
+#line 3389
   *     at next location for converted output
-#line 3385
+#line 3389
   */
-#line 3385
+#line 3389
   long i, j, ni;
-#line 3385
+#line 3389
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3385
+#line 3389
   float *xp;
-#line 3385
+#line 3389
   int nrange = 0;         /* number of range errors */
-#line 3385
+#line 3389
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3385
+#line 3389
   long cxp = (long) *((char**)xpp);
-#line 3385
+#line 3389
 
-#line 3385
+#line 3389
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3385
+#line 3389
   /* sjl: manually stripmine so we can limit amount of
-#line 3385
+#line 3389
    * vector work space reserved to LOOPCNT elements. Also
-#line 3385
+#line 3389
    * makes vectorisation easy */
-#line 3385
+#line 3389
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3385
+#line 3389
     ni=Min(nelems-j,LOOPCNT);
-#line 3385
+#line 3389
     if (realign) {
-#line 3385
+#line 3389
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3385
+#line 3389
       xp = tmp;
-#line 3385
+#line 3389
     } else {
-#line 3385
+#line 3389
       xp = (float *) *xpp;
-#line 3385
+#line 3389
     }
-#line 3385
+#line 3389
    /* copy the next block */
-#line 3385
+#line 3389
 #pragma cdir loopcnt=LOOPCNT
-#line 3385
+#line 3389
 #pragma cdir shortloop
-#line 3385
+#line 3389
     for (i=0; i<ni; i++) {
-#line 3385
+#line 3389
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3385
+#line 3389
      /* test for range errors (not always needed but do it anyway) */
-#line 3385
+#line 3389
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3385
+#line 3389
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3385
+#line 3389
       nrange += xp[i] > UINT_MAX || xp[i] < 0;
-#line 3385
+#line 3389
     }
-#line 3385
+#line 3389
    /* update xpp and tp */
-#line 3385
+#line 3389
     if (realign) xp = (float *) *xpp;
-#line 3385
+#line 3389
     xp += ni;
-#line 3385
+#line 3389
     tp += ni;
-#line 3385
+#line 3389
     *xpp = (void*)xp;
-#line 3385
+#line 3389
   }
-#line 3385
+#line 3389
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3385
+#line 3389
 
-#line 3385
+#line 3389
 #else   /* not SX */
-#line 3385
+#line 3389
 	const char *xp = (const char *) *xpp;
-#line 3385
+#line 3389
 	int status = NC_NOERR;
-#line 3385
+#line 3389
 
-#line 3385
+#line 3389
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3385
+#line 3389
 	{
-#line 3385
+#line 3389
 		const int lstatus = ncx_get_float_uint(xp, tp);
-#line 3385
+#line 3389
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3385
+#line 3389
 			status = lstatus;
-#line 3385
+#line 3389
 	}
-#line 3385
+#line 3389
 
-#line 3385
+#line 3389
 	*xpp = (const void *)xp;
-#line 3385
+#line 3389
 	return status;
-#line 3385
+#line 3389
 #endif
-#line 3385
+#line 3389
 }
-#line 3385
+#line 3389
 
 int
-#line 3386
+#line 3390
 ncx_getn_float_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3386
+#line 3390
 {
-#line 3386
+#line 3390
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3386
+#line 3390
 
-#line 3386
+#line 3390
  /* basic algorithm is:
-#line 3386
+#line 3390
   *   - ensure sane alignment of input data
-#line 3386
+#line 3390
   *   - copy (conversion happens automatically) input data
-#line 3386
+#line 3390
   *     to output
-#line 3386
+#line 3390
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3386
+#line 3390
   *     at next location for converted output
-#line 3386
+#line 3390
   */
-#line 3386
+#line 3390
   long i, j, ni;
-#line 3386
+#line 3390
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3386
+#line 3390
   float *xp;
-#line 3386
+#line 3390
   int nrange = 0;         /* number of range errors */
-#line 3386
+#line 3390
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3386
+#line 3390
   long cxp = (long) *((char**)xpp);
-#line 3386
+#line 3390
 
-#line 3386
+#line 3390
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3386
+#line 3390
   /* sjl: manually stripmine so we can limit amount of
-#line 3386
+#line 3390
    * vector work space reserved to LOOPCNT elements. Also
-#line 3386
+#line 3390
    * makes vectorisation easy */
-#line 3386
+#line 3390
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3386
+#line 3390
     ni=Min(nelems-j,LOOPCNT);
-#line 3386
+#line 3390
     if (realign) {
-#line 3386
+#line 3390
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_FLOAT));
-#line 3386
+#line 3390
       xp = tmp;
-#line 3386
+#line 3390
     } else {
-#line 3386
+#line 3390
       xp = (float *) *xpp;
-#line 3386
+#line 3390
     }
-#line 3386
+#line 3390
    /* copy the next block */
-#line 3386
+#line 3390
 #pragma cdir loopcnt=LOOPCNT
-#line 3386
+#line 3390
 #pragma cdir shortloop
-#line 3386
+#line 3390
     for (i=0; i<ni; i++) {
-#line 3386
+#line 3390
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3386
+#line 3390
      /* test for range errors (not always needed but do it anyway) */
-#line 3386
+#line 3390
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3386
+#line 3390
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3386
+#line 3390
       nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
-#line 3386
+#line 3390
     }
-#line 3386
+#line 3390
    /* update xpp and tp */
-#line 3386
+#line 3390
     if (realign) xp = (float *) *xpp;
-#line 3386
+#line 3390
     xp += ni;
-#line 3386
+#line 3390
     tp += ni;
-#line 3386
+#line 3390
     *xpp = (void*)xp;
-#line 3386
+#line 3390
   }
-#line 3386
+#line 3390
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3386
+#line 3390
 
-#line 3386
+#line 3390
 #else   /* not SX */
-#line 3386
+#line 3390
 	const char *xp = (const char *) *xpp;
-#line 3386
+#line 3390
 	int status = NC_NOERR;
-#line 3386
+#line 3390
 
-#line 3386
+#line 3390
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3386
+#line 3390
 	{
-#line 3386
+#line 3390
 		const int lstatus = ncx_get_float_ulonglong(xp, tp);
-#line 3386
+#line 3390
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3386
+#line 3390
 			status = lstatus;
-#line 3386
+#line 3390
 	}
-#line 3386
+#line 3390
 
-#line 3386
+#line 3390
 	*xpp = (const void *)xp;
-#line 3386
+#line 3390
 	return status;
-#line 3386
+#line 3390
 #endif
-#line 3386
+#line 3390
 }
-#line 3386
+#line 3390
 
 
 int
@@ -26811,93 +26815,93 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 
 	while (tp < end) {
 				const struct vax_single *const vsp =
-#line 3406
+#line 3410
 			 (const struct vax_single *)ip;
-#line 3406
+#line 3410
 		struct ieee_single *const isp = (struct ieee_single *) (*xpp);
-#line 3406
+#line 3410
 
-#line 3406
+#line 3410
 		switch(vsp->exp){
-#line 3406
+#line 3410
 		case 0 :
-#line 3406
+#line 3410
 			/* all vax float with zero exponent map to zero */
-#line 3406
+#line 3410
 			*isp = min.ieee;
-#line 3406
+#line 3410
 			break;
-#line 3406
+#line 3410
 		case 2 :
-#line 3406
+#line 3410
 		case 1 :
-#line 3406
+#line 3410
 		{
-#line 3406
+#line 3410
 			/* These will map to subnormals */
-#line 3406
+#line 3410
 			unsigned mantissa = (vsp->mantissa1 << 16)
-#line 3406
+#line 3410
 					 | vsp->mantissa2;
-#line 3406
+#line 3410
 			mantissa >>= 3 - vsp->exp;
-#line 3406
+#line 3410
 			mantissa += (1 << (20 + vsp->exp));
-#line 3406
+#line 3410
 			isp->mant_lo_lo = mantissa;
-#line 3406
+#line 3410
 			isp->mant_lo_hi = mantissa >> 8;
-#line 3406
+#line 3410
 			isp->mant_hi = mantissa >> 16;
-#line 3406
+#line 3410
 			isp->exp_lo = 0;
-#line 3406
+#line 3410
 			isp->exp_hi = 0;
-#line 3406
+#line 3410
 		}
-#line 3406
+#line 3410
 			break;
-#line 3406
+#line 3410
 		case 0xff : /* max.s.exp */
-#line 3406
+#line 3410
 			if (vsp->mantissa2 == max.s.mantissa2 &&
-#line 3406
+#line 3410
 			    vsp->mantissa1 == max.s.mantissa1)
-#line 3406
+#line 3410
 			{
-#line 3406
+#line 3410
 				/* map largest vax float to ieee infinity */
-#line 3406
+#line 3410
 				*isp = max.ieee;
-#line 3406
+#line 3410
 				break;
-#line 3406
+#line 3410
 			} /* else, fall thru */
-#line 3406
+#line 3410
 		default :
-#line 3406
+#line 3410
 		{
-#line 3406
+#line 3410
 			unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
-#line 3406
+#line 3410
 			isp->exp_hi = exp >> 1;
-#line 3406
+#line 3410
 			isp->exp_lo = exp;
-#line 3406
+#line 3410
 			isp->mant_lo_lo = vsp->mantissa2;
-#line 3406
+#line 3410
 			isp->mant_lo_hi = vsp->mantissa2 >> 8;
-#line 3406
+#line 3410
 			isp->mant_hi = vsp->mantissa1;
-#line 3406
+#line 3410
 		}
-#line 3406
+#line 3410
 		}
-#line 3406
+#line 3410
 
-#line 3406
+#line 3410
 		isp->sign = vsp->sign;
-#line 3406
+#line 3410
 
 		tp++;
 		*xpp = (char *)(*xpp) + X_SIZEOF_FLOAT;
@@ -26920,1394 +26924,1394 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp, void *fillp)
 }
 #endif
 int
-#line 3427
+#line 3431
 ncx_putn_float_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3427
+#line 3431
 {
-#line 3427
+#line 3431
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3427
+#line 3431
 
-#line 3427
+#line 3431
  /* basic algorithm is:
-#line 3427
+#line 3431
   *   - ensure sane alignment of output data
-#line 3427
+#line 3431
   *   - copy (conversion happens automatically) input data
-#line 3427
+#line 3431
   *     to output
-#line 3427
+#line 3431
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3427
+#line 3431
   *     at next location for converted output
-#line 3427
+#line 3431
   */
-#line 3427
+#line 3431
   long i, j, ni;
-#line 3427
+#line 3431
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3427
+#line 3431
   float *xp;
-#line 3427
+#line 3431
   int nrange = 0;         /* number of range errors */
-#line 3427
+#line 3431
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3427
+#line 3431
   long cxp = (long) *((char**)xpp);
-#line 3427
+#line 3431
 
-#line 3427
+#line 3431
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3427
+#line 3431
   /* sjl: manually stripmine so we can limit amount of
-#line 3427
+#line 3431
    * vector work space reserved to LOOPCNT elements. Also
-#line 3427
+#line 3431
    * makes vectorisation easy */
-#line 3427
+#line 3431
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3427
+#line 3431
     ni=Min(nelems-j,LOOPCNT);
-#line 3427
+#line 3431
     if (realign) {
-#line 3427
+#line 3431
       xp = tmp;
-#line 3427
+#line 3431
     } else {
-#line 3427
+#line 3431
       xp = (float *) *xpp;
-#line 3427
+#line 3431
     }
-#line 3427
+#line 3431
    /* copy the next block */
-#line 3427
+#line 3431
 #pragma cdir loopcnt=LOOPCNT
-#line 3427
+#line 3431
 #pragma cdir shortloop
-#line 3427
+#line 3431
     for (i=0; i<ni; i++) {
-#line 3427
+#line 3431
       /* the normal case: */
-#line 3427
+#line 3431
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3427
+#line 3431
      /* test for range errors (not always needed but do it anyway) */
-#line 3427
+#line 3431
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3427
+#line 3431
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3427
+#line 3431
       nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
-#line 3427
+#line 3431
     }
-#line 3427
+#line 3431
    /* copy workspace back if necessary */
-#line 3427
+#line 3431
     if (realign) {
-#line 3427
+#line 3431
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3427
+#line 3431
       xp = (float *) *xpp;
-#line 3427
+#line 3431
     }
-#line 3427
+#line 3431
    /* update xpp and tp */
-#line 3427
+#line 3431
     xp += ni;
-#line 3427
+#line 3431
     tp += ni;
-#line 3427
+#line 3431
     *xpp = (void*)xp;
-#line 3427
+#line 3431
   }
-#line 3427
+#line 3431
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3427
+#line 3431
 
-#line 3427
+#line 3431
 #else   /* not SX */
-#line 3427
+#line 3431
 
-#line 3427
+#line 3431
 	char *xp = (char *) *xpp;
-#line 3427
+#line 3431
 	int status = NC_NOERR;
-#line 3427
+#line 3431
 
-#line 3427
+#line 3431
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3427
+#line 3431
 	{
-#line 3427
+#line 3431
 		int lstatus = ncx_put_float_schar(xp, tp, fillp);
-#line 3427
+#line 3431
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3427
+#line 3431
 			status = lstatus;
-#line 3427
+#line 3431
 	}
-#line 3427
+#line 3431
 
-#line 3427
+#line 3431
 	*xpp = (void *)xp;
-#line 3427
+#line 3431
 	return status;
-#line 3427
+#line 3431
 #endif
-#line 3427
+#line 3431
 }
-#line 3427
+#line 3431
 
 int
-#line 3428
+#line 3432
 ncx_putn_float_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3428
+#line 3432
 {
-#line 3428
+#line 3432
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3428
+#line 3432
 
-#line 3428
+#line 3432
  /* basic algorithm is:
-#line 3428
+#line 3432
   *   - ensure sane alignment of output data
-#line 3428
+#line 3432
   *   - copy (conversion happens automatically) input data
-#line 3428
+#line 3432
   *     to output
-#line 3428
+#line 3432
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3428
+#line 3432
   *     at next location for converted output
-#line 3428
+#line 3432
   */
-#line 3428
+#line 3432
   long i, j, ni;
-#line 3428
+#line 3432
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3428
+#line 3432
   float *xp;
-#line 3428
+#line 3432
   int nrange = 0;         /* number of range errors */
-#line 3428
+#line 3432
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3428
+#line 3432
   long cxp = (long) *((char**)xpp);
-#line 3428
+#line 3432
 
-#line 3428
+#line 3432
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3428
+#line 3432
   /* sjl: manually stripmine so we can limit amount of
-#line 3428
+#line 3432
    * vector work space reserved to LOOPCNT elements. Also
-#line 3428
+#line 3432
    * makes vectorisation easy */
-#line 3428
+#line 3432
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3428
+#line 3432
     ni=Min(nelems-j,LOOPCNT);
-#line 3428
+#line 3432
     if (realign) {
-#line 3428
+#line 3432
       xp = tmp;
-#line 3428
+#line 3432
     } else {
-#line 3428
+#line 3432
       xp = (float *) *xpp;
-#line 3428
+#line 3432
     }
-#line 3428
+#line 3432
    /* copy the next block */
-#line 3428
+#line 3432
 #pragma cdir loopcnt=LOOPCNT
-#line 3428
+#line 3432
 #pragma cdir shortloop
-#line 3428
+#line 3432
     for (i=0; i<ni; i++) {
-#line 3428
+#line 3432
       /* the normal case: */
-#line 3428
+#line 3432
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3428
+#line 3432
      /* test for range errors (not always needed but do it anyway) */
-#line 3428
+#line 3432
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3428
+#line 3432
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3428
+#line 3432
       nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
-#line 3428
+#line 3432
     }
-#line 3428
+#line 3432
    /* copy workspace back if necessary */
-#line 3428
+#line 3432
     if (realign) {
-#line 3428
+#line 3432
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3428
+#line 3432
       xp = (float *) *xpp;
-#line 3428
+#line 3432
     }
-#line 3428
+#line 3432
    /* update xpp and tp */
-#line 3428
+#line 3432
     xp += ni;
-#line 3428
+#line 3432
     tp += ni;
-#line 3428
+#line 3432
     *xpp = (void*)xp;
-#line 3428
+#line 3432
   }
-#line 3428
+#line 3432
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3428
+#line 3432
 
-#line 3428
+#line 3432
 #else   /* not SX */
-#line 3428
+#line 3432
 
-#line 3428
+#line 3432
 	char *xp = (char *) *xpp;
-#line 3428
+#line 3432
 	int status = NC_NOERR;
-#line 3428
+#line 3432
 
-#line 3428
+#line 3432
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3428
+#line 3432
 	{
-#line 3428
+#line 3432
 		int lstatus = ncx_put_float_short(xp, tp, fillp);
-#line 3428
+#line 3432
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3428
+#line 3432
 			status = lstatus;
-#line 3428
+#line 3432
 	}
-#line 3428
+#line 3432
 
-#line 3428
+#line 3432
 	*xpp = (void *)xp;
-#line 3428
+#line 3432
 	return status;
-#line 3428
+#line 3432
 #endif
-#line 3428
+#line 3432
 }
-#line 3428
+#line 3432
 
 int
-#line 3429
+#line 3433
 ncx_putn_float_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3429
+#line 3433
 {
-#line 3429
+#line 3433
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3429
+#line 3433
 
-#line 3429
+#line 3433
  /* basic algorithm is:
-#line 3429
+#line 3433
   *   - ensure sane alignment of output data
-#line 3429
+#line 3433
   *   - copy (conversion happens automatically) input data
-#line 3429
+#line 3433
   *     to output
-#line 3429
+#line 3433
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3429
+#line 3433
   *     at next location for converted output
-#line 3429
+#line 3433
   */
-#line 3429
+#line 3433
   long i, j, ni;
-#line 3429
+#line 3433
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3429
+#line 3433
   float *xp;
-#line 3429
+#line 3433
   int nrange = 0;         /* number of range errors */
-#line 3429
+#line 3433
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3429
+#line 3433
   long cxp = (long) *((char**)xpp);
-#line 3429
+#line 3433
 
-#line 3429
+#line 3433
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3429
+#line 3433
   /* sjl: manually stripmine so we can limit amount of
-#line 3429
+#line 3433
    * vector work space reserved to LOOPCNT elements. Also
-#line 3429
+#line 3433
    * makes vectorisation easy */
-#line 3429
+#line 3433
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3429
+#line 3433
     ni=Min(nelems-j,LOOPCNT);
-#line 3429
+#line 3433
     if (realign) {
-#line 3429
+#line 3433
       xp = tmp;
-#line 3429
+#line 3433
     } else {
-#line 3429
+#line 3433
       xp = (float *) *xpp;
-#line 3429
+#line 3433
     }
-#line 3429
+#line 3433
    /* copy the next block */
-#line 3429
+#line 3433
 #pragma cdir loopcnt=LOOPCNT
-#line 3429
+#line 3433
 #pragma cdir shortloop
-#line 3429
+#line 3433
     for (i=0; i<ni; i++) {
-#line 3429
+#line 3433
       /* the normal case: */
-#line 3429
+#line 3433
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3429
+#line 3433
      /* test for range errors (not always needed but do it anyway) */
-#line 3429
+#line 3433
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3429
+#line 3433
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3429
+#line 3433
       nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
-#line 3429
+#line 3433
     }
-#line 3429
+#line 3433
    /* copy workspace back if necessary */
-#line 3429
+#line 3433
     if (realign) {
-#line 3429
+#line 3433
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3429
+#line 3433
       xp = (float *) *xpp;
-#line 3429
+#line 3433
     }
-#line 3429
+#line 3433
    /* update xpp and tp */
-#line 3429
+#line 3433
     xp += ni;
-#line 3429
+#line 3433
     tp += ni;
-#line 3429
+#line 3433
     *xpp = (void*)xp;
-#line 3429
+#line 3433
   }
-#line 3429
+#line 3433
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3429
+#line 3433
 
-#line 3429
+#line 3433
 #else   /* not SX */
-#line 3429
+#line 3433
 
-#line 3429
+#line 3433
 	char *xp = (char *) *xpp;
-#line 3429
+#line 3433
 	int status = NC_NOERR;
-#line 3429
+#line 3433
 
-#line 3429
+#line 3433
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3429
+#line 3433
 	{
-#line 3429
+#line 3433
 		int lstatus = ncx_put_float_int(xp, tp, fillp);
-#line 3429
+#line 3433
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3429
+#line 3433
 			status = lstatus;
-#line 3429
+#line 3433
 	}
-#line 3429
+#line 3433
 
-#line 3429
+#line 3433
 	*xpp = (void *)xp;
-#line 3429
+#line 3433
 	return status;
-#line 3429
+#line 3433
 #endif
-#line 3429
+#line 3433
 }
-#line 3429
+#line 3433
 
 int
-#line 3430
+#line 3434
 ncx_putn_float_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3430
+#line 3434
 {
-#line 3430
+#line 3434
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3430
+#line 3434
 
-#line 3430
+#line 3434
  /* basic algorithm is:
-#line 3430
+#line 3434
   *   - ensure sane alignment of output data
-#line 3430
+#line 3434
   *   - copy (conversion happens automatically) input data
-#line 3430
+#line 3434
   *     to output
-#line 3430
+#line 3434
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3430
+#line 3434
   *     at next location for converted output
-#line 3430
+#line 3434
   */
-#line 3430
+#line 3434
   long i, j, ni;
-#line 3430
+#line 3434
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3430
+#line 3434
   float *xp;
-#line 3430
+#line 3434
   int nrange = 0;         /* number of range errors */
-#line 3430
+#line 3434
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3430
+#line 3434
   long cxp = (long) *((char**)xpp);
-#line 3430
+#line 3434
 
-#line 3430
+#line 3434
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3430
+#line 3434
   /* sjl: manually stripmine so we can limit amount of
-#line 3430
+#line 3434
    * vector work space reserved to LOOPCNT elements. Also
-#line 3430
+#line 3434
    * makes vectorisation easy */
-#line 3430
+#line 3434
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3430
+#line 3434
     ni=Min(nelems-j,LOOPCNT);
-#line 3430
+#line 3434
     if (realign) {
-#line 3430
+#line 3434
       xp = tmp;
-#line 3430
+#line 3434
     } else {
-#line 3430
+#line 3434
       xp = (float *) *xpp;
-#line 3430
+#line 3434
     }
-#line 3430
+#line 3434
    /* copy the next block */
-#line 3430
+#line 3434
 #pragma cdir loopcnt=LOOPCNT
-#line 3430
+#line 3434
 #pragma cdir shortloop
-#line 3430
+#line 3434
     for (i=0; i<ni; i++) {
-#line 3430
+#line 3434
       /* the normal case: */
-#line 3430
+#line 3434
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3430
+#line 3434
      /* test for range errors (not always needed but do it anyway) */
-#line 3430
+#line 3434
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3430
+#line 3434
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3430
+#line 3434
       nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
-#line 3430
+#line 3434
     }
-#line 3430
+#line 3434
    /* copy workspace back if necessary */
-#line 3430
+#line 3434
     if (realign) {
-#line 3430
+#line 3434
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3430
+#line 3434
       xp = (float *) *xpp;
-#line 3430
+#line 3434
     }
-#line 3430
+#line 3434
    /* update xpp and tp */
-#line 3430
+#line 3434
     xp += ni;
-#line 3430
+#line 3434
     tp += ni;
-#line 3430
+#line 3434
     *xpp = (void*)xp;
-#line 3430
+#line 3434
   }
-#line 3430
+#line 3434
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3430
+#line 3434
 
-#line 3430
+#line 3434
 #else   /* not SX */
-#line 3430
+#line 3434
 
-#line 3430
+#line 3434
 	char *xp = (char *) *xpp;
-#line 3430
+#line 3434
 	int status = NC_NOERR;
-#line 3430
+#line 3434
 
-#line 3430
+#line 3434
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3430
+#line 3434
 	{
-#line 3430
+#line 3434
 		int lstatus = ncx_put_float_long(xp, tp, fillp);
-#line 3430
+#line 3434
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3430
+#line 3434
 			status = lstatus;
-#line 3430
+#line 3434
 	}
-#line 3430
+#line 3434
 
-#line 3430
+#line 3434
 	*xpp = (void *)xp;
-#line 3430
+#line 3434
 	return status;
-#line 3430
+#line 3434
 #endif
-#line 3430
+#line 3434
 }
-#line 3430
+#line 3434
 
 int
-#line 3431
+#line 3435
 ncx_putn_float_double(void **xpp, size_t nelems, const double *tp, void *fillp)
-#line 3431
+#line 3435
 {
-#line 3431
+#line 3435
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3431
+#line 3435
 
-#line 3431
+#line 3435
  /* basic algorithm is:
-#line 3431
+#line 3435
   *   - ensure sane alignment of output data
-#line 3431
+#line 3435
   *   - copy (conversion happens automatically) input data
-#line 3431
+#line 3435
   *     to output
-#line 3431
+#line 3435
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3431
+#line 3435
   *     at next location for converted output
-#line 3431
+#line 3435
   */
-#line 3431
+#line 3435
   long i, j, ni;
-#line 3431
+#line 3435
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3431
+#line 3435
   float *xp;
-#line 3431
+#line 3435
   int nrange = 0;         /* number of range errors */
-#line 3431
+#line 3435
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3431
+#line 3435
   long cxp = (long) *((char**)xpp);
-#line 3431
+#line 3435
 
-#line 3431
+#line 3435
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3431
+#line 3435
   /* sjl: manually stripmine so we can limit amount of
-#line 3431
+#line 3435
    * vector work space reserved to LOOPCNT elements. Also
-#line 3431
+#line 3435
    * makes vectorisation easy */
-#line 3431
+#line 3435
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3431
+#line 3435
     ni=Min(nelems-j,LOOPCNT);
-#line 3431
+#line 3435
     if (realign) {
-#line 3431
+#line 3435
       xp = tmp;
-#line 3431
+#line 3435
     } else {
-#line 3431
+#line 3435
       xp = (float *) *xpp;
-#line 3431
+#line 3435
     }
-#line 3431
+#line 3435
    /* copy the next block */
-#line 3431
+#line 3435
 #pragma cdir loopcnt=LOOPCNT
-#line 3431
+#line 3435
 #pragma cdir shortloop
-#line 3431
+#line 3435
     for (i=0; i<ni; i++) {
-#line 3431
+#line 3435
       /* the normal case: */
-#line 3431
+#line 3435
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3431
+#line 3435
      /* test for range errors (not always needed but do it anyway) */
-#line 3431
+#line 3435
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3431
+#line 3435
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3431
+#line 3435
       nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
-#line 3431
+#line 3435
     }
-#line 3431
+#line 3435
    /* copy workspace back if necessary */
-#line 3431
+#line 3435
     if (realign) {
-#line 3431
+#line 3435
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3431
+#line 3435
       xp = (float *) *xpp;
-#line 3431
+#line 3435
     }
-#line 3431
+#line 3435
    /* update xpp and tp */
-#line 3431
+#line 3435
     xp += ni;
-#line 3431
+#line 3435
     tp += ni;
-#line 3431
+#line 3435
     *xpp = (void*)xp;
-#line 3431
+#line 3435
   }
-#line 3431
+#line 3435
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3431
+#line 3435
 
-#line 3431
+#line 3435
 #else   /* not SX */
-#line 3431
+#line 3435
 
-#line 3431
+#line 3435
 	char *xp = (char *) *xpp;
-#line 3431
+#line 3435
 	int status = NC_NOERR;
-#line 3431
+#line 3435
 
-#line 3431
+#line 3435
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3431
+#line 3435
 	{
-#line 3431
+#line 3435
 		int lstatus = ncx_put_float_double(xp, tp, fillp);
-#line 3431
+#line 3435
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3431
+#line 3435
 			status = lstatus;
-#line 3431
+#line 3435
 	}
-#line 3431
+#line 3435
 
-#line 3431
+#line 3435
 	*xpp = (void *)xp;
-#line 3431
+#line 3435
 	return status;
-#line 3431
+#line 3435
 #endif
-#line 3431
+#line 3435
 }
-#line 3431
+#line 3435
 
 int
-#line 3432
+#line 3436
 ncx_putn_float_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
-#line 3432
+#line 3436
 {
-#line 3432
+#line 3436
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3432
+#line 3436
 
-#line 3432
+#line 3436
  /* basic algorithm is:
-#line 3432
+#line 3436
   *   - ensure sane alignment of output data
-#line 3432
+#line 3436
   *   - copy (conversion happens automatically) input data
-#line 3432
+#line 3436
   *     to output
-#line 3432
+#line 3436
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3432
+#line 3436
   *     at next location for converted output
-#line 3432
+#line 3436
   */
-#line 3432
+#line 3436
   long i, j, ni;
-#line 3432
+#line 3436
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3432
+#line 3436
   float *xp;
-#line 3432
+#line 3436
   int nrange = 0;         /* number of range errors */
-#line 3432
+#line 3436
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3432
+#line 3436
   long cxp = (long) *((char**)xpp);
-#line 3432
+#line 3436
 
-#line 3432
+#line 3436
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3432
+#line 3436
   /* sjl: manually stripmine so we can limit amount of
-#line 3432
+#line 3436
    * vector work space reserved to LOOPCNT elements. Also
-#line 3432
+#line 3436
    * makes vectorisation easy */
-#line 3432
+#line 3436
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3432
+#line 3436
     ni=Min(nelems-j,LOOPCNT);
-#line 3432
+#line 3436
     if (realign) {
-#line 3432
+#line 3436
       xp = tmp;
-#line 3432
+#line 3436
     } else {
-#line 3432
+#line 3436
       xp = (float *) *xpp;
-#line 3432
+#line 3436
     }
-#line 3432
+#line 3436
    /* copy the next block */
-#line 3432
+#line 3436
 #pragma cdir loopcnt=LOOPCNT
-#line 3432
+#line 3436
 #pragma cdir shortloop
-#line 3432
+#line 3436
     for (i=0; i<ni; i++) {
-#line 3432
+#line 3436
       /* the normal case: */
-#line 3432
+#line 3436
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3432
+#line 3436
      /* test for range errors (not always needed but do it anyway) */
-#line 3432
+#line 3436
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3432
+#line 3436
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3432
+#line 3436
       nrange += tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN;
-#line 3432
+#line 3436
     }
-#line 3432
+#line 3436
    /* copy workspace back if necessary */
-#line 3432
+#line 3436
     if (realign) {
-#line 3432
+#line 3436
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3432
+#line 3436
       xp = (float *) *xpp;
-#line 3432
+#line 3436
     }
-#line 3432
+#line 3436
    /* update xpp and tp */
-#line 3432
+#line 3436
     xp += ni;
-#line 3432
+#line 3436
     tp += ni;
-#line 3432
+#line 3436
     *xpp = (void*)xp;
-#line 3432
+#line 3436
   }
-#line 3432
+#line 3436
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3432
+#line 3436
 
-#line 3432
+#line 3436
 #else   /* not SX */
-#line 3432
+#line 3436
 
-#line 3432
+#line 3436
 	char *xp = (char *) *xpp;
-#line 3432
+#line 3436
 	int status = NC_NOERR;
-#line 3432
+#line 3436
 
-#line 3432
+#line 3436
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3432
+#line 3436
 	{
-#line 3432
+#line 3436
 		int lstatus = ncx_put_float_longlong(xp, tp, fillp);
-#line 3432
+#line 3436
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3432
+#line 3436
 			status = lstatus;
-#line 3432
+#line 3436
 	}
-#line 3432
+#line 3436
 
-#line 3432
+#line 3436
 	*xpp = (void *)xp;
-#line 3432
+#line 3436
 	return status;
-#line 3432
+#line 3436
 #endif
-#line 3432
+#line 3436
 }
-#line 3432
+#line 3436
 
 int
-#line 3433
+#line 3437
 ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 3433
+#line 3437
 {
-#line 3433
+#line 3437
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3433
+#line 3437
 
-#line 3433
+#line 3437
  /* basic algorithm is:
-#line 3433
+#line 3437
   *   - ensure sane alignment of output data
-#line 3433
+#line 3437
   *   - copy (conversion happens automatically) input data
-#line 3433
+#line 3437
   *     to output
-#line 3433
+#line 3437
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3433
+#line 3437
   *     at next location for converted output
-#line 3433
+#line 3437
   */
-#line 3433
+#line 3437
   long i, j, ni;
-#line 3433
+#line 3437
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3433
+#line 3437
   float *xp;
-#line 3433
+#line 3437
   int nrange = 0;         /* number of range errors */
-#line 3433
+#line 3437
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3433
+#line 3437
   long cxp = (long) *((char**)xpp);
-#line 3433
+#line 3437
 
-#line 3433
+#line 3437
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3433
+#line 3437
   /* sjl: manually stripmine so we can limit amount of
-#line 3433
+#line 3437
    * vector work space reserved to LOOPCNT elements. Also
-#line 3433
+#line 3437
    * makes vectorisation easy */
-#line 3433
+#line 3437
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3433
+#line 3437
     ni=Min(nelems-j,LOOPCNT);
-#line 3433
+#line 3437
     if (realign) {
-#line 3433
+#line 3437
       xp = tmp;
-#line 3433
+#line 3437
     } else {
-#line 3433
+#line 3437
       xp = (float *) *xpp;
-#line 3433
+#line 3437
     }
-#line 3433
+#line 3437
    /* copy the next block */
-#line 3433
+#line 3437
 #pragma cdir loopcnt=LOOPCNT
-#line 3433
+#line 3437
 #pragma cdir shortloop
-#line 3433
+#line 3437
     for (i=0; i<ni; i++) {
-#line 3433
+#line 3437
       /* the normal case: */
-#line 3433
+#line 3437
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3433
+#line 3437
      /* test for range errors (not always needed but do it anyway) */
-#line 3433
+#line 3437
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3433
+#line 3437
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3433
+#line 3437
       nrange += tp[i] > X_FLOAT_MAX ;
-#line 3433
+#line 3437
     }
-#line 3433
+#line 3437
    /* copy workspace back if necessary */
-#line 3433
+#line 3437
     if (realign) {
-#line 3433
+#line 3437
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3433
+#line 3437
       xp = (float *) *xpp;
-#line 3433
+#line 3437
     }
-#line 3433
+#line 3437
    /* update xpp and tp */
-#line 3433
+#line 3437
     xp += ni;
-#line 3433
+#line 3437
     tp += ni;
-#line 3433
+#line 3437
     *xpp = (void*)xp;
-#line 3433
+#line 3437
   }
-#line 3433
+#line 3437
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3433
+#line 3437
 
-#line 3433
+#line 3437
 #else   /* not SX */
-#line 3433
+#line 3437
 
-#line 3433
+#line 3437
 	char *xp = (char *) *xpp;
-#line 3433
+#line 3437
 	int status = NC_NOERR;
-#line 3433
+#line 3437
 
-#line 3433
+#line 3437
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3433
+#line 3437
 	{
-#line 3433
+#line 3437
 		int lstatus = ncx_put_float_uchar(xp, tp, fillp);
-#line 3433
+#line 3437
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3433
+#line 3437
 			status = lstatus;
-#line 3433
+#line 3437
 	}
-#line 3433
+#line 3437
 
-#line 3433
+#line 3437
 	*xpp = (void *)xp;
-#line 3433
+#line 3437
 	return status;
-#line 3433
+#line 3437
 #endif
-#line 3433
+#line 3437
 }
-#line 3433
+#line 3437
 
 int
-#line 3434
+#line 3438
 ncx_putn_float_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3434
+#line 3438
 {
-#line 3434
+#line 3438
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3434
+#line 3438
 
-#line 3434
+#line 3438
  /* basic algorithm is:
-#line 3434
+#line 3438
   *   - ensure sane alignment of output data
-#line 3434
+#line 3438
   *   - copy (conversion happens automatically) input data
-#line 3434
+#line 3438
   *     to output
-#line 3434
+#line 3438
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3434
+#line 3438
   *     at next location for converted output
-#line 3434
+#line 3438
   */
-#line 3434
+#line 3438
   long i, j, ni;
-#line 3434
+#line 3438
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3434
+#line 3438
   float *xp;
-#line 3434
+#line 3438
   int nrange = 0;         /* number of range errors */
-#line 3434
+#line 3438
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3434
+#line 3438
   long cxp = (long) *((char**)xpp);
-#line 3434
+#line 3438
 
-#line 3434
+#line 3438
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3434
+#line 3438
   /* sjl: manually stripmine so we can limit amount of
-#line 3434
+#line 3438
    * vector work space reserved to LOOPCNT elements. Also
-#line 3434
+#line 3438
    * makes vectorisation easy */
-#line 3434
+#line 3438
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3434
+#line 3438
     ni=Min(nelems-j,LOOPCNT);
-#line 3434
+#line 3438
     if (realign) {
-#line 3434
+#line 3438
       xp = tmp;
-#line 3434
+#line 3438
     } else {
-#line 3434
+#line 3438
       xp = (float *) *xpp;
-#line 3434
+#line 3438
     }
-#line 3434
+#line 3438
    /* copy the next block */
-#line 3434
+#line 3438
 #pragma cdir loopcnt=LOOPCNT
-#line 3434
+#line 3438
 #pragma cdir shortloop
-#line 3434
+#line 3438
     for (i=0; i<ni; i++) {
-#line 3434
+#line 3438
       /* the normal case: */
-#line 3434
+#line 3438
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3434
+#line 3438
      /* test for range errors (not always needed but do it anyway) */
-#line 3434
+#line 3438
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3434
+#line 3438
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3434
+#line 3438
       nrange += tp[i] > X_FLOAT_MAX ;
-#line 3434
+#line 3438
     }
-#line 3434
+#line 3438
    /* copy workspace back if necessary */
-#line 3434
+#line 3438
     if (realign) {
-#line 3434
+#line 3438
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3434
+#line 3438
       xp = (float *) *xpp;
-#line 3434
+#line 3438
     }
-#line 3434
+#line 3438
    /* update xpp and tp */
-#line 3434
+#line 3438
     xp += ni;
-#line 3434
+#line 3438
     tp += ni;
-#line 3434
+#line 3438
     *xpp = (void*)xp;
-#line 3434
+#line 3438
   }
-#line 3434
+#line 3438
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3434
+#line 3438
 
-#line 3434
+#line 3438
 #else   /* not SX */
-#line 3434
+#line 3438
 
-#line 3434
+#line 3438
 	char *xp = (char *) *xpp;
-#line 3434
+#line 3438
 	int status = NC_NOERR;
-#line 3434
+#line 3438
 
-#line 3434
+#line 3438
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3434
+#line 3438
 	{
-#line 3434
+#line 3438
 		int lstatus = ncx_put_float_ushort(xp, tp, fillp);
-#line 3434
+#line 3438
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3434
+#line 3438
 			status = lstatus;
-#line 3434
+#line 3438
 	}
-#line 3434
+#line 3438
 
-#line 3434
+#line 3438
 	*xpp = (void *)xp;
-#line 3434
+#line 3438
 	return status;
-#line 3434
+#line 3438
 #endif
-#line 3434
+#line 3438
 }
-#line 3434
+#line 3438
 
 int
-#line 3435
+#line 3439
 ncx_putn_float_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
-#line 3435
+#line 3439
 {
-#line 3435
+#line 3439
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3435
+#line 3439
 
-#line 3435
+#line 3439
  /* basic algorithm is:
-#line 3435
+#line 3439
   *   - ensure sane alignment of output data
-#line 3435
+#line 3439
   *   - copy (conversion happens automatically) input data
-#line 3435
+#line 3439
   *     to output
-#line 3435
+#line 3439
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3435
+#line 3439
   *     at next location for converted output
-#line 3435
+#line 3439
   */
-#line 3435
+#line 3439
   long i, j, ni;
-#line 3435
+#line 3439
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3435
+#line 3439
   float *xp;
-#line 3435
+#line 3439
   int nrange = 0;         /* number of range errors */
-#line 3435
+#line 3439
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3435
+#line 3439
   long cxp = (long) *((char**)xpp);
-#line 3435
+#line 3439
 
-#line 3435
+#line 3439
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3435
+#line 3439
   /* sjl: manually stripmine so we can limit amount of
-#line 3435
+#line 3439
    * vector work space reserved to LOOPCNT elements. Also
-#line 3435
+#line 3439
    * makes vectorisation easy */
-#line 3435
+#line 3439
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3435
+#line 3439
     ni=Min(nelems-j,LOOPCNT);
-#line 3435
+#line 3439
     if (realign) {
-#line 3435
+#line 3439
       xp = tmp;
-#line 3435
+#line 3439
     } else {
-#line 3435
+#line 3439
       xp = (float *) *xpp;
-#line 3435
+#line 3439
     }
-#line 3435
+#line 3439
    /* copy the next block */
-#line 3435
+#line 3439
 #pragma cdir loopcnt=LOOPCNT
-#line 3435
+#line 3439
 #pragma cdir shortloop
-#line 3435
+#line 3439
     for (i=0; i<ni; i++) {
-#line 3435
+#line 3439
       /* the normal case: */
-#line 3435
+#line 3439
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3435
+#line 3439
      /* test for range errors (not always needed but do it anyway) */
-#line 3435
+#line 3439
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3435
+#line 3439
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3435
+#line 3439
       nrange += tp[i] > X_FLOAT_MAX ;
-#line 3435
+#line 3439
     }
-#line 3435
+#line 3439
    /* copy workspace back if necessary */
-#line 3435
+#line 3439
     if (realign) {
-#line 3435
+#line 3439
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3435
+#line 3439
       xp = (float *) *xpp;
-#line 3435
+#line 3439
     }
-#line 3435
+#line 3439
    /* update xpp and tp */
-#line 3435
+#line 3439
     xp += ni;
-#line 3435
+#line 3439
     tp += ni;
-#line 3435
+#line 3439
     *xpp = (void*)xp;
-#line 3435
+#line 3439
   }
-#line 3435
+#line 3439
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3435
+#line 3439
 
-#line 3435
+#line 3439
 #else   /* not SX */
-#line 3435
+#line 3439
 
-#line 3435
+#line 3439
 	char *xp = (char *) *xpp;
-#line 3435
+#line 3439
 	int status = NC_NOERR;
-#line 3435
+#line 3439
 
-#line 3435
+#line 3439
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3435
+#line 3439
 	{
-#line 3435
+#line 3439
 		int lstatus = ncx_put_float_uint(xp, tp, fillp);
-#line 3435
+#line 3439
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3435
+#line 3439
 			status = lstatus;
-#line 3435
+#line 3439
 	}
-#line 3435
+#line 3439
 
-#line 3435
+#line 3439
 	*xpp = (void *)xp;
-#line 3435
+#line 3439
 	return status;
-#line 3435
+#line 3439
 #endif
-#line 3435
+#line 3439
 }
-#line 3435
+#line 3439
 
 int
-#line 3436
+#line 3440
 ncx_putn_float_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
-#line 3436
+#line 3440
 {
-#line 3436
+#line 3440
 #if defined(_SX) && _SX != 0 && X_SIZEOF_FLOAT == SIZEOF_FLOAT
-#line 3436
+#line 3440
 
-#line 3436
+#line 3440
  /* basic algorithm is:
-#line 3436
+#line 3440
   *   - ensure sane alignment of output data
-#line 3436
+#line 3440
   *   - copy (conversion happens automatically) input data
-#line 3436
+#line 3440
   *     to output
-#line 3436
+#line 3440
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3436
+#line 3440
   *     at next location for converted output
-#line 3436
+#line 3440
   */
-#line 3436
+#line 3440
   long i, j, ni;
-#line 3436
+#line 3440
   float tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3436
+#line 3440
   float *xp;
-#line 3436
+#line 3440
   int nrange = 0;         /* number of range errors */
-#line 3436
+#line 3440
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3436
+#line 3440
   long cxp = (long) *((char**)xpp);
-#line 3436
+#line 3440
 
-#line 3436
+#line 3440
   realign = (cxp & 7) % SIZEOF_FLOAT;
-#line 3436
+#line 3440
   /* sjl: manually stripmine so we can limit amount of
-#line 3436
+#line 3440
    * vector work space reserved to LOOPCNT elements. Also
-#line 3436
+#line 3440
    * makes vectorisation easy */
-#line 3436
+#line 3440
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3436
+#line 3440
     ni=Min(nelems-j,LOOPCNT);
-#line 3436
+#line 3440
     if (realign) {
-#line 3436
+#line 3440
       xp = tmp;
-#line 3436
+#line 3440
     } else {
-#line 3436
+#line 3440
       xp = (float *) *xpp;
-#line 3436
+#line 3440
     }
-#line 3436
+#line 3440
    /* copy the next block */
-#line 3436
+#line 3440
 #pragma cdir loopcnt=LOOPCNT
-#line 3436
+#line 3440
 #pragma cdir shortloop
-#line 3436
+#line 3440
     for (i=0; i<ni; i++) {
-#line 3436
+#line 3440
       /* the normal case: */
-#line 3436
+#line 3440
       xp[i] = (float) Max( X_FLOAT_MIN, Min(X_FLOAT_MAX, (float) tp[i]));
-#line 3436
+#line 3440
      /* test for range errors (not always needed but do it anyway) */
-#line 3436
+#line 3440
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3436
+#line 3440
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3436
+#line 3440
       nrange += tp[i] > X_FLOAT_MAX ;
-#line 3436
+#line 3440
     }
-#line 3436
+#line 3440
    /* copy workspace back if necessary */
-#line 3436
+#line 3440
     if (realign) {
-#line 3436
+#line 3440
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_FLOAT);
-#line 3436
+#line 3440
       xp = (float *) *xpp;
-#line 3436
+#line 3440
     }
-#line 3436
+#line 3440
    /* update xpp and tp */
-#line 3436
+#line 3440
     xp += ni;
-#line 3436
+#line 3440
     tp += ni;
-#line 3436
+#line 3440
     *xpp = (void*)xp;
-#line 3436
+#line 3440
   }
-#line 3436
+#line 3440
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3436
+#line 3440
 
-#line 3436
+#line 3440
 #else   /* not SX */
-#line 3436
+#line 3440
 
-#line 3436
+#line 3440
 	char *xp = (char *) *xpp;
-#line 3436
+#line 3440
 	int status = NC_NOERR;
-#line 3436
+#line 3440
 
-#line 3436
+#line 3440
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
-#line 3436
+#line 3440
 	{
-#line 3436
+#line 3440
 		int lstatus = ncx_put_float_ulonglong(xp, tp, fillp);
-#line 3436
+#line 3440
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3436
+#line 3440
 			status = lstatus;
-#line 3436
+#line 3440
 	}
-#line 3436
+#line 3440
 
-#line 3436
+#line 3440
 	*xpp = (void *)xp;
-#line 3436
+#line 3440
 	return status;
-#line 3436
+#line 3440
 #endif
-#line 3436
+#line 3440
 }
-#line 3436
+#line 3440
 
 
 /* double --------------------------------------------------------------------*/
@@ -28334,87 +28338,87 @@ ncx_getn_double_double(const void **xpp, size_t ndoubles, double *ip)
 	while (ip < end)
 	{
 	struct vax_double *const vdp =
-#line 3461
+#line 3465
 			 (struct vax_double *)ip;
-#line 3461
+#line 3465
 	const struct ieee_double *const idp =
-#line 3461
+#line 3465
 			 (const struct ieee_double *) (*xpp);
-#line 3461
+#line 3465
 	{
-#line 3461
+#line 3465
 		const struct dbl_limits *lim;
-#line 3461
+#line 3465
 		int ii;
-#line 3461
+#line 3465
 		for (ii = 0, lim = dbl_limits;
-#line 3461
+#line 3465
 			ii < sizeof(dbl_limits)/sizeof(struct dbl_limits);
-#line 3461
+#line 3465
 			ii++, lim++)
-#line 3461
+#line 3465
 		{
-#line 3461
+#line 3465
 			if ((idp->mant_lo == lim->ieee.mant_lo)
-#line 3461
+#line 3465
 				&& (idp->mant_4 == lim->ieee.mant_4)
-#line 3461
+#line 3465
 				&& (idp->mant_5 == lim->ieee.mant_5)
-#line 3461
+#line 3465
 				&& (idp->mant_6 == lim->ieee.mant_6)
-#line 3461
+#line 3465
 				&& (idp->exp_lo == lim->ieee.exp_lo)
-#line 3461
+#line 3465
 				&& (idp->exp_hi == lim->ieee.exp_hi)
-#line 3461
+#line 3465
 				)
-#line 3461
+#line 3465
 			{
-#line 3461
+#line 3465
 				*vdp = lim->d;
-#line 3461
+#line 3465
 				goto doneit;
-#line 3461
+#line 3465
 			}
-#line 3461
+#line 3465
 		}
-#line 3461
+#line 3465
 	}
-#line 3461
+#line 3465
 	{
-#line 3461
+#line 3465
 		unsigned exp = idp->exp_hi << 4 | idp->exp_lo;
-#line 3461
+#line 3465
 		vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
-#line 3461
+#line 3465
 	}
-#line 3461
+#line 3465
 	{
-#line 3461
+#line 3465
 		unsigned mant_hi = ((idp->mant_6 << 16)
-#line 3461
+#line 3465
 				 | (idp->mant_5 << 8)
-#line 3461
+#line 3465
 				 | idp->mant_4);
-#line 3461
+#line 3465
 		unsigned mant_lo = SWAP4(idp->mant_lo);
-#line 3461
+#line 3465
 		vdp->mantissa1 = (mant_hi >> 13);
-#line 3461
+#line 3465
 		vdp->mantissa2 = ((mant_hi & MASK(13)) << 3)
-#line 3461
+#line 3465
 				| (mant_lo >> 29);
-#line 3461
+#line 3465
 		vdp->mantissa3 = (mant_lo >> 13);
-#line 3461
+#line 3465
 		vdp->mantissa4 = (mant_lo << 3);
-#line 3461
+#line 3465
 	}
-#line 3461
+#line 3465
 	doneit:
-#line 3461
+#line 3465
 		vdp->sign = idp->sign;
-#line 3461
+#line 3465
 
 		ip++;
 		*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
@@ -28441,1294 +28445,1294 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
 }
 #endif
 int
-#line 3486
+#line 3490
 ncx_getn_double_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3486
+#line 3490
 {
-#line 3486
+#line 3490
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3486
+#line 3490
 
-#line 3486
+#line 3490
  /* basic algorithm is:
-#line 3486
+#line 3490
   *   - ensure sane alignment of input data
-#line 3486
+#line 3490
   *   - copy (conversion happens automatically) input data
-#line 3486
+#line 3490
   *     to output
-#line 3486
+#line 3490
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3486
+#line 3490
   *     at next location for converted output
-#line 3486
+#line 3490
   */
-#line 3486
+#line 3490
   long i, j, ni;
-#line 3486
+#line 3490
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3486
+#line 3490
   double *xp;
-#line 3486
+#line 3490
   int nrange = 0;         /* number of range errors */
-#line 3486
+#line 3490
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3486
+#line 3490
   long cxp = (long) *((char**)xpp);
-#line 3486
+#line 3490
 
-#line 3486
+#line 3490
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3486
+#line 3490
   /* sjl: manually stripmine so we can limit amount of
-#line 3486
+#line 3490
    * vector work space reserved to LOOPCNT elements. Also
-#line 3486
+#line 3490
    * makes vectorisation easy */
-#line 3486
+#line 3490
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3486
+#line 3490
     ni=Min(nelems-j,LOOPCNT);
-#line 3486
+#line 3490
     if (realign) {
-#line 3486
+#line 3490
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3486
+#line 3490
       xp = tmp;
-#line 3486
+#line 3490
     } else {
-#line 3486
+#line 3490
       xp = (double *) *xpp;
-#line 3486
+#line 3490
     }
-#line 3486
+#line 3490
    /* copy the next block */
-#line 3486
+#line 3490
 #pragma cdir loopcnt=LOOPCNT
-#line 3486
+#line 3490
 #pragma cdir shortloop
-#line 3486
+#line 3490
     for (i=0; i<ni; i++) {
-#line 3486
+#line 3490
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3486
+#line 3490
      /* test for range errors (not always needed but do it anyway) */
-#line 3486
+#line 3490
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3486
+#line 3490
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3486
+#line 3490
       nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
-#line 3486
+#line 3490
     }
-#line 3486
+#line 3490
    /* update xpp and tp */
-#line 3486
+#line 3490
     if (realign) xp = (double *) *xpp;
-#line 3486
+#line 3490
     xp += ni;
-#line 3486
+#line 3490
     tp += ni;
-#line 3486
+#line 3490
     *xpp = (void*)xp;
-#line 3486
+#line 3490
   }
-#line 3486
+#line 3490
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3486
+#line 3490
 
-#line 3486
+#line 3490
 #else   /* not SX */
-#line 3486
+#line 3490
 	const char *xp = (const char *) *xpp;
-#line 3486
+#line 3490
 	int status = NC_NOERR;
-#line 3486
+#line 3490
 
-#line 3486
+#line 3490
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3486
+#line 3490
 	{
-#line 3486
+#line 3490
 		const int lstatus = ncx_get_double_schar(xp, tp);
-#line 3486
+#line 3490
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3486
+#line 3490
 			status = lstatus;
-#line 3486
+#line 3490
 	}
-#line 3486
+#line 3490
 
-#line 3486
+#line 3490
 	*xpp = (const void *)xp;
-#line 3486
+#line 3490
 	return status;
-#line 3486
+#line 3490
 #endif
-#line 3486
+#line 3490
 }
-#line 3486
+#line 3490
 
 int
-#line 3487
+#line 3491
 ncx_getn_double_short(const void **xpp, size_t nelems, short *tp)
-#line 3487
+#line 3491
 {
-#line 3487
+#line 3491
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3487
+#line 3491
 
-#line 3487
+#line 3491
  /* basic algorithm is:
-#line 3487
+#line 3491
   *   - ensure sane alignment of input data
-#line 3487
+#line 3491
   *   - copy (conversion happens automatically) input data
-#line 3487
+#line 3491
   *     to output
-#line 3487
+#line 3491
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3487
+#line 3491
   *     at next location for converted output
-#line 3487
+#line 3491
   */
-#line 3487
+#line 3491
   long i, j, ni;
-#line 3487
+#line 3491
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3487
+#line 3491
   double *xp;
-#line 3487
+#line 3491
   int nrange = 0;         /* number of range errors */
-#line 3487
+#line 3491
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3487
+#line 3491
   long cxp = (long) *((char**)xpp);
-#line 3487
+#line 3491
 
-#line 3487
+#line 3491
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3487
+#line 3491
   /* sjl: manually stripmine so we can limit amount of
-#line 3487
+#line 3491
    * vector work space reserved to LOOPCNT elements. Also
-#line 3487
+#line 3491
    * makes vectorisation easy */
-#line 3487
+#line 3491
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3487
+#line 3491
     ni=Min(nelems-j,LOOPCNT);
-#line 3487
+#line 3491
     if (realign) {
-#line 3487
+#line 3491
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3487
+#line 3491
       xp = tmp;
-#line 3487
+#line 3491
     } else {
-#line 3487
+#line 3491
       xp = (double *) *xpp;
-#line 3487
+#line 3491
     }
-#line 3487
+#line 3491
    /* copy the next block */
-#line 3487
+#line 3491
 #pragma cdir loopcnt=LOOPCNT
-#line 3487
+#line 3491
 #pragma cdir shortloop
-#line 3487
+#line 3491
     for (i=0; i<ni; i++) {
-#line 3487
+#line 3491
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3487
+#line 3491
      /* test for range errors (not always needed but do it anyway) */
-#line 3487
+#line 3491
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3487
+#line 3491
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3487
+#line 3491
       nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
-#line 3487
+#line 3491
     }
-#line 3487
+#line 3491
    /* update xpp and tp */
-#line 3487
+#line 3491
     if (realign) xp = (double *) *xpp;
-#line 3487
+#line 3491
     xp += ni;
-#line 3487
+#line 3491
     tp += ni;
-#line 3487
+#line 3491
     *xpp = (void*)xp;
-#line 3487
+#line 3491
   }
-#line 3487
+#line 3491
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3487
+#line 3491
 
-#line 3487
+#line 3491
 #else   /* not SX */
-#line 3487
+#line 3491
 	const char *xp = (const char *) *xpp;
-#line 3487
+#line 3491
 	int status = NC_NOERR;
-#line 3487
+#line 3491
 
-#line 3487
+#line 3491
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3487
+#line 3491
 	{
-#line 3487
+#line 3491
 		const int lstatus = ncx_get_double_short(xp, tp);
-#line 3487
+#line 3491
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3487
+#line 3491
 			status = lstatus;
-#line 3487
+#line 3491
 	}
-#line 3487
+#line 3491
 
-#line 3487
+#line 3491
 	*xpp = (const void *)xp;
-#line 3487
+#line 3491
 	return status;
-#line 3487
+#line 3491
 #endif
-#line 3487
+#line 3491
 }
-#line 3487
+#line 3491
 
 int
-#line 3488
+#line 3492
 ncx_getn_double_int(const void **xpp, size_t nelems, int *tp)
-#line 3488
+#line 3492
 {
-#line 3488
+#line 3492
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3488
+#line 3492
 
-#line 3488
+#line 3492
  /* basic algorithm is:
-#line 3488
+#line 3492
   *   - ensure sane alignment of input data
-#line 3488
+#line 3492
   *   - copy (conversion happens automatically) input data
-#line 3488
+#line 3492
   *     to output
-#line 3488
+#line 3492
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3488
+#line 3492
   *     at next location for converted output
-#line 3488
+#line 3492
   */
-#line 3488
+#line 3492
   long i, j, ni;
-#line 3488
+#line 3492
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3488
+#line 3492
   double *xp;
-#line 3488
+#line 3492
   int nrange = 0;         /* number of range errors */
-#line 3488
+#line 3492
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3488
+#line 3492
   long cxp = (long) *((char**)xpp);
-#line 3488
+#line 3492
 
-#line 3488
+#line 3492
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3488
+#line 3492
   /* sjl: manually stripmine so we can limit amount of
-#line 3488
+#line 3492
    * vector work space reserved to LOOPCNT elements. Also
-#line 3488
+#line 3492
    * makes vectorisation easy */
-#line 3488
+#line 3492
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3488
+#line 3492
     ni=Min(nelems-j,LOOPCNT);
-#line 3488
+#line 3492
     if (realign) {
-#line 3488
+#line 3492
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3488
+#line 3492
       xp = tmp;
-#line 3488
+#line 3492
     } else {
-#line 3488
+#line 3492
       xp = (double *) *xpp;
-#line 3488
+#line 3492
     }
-#line 3488
+#line 3492
    /* copy the next block */
-#line 3488
+#line 3492
 #pragma cdir loopcnt=LOOPCNT
-#line 3488
+#line 3492
 #pragma cdir shortloop
-#line 3488
+#line 3492
     for (i=0; i<ni; i++) {
-#line 3488
+#line 3492
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3488
+#line 3492
      /* test for range errors (not always needed but do it anyway) */
-#line 3488
+#line 3492
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3488
+#line 3492
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3488
+#line 3492
       nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
-#line 3488
+#line 3492
     }
-#line 3488
+#line 3492
    /* update xpp and tp */
-#line 3488
+#line 3492
     if (realign) xp = (double *) *xpp;
-#line 3488
+#line 3492
     xp += ni;
-#line 3488
+#line 3492
     tp += ni;
-#line 3488
+#line 3492
     *xpp = (void*)xp;
-#line 3488
+#line 3492
   }
-#line 3488
+#line 3492
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3488
+#line 3492
 
-#line 3488
+#line 3492
 #else   /* not SX */
-#line 3488
+#line 3492
 	const char *xp = (const char *) *xpp;
-#line 3488
+#line 3492
 	int status = NC_NOERR;
-#line 3488
+#line 3492
 
-#line 3488
+#line 3492
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3488
+#line 3492
 	{
-#line 3488
+#line 3492
 		const int lstatus = ncx_get_double_int(xp, tp);
-#line 3488
+#line 3492
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3488
+#line 3492
 			status = lstatus;
-#line 3488
+#line 3492
 	}
-#line 3488
+#line 3492
 
-#line 3488
+#line 3492
 	*xpp = (const void *)xp;
-#line 3488
+#line 3492
 	return status;
-#line 3488
+#line 3492
 #endif
-#line 3488
+#line 3492
 }
-#line 3488
+#line 3492
 
 int
-#line 3489
+#line 3493
 ncx_getn_double_long(const void **xpp, size_t nelems, long *tp)
-#line 3489
+#line 3493
 {
-#line 3489
+#line 3493
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3489
+#line 3493
 
-#line 3489
+#line 3493
  /* basic algorithm is:
-#line 3489
+#line 3493
   *   - ensure sane alignment of input data
-#line 3489
+#line 3493
   *   - copy (conversion happens automatically) input data
-#line 3489
+#line 3493
   *     to output
-#line 3489
+#line 3493
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3489
+#line 3493
   *     at next location for converted output
-#line 3489
+#line 3493
   */
-#line 3489
+#line 3493
   long i, j, ni;
-#line 3489
+#line 3493
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3489
+#line 3493
   double *xp;
-#line 3489
+#line 3493
   int nrange = 0;         /* number of range errors */
-#line 3489
+#line 3493
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3489
+#line 3493
   long cxp = (long) *((char**)xpp);
-#line 3489
+#line 3493
 
-#line 3489
+#line 3493
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3489
+#line 3493
   /* sjl: manually stripmine so we can limit amount of
-#line 3489
+#line 3493
    * vector work space reserved to LOOPCNT elements. Also
-#line 3489
+#line 3493
    * makes vectorisation easy */
-#line 3489
+#line 3493
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3489
+#line 3493
     ni=Min(nelems-j,LOOPCNT);
-#line 3489
+#line 3493
     if (realign) {
-#line 3489
+#line 3493
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3489
+#line 3493
       xp = tmp;
-#line 3489
+#line 3493
     } else {
-#line 3489
+#line 3493
       xp = (double *) *xpp;
-#line 3489
+#line 3493
     }
-#line 3489
+#line 3493
    /* copy the next block */
-#line 3489
+#line 3493
 #pragma cdir loopcnt=LOOPCNT
-#line 3489
+#line 3493
 #pragma cdir shortloop
-#line 3489
+#line 3493
     for (i=0; i<ni; i++) {
-#line 3489
+#line 3493
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3489
+#line 3493
      /* test for range errors (not always needed but do it anyway) */
-#line 3489
+#line 3493
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3489
+#line 3493
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3489
+#line 3493
       nrange += xp[i] > LONG_MAX || xp[i] < LONG_MIN;
-#line 3489
+#line 3493
     }
-#line 3489
+#line 3493
    /* update xpp and tp */
-#line 3489
+#line 3493
     if (realign) xp = (double *) *xpp;
-#line 3489
+#line 3493
     xp += ni;
-#line 3489
+#line 3493
     tp += ni;
-#line 3489
+#line 3493
     *xpp = (void*)xp;
-#line 3489
+#line 3493
   }
-#line 3489
+#line 3493
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3489
+#line 3493
 
-#line 3489
+#line 3493
 #else   /* not SX */
-#line 3489
+#line 3493
 	const char *xp = (const char *) *xpp;
-#line 3489
+#line 3493
 	int status = NC_NOERR;
-#line 3489
+#line 3493
 
-#line 3489
+#line 3493
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3489
+#line 3493
 	{
-#line 3489
+#line 3493
 		const int lstatus = ncx_get_double_long(xp, tp);
-#line 3489
+#line 3493
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3489
+#line 3493
 			status = lstatus;
-#line 3489
+#line 3493
 	}
-#line 3489
+#line 3493
 
-#line 3489
+#line 3493
 	*xpp = (const void *)xp;
-#line 3489
+#line 3493
 	return status;
-#line 3489
+#line 3493
 #endif
-#line 3489
+#line 3493
 }
-#line 3489
+#line 3493
 
 int
-#line 3490
+#line 3494
 ncx_getn_double_float(const void **xpp, size_t nelems, float *tp)
-#line 3490
+#line 3494
 {
-#line 3490
+#line 3494
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3490
+#line 3494
 
-#line 3490
+#line 3494
  /* basic algorithm is:
-#line 3490
+#line 3494
   *   - ensure sane alignment of input data
-#line 3490
+#line 3494
   *   - copy (conversion happens automatically) input data
-#line 3490
+#line 3494
   *     to output
-#line 3490
+#line 3494
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3490
+#line 3494
   *     at next location for converted output
-#line 3490
+#line 3494
   */
-#line 3490
+#line 3494
   long i, j, ni;
-#line 3490
+#line 3494
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3490
+#line 3494
   double *xp;
-#line 3490
+#line 3494
   int nrange = 0;         /* number of range errors */
-#line 3490
+#line 3494
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3490
+#line 3494
   long cxp = (long) *((char**)xpp);
-#line 3490
+#line 3494
 
-#line 3490
+#line 3494
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3490
+#line 3494
   /* sjl: manually stripmine so we can limit amount of
-#line 3490
+#line 3494
    * vector work space reserved to LOOPCNT elements. Also
-#line 3490
+#line 3494
    * makes vectorisation easy */
-#line 3490
+#line 3494
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3490
+#line 3494
     ni=Min(nelems-j,LOOPCNT);
-#line 3490
+#line 3494
     if (realign) {
-#line 3490
+#line 3494
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3490
+#line 3494
       xp = tmp;
-#line 3490
+#line 3494
     } else {
-#line 3490
+#line 3494
       xp = (double *) *xpp;
-#line 3490
+#line 3494
     }
-#line 3490
+#line 3494
    /* copy the next block */
-#line 3490
+#line 3494
 #pragma cdir loopcnt=LOOPCNT
-#line 3490
+#line 3494
 #pragma cdir shortloop
-#line 3490
+#line 3494
     for (i=0; i<ni; i++) {
-#line 3490
+#line 3494
       tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
-#line 3490
+#line 3494
      /* test for range errors (not always needed but do it anyway) */
-#line 3490
+#line 3494
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3490
+#line 3494
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3490
+#line 3494
       nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
-#line 3490
+#line 3494
     }
-#line 3490
+#line 3494
    /* update xpp and tp */
-#line 3490
+#line 3494
     if (realign) xp = (double *) *xpp;
-#line 3490
+#line 3494
     xp += ni;
-#line 3490
+#line 3494
     tp += ni;
-#line 3490
+#line 3494
     *xpp = (void*)xp;
-#line 3490
+#line 3494
   }
-#line 3490
+#line 3494
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3490
+#line 3494
 
-#line 3490
+#line 3494
 #else   /* not SX */
-#line 3490
+#line 3494
 	const char *xp = (const char *) *xpp;
-#line 3490
+#line 3494
 	int status = NC_NOERR;
-#line 3490
+#line 3494
 
-#line 3490
+#line 3494
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3490
+#line 3494
 	{
-#line 3490
+#line 3494
 		const int lstatus = ncx_get_double_float(xp, tp);
-#line 3490
+#line 3494
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3490
+#line 3494
 			status = lstatus;
-#line 3490
+#line 3494
 	}
-#line 3490
+#line 3494
 
-#line 3490
+#line 3494
 	*xpp = (const void *)xp;
-#line 3490
+#line 3494
 	return status;
-#line 3490
+#line 3494
 #endif
-#line 3490
+#line 3494
 }
-#line 3490
+#line 3494
 
 int
-#line 3491
+#line 3495
 ncx_getn_double_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3491
+#line 3495
 {
-#line 3491
+#line 3495
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3491
+#line 3495
 
-#line 3491
+#line 3495
  /* basic algorithm is:
-#line 3491
+#line 3495
   *   - ensure sane alignment of input data
-#line 3491
+#line 3495
   *   - copy (conversion happens automatically) input data
-#line 3491
+#line 3495
   *     to output
-#line 3491
+#line 3495
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3491
+#line 3495
   *     at next location for converted output
-#line 3491
+#line 3495
   */
-#line 3491
+#line 3495
   long i, j, ni;
-#line 3491
+#line 3495
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3491
+#line 3495
   double *xp;
-#line 3491
+#line 3495
   int nrange = 0;         /* number of range errors */
-#line 3491
+#line 3495
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3491
+#line 3495
   long cxp = (long) *((char**)xpp);
-#line 3491
+#line 3495
 
-#line 3491
+#line 3495
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3491
+#line 3495
   /* sjl: manually stripmine so we can limit amount of
-#line 3491
+#line 3495
    * vector work space reserved to LOOPCNT elements. Also
-#line 3491
+#line 3495
    * makes vectorisation easy */
-#line 3491
+#line 3495
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3491
+#line 3495
     ni=Min(nelems-j,LOOPCNT);
-#line 3491
+#line 3495
     if (realign) {
-#line 3491
+#line 3495
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3491
+#line 3495
       xp = tmp;
-#line 3491
+#line 3495
     } else {
-#line 3491
+#line 3495
       xp = (double *) *xpp;
-#line 3491
+#line 3495
     }
-#line 3491
+#line 3495
    /* copy the next block */
-#line 3491
+#line 3495
 #pragma cdir loopcnt=LOOPCNT
-#line 3491
+#line 3495
 #pragma cdir shortloop
-#line 3491
+#line 3495
     for (i=0; i<ni; i++) {
-#line 3491
+#line 3495
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3491
+#line 3495
      /* test for range errors (not always needed but do it anyway) */
-#line 3491
+#line 3495
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3491
+#line 3495
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3491
+#line 3495
       nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
-#line 3491
+#line 3495
     }
-#line 3491
+#line 3495
    /* update xpp and tp */
-#line 3491
+#line 3495
     if (realign) xp = (double *) *xpp;
-#line 3491
+#line 3495
     xp += ni;
-#line 3491
+#line 3495
     tp += ni;
-#line 3491
+#line 3495
     *xpp = (void*)xp;
-#line 3491
+#line 3495
   }
-#line 3491
+#line 3495
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3491
+#line 3495
 
-#line 3491
+#line 3495
 #else   /* not SX */
-#line 3491
+#line 3495
 	const char *xp = (const char *) *xpp;
-#line 3491
+#line 3495
 	int status = NC_NOERR;
-#line 3491
+#line 3495
 
-#line 3491
+#line 3495
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3491
+#line 3495
 	{
-#line 3491
+#line 3495
 		const int lstatus = ncx_get_double_longlong(xp, tp);
-#line 3491
+#line 3495
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3491
+#line 3495
 			status = lstatus;
-#line 3491
+#line 3495
 	}
-#line 3491
+#line 3495
 
-#line 3491
+#line 3495
 	*xpp = (const void *)xp;
-#line 3491
+#line 3495
 	return status;
-#line 3491
+#line 3495
 #endif
-#line 3491
+#line 3495
 }
-#line 3491
+#line 3495
 
 int
-#line 3492
+#line 3496
 ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3492
+#line 3496
 {
-#line 3492
+#line 3496
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3492
+#line 3496
 
-#line 3492
+#line 3496
  /* basic algorithm is:
-#line 3492
+#line 3496
   *   - ensure sane alignment of input data
-#line 3492
+#line 3496
   *   - copy (conversion happens automatically) input data
-#line 3492
+#line 3496
   *     to output
-#line 3492
+#line 3496
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3492
+#line 3496
   *     at next location for converted output
-#line 3492
+#line 3496
   */
-#line 3492
+#line 3496
   long i, j, ni;
-#line 3492
+#line 3496
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3492
+#line 3496
   double *xp;
-#line 3492
+#line 3496
   int nrange = 0;         /* number of range errors */
-#line 3492
+#line 3496
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3492
+#line 3496
   long cxp = (long) *((char**)xpp);
-#line 3492
+#line 3496
 
-#line 3492
+#line 3496
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3492
+#line 3496
   /* sjl: manually stripmine so we can limit amount of
-#line 3492
+#line 3496
    * vector work space reserved to LOOPCNT elements. Also
-#line 3492
+#line 3496
    * makes vectorisation easy */
-#line 3492
+#line 3496
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3492
+#line 3496
     ni=Min(nelems-j,LOOPCNT);
-#line 3492
+#line 3496
     if (realign) {
-#line 3492
+#line 3496
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3492
+#line 3496
       xp = tmp;
-#line 3492
+#line 3496
     } else {
-#line 3492
+#line 3496
       xp = (double *) *xpp;
-#line 3492
+#line 3496
     }
-#line 3492
+#line 3496
    /* copy the next block */
-#line 3492
+#line 3496
 #pragma cdir loopcnt=LOOPCNT
-#line 3492
+#line 3496
 #pragma cdir shortloop
-#line 3492
+#line 3496
     for (i=0; i<ni; i++) {
-#line 3492
+#line 3496
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3492
+#line 3496
      /* test for range errors (not always needed but do it anyway) */
-#line 3492
+#line 3496
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3492
+#line 3496
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3492
+#line 3496
       nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
-#line 3492
+#line 3496
     }
-#line 3492
+#line 3496
    /* update xpp and tp */
-#line 3492
+#line 3496
     if (realign) xp = (double *) *xpp;
-#line 3492
+#line 3496
     xp += ni;
-#line 3492
+#line 3496
     tp += ni;
-#line 3492
+#line 3496
     *xpp = (void*)xp;
-#line 3492
+#line 3496
   }
-#line 3492
+#line 3496
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3492
+#line 3496
 
-#line 3492
+#line 3496
 #else   /* not SX */
-#line 3492
+#line 3496
 	const char *xp = (const char *) *xpp;
-#line 3492
+#line 3496
 	int status = NC_NOERR;
-#line 3492
+#line 3496
 
-#line 3492
+#line 3496
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3492
+#line 3496
 	{
-#line 3492
+#line 3496
 		const int lstatus = ncx_get_double_uchar(xp, tp);
-#line 3492
+#line 3496
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3492
+#line 3496
 			status = lstatus;
-#line 3492
+#line 3496
 	}
-#line 3492
+#line 3496
 
-#line 3492
+#line 3496
 	*xpp = (const void *)xp;
-#line 3492
+#line 3496
 	return status;
-#line 3492
+#line 3496
 #endif
-#line 3492
+#line 3496
 }
-#line 3492
+#line 3496
 
 int
-#line 3493
+#line 3497
 ncx_getn_double_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3493
+#line 3497
 {
-#line 3493
+#line 3497
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3493
+#line 3497
 
-#line 3493
+#line 3497
  /* basic algorithm is:
-#line 3493
+#line 3497
   *   - ensure sane alignment of input data
-#line 3493
+#line 3497
   *   - copy (conversion happens automatically) input data
-#line 3493
+#line 3497
   *     to output
-#line 3493
+#line 3497
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3493
+#line 3497
   *     at next location for converted output
-#line 3493
+#line 3497
   */
-#line 3493
+#line 3497
   long i, j, ni;
-#line 3493
+#line 3497
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3493
+#line 3497
   double *xp;
-#line 3493
+#line 3497
   int nrange = 0;         /* number of range errors */
-#line 3493
+#line 3497
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3493
+#line 3497
   long cxp = (long) *((char**)xpp);
-#line 3493
+#line 3497
 
-#line 3493
+#line 3497
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3493
+#line 3497
   /* sjl: manually stripmine so we can limit amount of
-#line 3493
+#line 3497
    * vector work space reserved to LOOPCNT elements. Also
-#line 3493
+#line 3497
    * makes vectorisation easy */
-#line 3493
+#line 3497
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3493
+#line 3497
     ni=Min(nelems-j,LOOPCNT);
-#line 3493
+#line 3497
     if (realign) {
-#line 3493
+#line 3497
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3493
+#line 3497
       xp = tmp;
-#line 3493
+#line 3497
     } else {
-#line 3493
+#line 3497
       xp = (double *) *xpp;
-#line 3493
+#line 3497
     }
-#line 3493
+#line 3497
    /* copy the next block */
-#line 3493
+#line 3497
 #pragma cdir loopcnt=LOOPCNT
-#line 3493
+#line 3497
 #pragma cdir shortloop
-#line 3493
+#line 3497
     for (i=0; i<ni; i++) {
-#line 3493
+#line 3497
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3493
+#line 3497
      /* test for range errors (not always needed but do it anyway) */
-#line 3493
+#line 3497
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3493
+#line 3497
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3493
+#line 3497
       nrange += xp[i] > USHORT_MAX || xp[i] < 0;
-#line 3493
+#line 3497
     }
-#line 3493
+#line 3497
    /* update xpp and tp */
-#line 3493
+#line 3497
     if (realign) xp = (double *) *xpp;
-#line 3493
+#line 3497
     xp += ni;
-#line 3493
+#line 3497
     tp += ni;
-#line 3493
+#line 3497
     *xpp = (void*)xp;
-#line 3493
+#line 3497
   }
-#line 3493
+#line 3497
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3493
+#line 3497
 
-#line 3493
+#line 3497
 #else   /* not SX */
-#line 3493
+#line 3497
 	const char *xp = (const char *) *xpp;
-#line 3493
+#line 3497
 	int status = NC_NOERR;
-#line 3493
+#line 3497
 
-#line 3493
+#line 3497
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3493
+#line 3497
 	{
-#line 3493
+#line 3497
 		const int lstatus = ncx_get_double_ushort(xp, tp);
-#line 3493
+#line 3497
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3493
+#line 3497
 			status = lstatus;
-#line 3493
+#line 3497
 	}
-#line 3493
+#line 3497
 
-#line 3493
+#line 3497
 	*xpp = (const void *)xp;
-#line 3493
+#line 3497
 	return status;
-#line 3493
+#line 3497
 #endif
-#line 3493
+#line 3497
 }
-#line 3493
+#line 3497
 
 int
-#line 3494
+#line 3498
 ncx_getn_double_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3494
+#line 3498
 {
-#line 3494
+#line 3498
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3494
+#line 3498
 
-#line 3494
+#line 3498
  /* basic algorithm is:
-#line 3494
+#line 3498
   *   - ensure sane alignment of input data
-#line 3494
+#line 3498
   *   - copy (conversion happens automatically) input data
-#line 3494
+#line 3498
   *     to output
-#line 3494
+#line 3498
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3494
+#line 3498
   *     at next location for converted output
-#line 3494
+#line 3498
   */
-#line 3494
+#line 3498
   long i, j, ni;
-#line 3494
+#line 3498
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3494
+#line 3498
   double *xp;
-#line 3494
+#line 3498
   int nrange = 0;         /* number of range errors */
-#line 3494
+#line 3498
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3494
+#line 3498
   long cxp = (long) *((char**)xpp);
-#line 3494
+#line 3498
 
-#line 3494
+#line 3498
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3494
+#line 3498
   /* sjl: manually stripmine so we can limit amount of
-#line 3494
+#line 3498
    * vector work space reserved to LOOPCNT elements. Also
-#line 3494
+#line 3498
    * makes vectorisation easy */
-#line 3494
+#line 3498
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3494
+#line 3498
     ni=Min(nelems-j,LOOPCNT);
-#line 3494
+#line 3498
     if (realign) {
-#line 3494
+#line 3498
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3494
+#line 3498
       xp = tmp;
-#line 3494
+#line 3498
     } else {
-#line 3494
+#line 3498
       xp = (double *) *xpp;
-#line 3494
+#line 3498
     }
-#line 3494
+#line 3498
    /* copy the next block */
-#line 3494
+#line 3498
 #pragma cdir loopcnt=LOOPCNT
-#line 3494
+#line 3498
 #pragma cdir shortloop
-#line 3494
+#line 3498
     for (i=0; i<ni; i++) {
-#line 3494
+#line 3498
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3494
+#line 3498
      /* test for range errors (not always needed but do it anyway) */
-#line 3494
+#line 3498
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3494
+#line 3498
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3494
+#line 3498
       nrange += xp[i] > UINT_MAX || xp[i] < 0;
-#line 3494
+#line 3498
     }
-#line 3494
+#line 3498
    /* update xpp and tp */
-#line 3494
+#line 3498
     if (realign) xp = (double *) *xpp;
-#line 3494
+#line 3498
     xp += ni;
-#line 3494
+#line 3498
     tp += ni;
-#line 3494
+#line 3498
     *xpp = (void*)xp;
-#line 3494
+#line 3498
   }
-#line 3494
+#line 3498
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3494
+#line 3498
 
-#line 3494
+#line 3498
 #else   /* not SX */
-#line 3494
+#line 3498
 	const char *xp = (const char *) *xpp;
-#line 3494
+#line 3498
 	int status = NC_NOERR;
-#line 3494
+#line 3498
 
-#line 3494
+#line 3498
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3494
+#line 3498
 	{
-#line 3494
+#line 3498
 		const int lstatus = ncx_get_double_uint(xp, tp);
-#line 3494
+#line 3498
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3494
+#line 3498
 			status = lstatus;
-#line 3494
+#line 3498
 	}
-#line 3494
+#line 3498
 
-#line 3494
+#line 3498
 	*xpp = (const void *)xp;
-#line 3494
+#line 3498
 	return status;
-#line 3494
+#line 3498
 #endif
-#line 3494
+#line 3498
 }
-#line 3494
+#line 3498
 
 int
-#line 3495
+#line 3499
 ncx_getn_double_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3495
+#line 3499
 {
-#line 3495
+#line 3499
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3495
+#line 3499
 
-#line 3495
+#line 3499
  /* basic algorithm is:
-#line 3495
+#line 3499
   *   - ensure sane alignment of input data
-#line 3495
+#line 3499
   *   - copy (conversion happens automatically) input data
-#line 3495
+#line 3499
   *     to output
-#line 3495
+#line 3499
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3495
+#line 3499
   *     at next location for converted output
-#line 3495
+#line 3499
   */
-#line 3495
+#line 3499
   long i, j, ni;
-#line 3495
+#line 3499
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3495
+#line 3499
   double *xp;
-#line 3495
+#line 3499
   int nrange = 0;         /* number of range errors */
-#line 3495
+#line 3499
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3495
+#line 3499
   long cxp = (long) *((char**)xpp);
-#line 3495
+#line 3499
 
-#line 3495
+#line 3499
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3495
+#line 3499
   /* sjl: manually stripmine so we can limit amount of
-#line 3495
+#line 3499
    * vector work space reserved to LOOPCNT elements. Also
-#line 3495
+#line 3499
    * makes vectorisation easy */
-#line 3495
+#line 3499
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3495
+#line 3499
     ni=Min(nelems-j,LOOPCNT);
-#line 3495
+#line 3499
     if (realign) {
-#line 3495
+#line 3499
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_DOUBLE));
-#line 3495
+#line 3499
       xp = tmp;
-#line 3495
+#line 3499
     } else {
-#line 3495
+#line 3499
       xp = (double *) *xpp;
-#line 3495
+#line 3499
     }
-#line 3495
+#line 3499
    /* copy the next block */
-#line 3495
+#line 3499
 #pragma cdir loopcnt=LOOPCNT
-#line 3495
+#line 3499
 #pragma cdir shortloop
-#line 3495
+#line 3499
     for (i=0; i<ni; i++) {
-#line 3495
+#line 3499
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3495
+#line 3499
      /* test for range errors (not always needed but do it anyway) */
-#line 3495
+#line 3499
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3495
+#line 3499
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3495
+#line 3499
       nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
-#line 3495
+#line 3499
     }
-#line 3495
+#line 3499
    /* update xpp and tp */
-#line 3495
+#line 3499
     if (realign) xp = (double *) *xpp;
-#line 3495
+#line 3499
     xp += ni;
-#line 3495
+#line 3499
     tp += ni;
-#line 3495
+#line 3499
     *xpp = (void*)xp;
-#line 3495
+#line 3499
   }
-#line 3495
+#line 3499
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3495
+#line 3499
 
-#line 3495
+#line 3499
 #else   /* not SX */
-#line 3495
+#line 3499
 	const char *xp = (const char *) *xpp;
-#line 3495
+#line 3499
 	int status = NC_NOERR;
-#line 3495
+#line 3499
 
-#line 3495
+#line 3499
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3495
+#line 3499
 	{
-#line 3495
+#line 3499
 		const int lstatus = ncx_get_double_ulonglong(xp, tp);
-#line 3495
+#line 3499
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3495
+#line 3499
 			status = lstatus;
-#line 3495
+#line 3499
 	}
-#line 3495
+#line 3499
 
-#line 3495
+#line 3499
 	*xpp = (const void *)xp;
-#line 3495
+#line 3499
 	return status;
-#line 3495
+#line 3499
 #endif
-#line 3495
+#line 3499
 }
-#line 3495
+#line 3499
 
 
 #if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT)
@@ -29753,123 +29757,123 @@ ncx_putn_double_double(void **xpp, size_t ndoubles, const double *ip, void *fill
 	while (ip < end)
 	{
 	const struct vax_double *const vdp =
-#line 3518
+#line 3522
 			(const struct vax_double *)ip;
-#line 3518
+#line 3522
 	struct ieee_double *const idp =
-#line 3518
+#line 3522
 			 (struct ieee_double *) (*xpp);
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 	if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) &&
-#line 3518
+#line 3522
 		(vdp->mantissa3 == dbl_limits[0].d.mantissa3) &&
-#line 3518
+#line 3522
 		(vdp->mantissa2 == dbl_limits[0].d.mantissa2) &&
-#line 3518
+#line 3522
 		(vdp->mantissa1 == dbl_limits[0].d.mantissa1) &&
-#line 3518
+#line 3522
 		(vdp->exp == dbl_limits[0].d.exp))
-#line 3518
+#line 3522
 	{
-#line 3518
+#line 3522
 		*idp = dbl_limits[0].ieee;
-#line 3518
+#line 3522
 		goto shipit;
-#line 3518
+#line 3522
 	}
-#line 3518
+#line 3522
 	if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) &&
-#line 3518
+#line 3522
 		(vdp->mantissa3 == dbl_limits[1].d.mantissa3) &&
-#line 3518
+#line 3522
 		(vdp->mantissa2 == dbl_limits[1].d.mantissa2) &&
-#line 3518
+#line 3522
 		(vdp->mantissa1 == dbl_limits[1].d.mantissa1) &&
-#line 3518
+#line 3522
 		(vdp->exp == dbl_limits[1].d.exp))
-#line 3518
+#line 3522
 	{
-#line 3518
+#line 3522
 		*idp = dbl_limits[1].ieee;
-#line 3518
+#line 3522
 		goto shipit;
-#line 3518
+#line 3522
 	}
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 	{
-#line 3518
+#line 3522
 		unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 		unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) |
-#line 3518
+#line 3522
 			(vdp->mantissa3 << 13) |
-#line 3518
+#line 3522
 			((vdp->mantissa4 >> 3) & MASK(13));
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 		unsigned mant_hi = (vdp->mantissa1 << 13)
-#line 3518
+#line 3522
 				 | (vdp->mantissa2 >> 3);
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 		if ((vdp->mantissa4 & 7) > 4)
-#line 3518
+#line 3522
 		{
-#line 3518
+#line 3522
 			/* round up */
-#line 3518
+#line 3522
 			mant_lo++;
-#line 3518
+#line 3522
 			if (mant_lo == 0)
-#line 3518
+#line 3522
 			{
-#line 3518
+#line 3522
 				mant_hi++;
-#line 3518
+#line 3522
 				if (mant_hi > 0xffffff)
-#line 3518
+#line 3522
 				{
-#line 3518
+#line 3522
 					mant_hi = 0;
-#line 3518
+#line 3522
 					exp++;
-#line 3518
+#line 3522
 				}
-#line 3518
+#line 3522
 			}
-#line 3518
+#line 3522
 		}
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 		idp->mant_lo = SWAP4(mant_lo);
-#line 3518
+#line 3522
 		idp->mant_6 = mant_hi >> 16;
-#line 3518
+#line 3522
 		idp->mant_5 = (mant_hi & 0xff00) >> 8;
-#line 3518
+#line 3522
 		idp->mant_4 = mant_hi;
-#line 3518
+#line 3522
 		idp->exp_hi = exp >> 4;
-#line 3518
+#line 3522
 		idp->exp_lo = exp;
-#line 3518
+#line 3522
 	}
-#line 3518
+#line 3522
 
-#line 3518
+#line 3522
 	shipit:
-#line 3518
+#line 3522
 		idp->sign = vdp->sign;
-#line 3518
+#line 3522
 
 		ip++;
 		*xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE;
@@ -29896,1394 +29900,1394 @@ ncx_putn_double_double(void **xpp, size_t nelems, const double *tp, void *fillp)
 }
 #endif
 int
-#line 3543
+#line 3547
 ncx_putn_double_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3543
+#line 3547
 {
-#line 3543
+#line 3547
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3543
+#line 3547
 
-#line 3543
+#line 3547
  /* basic algorithm is:
-#line 3543
+#line 3547
   *   - ensure sane alignment of output data
-#line 3543
+#line 3547
   *   - copy (conversion happens automatically) input data
-#line 3543
+#line 3547
   *     to output
-#line 3543
+#line 3547
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3543
+#line 3547
   *     at next location for converted output
-#line 3543
+#line 3547
   */
-#line 3543
+#line 3547
   long i, j, ni;
-#line 3543
+#line 3547
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3543
+#line 3547
   double *xp;
-#line 3543
+#line 3547
   int nrange = 0;         /* number of range errors */
-#line 3543
+#line 3547
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3543
+#line 3547
   long cxp = (long) *((char**)xpp);
-#line 3543
+#line 3547
 
-#line 3543
+#line 3547
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3543
+#line 3547
   /* sjl: manually stripmine so we can limit amount of
-#line 3543
+#line 3547
    * vector work space reserved to LOOPCNT elements. Also
-#line 3543
+#line 3547
    * makes vectorisation easy */
-#line 3543
+#line 3547
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3543
+#line 3547
     ni=Min(nelems-j,LOOPCNT);
-#line 3543
+#line 3547
     if (realign) {
-#line 3543
+#line 3547
       xp = tmp;
-#line 3543
+#line 3547
     } else {
-#line 3543
+#line 3547
       xp = (double *) *xpp;
-#line 3543
+#line 3547
     }
-#line 3543
+#line 3547
    /* copy the next block */
-#line 3543
+#line 3547
 #pragma cdir loopcnt=LOOPCNT
-#line 3543
+#line 3547
 #pragma cdir shortloop
-#line 3543
+#line 3547
     for (i=0; i<ni; i++) {
-#line 3543
+#line 3547
       /* the normal case: */
-#line 3543
+#line 3547
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3543
+#line 3547
      /* test for range errors (not always needed but do it anyway) */
-#line 3543
+#line 3547
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3543
+#line 3547
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3543
+#line 3547
       nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
-#line 3543
+#line 3547
     }
-#line 3543
+#line 3547
    /* copy workspace back if necessary */
-#line 3543
+#line 3547
     if (realign) {
-#line 3543
+#line 3547
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3543
+#line 3547
       xp = (double *) *xpp;
-#line 3543
+#line 3547
     }
-#line 3543
+#line 3547
    /* update xpp and tp */
-#line 3543
+#line 3547
     xp += ni;
-#line 3543
+#line 3547
     tp += ni;
-#line 3543
+#line 3547
     *xpp = (void*)xp;
-#line 3543
+#line 3547
   }
-#line 3543
+#line 3547
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3543
+#line 3547
 
-#line 3543
+#line 3547
 #else   /* not SX */
-#line 3543
+#line 3547
 
-#line 3543
+#line 3547
 	char *xp = (char *) *xpp;
-#line 3543
+#line 3547
 	int status = NC_NOERR;
-#line 3543
+#line 3547
 
-#line 3543
+#line 3547
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3543
+#line 3547
 	{
-#line 3543
+#line 3547
 		int lstatus = ncx_put_double_schar(xp, tp, fillp);
-#line 3543
+#line 3547
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3543
+#line 3547
 			status = lstatus;
-#line 3543
+#line 3547
 	}
-#line 3543
+#line 3547
 
-#line 3543
+#line 3547
 	*xpp = (void *)xp;
-#line 3543
+#line 3547
 	return status;
-#line 3543
+#line 3547
 #endif
-#line 3543
+#line 3547
 }
-#line 3543
+#line 3547
 
 int
-#line 3544
+#line 3548
 ncx_putn_double_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3544
+#line 3548
 {
-#line 3544
+#line 3548
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3544
+#line 3548
 
-#line 3544
+#line 3548
  /* basic algorithm is:
-#line 3544
+#line 3548
   *   - ensure sane alignment of output data
-#line 3544
+#line 3548
   *   - copy (conversion happens automatically) input data
-#line 3544
+#line 3548
   *     to output
-#line 3544
+#line 3548
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3544
+#line 3548
   *     at next location for converted output
-#line 3544
+#line 3548
   */
-#line 3544
+#line 3548
   long i, j, ni;
-#line 3544
+#line 3548
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3544
+#line 3548
   double *xp;
-#line 3544
+#line 3548
   int nrange = 0;         /* number of range errors */
-#line 3544
+#line 3548
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3544
+#line 3548
   long cxp = (long) *((char**)xpp);
-#line 3544
+#line 3548
 
-#line 3544
+#line 3548
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3544
+#line 3548
   /* sjl: manually stripmine so we can limit amount of
-#line 3544
+#line 3548
    * vector work space reserved to LOOPCNT elements. Also
-#line 3544
+#line 3548
    * makes vectorisation easy */
-#line 3544
+#line 3548
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3544
+#line 3548
     ni=Min(nelems-j,LOOPCNT);
-#line 3544
+#line 3548
     if (realign) {
-#line 3544
+#line 3548
       xp = tmp;
-#line 3544
+#line 3548
     } else {
-#line 3544
+#line 3548
       xp = (double *) *xpp;
-#line 3544
+#line 3548
     }
-#line 3544
+#line 3548
    /* copy the next block */
-#line 3544
+#line 3548
 #pragma cdir loopcnt=LOOPCNT
-#line 3544
+#line 3548
 #pragma cdir shortloop
-#line 3544
+#line 3548
     for (i=0; i<ni; i++) {
-#line 3544
+#line 3548
       /* the normal case: */
-#line 3544
+#line 3548
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3544
+#line 3548
      /* test for range errors (not always needed but do it anyway) */
-#line 3544
+#line 3548
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3544
+#line 3548
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3544
+#line 3548
       nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
-#line 3544
+#line 3548
     }
-#line 3544
+#line 3548
    /* copy workspace back if necessary */
-#line 3544
+#line 3548
     if (realign) {
-#line 3544
+#line 3548
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3544
+#line 3548
       xp = (double *) *xpp;
-#line 3544
+#line 3548
     }
-#line 3544
+#line 3548
    /* update xpp and tp */
-#line 3544
+#line 3548
     xp += ni;
-#line 3544
+#line 3548
     tp += ni;
-#line 3544
+#line 3548
     *xpp = (void*)xp;
-#line 3544
+#line 3548
   }
-#line 3544
+#line 3548
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3544
+#line 3548
 
-#line 3544
+#line 3548
 #else   /* not SX */
-#line 3544
+#line 3548
 
-#line 3544
+#line 3548
 	char *xp = (char *) *xpp;
-#line 3544
+#line 3548
 	int status = NC_NOERR;
-#line 3544
+#line 3548
 
-#line 3544
+#line 3548
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3544
+#line 3548
 	{
-#line 3544
+#line 3548
 		int lstatus = ncx_put_double_short(xp, tp, fillp);
-#line 3544
+#line 3548
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3544
+#line 3548
 			status = lstatus;
-#line 3544
+#line 3548
 	}
-#line 3544
+#line 3548
 
-#line 3544
+#line 3548
 	*xpp = (void *)xp;
-#line 3544
+#line 3548
 	return status;
-#line 3544
+#line 3548
 #endif
-#line 3544
+#line 3548
 }
-#line 3544
+#line 3548
 
 int
-#line 3545
+#line 3549
 ncx_putn_double_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3545
+#line 3549
 {
-#line 3545
+#line 3549
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3545
+#line 3549
 
-#line 3545
+#line 3549
  /* basic algorithm is:
-#line 3545
+#line 3549
   *   - ensure sane alignment of output data
-#line 3545
+#line 3549
   *   - copy (conversion happens automatically) input data
-#line 3545
+#line 3549
   *     to output
-#line 3545
+#line 3549
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3545
+#line 3549
   *     at next location for converted output
-#line 3545
+#line 3549
   */
-#line 3545
+#line 3549
   long i, j, ni;
-#line 3545
+#line 3549
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3545
+#line 3549
   double *xp;
-#line 3545
+#line 3549
   int nrange = 0;         /* number of range errors */
-#line 3545
+#line 3549
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3545
+#line 3549
   long cxp = (long) *((char**)xpp);
-#line 3545
+#line 3549
 
-#line 3545
+#line 3549
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3545
+#line 3549
   /* sjl: manually stripmine so we can limit amount of
-#line 3545
+#line 3549
    * vector work space reserved to LOOPCNT elements. Also
-#line 3545
+#line 3549
    * makes vectorisation easy */
-#line 3545
+#line 3549
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3545
+#line 3549
     ni=Min(nelems-j,LOOPCNT);
-#line 3545
+#line 3549
     if (realign) {
-#line 3545
+#line 3549
       xp = tmp;
-#line 3545
+#line 3549
     } else {
-#line 3545
+#line 3549
       xp = (double *) *xpp;
-#line 3545
+#line 3549
     }
-#line 3545
+#line 3549
    /* copy the next block */
-#line 3545
+#line 3549
 #pragma cdir loopcnt=LOOPCNT
-#line 3545
+#line 3549
 #pragma cdir shortloop
-#line 3545
+#line 3549
     for (i=0; i<ni; i++) {
-#line 3545
+#line 3549
       /* the normal case: */
-#line 3545
+#line 3549
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3545
+#line 3549
      /* test for range errors (not always needed but do it anyway) */
-#line 3545
+#line 3549
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3545
+#line 3549
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3545
+#line 3549
       nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
-#line 3545
+#line 3549
     }
-#line 3545
+#line 3549
    /* copy workspace back if necessary */
-#line 3545
+#line 3549
     if (realign) {
-#line 3545
+#line 3549
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3545
+#line 3549
       xp = (double *) *xpp;
-#line 3545
+#line 3549
     }
-#line 3545
+#line 3549
    /* update xpp and tp */
-#line 3545
+#line 3549
     xp += ni;
-#line 3545
+#line 3549
     tp += ni;
-#line 3545
+#line 3549
     *xpp = (void*)xp;
-#line 3545
+#line 3549
   }
-#line 3545
+#line 3549
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3545
+#line 3549
 
-#line 3545
+#line 3549
 #else   /* not SX */
-#line 3545
+#line 3549
 
-#line 3545
+#line 3549
 	char *xp = (char *) *xpp;
-#line 3545
+#line 3549
 	int status = NC_NOERR;
-#line 3545
+#line 3549
 
-#line 3545
+#line 3549
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3545
+#line 3549
 	{
-#line 3545
+#line 3549
 		int lstatus = ncx_put_double_int(xp, tp, fillp);
-#line 3545
+#line 3549
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3545
+#line 3549
 			status = lstatus;
-#line 3545
+#line 3549
 	}
-#line 3545
+#line 3549
 
-#line 3545
+#line 3549
 	*xpp = (void *)xp;
-#line 3545
+#line 3549
 	return status;
-#line 3545
+#line 3549
 #endif
-#line 3545
+#line 3549
 }
-#line 3545
+#line 3549
 
 int
-#line 3546
+#line 3550
 ncx_putn_double_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3546
+#line 3550
 {
-#line 3546
+#line 3550
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3546
+#line 3550
 
-#line 3546
+#line 3550
  /* basic algorithm is:
-#line 3546
+#line 3550
   *   - ensure sane alignment of output data
-#line 3546
+#line 3550
   *   - copy (conversion happens automatically) input data
-#line 3546
+#line 3550
   *     to output
-#line 3546
+#line 3550
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3546
+#line 3550
   *     at next location for converted output
-#line 3546
+#line 3550
   */
-#line 3546
+#line 3550
   long i, j, ni;
-#line 3546
+#line 3550
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3546
+#line 3550
   double *xp;
-#line 3546
+#line 3550
   int nrange = 0;         /* number of range errors */
-#line 3546
+#line 3550
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3546
+#line 3550
   long cxp = (long) *((char**)xpp);
-#line 3546
+#line 3550
 
-#line 3546
+#line 3550
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3546
+#line 3550
   /* sjl: manually stripmine so we can limit amount of
-#line 3546
+#line 3550
    * vector work space reserved to LOOPCNT elements. Also
-#line 3546
+#line 3550
    * makes vectorisation easy */
-#line 3546
+#line 3550
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3546
+#line 3550
     ni=Min(nelems-j,LOOPCNT);
-#line 3546
+#line 3550
     if (realign) {
-#line 3546
+#line 3550
       xp = tmp;
-#line 3546
+#line 3550
     } else {
-#line 3546
+#line 3550
       xp = (double *) *xpp;
-#line 3546
+#line 3550
     }
-#line 3546
+#line 3550
    /* copy the next block */
-#line 3546
+#line 3550
 #pragma cdir loopcnt=LOOPCNT
-#line 3546
+#line 3550
 #pragma cdir shortloop
-#line 3546
+#line 3550
     for (i=0; i<ni; i++) {
-#line 3546
+#line 3550
       /* the normal case: */
-#line 3546
+#line 3550
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3546
+#line 3550
      /* test for range errors (not always needed but do it anyway) */
-#line 3546
+#line 3550
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3546
+#line 3550
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3546
+#line 3550
       nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
-#line 3546
+#line 3550
     }
-#line 3546
+#line 3550
    /* copy workspace back if necessary */
-#line 3546
+#line 3550
     if (realign) {
-#line 3546
+#line 3550
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3546
+#line 3550
       xp = (double *) *xpp;
-#line 3546
+#line 3550
     }
-#line 3546
+#line 3550
    /* update xpp and tp */
-#line 3546
+#line 3550
     xp += ni;
-#line 3546
+#line 3550
     tp += ni;
-#line 3546
+#line 3550
     *xpp = (void*)xp;
-#line 3546
+#line 3550
   }
-#line 3546
+#line 3550
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3546
+#line 3550
 
-#line 3546
+#line 3550
 #else   /* not SX */
-#line 3546
+#line 3550
 
-#line 3546
+#line 3550
 	char *xp = (char *) *xpp;
-#line 3546
+#line 3550
 	int status = NC_NOERR;
-#line 3546
+#line 3550
 
-#line 3546
+#line 3550
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3546
+#line 3550
 	{
-#line 3546
+#line 3550
 		int lstatus = ncx_put_double_long(xp, tp, fillp);
-#line 3546
+#line 3550
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3546
+#line 3550
 			status = lstatus;
-#line 3546
+#line 3550
 	}
-#line 3546
+#line 3550
 
-#line 3546
+#line 3550
 	*xpp = (void *)xp;
-#line 3546
+#line 3550
 	return status;
-#line 3546
+#line 3550
 #endif
-#line 3546
+#line 3550
 }
-#line 3546
+#line 3550
 
 int
-#line 3547
+#line 3551
 ncx_putn_double_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3547
+#line 3551
 {
-#line 3547
+#line 3551
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3547
+#line 3551
 
-#line 3547
+#line 3551
  /* basic algorithm is:
-#line 3547
+#line 3551
   *   - ensure sane alignment of output data
-#line 3547
+#line 3551
   *   - copy (conversion happens automatically) input data
-#line 3547
+#line 3551
   *     to output
-#line 3547
+#line 3551
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3547
+#line 3551
   *     at next location for converted output
-#line 3547
+#line 3551
   */
-#line 3547
+#line 3551
   long i, j, ni;
-#line 3547
+#line 3551
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3547
+#line 3551
   double *xp;
-#line 3547
+#line 3551
   int nrange = 0;         /* number of range errors */
-#line 3547
+#line 3551
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3547
+#line 3551
   long cxp = (long) *((char**)xpp);
-#line 3547
+#line 3551
 
-#line 3547
+#line 3551
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3547
+#line 3551
   /* sjl: manually stripmine so we can limit amount of
-#line 3547
+#line 3551
    * vector work space reserved to LOOPCNT elements. Also
-#line 3547
+#line 3551
    * makes vectorisation easy */
-#line 3547
+#line 3551
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3547
+#line 3551
     ni=Min(nelems-j,LOOPCNT);
-#line 3547
+#line 3551
     if (realign) {
-#line 3547
+#line 3551
       xp = tmp;
-#line 3547
+#line 3551
     } else {
-#line 3547
+#line 3551
       xp = (double *) *xpp;
-#line 3547
+#line 3551
     }
-#line 3547
+#line 3551
    /* copy the next block */
-#line 3547
+#line 3551
 #pragma cdir loopcnt=LOOPCNT
-#line 3547
+#line 3551
 #pragma cdir shortloop
-#line 3547
+#line 3551
     for (i=0; i<ni; i++) {
-#line 3547
+#line 3551
       /* the normal case: */
-#line 3547
+#line 3551
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3547
+#line 3551
      /* test for range errors (not always needed but do it anyway) */
-#line 3547
+#line 3551
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3547
+#line 3551
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3547
+#line 3551
       nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
-#line 3547
+#line 3551
     }
-#line 3547
+#line 3551
    /* copy workspace back if necessary */
-#line 3547
+#line 3551
     if (realign) {
-#line 3547
+#line 3551
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3547
+#line 3551
       xp = (double *) *xpp;
-#line 3547
+#line 3551
     }
-#line 3547
+#line 3551
    /* update xpp and tp */
-#line 3547
+#line 3551
     xp += ni;
-#line 3547
+#line 3551
     tp += ni;
-#line 3547
+#line 3551
     *xpp = (void*)xp;
-#line 3547
+#line 3551
   }
-#line 3547
+#line 3551
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3547
+#line 3551
 
-#line 3547
+#line 3551
 #else   /* not SX */
-#line 3547
+#line 3551
 
-#line 3547
+#line 3551
 	char *xp = (char *) *xpp;
-#line 3547
+#line 3551
 	int status = NC_NOERR;
-#line 3547
+#line 3551
 
-#line 3547
+#line 3551
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3547
+#line 3551
 	{
-#line 3547
+#line 3551
 		int lstatus = ncx_put_double_float(xp, tp, fillp);
-#line 3547
+#line 3551
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3547
+#line 3551
 			status = lstatus;
-#line 3547
+#line 3551
 	}
-#line 3547
+#line 3551
 
-#line 3547
+#line 3551
 	*xpp = (void *)xp;
-#line 3547
+#line 3551
 	return status;
-#line 3547
+#line 3551
 #endif
-#line 3547
+#line 3551
 }
-#line 3547
+#line 3551
 
 int
-#line 3548
+#line 3552
 ncx_putn_double_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
-#line 3548
+#line 3552
 {
-#line 3548
+#line 3552
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3548
+#line 3552
 
-#line 3548
+#line 3552
  /* basic algorithm is:
-#line 3548
+#line 3552
   *   - ensure sane alignment of output data
-#line 3548
+#line 3552
   *   - copy (conversion happens automatically) input data
-#line 3548
+#line 3552
   *     to output
-#line 3548
+#line 3552
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3548
+#line 3552
   *     at next location for converted output
-#line 3548
+#line 3552
   */
-#line 3548
+#line 3552
   long i, j, ni;
-#line 3548
+#line 3552
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3548
+#line 3552
   double *xp;
-#line 3548
+#line 3552
   int nrange = 0;         /* number of range errors */
-#line 3548
+#line 3552
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3548
+#line 3552
   long cxp = (long) *((char**)xpp);
-#line 3548
+#line 3552
 
-#line 3548
+#line 3552
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3548
+#line 3552
   /* sjl: manually stripmine so we can limit amount of
-#line 3548
+#line 3552
    * vector work space reserved to LOOPCNT elements. Also
-#line 3548
+#line 3552
    * makes vectorisation easy */
-#line 3548
+#line 3552
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3548
+#line 3552
     ni=Min(nelems-j,LOOPCNT);
-#line 3548
+#line 3552
     if (realign) {
-#line 3548
+#line 3552
       xp = tmp;
-#line 3548
+#line 3552
     } else {
-#line 3548
+#line 3552
       xp = (double *) *xpp;
-#line 3548
+#line 3552
     }
-#line 3548
+#line 3552
    /* copy the next block */
-#line 3548
+#line 3552
 #pragma cdir loopcnt=LOOPCNT
-#line 3548
+#line 3552
 #pragma cdir shortloop
-#line 3548
+#line 3552
     for (i=0; i<ni; i++) {
-#line 3548
+#line 3552
       /* the normal case: */
-#line 3548
+#line 3552
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3548
+#line 3552
      /* test for range errors (not always needed but do it anyway) */
-#line 3548
+#line 3552
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3548
+#line 3552
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3548
+#line 3552
       nrange += tp[i] > X_DOUBLE_MAX || tp[i] < X_DOUBLE_MIN;
-#line 3548
+#line 3552
     }
-#line 3548
+#line 3552
    /* copy workspace back if necessary */
-#line 3548
+#line 3552
     if (realign) {
-#line 3548
+#line 3552
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3548
+#line 3552
       xp = (double *) *xpp;
-#line 3548
+#line 3552
     }
-#line 3548
+#line 3552
    /* update xpp and tp */
-#line 3548
+#line 3552
     xp += ni;
-#line 3548
+#line 3552
     tp += ni;
-#line 3548
+#line 3552
     *xpp = (void*)xp;
-#line 3548
+#line 3552
   }
-#line 3548
+#line 3552
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3548
+#line 3552
 
-#line 3548
+#line 3552
 #else   /* not SX */
-#line 3548
+#line 3552
 
-#line 3548
+#line 3552
 	char *xp = (char *) *xpp;
-#line 3548
+#line 3552
 	int status = NC_NOERR;
-#line 3548
+#line 3552
 
-#line 3548
+#line 3552
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3548
+#line 3552
 	{
-#line 3548
+#line 3552
 		int lstatus = ncx_put_double_longlong(xp, tp, fillp);
-#line 3548
+#line 3552
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3548
+#line 3552
 			status = lstatus;
-#line 3548
+#line 3552
 	}
-#line 3548
+#line 3552
 
-#line 3548
+#line 3552
 	*xpp = (void *)xp;
-#line 3548
+#line 3552
 	return status;
-#line 3548
+#line 3552
 #endif
-#line 3548
+#line 3552
 }
-#line 3548
+#line 3552
 
 int
-#line 3549
+#line 3553
 ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 3549
+#line 3553
 {
-#line 3549
+#line 3553
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3549
+#line 3553
 
-#line 3549
+#line 3553
  /* basic algorithm is:
-#line 3549
+#line 3553
   *   - ensure sane alignment of output data
-#line 3549
+#line 3553
   *   - copy (conversion happens automatically) input data
-#line 3549
+#line 3553
   *     to output
-#line 3549
+#line 3553
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3549
+#line 3553
   *     at next location for converted output
-#line 3549
+#line 3553
   */
-#line 3549
+#line 3553
   long i, j, ni;
-#line 3549
+#line 3553
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3549
+#line 3553
   double *xp;
-#line 3549
+#line 3553
   int nrange = 0;         /* number of range errors */
-#line 3549
+#line 3553
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3549
+#line 3553
   long cxp = (long) *((char**)xpp);
-#line 3549
+#line 3553
 
-#line 3549
+#line 3553
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3549
+#line 3553
   /* sjl: manually stripmine so we can limit amount of
-#line 3549
+#line 3553
    * vector work space reserved to LOOPCNT elements. Also
-#line 3549
+#line 3553
    * makes vectorisation easy */
-#line 3549
+#line 3553
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3549
+#line 3553
     ni=Min(nelems-j,LOOPCNT);
-#line 3549
+#line 3553
     if (realign) {
-#line 3549
+#line 3553
       xp = tmp;
-#line 3549
+#line 3553
     } else {
-#line 3549
+#line 3553
       xp = (double *) *xpp;
-#line 3549
+#line 3553
     }
-#line 3549
+#line 3553
    /* copy the next block */
-#line 3549
+#line 3553
 #pragma cdir loopcnt=LOOPCNT
-#line 3549
+#line 3553
 #pragma cdir shortloop
-#line 3549
+#line 3553
     for (i=0; i<ni; i++) {
-#line 3549
+#line 3553
       /* the normal case: */
-#line 3549
+#line 3553
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3549
+#line 3553
      /* test for range errors (not always needed but do it anyway) */
-#line 3549
+#line 3553
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3549
+#line 3553
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3549
+#line 3553
       nrange += tp[i] > X_DOUBLE_MAX ;
-#line 3549
+#line 3553
     }
-#line 3549
+#line 3553
    /* copy workspace back if necessary */
-#line 3549
+#line 3553
     if (realign) {
-#line 3549
+#line 3553
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3549
+#line 3553
       xp = (double *) *xpp;
-#line 3549
+#line 3553
     }
-#line 3549
+#line 3553
    /* update xpp and tp */
-#line 3549
+#line 3553
     xp += ni;
-#line 3549
+#line 3553
     tp += ni;
-#line 3549
+#line 3553
     *xpp = (void*)xp;
-#line 3549
+#line 3553
   }
-#line 3549
+#line 3553
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3549
+#line 3553
 
-#line 3549
+#line 3553
 #else   /* not SX */
-#line 3549
+#line 3553
 
-#line 3549
+#line 3553
 	char *xp = (char *) *xpp;
-#line 3549
+#line 3553
 	int status = NC_NOERR;
-#line 3549
+#line 3553
 
-#line 3549
+#line 3553
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3549
+#line 3553
 	{
-#line 3549
+#line 3553
 		int lstatus = ncx_put_double_uchar(xp, tp, fillp);
-#line 3549
+#line 3553
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3549
+#line 3553
 			status = lstatus;
-#line 3549
+#line 3553
 	}
-#line 3549
+#line 3553
 
-#line 3549
+#line 3553
 	*xpp = (void *)xp;
-#line 3549
+#line 3553
 	return status;
-#line 3549
+#line 3553
 #endif
-#line 3549
+#line 3553
 }
-#line 3549
+#line 3553
 
 int
-#line 3550
+#line 3554
 ncx_putn_double_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3550
+#line 3554
 {
-#line 3550
+#line 3554
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3550
+#line 3554
 
-#line 3550
+#line 3554
  /* basic algorithm is:
-#line 3550
+#line 3554
   *   - ensure sane alignment of output data
-#line 3550
+#line 3554
   *   - copy (conversion happens automatically) input data
-#line 3550
+#line 3554
   *     to output
-#line 3550
+#line 3554
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3550
+#line 3554
   *     at next location for converted output
-#line 3550
+#line 3554
   */
-#line 3550
+#line 3554
   long i, j, ni;
-#line 3550
+#line 3554
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3550
+#line 3554
   double *xp;
-#line 3550
+#line 3554
   int nrange = 0;         /* number of range errors */
-#line 3550
+#line 3554
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3550
+#line 3554
   long cxp = (long) *((char**)xpp);
-#line 3550
+#line 3554
 
-#line 3550
+#line 3554
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3550
+#line 3554
   /* sjl: manually stripmine so we can limit amount of
-#line 3550
+#line 3554
    * vector work space reserved to LOOPCNT elements. Also
-#line 3550
+#line 3554
    * makes vectorisation easy */
-#line 3550
+#line 3554
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3550
+#line 3554
     ni=Min(nelems-j,LOOPCNT);
-#line 3550
+#line 3554
     if (realign) {
-#line 3550
+#line 3554
       xp = tmp;
-#line 3550
+#line 3554
     } else {
-#line 3550
+#line 3554
       xp = (double *) *xpp;
-#line 3550
+#line 3554
     }
-#line 3550
+#line 3554
    /* copy the next block */
-#line 3550
+#line 3554
 #pragma cdir loopcnt=LOOPCNT
-#line 3550
+#line 3554
 #pragma cdir shortloop
-#line 3550
+#line 3554
     for (i=0; i<ni; i++) {
-#line 3550
+#line 3554
       /* the normal case: */
-#line 3550
+#line 3554
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3550
+#line 3554
      /* test for range errors (not always needed but do it anyway) */
-#line 3550
+#line 3554
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3550
+#line 3554
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3550
+#line 3554
       nrange += tp[i] > X_DOUBLE_MAX ;
-#line 3550
+#line 3554
     }
-#line 3550
+#line 3554
    /* copy workspace back if necessary */
-#line 3550
+#line 3554
     if (realign) {
-#line 3550
+#line 3554
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3550
+#line 3554
       xp = (double *) *xpp;
-#line 3550
+#line 3554
     }
-#line 3550
+#line 3554
    /* update xpp and tp */
-#line 3550
+#line 3554
     xp += ni;
-#line 3550
+#line 3554
     tp += ni;
-#line 3550
+#line 3554
     *xpp = (void*)xp;
-#line 3550
+#line 3554
   }
-#line 3550
+#line 3554
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3550
+#line 3554
 
-#line 3550
+#line 3554
 #else   /* not SX */
-#line 3550
+#line 3554
 
-#line 3550
+#line 3554
 	char *xp = (char *) *xpp;
-#line 3550
+#line 3554
 	int status = NC_NOERR;
-#line 3550
+#line 3554
 
-#line 3550
+#line 3554
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3550
+#line 3554
 	{
-#line 3550
+#line 3554
 		int lstatus = ncx_put_double_ushort(xp, tp, fillp);
-#line 3550
+#line 3554
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3550
+#line 3554
 			status = lstatus;
-#line 3550
+#line 3554
 	}
-#line 3550
+#line 3554
 
-#line 3550
+#line 3554
 	*xpp = (void *)xp;
-#line 3550
+#line 3554
 	return status;
-#line 3550
+#line 3554
 #endif
-#line 3550
+#line 3554
 }
-#line 3550
+#line 3554
 
 int
-#line 3551
+#line 3555
 ncx_putn_double_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
-#line 3551
+#line 3555
 {
-#line 3551
+#line 3555
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3551
+#line 3555
 
-#line 3551
+#line 3555
  /* basic algorithm is:
-#line 3551
+#line 3555
   *   - ensure sane alignment of output data
-#line 3551
+#line 3555
   *   - copy (conversion happens automatically) input data
-#line 3551
+#line 3555
   *     to output
-#line 3551
+#line 3555
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3551
+#line 3555
   *     at next location for converted output
-#line 3551
+#line 3555
   */
-#line 3551
+#line 3555
   long i, j, ni;
-#line 3551
+#line 3555
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3551
+#line 3555
   double *xp;
-#line 3551
+#line 3555
   int nrange = 0;         /* number of range errors */
-#line 3551
+#line 3555
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3551
+#line 3555
   long cxp = (long) *((char**)xpp);
-#line 3551
+#line 3555
 
-#line 3551
+#line 3555
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3551
+#line 3555
   /* sjl: manually stripmine so we can limit amount of
-#line 3551
+#line 3555
    * vector work space reserved to LOOPCNT elements. Also
-#line 3551
+#line 3555
    * makes vectorisation easy */
-#line 3551
+#line 3555
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3551
+#line 3555
     ni=Min(nelems-j,LOOPCNT);
-#line 3551
+#line 3555
     if (realign) {
-#line 3551
+#line 3555
       xp = tmp;
-#line 3551
+#line 3555
     } else {
-#line 3551
+#line 3555
       xp = (double *) *xpp;
-#line 3551
+#line 3555
     }
-#line 3551
+#line 3555
    /* copy the next block */
-#line 3551
+#line 3555
 #pragma cdir loopcnt=LOOPCNT
-#line 3551
+#line 3555
 #pragma cdir shortloop
-#line 3551
+#line 3555
     for (i=0; i<ni; i++) {
-#line 3551
+#line 3555
       /* the normal case: */
-#line 3551
+#line 3555
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3551
+#line 3555
      /* test for range errors (not always needed but do it anyway) */
-#line 3551
+#line 3555
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3551
+#line 3555
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3551
+#line 3555
       nrange += tp[i] > X_DOUBLE_MAX ;
-#line 3551
+#line 3555
     }
-#line 3551
+#line 3555
    /* copy workspace back if necessary */
-#line 3551
+#line 3555
     if (realign) {
-#line 3551
+#line 3555
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3551
+#line 3555
       xp = (double *) *xpp;
-#line 3551
+#line 3555
     }
-#line 3551
+#line 3555
    /* update xpp and tp */
-#line 3551
+#line 3555
     xp += ni;
-#line 3551
+#line 3555
     tp += ni;
-#line 3551
+#line 3555
     *xpp = (void*)xp;
-#line 3551
+#line 3555
   }
-#line 3551
+#line 3555
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3551
+#line 3555
 
-#line 3551
+#line 3555
 #else   /* not SX */
-#line 3551
+#line 3555
 
-#line 3551
+#line 3555
 	char *xp = (char *) *xpp;
-#line 3551
+#line 3555
 	int status = NC_NOERR;
-#line 3551
+#line 3555
 
-#line 3551
+#line 3555
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3551
+#line 3555
 	{
-#line 3551
+#line 3555
 		int lstatus = ncx_put_double_uint(xp, tp, fillp);
-#line 3551
+#line 3555
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3551
+#line 3555
 			status = lstatus;
-#line 3551
+#line 3555
 	}
-#line 3551
+#line 3555
 
-#line 3551
+#line 3555
 	*xpp = (void *)xp;
-#line 3551
+#line 3555
 	return status;
-#line 3551
+#line 3555
 #endif
-#line 3551
+#line 3555
 }
-#line 3551
+#line 3555
 
 int
-#line 3552
+#line 3556
 ncx_putn_double_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
-#line 3552
+#line 3556
 {
-#line 3552
+#line 3556
 #if defined(_SX) && _SX != 0 && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE
-#line 3552
+#line 3556
 
-#line 3552
+#line 3556
  /* basic algorithm is:
-#line 3552
+#line 3556
   *   - ensure sane alignment of output data
-#line 3552
+#line 3556
   *   - copy (conversion happens automatically) input data
-#line 3552
+#line 3556
   *     to output
-#line 3552
+#line 3556
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3552
+#line 3556
   *     at next location for converted output
-#line 3552
+#line 3556
   */
-#line 3552
+#line 3556
   long i, j, ni;
-#line 3552
+#line 3556
   double tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3552
+#line 3556
   double *xp;
-#line 3552
+#line 3556
   int nrange = 0;         /* number of range errors */
-#line 3552
+#line 3556
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3552
+#line 3556
   long cxp = (long) *((char**)xpp);
-#line 3552
+#line 3556
 
-#line 3552
+#line 3556
   realign = (cxp & 7) % SIZEOF_DOUBLE;
-#line 3552
+#line 3556
   /* sjl: manually stripmine so we can limit amount of
-#line 3552
+#line 3556
    * vector work space reserved to LOOPCNT elements. Also
-#line 3552
+#line 3556
    * makes vectorisation easy */
-#line 3552
+#line 3556
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3552
+#line 3556
     ni=Min(nelems-j,LOOPCNT);
-#line 3552
+#line 3556
     if (realign) {
-#line 3552
+#line 3556
       xp = tmp;
-#line 3552
+#line 3556
     } else {
-#line 3552
+#line 3556
       xp = (double *) *xpp;
-#line 3552
+#line 3556
     }
-#line 3552
+#line 3556
    /* copy the next block */
-#line 3552
+#line 3556
 #pragma cdir loopcnt=LOOPCNT
-#line 3552
+#line 3556
 #pragma cdir shortloop
-#line 3552
+#line 3556
     for (i=0; i<ni; i++) {
-#line 3552
+#line 3556
       /* the normal case: */
-#line 3552
+#line 3556
       xp[i] = (double) Max( X_DOUBLE_MIN, Min(X_DOUBLE_MAX, (double) tp[i]));
-#line 3552
+#line 3556
      /* test for range errors (not always needed but do it anyway) */
-#line 3552
+#line 3556
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3552
+#line 3556
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3552
+#line 3556
       nrange += tp[i] > X_DOUBLE_MAX ;
-#line 3552
+#line 3556
     }
-#line 3552
+#line 3556
    /* copy workspace back if necessary */
-#line 3552
+#line 3556
     if (realign) {
-#line 3552
+#line 3556
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_DOUBLE);
-#line 3552
+#line 3556
       xp = (double *) *xpp;
-#line 3552
+#line 3556
     }
-#line 3552
+#line 3556
    /* update xpp and tp */
-#line 3552
+#line 3556
     xp += ni;
-#line 3552
+#line 3556
     tp += ni;
-#line 3552
+#line 3556
     *xpp = (void*)xp;
-#line 3552
+#line 3556
   }
-#line 3552
+#line 3556
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3552
+#line 3556
 
-#line 3552
+#line 3556
 #else   /* not SX */
-#line 3552
+#line 3556
 
-#line 3552
+#line 3556
 	char *xp = (char *) *xpp;
-#line 3552
+#line 3556
 	int status = NC_NOERR;
-#line 3552
+#line 3556
 
-#line 3552
+#line 3556
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
-#line 3552
+#line 3556
 	{
-#line 3552
+#line 3556
 		int lstatus = ncx_put_double_ulonglong(xp, tp, fillp);
-#line 3552
+#line 3556
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3552
+#line 3556
 			status = lstatus;
-#line 3552
+#line 3556
 	}
-#line 3552
+#line 3556
 
-#line 3552
+#line 3556
 	*xpp = (void *)xp;
-#line 3552
+#line 3556
 	return status;
-#line 3552
+#line 3556
 #endif
-#line 3552
+#line 3556
 }
-#line 3552
+#line 3556
 
 
 
@@ -31304,1424 +31308,1424 @@ ncx_getn_longlong_longlong(const void **xpp, size_t nelems, long long *tp)
 }
 #else
 int
-#line 3571
+#line 3575
 ncx_getn_longlong_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3571
+#line 3575
 {
-#line 3571
+#line 3575
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3571
+#line 3575
 
-#line 3571
+#line 3575
  /* basic algorithm is:
-#line 3571
+#line 3575
   *   - ensure sane alignment of input data
-#line 3571
+#line 3575
   *   - copy (conversion happens automatically) input data
-#line 3571
+#line 3575
   *     to output
-#line 3571
+#line 3575
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3571
+#line 3575
   *     at next location for converted output
-#line 3571
+#line 3575
   */
-#line 3571
+#line 3575
   long i, j, ni;
-#line 3571
+#line 3575
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3571
+#line 3575
   int64 *xp;
-#line 3571
+#line 3575
   int nrange = 0;         /* number of range errors */
-#line 3571
+#line 3575
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3571
+#line 3575
   long cxp = (long) *((char**)xpp);
-#line 3571
+#line 3575
 
-#line 3571
+#line 3575
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3571
+#line 3575
   /* sjl: manually stripmine so we can limit amount of
-#line 3571
+#line 3575
    * vector work space reserved to LOOPCNT elements. Also
-#line 3571
+#line 3575
    * makes vectorisation easy */
-#line 3571
+#line 3575
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3571
+#line 3575
     ni=Min(nelems-j,LOOPCNT);
-#line 3571
+#line 3575
     if (realign) {
-#line 3571
+#line 3575
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3571
+#line 3575
       xp = tmp;
-#line 3571
+#line 3575
     } else {
-#line 3571
+#line 3575
       xp = (int64 *) *xpp;
-#line 3571
+#line 3575
     }
-#line 3571
+#line 3575
    /* copy the next block */
-#line 3571
+#line 3575
 #pragma cdir loopcnt=LOOPCNT
-#line 3571
+#line 3575
 #pragma cdir shortloop
-#line 3571
+#line 3575
     for (i=0; i<ni; i++) {
-#line 3571
+#line 3575
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3571
+#line 3575
      /* test for range errors (not always needed but do it anyway) */
-#line 3571
+#line 3575
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3571
+#line 3575
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3571
+#line 3575
       nrange += xp[i] > LONGLONG_MAX || xp[i] < LONGLONG_MIN;
-#line 3571
+#line 3575
     }
-#line 3571
+#line 3575
    /* update xpp and tp */
-#line 3571
+#line 3575
     if (realign) xp = (int64 *) *xpp;
-#line 3571
+#line 3575
     xp += ni;
-#line 3571
+#line 3575
     tp += ni;
-#line 3571
+#line 3575
     *xpp = (void*)xp;
-#line 3571
+#line 3575
   }
-#line 3571
+#line 3575
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3571
+#line 3575
 
-#line 3571
+#line 3575
 #else   /* not SX */
-#line 3571
+#line 3575
 	const char *xp = (const char *) *xpp;
-#line 3571
+#line 3575
 	int status = NC_NOERR;
-#line 3571
+#line 3575
 
-#line 3571
+#line 3575
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3571
+#line 3575
 	{
-#line 3571
+#line 3575
 		const int lstatus = ncx_get_longlong_longlong(xp, tp);
-#line 3571
+#line 3575
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3571
+#line 3575
 			status = lstatus;
-#line 3571
+#line 3575
 	}
-#line 3571
+#line 3575
 
-#line 3571
+#line 3575
 	*xpp = (const void *)xp;
-#line 3571
+#line 3575
 	return status;
-#line 3571
+#line 3575
 #endif
-#line 3571
+#line 3575
 }
-#line 3571
+#line 3575
 
 #endif
 int
-#line 3573
+#line 3577
 ncx_getn_longlong_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3573
+#line 3577
 {
-#line 3573
+#line 3577
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3573
+#line 3577
 
-#line 3573
+#line 3577
  /* basic algorithm is:
-#line 3573
+#line 3577
   *   - ensure sane alignment of input data
-#line 3573
+#line 3577
   *   - copy (conversion happens automatically) input data
-#line 3573
+#line 3577
   *     to output
-#line 3573
+#line 3577
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3573
+#line 3577
   *     at next location for converted output
-#line 3573
+#line 3577
   */
-#line 3573
+#line 3577
   long i, j, ni;
-#line 3573
+#line 3577
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3573
+#line 3577
   int64 *xp;
-#line 3573
+#line 3577
   int nrange = 0;         /* number of range errors */
-#line 3573
+#line 3577
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3573
+#line 3577
   long cxp = (long) *((char**)xpp);
-#line 3573
+#line 3577
 
-#line 3573
+#line 3577
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3573
+#line 3577
   /* sjl: manually stripmine so we can limit amount of
-#line 3573
+#line 3577
    * vector work space reserved to LOOPCNT elements. Also
-#line 3573
+#line 3577
    * makes vectorisation easy */
-#line 3573
+#line 3577
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3573
+#line 3577
     ni=Min(nelems-j,LOOPCNT);
-#line 3573
+#line 3577
     if (realign) {
-#line 3573
+#line 3577
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3573
+#line 3577
       xp = tmp;
-#line 3573
+#line 3577
     } else {
-#line 3573
+#line 3577
       xp = (int64 *) *xpp;
-#line 3573
+#line 3577
     }
-#line 3573
+#line 3577
    /* copy the next block */
-#line 3573
+#line 3577
 #pragma cdir loopcnt=LOOPCNT
-#line 3573
+#line 3577
 #pragma cdir shortloop
-#line 3573
+#line 3577
     for (i=0; i<ni; i++) {
-#line 3573
+#line 3577
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3573
+#line 3577
      /* test for range errors (not always needed but do it anyway) */
-#line 3573
+#line 3577
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3573
+#line 3577
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3573
+#line 3577
       nrange += xp[i] > SCHAR_MAX || xp[i] < SCHAR_MIN;
-#line 3573
+#line 3577
     }
-#line 3573
+#line 3577
    /* update xpp and tp */
-#line 3573
+#line 3577
     if (realign) xp = (int64 *) *xpp;
-#line 3573
+#line 3577
     xp += ni;
-#line 3573
+#line 3577
     tp += ni;
-#line 3573
+#line 3577
     *xpp = (void*)xp;
-#line 3573
+#line 3577
   }
-#line 3573
+#line 3577
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3573
+#line 3577
 
-#line 3573
+#line 3577
 #else   /* not SX */
-#line 3573
+#line 3577
 	const char *xp = (const char *) *xpp;
-#line 3573
+#line 3577
 	int status = NC_NOERR;
-#line 3573
+#line 3577
 
-#line 3573
+#line 3577
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3573
+#line 3577
 	{
-#line 3573
+#line 3577
 		const int lstatus = ncx_get_longlong_schar(xp, tp);
-#line 3573
+#line 3577
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3573
+#line 3577
 			status = lstatus;
-#line 3573
+#line 3577
 	}
-#line 3573
+#line 3577
 
-#line 3573
+#line 3577
 	*xpp = (const void *)xp;
-#line 3573
+#line 3577
 	return status;
-#line 3573
+#line 3577
 #endif
-#line 3573
+#line 3577
 }
-#line 3573
+#line 3577
 
 int
-#line 3574
+#line 3578
 ncx_getn_longlong_short(const void **xpp, size_t nelems, short *tp)
-#line 3574
+#line 3578
 {
-#line 3574
+#line 3578
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3574
+#line 3578
 
-#line 3574
+#line 3578
  /* basic algorithm is:
-#line 3574
+#line 3578
   *   - ensure sane alignment of input data
-#line 3574
+#line 3578
   *   - copy (conversion happens automatically) input data
-#line 3574
+#line 3578
   *     to output
-#line 3574
+#line 3578
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3574
+#line 3578
   *     at next location for converted output
-#line 3574
+#line 3578
   */
-#line 3574
+#line 3578
   long i, j, ni;
-#line 3574
+#line 3578
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3574
+#line 3578
   int64 *xp;
-#line 3574
+#line 3578
   int nrange = 0;         /* number of range errors */
-#line 3574
+#line 3578
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3574
+#line 3578
   long cxp = (long) *((char**)xpp);
-#line 3574
+#line 3578
 
-#line 3574
+#line 3578
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3574
+#line 3578
   /* sjl: manually stripmine so we can limit amount of
-#line 3574
+#line 3578
    * vector work space reserved to LOOPCNT elements. Also
-#line 3574
+#line 3578
    * makes vectorisation easy */
-#line 3574
+#line 3578
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3574
+#line 3578
     ni=Min(nelems-j,LOOPCNT);
-#line 3574
+#line 3578
     if (realign) {
-#line 3574
+#line 3578
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3574
+#line 3578
       xp = tmp;
-#line 3574
+#line 3578
     } else {
-#line 3574
+#line 3578
       xp = (int64 *) *xpp;
-#line 3574
+#line 3578
     }
-#line 3574
+#line 3578
    /* copy the next block */
-#line 3574
+#line 3578
 #pragma cdir loopcnt=LOOPCNT
-#line 3574
+#line 3578
 #pragma cdir shortloop
-#line 3574
+#line 3578
     for (i=0; i<ni; i++) {
-#line 3574
+#line 3578
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3574
+#line 3578
      /* test for range errors (not always needed but do it anyway) */
-#line 3574
+#line 3578
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3574
+#line 3578
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3574
+#line 3578
       nrange += xp[i] > SHORT_MAX || xp[i] < SHORT_MIN;
-#line 3574
+#line 3578
     }
-#line 3574
+#line 3578
    /* update xpp and tp */
-#line 3574
+#line 3578
     if (realign) xp = (int64 *) *xpp;
-#line 3574
+#line 3578
     xp += ni;
-#line 3574
+#line 3578
     tp += ni;
-#line 3574
+#line 3578
     *xpp = (void*)xp;
-#line 3574
+#line 3578
   }
-#line 3574
+#line 3578
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3574
+#line 3578
 
-#line 3574
+#line 3578
 #else   /* not SX */
-#line 3574
+#line 3578
 	const char *xp = (const char *) *xpp;
-#line 3574
+#line 3578
 	int status = NC_NOERR;
-#line 3574
+#line 3578
 
-#line 3574
+#line 3578
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3574
+#line 3578
 	{
-#line 3574
+#line 3578
 		const int lstatus = ncx_get_longlong_short(xp, tp);
-#line 3574
+#line 3578
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3574
+#line 3578
 			status = lstatus;
-#line 3574
+#line 3578
 	}
-#line 3574
+#line 3578
 
-#line 3574
+#line 3578
 	*xpp = (const void *)xp;
-#line 3574
+#line 3578
 	return status;
-#line 3574
+#line 3578
 #endif
-#line 3574
+#line 3578
 }
-#line 3574
+#line 3578
 
 int
-#line 3575
+#line 3579
 ncx_getn_longlong_int(const void **xpp, size_t nelems, int *tp)
-#line 3575
+#line 3579
 {
-#line 3575
+#line 3579
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3575
+#line 3579
 
-#line 3575
+#line 3579
  /* basic algorithm is:
-#line 3575
+#line 3579
   *   - ensure sane alignment of input data
-#line 3575
+#line 3579
   *   - copy (conversion happens automatically) input data
-#line 3575
+#line 3579
   *     to output
-#line 3575
+#line 3579
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3575
+#line 3579
   *     at next location for converted output
-#line 3575
+#line 3579
   */
-#line 3575
+#line 3579
   long i, j, ni;
-#line 3575
+#line 3579
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3575
+#line 3579
   int64 *xp;
-#line 3575
+#line 3579
   int nrange = 0;         /* number of range errors */
-#line 3575
+#line 3579
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3575
+#line 3579
   long cxp = (long) *((char**)xpp);
-#line 3575
+#line 3579
 
-#line 3575
+#line 3579
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3575
+#line 3579
   /* sjl: manually stripmine so we can limit amount of
-#line 3575
+#line 3579
    * vector work space reserved to LOOPCNT elements. Also
-#line 3575
+#line 3579
    * makes vectorisation easy */
-#line 3575
+#line 3579
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3575
+#line 3579
     ni=Min(nelems-j,LOOPCNT);
-#line 3575
+#line 3579
     if (realign) {
-#line 3575
+#line 3579
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3575
+#line 3579
       xp = tmp;
-#line 3575
+#line 3579
     } else {
-#line 3575
+#line 3579
       xp = (int64 *) *xpp;
-#line 3575
+#line 3579
     }
-#line 3575
+#line 3579
    /* copy the next block */
-#line 3575
+#line 3579
 #pragma cdir loopcnt=LOOPCNT
-#line 3575
+#line 3579
 #pragma cdir shortloop
-#line 3575
+#line 3579
     for (i=0; i<ni; i++) {
-#line 3575
+#line 3579
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3575
+#line 3579
      /* test for range errors (not always needed but do it anyway) */
-#line 3575
+#line 3579
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3575
+#line 3579
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3575
+#line 3579
       nrange += xp[i] > INT_MAX || xp[i] < INT_MIN;
-#line 3575
+#line 3579
     }
-#line 3575
+#line 3579
    /* update xpp and tp */
-#line 3575
+#line 3579
     if (realign) xp = (int64 *) *xpp;
-#line 3575
+#line 3579
     xp += ni;
-#line 3575
+#line 3579
     tp += ni;
-#line 3575
+#line 3579
     *xpp = (void*)xp;
-#line 3575
+#line 3579
   }
-#line 3575
+#line 3579
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3575
+#line 3579
 
-#line 3575
+#line 3579
 #else   /* not SX */
-#line 3575
+#line 3579
 	const char *xp = (const char *) *xpp;
-#line 3575
+#line 3579
 	int status = NC_NOERR;
-#line 3575
+#line 3579
 
-#line 3575
+#line 3579
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3575
+#line 3579
 	{
-#line 3575
+#line 3579
 		const int lstatus = ncx_get_longlong_int(xp, tp);
-#line 3575
+#line 3579
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3575
+#line 3579
 			status = lstatus;
-#line 3575
+#line 3579
 	}
-#line 3575
+#line 3579
 
-#line 3575
+#line 3579
 	*xpp = (const void *)xp;
-#line 3575
+#line 3579
 	return status;
-#line 3575
+#line 3579
 #endif
-#line 3575
+#line 3579
 }
-#line 3575
+#line 3579
 
 int
-#line 3576
+#line 3580
 ncx_getn_longlong_long(const void **xpp, size_t nelems, long *tp)
-#line 3576
+#line 3580
 {
-#line 3576
+#line 3580
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3576
+#line 3580
 
-#line 3576
+#line 3580
  /* basic algorithm is:
-#line 3576
+#line 3580
   *   - ensure sane alignment of input data
-#line 3576
+#line 3580
   *   - copy (conversion happens automatically) input data
-#line 3576
+#line 3580
   *     to output
-#line 3576
+#line 3580
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3576
+#line 3580
   *     at next location for converted output
-#line 3576
+#line 3580
   */
-#line 3576
+#line 3580
   long i, j, ni;
-#line 3576
+#line 3580
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3576
+#line 3580
   int64 *xp;
-#line 3576
+#line 3580
   int nrange = 0;         /* number of range errors */
-#line 3576
+#line 3580
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3576
+#line 3580
   long cxp = (long) *((char**)xpp);
-#line 3576
+#line 3580
 
-#line 3576
+#line 3580
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3576
+#line 3580
   /* sjl: manually stripmine so we can limit amount of
-#line 3576
+#line 3580
    * vector work space reserved to LOOPCNT elements. Also
-#line 3576
+#line 3580
    * makes vectorisation easy */
-#line 3576
+#line 3580
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3576
+#line 3580
     ni=Min(nelems-j,LOOPCNT);
-#line 3576
+#line 3580
     if (realign) {
-#line 3576
+#line 3580
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3576
+#line 3580
       xp = tmp;
-#line 3576
+#line 3580
     } else {
-#line 3576
+#line 3580
       xp = (int64 *) *xpp;
-#line 3576
+#line 3580
     }
-#line 3576
+#line 3580
    /* copy the next block */
-#line 3576
+#line 3580
 #pragma cdir loopcnt=LOOPCNT
-#line 3576
+#line 3580
 #pragma cdir shortloop
-#line 3576
+#line 3580
     for (i=0; i<ni; i++) {
-#line 3576
+#line 3580
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3576
+#line 3580
      /* test for range errors (not always needed but do it anyway) */
-#line 3576
+#line 3580
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3576
+#line 3580
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3576
+#line 3580
       nrange += xp[i] > LONG_MAX || xp[i] < LONG_MIN;
-#line 3576
+#line 3580
     }
-#line 3576
+#line 3580
    /* update xpp and tp */
-#line 3576
+#line 3580
     if (realign) xp = (int64 *) *xpp;
-#line 3576
+#line 3580
     xp += ni;
-#line 3576
+#line 3580
     tp += ni;
-#line 3576
+#line 3580
     *xpp = (void*)xp;
-#line 3576
+#line 3580
   }
-#line 3576
+#line 3580
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3576
+#line 3580
 
-#line 3576
+#line 3580
 #else   /* not SX */
-#line 3576
+#line 3580
 	const char *xp = (const char *) *xpp;
-#line 3576
+#line 3580
 	int status = NC_NOERR;
-#line 3576
+#line 3580
 
-#line 3576
+#line 3580
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3576
+#line 3580
 	{
-#line 3576
+#line 3580
 		const int lstatus = ncx_get_longlong_long(xp, tp);
-#line 3576
+#line 3580
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3576
+#line 3580
 			status = lstatus;
-#line 3576
+#line 3580
 	}
-#line 3576
+#line 3580
 
-#line 3576
+#line 3580
 	*xpp = (const void *)xp;
-#line 3576
+#line 3580
 	return status;
-#line 3576
+#line 3580
 #endif
-#line 3576
+#line 3580
 }
-#line 3576
+#line 3580
 
 int
-#line 3577
+#line 3581
 ncx_getn_longlong_float(const void **xpp, size_t nelems, float *tp)
-#line 3577
+#line 3581
 {
-#line 3577
+#line 3581
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3577
+#line 3581
 
-#line 3577
+#line 3581
  /* basic algorithm is:
-#line 3577
+#line 3581
   *   - ensure sane alignment of input data
-#line 3577
+#line 3581
   *   - copy (conversion happens automatically) input data
-#line 3577
+#line 3581
   *     to output
-#line 3577
+#line 3581
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3577
+#line 3581
   *     at next location for converted output
-#line 3577
+#line 3581
   */
-#line 3577
+#line 3581
   long i, j, ni;
-#line 3577
+#line 3581
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3577
+#line 3581
   int64 *xp;
-#line 3577
+#line 3581
   int nrange = 0;         /* number of range errors */
-#line 3577
+#line 3581
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3577
+#line 3581
   long cxp = (long) *((char**)xpp);
-#line 3577
+#line 3581
 
-#line 3577
+#line 3581
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3577
+#line 3581
   /* sjl: manually stripmine so we can limit amount of
-#line 3577
+#line 3581
    * vector work space reserved to LOOPCNT elements. Also
-#line 3577
+#line 3581
    * makes vectorisation easy */
-#line 3577
+#line 3581
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3577
+#line 3581
     ni=Min(nelems-j,LOOPCNT);
-#line 3577
+#line 3581
     if (realign) {
-#line 3577
+#line 3581
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3577
+#line 3581
       xp = tmp;
-#line 3577
+#line 3581
     } else {
-#line 3577
+#line 3581
       xp = (int64 *) *xpp;
-#line 3577
+#line 3581
     }
-#line 3577
+#line 3581
    /* copy the next block */
-#line 3577
+#line 3581
 #pragma cdir loopcnt=LOOPCNT
-#line 3577
+#line 3581
 #pragma cdir shortloop
-#line 3577
+#line 3581
     for (i=0; i<ni; i++) {
-#line 3577
+#line 3581
       tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
-#line 3577
+#line 3581
      /* test for range errors (not always needed but do it anyway) */
-#line 3577
+#line 3581
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3577
+#line 3581
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3577
+#line 3581
       nrange += xp[i] > FLOAT_MAX || xp[i] < FLOAT_MIN;
-#line 3577
+#line 3581
     }
-#line 3577
+#line 3581
    /* update xpp and tp */
-#line 3577
+#line 3581
     if (realign) xp = (int64 *) *xpp;
-#line 3577
+#line 3581
     xp += ni;
-#line 3577
+#line 3581
     tp += ni;
-#line 3577
+#line 3581
     *xpp = (void*)xp;
-#line 3577
+#line 3581
   }
-#line 3577
+#line 3581
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3577
+#line 3581
 
-#line 3577
+#line 3581
 #else   /* not SX */
-#line 3577
+#line 3581
 	const char *xp = (const char *) *xpp;
-#line 3577
+#line 3581
 	int status = NC_NOERR;
-#line 3577
+#line 3581
 
-#line 3577
+#line 3581
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3577
+#line 3581
 	{
-#line 3577
+#line 3581
 		const int lstatus = ncx_get_longlong_float(xp, tp);
-#line 3577
+#line 3581
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3577
+#line 3581
 			status = lstatus;
-#line 3577
+#line 3581
 	}
-#line 3577
+#line 3581
 
-#line 3577
+#line 3581
 	*xpp = (const void *)xp;
-#line 3577
+#line 3581
 	return status;
-#line 3577
+#line 3581
 #endif
-#line 3577
+#line 3581
 }
-#line 3577
+#line 3581
 
 int
-#line 3578
+#line 3582
 ncx_getn_longlong_double(const void **xpp, size_t nelems, double *tp)
-#line 3578
+#line 3582
 {
-#line 3578
+#line 3582
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3578
+#line 3582
 
-#line 3578
+#line 3582
  /* basic algorithm is:
-#line 3578
+#line 3582
   *   - ensure sane alignment of input data
-#line 3578
+#line 3582
   *   - copy (conversion happens automatically) input data
-#line 3578
+#line 3582
   *     to output
-#line 3578
+#line 3582
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3578
+#line 3582
   *     at next location for converted output
-#line 3578
+#line 3582
   */
-#line 3578
+#line 3582
   long i, j, ni;
-#line 3578
+#line 3582
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3578
+#line 3582
   int64 *xp;
-#line 3578
+#line 3582
   int nrange = 0;         /* number of range errors */
-#line 3578
+#line 3582
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3578
+#line 3582
   long cxp = (long) *((char**)xpp);
-#line 3578
+#line 3582
 
-#line 3578
+#line 3582
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3578
+#line 3582
   /* sjl: manually stripmine so we can limit amount of
-#line 3578
+#line 3582
    * vector work space reserved to LOOPCNT elements. Also
-#line 3578
+#line 3582
    * makes vectorisation easy */
-#line 3578
+#line 3582
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3578
+#line 3582
     ni=Min(nelems-j,LOOPCNT);
-#line 3578
+#line 3582
     if (realign) {
-#line 3578
+#line 3582
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3578
+#line 3582
       xp = tmp;
-#line 3578
+#line 3582
     } else {
-#line 3578
+#line 3582
       xp = (int64 *) *xpp;
-#line 3578
+#line 3582
     }
-#line 3578
+#line 3582
    /* copy the next block */
-#line 3578
+#line 3582
 #pragma cdir loopcnt=LOOPCNT
-#line 3578
+#line 3582
 #pragma cdir shortloop
-#line 3578
+#line 3582
     for (i=0; i<ni; i++) {
-#line 3578
+#line 3582
       tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
-#line 3578
+#line 3582
      /* test for range errors (not always needed but do it anyway) */
-#line 3578
+#line 3582
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3578
+#line 3582
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3578
+#line 3582
       nrange += xp[i] > DOUBLE_MAX || xp[i] < DOUBLE_MIN;
-#line 3578
+#line 3582
     }
-#line 3578
+#line 3582
    /* update xpp and tp */
-#line 3578
+#line 3582
     if (realign) xp = (int64 *) *xpp;
-#line 3578
+#line 3582
     xp += ni;
-#line 3578
+#line 3582
     tp += ni;
-#line 3578
+#line 3582
     *xpp = (void*)xp;
-#line 3578
+#line 3582
   }
-#line 3578
+#line 3582
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3578
+#line 3582
 
-#line 3578
+#line 3582
 #else   /* not SX */
-#line 3578
+#line 3582
 	const char *xp = (const char *) *xpp;
-#line 3578
+#line 3582
 	int status = NC_NOERR;
-#line 3578
+#line 3582
 
-#line 3578
+#line 3582
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3578
+#line 3582
 	{
-#line 3578
+#line 3582
 		const int lstatus = ncx_get_longlong_double(xp, tp);
-#line 3578
+#line 3582
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3578
+#line 3582
 			status = lstatus;
-#line 3578
+#line 3582
 	}
-#line 3578
+#line 3582
 
-#line 3578
+#line 3582
 	*xpp = (const void *)xp;
-#line 3578
+#line 3582
 	return status;
-#line 3578
+#line 3582
 #endif
-#line 3578
+#line 3582
 }
-#line 3578
+#line 3582
 
 int
-#line 3579
+#line 3583
 ncx_getn_longlong_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3579
+#line 3583
 {
-#line 3579
+#line 3583
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3579
+#line 3583
 
-#line 3579
+#line 3583
  /* basic algorithm is:
-#line 3579
+#line 3583
   *   - ensure sane alignment of input data
-#line 3579
+#line 3583
   *   - copy (conversion happens automatically) input data
-#line 3579
+#line 3583
   *     to output
-#line 3579
+#line 3583
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3579
+#line 3583
   *     at next location for converted output
-#line 3579
+#line 3583
   */
-#line 3579
+#line 3583
   long i, j, ni;
-#line 3579
+#line 3583
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3579
+#line 3583
   int64 *xp;
-#line 3579
+#line 3583
   int nrange = 0;         /* number of range errors */
-#line 3579
+#line 3583
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3579
+#line 3583
   long cxp = (long) *((char**)xpp);
-#line 3579
+#line 3583
 
-#line 3579
+#line 3583
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3579
+#line 3583
   /* sjl: manually stripmine so we can limit amount of
-#line 3579
+#line 3583
    * vector work space reserved to LOOPCNT elements. Also
-#line 3579
+#line 3583
    * makes vectorisation easy */
-#line 3579
+#line 3583
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3579
+#line 3583
     ni=Min(nelems-j,LOOPCNT);
-#line 3579
+#line 3583
     if (realign) {
-#line 3579
+#line 3583
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3579
+#line 3583
       xp = tmp;
-#line 3579
+#line 3583
     } else {
-#line 3579
+#line 3583
       xp = (int64 *) *xpp;
-#line 3579
+#line 3583
     }
-#line 3579
+#line 3583
    /* copy the next block */
-#line 3579
+#line 3583
 #pragma cdir loopcnt=LOOPCNT
-#line 3579
+#line 3583
 #pragma cdir shortloop
-#line 3579
+#line 3583
     for (i=0; i<ni; i++) {
-#line 3579
+#line 3583
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3579
+#line 3583
      /* test for range errors (not always needed but do it anyway) */
-#line 3579
+#line 3583
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3579
+#line 3583
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3579
+#line 3583
       nrange += xp[i] > UCHAR_MAX || xp[i] < 0;
-#line 3579
+#line 3583
     }
-#line 3579
+#line 3583
    /* update xpp and tp */
-#line 3579
+#line 3583
     if (realign) xp = (int64 *) *xpp;
-#line 3579
+#line 3583
     xp += ni;
-#line 3579
+#line 3583
     tp += ni;
-#line 3579
+#line 3583
     *xpp = (void*)xp;
-#line 3579
+#line 3583
   }
-#line 3579
+#line 3583
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3579
+#line 3583
 
-#line 3579
+#line 3583
 #else   /* not SX */
-#line 3579
+#line 3583
 	const char *xp = (const char *) *xpp;
-#line 3579
+#line 3583
 	int status = NC_NOERR;
-#line 3579
+#line 3583
 
-#line 3579
+#line 3583
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3579
+#line 3583
 	{
-#line 3579
+#line 3583
 		const int lstatus = ncx_get_longlong_uchar(xp, tp);
-#line 3579
+#line 3583
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3579
+#line 3583
 			status = lstatus;
-#line 3579
+#line 3583
 	}
-#line 3579
+#line 3583
 
-#line 3579
+#line 3583
 	*xpp = (const void *)xp;
-#line 3579
+#line 3583
 	return status;
-#line 3579
+#line 3583
 #endif
-#line 3579
+#line 3583
 }
-#line 3579
+#line 3583
 
 int
-#line 3580
+#line 3584
 ncx_getn_longlong_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3580
+#line 3584
 {
-#line 3580
+#line 3584
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3580
+#line 3584
 
-#line 3580
+#line 3584
  /* basic algorithm is:
-#line 3580
+#line 3584
   *   - ensure sane alignment of input data
-#line 3580
+#line 3584
   *   - copy (conversion happens automatically) input data
-#line 3580
+#line 3584
   *     to output
-#line 3580
+#line 3584
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3580
+#line 3584
   *     at next location for converted output
-#line 3580
+#line 3584
   */
-#line 3580
+#line 3584
   long i, j, ni;
-#line 3580
+#line 3584
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3580
+#line 3584
   int64 *xp;
-#line 3580
+#line 3584
   int nrange = 0;         /* number of range errors */
-#line 3580
+#line 3584
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3580
+#line 3584
   long cxp = (long) *((char**)xpp);
-#line 3580
+#line 3584
 
-#line 3580
+#line 3584
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3580
+#line 3584
   /* sjl: manually stripmine so we can limit amount of
-#line 3580
+#line 3584
    * vector work space reserved to LOOPCNT elements. Also
-#line 3580
+#line 3584
    * makes vectorisation easy */
-#line 3580
+#line 3584
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3580
+#line 3584
     ni=Min(nelems-j,LOOPCNT);
-#line 3580
+#line 3584
     if (realign) {
-#line 3580
+#line 3584
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3580
+#line 3584
       xp = tmp;
-#line 3580
+#line 3584
     } else {
-#line 3580
+#line 3584
       xp = (int64 *) *xpp;
-#line 3580
+#line 3584
     }
-#line 3580
+#line 3584
    /* copy the next block */
-#line 3580
+#line 3584
 #pragma cdir loopcnt=LOOPCNT
-#line 3580
+#line 3584
 #pragma cdir shortloop
-#line 3580
+#line 3584
     for (i=0; i<ni; i++) {
-#line 3580
+#line 3584
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3580
+#line 3584
      /* test for range errors (not always needed but do it anyway) */
-#line 3580
+#line 3584
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3580
+#line 3584
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3580
+#line 3584
       nrange += xp[i] > USHORT_MAX || xp[i] < 0;
-#line 3580
+#line 3584
     }
-#line 3580
+#line 3584
    /* update xpp and tp */
-#line 3580
+#line 3584
     if (realign) xp = (int64 *) *xpp;
-#line 3580
+#line 3584
     xp += ni;
-#line 3580
+#line 3584
     tp += ni;
-#line 3580
+#line 3584
     *xpp = (void*)xp;
-#line 3580
+#line 3584
   }
-#line 3580
+#line 3584
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3580
+#line 3584
 
-#line 3580
+#line 3584
 #else   /* not SX */
-#line 3580
+#line 3584
 	const char *xp = (const char *) *xpp;
-#line 3580
+#line 3584
 	int status = NC_NOERR;
-#line 3580
+#line 3584
 
-#line 3580
+#line 3584
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3580
+#line 3584
 	{
-#line 3580
+#line 3584
 		const int lstatus = ncx_get_longlong_ushort(xp, tp);
-#line 3580
+#line 3584
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3580
+#line 3584
 			status = lstatus;
-#line 3580
+#line 3584
 	}
-#line 3580
+#line 3584
 
-#line 3580
+#line 3584
 	*xpp = (const void *)xp;
-#line 3580
+#line 3584
 	return status;
-#line 3580
+#line 3584
 #endif
-#line 3580
+#line 3584
 }
-#line 3580
+#line 3584
 
 int
-#line 3581
+#line 3585
 ncx_getn_longlong_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3581
+#line 3585
 {
-#line 3581
+#line 3585
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3581
+#line 3585
 
-#line 3581
+#line 3585
  /* basic algorithm is:
-#line 3581
+#line 3585
   *   - ensure sane alignment of input data
-#line 3581
+#line 3585
   *   - copy (conversion happens automatically) input data
-#line 3581
+#line 3585
   *     to output
-#line 3581
+#line 3585
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3581
+#line 3585
   *     at next location for converted output
-#line 3581
+#line 3585
   */
-#line 3581
+#line 3585
   long i, j, ni;
-#line 3581
+#line 3585
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3581
+#line 3585
   int64 *xp;
-#line 3581
+#line 3585
   int nrange = 0;         /* number of range errors */
-#line 3581
+#line 3585
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3581
+#line 3585
   long cxp = (long) *((char**)xpp);
-#line 3581
+#line 3585
 
-#line 3581
+#line 3585
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3581
+#line 3585
   /* sjl: manually stripmine so we can limit amount of
-#line 3581
+#line 3585
    * vector work space reserved to LOOPCNT elements. Also
-#line 3581
+#line 3585
    * makes vectorisation easy */
-#line 3581
+#line 3585
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3581
+#line 3585
     ni=Min(nelems-j,LOOPCNT);
-#line 3581
+#line 3585
     if (realign) {
-#line 3581
+#line 3585
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3581
+#line 3585
       xp = tmp;
-#line 3581
+#line 3585
     } else {
-#line 3581
+#line 3585
       xp = (int64 *) *xpp;
-#line 3581
+#line 3585
     }
-#line 3581
+#line 3585
    /* copy the next block */
-#line 3581
+#line 3585
 #pragma cdir loopcnt=LOOPCNT
-#line 3581
+#line 3585
 #pragma cdir shortloop
-#line 3581
+#line 3585
     for (i=0; i<ni; i++) {
-#line 3581
+#line 3585
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3581
+#line 3585
      /* test for range errors (not always needed but do it anyway) */
-#line 3581
+#line 3585
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3581
+#line 3585
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3581
+#line 3585
       nrange += xp[i] > UINT_MAX || xp[i] < 0;
-#line 3581
+#line 3585
     }
-#line 3581
+#line 3585
    /* update xpp and tp */
-#line 3581
+#line 3585
     if (realign) xp = (int64 *) *xpp;
-#line 3581
+#line 3585
     xp += ni;
-#line 3581
+#line 3585
     tp += ni;
-#line 3581
+#line 3585
     *xpp = (void*)xp;
-#line 3581
+#line 3585
   }
-#line 3581
+#line 3585
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3581
+#line 3585
 
-#line 3581
+#line 3585
 #else   /* not SX */
-#line 3581
+#line 3585
 	const char *xp = (const char *) *xpp;
-#line 3581
+#line 3585
 	int status = NC_NOERR;
-#line 3581
+#line 3585
 
-#line 3581
+#line 3585
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3581
+#line 3585
 	{
-#line 3581
+#line 3585
 		const int lstatus = ncx_get_longlong_uint(xp, tp);
-#line 3581
+#line 3585
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3581
+#line 3585
 			status = lstatus;
-#line 3581
+#line 3585
 	}
-#line 3581
+#line 3585
 
-#line 3581
+#line 3585
 	*xpp = (const void *)xp;
-#line 3581
+#line 3585
 	return status;
-#line 3581
+#line 3585
 #endif
-#line 3581
+#line 3585
 }
-#line 3581
+#line 3585
 
 int
-#line 3582
+#line 3586
 ncx_getn_longlong_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3582
+#line 3586
 {
-#line 3582
+#line 3586
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3582
+#line 3586
 
-#line 3582
+#line 3586
  /* basic algorithm is:
-#line 3582
+#line 3586
   *   - ensure sane alignment of input data
-#line 3582
+#line 3586
   *   - copy (conversion happens automatically) input data
-#line 3582
+#line 3586
   *     to output
-#line 3582
+#line 3586
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3582
+#line 3586
   *     at next location for converted output
-#line 3582
+#line 3586
   */
-#line 3582
+#line 3586
   long i, j, ni;
-#line 3582
+#line 3586
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3582
+#line 3586
   int64 *xp;
-#line 3582
+#line 3586
   int nrange = 0;         /* number of range errors */
-#line 3582
+#line 3586
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3582
+#line 3586
   long cxp = (long) *((char**)xpp);
-#line 3582
+#line 3586
 
-#line 3582
+#line 3586
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3582
+#line 3586
   /* sjl: manually stripmine so we can limit amount of
-#line 3582
+#line 3586
    * vector work space reserved to LOOPCNT elements. Also
-#line 3582
+#line 3586
    * makes vectorisation easy */
-#line 3582
+#line 3586
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3582
+#line 3586
     ni=Min(nelems-j,LOOPCNT);
-#line 3582
+#line 3586
     if (realign) {
-#line 3582
+#line 3586
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_INT64));
-#line 3582
+#line 3586
       xp = tmp;
-#line 3582
+#line 3586
     } else {
-#line 3582
+#line 3586
       xp = (int64 *) *xpp;
-#line 3582
+#line 3586
     }
-#line 3582
+#line 3586
    /* copy the next block */
-#line 3582
+#line 3586
 #pragma cdir loopcnt=LOOPCNT
-#line 3582
+#line 3586
 #pragma cdir shortloop
-#line 3582
+#line 3586
     for (i=0; i<ni; i++) {
-#line 3582
+#line 3586
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3582
+#line 3586
      /* test for range errors (not always needed but do it anyway) */
-#line 3582
+#line 3586
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3582
+#line 3586
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3582
+#line 3586
       nrange += xp[i] > ULONGLONG_MAX || xp[i] < 0;
-#line 3582
+#line 3586
     }
-#line 3582
+#line 3586
    /* update xpp and tp */
-#line 3582
+#line 3586
     if (realign) xp = (int64 *) *xpp;
-#line 3582
+#line 3586
     xp += ni;
-#line 3582
+#line 3586
     tp += ni;
-#line 3582
+#line 3586
     *xpp = (void*)xp;
-#line 3582
+#line 3586
   }
-#line 3582
+#line 3586
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3582
+#line 3586
 
-#line 3582
+#line 3586
 #else   /* not SX */
-#line 3582
+#line 3586
 	const char *xp = (const char *) *xpp;
-#line 3582
+#line 3586
 	int status = NC_NOERR;
-#line 3582
+#line 3586
 
-#line 3582
+#line 3586
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3582
+#line 3586
 	{
-#line 3582
+#line 3586
 		const int lstatus = ncx_get_longlong_ulonglong(xp, tp);
-#line 3582
+#line 3586
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3582
+#line 3586
 			status = lstatus;
-#line 3582
+#line 3586
 	}
-#line 3582
+#line 3586
 
-#line 3582
+#line 3586
 	*xpp = (const void *)xp;
-#line 3582
+#line 3586
 	return status;
-#line 3582
+#line 3586
 #endif
-#line 3582
+#line 3586
 }
-#line 3582
+#line 3586
 
 
 #if X_SIZEOF_INT64 == SIZEOF_LONGLONG
@@ -32739,1534 +32743,1534 @@ ncx_putn_longlong_longlong(void **xpp, size_t nelems, const long long *tp, void
 }
 #else
 int
-#line 3598
+#line 3602
 ncx_putn_longlong_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
-#line 3598
+#line 3602
 {
-#line 3598
+#line 3602
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3598
+#line 3602
 
-#line 3598
+#line 3602
  /* basic algorithm is:
-#line 3598
+#line 3602
   *   - ensure sane alignment of output data
-#line 3598
+#line 3602
   *   - copy (conversion happens automatically) input data
-#line 3598
+#line 3602
   *     to output
-#line 3598
+#line 3602
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3598
+#line 3602
   *     at next location for converted output
-#line 3598
+#line 3602
   */
-#line 3598
+#line 3602
   long i, j, ni;
-#line 3598
+#line 3602
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3598
+#line 3602
   int64 *xp;
-#line 3598
+#line 3602
   int nrange = 0;         /* number of range errors */
-#line 3598
+#line 3602
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3598
+#line 3602
   long cxp = (long) *((char**)xpp);
-#line 3598
+#line 3602
 
-#line 3598
+#line 3602
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3598
+#line 3602
   /* sjl: manually stripmine so we can limit amount of
-#line 3598
+#line 3602
    * vector work space reserved to LOOPCNT elements. Also
-#line 3598
+#line 3602
    * makes vectorisation easy */
-#line 3598
+#line 3602
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3598
+#line 3602
     ni=Min(nelems-j,LOOPCNT);
-#line 3598
+#line 3602
     if (realign) {
-#line 3598
+#line 3602
       xp = tmp;
-#line 3598
+#line 3602
     } else {
-#line 3598
+#line 3602
       xp = (int64 *) *xpp;
-#line 3598
+#line 3602
     }
-#line 3598
+#line 3602
    /* copy the next block */
-#line 3598
+#line 3602
 #pragma cdir loopcnt=LOOPCNT
-#line 3598
+#line 3602
 #pragma cdir shortloop
-#line 3598
+#line 3602
     for (i=0; i<ni; i++) {
-#line 3598
+#line 3602
       /* the normal case: */
-#line 3598
+#line 3602
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3598
+#line 3602
      /* test for range errors (not always needed but do it anyway) */
-#line 3598
+#line 3602
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3598
+#line 3602
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3598
+#line 3602
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3598
+#line 3602
     }
-#line 3598
+#line 3602
    /* copy workspace back if necessary */
-#line 3598
+#line 3602
     if (realign) {
-#line 3598
+#line 3602
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3598
+#line 3602
       xp = (int64 *) *xpp;
-#line 3598
+#line 3602
     }
-#line 3598
+#line 3602
    /* update xpp and tp */
-#line 3598
+#line 3602
     xp += ni;
-#line 3598
+#line 3602
     tp += ni;
-#line 3598
+#line 3602
     *xpp = (void*)xp;
-#line 3598
+#line 3602
   }
-#line 3598
+#line 3602
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3598
+#line 3602
 
-#line 3598
+#line 3602
 #else   /* not SX */
-#line 3598
+#line 3602
 
-#line 3598
+#line 3602
 	char *xp = (char *) *xpp;
-#line 3598
+#line 3602
 	int status = NC_NOERR;
-#line 3598
+#line 3602
 
-#line 3598
+#line 3602
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3598
+#line 3602
 	{
-#line 3598
+#line 3602
 		int lstatus = ncx_put_longlong_longlong(xp, tp, fillp);
-#line 3598
+#line 3602
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3598
+#line 3602
 			status = lstatus;
-#line 3598
+#line 3602
 	}
-#line 3598
+#line 3602
 
-#line 3598
+#line 3602
 	*xpp = (void *)xp;
-#line 3598
+#line 3602
 	return status;
-#line 3598
+#line 3602
 #endif
-#line 3598
+#line 3602
 }
-#line 3598
+#line 3602
 
 #endif
 int
-#line 3600
+#line 3604
 ncx_putn_longlong_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3600
+#line 3604
 {
-#line 3600
+#line 3604
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3600
+#line 3604
 
-#line 3600
+#line 3604
  /* basic algorithm is:
-#line 3600
+#line 3604
   *   - ensure sane alignment of output data
-#line 3600
+#line 3604
   *   - copy (conversion happens automatically) input data
-#line 3600
+#line 3604
   *     to output
-#line 3600
+#line 3604
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3600
+#line 3604
   *     at next location for converted output
-#line 3600
+#line 3604
   */
-#line 3600
+#line 3604
   long i, j, ni;
-#line 3600
+#line 3604
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3600
+#line 3604
   int64 *xp;
-#line 3600
+#line 3604
   int nrange = 0;         /* number of range errors */
-#line 3600
+#line 3604
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3600
+#line 3604
   long cxp = (long) *((char**)xpp);
-#line 3600
+#line 3604
 
-#line 3600
+#line 3604
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3600
+#line 3604
   /* sjl: manually stripmine so we can limit amount of
-#line 3600
+#line 3604
    * vector work space reserved to LOOPCNT elements. Also
-#line 3600
+#line 3604
    * makes vectorisation easy */
-#line 3600
+#line 3604
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3600
+#line 3604
     ni=Min(nelems-j,LOOPCNT);
-#line 3600
+#line 3604
     if (realign) {
-#line 3600
+#line 3604
       xp = tmp;
-#line 3600
+#line 3604
     } else {
-#line 3600
+#line 3604
       xp = (int64 *) *xpp;
-#line 3600
+#line 3604
     }
-#line 3600
+#line 3604
    /* copy the next block */
-#line 3600
+#line 3604
 #pragma cdir loopcnt=LOOPCNT
-#line 3600
+#line 3604
 #pragma cdir shortloop
-#line 3600
+#line 3604
     for (i=0; i<ni; i++) {
-#line 3600
+#line 3604
       /* the normal case: */
-#line 3600
+#line 3604
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3600
+#line 3604
      /* test for range errors (not always needed but do it anyway) */
-#line 3600
+#line 3604
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3600
+#line 3604
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3600
+#line 3604
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3600
+#line 3604
     }
-#line 3600
+#line 3604
    /* copy workspace back if necessary */
-#line 3600
+#line 3604
     if (realign) {
-#line 3600
+#line 3604
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3600
+#line 3604
       xp = (int64 *) *xpp;
-#line 3600
+#line 3604
     }
-#line 3600
+#line 3604
    /* update xpp and tp */
-#line 3600
+#line 3604
     xp += ni;
-#line 3600
+#line 3604
     tp += ni;
-#line 3600
+#line 3604
     *xpp = (void*)xp;
-#line 3600
+#line 3604
   }
-#line 3600
+#line 3604
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3600
+#line 3604
 
-#line 3600
+#line 3604
 #else   /* not SX */
-#line 3600
+#line 3604
 
-#line 3600
+#line 3604
 	char *xp = (char *) *xpp;
-#line 3600
+#line 3604
 	int status = NC_NOERR;
-#line 3600
+#line 3604
 
-#line 3600
+#line 3604
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3600
+#line 3604
 	{
-#line 3600
+#line 3604
 		int lstatus = ncx_put_longlong_schar(xp, tp, fillp);
-#line 3600
+#line 3604
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3600
+#line 3604
 			status = lstatus;
-#line 3600
+#line 3604
 	}
-#line 3600
+#line 3604
 
-#line 3600
+#line 3604
 	*xpp = (void *)xp;
-#line 3600
+#line 3604
 	return status;
-#line 3600
+#line 3604
 #endif
-#line 3600
+#line 3604
 }
-#line 3600
+#line 3604
 
 int
-#line 3601
+#line 3605
 ncx_putn_longlong_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3601
+#line 3605
 {
-#line 3601
+#line 3605
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3601
+#line 3605
 
-#line 3601
+#line 3605
  /* basic algorithm is:
-#line 3601
+#line 3605
   *   - ensure sane alignment of output data
-#line 3601
+#line 3605
   *   - copy (conversion happens automatically) input data
-#line 3601
+#line 3605
   *     to output
-#line 3601
+#line 3605
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3601
+#line 3605
   *     at next location for converted output
-#line 3601
+#line 3605
   */
-#line 3601
+#line 3605
   long i, j, ni;
-#line 3601
+#line 3605
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3601
+#line 3605
   int64 *xp;
-#line 3601
+#line 3605
   int nrange = 0;         /* number of range errors */
-#line 3601
+#line 3605
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3601
+#line 3605
   long cxp = (long) *((char**)xpp);
-#line 3601
+#line 3605
 
-#line 3601
+#line 3605
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3601
+#line 3605
   /* sjl: manually stripmine so we can limit amount of
-#line 3601
+#line 3605
    * vector work space reserved to LOOPCNT elements. Also
-#line 3601
+#line 3605
    * makes vectorisation easy */
-#line 3601
+#line 3605
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3601
+#line 3605
     ni=Min(nelems-j,LOOPCNT);
-#line 3601
+#line 3605
     if (realign) {
-#line 3601
+#line 3605
       xp = tmp;
-#line 3601
+#line 3605
     } else {
-#line 3601
+#line 3605
       xp = (int64 *) *xpp;
-#line 3601
+#line 3605
     }
-#line 3601
+#line 3605
    /* copy the next block */
-#line 3601
+#line 3605
 #pragma cdir loopcnt=LOOPCNT
-#line 3601
+#line 3605
 #pragma cdir shortloop
-#line 3601
+#line 3605
     for (i=0; i<ni; i++) {
-#line 3601
+#line 3605
       /* the normal case: */
-#line 3601
+#line 3605
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3601
+#line 3605
      /* test for range errors (not always needed but do it anyway) */
-#line 3601
+#line 3605
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3601
+#line 3605
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3601
+#line 3605
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3601
+#line 3605
     }
-#line 3601
+#line 3605
    /* copy workspace back if necessary */
-#line 3601
+#line 3605
     if (realign) {
-#line 3601
+#line 3605
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3601
+#line 3605
       xp = (int64 *) *xpp;
-#line 3601
+#line 3605
     }
-#line 3601
+#line 3605
    /* update xpp and tp */
-#line 3601
+#line 3605
     xp += ni;
-#line 3601
+#line 3605
     tp += ni;
-#line 3601
+#line 3605
     *xpp = (void*)xp;
-#line 3601
+#line 3605
   }
-#line 3601
+#line 3605
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3601
+#line 3605
 
-#line 3601
+#line 3605
 #else   /* not SX */
-#line 3601
+#line 3605
 
-#line 3601
+#line 3605
 	char *xp = (char *) *xpp;
-#line 3601
+#line 3605
 	int status = NC_NOERR;
-#line 3601
+#line 3605
 
-#line 3601
+#line 3605
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3601
+#line 3605
 	{
-#line 3601
+#line 3605
 		int lstatus = ncx_put_longlong_short(xp, tp, fillp);
-#line 3601
+#line 3605
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3601
+#line 3605
 			status = lstatus;
-#line 3601
+#line 3605
 	}
-#line 3601
+#line 3605
 
-#line 3601
+#line 3605
 	*xpp = (void *)xp;
-#line 3601
+#line 3605
 	return status;
-#line 3601
+#line 3605
 #endif
-#line 3601
+#line 3605
 }
-#line 3601
+#line 3605
 
 int
-#line 3602
+#line 3606
 ncx_putn_longlong_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3602
+#line 3606
 {
-#line 3602
+#line 3606
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3602
+#line 3606
 
-#line 3602
+#line 3606
  /* basic algorithm is:
-#line 3602
+#line 3606
   *   - ensure sane alignment of output data
-#line 3602
+#line 3606
   *   - copy (conversion happens automatically) input data
-#line 3602
+#line 3606
   *     to output
-#line 3602
+#line 3606
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3602
+#line 3606
   *     at next location for converted output
-#line 3602
+#line 3606
   */
-#line 3602
+#line 3606
   long i, j, ni;
-#line 3602
+#line 3606
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3602
+#line 3606
   int64 *xp;
-#line 3602
+#line 3606
   int nrange = 0;         /* number of range errors */
-#line 3602
+#line 3606
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3602
+#line 3606
   long cxp = (long) *((char**)xpp);
-#line 3602
+#line 3606
 
-#line 3602
+#line 3606
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3602
+#line 3606
   /* sjl: manually stripmine so we can limit amount of
-#line 3602
+#line 3606
    * vector work space reserved to LOOPCNT elements. Also
-#line 3602
+#line 3606
    * makes vectorisation easy */
-#line 3602
+#line 3606
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3602
+#line 3606
     ni=Min(nelems-j,LOOPCNT);
-#line 3602
+#line 3606
     if (realign) {
-#line 3602
+#line 3606
       xp = tmp;
-#line 3602
+#line 3606
     } else {
-#line 3602
+#line 3606
       xp = (int64 *) *xpp;
-#line 3602
+#line 3606
     }
-#line 3602
+#line 3606
    /* copy the next block */
-#line 3602
+#line 3606
 #pragma cdir loopcnt=LOOPCNT
-#line 3602
+#line 3606
 #pragma cdir shortloop
-#line 3602
+#line 3606
     for (i=0; i<ni; i++) {
-#line 3602
+#line 3606
       /* the normal case: */
-#line 3602
+#line 3606
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3602
+#line 3606
      /* test for range errors (not always needed but do it anyway) */
-#line 3602
+#line 3606
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3602
+#line 3606
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3602
+#line 3606
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3602
+#line 3606
     }
-#line 3602
+#line 3606
    /* copy workspace back if necessary */
-#line 3602
+#line 3606
     if (realign) {
-#line 3602
+#line 3606
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3602
+#line 3606
       xp = (int64 *) *xpp;
-#line 3602
+#line 3606
     }
-#line 3602
+#line 3606
    /* update xpp and tp */
-#line 3602
+#line 3606
     xp += ni;
-#line 3602
+#line 3606
     tp += ni;
-#line 3602
+#line 3606
     *xpp = (void*)xp;
-#line 3602
+#line 3606
   }
-#line 3602
+#line 3606
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3602
+#line 3606
 
-#line 3602
+#line 3606
 #else   /* not SX */
-#line 3602
+#line 3606
 
-#line 3602
+#line 3606
 	char *xp = (char *) *xpp;
-#line 3602
+#line 3606
 	int status = NC_NOERR;
-#line 3602
+#line 3606
 
-#line 3602
+#line 3606
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3602
+#line 3606
 	{
-#line 3602
+#line 3606
 		int lstatus = ncx_put_longlong_int(xp, tp, fillp);
-#line 3602
+#line 3606
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3602
+#line 3606
 			status = lstatus;
-#line 3602
+#line 3606
 	}
-#line 3602
+#line 3606
 
-#line 3602
+#line 3606
 	*xpp = (void *)xp;
-#line 3602
+#line 3606
 	return status;
-#line 3602
+#line 3606
 #endif
-#line 3602
+#line 3606
 }
-#line 3602
+#line 3606
 
 int
-#line 3603
+#line 3607
 ncx_putn_longlong_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3603
+#line 3607
 {
-#line 3603
+#line 3607
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3603
+#line 3607
 
-#line 3603
+#line 3607
  /* basic algorithm is:
-#line 3603
+#line 3607
   *   - ensure sane alignment of output data
-#line 3603
+#line 3607
   *   - copy (conversion happens automatically) input data
-#line 3603
+#line 3607
   *     to output
-#line 3603
+#line 3607
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3603
+#line 3607
   *     at next location for converted output
-#line 3603
+#line 3607
   */
-#line 3603
+#line 3607
   long i, j, ni;
-#line 3603
+#line 3607
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3603
+#line 3607
   int64 *xp;
-#line 3603
+#line 3607
   int nrange = 0;         /* number of range errors */
-#line 3603
+#line 3607
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3603
+#line 3607
   long cxp = (long) *((char**)xpp);
-#line 3603
+#line 3607
 
-#line 3603
+#line 3607
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3603
+#line 3607
   /* sjl: manually stripmine so we can limit amount of
-#line 3603
+#line 3607
    * vector work space reserved to LOOPCNT elements. Also
-#line 3603
+#line 3607
    * makes vectorisation easy */
-#line 3603
+#line 3607
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3603
+#line 3607
     ni=Min(nelems-j,LOOPCNT);
-#line 3603
+#line 3607
     if (realign) {
-#line 3603
+#line 3607
       xp = tmp;
-#line 3603
+#line 3607
     } else {
-#line 3603
+#line 3607
       xp = (int64 *) *xpp;
-#line 3603
+#line 3607
     }
-#line 3603
+#line 3607
    /* copy the next block */
-#line 3603
+#line 3607
 #pragma cdir loopcnt=LOOPCNT
-#line 3603
+#line 3607
 #pragma cdir shortloop
-#line 3603
+#line 3607
     for (i=0; i<ni; i++) {
-#line 3603
+#line 3607
       /* the normal case: */
-#line 3603
+#line 3607
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3603
+#line 3607
      /* test for range errors (not always needed but do it anyway) */
-#line 3603
+#line 3607
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3603
+#line 3607
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3603
+#line 3607
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3603
+#line 3607
     }
-#line 3603
+#line 3607
    /* copy workspace back if necessary */
-#line 3603
+#line 3607
     if (realign) {
-#line 3603
+#line 3607
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3603
+#line 3607
       xp = (int64 *) *xpp;
-#line 3603
+#line 3607
     }
-#line 3603
+#line 3607
    /* update xpp and tp */
-#line 3603
+#line 3607
     xp += ni;
-#line 3603
+#line 3607
     tp += ni;
-#line 3603
+#line 3607
     *xpp = (void*)xp;
-#line 3603
+#line 3607
   }
-#line 3603
+#line 3607
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3603
+#line 3607
 
-#line 3603
+#line 3607
 #else   /* not SX */
-#line 3603
+#line 3607
 
-#line 3603
+#line 3607
 	char *xp = (char *) *xpp;
-#line 3603
+#line 3607
 	int status = NC_NOERR;
-#line 3603
+#line 3607
 
-#line 3603
+#line 3607
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3603
+#line 3607
 	{
-#line 3603
+#line 3607
 		int lstatus = ncx_put_longlong_long(xp, tp, fillp);
-#line 3603
+#line 3607
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3603
+#line 3607
 			status = lstatus;
-#line 3603
+#line 3607
 	}
-#line 3603
+#line 3607
 
-#line 3603
+#line 3607
 	*xpp = (void *)xp;
-#line 3603
+#line 3607
 	return status;
-#line 3603
+#line 3607
 #endif
-#line 3603
+#line 3607
 }
-#line 3603
+#line 3607
 
 int
-#line 3604
+#line 3608
 ncx_putn_longlong_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3604
+#line 3608
 {
-#line 3604
+#line 3608
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3604
+#line 3608
 
-#line 3604
+#line 3608
  /* basic algorithm is:
-#line 3604
+#line 3608
   *   - ensure sane alignment of output data
-#line 3604
+#line 3608
   *   - copy (conversion happens automatically) input data
-#line 3604
+#line 3608
   *     to output
-#line 3604
+#line 3608
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3604
+#line 3608
   *     at next location for converted output
-#line 3604
+#line 3608
   */
-#line 3604
+#line 3608
   long i, j, ni;
-#line 3604
+#line 3608
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3604
+#line 3608
   int64 *xp;
-#line 3604
+#line 3608
   int nrange = 0;         /* number of range errors */
-#line 3604
+#line 3608
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3604
+#line 3608
   long cxp = (long) *((char**)xpp);
-#line 3604
+#line 3608
 
-#line 3604
+#line 3608
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3604
+#line 3608
   /* sjl: manually stripmine so we can limit amount of
-#line 3604
+#line 3608
    * vector work space reserved to LOOPCNT elements. Also
-#line 3604
+#line 3608
    * makes vectorisation easy */
-#line 3604
+#line 3608
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3604
+#line 3608
     ni=Min(nelems-j,LOOPCNT);
-#line 3604
+#line 3608
     if (realign) {
-#line 3604
+#line 3608
       xp = tmp;
-#line 3604
+#line 3608
     } else {
-#line 3604
+#line 3608
       xp = (int64 *) *xpp;
-#line 3604
+#line 3608
     }
-#line 3604
+#line 3608
    /* copy the next block */
-#line 3604
+#line 3608
 #pragma cdir loopcnt=LOOPCNT
-#line 3604
+#line 3608
 #pragma cdir shortloop
-#line 3604
+#line 3608
     for (i=0; i<ni; i++) {
-#line 3604
+#line 3608
       /* the normal case: */
-#line 3604
+#line 3608
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3604
+#line 3608
      /* test for range errors (not always needed but do it anyway) */
-#line 3604
+#line 3608
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3604
+#line 3608
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3604
+#line 3608
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3604
+#line 3608
     }
-#line 3604
+#line 3608
    /* copy workspace back if necessary */
-#line 3604
+#line 3608
     if (realign) {
-#line 3604
+#line 3608
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3604
+#line 3608
       xp = (int64 *) *xpp;
-#line 3604
+#line 3608
     }
-#line 3604
+#line 3608
    /* update xpp and tp */
-#line 3604
+#line 3608
     xp += ni;
-#line 3604
+#line 3608
     tp += ni;
-#line 3604
+#line 3608
     *xpp = (void*)xp;
-#line 3604
+#line 3608
   }
-#line 3604
+#line 3608
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3604
+#line 3608
 
-#line 3604
+#line 3608
 #else   /* not SX */
-#line 3604
+#line 3608
 
-#line 3604
+#line 3608
 	char *xp = (char *) *xpp;
-#line 3604
+#line 3608
 	int status = NC_NOERR;
-#line 3604
+#line 3608
 
-#line 3604
+#line 3608
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3604
+#line 3608
 	{
-#line 3604
+#line 3608
 		int lstatus = ncx_put_longlong_float(xp, tp, fillp);
-#line 3604
+#line 3608
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3604
+#line 3608
 			status = lstatus;
-#line 3604
+#line 3608
 	}
-#line 3604
+#line 3608
 
-#line 3604
+#line 3608
 	*xpp = (void *)xp;
-#line 3604
+#line 3608
 	return status;
-#line 3604
+#line 3608
 #endif
-#line 3604
+#line 3608
 }
-#line 3604
+#line 3608
 
 int
-#line 3605
+#line 3609
 ncx_putn_longlong_double(void **xpp, size_t nelems, const double *tp, void *fillp)
-#line 3605
+#line 3609
 {
-#line 3605
+#line 3609
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3605
+#line 3609
 
-#line 3605
+#line 3609
  /* basic algorithm is:
-#line 3605
+#line 3609
   *   - ensure sane alignment of output data
-#line 3605
+#line 3609
   *   - copy (conversion happens automatically) input data
-#line 3605
+#line 3609
   *     to output
-#line 3605
+#line 3609
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3605
+#line 3609
   *     at next location for converted output
-#line 3605
+#line 3609
   */
-#line 3605
+#line 3609
   long i, j, ni;
-#line 3605
+#line 3609
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3605
+#line 3609
   int64 *xp;
-#line 3605
+#line 3609
   int nrange = 0;         /* number of range errors */
-#line 3605
+#line 3609
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3605
+#line 3609
   long cxp = (long) *((char**)xpp);
-#line 3605
+#line 3609
 
-#line 3605
+#line 3609
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3605
+#line 3609
   /* sjl: manually stripmine so we can limit amount of
-#line 3605
+#line 3609
    * vector work space reserved to LOOPCNT elements. Also
-#line 3605
+#line 3609
    * makes vectorisation easy */
-#line 3605
+#line 3609
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3605
+#line 3609
     ni=Min(nelems-j,LOOPCNT);
-#line 3605
+#line 3609
     if (realign) {
-#line 3605
+#line 3609
       xp = tmp;
-#line 3605
+#line 3609
     } else {
-#line 3605
+#line 3609
       xp = (int64 *) *xpp;
-#line 3605
+#line 3609
     }
-#line 3605
+#line 3609
    /* copy the next block */
-#line 3605
+#line 3609
 #pragma cdir loopcnt=LOOPCNT
-#line 3605
+#line 3609
 #pragma cdir shortloop
-#line 3605
+#line 3609
     for (i=0; i<ni; i++) {
-#line 3605
+#line 3609
       /* the normal case: */
-#line 3605
+#line 3609
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3605
+#line 3609
      /* test for range errors (not always needed but do it anyway) */
-#line 3605
+#line 3609
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3605
+#line 3609
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3605
+#line 3609
       nrange += tp[i] > X_INT64_MAX || tp[i] < X_INT64_MIN;
-#line 3605
+#line 3609
     }
-#line 3605
+#line 3609
    /* copy workspace back if necessary */
-#line 3605
+#line 3609
     if (realign) {
-#line 3605
+#line 3609
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3605
+#line 3609
       xp = (int64 *) *xpp;
-#line 3605
+#line 3609
     }
-#line 3605
+#line 3609
    /* update xpp and tp */
-#line 3605
+#line 3609
     xp += ni;
-#line 3605
+#line 3609
     tp += ni;
-#line 3605
+#line 3609
     *xpp = (void*)xp;
-#line 3605
+#line 3609
   }
-#line 3605
+#line 3609
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3605
+#line 3609
 
-#line 3605
+#line 3609
 #else   /* not SX */
-#line 3605
+#line 3609
 
-#line 3605
+#line 3609
 	char *xp = (char *) *xpp;
-#line 3605
+#line 3609
 	int status = NC_NOERR;
-#line 3605
+#line 3609
 
-#line 3605
+#line 3609
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3605
+#line 3609
 	{
-#line 3605
+#line 3609
 		int lstatus = ncx_put_longlong_double(xp, tp, fillp);
-#line 3605
+#line 3609
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3605
+#line 3609
 			status = lstatus;
-#line 3605
+#line 3609
 	}
-#line 3605
+#line 3609
 
-#line 3605
+#line 3609
 	*xpp = (void *)xp;
-#line 3605
+#line 3609
 	return status;
-#line 3605
+#line 3609
 #endif
-#line 3605
+#line 3609
 }
-#line 3605
+#line 3609
 
 int
-#line 3606
+#line 3610
 ncx_putn_longlong_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 3606
+#line 3610
 {
-#line 3606
+#line 3610
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3606
+#line 3610
 
-#line 3606
+#line 3610
  /* basic algorithm is:
-#line 3606
+#line 3610
   *   - ensure sane alignment of output data
-#line 3606
+#line 3610
   *   - copy (conversion happens automatically) input data
-#line 3606
+#line 3610
   *     to output
-#line 3606
+#line 3610
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3606
+#line 3610
   *     at next location for converted output
-#line 3606
+#line 3610
   */
-#line 3606
+#line 3610
   long i, j, ni;
-#line 3606
+#line 3610
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3606
+#line 3610
   int64 *xp;
-#line 3606
+#line 3610
   int nrange = 0;         /* number of range errors */
-#line 3606
+#line 3610
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3606
+#line 3610
   long cxp = (long) *((char**)xpp);
-#line 3606
+#line 3610
 
-#line 3606
+#line 3610
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3606
+#line 3610
   /* sjl: manually stripmine so we can limit amount of
-#line 3606
+#line 3610
    * vector work space reserved to LOOPCNT elements. Also
-#line 3606
+#line 3610
    * makes vectorisation easy */
-#line 3606
+#line 3610
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3606
+#line 3610
     ni=Min(nelems-j,LOOPCNT);
-#line 3606
+#line 3610
     if (realign) {
-#line 3606
+#line 3610
       xp = tmp;
-#line 3606
+#line 3610
     } else {
-#line 3606
+#line 3610
       xp = (int64 *) *xpp;
-#line 3606
+#line 3610
     }
-#line 3606
+#line 3610
    /* copy the next block */
-#line 3606
+#line 3610
 #pragma cdir loopcnt=LOOPCNT
-#line 3606
+#line 3610
 #pragma cdir shortloop
-#line 3606
+#line 3610
     for (i=0; i<ni; i++) {
-#line 3606
+#line 3610
       /* the normal case: */
-#line 3606
+#line 3610
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3606
+#line 3610
      /* test for range errors (not always needed but do it anyway) */
-#line 3606
+#line 3610
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3606
+#line 3610
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3606
+#line 3610
       nrange += tp[i] > X_INT64_MAX ;
-#line 3606
+#line 3610
     }
-#line 3606
+#line 3610
    /* copy workspace back if necessary */
-#line 3606
+#line 3610
     if (realign) {
-#line 3606
+#line 3610
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3606
+#line 3610
       xp = (int64 *) *xpp;
-#line 3606
+#line 3610
     }
-#line 3606
+#line 3610
    /* update xpp and tp */
-#line 3606
+#line 3610
     xp += ni;
-#line 3606
+#line 3610
     tp += ni;
-#line 3606
+#line 3610
     *xpp = (void*)xp;
-#line 3606
+#line 3610
   }
-#line 3606
+#line 3610
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3606
+#line 3610
 
-#line 3606
+#line 3610
 #else   /* not SX */
-#line 3606
+#line 3610
 
-#line 3606
+#line 3610
 	char *xp = (char *) *xpp;
-#line 3606
+#line 3610
 	int status = NC_NOERR;
-#line 3606
+#line 3610
 
-#line 3606
+#line 3610
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3606
+#line 3610
 	{
-#line 3606
+#line 3610
 		int lstatus = ncx_put_longlong_uchar(xp, tp, fillp);
-#line 3606
+#line 3610
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3606
+#line 3610
 			status = lstatus;
-#line 3606
+#line 3610
 	}
-#line 3606
+#line 3610
 
-#line 3606
+#line 3610
 	*xpp = (void *)xp;
-#line 3606
+#line 3610
 	return status;
-#line 3606
+#line 3610
 #endif
-#line 3606
+#line 3610
 }
-#line 3606
+#line 3610
 
 int
-#line 3607
+#line 3611
 ncx_putn_longlong_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3607
+#line 3611
 {
-#line 3607
+#line 3611
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3607
+#line 3611
 
-#line 3607
+#line 3611
  /* basic algorithm is:
-#line 3607
+#line 3611
   *   - ensure sane alignment of output data
-#line 3607
+#line 3611
   *   - copy (conversion happens automatically) input data
-#line 3607
+#line 3611
   *     to output
-#line 3607
+#line 3611
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3607
+#line 3611
   *     at next location for converted output
-#line 3607
+#line 3611
   */
-#line 3607
+#line 3611
   long i, j, ni;
-#line 3607
+#line 3611
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3607
+#line 3611
   int64 *xp;
-#line 3607
+#line 3611
   int nrange = 0;         /* number of range errors */
-#line 3607
+#line 3611
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3607
+#line 3611
   long cxp = (long) *((char**)xpp);
-#line 3607
+#line 3611
 
-#line 3607
+#line 3611
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3607
+#line 3611
   /* sjl: manually stripmine so we can limit amount of
-#line 3607
+#line 3611
    * vector work space reserved to LOOPCNT elements. Also
-#line 3607
+#line 3611
    * makes vectorisation easy */
-#line 3607
+#line 3611
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3607
+#line 3611
     ni=Min(nelems-j,LOOPCNT);
-#line 3607
+#line 3611
     if (realign) {
-#line 3607
+#line 3611
       xp = tmp;
-#line 3607
+#line 3611
     } else {
-#line 3607
+#line 3611
       xp = (int64 *) *xpp;
-#line 3607
+#line 3611
     }
-#line 3607
+#line 3611
    /* copy the next block */
-#line 3607
+#line 3611
 #pragma cdir loopcnt=LOOPCNT
-#line 3607
+#line 3611
 #pragma cdir shortloop
-#line 3607
+#line 3611
     for (i=0; i<ni; i++) {
-#line 3607
+#line 3611
       /* the normal case: */
-#line 3607
+#line 3611
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3607
+#line 3611
      /* test for range errors (not always needed but do it anyway) */
-#line 3607
+#line 3611
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3607
+#line 3611
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3607
+#line 3611
       nrange += tp[i] > X_INT64_MAX ;
-#line 3607
+#line 3611
     }
-#line 3607
+#line 3611
    /* copy workspace back if necessary */
-#line 3607
+#line 3611
     if (realign) {
-#line 3607
+#line 3611
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3607
+#line 3611
       xp = (int64 *) *xpp;
-#line 3607
+#line 3611
     }
-#line 3607
+#line 3611
    /* update xpp and tp */
-#line 3607
+#line 3611
     xp += ni;
-#line 3607
+#line 3611
     tp += ni;
-#line 3607
+#line 3611
     *xpp = (void*)xp;
-#line 3607
+#line 3611
   }
-#line 3607
+#line 3611
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3607
+#line 3611
 
-#line 3607
+#line 3611
 #else   /* not SX */
-#line 3607
+#line 3611
 
-#line 3607
+#line 3611
 	char *xp = (char *) *xpp;
-#line 3607
+#line 3611
 	int status = NC_NOERR;
-#line 3607
+#line 3611
 
-#line 3607
+#line 3611
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3607
+#line 3611
 	{
-#line 3607
+#line 3611
 		int lstatus = ncx_put_longlong_ushort(xp, tp, fillp);
-#line 3607
+#line 3611
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3607
+#line 3611
 			status = lstatus;
-#line 3607
+#line 3611
 	}
-#line 3607
+#line 3611
 
-#line 3607
+#line 3611
 	*xpp = (void *)xp;
-#line 3607
+#line 3611
 	return status;
-#line 3607
+#line 3611
 #endif
-#line 3607
+#line 3611
 }
-#line 3607
+#line 3611
 
 int
-#line 3608
+#line 3612
 ncx_putn_longlong_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
-#line 3608
+#line 3612
 {
-#line 3608
+#line 3612
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3608
+#line 3612
 
-#line 3608
+#line 3612
  /* basic algorithm is:
-#line 3608
+#line 3612
   *   - ensure sane alignment of output data
-#line 3608
+#line 3612
   *   - copy (conversion happens automatically) input data
-#line 3608
+#line 3612
   *     to output
-#line 3608
+#line 3612
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3608
+#line 3612
   *     at next location for converted output
-#line 3608
+#line 3612
   */
-#line 3608
+#line 3612
   long i, j, ni;
-#line 3608
+#line 3612
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3608
+#line 3612
   int64 *xp;
-#line 3608
+#line 3612
   int nrange = 0;         /* number of range errors */
-#line 3608
+#line 3612
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3608
+#line 3612
   long cxp = (long) *((char**)xpp);
-#line 3608
+#line 3612
 
-#line 3608
+#line 3612
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3608
+#line 3612
   /* sjl: manually stripmine so we can limit amount of
-#line 3608
+#line 3612
    * vector work space reserved to LOOPCNT elements. Also
-#line 3608
+#line 3612
    * makes vectorisation easy */
-#line 3608
+#line 3612
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3608
+#line 3612
     ni=Min(nelems-j,LOOPCNT);
-#line 3608
+#line 3612
     if (realign) {
-#line 3608
+#line 3612
       xp = tmp;
-#line 3608
+#line 3612
     } else {
-#line 3608
+#line 3612
       xp = (int64 *) *xpp;
-#line 3608
+#line 3612
     }
-#line 3608
+#line 3612
    /* copy the next block */
-#line 3608
+#line 3612
 #pragma cdir loopcnt=LOOPCNT
-#line 3608
+#line 3612
 #pragma cdir shortloop
-#line 3608
+#line 3612
     for (i=0; i<ni; i++) {
-#line 3608
+#line 3612
       /* the normal case: */
-#line 3608
+#line 3612
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3608
+#line 3612
      /* test for range errors (not always needed but do it anyway) */
-#line 3608
+#line 3612
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3608
+#line 3612
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3608
+#line 3612
       nrange += tp[i] > X_INT64_MAX ;
-#line 3608
+#line 3612
     }
-#line 3608
+#line 3612
    /* copy workspace back if necessary */
-#line 3608
+#line 3612
     if (realign) {
-#line 3608
+#line 3612
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3608
+#line 3612
       xp = (int64 *) *xpp;
-#line 3608
+#line 3612
     }
-#line 3608
+#line 3612
    /* update xpp and tp */
-#line 3608
+#line 3612
     xp += ni;
-#line 3608
+#line 3612
     tp += ni;
-#line 3608
+#line 3612
     *xpp = (void*)xp;
-#line 3608
+#line 3612
   }
-#line 3608
+#line 3612
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3608
+#line 3612
 
-#line 3608
+#line 3612
 #else   /* not SX */
-#line 3608
+#line 3612
 
-#line 3608
+#line 3612
 	char *xp = (char *) *xpp;
-#line 3608
+#line 3612
 	int status = NC_NOERR;
-#line 3608
+#line 3612
 
-#line 3608
+#line 3612
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3608
+#line 3612
 	{
-#line 3608
+#line 3612
 		int lstatus = ncx_put_longlong_uint(xp, tp, fillp);
-#line 3608
+#line 3612
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3608
+#line 3612
 			status = lstatus;
-#line 3608
+#line 3612
 	}
-#line 3608
+#line 3612
 
-#line 3608
+#line 3612
 	*xpp = (void *)xp;
-#line 3608
+#line 3612
 	return status;
-#line 3608
+#line 3612
 #endif
-#line 3608
+#line 3612
 }
-#line 3608
+#line 3612
 
 int
-#line 3609
+#line 3613
 ncx_putn_longlong_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
-#line 3609
+#line 3613
 {
-#line 3609
+#line 3613
 #if defined(_SX) && _SX != 0 && X_SIZEOF_INT64 == SIZEOF_INT64
-#line 3609
+#line 3613
 
-#line 3609
+#line 3613
  /* basic algorithm is:
-#line 3609
+#line 3613
   *   - ensure sane alignment of output data
-#line 3609
+#line 3613
   *   - copy (conversion happens automatically) input data
-#line 3609
+#line 3613
   *     to output
-#line 3609
+#line 3613
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3609
+#line 3613
   *     at next location for converted output
-#line 3609
+#line 3613
   */
-#line 3609
+#line 3613
   long i, j, ni;
-#line 3609
+#line 3613
   int64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3609
+#line 3613
   int64 *xp;
-#line 3609
+#line 3613
   int nrange = 0;         /* number of range errors */
-#line 3609
+#line 3613
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3609
+#line 3613
   long cxp = (long) *((char**)xpp);
-#line 3609
+#line 3613
 
-#line 3609
+#line 3613
   realign = (cxp & 7) % SIZEOF_INT64;
-#line 3609
+#line 3613
   /* sjl: manually stripmine so we can limit amount of
-#line 3609
+#line 3613
    * vector work space reserved to LOOPCNT elements. Also
-#line 3609
+#line 3613
    * makes vectorisation easy */
-#line 3609
+#line 3613
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3609
+#line 3613
     ni=Min(nelems-j,LOOPCNT);
-#line 3609
+#line 3613
     if (realign) {
-#line 3609
+#line 3613
       xp = tmp;
-#line 3609
+#line 3613
     } else {
-#line 3609
+#line 3613
       xp = (int64 *) *xpp;
-#line 3609
+#line 3613
     }
-#line 3609
+#line 3613
    /* copy the next block */
-#line 3609
+#line 3613
 #pragma cdir loopcnt=LOOPCNT
-#line 3609
+#line 3613
 #pragma cdir shortloop
-#line 3609
+#line 3613
     for (i=0; i<ni; i++) {
-#line 3609
+#line 3613
       /* the normal case: */
-#line 3609
+#line 3613
       xp[i] = (int64) Max( X_INT64_MIN, Min(X_INT64_MAX, (int64) tp[i]));
-#line 3609
+#line 3613
      /* test for range errors (not always needed but do it anyway) */
-#line 3609
+#line 3613
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3609
+#line 3613
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3609
+#line 3613
       nrange += tp[i] > X_INT64_MAX ;
-#line 3609
+#line 3613
     }
-#line 3609
+#line 3613
    /* copy workspace back if necessary */
-#line 3609
+#line 3613
     if (realign) {
-#line 3609
+#line 3613
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_INT64);
-#line 3609
+#line 3613
       xp = (int64 *) *xpp;
-#line 3609
+#line 3613
     }
-#line 3609
+#line 3613
    /* update xpp and tp */
-#line 3609
+#line 3613
     xp += ni;
-#line 3609
+#line 3613
     tp += ni;
-#line 3609
+#line 3613
     *xpp = (void*)xp;
-#line 3609
+#line 3613
   }
-#line 3609
+#line 3613
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3609
+#line 3613
 
-#line 3609
+#line 3613
 #else   /* not SX */
-#line 3609
+#line 3613
 
-#line 3609
+#line 3613
 	char *xp = (char *) *xpp;
-#line 3609
+#line 3613
 	int status = NC_NOERR;
-#line 3609
+#line 3613
 
-#line 3609
+#line 3613
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT64, tp++)
-#line 3609
+#line 3613
 	{
-#line 3609
+#line 3613
 		int lstatus = ncx_put_longlong_ulonglong(xp, tp, fillp);
-#line 3609
+#line 3613
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3609
+#line 3613
 			status = lstatus;
-#line 3609
+#line 3613
 	}
-#line 3609
+#line 3613
 
-#line 3609
+#line 3613
 	*xpp = (void *)xp;
-#line 3609
+#line 3613
 	return status;
-#line 3609
+#line 3613
 #endif
-#line 3609
+#line 3613
 }
-#line 3609
+#line 3613
 
 
 /* uint64 --------------------------------------------------------------------*/
@@ -34286,1424 +34290,1424 @@ ncx_getn_ulonglong_ulonglong(const void **xpp, size_t nelems, unsigned long long
 }
 #else
 int
-#line 3627
+#line 3631
 ncx_getn_ulonglong_ulonglong(const void **xpp, size_t nelems, ulonglong *tp)
-#line 3627
+#line 3631
 {
-#line 3627
+#line 3631
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3627
+#line 3631
 
-#line 3627
+#line 3631
  /* basic algorithm is:
-#line 3627
+#line 3631
   *   - ensure sane alignment of input data
-#line 3627
+#line 3631
   *   - copy (conversion happens automatically) input data
-#line 3627
+#line 3631
   *     to output
-#line 3627
+#line 3631
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3627
+#line 3631
   *     at next location for converted output
-#line 3627
+#line 3631
   */
-#line 3627
+#line 3631
   long i, j, ni;
-#line 3627
+#line 3631
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3627
+#line 3631
   uint64 *xp;
-#line 3627
+#line 3631
   int nrange = 0;         /* number of range errors */
-#line 3627
+#line 3631
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3627
+#line 3631
   long cxp = (long) *((char**)xpp);
-#line 3627
+#line 3631
 
-#line 3627
+#line 3631
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3627
+#line 3631
   /* sjl: manually stripmine so we can limit amount of
-#line 3627
+#line 3631
    * vector work space reserved to LOOPCNT elements. Also
-#line 3627
+#line 3631
    * makes vectorisation easy */
-#line 3627
+#line 3631
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3627
+#line 3631
     ni=Min(nelems-j,LOOPCNT);
-#line 3627
+#line 3631
     if (realign) {
-#line 3627
+#line 3631
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3627
+#line 3631
       xp = tmp;
-#line 3627
+#line 3631
     } else {
-#line 3627
+#line 3631
       xp = (uint64 *) *xpp;
-#line 3627
+#line 3631
     }
-#line 3627
+#line 3631
    /* copy the next block */
-#line 3627
+#line 3631
 #pragma cdir loopcnt=LOOPCNT
-#line 3627
+#line 3631
 #pragma cdir shortloop
-#line 3627
+#line 3631
     for (i=0; i<ni; i++) {
-#line 3627
+#line 3631
       tp[i] = (ulonglong) Max( ULONGLONG_MIN, Min(ULONGLONG_MAX, (ulonglong) xp[i]));
-#line 3627
+#line 3631
      /* test for range errors (not always needed but do it anyway) */
-#line 3627
+#line 3631
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3627
+#line 3631
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3627
+#line 3631
       nrange += xp[i] > ULONGLONG_MAX ;
-#line 3627
+#line 3631
     }
-#line 3627
+#line 3631
    /* update xpp and tp */
-#line 3627
+#line 3631
     if (realign) xp = (uint64 *) *xpp;
-#line 3627
+#line 3631
     xp += ni;
-#line 3627
+#line 3631
     tp += ni;
-#line 3627
+#line 3631
     *xpp = (void*)xp;
-#line 3627
+#line 3631
   }
-#line 3627
+#line 3631
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3627
+#line 3631
 
-#line 3627
+#line 3631
 #else   /* not SX */
-#line 3627
+#line 3631
 	const char *xp = (const char *) *xpp;
-#line 3627
+#line 3631
 	int status = NC_NOERR;
-#line 3627
+#line 3631
 
-#line 3627
+#line 3631
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3627
+#line 3631
 	{
-#line 3627
+#line 3631
 		const int lstatus = ncx_get_ulonglong_ulonglong(xp, tp);
-#line 3627
+#line 3631
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3627
+#line 3631
 			status = lstatus;
-#line 3627
+#line 3631
 	}
-#line 3627
+#line 3631
 
-#line 3627
+#line 3631
 	*xpp = (const void *)xp;
-#line 3627
+#line 3631
 	return status;
-#line 3627
+#line 3631
 #endif
-#line 3627
+#line 3631
 }
-#line 3627
+#line 3631
 
 #endif
 int
-#line 3629
+#line 3633
 ncx_getn_ulonglong_schar(const void **xpp, size_t nelems, schar *tp)
-#line 3629
+#line 3633
 {
-#line 3629
+#line 3633
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3629
+#line 3633
 
-#line 3629
+#line 3633
  /* basic algorithm is:
-#line 3629
+#line 3633
   *   - ensure sane alignment of input data
-#line 3629
+#line 3633
   *   - copy (conversion happens automatically) input data
-#line 3629
+#line 3633
   *     to output
-#line 3629
+#line 3633
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3629
+#line 3633
   *     at next location for converted output
-#line 3629
+#line 3633
   */
-#line 3629
+#line 3633
   long i, j, ni;
-#line 3629
+#line 3633
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3629
+#line 3633
   uint64 *xp;
-#line 3629
+#line 3633
   int nrange = 0;         /* number of range errors */
-#line 3629
+#line 3633
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3629
+#line 3633
   long cxp = (long) *((char**)xpp);
-#line 3629
+#line 3633
 
-#line 3629
+#line 3633
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3629
+#line 3633
   /* sjl: manually stripmine so we can limit amount of
-#line 3629
+#line 3633
    * vector work space reserved to LOOPCNT elements. Also
-#line 3629
+#line 3633
    * makes vectorisation easy */
-#line 3629
+#line 3633
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3629
+#line 3633
     ni=Min(nelems-j,LOOPCNT);
-#line 3629
+#line 3633
     if (realign) {
-#line 3629
+#line 3633
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3629
+#line 3633
       xp = tmp;
-#line 3629
+#line 3633
     } else {
-#line 3629
+#line 3633
       xp = (uint64 *) *xpp;
-#line 3629
+#line 3633
     }
-#line 3629
+#line 3633
    /* copy the next block */
-#line 3629
+#line 3633
 #pragma cdir loopcnt=LOOPCNT
-#line 3629
+#line 3633
 #pragma cdir shortloop
-#line 3629
+#line 3633
     for (i=0; i<ni; i++) {
-#line 3629
+#line 3633
       tp[i] = (schar) Max( SCHAR_MIN, Min(SCHAR_MAX, (schar) xp[i]));
-#line 3629
+#line 3633
      /* test for range errors (not always needed but do it anyway) */
-#line 3629
+#line 3633
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3629
+#line 3633
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3629
+#line 3633
       nrange += xp[i] > SCHAR_MAX ;
-#line 3629
+#line 3633
     }
-#line 3629
+#line 3633
    /* update xpp and tp */
-#line 3629
+#line 3633
     if (realign) xp = (uint64 *) *xpp;
-#line 3629
+#line 3633
     xp += ni;
-#line 3629
+#line 3633
     tp += ni;
-#line 3629
+#line 3633
     *xpp = (void*)xp;
-#line 3629
+#line 3633
   }
-#line 3629
+#line 3633
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3629
+#line 3633
 
-#line 3629
+#line 3633
 #else   /* not SX */
-#line 3629
+#line 3633
 	const char *xp = (const char *) *xpp;
-#line 3629
+#line 3633
 	int status = NC_NOERR;
-#line 3629
+#line 3633
 
-#line 3629
+#line 3633
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3629
+#line 3633
 	{
-#line 3629
+#line 3633
 		const int lstatus = ncx_get_ulonglong_schar(xp, tp);
-#line 3629
+#line 3633
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3629
+#line 3633
 			status = lstatus;
-#line 3629
+#line 3633
 	}
-#line 3629
+#line 3633
 
-#line 3629
+#line 3633
 	*xpp = (const void *)xp;
-#line 3629
+#line 3633
 	return status;
-#line 3629
+#line 3633
 #endif
-#line 3629
+#line 3633
 }
-#line 3629
+#line 3633
 
 int
-#line 3630
+#line 3634
 ncx_getn_ulonglong_short(const void **xpp, size_t nelems, short *tp)
-#line 3630
+#line 3634
 {
-#line 3630
+#line 3634
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3630
+#line 3634
 
-#line 3630
+#line 3634
  /* basic algorithm is:
-#line 3630
+#line 3634
   *   - ensure sane alignment of input data
-#line 3630
+#line 3634
   *   - copy (conversion happens automatically) input data
-#line 3630
+#line 3634
   *     to output
-#line 3630
+#line 3634
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3630
+#line 3634
   *     at next location for converted output
-#line 3630
+#line 3634
   */
-#line 3630
+#line 3634
   long i, j, ni;
-#line 3630
+#line 3634
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3630
+#line 3634
   uint64 *xp;
-#line 3630
+#line 3634
   int nrange = 0;         /* number of range errors */
-#line 3630
+#line 3634
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3630
+#line 3634
   long cxp = (long) *((char**)xpp);
-#line 3630
+#line 3634
 
-#line 3630
+#line 3634
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3630
+#line 3634
   /* sjl: manually stripmine so we can limit amount of
-#line 3630
+#line 3634
    * vector work space reserved to LOOPCNT elements. Also
-#line 3630
+#line 3634
    * makes vectorisation easy */
-#line 3630
+#line 3634
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3630
+#line 3634
     ni=Min(nelems-j,LOOPCNT);
-#line 3630
+#line 3634
     if (realign) {
-#line 3630
+#line 3634
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3630
+#line 3634
       xp = tmp;
-#line 3630
+#line 3634
     } else {
-#line 3630
+#line 3634
       xp = (uint64 *) *xpp;
-#line 3630
+#line 3634
     }
-#line 3630
+#line 3634
    /* copy the next block */
-#line 3630
+#line 3634
 #pragma cdir loopcnt=LOOPCNT
-#line 3630
+#line 3634
 #pragma cdir shortloop
-#line 3630
+#line 3634
     for (i=0; i<ni; i++) {
-#line 3630
+#line 3634
       tp[i] = (short) Max( SHORT_MIN, Min(SHORT_MAX, (short) xp[i]));
-#line 3630
+#line 3634
      /* test for range errors (not always needed but do it anyway) */
-#line 3630
+#line 3634
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3630
+#line 3634
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3630
+#line 3634
       nrange += xp[i] > SHORT_MAX ;
-#line 3630
+#line 3634
     }
-#line 3630
+#line 3634
    /* update xpp and tp */
-#line 3630
+#line 3634
     if (realign) xp = (uint64 *) *xpp;
-#line 3630
+#line 3634
     xp += ni;
-#line 3630
+#line 3634
     tp += ni;
-#line 3630
+#line 3634
     *xpp = (void*)xp;
-#line 3630
+#line 3634
   }
-#line 3630
+#line 3634
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3630
+#line 3634
 
-#line 3630
+#line 3634
 #else   /* not SX */
-#line 3630
+#line 3634
 	const char *xp = (const char *) *xpp;
-#line 3630
+#line 3634
 	int status = NC_NOERR;
-#line 3630
+#line 3634
 
-#line 3630
+#line 3634
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3630
+#line 3634
 	{
-#line 3630
+#line 3634
 		const int lstatus = ncx_get_ulonglong_short(xp, tp);
-#line 3630
+#line 3634
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3630
+#line 3634
 			status = lstatus;
-#line 3630
+#line 3634
 	}
-#line 3630
+#line 3634
 
-#line 3630
+#line 3634
 	*xpp = (const void *)xp;
-#line 3630
+#line 3634
 	return status;
-#line 3630
+#line 3634
 #endif
-#line 3630
+#line 3634
 }
-#line 3630
+#line 3634
 
 int
-#line 3631
+#line 3635
 ncx_getn_ulonglong_int(const void **xpp, size_t nelems, int *tp)
-#line 3631
+#line 3635
 {
-#line 3631
+#line 3635
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3631
+#line 3635
 
-#line 3631
+#line 3635
  /* basic algorithm is:
-#line 3631
+#line 3635
   *   - ensure sane alignment of input data
-#line 3631
+#line 3635
   *   - copy (conversion happens automatically) input data
-#line 3631
+#line 3635
   *     to output
-#line 3631
+#line 3635
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3631
+#line 3635
   *     at next location for converted output
-#line 3631
+#line 3635
   */
-#line 3631
+#line 3635
   long i, j, ni;
-#line 3631
+#line 3635
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3631
+#line 3635
   uint64 *xp;
-#line 3631
+#line 3635
   int nrange = 0;         /* number of range errors */
-#line 3631
+#line 3635
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3631
+#line 3635
   long cxp = (long) *((char**)xpp);
-#line 3631
+#line 3635
 
-#line 3631
+#line 3635
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3631
+#line 3635
   /* sjl: manually stripmine so we can limit amount of
-#line 3631
+#line 3635
    * vector work space reserved to LOOPCNT elements. Also
-#line 3631
+#line 3635
    * makes vectorisation easy */
-#line 3631
+#line 3635
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3631
+#line 3635
     ni=Min(nelems-j,LOOPCNT);
-#line 3631
+#line 3635
     if (realign) {
-#line 3631
+#line 3635
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3631
+#line 3635
       xp = tmp;
-#line 3631
+#line 3635
     } else {
-#line 3631
+#line 3635
       xp = (uint64 *) *xpp;
-#line 3631
+#line 3635
     }
-#line 3631
+#line 3635
    /* copy the next block */
-#line 3631
+#line 3635
 #pragma cdir loopcnt=LOOPCNT
-#line 3631
+#line 3635
 #pragma cdir shortloop
-#line 3631
+#line 3635
     for (i=0; i<ni; i++) {
-#line 3631
+#line 3635
       tp[i] = (int) Max( INT_MIN, Min(INT_MAX, (int) xp[i]));
-#line 3631
+#line 3635
      /* test for range errors (not always needed but do it anyway) */
-#line 3631
+#line 3635
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3631
+#line 3635
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3631
+#line 3635
       nrange += xp[i] > INT_MAX ;
-#line 3631
+#line 3635
     }
-#line 3631
+#line 3635
    /* update xpp and tp */
-#line 3631
+#line 3635
     if (realign) xp = (uint64 *) *xpp;
-#line 3631
+#line 3635
     xp += ni;
-#line 3631
+#line 3635
     tp += ni;
-#line 3631
+#line 3635
     *xpp = (void*)xp;
-#line 3631
+#line 3635
   }
-#line 3631
+#line 3635
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3631
+#line 3635
 
-#line 3631
+#line 3635
 #else   /* not SX */
-#line 3631
+#line 3635
 	const char *xp = (const char *) *xpp;
-#line 3631
+#line 3635
 	int status = NC_NOERR;
-#line 3631
+#line 3635
 
-#line 3631
+#line 3635
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3631
+#line 3635
 	{
-#line 3631
+#line 3635
 		const int lstatus = ncx_get_ulonglong_int(xp, tp);
-#line 3631
+#line 3635
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3631
+#line 3635
 			status = lstatus;
-#line 3631
+#line 3635
 	}
-#line 3631
+#line 3635
 
-#line 3631
+#line 3635
 	*xpp = (const void *)xp;
-#line 3631
+#line 3635
 	return status;
-#line 3631
+#line 3635
 #endif
-#line 3631
+#line 3635
 }
-#line 3631
+#line 3635
 
 int
-#line 3632
+#line 3636
 ncx_getn_ulonglong_long(const void **xpp, size_t nelems, long *tp)
-#line 3632
+#line 3636
 {
-#line 3632
+#line 3636
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3632
+#line 3636
 
-#line 3632
+#line 3636
  /* basic algorithm is:
-#line 3632
+#line 3636
   *   - ensure sane alignment of input data
-#line 3632
+#line 3636
   *   - copy (conversion happens automatically) input data
-#line 3632
+#line 3636
   *     to output
-#line 3632
+#line 3636
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3632
+#line 3636
   *     at next location for converted output
-#line 3632
+#line 3636
   */
-#line 3632
+#line 3636
   long i, j, ni;
-#line 3632
+#line 3636
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3632
+#line 3636
   uint64 *xp;
-#line 3632
+#line 3636
   int nrange = 0;         /* number of range errors */
-#line 3632
+#line 3636
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3632
+#line 3636
   long cxp = (long) *((char**)xpp);
-#line 3632
+#line 3636
 
-#line 3632
+#line 3636
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3632
+#line 3636
   /* sjl: manually stripmine so we can limit amount of
-#line 3632
+#line 3636
    * vector work space reserved to LOOPCNT elements. Also
-#line 3632
+#line 3636
    * makes vectorisation easy */
-#line 3632
+#line 3636
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3632
+#line 3636
     ni=Min(nelems-j,LOOPCNT);
-#line 3632
+#line 3636
     if (realign) {
-#line 3632
+#line 3636
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3632
+#line 3636
       xp = tmp;
-#line 3632
+#line 3636
     } else {
-#line 3632
+#line 3636
       xp = (uint64 *) *xpp;
-#line 3632
+#line 3636
     }
-#line 3632
+#line 3636
    /* copy the next block */
-#line 3632
+#line 3636
 #pragma cdir loopcnt=LOOPCNT
-#line 3632
+#line 3636
 #pragma cdir shortloop
-#line 3632
+#line 3636
     for (i=0; i<ni; i++) {
-#line 3632
+#line 3636
       tp[i] = (long) Max( LONG_MIN, Min(LONG_MAX, (long) xp[i]));
-#line 3632
+#line 3636
      /* test for range errors (not always needed but do it anyway) */
-#line 3632
+#line 3636
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3632
+#line 3636
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3632
+#line 3636
       nrange += xp[i] > LONG_MAX ;
-#line 3632
+#line 3636
     }
-#line 3632
+#line 3636
    /* update xpp and tp */
-#line 3632
+#line 3636
     if (realign) xp = (uint64 *) *xpp;
-#line 3632
+#line 3636
     xp += ni;
-#line 3632
+#line 3636
     tp += ni;
-#line 3632
+#line 3636
     *xpp = (void*)xp;
-#line 3632
+#line 3636
   }
-#line 3632
+#line 3636
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3632
+#line 3636
 
-#line 3632
+#line 3636
 #else   /* not SX */
-#line 3632
+#line 3636
 	const char *xp = (const char *) *xpp;
-#line 3632
+#line 3636
 	int status = NC_NOERR;
-#line 3632
+#line 3636
 
-#line 3632
+#line 3636
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3632
+#line 3636
 	{
-#line 3632
+#line 3636
 		const int lstatus = ncx_get_ulonglong_long(xp, tp);
-#line 3632
+#line 3636
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3632
+#line 3636
 			status = lstatus;
-#line 3632
+#line 3636
 	}
-#line 3632
+#line 3636
 
-#line 3632
+#line 3636
 	*xpp = (const void *)xp;
-#line 3632
+#line 3636
 	return status;
-#line 3632
+#line 3636
 #endif
-#line 3632
+#line 3636
 }
-#line 3632
+#line 3636
 
 int
-#line 3633
+#line 3637
 ncx_getn_ulonglong_float(const void **xpp, size_t nelems, float *tp)
-#line 3633
+#line 3637
 {
-#line 3633
+#line 3637
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3633
+#line 3637
 
-#line 3633
+#line 3637
  /* basic algorithm is:
-#line 3633
+#line 3637
   *   - ensure sane alignment of input data
-#line 3633
+#line 3637
   *   - copy (conversion happens automatically) input data
-#line 3633
+#line 3637
   *     to output
-#line 3633
+#line 3637
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3633
+#line 3637
   *     at next location for converted output
-#line 3633
+#line 3637
   */
-#line 3633
+#line 3637
   long i, j, ni;
-#line 3633
+#line 3637
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3633
+#line 3637
   uint64 *xp;
-#line 3633
+#line 3637
   int nrange = 0;         /* number of range errors */
-#line 3633
+#line 3637
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3633
+#line 3637
   long cxp = (long) *((char**)xpp);
-#line 3633
+#line 3637
 
-#line 3633
+#line 3637
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3633
+#line 3637
   /* sjl: manually stripmine so we can limit amount of
-#line 3633
+#line 3637
    * vector work space reserved to LOOPCNT elements. Also
-#line 3633
+#line 3637
    * makes vectorisation easy */
-#line 3633
+#line 3637
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3633
+#line 3637
     ni=Min(nelems-j,LOOPCNT);
-#line 3633
+#line 3637
     if (realign) {
-#line 3633
+#line 3637
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3633
+#line 3637
       xp = tmp;
-#line 3633
+#line 3637
     } else {
-#line 3633
+#line 3637
       xp = (uint64 *) *xpp;
-#line 3633
+#line 3637
     }
-#line 3633
+#line 3637
    /* copy the next block */
-#line 3633
+#line 3637
 #pragma cdir loopcnt=LOOPCNT
-#line 3633
+#line 3637
 #pragma cdir shortloop
-#line 3633
+#line 3637
     for (i=0; i<ni; i++) {
-#line 3633
+#line 3637
       tp[i] = (float) Max( FLOAT_MIN, Min(FLOAT_MAX, (float) xp[i]));
-#line 3633
+#line 3637
      /* test for range errors (not always needed but do it anyway) */
-#line 3633
+#line 3637
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3633
+#line 3637
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3633
+#line 3637
       nrange += xp[i] > FLOAT_MAX ;
-#line 3633
+#line 3637
     }
-#line 3633
+#line 3637
    /* update xpp and tp */
-#line 3633
+#line 3637
     if (realign) xp = (uint64 *) *xpp;
-#line 3633
+#line 3637
     xp += ni;
-#line 3633
+#line 3637
     tp += ni;
-#line 3633
+#line 3637
     *xpp = (void*)xp;
-#line 3633
+#line 3637
   }
-#line 3633
+#line 3637
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3633
+#line 3637
 
-#line 3633
+#line 3637
 #else   /* not SX */
-#line 3633
+#line 3637
 	const char *xp = (const char *) *xpp;
-#line 3633
+#line 3637
 	int status = NC_NOERR;
-#line 3633
+#line 3637
 
-#line 3633
+#line 3637
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3633
+#line 3637
 	{
-#line 3633
+#line 3637
 		const int lstatus = ncx_get_ulonglong_float(xp, tp);
-#line 3633
+#line 3637
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3633
+#line 3637
 			status = lstatus;
-#line 3633
+#line 3637
 	}
-#line 3633
+#line 3637
 
-#line 3633
+#line 3637
 	*xpp = (const void *)xp;
-#line 3633
+#line 3637
 	return status;
-#line 3633
+#line 3637
 #endif
-#line 3633
+#line 3637
 }
-#line 3633
+#line 3637
 
 int
-#line 3634
+#line 3638
 ncx_getn_ulonglong_double(const void **xpp, size_t nelems, double *tp)
-#line 3634
+#line 3638
 {
-#line 3634
+#line 3638
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3634
+#line 3638
 
-#line 3634
+#line 3638
  /* basic algorithm is:
-#line 3634
+#line 3638
   *   - ensure sane alignment of input data
-#line 3634
+#line 3638
   *   - copy (conversion happens automatically) input data
-#line 3634
+#line 3638
   *     to output
-#line 3634
+#line 3638
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3634
+#line 3638
   *     at next location for converted output
-#line 3634
+#line 3638
   */
-#line 3634
+#line 3638
   long i, j, ni;
-#line 3634
+#line 3638
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3634
+#line 3638
   uint64 *xp;
-#line 3634
+#line 3638
   int nrange = 0;         /* number of range errors */
-#line 3634
+#line 3638
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3634
+#line 3638
   long cxp = (long) *((char**)xpp);
-#line 3634
+#line 3638
 
-#line 3634
+#line 3638
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3634
+#line 3638
   /* sjl: manually stripmine so we can limit amount of
-#line 3634
+#line 3638
    * vector work space reserved to LOOPCNT elements. Also
-#line 3634
+#line 3638
    * makes vectorisation easy */
-#line 3634
+#line 3638
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3634
+#line 3638
     ni=Min(nelems-j,LOOPCNT);
-#line 3634
+#line 3638
     if (realign) {
-#line 3634
+#line 3638
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3634
+#line 3638
       xp = tmp;
-#line 3634
+#line 3638
     } else {
-#line 3634
+#line 3638
       xp = (uint64 *) *xpp;
-#line 3634
+#line 3638
     }
-#line 3634
+#line 3638
    /* copy the next block */
-#line 3634
+#line 3638
 #pragma cdir loopcnt=LOOPCNT
-#line 3634
+#line 3638
 #pragma cdir shortloop
-#line 3634
+#line 3638
     for (i=0; i<ni; i++) {
-#line 3634
+#line 3638
       tp[i] = (double) Max( DOUBLE_MIN, Min(DOUBLE_MAX, (double) xp[i]));
-#line 3634
+#line 3638
      /* test for range errors (not always needed but do it anyway) */
-#line 3634
+#line 3638
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3634
+#line 3638
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3634
+#line 3638
       nrange += xp[i] > DOUBLE_MAX ;
-#line 3634
+#line 3638
     }
-#line 3634
+#line 3638
    /* update xpp and tp */
-#line 3634
+#line 3638
     if (realign) xp = (uint64 *) *xpp;
-#line 3634
+#line 3638
     xp += ni;
-#line 3634
+#line 3638
     tp += ni;
-#line 3634
+#line 3638
     *xpp = (void*)xp;
-#line 3634
+#line 3638
   }
-#line 3634
+#line 3638
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3634
+#line 3638
 
-#line 3634
+#line 3638
 #else   /* not SX */
-#line 3634
+#line 3638
 	const char *xp = (const char *) *xpp;
-#line 3634
+#line 3638
 	int status = NC_NOERR;
-#line 3634
+#line 3638
 
-#line 3634
+#line 3638
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3634
+#line 3638
 	{
-#line 3634
+#line 3638
 		const int lstatus = ncx_get_ulonglong_double(xp, tp);
-#line 3634
+#line 3638
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3634
+#line 3638
 			status = lstatus;
-#line 3634
+#line 3638
 	}
-#line 3634
+#line 3638
 
-#line 3634
+#line 3638
 	*xpp = (const void *)xp;
-#line 3634
+#line 3638
 	return status;
-#line 3634
+#line 3638
 #endif
-#line 3634
+#line 3638
 }
-#line 3634
+#line 3638
 
 int
-#line 3635
+#line 3639
 ncx_getn_ulonglong_longlong(const void **xpp, size_t nelems, longlong *tp)
-#line 3635
+#line 3639
 {
-#line 3635
+#line 3639
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3635
+#line 3639
 
-#line 3635
+#line 3639
  /* basic algorithm is:
-#line 3635
+#line 3639
   *   - ensure sane alignment of input data
-#line 3635
+#line 3639
   *   - copy (conversion happens automatically) input data
-#line 3635
+#line 3639
   *     to output
-#line 3635
+#line 3639
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3635
+#line 3639
   *     at next location for converted output
-#line 3635
+#line 3639
   */
-#line 3635
+#line 3639
   long i, j, ni;
-#line 3635
+#line 3639
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3635
+#line 3639
   uint64 *xp;
-#line 3635
+#line 3639
   int nrange = 0;         /* number of range errors */
-#line 3635
+#line 3639
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3635
+#line 3639
   long cxp = (long) *((char**)xpp);
-#line 3635
+#line 3639
 
-#line 3635
+#line 3639
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3635
+#line 3639
   /* sjl: manually stripmine so we can limit amount of
-#line 3635
+#line 3639
    * vector work space reserved to LOOPCNT elements. Also
-#line 3635
+#line 3639
    * makes vectorisation easy */
-#line 3635
+#line 3639
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3635
+#line 3639
     ni=Min(nelems-j,LOOPCNT);
-#line 3635
+#line 3639
     if (realign) {
-#line 3635
+#line 3639
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3635
+#line 3639
       xp = tmp;
-#line 3635
+#line 3639
     } else {
-#line 3635
+#line 3639
       xp = (uint64 *) *xpp;
-#line 3635
+#line 3639
     }
-#line 3635
+#line 3639
    /* copy the next block */
-#line 3635
+#line 3639
 #pragma cdir loopcnt=LOOPCNT
-#line 3635
+#line 3639
 #pragma cdir shortloop
-#line 3635
+#line 3639
     for (i=0; i<ni; i++) {
-#line 3635
+#line 3639
       tp[i] = (longlong) Max( LONGLONG_MIN, Min(LONGLONG_MAX, (longlong) xp[i]));
-#line 3635
+#line 3639
      /* test for range errors (not always needed but do it anyway) */
-#line 3635
+#line 3639
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3635
+#line 3639
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3635
+#line 3639
       nrange += xp[i] > LONGLONG_MAX ;
-#line 3635
+#line 3639
     }
-#line 3635
+#line 3639
    /* update xpp and tp */
-#line 3635
+#line 3639
     if (realign) xp = (uint64 *) *xpp;
-#line 3635
+#line 3639
     xp += ni;
-#line 3635
+#line 3639
     tp += ni;
-#line 3635
+#line 3639
     *xpp = (void*)xp;
-#line 3635
+#line 3639
   }
-#line 3635
+#line 3639
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3635
+#line 3639
 
-#line 3635
+#line 3639
 #else   /* not SX */
-#line 3635
+#line 3639
 	const char *xp = (const char *) *xpp;
-#line 3635
+#line 3639
 	int status = NC_NOERR;
-#line 3635
+#line 3639
 
-#line 3635
+#line 3639
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3635
+#line 3639
 	{
-#line 3635
+#line 3639
 		const int lstatus = ncx_get_ulonglong_longlong(xp, tp);
-#line 3635
+#line 3639
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3635
+#line 3639
 			status = lstatus;
-#line 3635
+#line 3639
 	}
-#line 3635
+#line 3639
 
-#line 3635
+#line 3639
 	*xpp = (const void *)xp;
-#line 3635
+#line 3639
 	return status;
-#line 3635
+#line 3639
 #endif
-#line 3635
+#line 3639
 }
-#line 3635
+#line 3639
 
 int
-#line 3636
+#line 3640
 ncx_getn_ulonglong_uchar(const void **xpp, size_t nelems, uchar *tp)
-#line 3636
+#line 3640
 {
-#line 3636
+#line 3640
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3636
+#line 3640
 
-#line 3636
+#line 3640
  /* basic algorithm is:
-#line 3636
+#line 3640
   *   - ensure sane alignment of input data
-#line 3636
+#line 3640
   *   - copy (conversion happens automatically) input data
-#line 3636
+#line 3640
   *     to output
-#line 3636
+#line 3640
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3636
+#line 3640
   *     at next location for converted output
-#line 3636
+#line 3640
   */
-#line 3636
+#line 3640
   long i, j, ni;
-#line 3636
+#line 3640
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3636
+#line 3640
   uint64 *xp;
-#line 3636
+#line 3640
   int nrange = 0;         /* number of range errors */
-#line 3636
+#line 3640
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3636
+#line 3640
   long cxp = (long) *((char**)xpp);
-#line 3636
+#line 3640
 
-#line 3636
+#line 3640
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3636
+#line 3640
   /* sjl: manually stripmine so we can limit amount of
-#line 3636
+#line 3640
    * vector work space reserved to LOOPCNT elements. Also
-#line 3636
+#line 3640
    * makes vectorisation easy */
-#line 3636
+#line 3640
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3636
+#line 3640
     ni=Min(nelems-j,LOOPCNT);
-#line 3636
+#line 3640
     if (realign) {
-#line 3636
+#line 3640
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3636
+#line 3640
       xp = tmp;
-#line 3636
+#line 3640
     } else {
-#line 3636
+#line 3640
       xp = (uint64 *) *xpp;
-#line 3636
+#line 3640
     }
-#line 3636
+#line 3640
    /* copy the next block */
-#line 3636
+#line 3640
 #pragma cdir loopcnt=LOOPCNT
-#line 3636
+#line 3640
 #pragma cdir shortloop
-#line 3636
+#line 3640
     for (i=0; i<ni; i++) {
-#line 3636
+#line 3640
       tp[i] = (uchar) Max( UCHAR_MIN, Min(UCHAR_MAX, (uchar) xp[i]));
-#line 3636
+#line 3640
      /* test for range errors (not always needed but do it anyway) */
-#line 3636
+#line 3640
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3636
+#line 3640
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3636
+#line 3640
       nrange += xp[i] > UCHAR_MAX ;
-#line 3636
+#line 3640
     }
-#line 3636
+#line 3640
    /* update xpp and tp */
-#line 3636
+#line 3640
     if (realign) xp = (uint64 *) *xpp;
-#line 3636
+#line 3640
     xp += ni;
-#line 3636
+#line 3640
     tp += ni;
-#line 3636
+#line 3640
     *xpp = (void*)xp;
-#line 3636
+#line 3640
   }
-#line 3636
+#line 3640
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3636
+#line 3640
 
-#line 3636
+#line 3640
 #else   /* not SX */
-#line 3636
+#line 3640
 	const char *xp = (const char *) *xpp;
-#line 3636
+#line 3640
 	int status = NC_NOERR;
-#line 3636
+#line 3640
 
-#line 3636
+#line 3640
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3636
+#line 3640
 	{
-#line 3636
+#line 3640
 		const int lstatus = ncx_get_ulonglong_uchar(xp, tp);
-#line 3636
+#line 3640
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3636
+#line 3640
 			status = lstatus;
-#line 3636
+#line 3640
 	}
-#line 3636
+#line 3640
 
-#line 3636
+#line 3640
 	*xpp = (const void *)xp;
-#line 3636
+#line 3640
 	return status;
-#line 3636
+#line 3640
 #endif
-#line 3636
+#line 3640
 }
-#line 3636
+#line 3640
 
 int
-#line 3637
+#line 3641
 ncx_getn_ulonglong_ushort(const void **xpp, size_t nelems, ushort *tp)
-#line 3637
+#line 3641
 {
-#line 3637
+#line 3641
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3637
+#line 3641
 
-#line 3637
+#line 3641
  /* basic algorithm is:
-#line 3637
+#line 3641
   *   - ensure sane alignment of input data
-#line 3637
+#line 3641
   *   - copy (conversion happens automatically) input data
-#line 3637
+#line 3641
   *     to output
-#line 3637
+#line 3641
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3637
+#line 3641
   *     at next location for converted output
-#line 3637
+#line 3641
   */
-#line 3637
+#line 3641
   long i, j, ni;
-#line 3637
+#line 3641
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3637
+#line 3641
   uint64 *xp;
-#line 3637
+#line 3641
   int nrange = 0;         /* number of range errors */
-#line 3637
+#line 3641
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3637
+#line 3641
   long cxp = (long) *((char**)xpp);
-#line 3637
+#line 3641
 
-#line 3637
+#line 3641
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3637
+#line 3641
   /* sjl: manually stripmine so we can limit amount of
-#line 3637
+#line 3641
    * vector work space reserved to LOOPCNT elements. Also
-#line 3637
+#line 3641
    * makes vectorisation easy */
-#line 3637
+#line 3641
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3637
+#line 3641
     ni=Min(nelems-j,LOOPCNT);
-#line 3637
+#line 3641
     if (realign) {
-#line 3637
+#line 3641
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3637
+#line 3641
       xp = tmp;
-#line 3637
+#line 3641
     } else {
-#line 3637
+#line 3641
       xp = (uint64 *) *xpp;
-#line 3637
+#line 3641
     }
-#line 3637
+#line 3641
    /* copy the next block */
-#line 3637
+#line 3641
 #pragma cdir loopcnt=LOOPCNT
-#line 3637
+#line 3641
 #pragma cdir shortloop
-#line 3637
+#line 3641
     for (i=0; i<ni; i++) {
-#line 3637
+#line 3641
       tp[i] = (ushort) Max( USHORT_MIN, Min(USHORT_MAX, (ushort) xp[i]));
-#line 3637
+#line 3641
      /* test for range errors (not always needed but do it anyway) */
-#line 3637
+#line 3641
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3637
+#line 3641
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3637
+#line 3641
       nrange += xp[i] > USHORT_MAX ;
-#line 3637
+#line 3641
     }
-#line 3637
+#line 3641
    /* update xpp and tp */
-#line 3637
+#line 3641
     if (realign) xp = (uint64 *) *xpp;
-#line 3637
+#line 3641
     xp += ni;
-#line 3637
+#line 3641
     tp += ni;
-#line 3637
+#line 3641
     *xpp = (void*)xp;
-#line 3637
+#line 3641
   }
-#line 3637
+#line 3641
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3637
+#line 3641
 
-#line 3637
+#line 3641
 #else   /* not SX */
-#line 3637
+#line 3641
 	const char *xp = (const char *) *xpp;
-#line 3637
+#line 3641
 	int status = NC_NOERR;
-#line 3637
+#line 3641
 
-#line 3637
+#line 3641
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3637
+#line 3641
 	{
-#line 3637
+#line 3641
 		const int lstatus = ncx_get_ulonglong_ushort(xp, tp);
-#line 3637
+#line 3641
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3637
+#line 3641
 			status = lstatus;
-#line 3637
+#line 3641
 	}
-#line 3637
+#line 3641
 
-#line 3637
+#line 3641
 	*xpp = (const void *)xp;
-#line 3637
+#line 3641
 	return status;
-#line 3637
+#line 3641
 #endif
-#line 3637
+#line 3641
 }
-#line 3637
+#line 3641
 
 int
-#line 3638
+#line 3642
 ncx_getn_ulonglong_uint(const void **xpp, size_t nelems, uint *tp)
-#line 3638
+#line 3642
 {
-#line 3638
+#line 3642
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3638
+#line 3642
 
-#line 3638
+#line 3642
  /* basic algorithm is:
-#line 3638
+#line 3642
   *   - ensure sane alignment of input data
-#line 3638
+#line 3642
   *   - copy (conversion happens automatically) input data
-#line 3638
+#line 3642
   *     to output
-#line 3638
+#line 3642
   *   - update xpp to point at next unconverted input, and tp to point
-#line 3638
+#line 3642
   *     at next location for converted output
-#line 3638
+#line 3642
   */
-#line 3638
+#line 3642
   long i, j, ni;
-#line 3638
+#line 3642
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3638
+#line 3642
   uint64 *xp;
-#line 3638
+#line 3642
   int nrange = 0;         /* number of range errors */
-#line 3638
+#line 3642
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3638
+#line 3642
   long cxp = (long) *((char**)xpp);
-#line 3638
+#line 3642
 
-#line 3638
+#line 3642
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3638
+#line 3642
   /* sjl: manually stripmine so we can limit amount of
-#line 3638
+#line 3642
    * vector work space reserved to LOOPCNT elements. Also
-#line 3638
+#line 3642
    * makes vectorisation easy */
-#line 3638
+#line 3642
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3638
+#line 3642
     ni=Min(nelems-j,LOOPCNT);
-#line 3638
+#line 3642
     if (realign) {
-#line 3638
+#line 3642
       memcpy(tmp, *xpp, (size_t)(ni*SIZEOF_UINT64));
-#line 3638
+#line 3642
       xp = tmp;
-#line 3638
+#line 3642
     } else {
-#line 3638
+#line 3642
       xp = (uint64 *) *xpp;
-#line 3638
+#line 3642
     }
-#line 3638
+#line 3642
    /* copy the next block */
-#line 3638
+#line 3642
 #pragma cdir loopcnt=LOOPCNT
-#line 3638
+#line 3642
 #pragma cdir shortloop
-#line 3638
+#line 3642
     for (i=0; i<ni; i++) {
-#line 3638
+#line 3642
       tp[i] = (uint) Max( UINT_MIN, Min(UINT_MAX, (uint) xp[i]));
-#line 3638
+#line 3642
      /* test for range errors (not always needed but do it anyway) */
-#line 3638
+#line 3642
      /* if xpp is unsigned, we need not check if xp[i] < _MIN */
-#line 3638
+#line 3642
      /* if xpp is signed && tp is unsigned, we need check if xp[i] >= 0 */
-#line 3638
+#line 3642
       nrange += xp[i] > UINT_MAX ;
-#line 3638
+#line 3642
     }
-#line 3638
+#line 3642
    /* update xpp and tp */
-#line 3638
+#line 3642
     if (realign) xp = (uint64 *) *xpp;
-#line 3638
+#line 3642
     xp += ni;
-#line 3638
+#line 3642
     tp += ni;
-#line 3638
+#line 3642
     *xpp = (void*)xp;
-#line 3638
+#line 3642
   }
-#line 3638
+#line 3642
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3638
+#line 3642
 
-#line 3638
+#line 3642
 #else   /* not SX */
-#line 3638
+#line 3642
 	const char *xp = (const char *) *xpp;
-#line 3638
+#line 3642
 	int status = NC_NOERR;
-#line 3638
+#line 3642
 
-#line 3638
+#line 3642
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3638
+#line 3642
 	{
-#line 3638
+#line 3642
 		const int lstatus = ncx_get_ulonglong_uint(xp, tp);
-#line 3638
+#line 3642
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3638
+#line 3642
 			status = lstatus;
-#line 3638
+#line 3642
 	}
-#line 3638
+#line 3642
 
-#line 3638
+#line 3642
 	*xpp = (const void *)xp;
-#line 3638
+#line 3642
 	return status;
-#line 3638
+#line 3642
 #endif
-#line 3638
+#line 3642
 }
-#line 3638
+#line 3642
 
 
 #if X_SIZEOF_UINT64 == SIZEOF_ULONGLONG
@@ -35721,1534 +35725,1534 @@ ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const unsigned long long
 }
 #else
 int
-#line 3654
+#line 3658
 ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const ulonglong *tp, void *fillp)
-#line 3654
+#line 3658
 {
-#line 3654
+#line 3658
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3654
+#line 3658
 
-#line 3654
+#line 3658
  /* basic algorithm is:
-#line 3654
+#line 3658
   *   - ensure sane alignment of output data
-#line 3654
+#line 3658
   *   - copy (conversion happens automatically) input data
-#line 3654
+#line 3658
   *     to output
-#line 3654
+#line 3658
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3654
+#line 3658
   *     at next location for converted output
-#line 3654
+#line 3658
   */
-#line 3654
+#line 3658
   long i, j, ni;
-#line 3654
+#line 3658
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3654
+#line 3658
   uint64 *xp;
-#line 3654
+#line 3658
   int nrange = 0;         /* number of range errors */
-#line 3654
+#line 3658
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3654
+#line 3658
   long cxp = (long) *((char**)xpp);
-#line 3654
+#line 3658
 
-#line 3654
+#line 3658
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3654
+#line 3658
   /* sjl: manually stripmine so we can limit amount of
-#line 3654
+#line 3658
    * vector work space reserved to LOOPCNT elements. Also
-#line 3654
+#line 3658
    * makes vectorisation easy */
-#line 3654
+#line 3658
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3654
+#line 3658
     ni=Min(nelems-j,LOOPCNT);
-#line 3654
+#line 3658
     if (realign) {
-#line 3654
+#line 3658
       xp = tmp;
-#line 3654
+#line 3658
     } else {
-#line 3654
+#line 3658
       xp = (uint64 *) *xpp;
-#line 3654
+#line 3658
     }
-#line 3654
+#line 3658
    /* copy the next block */
-#line 3654
+#line 3658
 #pragma cdir loopcnt=LOOPCNT
-#line 3654
+#line 3658
 #pragma cdir shortloop
-#line 3654
+#line 3658
     for (i=0; i<ni; i++) {
-#line 3654
+#line 3658
       /* the normal case: */
-#line 3654
+#line 3658
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3654
+#line 3658
      /* test for range errors (not always needed but do it anyway) */
-#line 3654
+#line 3658
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3654
+#line 3658
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3654
+#line 3658
       nrange += tp[i] > X_UINT64_MAX ;
-#line 3654
+#line 3658
     }
-#line 3654
+#line 3658
    /* copy workspace back if necessary */
-#line 3654
+#line 3658
     if (realign) {
-#line 3654
+#line 3658
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3654
+#line 3658
       xp = (uint64 *) *xpp;
-#line 3654
+#line 3658
     }
-#line 3654
+#line 3658
    /* update xpp and tp */
-#line 3654
+#line 3658
     xp += ni;
-#line 3654
+#line 3658
     tp += ni;
-#line 3654
+#line 3658
     *xpp = (void*)xp;
-#line 3654
+#line 3658
   }
-#line 3654
+#line 3658
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3654
+#line 3658
 
-#line 3654
+#line 3658
 #else   /* not SX */
-#line 3654
+#line 3658
 
-#line 3654
+#line 3658
 	char *xp = (char *) *xpp;
-#line 3654
+#line 3658
 	int status = NC_NOERR;
-#line 3654
+#line 3658
 
-#line 3654
+#line 3658
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3654
+#line 3658
 	{
-#line 3654
+#line 3658
 		int lstatus = ncx_put_ulonglong_ulonglong(xp, tp, fillp);
-#line 3654
+#line 3658
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3654
+#line 3658
 			status = lstatus;
-#line 3654
+#line 3658
 	}
-#line 3654
+#line 3658
 
-#line 3654
+#line 3658
 	*xpp = (void *)xp;
-#line 3654
+#line 3658
 	return status;
-#line 3654
+#line 3658
 #endif
-#line 3654
+#line 3658
 }
-#line 3654
+#line 3658
 
 #endif
 int
-#line 3656
+#line 3660
 ncx_putn_ulonglong_schar(void **xpp, size_t nelems, const schar *tp, void *fillp)
-#line 3656
+#line 3660
 {
-#line 3656
+#line 3660
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3656
+#line 3660
 
-#line 3656
+#line 3660
  /* basic algorithm is:
-#line 3656
+#line 3660
   *   - ensure sane alignment of output data
-#line 3656
+#line 3660
   *   - copy (conversion happens automatically) input data
-#line 3656
+#line 3660
   *     to output
-#line 3656
+#line 3660
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3656
+#line 3660
   *     at next location for converted output
-#line 3656
+#line 3660
   */
-#line 3656
+#line 3660
   long i, j, ni;
-#line 3656
+#line 3660
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3656
+#line 3660
   uint64 *xp;
-#line 3656
+#line 3660
   int nrange = 0;         /* number of range errors */
-#line 3656
+#line 3660
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3656
+#line 3660
   long cxp = (long) *((char**)xpp);
-#line 3656
+#line 3660
 
-#line 3656
+#line 3660
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3656
+#line 3660
   /* sjl: manually stripmine so we can limit amount of
-#line 3656
+#line 3660
    * vector work space reserved to LOOPCNT elements. Also
-#line 3656
+#line 3660
    * makes vectorisation easy */
-#line 3656
+#line 3660
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3656
+#line 3660
     ni=Min(nelems-j,LOOPCNT);
-#line 3656
+#line 3660
     if (realign) {
-#line 3656
+#line 3660
       xp = tmp;
-#line 3656
+#line 3660
     } else {
-#line 3656
+#line 3660
       xp = (uint64 *) *xpp;
-#line 3656
+#line 3660
     }
-#line 3656
+#line 3660
    /* copy the next block */
-#line 3656
+#line 3660
 #pragma cdir loopcnt=LOOPCNT
-#line 3656
+#line 3660
 #pragma cdir shortloop
-#line 3656
+#line 3660
     for (i=0; i<ni; i++) {
-#line 3656
+#line 3660
       /* the normal case: */
-#line 3656
+#line 3660
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3656
+#line 3660
      /* test for range errors (not always needed but do it anyway) */
-#line 3656
+#line 3660
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3656
+#line 3660
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3656
+#line 3660
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3656
+#line 3660
     }
-#line 3656
+#line 3660
    /* copy workspace back if necessary */
-#line 3656
+#line 3660
     if (realign) {
-#line 3656
+#line 3660
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3656
+#line 3660
       xp = (uint64 *) *xpp;
-#line 3656
+#line 3660
     }
-#line 3656
+#line 3660
    /* update xpp and tp */
-#line 3656
+#line 3660
     xp += ni;
-#line 3656
+#line 3660
     tp += ni;
-#line 3656
+#line 3660
     *xpp = (void*)xp;
-#line 3656
+#line 3660
   }
-#line 3656
+#line 3660
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3656
+#line 3660
 
-#line 3656
+#line 3660
 #else   /* not SX */
-#line 3656
+#line 3660
 
-#line 3656
+#line 3660
 	char *xp = (char *) *xpp;
-#line 3656
+#line 3660
 	int status = NC_NOERR;
-#line 3656
+#line 3660
 
-#line 3656
+#line 3660
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3656
+#line 3660
 	{
-#line 3656
+#line 3660
 		int lstatus = ncx_put_ulonglong_schar(xp, tp, fillp);
-#line 3656
+#line 3660
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3656
+#line 3660
 			status = lstatus;
-#line 3656
+#line 3660
 	}
-#line 3656
+#line 3660
 
-#line 3656
+#line 3660
 	*xpp = (void *)xp;
-#line 3656
+#line 3660
 	return status;
-#line 3656
+#line 3660
 #endif
-#line 3656
+#line 3660
 }
-#line 3656
+#line 3660
 
 int
-#line 3657
+#line 3661
 ncx_putn_ulonglong_short(void **xpp, size_t nelems, const short *tp, void *fillp)
-#line 3657
+#line 3661
 {
-#line 3657
+#line 3661
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3657
+#line 3661
 
-#line 3657
+#line 3661
  /* basic algorithm is:
-#line 3657
+#line 3661
   *   - ensure sane alignment of output data
-#line 3657
+#line 3661
   *   - copy (conversion happens automatically) input data
-#line 3657
+#line 3661
   *     to output
-#line 3657
+#line 3661
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3657
+#line 3661
   *     at next location for converted output
-#line 3657
+#line 3661
   */
-#line 3657
+#line 3661
   long i, j, ni;
-#line 3657
+#line 3661
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3657
+#line 3661
   uint64 *xp;
-#line 3657
+#line 3661
   int nrange = 0;         /* number of range errors */
-#line 3657
+#line 3661
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3657
+#line 3661
   long cxp = (long) *((char**)xpp);
-#line 3657
+#line 3661
 
-#line 3657
+#line 3661
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3657
+#line 3661
   /* sjl: manually stripmine so we can limit amount of
-#line 3657
+#line 3661
    * vector work space reserved to LOOPCNT elements. Also
-#line 3657
+#line 3661
    * makes vectorisation easy */
-#line 3657
+#line 3661
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3657
+#line 3661
     ni=Min(nelems-j,LOOPCNT);
-#line 3657
+#line 3661
     if (realign) {
-#line 3657
+#line 3661
       xp = tmp;
-#line 3657
+#line 3661
     } else {
-#line 3657
+#line 3661
       xp = (uint64 *) *xpp;
-#line 3657
+#line 3661
     }
-#line 3657
+#line 3661
    /* copy the next block */
-#line 3657
+#line 3661
 #pragma cdir loopcnt=LOOPCNT
-#line 3657
+#line 3661
 #pragma cdir shortloop
-#line 3657
+#line 3661
     for (i=0; i<ni; i++) {
-#line 3657
+#line 3661
       /* the normal case: */
-#line 3657
+#line 3661
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3657
+#line 3661
      /* test for range errors (not always needed but do it anyway) */
-#line 3657
+#line 3661
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3657
+#line 3661
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3657
+#line 3661
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3657
+#line 3661
     }
-#line 3657
+#line 3661
    /* copy workspace back if necessary */
-#line 3657
+#line 3661
     if (realign) {
-#line 3657
+#line 3661
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3657
+#line 3661
       xp = (uint64 *) *xpp;
-#line 3657
+#line 3661
     }
-#line 3657
+#line 3661
    /* update xpp and tp */
-#line 3657
+#line 3661
     xp += ni;
-#line 3657
+#line 3661
     tp += ni;
-#line 3657
+#line 3661
     *xpp = (void*)xp;
-#line 3657
+#line 3661
   }
-#line 3657
+#line 3661
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3657
+#line 3661
 
-#line 3657
+#line 3661
 #else   /* not SX */
-#line 3657
+#line 3661
 
-#line 3657
+#line 3661
 	char *xp = (char *) *xpp;
-#line 3657
+#line 3661
 	int status = NC_NOERR;
-#line 3657
+#line 3661
 
-#line 3657
+#line 3661
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3657
+#line 3661
 	{
-#line 3657
+#line 3661
 		int lstatus = ncx_put_ulonglong_short(xp, tp, fillp);
-#line 3657
+#line 3661
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3657
+#line 3661
 			status = lstatus;
-#line 3657
+#line 3661
 	}
-#line 3657
+#line 3661
 
-#line 3657
+#line 3661
 	*xpp = (void *)xp;
-#line 3657
+#line 3661
 	return status;
-#line 3657
+#line 3661
 #endif
-#line 3657
+#line 3661
 }
-#line 3657
+#line 3661
 
 int
-#line 3658
+#line 3662
 ncx_putn_ulonglong_int(void **xpp, size_t nelems, const int *tp, void *fillp)
-#line 3658
+#line 3662
 {
-#line 3658
+#line 3662
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3658
+#line 3662
 
-#line 3658
+#line 3662
  /* basic algorithm is:
-#line 3658
+#line 3662
   *   - ensure sane alignment of output data
-#line 3658
+#line 3662
   *   - copy (conversion happens automatically) input data
-#line 3658
+#line 3662
   *     to output
-#line 3658
+#line 3662
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3658
+#line 3662
   *     at next location for converted output
-#line 3658
+#line 3662
   */
-#line 3658
+#line 3662
   long i, j, ni;
-#line 3658
+#line 3662
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3658
+#line 3662
   uint64 *xp;
-#line 3658
+#line 3662
   int nrange = 0;         /* number of range errors */
-#line 3658
+#line 3662
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3658
+#line 3662
   long cxp = (long) *((char**)xpp);
-#line 3658
+#line 3662
 
-#line 3658
+#line 3662
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3658
+#line 3662
   /* sjl: manually stripmine so we can limit amount of
-#line 3658
+#line 3662
    * vector work space reserved to LOOPCNT elements. Also
-#line 3658
+#line 3662
    * makes vectorisation easy */
-#line 3658
+#line 3662
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3658
+#line 3662
     ni=Min(nelems-j,LOOPCNT);
-#line 3658
+#line 3662
     if (realign) {
-#line 3658
+#line 3662
       xp = tmp;
-#line 3658
+#line 3662
     } else {
-#line 3658
+#line 3662
       xp = (uint64 *) *xpp;
-#line 3658
+#line 3662
     }
-#line 3658
+#line 3662
    /* copy the next block */
-#line 3658
+#line 3662
 #pragma cdir loopcnt=LOOPCNT
-#line 3658
+#line 3662
 #pragma cdir shortloop
-#line 3658
+#line 3662
     for (i=0; i<ni; i++) {
-#line 3658
+#line 3662
       /* the normal case: */
-#line 3658
+#line 3662
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3658
+#line 3662
      /* test for range errors (not always needed but do it anyway) */
-#line 3658
+#line 3662
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3658
+#line 3662
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3658
+#line 3662
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3658
+#line 3662
     }
-#line 3658
+#line 3662
    /* copy workspace back if necessary */
-#line 3658
+#line 3662
     if (realign) {
-#line 3658
+#line 3662
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3658
+#line 3662
       xp = (uint64 *) *xpp;
-#line 3658
+#line 3662
     }
-#line 3658
+#line 3662
    /* update xpp and tp */
-#line 3658
+#line 3662
     xp += ni;
-#line 3658
+#line 3662
     tp += ni;
-#line 3658
+#line 3662
     *xpp = (void*)xp;
-#line 3658
+#line 3662
   }
-#line 3658
+#line 3662
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3658
+#line 3662
 
-#line 3658
+#line 3662
 #else   /* not SX */
-#line 3658
+#line 3662
 
-#line 3658
+#line 3662
 	char *xp = (char *) *xpp;
-#line 3658
+#line 3662
 	int status = NC_NOERR;
-#line 3658
+#line 3662
 
-#line 3658
+#line 3662
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3658
+#line 3662
 	{
-#line 3658
+#line 3662
 		int lstatus = ncx_put_ulonglong_int(xp, tp, fillp);
-#line 3658
+#line 3662
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3658
+#line 3662
 			status = lstatus;
-#line 3658
+#line 3662
 	}
-#line 3658
+#line 3662
 
-#line 3658
+#line 3662
 	*xpp = (void *)xp;
-#line 3658
+#line 3662
 	return status;
-#line 3658
+#line 3662
 #endif
-#line 3658
+#line 3662
 }
-#line 3658
+#line 3662
 
 int
-#line 3659
+#line 3663
 ncx_putn_ulonglong_long(void **xpp, size_t nelems, const long *tp, void *fillp)
-#line 3659
+#line 3663
 {
-#line 3659
+#line 3663
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3659
+#line 3663
 
-#line 3659
+#line 3663
  /* basic algorithm is:
-#line 3659
+#line 3663
   *   - ensure sane alignment of output data
-#line 3659
+#line 3663
   *   - copy (conversion happens automatically) input data
-#line 3659
+#line 3663
   *     to output
-#line 3659
+#line 3663
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3659
+#line 3663
   *     at next location for converted output
-#line 3659
+#line 3663
   */
-#line 3659
+#line 3663
   long i, j, ni;
-#line 3659
+#line 3663
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3659
+#line 3663
   uint64 *xp;
-#line 3659
+#line 3663
   int nrange = 0;         /* number of range errors */
-#line 3659
+#line 3663
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3659
+#line 3663
   long cxp = (long) *((char**)xpp);
-#line 3659
+#line 3663
 
-#line 3659
+#line 3663
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3659
+#line 3663
   /* sjl: manually stripmine so we can limit amount of
-#line 3659
+#line 3663
    * vector work space reserved to LOOPCNT elements. Also
-#line 3659
+#line 3663
    * makes vectorisation easy */
-#line 3659
+#line 3663
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3659
+#line 3663
     ni=Min(nelems-j,LOOPCNT);
-#line 3659
+#line 3663
     if (realign) {
-#line 3659
+#line 3663
       xp = tmp;
-#line 3659
+#line 3663
     } else {
-#line 3659
+#line 3663
       xp = (uint64 *) *xpp;
-#line 3659
+#line 3663
     }
-#line 3659
+#line 3663
    /* copy the next block */
-#line 3659
+#line 3663
 #pragma cdir loopcnt=LOOPCNT
-#line 3659
+#line 3663
 #pragma cdir shortloop
-#line 3659
+#line 3663
     for (i=0; i<ni; i++) {
-#line 3659
+#line 3663
       /* the normal case: */
-#line 3659
+#line 3663
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3659
+#line 3663
      /* test for range errors (not always needed but do it anyway) */
-#line 3659
+#line 3663
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3659
+#line 3663
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3659
+#line 3663
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3659
+#line 3663
     }
-#line 3659
+#line 3663
    /* copy workspace back if necessary */
-#line 3659
+#line 3663
     if (realign) {
-#line 3659
+#line 3663
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3659
+#line 3663
       xp = (uint64 *) *xpp;
-#line 3659
+#line 3663
     }
-#line 3659
+#line 3663
    /* update xpp and tp */
-#line 3659
+#line 3663
     xp += ni;
-#line 3659
+#line 3663
     tp += ni;
-#line 3659
+#line 3663
     *xpp = (void*)xp;
-#line 3659
+#line 3663
   }
-#line 3659
+#line 3663
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3659
+#line 3663
 
-#line 3659
+#line 3663
 #else   /* not SX */
-#line 3659
+#line 3663
 
-#line 3659
+#line 3663
 	char *xp = (char *) *xpp;
-#line 3659
+#line 3663
 	int status = NC_NOERR;
-#line 3659
+#line 3663
 
-#line 3659
+#line 3663
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3659
+#line 3663
 	{
-#line 3659
+#line 3663
 		int lstatus = ncx_put_ulonglong_long(xp, tp, fillp);
-#line 3659
+#line 3663
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3659
+#line 3663
 			status = lstatus;
-#line 3659
+#line 3663
 	}
-#line 3659
+#line 3663
 
-#line 3659
+#line 3663
 	*xpp = (void *)xp;
-#line 3659
+#line 3663
 	return status;
-#line 3659
+#line 3663
 #endif
-#line 3659
+#line 3663
 }
-#line 3659
+#line 3663
 
 int
-#line 3660
+#line 3664
 ncx_putn_ulonglong_float(void **xpp, size_t nelems, const float *tp, void *fillp)
-#line 3660
+#line 3664
 {
-#line 3660
+#line 3664
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3660
+#line 3664
 
-#line 3660
+#line 3664
  /* basic algorithm is:
-#line 3660
+#line 3664
   *   - ensure sane alignment of output data
-#line 3660
+#line 3664
   *   - copy (conversion happens automatically) input data
-#line 3660
+#line 3664
   *     to output
-#line 3660
+#line 3664
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3660
+#line 3664
   *     at next location for converted output
-#line 3660
+#line 3664
   */
-#line 3660
+#line 3664
   long i, j, ni;
-#line 3660
+#line 3664
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3660
+#line 3664
   uint64 *xp;
-#line 3660
+#line 3664
   int nrange = 0;         /* number of range errors */
-#line 3660
+#line 3664
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3660
+#line 3664
   long cxp = (long) *((char**)xpp);
-#line 3660
+#line 3664
 
-#line 3660
+#line 3664
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3660
+#line 3664
   /* sjl: manually stripmine so we can limit amount of
-#line 3660
+#line 3664
    * vector work space reserved to LOOPCNT elements. Also
-#line 3660
+#line 3664
    * makes vectorisation easy */
-#line 3660
+#line 3664
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3660
+#line 3664
     ni=Min(nelems-j,LOOPCNT);
-#line 3660
+#line 3664
     if (realign) {
-#line 3660
+#line 3664
       xp = tmp;
-#line 3660
+#line 3664
     } else {
-#line 3660
+#line 3664
       xp = (uint64 *) *xpp;
-#line 3660
+#line 3664
     }
-#line 3660
+#line 3664
    /* copy the next block */
-#line 3660
+#line 3664
 #pragma cdir loopcnt=LOOPCNT
-#line 3660
+#line 3664
 #pragma cdir shortloop
-#line 3660
+#line 3664
     for (i=0; i<ni; i++) {
-#line 3660
+#line 3664
       /* the normal case: */
-#line 3660
+#line 3664
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3660
+#line 3664
      /* test for range errors (not always needed but do it anyway) */
-#line 3660
+#line 3664
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3660
+#line 3664
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3660
+#line 3664
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3660
+#line 3664
     }
-#line 3660
+#line 3664
    /* copy workspace back if necessary */
-#line 3660
+#line 3664
     if (realign) {
-#line 3660
+#line 3664
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3660
+#line 3664
       xp = (uint64 *) *xpp;
-#line 3660
+#line 3664
     }
-#line 3660
+#line 3664
    /* update xpp and tp */
-#line 3660
+#line 3664
     xp += ni;
-#line 3660
+#line 3664
     tp += ni;
-#line 3660
+#line 3664
     *xpp = (void*)xp;
-#line 3660
+#line 3664
   }
-#line 3660
+#line 3664
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3660
+#line 3664
 
-#line 3660
+#line 3664
 #else   /* not SX */
-#line 3660
+#line 3664
 
-#line 3660
+#line 3664
 	char *xp = (char *) *xpp;
-#line 3660
+#line 3664
 	int status = NC_NOERR;
-#line 3660
+#line 3664
 
-#line 3660
+#line 3664
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3660
+#line 3664
 	{
-#line 3660
+#line 3664
 		int lstatus = ncx_put_ulonglong_float(xp, tp, fillp);
-#line 3660
+#line 3664
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3660
+#line 3664
 			status = lstatus;
-#line 3660
+#line 3664
 	}
-#line 3660
+#line 3664
 
-#line 3660
+#line 3664
 	*xpp = (void *)xp;
-#line 3660
+#line 3664
 	return status;
-#line 3660
+#line 3664
 #endif
-#line 3660
+#line 3664
 }
-#line 3660
+#line 3664
 
 int
-#line 3661
+#line 3665
 ncx_putn_ulonglong_double(void **xpp, size_t nelems, const double *tp, void *fillp)
-#line 3661
+#line 3665
 {
-#line 3661
+#line 3665
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3661
+#line 3665
 
-#line 3661
+#line 3665
  /* basic algorithm is:
-#line 3661
+#line 3665
   *   - ensure sane alignment of output data
-#line 3661
+#line 3665
   *   - copy (conversion happens automatically) input data
-#line 3661
+#line 3665
   *     to output
-#line 3661
+#line 3665
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3661
+#line 3665
   *     at next location for converted output
-#line 3661
+#line 3665
   */
-#line 3661
+#line 3665
   long i, j, ni;
-#line 3661
+#line 3665
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3661
+#line 3665
   uint64 *xp;
-#line 3661
+#line 3665
   int nrange = 0;         /* number of range errors */
-#line 3661
+#line 3665
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3661
+#line 3665
   long cxp = (long) *((char**)xpp);
-#line 3661
+#line 3665
 
-#line 3661
+#line 3665
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3661
+#line 3665
   /* sjl: manually stripmine so we can limit amount of
-#line 3661
+#line 3665
    * vector work space reserved to LOOPCNT elements. Also
-#line 3661
+#line 3665
    * makes vectorisation easy */
-#line 3661
+#line 3665
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3661
+#line 3665
     ni=Min(nelems-j,LOOPCNT);
-#line 3661
+#line 3665
     if (realign) {
-#line 3661
+#line 3665
       xp = tmp;
-#line 3661
+#line 3665
     } else {
-#line 3661
+#line 3665
       xp = (uint64 *) *xpp;
-#line 3661
+#line 3665
     }
-#line 3661
+#line 3665
    /* copy the next block */
-#line 3661
+#line 3665
 #pragma cdir loopcnt=LOOPCNT
-#line 3661
+#line 3665
 #pragma cdir shortloop
-#line 3661
+#line 3665
     for (i=0; i<ni; i++) {
-#line 3661
+#line 3665
       /* the normal case: */
-#line 3661
+#line 3665
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3661
+#line 3665
      /* test for range errors (not always needed but do it anyway) */
-#line 3661
+#line 3665
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3661
+#line 3665
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3661
+#line 3665
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3661
+#line 3665
     }
-#line 3661
+#line 3665
    /* copy workspace back if necessary */
-#line 3661
+#line 3665
     if (realign) {
-#line 3661
+#line 3665
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3661
+#line 3665
       xp = (uint64 *) *xpp;
-#line 3661
+#line 3665
     }
-#line 3661
+#line 3665
    /* update xpp and tp */
-#line 3661
+#line 3665
     xp += ni;
-#line 3661
+#line 3665
     tp += ni;
-#line 3661
+#line 3665
     *xpp = (void*)xp;
-#line 3661
+#line 3665
   }
-#line 3661
+#line 3665
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3661
+#line 3665
 
-#line 3661
+#line 3665
 #else   /* not SX */
-#line 3661
+#line 3665
 
-#line 3661
+#line 3665
 	char *xp = (char *) *xpp;
-#line 3661
+#line 3665
 	int status = NC_NOERR;
-#line 3661
+#line 3665
 
-#line 3661
+#line 3665
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3661
+#line 3665
 	{
-#line 3661
+#line 3665
 		int lstatus = ncx_put_ulonglong_double(xp, tp, fillp);
-#line 3661
+#line 3665
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3661
+#line 3665
 			status = lstatus;
-#line 3661
+#line 3665
 	}
-#line 3661
+#line 3665
 
-#line 3661
+#line 3665
 	*xpp = (void *)xp;
-#line 3661
+#line 3665
 	return status;
-#line 3661
+#line 3665
 #endif
-#line 3661
+#line 3665
 }
-#line 3661
+#line 3665
 
 int
-#line 3662
+#line 3666
 ncx_putn_ulonglong_longlong(void **xpp, size_t nelems, const longlong *tp, void *fillp)
-#line 3662
+#line 3666
 {
-#line 3662
+#line 3666
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3662
+#line 3666
 
-#line 3662
+#line 3666
  /* basic algorithm is:
-#line 3662
+#line 3666
   *   - ensure sane alignment of output data
-#line 3662
+#line 3666
   *   - copy (conversion happens automatically) input data
-#line 3662
+#line 3666
   *     to output
-#line 3662
+#line 3666
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3662
+#line 3666
   *     at next location for converted output
-#line 3662
+#line 3666
   */
-#line 3662
+#line 3666
   long i, j, ni;
-#line 3662
+#line 3666
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3662
+#line 3666
   uint64 *xp;
-#line 3662
+#line 3666
   int nrange = 0;         /* number of range errors */
-#line 3662
+#line 3666
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3662
+#line 3666
   long cxp = (long) *((char**)xpp);
-#line 3662
+#line 3666
 
-#line 3662
+#line 3666
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3662
+#line 3666
   /* sjl: manually stripmine so we can limit amount of
-#line 3662
+#line 3666
    * vector work space reserved to LOOPCNT elements. Also
-#line 3662
+#line 3666
    * makes vectorisation easy */
-#line 3662
+#line 3666
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3662
+#line 3666
     ni=Min(nelems-j,LOOPCNT);
-#line 3662
+#line 3666
     if (realign) {
-#line 3662
+#line 3666
       xp = tmp;
-#line 3662
+#line 3666
     } else {
-#line 3662
+#line 3666
       xp = (uint64 *) *xpp;
-#line 3662
+#line 3666
     }
-#line 3662
+#line 3666
    /* copy the next block */
-#line 3662
+#line 3666
 #pragma cdir loopcnt=LOOPCNT
-#line 3662
+#line 3666
 #pragma cdir shortloop
-#line 3662
+#line 3666
     for (i=0; i<ni; i++) {
-#line 3662
+#line 3666
       /* the normal case: */
-#line 3662
+#line 3666
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3662
+#line 3666
      /* test for range errors (not always needed but do it anyway) */
-#line 3662
+#line 3666
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3662
+#line 3666
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3662
+#line 3666
       nrange += tp[i] > X_UINT64_MAX || tp[i] < 0;
-#line 3662
+#line 3666
     }
-#line 3662
+#line 3666
    /* copy workspace back if necessary */
-#line 3662
+#line 3666
     if (realign) {
-#line 3662
+#line 3666
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3662
+#line 3666
       xp = (uint64 *) *xpp;
-#line 3662
+#line 3666
     }
-#line 3662
+#line 3666
    /* update xpp and tp */
-#line 3662
+#line 3666
     xp += ni;
-#line 3662
+#line 3666
     tp += ni;
-#line 3662
+#line 3666
     *xpp = (void*)xp;
-#line 3662
+#line 3666
   }
-#line 3662
+#line 3666
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3662
+#line 3666
 
-#line 3662
+#line 3666
 #else   /* not SX */
-#line 3662
+#line 3666
 
-#line 3662
+#line 3666
 	char *xp = (char *) *xpp;
-#line 3662
+#line 3666
 	int status = NC_NOERR;
-#line 3662
+#line 3666
 
-#line 3662
+#line 3666
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3662
+#line 3666
 	{
-#line 3662
+#line 3666
 		int lstatus = ncx_put_ulonglong_longlong(xp, tp, fillp);
-#line 3662
+#line 3666
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3662
+#line 3666
 			status = lstatus;
-#line 3662
+#line 3666
 	}
-#line 3662
+#line 3666
 
-#line 3662
+#line 3666
 	*xpp = (void *)xp;
-#line 3662
+#line 3666
 	return status;
-#line 3662
+#line 3666
 #endif
-#line 3662
+#line 3666
 }
-#line 3662
+#line 3666
 
 int
-#line 3663
+#line 3667
 ncx_putn_ulonglong_uchar(void **xpp, size_t nelems, const uchar *tp, void *fillp)
-#line 3663
+#line 3667
 {
-#line 3663
+#line 3667
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3663
+#line 3667
 
-#line 3663
+#line 3667
  /* basic algorithm is:
-#line 3663
+#line 3667
   *   - ensure sane alignment of output data
-#line 3663
+#line 3667
   *   - copy (conversion happens automatically) input data
-#line 3663
+#line 3667
   *     to output
-#line 3663
+#line 3667
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3663
+#line 3667
   *     at next location for converted output
-#line 3663
+#line 3667
   */
-#line 3663
+#line 3667
   long i, j, ni;
-#line 3663
+#line 3667
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3663
+#line 3667
   uint64 *xp;
-#line 3663
+#line 3667
   int nrange = 0;         /* number of range errors */
-#line 3663
+#line 3667
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3663
+#line 3667
   long cxp = (long) *((char**)xpp);
-#line 3663
+#line 3667
 
-#line 3663
+#line 3667
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3663
+#line 3667
   /* sjl: manually stripmine so we can limit amount of
-#line 3663
+#line 3667
    * vector work space reserved to LOOPCNT elements. Also
-#line 3663
+#line 3667
    * makes vectorisation easy */
-#line 3663
+#line 3667
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3663
+#line 3667
     ni=Min(nelems-j,LOOPCNT);
-#line 3663
+#line 3667
     if (realign) {
-#line 3663
+#line 3667
       xp = tmp;
-#line 3663
+#line 3667
     } else {
-#line 3663
+#line 3667
       xp = (uint64 *) *xpp;
-#line 3663
+#line 3667
     }
-#line 3663
+#line 3667
    /* copy the next block */
-#line 3663
+#line 3667
 #pragma cdir loopcnt=LOOPCNT
-#line 3663
+#line 3667
 #pragma cdir shortloop
-#line 3663
+#line 3667
     for (i=0; i<ni; i++) {
-#line 3663
+#line 3667
       /* the normal case: */
-#line 3663
+#line 3667
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3663
+#line 3667
      /* test for range errors (not always needed but do it anyway) */
-#line 3663
+#line 3667
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3663
+#line 3667
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3663
+#line 3667
       nrange += tp[i] > X_UINT64_MAX ;
-#line 3663
+#line 3667
     }
-#line 3663
+#line 3667
    /* copy workspace back if necessary */
-#line 3663
+#line 3667
     if (realign) {
-#line 3663
+#line 3667
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3663
+#line 3667
       xp = (uint64 *) *xpp;
-#line 3663
+#line 3667
     }
-#line 3663
+#line 3667
    /* update xpp and tp */
-#line 3663
+#line 3667
     xp += ni;
-#line 3663
+#line 3667
     tp += ni;
-#line 3663
+#line 3667
     *xpp = (void*)xp;
-#line 3663
+#line 3667
   }
-#line 3663
+#line 3667
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3663
+#line 3667
 
-#line 3663
+#line 3667
 #else   /* not SX */
-#line 3663
+#line 3667
 
-#line 3663
+#line 3667
 	char *xp = (char *) *xpp;
-#line 3663
+#line 3667
 	int status = NC_NOERR;
-#line 3663
+#line 3667
 
-#line 3663
+#line 3667
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3663
+#line 3667
 	{
-#line 3663
+#line 3667
 		int lstatus = ncx_put_ulonglong_uchar(xp, tp, fillp);
-#line 3663
+#line 3667
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3663
+#line 3667
 			status = lstatus;
-#line 3663
+#line 3667
 	}
-#line 3663
+#line 3667
 
-#line 3663
+#line 3667
 	*xpp = (void *)xp;
-#line 3663
+#line 3667
 	return status;
-#line 3663
+#line 3667
 #endif
-#line 3663
+#line 3667
 }
-#line 3663
+#line 3667
 
 int
-#line 3664
+#line 3668
 ncx_putn_ulonglong_ushort(void **xpp, size_t nelems, const ushort *tp, void *fillp)
-#line 3664
+#line 3668
 {
-#line 3664
+#line 3668
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3664
+#line 3668
 
-#line 3664
+#line 3668
  /* basic algorithm is:
-#line 3664
+#line 3668
   *   - ensure sane alignment of output data
-#line 3664
+#line 3668
   *   - copy (conversion happens automatically) input data
-#line 3664
+#line 3668
   *     to output
-#line 3664
+#line 3668
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3664
+#line 3668
   *     at next location for converted output
-#line 3664
+#line 3668
   */
-#line 3664
+#line 3668
   long i, j, ni;
-#line 3664
+#line 3668
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3664
+#line 3668
   uint64 *xp;
-#line 3664
+#line 3668
   int nrange = 0;         /* number of range errors */
-#line 3664
+#line 3668
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3664
+#line 3668
   long cxp = (long) *((char**)xpp);
-#line 3664
+#line 3668
 
-#line 3664
+#line 3668
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3664
+#line 3668
   /* sjl: manually stripmine so we can limit amount of
-#line 3664
+#line 3668
    * vector work space reserved to LOOPCNT elements. Also
-#line 3664
+#line 3668
    * makes vectorisation easy */
-#line 3664
+#line 3668
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3664
+#line 3668
     ni=Min(nelems-j,LOOPCNT);
-#line 3664
+#line 3668
     if (realign) {
-#line 3664
+#line 3668
       xp = tmp;
-#line 3664
+#line 3668
     } else {
-#line 3664
+#line 3668
       xp = (uint64 *) *xpp;
-#line 3664
+#line 3668
     }
-#line 3664
+#line 3668
    /* copy the next block */
-#line 3664
+#line 3668
 #pragma cdir loopcnt=LOOPCNT
-#line 3664
+#line 3668
 #pragma cdir shortloop
-#line 3664
+#line 3668
     for (i=0; i<ni; i++) {
-#line 3664
+#line 3668
       /* the normal case: */
-#line 3664
+#line 3668
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3664
+#line 3668
      /* test for range errors (not always needed but do it anyway) */
-#line 3664
+#line 3668
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3664
+#line 3668
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3664
+#line 3668
       nrange += tp[i] > X_UINT64_MAX ;
-#line 3664
+#line 3668
     }
-#line 3664
+#line 3668
    /* copy workspace back if necessary */
-#line 3664
+#line 3668
     if (realign) {
-#line 3664
+#line 3668
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3664
+#line 3668
       xp = (uint64 *) *xpp;
-#line 3664
+#line 3668
     }
-#line 3664
+#line 3668
    /* update xpp and tp */
-#line 3664
+#line 3668
     xp += ni;
-#line 3664
+#line 3668
     tp += ni;
-#line 3664
+#line 3668
     *xpp = (void*)xp;
-#line 3664
+#line 3668
   }
-#line 3664
+#line 3668
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3664
+#line 3668
 
-#line 3664
+#line 3668
 #else   /* not SX */
-#line 3664
+#line 3668
 
-#line 3664
+#line 3668
 	char *xp = (char *) *xpp;
-#line 3664
+#line 3668
 	int status = NC_NOERR;
-#line 3664
+#line 3668
 
-#line 3664
+#line 3668
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3664
+#line 3668
 	{
-#line 3664
+#line 3668
 		int lstatus = ncx_put_ulonglong_ushort(xp, tp, fillp);
-#line 3664
+#line 3668
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3664
+#line 3668
 			status = lstatus;
-#line 3664
+#line 3668
 	}
-#line 3664
+#line 3668
 
-#line 3664
+#line 3668
 	*xpp = (void *)xp;
-#line 3664
+#line 3668
 	return status;
-#line 3664
+#line 3668
 #endif
-#line 3664
+#line 3668
 }
-#line 3664
+#line 3668
 
 int
-#line 3665
+#line 3669
 ncx_putn_ulonglong_uint(void **xpp, size_t nelems, const uint *tp, void *fillp)
-#line 3665
+#line 3669
 {
-#line 3665
+#line 3669
 #if defined(_SX) && _SX != 0 && X_SIZEOF_UINT64 == SIZEOF_UINT64
-#line 3665
+#line 3669
 
-#line 3665
+#line 3669
  /* basic algorithm is:
-#line 3665
+#line 3669
   *   - ensure sane alignment of output data
-#line 3665
+#line 3669
   *   - copy (conversion happens automatically) input data
-#line 3665
+#line 3669
   *     to output
-#line 3665
+#line 3669
   *   - update tp to point at next unconverted input, and xpp to point
-#line 3665
+#line 3669
   *     at next location for converted output
-#line 3665
+#line 3669
   */
-#line 3665
+#line 3669
   long i, j, ni;
-#line 3665
+#line 3669
   uint64 tmp[LOOPCNT];        /* in case input is misaligned */
-#line 3665
+#line 3669
   uint64 *xp;
-#line 3665
+#line 3669
   int nrange = 0;         /* number of range errors */
-#line 3665
+#line 3669
   int realign = 0;        /* "do we need to fix input data alignment?" */
-#line 3665
+#line 3669
   long cxp = (long) *((char**)xpp);
-#line 3665
+#line 3669
 
-#line 3665
+#line 3669
   realign = (cxp & 7) % SIZEOF_UINT64;
-#line 3665
+#line 3669
   /* sjl: manually stripmine so we can limit amount of
-#line 3665
+#line 3669
    * vector work space reserved to LOOPCNT elements. Also
-#line 3665
+#line 3669
    * makes vectorisation easy */
-#line 3665
+#line 3669
   for (j=0; j<nelems && nrange==0; j+=LOOPCNT) {
-#line 3665
+#line 3669
     ni=Min(nelems-j,LOOPCNT);
-#line 3665
+#line 3669
     if (realign) {
-#line 3665
+#line 3669
       xp = tmp;
-#line 3665
+#line 3669
     } else {
-#line 3665
+#line 3669
       xp = (uint64 *) *xpp;
-#line 3665
+#line 3669
     }
-#line 3665
+#line 3669
    /* copy the next block */
-#line 3665
+#line 3669
 #pragma cdir loopcnt=LOOPCNT
-#line 3665
+#line 3669
 #pragma cdir shortloop
-#line 3665
+#line 3669
     for (i=0; i<ni; i++) {
-#line 3665
+#line 3669
       /* the normal case: */
-#line 3665
+#line 3669
       xp[i] = (uint64) Max( X_UINT64_MIN, Min(X_UINT64_MAX, (uint64) tp[i]));
-#line 3665
+#line 3669
      /* test for range errors (not always needed but do it anyway) */
-#line 3665
+#line 3669
      /* if xpp is unsigned && tp is signed, we need check if tp[i] >= 0 */
-#line 3665
+#line 3669
      /* if tp is unsigned, we need not check if tp[i] < X__MIN */
-#line 3665
+#line 3669
       nrange += tp[i] > X_UINT64_MAX ;
-#line 3665
+#line 3669
     }
-#line 3665
+#line 3669
    /* copy workspace back if necessary */
-#line 3665
+#line 3669
     if (realign) {
-#line 3665
+#line 3669
       memcpy(*xpp, tmp, (size_t)*ni*X_SIZEOF_UINT64);
-#line 3665
+#line 3669
       xp = (uint64 *) *xpp;
-#line 3665
+#line 3669
     }
-#line 3665
+#line 3669
    /* update xpp and tp */
-#line 3665
+#line 3669
     xp += ni;
-#line 3665
+#line 3669
     tp += ni;
-#line 3665
+#line 3669
     *xpp = (void*)xp;
-#line 3665
+#line 3669
   }
-#line 3665
+#line 3669
   return nrange == 0 ? NC_NOERR : NC_ERANGE;
-#line 3665
+#line 3669
 
-#line 3665
+#line 3669
 #else   /* not SX */
-#line 3665
+#line 3669
 
-#line 3665
+#line 3669
 	char *xp = (char *) *xpp;
-#line 3665
+#line 3669
 	int status = NC_NOERR;
-#line 3665
+#line 3669
 
-#line 3665
+#line 3669
 	for( ; nelems != 0; nelems--, xp += X_SIZEOF_UINT64, tp++)
-#line 3665
+#line 3669
 	{
-#line 3665
+#line 3669
 		int lstatus = ncx_put_ulonglong_uint(xp, tp, fillp);
-#line 3665
+#line 3669
 		if (status == NC_NOERR) /* report the first encountered error */
-#line 3665
+#line 3669
 			status = lstatus;
-#line 3665
+#line 3669
 	}
-#line 3665
+#line 3669
 
-#line 3665
+#line 3669
 	*xpp = (void *)xp;
-#line 3665
+#line 3669
 	return status;
-#line 3665
+#line 3669
 #endif
-#line 3665
+#line 3669
 }
-#line 3665
+#line 3669
 
 
 
@@ -37262,11 +37266,11 @@ int
 ncx_getn_text(const void **xpp, size_t nelems, char *tp)
 {
 	(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 3677
+#line 3681
 	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3677
+#line 3681
 	return NC_NOERR;
-#line 3677
+#line 3681
 
 }
 
@@ -37274,23 +37278,23 @@ int
 ncx_pad_getn_text(const void **xpp, size_t nelems, char *tp)
 {
 	size_t rndup = nelems % X_ALIGN;
-#line 3683
+#line 3687
 
-#line 3683
+#line 3687
 	if (rndup)
-#line 3683
+#line 3687
 		rndup = X_ALIGN - rndup;
-#line 3683
+#line 3687
 
-#line 3683
+#line 3687
 	(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 3683
+#line 3687
 	*xpp = (void *)((char *)(*xpp) + nelems + rndup);
-#line 3683
+#line 3687
 
-#line 3683
+#line 3687
 	return NC_NOERR;
-#line 3683
+#line 3687
 
 }
 
@@ -37298,13 +37302,13 @@ int
 ncx_putn_text(void **xpp, size_t nelems, const char *tp)
 {
 	(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 3689
+#line 3693
 	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3689
+#line 3693
 
-#line 3689
+#line 3693
 	return NC_NOERR;
-#line 3689
+#line 3693
 
 }
 
@@ -37312,35 +37316,35 @@ int
 ncx_pad_putn_text(void **xpp, size_t nelems, const char *tp)
 {
 	size_t rndup = nelems % X_ALIGN;
-#line 3695
+#line 3699
 
-#line 3695
+#line 3699
 	if (rndup)
-#line 3695
+#line 3699
 		rndup = X_ALIGN - rndup;
-#line 3695
+#line 3699
 
-#line 3695
+#line 3699
 	(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 3695
+#line 3699
 	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3695
+#line 3699
 
-#line 3695
+#line 3699
 	if (rndup)
-#line 3695
+#line 3699
 	{
-#line 3695
+#line 3699
 		(void) memcpy(*xpp, nada, (size_t)rndup);
-#line 3695
+#line 3699
 		*xpp = (void *)((char *)(*xpp) + rndup);
-#line 3695
+#line 3699
 	}
-#line 3695
+#line 3699
 
-#line 3695
+#line 3699
 	return NC_NOERR;
-#line 3695
+#line 3699
 
 }
 
@@ -37351,11 +37355,11 @@ int
 ncx_getn_void(const void **xpp, size_t nelems, void *tp)
 {
 	(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 3704
+#line 3708
 	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3704
+#line 3708
 	return NC_NOERR;
-#line 3704
+#line 3708
 
 }
 
@@ -37363,23 +37367,23 @@ int
 ncx_pad_getn_void(const void **xpp, size_t nelems, void *tp)
 {
 	size_t rndup = nelems % X_ALIGN;
-#line 3710
+#line 3714
 
-#line 3710
+#line 3714
 	if (rndup)
-#line 3710
+#line 3714
 		rndup = X_ALIGN - rndup;
-#line 3710
+#line 3714
 
-#line 3710
+#line 3714
 	(void) memcpy(tp, *xpp, (size_t)nelems);
-#line 3710
+#line 3714
 	*xpp = (void *)((char *)(*xpp) + nelems + rndup);
-#line 3710
+#line 3714
 
-#line 3710
+#line 3714
 	return NC_NOERR;
-#line 3710
+#line 3714
 
 }
 
@@ -37387,13 +37391,13 @@ int
 ncx_putn_void(void **xpp, size_t nelems, const void *tp)
 {
 	(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 3716
+#line 3720
 	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3716
+#line 3720
 
-#line 3716
+#line 3720
 	return NC_NOERR;
-#line 3716
+#line 3720
 
 }
 
@@ -37401,34 +37405,34 @@ int
 ncx_pad_putn_void(void **xpp, size_t nelems, const void *tp)
 {
 	size_t rndup = nelems % X_ALIGN;
-#line 3722
+#line 3726
 
-#line 3722
+#line 3726
 	if (rndup)
-#line 3722
+#line 3726
 		rndup = X_ALIGN - rndup;
-#line 3722
+#line 3726
 
-#line 3722
+#line 3726
 	(void) memcpy(*xpp, tp, (size_t)nelems);
-#line 3722
+#line 3726
 	*xpp = (void *)((char *)(*xpp) + nelems);
-#line 3722
+#line 3726
 
-#line 3722
+#line 3726
 	if (rndup)
-#line 3722
+#line 3726
 	{
-#line 3722
+#line 3726
 		(void) memcpy(*xpp, nada, (size_t)rndup);
-#line 3722
+#line 3726
 		*xpp = (void *)((char *)(*xpp) + rndup);
-#line 3722
+#line 3726
 	}
-#line 3722
+#line 3726
 
-#line 3722
+#line 3726
 	return NC_NOERR;
-#line 3722
+#line 3726
 
 }
diff --git a/libsrc/ncx.h b/libsrc/ncx.h
index 805d110..6b2313c 100644
--- a/libsrc/ncx.h
+++ b/libsrc/ncx.h
@@ -92,9 +92,9 @@
 #define X_INT_MIN	(-2147483647-1)
 #define X_INT_MAX	2147483647
 #define X_UINT_MAX	4294967295U
-#define X_LONGLONG_MIN	(-9223372036854775807LL-1LL)
-#define X_LONGLONG_MAX	9223372036854775807LL
-#define X_ULONGLONG_MAX	18446744073709551615ULL
+#define X_INT64_MIN	(-9223372036854775807LL-1LL)
+#define X_INT64_MAX	9223372036854775807LL
+#define X_UINT64_MAX	18446744073709551615ULL
 #define X_FLOAT_MAX	3.402823466e+38f
 #define X_FLOAT_MIN	(-X_FLOAT_MAX)
 #define X_FLT_MAX	X_FLOAT_MAX	/* alias compatible with limits.h */
diff --git a/libsrc/ncx.m4 b/libsrc/ncx.m4
index 219e145..319cdb3 100644
--- a/libsrc/ncx.m4
+++ b/libsrc/ncx.m4
@@ -999,7 +999,11 @@ get_ix_int(const void *xp, ix_int *ip)
 {
 	const uchar *cp = (const uchar *) xp;
 
+#if INT_MAX  >= X_INT_MAX
+	*ip = (ix_int)((unsigned)(*cp++) << 24);
+#else
 	*ip = *cp++ << 24;
+#endif
 #if SIZEOF_IX_INT > X_SIZEOF_INT
 	if (*ip & 0x80000000)
 	{
@@ -2196,7 +2200,7 @@ APIPrefix`x_get_size_t'(const void **xpp,  size_t *ulp)
 	/* similar to get_ix_int */
 	const uchar *cp = (const uchar *) *xpp;
 
-	*ulp  = (unsigned)(*cp++ << 24);
+	*ulp  = (unsigned)(*cp++) << 24;
 	*ulp |= (*cp++ << 16);
 	*ulp |= (*cp++ << 8);
 	*ulp |= *cp;
diff --git a/libsrc/posixio.c b/libsrc/posixio.c
index 67fe48f..5a7fc67 100644
--- a/libsrc/posixio.c
+++ b/libsrc/posixio.c
@@ -118,16 +118,16 @@ static int ncio_spx_close(ncio *nciop, int doUnlink);
  * @par fd File Descriptor.
  * @return -1 on error, length of file (in bytes) otherwise.
  */
-static size_t nc_get_filelen(const int fd) {
+static off_t nc_get_filelen(const int fd) {
 
-  size_t flen;
+  off_t flen;
 
 #ifdef HAVE_FILE_LENGTH_I64
   __int64 file_len = 0;
   if ((file_len = _filelengthi64(fd)) < 0) {
     return file_len;
   }
-  flen = (size_t)file_len;
+  flen = (off_t)file_len;
 
 #else
   int res = 0;
@@ -243,7 +243,7 @@ fgrow2(const int fd, const off_t len)
   */
 
 
-  size_t file_len = nc_get_filelen(fd);
+  off_t file_len = nc_get_filelen(fd);
   if(file_len < 0) return errno;
   if(len <= file_len)
     return NC_NOERR;
diff --git a/libsrc4/Makefile.in b/libsrc4/Makefile.in
index bce21d7..c73a022 100644
--- a/libsrc4/Makefile.in
+++ b/libsrc4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c
index c008097..faeb4bf 100644
--- a/libsrc4/nc4file.c
+++ b/libsrc4/nc4file.c
@@ -25,10 +25,7 @@ extern int nc4_vararray_add(NC_GRP_INFO_T *grp,
 #ifdef USE_HDF4
 #include <mfhdf.h>
 #endif
-
-#ifdef USE_DISKLESS
 #include <hdf5_hl.h>
-#endif
 
 /* When we have open objects at file close, should
    we log them or print to stdout. Default is to log
@@ -302,9 +299,7 @@ nc_check_for_hdf(const char *path, int flags, void* parameters, int *hdf_file)
    MPI_Info info = MPI_INFO_NULL;
 #endif
    int inmemory = ((flags & NC_INMEMORY) == NC_INMEMORY);
-#ifdef USE_DISKLESS
    NC_MEM_INFO* meminfo = (NC_MEM_INFO*)parameters;
-#endif
 
 #ifdef USE_PARALLEL4
    if(use_parallel) {
@@ -602,15 +597,15 @@ NC4_create(const char* path, int cmode, size_t initialsz, int basepe,
 
    /* Check the cmode for validity. */
    if((cmode & ILLEGAL_CREATE_FLAGS) != 0)
-      return NC_EINVAL;
+      {res = NC_EINVAL; goto done;}
 
    /* Cannot have both */
    if((cmode & (NC_MPIIO|NC_MPIPOSIX)) == (NC_MPIIO|NC_MPIPOSIX))
-      return NC_EINVAL;
+      {res = NC_EINVAL; goto done;}
 
    /* Currently no parallel diskless io */
    if((cmode & (NC_MPIIO | NC_MPIPOSIX)) && (cmode & NC_DISKLESS))
-      return NC_EINVAL;
+      {res = NC_EINVAL; goto done;}
 
 #ifndef USE_PARALLEL_POSIX
 /* If the HDF5 library has been compiled without the MPI-POSIX VFD, alias
@@ -636,8 +631,10 @@ NC4_create(const char* path, int cmode, size_t initialsz, int basepe,
    LOG((2, "cmode after applying default format: 0x%x", cmode));
 
    nc_file->int_ncid = nc_file->ext_ncid;
-   res = nc4_create_file(nc_file->path, cmode, comm, info, nc_file);
 
+   res = nc4_create_file(path, cmode, comm, info, nc_file);
+
+done:
    return res;
 }
 
@@ -2231,9 +2228,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
    int retval;
    NC_HDF5_FILE_INFO_T* nc4_info = NULL;
    int inmemory = ((mode & NC_INMEMORY) == NC_INMEMORY);
-#ifdef USE_DISKLESS
    NC_MEM_INFO* meminfo = (NC_MEM_INFO*)parameters;
-#endif
 #ifdef USE_PARALLEL4
    NC_MPI_INFO* mpiinfo = (NC_MPI_INFO*)parameters;
    int comm_duped = 0;          /* Whether the MPI Communicator was duplicated */
@@ -2845,11 +2840,11 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
 
    /* Check the mode for validity */
    if((mode & ILLEGAL_OPEN_FLAGS) != 0)
-      return NC_EINVAL;
+      {res = NC_EINVAL; goto done;}
 
    /* Cannot have both */
    if((mode & (NC_MPIIO|NC_MPIPOSIX)) == (NC_MPIIO|NC_MPIPOSIX))
-      return NC_EINVAL;
+      {res = NC_EINVAL; goto done;}
 
 #ifndef USE_PARALLEL_POSIX
 /* If the HDF5 library has been compiled without the MPI-POSIX VFD, alias
@@ -2864,7 +2859,7 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
 
    /* Figure out if this is a hdf4 or hdf5 file. */
    if ((res = nc_check_for_hdf(path, use_parallel, parameters, &hdf_file)))
-	return res;
+	goto done;
 
    /* Depending on the type of file, open it. */
    nc_file->int_ncid = nc_file->ext_ncid;
@@ -2872,12 +2867,13 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
        res = nc4_open_file(path, mode, parameters, nc_file);
 #ifdef USE_HDF4
    else if (hdf_file == NC_HDF4_FILE && inmemory)
-	return NC_EDISKLESS;
+	{res = NC_EDISKLESS; goto done;}
    else if (hdf_file == NC_HDF4_FILE)
        res = nc4_open_hdf4_file(path, mode, nc_file);
 #endif /* USE_HDF4 */
    else
-         assert(0); /* should never happen */
+       assert(0); /* should never happen */
+done:
    return res;
 }
 
diff --git a/libsrc4/nc4info.c b/libsrc4/nc4info.c
index 2424f8e..b6564f1 100644
--- a/libsrc4/nc4info.c
+++ b/libsrc4/nc4info.c
@@ -170,11 +170,9 @@ NC4_put_propattr(NC_HDF5_FILE_INFO_T* h5)
       herr = 0;
     }
  done:
-    if(ncstat != NC_NOERR) {
-      if(text != NULL) {
-        free(text);
-        text = NULL;
-      }
+    if(text != NULL) {
+      free(text);
+      text = NULL;
     }
 
     if(attid >= 0) HCHECK((H5Aclose(attid)));
diff --git a/libsrcp/Makefile.in b/libsrcp/Makefile.in
index 9f4d283..4a35ab6 100644
--- a/libsrcp/Makefile.in
+++ b/libsrcp/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/libsrcp/ncpdispatch.c b/libsrcp/ncpdispatch.c
index 19b2d31..04f5ec8 100644
--- a/libsrcp/ncpdispatch.c
+++ b/libsrcp/ncpdispatch.c
@@ -9,6 +9,7 @@
 #include <mpi.h>
 #include "nc.h"
 #include "ncdispatch.h"
+
 /* Must follow netcdf.h */
 #include <pnetcdf.h>
 
@@ -50,15 +51,15 @@ NCP_create(const char *path, int cmode,
 
     /* Check the cmode for only valid flags*/
     if(cmode & ~LEGAL_CREATE_FLAGS)
-	return NC_EINVAL;
+	{res = NC_EINVAL; goto done;}
 
     /* Cannot have both MPIO flags */
     if((cmode & (NC_MPIIO|NC_MPIPOSIX)) == (NC_MPIIO|NC_MPIPOSIX))
-	return NC_EINVAL;
+	{res = NC_EINVAL; goto done;}
 
     /* Cannot have both NC_64BIT_OFFSET & NC_64BIT_DATA */
     if((cmode & (NC_64BIT_OFFSET|NC_64BIT_DATA)) == (NC_64BIT_OFFSET|NC_64BIT_DATA))
- 	return NC_EINVAL;
+	{res = NC_EINVAL; goto done;}
 
     default_format = nc_get_default_format();
     /* if (default_format == NC_FORMAT_CLASSIC) then we respect the format set in cmode */
@@ -72,14 +73,17 @@ NCP_create(const char *path, int cmode,
     }
 
     /* No MPI environment initialized */
-    if (mpidata == NULL) return NC_ENOPAR;
+    if (mpidata == NULL)
+	{res = NC_ENOPAR; goto done;}
 
     comm = ((NC_MPI_INFO *)mpidata)->comm;
     info = ((NC_MPI_INFO *)mpidata)->info;
 
     /* Create our specific NCP_INFO instance */
+
     nc5 = (NCP_INFO*)calloc(1,sizeof(NCP_INFO));
-    if(nc5 == NULL) return NC_ENOMEM;
+    if(nc5 == NULL)
+	{res = NC_ENOMEM; goto done;}
 
     /* Link nc5 and nc */
     NCP_DATA_SET(nc,nc5);
@@ -97,9 +101,11 @@ NCP_create(const char *path, int cmode,
     */
     /* PnetCDF recognizes the flags below for create and ignores NC_LOCK and  NC_SHARE */
     cmode &= (NC_WRITE | NC_NOCLOBBER | NC_SHARE | NC_64BIT_OFFSET | NC_64BIT_DATA);
+
     res = ncmpi_create(comm, path, cmode, info, &(nc->int_ncid));
 
     if(res && nc5 != NULL) free(nc5); /* reclaim allocated space */
+done:
     return res;
 }
 
@@ -116,16 +122,15 @@ NCP_open(const char *path, int cmode,
 
     /* Check the cmode for only valid flags*/
     if(cmode & ~LEGAL_OPEN_FLAGS)
-	return NC_EINVAL;
+	{res = NC_EINVAL; goto done;}
 
     /* Cannot have both MPIO flags */
     if((cmode & (NC_MPIIO|NC_MPIPOSIX)) == (NC_MPIIO|NC_MPIPOSIX))
-	return NC_EINVAL;
+	{res = NC_EINVAL; goto done;}
 
     /* Appears that this comment is wrong; allow 64 bit offset*/
     /* Cannot have 64 bit offset flag */
-    /* if(cmode & (NC_64BIT_OFFSET)) return NC_EINVAL; */
-
+    /* if(cmode & (NC_64BIT_OFFSET)) {res = NC_EINVAL; goto done;} */
     if(mpidata != NULL) {
         comm = ((NC_MPI_INFO *)mpidata)->comm;
         info = ((NC_MPI_INFO *)mpidata)->info;
@@ -145,7 +150,7 @@ NCP_open(const char *path, int cmode,
 
     /* Create our specific NCP_INFO instance */
     nc5 = (NCP_INFO*)calloc(1,sizeof(NCP_INFO));
-    if(nc5 == NULL) return NC_ENOMEM;
+    if(nc5 == NULL) {res = NC_ENOMEM; goto done;}
 
     /* Link nc5 and nc */
     NCP_DATA_SET(nc,nc5);
@@ -157,7 +162,7 @@ NCP_open(const char *path, int cmode,
 	res = ncmpi_begin_indep_data(nc->int_ncid);
 	nc5->pnetcdf_access_mode = NC_INDEPENDENT;
     }
-
+done:
     return res;
 }
 
diff --git a/missing b/missing
index f62bbae..c6e3795 100755
--- a/missing
+++ b/missing
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2013-10-28.13; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -210,6 +210,6 @@ exit $st
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/nc-config.cmake.in b/nc-config.cmake.in
index f04c1f5..f065e62 100644
--- a/nc-config.cmake.in
+++ b/nc-config.cmake.in
@@ -96,12 +96,16 @@ fi
 
 has_cxx="no"
 has_cxx4="no"
-if type -p ncxx4-config > /dev/null 2>&1; then
+
+ncxxconf=$(which ncxx-config 2>/dev/null)
+ncxx4conf=$(which ncxx4-config 2>/dev/null)
+
+if [ -f "$ncxx4conf" ]; 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
+elif [ -f "$ncxxconf" ]; then
   cxx=`ncxx-config --cxx`
   cxxflags=`ncxx-config --cflags`
   cxxlibs=`ncxx-config --libs`
@@ -139,13 +143,13 @@ Available values for OPTION include:
   --version     Library version
 
 EOF
-if type -p ncxx4-config > /dev/null 2>&1; then
+if [ -f "$ncxx4conf" ]; then
     cat <<EOF
   --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
+elif [ -f "$ncxxconf" ]; then
     cat <<EOF
   --cxx         C++ compiler
   --cxxflags    flags needed to compile a C++ program
@@ -176,14 +180,14 @@ all()
         echo "  --has-c++   -> $has_cxx"
         echo "  --cxx       -> $cxx"
 
-if type -p ncxx-config > /dev/null 2>&1; then
+if [ -f "$ncxxconf" ]; 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
+if [ -f "$ncxx4conf" ]; then
         echo "  --cxx4flags -> $cxx4flags"
         echo "  --cxx4libs  -> $cxx4libs"
 fi
diff --git a/nc-config.in b/nc-config.in
index d0cadfd..9e3e57f 100644
--- a/nc-config.in
+++ b/nc-config.in
@@ -40,12 +40,16 @@ fi
 
 has_cxx="no"
 has_cxx4="no"
-if type -p ncxx4-config > /dev/null 2>&1; then
+
+ncxxconf=$(which ncxx-config 2>/dev/null)
+ncxx4conf=$(which ncxx4-config 2>/dev/null)
+
+if [ -f "$ncxx4conf" ]; 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
+elif [ -f "$ncxxconf" ]; then
   cxx=`ncxx-config --cxx`
   cxxflags=`ncxx-config --cflags`
   cxxlibs=`ncxx-config --libs`
@@ -82,13 +86,13 @@ Available values for OPTION include:
   --version     Library version
 
 EOF
-if type -p ncxx4-config > /dev/null 2>&1; then
+if [ -f "$ncxx4conf" ]; then
     cat <<EOF
   --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
+elif [ -f "$ncxxconf" ]; then
     cat <<EOF
   --cxx         C++ compiler
   --cxxflags    flags needed to compile a C++ program
@@ -119,14 +123,14 @@ all()
         echo "  --has-c++   -> $has_cxx"
         echo "  --cxx       -> $cxx"
 
-if type -p ncxx-config > /dev/null 2>&1; then
+if [ -f "$ncxxconf" ]; 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
+if [ -f "$ncxx4conf" ]; then
         echo "  --cxx4flags -> $cxx4flags"
         echo "  --cxx4libs  -> $cxx4libs"
 fi
diff --git a/nc_test/Makefile.in b/nc_test/Makefile.in
index 69f59a4..cbc8dda 100644
--- a/nc_test/Makefile.in
+++ b/nc_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/nc_test/large_files.c b/nc_test/large_files.c
index cd23526..f92d785 100644
--- a/nc_test/large_files.c
+++ b/nc_test/large_files.c
@@ -3,7 +3,7 @@
   See COPYRIGHT file for copying and redistribution conditions.
 
   This is part of netCDF.
-   
+
   This program also takes a long time to run - it writes some data in
   a very large file, and then reads it all back to be sure it's
   correct.
@@ -47,11 +47,13 @@ main(int argc, char **argv) {
    int n_dim;
 
 #define NUMRECS 2
-#define I_LEN 5
-#if 0
-#define J_LEN 214700000
-#endif
-#define J_LEN   500000000
+#define I_LEN 4106
+   //#define I_LEN 5
+   //#if 0
+   //#define J_LEN 214700000
+   //#endif
+   //#define J_LEN   500000000
+#define J_LEN 1023
 #define K_LEN 1023
 #define N_LEN 2
 
@@ -157,7 +159,7 @@ main(int argc, char **argv) {
    check_err(stat,__LINE__,__FILE__);
 
    {			/* read var1 */
-     
+
      /*static float avar1[J_LEN];*/
      static float *avar1 = NULL;
      avar1 = (float*)malloc(sizeof(float)*J_LEN);
@@ -172,11 +174,11 @@ main(int argc, char **argv) {
          avar1_start[1] = i;
          stat = nc_get_vara_float(ncid, var1_id, avar1_start, avar1_count, avar1);
          check_err(stat,__LINE__,__FILE__);
-         for(j=0; j<J_LEN; j++) 
+         for(j=0; j<J_LEN; j++)
          {
            if (avar1[j] != (float)(j + (rec + 1) * i)) {
              printf("Error on read, var1[%d, %d, %d] = %g wrong, "
-                    "should be %g !\n", rec, i, j, avar1[j], (float) (j + (rec + 1)* i)); 
+                    "should be %g !\n", rec, i, j, avar1[j], (float) (j + (rec + 1)* i));
              return 1;
            }
          }
diff --git a/nc_test/test_get.c b/nc_test/test_get.c
deleted file mode 100644
index f9629d4..0000000
--- a/nc_test/test_get.c
+++ /dev/null
@@ -1,12203 +0,0 @@
-/* Do not edit this file. It is produced from the corresponding .m4 source */
-/*
- *  Copyright (C) 2003, Northwestern University and Argonne National Laboratory
- *  See COPYRIGHT notice in top-level directory.
- */
-/* $Id: test_get.m4 2672 2016-12-03 19:23:53Z wkliao $ */
-
-
-#include "tests.h"
-
-#ifdef USE_PNETCDF
-#include <pnetcdf.h>
-#ifndef PNETCDF_VERSION_MAJOR
-#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
-#endif
-#ifndef PNETCDF_VERSION_MINOR
-#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
-#endif
-#endif
-
-
-
-
-
-
-
-
-
-
-int
-test_nc_get_var1_text(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    text value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_text(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_text(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_text(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_text(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_TEXT);
-            err = nc_get_var1_text(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_TEXT)) {
-                    if (1) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_TEXT)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_schar(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    schar value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_schar(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_schar(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_schar(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_schar(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_SCHAR);
-            err = nc_get_var1_schar(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_SCHAR)) {
-                    if ((expect >= schar_min && expect <= schar_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_SCHAR)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_uchar(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    uchar value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_uchar(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_uchar(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_uchar(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_uchar(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_UCHAR);
-            err = nc_get_var1_uchar(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_UCHAR)) {
-                    if ((expect >= uchar_min && expect <= uchar_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            /* in put_vars(), API _put_vara_double() is used to
-                             * write the NC_BYTE variables to files. In this
-                             * case, NC_BYTE variables are treated as signed
-                             * for CDF-1 and 2 formats. Thus, we must skip the
-                             * equal test below for uchar.
-                             */
-                            if (cdf_format < NC_FORMAT_CDF5 && var_type[i] == NC_BYTE && expect > schar_max) continue;
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_UCHAR)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_short(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    short value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_short(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_short(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_short(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_short(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_SHORT);
-            err = nc_get_var1_short(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_SHORT)) {
-                    if ((expect >= short_min && expect <= short_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_SHORT)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_int(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    int value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_int(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_int(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_int(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_int(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_INT);
-            err = nc_get_var1_int(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_INT)) {
-                    if ((expect >= int_min && expect <= int_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_INT)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_long(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    long value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_long(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_long(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_long(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_long(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_LONG);
-            err = nc_get_var1_long(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_LONG)) {
-                    if ((expect >= long_min && expect <= long_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_LONG)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_float(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    float value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_float(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_float(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_float(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_float(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_FLOAT);
-            err = nc_get_var1_float(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_FLOAT)) {
-                    if ((expect >= float_min && expect <= float_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_FLOAT)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_double(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    double value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_double(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_double(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_double(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_double(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_DOUBLE);
-            err = nc_get_var1_double(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_DOUBLE)) {
-                    if ((expect >= double_min && expect <= double_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_DOUBLE)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_ushort(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    ushort value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_ushort(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_ushort(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_ushort(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_ushort(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_USHORT);
-            err = nc_get_var1_ushort(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_USHORT)) {
-                    if ((expect >= ushort_min && expect <= ushort_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_USHORT)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_uint(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    uint value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_uint(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_uint(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_uint(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_uint(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_UINT);
-            err = nc_get_var1_uint(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_UINT)) {
-                    if ((expect >= uint_min && expect <= uint_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_UINT)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_longlong(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    longlong value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_longlong(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_longlong(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_longlong(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_longlong(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_LONGLONG);
-            err = nc_get_var1_longlong(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_LONGLONG)) {
-                    if ((expect >= longlong_min && expect <= longlong_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_LONGLONG)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var1_ulonglong(void)
-{
-    int i, err, ncid, cdf_format;
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect;
-    ulonglong value[1];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1_ulonglong(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1_ulonglong(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1_ulonglong(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_get_var1_ulonglong(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            /* when file is created the variable contents are generated by
-             * hash functions */
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_ULONGLONG);
-            err = nc_get_var1_ulonglong(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, expect,var_type[i], NCT_ULONGLONG)) {
-                    if ((expect >= ulonglong_min && expect <= ulonglong_max)) {
-                        IF (err != NC_NOERR) {
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        } else {
-                            
-                            IF (!equal((double)value[0], expect, var_type[i], NCT_ULONGLONG)) {
-                                error("expected: %G, got: %G", expect, (double)value[0]);
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-
-
-int
-test_nc_get_var_text(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    text value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_text(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_text(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_text(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_TEXT);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_TEXT)) {
-                if (var_type[i] != NC_CHAR)
-                    allInIntRange &= 1;
-            } else
-                allInExtRange = 0;
-        }
-        err = nc_get_var_text(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                if (allInIntRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (1) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_uchar(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    uchar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_uchar(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_uchar(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_uchar(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_UCHAR);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_UCHAR)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR) && (expect[j] >= uchar_min && expect[j] <= uchar_max)) {
-                    
-                    /* in put_vars(), API _put_vara_double() is used to
-                     * write the NC_BYTE variables to files. In this
-                     * case, NC_BYTE variables are treated as signed
-                     * for CDF-1 and 2 formats. Thus, we must skip the
-                     * equal test below for uchar.
-                     */
-                    if (cdf_format < NC_FORMAT_CDF5 && var_type[i] == NC_BYTE && expect[j] > schar_max) continue;
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_schar(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    schar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_schar(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_schar(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_schar(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_SCHAR);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_SCHAR)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR) && (expect[j] >= schar_min && expect[j] <= schar_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_short(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    short value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_short(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_short(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_short(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_SHORT);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_SHORT)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT) && (expect[j] >= short_min && expect[j] <= short_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_int(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    int value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_int(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_int(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_int(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_INT);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_INT)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT) && (expect[j] >= int_min && expect[j] <= int_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_long(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    long value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_long(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_long(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_long(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_LONG);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_LONG)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG) && (expect[j] >= long_min && expect[j] <= long_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_float(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    float value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_float(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_float(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_float(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_FLOAT);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_FLOAT)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT) && (expect[j] >= float_min && expect[j] <= float_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_double(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    double value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_double(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_double(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_double(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_DOUBLE);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_DOUBLE)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE) && (expect[j] >= double_min && expect[j] <= double_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_ushort(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    ushort value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_ushort(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_ushort(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_ushort(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_USHORT);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_USHORT)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT) && (expect[j] >= ushort_min && expect[j] <= ushort_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_uint(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    uint value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_uint(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_uint(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_uint(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_UINT);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_UINT)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT) && (expect[j] >= uint_min && expect[j] <= uint_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_longlong(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    longlong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_longlong(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_longlong(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_longlong(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_LONGLONG);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_LONGLONG)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG) && (expect[j] >= longlong_min && expect[j] <= longlong_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_var_ulonglong(void)
-{
-    int i, err, ncid, cdf_format;
-    int allInExtRange;  /* all values within range of external data type */
-    int allInIntRange;  /* all values within range of internal data type */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double expect[MAX_NELS];
-    ulonglong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var_ulonglong(BAD_ID, 0, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var_ulonglong(ncid, BAD_VARID, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var_ulonglong(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        allInExtRange = allInIntRange = 1;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                              NCT_ULONGLONG);
-            if (inRange3(cdf_format, expect[j],var_type[i], NCT_ULONGLONG)) {
-                
-                    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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (j = 0; j < var_nels[i]; j++) {
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG) && (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max)) {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                            error("element number: %d, ", j);
-                            error("expect: %g, ", expect[j]);
-                            error("got: %g", (double) value[j]);
-                        }
-                    }
-                    ELSE_NOK
-                }
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-
-
-int
-test_nc_get_vara_text(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    text value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_text(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_text(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_text(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_text(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_text(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_text(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_text(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_text(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_TEXT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_TEXT) &&
-                1) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_TEXT);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_TEXT)) {
-		    if (var_type[i] != NC_CHAR)
-                        allInIntRange &= 1;
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_text(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (1) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_uchar(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    uchar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_uchar(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_uchar(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_uchar(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_uchar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_uchar(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_uchar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_uchar(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_uchar(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_UCHAR);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_UCHAR) &&
-                (expect[0] >= uchar_min && expect[0] <= uchar_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-#endif
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_UCHAR);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR)) {
-		    
-                        allInIntRange &= (expect[j] >= uchar_min && expect[j] <= uchar_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_uchar(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR) && (expect[j] >= uchar_min && expect[j] <= uchar_max)) {
-                        
-                        /* in put_vars(), API _put_vara_double() is used to
-                         * write the NC_BYTE variables to files. In this
-                         * case, NC_BYTE variables are treated as signed
-                         * for CDF-1 and 2 formats. Thus, we must skip the
-                         * equal test below for uchar.
-                         */
-                        if (cdf_format < NC_FORMAT_CDF5 && var_type[i] == NC_BYTE && expect[j] > schar_max) continue;
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_schar(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    schar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_schar(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_schar(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_schar(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_schar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_schar(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_schar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_schar(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_schar(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_SCHAR);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_SCHAR) &&
-                (expect[0] >= schar_min && expect[0] <= schar_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_SCHAR);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR)) {
-		    
-                        allInIntRange &= (expect[j] >= schar_min && expect[j] <= schar_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_schar(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR) && (expect[j] >= schar_min && expect[j] <= schar_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_short(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    short value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_short(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_short(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_short(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_short(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_short(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_short(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_short(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_short(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_SHORT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_SHORT) &&
-                (expect[0] >= short_min && expect[0] <= short_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_SHORT);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT)) {
-		    
-                        allInIntRange &= (expect[j] >= short_min && expect[j] <= short_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_short(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT) && (expect[j] >= short_min && expect[j] <= short_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_int(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    int value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_int(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_int(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_int(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_int(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_int(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_int(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_int(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_int(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_INT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_INT) &&
-                (expect[0] >= int_min && expect[0] <= int_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_INT);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT)) {
-		    
-                        allInIntRange &= (expect[j] >= int_min && expect[j] <= int_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_int(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT) && (expect[j] >= int_min && expect[j] <= int_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_long(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    long value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_long(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_long(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_long(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_long(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_long(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_long(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_long(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_long(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_LONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_LONG) &&
-                (expect[0] >= long_min && expect[0] <= long_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_LONG);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG)) {
-		    
-                        allInIntRange &= (expect[j] >= long_min && expect[j] <= long_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_long(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG) && (expect[j] >= long_min && expect[j] <= long_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_float(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    float value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_float(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_float(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_float(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_float(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_float(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_float(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_float(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_float(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_FLOAT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_FLOAT) &&
-                (expect[0] >= float_min && expect[0] <= float_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_FLOAT);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT)) {
-		    
-                        allInIntRange &= (expect[j] >= float_min && expect[j] <= float_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_float(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT) && (expect[j] >= float_min && expect[j] <= float_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_double(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    double value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_double(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_double(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_double(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_double(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_double(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_double(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_double(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_double(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_DOUBLE);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_DOUBLE) &&
-                (expect[0] >= double_min && expect[0] <= double_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_DOUBLE);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE)) {
-		    
-                        allInIntRange &= (expect[j] >= double_min && expect[j] <= double_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_double(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE) && (expect[j] >= double_min && expect[j] <= double_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_ushort(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    ushort value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_ushort(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_ushort(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_ushort(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_ushort(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_ushort(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_ushort(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_ushort(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_ushort(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_USHORT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_USHORT) &&
-                (expect[0] >= ushort_min && expect[0] <= ushort_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_USHORT);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT)) {
-		    
-                        allInIntRange &= (expect[j] >= ushort_min && expect[j] <= ushort_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_ushort(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT) && (expect[j] >= ushort_min && expect[j] <= ushort_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_uint(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    uint value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_uint(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_uint(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_uint(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_uint(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_uint(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_uint(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_uint(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_uint(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_UINT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_UINT) &&
-                (expect[0] >= uint_min && expect[0] <= uint_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_UINT);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT)) {
-		    
-                        allInIntRange &= (expect[j] >= uint_min && expect[j] <= uint_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_uint(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT) && (expect[j] >= uint_min && expect[j] <= uint_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_longlong(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    longlong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_longlong(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_longlong(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_longlong(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_longlong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_longlong(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_longlong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_longlong(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_longlong(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_LONGLONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_LONGLONG) &&
-                (expect[0] >= longlong_min && expect[0] <= longlong_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_LONGLONG);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG)) {
-		    
-                        allInIntRange &= (expect[j] >= longlong_min && expect[j] <= longlong_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_longlong(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG) && (expect[j] >= longlong_min && expect[j] <= longlong_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vara_ulonglong(void)
-{
-    int i, k, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK], mid[MAX_RANK];
-    double expect[MAX_NELS];
-    ulonglong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vara_ulonglong(BAD_ID, 0, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vara_ulonglong(ncid, BAD_VARID, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara_ulonglong(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j]; /* causes NC_EINVALCOORDS */
-            err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1; /* causes NC_EEDGE */
-            err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[*]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_rank[i] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1; /* should cause NC_EINVALCOORDS */
-            err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-        }
-
-        err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_ULONGLONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_ULONGLONG) &&
-                (expect[0] >= ulonglong_min && expect[0] <= ulonglong_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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++) {
-            size_t 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++) {
-                int d;
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect[j] = hash4(cdf_format, var_type[i], var_rank[i], index,
-                                  NCT_ULONGLONG);
-                if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG)) {
-		    
-                        allInIntRange &= (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max);
-                } else
-                    allInExtRange = 0;
-            }
-            err = nc_get_vara_ulonglong(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    if (allInIntRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (j = 0; j < nels; j++) {
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG) && (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max)) {
-                        
-                        IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                error("element number: %d, ", j);
-                                error("expect: %g, ", expect[j]);
-                                error("got: %g", (double) value[j]);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                }
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-
-
-int
-test_nc_get_vars_text(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    text value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_text(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_text(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_text(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_text(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_text(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_text(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_text(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_text(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_TEXT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_TEXT) &&
-                1) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_TEXT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_TEXT)) {
-		        if (var_type[i] != NC_CHAR)
-                            allInIntRange &= 1;
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_text(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (1) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_uchar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    uchar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_uchar(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_uchar(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_uchar(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_uchar(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_UCHAR);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_UCHAR) &&
-                (expect[0] >= uchar_min && expect[0] <= uchar_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-#endif
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_UCHAR);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR)) {
-		        
-                            allInIntRange &= (expect[j] >= uchar_min && expect[j] <= uchar_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_uchar(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR) && (expect[j] >= uchar_min && expect[j] <= uchar_max)) {
-                            
-                            /* in put_vars(), API _put_vara_double() is used to
-                             * write the NC_BYTE variables to files. In this
-                             * case, NC_BYTE variables are treated as signed
-                             * for CDF-1 and 2 formats. Thus, we must skip the
-                             * equal test below for uchar.
-                             */
-                            if (cdf_format < NC_FORMAT_CDF5 && var_type[i] == NC_BYTE && expect[j] > schar_max) continue;
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_schar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    schar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_schar(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_schar(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_schar(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_schar(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_SCHAR);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_SCHAR) &&
-                (expect[0] >= schar_min && expect[0] <= schar_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_SCHAR);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR)) {
-		        
-                            allInIntRange &= (expect[j] >= schar_min && expect[j] <= schar_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_schar(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR) && (expect[j] >= schar_min && expect[j] <= schar_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_short(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    short value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_short(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_short(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_short(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_short(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_short(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_short(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_short(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_short(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_SHORT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_SHORT) &&
-                (expect[0] >= short_min && expect[0] <= short_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_SHORT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT)) {
-		        
-                            allInIntRange &= (expect[j] >= short_min && expect[j] <= short_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_short(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT) && (expect[j] >= short_min && expect[j] <= short_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_int(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    int value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_int(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_int(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_int(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_int(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_int(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_int(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_int(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_int(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_INT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_INT) &&
-                (expect[0] >= int_min && expect[0] <= int_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_INT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT)) {
-		        
-                            allInIntRange &= (expect[j] >= int_min && expect[j] <= int_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_int(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT) && (expect[j] >= int_min && expect[j] <= int_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_long(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    long value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_long(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_long(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_long(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_long(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_long(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_long(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_long(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_long(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_LONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_LONG) &&
-                (expect[0] >= long_min && expect[0] <= long_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_LONG);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG)) {
-		        
-                            allInIntRange &= (expect[j] >= long_min && expect[j] <= long_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_long(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG) && (expect[j] >= long_min && expect[j] <= long_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_float(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    float value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_float(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_float(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_float(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_float(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_float(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_float(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_float(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_float(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_FLOAT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_FLOAT) &&
-                (expect[0] >= float_min && expect[0] <= float_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_FLOAT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT)) {
-		        
-                            allInIntRange &= (expect[j] >= float_min && expect[j] <= float_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_float(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT) && (expect[j] >= float_min && expect[j] <= float_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_double(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    double value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_double(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_double(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_double(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_double(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_double(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_double(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_double(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_double(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_DOUBLE);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_DOUBLE) &&
-                (expect[0] >= double_min && expect[0] <= double_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_DOUBLE);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE)) {
-		        
-                            allInIntRange &= (expect[j] >= double_min && expect[j] <= double_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_double(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE) && (expect[j] >= double_min && expect[j] <= double_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_ushort(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    ushort value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_ushort(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_ushort(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_ushort(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_ushort(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_USHORT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_USHORT) &&
-                (expect[0] >= ushort_min && expect[0] <= ushort_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_USHORT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT)) {
-		        
-                            allInIntRange &= (expect[j] >= ushort_min && expect[j] <= ushort_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_ushort(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT) && (expect[j] >= ushort_min && expect[j] <= ushort_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_uint(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    uint value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_uint(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_uint(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_uint(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_uint(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_UINT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_UINT) &&
-                (expect[0] >= uint_min && expect[0] <= uint_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_UINT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT)) {
-		        
-                            allInIntRange &= (expect[j] >= uint_min && expect[j] <= uint_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_uint(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT) && (expect[j] >= uint_min && expect[j] <= uint_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_longlong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    longlong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_longlong(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_longlong(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_longlong(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_longlong(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_LONGLONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_LONGLONG) &&
-                (expect[0] >= longlong_min && expect[0] <= longlong_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_LONGLONG);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG)) {
-		        
-                            allInIntRange &= (expect[j] >= longlong_min && expect[j] <= longlong_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_longlong(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG) && (expect[j] >= longlong_min && expect[j] <= longlong_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_vars_ulonglong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK];
-    double expect[MAX_NELS];
-    ulonglong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_vars_ulonglong(BAD_ID, 0, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_vars_ulonglong(ncid, BAD_VARID, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_ulonglong(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_vars_ulonglong(ncid, i, start, edge, stride, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_ULONGLONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_ULONGLONG) &&
-                (expect[0] >= ulonglong_min && expect[0] <= ulonglong_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)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 != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_ULONGLONG);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG)) {
-		        
-                            allInIntRange &= (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_vars_ulonglong(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG) && (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-
-
-int
-test_nc_get_varm_text(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    text value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_text(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_text(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_text(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_TEXT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_TEXT) &&
-                1) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_TEXT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_TEXT)) {
-		        if (var_type[i] != NC_CHAR)
-                            allInIntRange &= 1;
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_text(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (1) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_uchar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    uchar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_uchar(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_uchar(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_uchar(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_UCHAR);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_UCHAR) &&
-                (expect[0] >= uchar_min && expect[0] <= uchar_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-#endif
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_UCHAR);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR)) {
-		        
-                            allInIntRange &= (expect[j] >= uchar_min && expect[j] <= uchar_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_uchar(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_UCHAR) && (expect[j] >= uchar_min && expect[j] <= uchar_max)) {
-                            
-                            /* in put_vars(), API _put_vara_double() is used to
-                             * write the NC_BYTE variables to files. In this
-                             * case, NC_BYTE variables are treated as signed
-                             * for CDF-1 and 2 formats. Thus, we must skip the
-                             * equal test below for uchar.
-                             */
-                            if (cdf_format < NC_FORMAT_CDF5 && var_type[i] == NC_BYTE && expect[j] > schar_max) continue;
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_schar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    schar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_schar(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_schar(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_schar(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_SCHAR);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_SCHAR) &&
-                (expect[0] >= schar_min && expect[0] <= schar_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_SCHAR);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR)) {
-		        
-                            allInIntRange &= (expect[j] >= schar_min && expect[j] <= schar_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_schar(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_SCHAR) && (expect[j] >= schar_min && expect[j] <= schar_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_short(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    short value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_short(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_short(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_short(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_SHORT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_SHORT) &&
-                (expect[0] >= short_min && expect[0] <= short_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_SHORT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT)) {
-		        
-                            allInIntRange &= (expect[j] >= short_min && expect[j] <= short_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_short(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_SHORT) && (expect[j] >= short_min && expect[j] <= short_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_int(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    int value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_int(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_int(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_int(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_INT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_INT) &&
-                (expect[0] >= int_min && expect[0] <= int_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_INT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT)) {
-		        
-                            allInIntRange &= (expect[j] >= int_min && expect[j] <= int_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_int(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_INT) && (expect[j] >= int_min && expect[j] <= int_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_long(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    long value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_long(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_long(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_long(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_LONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_LONG) &&
-                (expect[0] >= long_min && expect[0] <= long_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_LONG);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG)) {
-		        
-                            allInIntRange &= (expect[j] >= long_min && expect[j] <= long_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_long(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONG) && (expect[j] >= long_min && expect[j] <= long_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_float(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    float value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_float(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_float(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_float(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_FLOAT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_FLOAT) &&
-                (expect[0] >= float_min && expect[0] <= float_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_FLOAT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT)) {
-		        
-                            allInIntRange &= (expect[j] >= float_min && expect[j] <= float_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_float(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_FLOAT) && (expect[j] >= float_min && expect[j] <= float_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_double(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    double value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_double(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_double(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_double(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_DOUBLE);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_DOUBLE) &&
-                (expect[0] >= double_min && expect[0] <= double_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_DOUBLE);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE)) {
-		        
-                            allInIntRange &= (expect[j] >= double_min && expect[j] <= double_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_double(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_DOUBLE) && (expect[j] >= double_min && expect[j] <= double_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_ushort(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    ushort value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_ushort(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_ushort(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_ushort(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_ushort(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_USHORT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_USHORT) &&
-                (expect[0] >= ushort_min && expect[0] <= ushort_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_USHORT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT)) {
-		        
-                            allInIntRange &= (expect[j] >= ushort_min && expect[j] <= ushort_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_ushort(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_USHORT) && (expect[j] >= ushort_min && expect[j] <= ushort_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_uint(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    uint value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_uint(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_uint(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_uint(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_uint(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_UINT);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_UINT) &&
-                (expect[0] >= uint_min && expect[0] <= uint_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_UINT);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT)) {
-		        
-                            allInIntRange &= (expect[j] >= uint_min && expect[j] <= uint_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_uint(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_UINT) && (expect[j] >= uint_min && expect[j] <= uint_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_longlong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    longlong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_longlong(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_longlong(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_longlong(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_longlong(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_LONGLONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_LONGLONG) &&
-                (expect[0] >= longlong_min && expect[0] <= longlong_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_LONGLONG);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG)) {
-		        
-                            allInIntRange &= (expect[j] >= longlong_min && expect[j] <= longlong_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_longlong(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_LONGLONG) && (expect[j] >= longlong_min && expect[j] <= longlong_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_varm_ulonglong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format;
-    int allInExtRange;  /* all values within external range? */
-    int allInIntRange;  /* all values within internal range? */
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* count of valid comparisons */
-    int canConvert;     /* Both text or both numeric */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double expect[MAX_NELS];
-    ulonglong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_varm_ulonglong(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_varm_ulonglong(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars_ulonglong(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            start[j] = var_shape[i][j]+1;  /* should cause NC_EINVALCOORDS */
-            err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            start[j] = 0;
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)
-            stride[j] = 0;
-            err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            stride[j] = 1;
-#endif
-        }
-
-        err = nc_get_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-        if (!canConvert) {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-        } else if (var_rank[i] == 0) {
-            expect[0] = hash4(cdf_format, var_type[i], 0, index, NCT_ULONGLONG);
-            if (inRange3(cdf_format, expect[0], var_type[i], NCT_ULONGLONG) &&
-                (expect[0] >= ulonglong_min && expect[0] <= ulonglong_max)) {
-                IF (err != NC_NOERR) error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            }
-
-            else IF (err != NC_ERANGE) error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-        } else {
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j]-index[j]-1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                allInExtRange = allInIntRange = 1;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect[j] = hash4(cdf_format, var_type[i], var_rank[i],
-                                      index2, NCT_ULONGLONG);
-                    if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG)) {
-		        
-                            allInIntRange &= (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max);
-                    } else
-                        allInExtRange = 0;
-                }
-                err = nc_get_varm_ulonglong(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        if (allInIntRange) {
-                            IF (err != NC_NOERR)
-                                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        }
-                        
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                    } else {
-                        IF (err != NC_NOERR && err != NC_ERANGE)
-                            error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                    }
-                    for (j = 0; j < nels; j++) {
-                        if (inRange3(cdf_format, expect[j],var_type[i],NCT_ULONGLONG) && (expect[j] >= ulonglong_min && expect[j] <= ulonglong_max)) {
-                            
-                            IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[i]));
-                                    error("element number: %d, ", j);
-                                    error("expect: %g, ", expect[j]);
-                                    error("got: %g", (double) value[j]);
-                                }
-                            }
-                            ELSE_NOK
-                        }
-                    }
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-
-
-int
-test_nc_get_att_text(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    text value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_text(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_text(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = -1; i < numVars; i++) {
-        for (j = 0; j < NATTS(i); j++) {
-            canConvert = (ATT_TYPE(i,j) == NC_CHAR) ;
-
-            err = nc_get_att_text(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_text(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_text(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_TEXT);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_TEXT)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    if (ATT_TYPE(i,j) != NC_CHAR)
-		    
-                        allInIntRange &= 1;
-                } 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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (1) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_TEXT)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_uchar(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    uchar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_uchar(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_uchar(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_uchar(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_uchar(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_UCHAR);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_UCHAR)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    if (cdf_format > NC_FORMAT_64BIT_OFFSET || (cdf_format < NC_FORMAT_CDF5 && ATT_TYPE(i,j) != NC_BYTE))
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-#endif
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_UCHAR) && (expect[k] >= uchar_min && expect[k] <= uchar_max)) {
-                        
-                        /* in put_vars(), API _put_vara_double() is used to
-                         * write the NC_BYTE variables to files. In this
-                         * case, NC_BYTE variables are treated as signed
-                         * for CDF-1 and 2 formats. Thus, we must skip the
-                         * equal test below for uchar.
-                         */
-                        if (cdf_format < NC_FORMAT_CDF5 && ATT_TYPE(i,j) == NC_BYTE && expect[k] > schar_max) continue;
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_UCHAR)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_schar(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    schar value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_schar(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_schar(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_schar(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_schar(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_SCHAR);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_SCHAR)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_SCHAR) && (expect[k] >= schar_min && expect[k] <= schar_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_SCHAR)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_short(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    short value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_short(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_short(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_short(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_short(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_SHORT);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_SHORT)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_SHORT) && (expect[k] >= short_min && expect[k] <= short_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_SHORT)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_int(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    int value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_int(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_int(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_int(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_int(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_INT);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_INT)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_INT) && (expect[k] >= int_min && expect[k] <= int_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_INT)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_long(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    long value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_long(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_long(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_long(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_long(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_LONG);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_LONG)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_LONG) && (expect[k] >= long_min && expect[k] <= long_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_LONG)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_float(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    float value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_float(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_float(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_float(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_float(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_FLOAT);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_FLOAT)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_FLOAT) && (expect[k] >= float_min && expect[k] <= float_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_FLOAT)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_double(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    double value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_double(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_double(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_double(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_double(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_DOUBLE);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_DOUBLE)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_DOUBLE) && (expect[k] >= double_min && expect[k] <= double_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_DOUBLE)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_ushort(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    ushort value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_ushort(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_ushort(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_ushort(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_ushort(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_USHORT);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_USHORT)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_USHORT) && (expect[k] >= ushort_min && expect[k] <= ushort_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_USHORT)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_uint(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    uint value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_uint(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_uint(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_uint(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_uint(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_UINT);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_UINT)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_UINT) && (expect[k] >= uint_min && expect[k] <= uint_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_UINT)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_longlong(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    longlong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_longlong(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_longlong(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_longlong(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_longlong(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_LONGLONG);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_LONGLONG)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_LONGLONG) && (expect[k] >= longlong_min && expect[k] <= longlong_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_LONGLONG)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-int
-test_nc_get_att_ulonglong(void)
-{
-    int i, j, err, ncid, cdf_format;
-    size_t k, ndx[1];
-    int allInExtRange;
-    int allInIntRange;
-    int canConvert;     /* Both text or both numeric */
-    int nok = 0;        /* count of valid comparisons */
-    double expect[MAX_NELS];
-    ulonglong value[MAX_NELS];
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    err = nc_get_att_ulonglong(BAD_ID, 0, NULL, value);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_get_att_ulonglong(ncid, BAD_VARID, NULL, value);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), value);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)
-            /* check if can detect a bad name */
-            err = nc_get_att_ulonglong(ncid, i, NULL, NULL);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-            ELSE_NOK
-#endif
-
-            err = nc_get_att_ulonglong(ncid, i, "noSuch", value);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            allInExtRange = allInIntRange = 1;
-            for (k = 0; k < ATT_LEN(i,j); k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_ULONGLONG);
-                if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_ULONGLONG)) {
-		    /* netCDF specification make a special case for type
-		     * conversion between uchar and scahr: do not check for
-		     * range error. See
-		     * http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
-                     */
-		    
-		    
-                        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 != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-
-                    } else {
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-
-                    }
-                } else {
-                    IF (err != NC_NOERR && err != NC_ERANGE)
-                        error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-                }
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_ULONGLONG) && (expect[k] >= ulonglong_min && expect[k] <= ulonglong_max)) {
-                        
-                        IF (!equal((double)value[k],expect[k],ATT_TYPE(i,j), NCT_ULONGLONG)){
-                            error("value read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                if (i == -1)
-                                    error("var_type: GLOBAL, ");
-                                else
-                                    error("var_name: %s var_type: %s, ", var_name[i],s_nc_type(var_type[i]));
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("att_type: %s, ", s_nc_type(ATT_TYPE(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("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
diff --git a/nc_test/test_put.c b/nc_test/test_put.c
deleted file mode 100644
index 24a0c89..0000000
--- a/nc_test/test_put.c
+++ /dev/null
@@ -1,13742 +0,0 @@
-/* Do not edit this file. It is produced from the corresponding .m4 source */
-/*
- *  Copyright (C) 2003, Northwestern University and Argonne National Laboratory
- *  See COPYRIGHT notice in top-level directory.
- */
-/* $Id: test_put.m4 2672 2016-12-03 19:23:53Z wkliao $ */
-
-
-#include "tests.h"
-
-#ifdef USE_PNETCDF
-#include <pnetcdf.h>
-#ifndef PNETCDF_VERSION_MAJOR
-#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
-#endif
-#ifndef PNETCDF_VERSION_MINOR
-#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
-#endif
-#endif
-
-
-
-
-
-
-
-
-
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-text
-hash_text(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    return (text)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-uchar
-hash_uchar(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > uchar_max) return uchar_max;
-    else if (value < uchar_min) return uchar_min;
-    else return (uchar)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-schar
-hash_schar(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > schar_max) return schar_max;
-    else if (value < schar_min) return schar_min;
-    else return (schar)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-short
-hash_short(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > short_max) return short_max;
-    else if (value < short_min) return short_min;
-    else return (short)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-int
-hash_int(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > int_max) return int_max;
-    else if (value < int_min) return int_min;
-    else return (int)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-long
-hash_long(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > long_max) return long_max;
-    else if (value < long_min) return long_min;
-    else return (long)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-float
-hash_float(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > float_max) return float_max;
-    else if (value < float_min) return float_min;
-    else return (float)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-double
-hash_double(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > double_max) return double_max;
-    else if (value < double_min) return double_min;
-    else return (double)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-ushort
-hash_ushort(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > ushort_max) return ushort_max;
-    else if (value < ushort_min) return ushort_min;
-    else return (ushort)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-uint
-hash_uint(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > uint_max) return uint_max;
-    else if (value < uint_min) return uint_min;
-    else return (uint)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-longlong
-hash_longlong(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > longlong_max) return longlong_max;
-    else if (value < longlong_min) return longlong_min;
-    else return (longlong)value;
-}
-
-/*
- *  ensure hash value within range for internal TYPE
- */
-ulonglong
-hash_ulonglong(const int       cdf_format,
-        const nc_type   type,
-        const int       rank,
-        const size_t  *index,
-        const nct_itype itype)
-{
-    double value;
-
-    value = hash4(cdf_format, type, rank, index, itype);
-    
-    if (value > ulonglong_max) return ulonglong_max;
-    else if (value < ulonglong_min) return ulonglong_min;
-    else return (ulonglong)value;
-}
-
-
-
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_text(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    text value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) ;
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_TEXT);
-            err = nc_get_var1_text(ncid, i, index, &value);
-            if (1) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_text: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_uchar(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    uchar value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_UCHAR);
-            err = nc_get_var1_uchar(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_UCHAR) && (expect >= uchar_min && expect <= uchar_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_uchar: %s",  nc_strerror(err));
-                } else {
-                    
-                    /* In put_vars(), nc_put_vara_double() is used to write
-                     * variables of type NC_BYTE to files. For uchar APIs,
-                     * NC_BYTE variables are treated as unsigned for CDF-1 and 2
-                     * formats. Thus, we skip the equal test for out-of-bound
-                     * values below for uchar APIs.
-                     */
-                    if (cdf_format < NC_FORMAT_CDF5 &&
-                        var_type[i] == NC_BYTE && expect > schar_max)
-                        continue;
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_schar(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    schar value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_SCHAR);
-            err = nc_get_var1_schar(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_SCHAR) && (expect >= schar_min && expect <= schar_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_schar: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_short(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    short value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_SHORT);
-            err = nc_get_var1_short(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_SHORT) && (expect >= short_min && expect <= short_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_short: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_int(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    int value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_INT);
-            err = nc_get_var1_int(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_INT) && (expect >= int_min && expect <= int_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_int: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_long(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    long value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_LONG);
-            err = nc_get_var1_long(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_LONG) && (expect >= long_min && expect <= long_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_long: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_float(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    float value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_FLOAT);
-            err = nc_get_var1_float(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_FLOAT) && (expect >= float_min && expect <= float_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_float: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_double(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    double value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_DOUBLE);
-            err = nc_get_var1_double(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_DOUBLE) && (expect >= double_min && expect <= double_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_double: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_ushort(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    ushort value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_USHORT);
-            err = nc_get_var1_ushort(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_USHORT) && (expect >= ushort_min && expect <= ushort_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_ushort: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_uint(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    uint value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_UINT);
-            err = nc_get_var1_uint(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_UINT) && (expect >= uint_min && expect <= uint_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_uint: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_longlong(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    longlong value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_LONGLONG);
-            err = nc_get_var1_longlong(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_LONGLONG) && (expect >= longlong_min && expect <= longlong_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_longlong: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-/*
- *  check all vars in file which are (text/numeric) compatible with TYPE
- */
-int
-check_vars_ulonglong(const char *filename, int numVars)
-{
-    int i, d, err, ncid, cdf_format, ndims;
-    int canConvert;   /* Both text or both numeric */
-    int nok = 0;      /* count of valid comparisons */
-    int dimids[MAX_RANK];
-    nc_type datatype;
-    char name[NC_MAX_NAME];
-    size_t j, length, index[MAX_RANK];
-    double expect;
-    ulonglong value;
-
-    err = file_open(filename, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR) error("inq_format: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-        if (!canConvert) continue;
-
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL);
-        IF (err != NC_NOERR)
-            error("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 != NC_NOERR)
-                error("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 != 0) error("error in toMixedBase");
-            expect = hash4(cdf_format, var_type[i], var_rank[i], index,
-                           NCT_ULONGLONG);
-            err = nc_get_var1_ulonglong(ncid, i, index, &value);
-            if (inRange3(cdf_format, (double)expect,datatype,NCT_ULONGLONG) && (expect >= ulonglong_min && expect <= ulonglong_max)) {
-                IF (err != NC_NOERR) {
-                    error("nc_get_var1_ulonglong: %s",  nc_strerror(err));
-                } else {
-                    
-                    IF (!equal((double)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("var_type: %s, ", s_nc_type(var_type[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 != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type text
- */
-int
-check_atts_text(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    text value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        for (j = 0; j < NATTS(i); j++) {
-            canConvert = (ATT_TYPE(i,j) == NC_CHAR) ;
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_TEXT);
-                if (inRange3(cdf_format, expect[k], datatype, NCT_TEXT)) {
-                    ++nInExtRange;
-                    if (0)
-                        ++nInIntRange;
-                }
-            }
-            err =  nc_get_att_text(ncid, i, ATT_NAME(i,j), value);
-            if (nInExtRange == length && nInIntRange == length) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (1) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type uchar
- */
-int
-check_atts_uchar(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    uchar value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_UCHAR);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_UCHAR) && (expect[k] >= uchar_min && expect[k] <= uchar_max)) {
-                    
-                    /* In put_vars(), nc_put_vara_double() is used to write
-                     * variables of type NC_BYTE to files. For uchar APIs,
-                     * NC_BYTE variables are treated as unsigned for CDF-1 and 2
-                     * formats. Thus, we skip the equal test for out-of-bound
-                     * values below for uchar APIs.
-                     */
-                    if (cdf_format < NC_FORMAT_CDF5 &&
-                        ATT_TYPE(i,j) == NC_BYTE && expect[k] > schar_max)
-                        continue;
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type schar
- */
-int
-check_atts_schar(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    schar value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_SCHAR);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_SCHAR) && (expect[k] >= schar_min && expect[k] <= schar_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type short
- */
-int
-check_atts_short(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    short value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_SHORT);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_SHORT) && (expect[k] >= short_min && expect[k] <= short_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type int
- */
-int
-check_atts_int(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    int value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_INT);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_INT) && (expect[k] >= int_min && expect[k] <= int_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type long
- */
-int
-check_atts_long(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    long value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_LONG);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_LONG) && (expect[k] >= long_min && expect[k] <= long_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type float
- */
-int
-check_atts_float(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    float value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_FLOAT);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_FLOAT) && (expect[k] >= float_min && expect[k] <= float_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type double
- */
-int
-check_atts_double(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    double value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_DOUBLE);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_DOUBLE) && (expect[k] >= double_min && expect[k] <= double_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type ushort
- */
-int
-check_atts_ushort(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    ushort value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_USHORT);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_USHORT) && (expect[k] >= ushort_min && expect[k] <= ushort_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type uint
- */
-int
-check_atts_uint(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    uint value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_UINT);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_UINT) && (expect[k] >= uint_min && expect[k] <= uint_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type longlong
- */
-int
-check_atts_longlong(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    longlong value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_LONGLONG);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_LONGLONG) && (expect[k] >= longlong_min && expect[k] <= longlong_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-/*
- *  for _text tests, check all attributes in file which are of text type
- *  Note no NC_ERANGE check for text attributes as text is not convertible to
- *  any other numerical data types (i.e. NC_ECHAR)
- *
- *  for other tests, check all numerical attributes in file against values
- *  outside range of type ulonglong
- */
-int
-check_atts_ulonglong(int ncid, int numGatts, int numVars)
-{
-    int i, j, cdf_format, err;
-    int canConvert;      /* Both text or both numeric */
-    int nok = 0;         /* count of valid comparisons */
-    size_t k, length, ndx[1];
-    nc_type datatype;
-    size_t nInExtRange;  /* number values within external range */
-    size_t nInIntRange;  /* number values within internal range */
-    double expect[MAX_NELS];
-    ulonglong value[MAX_NELS];
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %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);
-            if (!canConvert) continue;
-
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s",  nc_strerror(err));
-            IF (datatype != ATT_TYPE(i,j))
-                error("inq_att: unexpected type");
-            IF (length != ATT_LEN(i,j))
-                error("inq_att: unexpected length");
-            assert(length <= MAX_NELS);
-            nInIntRange = nInExtRange = 0;
-            for (k = 0; k < length; k++) {
-                ndx[0] = k;
-                expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_ULONGLONG);
-                if (inRange3(cdf_format, 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 != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            } else {
-                IF (err != NC_NOERR && err != NC_ERANGE)
-                    error("expecting NC_NOERR or NC_ERANGE but got %s",nc_err_code_name(err));
-            }
-            for (k = 0; k < length; k++) {
-                if (inRange3(cdf_format, (double)expect[k],datatype,NCT_ULONGLONG) && (expect[k] >= ulonglong_min && expect[k] <= ulonglong_max)) {
-                    
-                    IF (!equal((double)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("att_type: %s, ", s_nc_type(ATT_TYPE(i,j)));
-                            error("element number: %d ", k);
-                            error("expect: %g, ", expect[k]);
-                            error("got: %g", (double) value[k]);
-                        }
-                    } else {
-                        nok++;
-                    }
-                }
-            }
-        }
-    }
-    return nok;
-}
-
-
-
-
-int
-test_nc_put_var1_text(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    text value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_text(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_text(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_text(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_text(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_text(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_TEXT);
-            err = nc_put_var1_text(ncid, i, index, value);
-            if (canConvert) {
-                if (1) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_text(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_uchar(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    uchar value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_uchar(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_uchar(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_uchar(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_uchar(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_uchar(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_UCHAR);
-            err = nc_put_var1_uchar(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_UCHAR)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uchar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_schar(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    schar value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_schar(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_schar(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_schar(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_schar(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_schar(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_SCHAR);
-            err = nc_put_var1_schar(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_SCHAR)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_schar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_short(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    short value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_short(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_short(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_short(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_short(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_short(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_SHORT);
-            err = nc_put_var1_short(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_SHORT)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_short(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_int(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    int value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_int(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_int(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_int(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_int(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_int(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_INT);
-            err = nc_put_var1_int(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_INT)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_int(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_long(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    long value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_long(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_long(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_long(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_long(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_long(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_LONG);
-            err = nc_put_var1_long(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_LONG)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_long(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_float(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    float value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_float(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_float(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_float(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_float(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_float(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_FLOAT);
-            err = nc_put_var1_float(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_FLOAT)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_float(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_double(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    double value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_double(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_double(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_double(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_double(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_double(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_DOUBLE);
-            err = nc_put_var1_double(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_DOUBLE)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_double(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_ushort(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    ushort value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_ushort(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_ushort(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_ushort(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_ushort(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_ushort(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_USHORT);
-            err = nc_put_var1_ushort(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_USHORT)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ushort(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_uint(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    uint value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_uint(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_uint(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_uint(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_uint(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_uint(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_UINT);
-            err = nc_put_var1_uint(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_UINT)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uint(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_longlong(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    longlong value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_longlong(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_longlong(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_longlong(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_longlong(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_longlong(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_LONGLONG);
-            err = nc_put_var1_longlong(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_LONGLONG)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_longlong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var1_ulonglong(void)
-{
-    int i, err, ncid, cdf_format, nok=0;
-    int canConvert;      /* Both text or both numeric */
-    size_t j, index[MAX_RANK];
-    ulonglong value[1];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1_ulonglong(BAD_ID, 0, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1_ulonglong(ncid, BAD_VARID, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var1_ulonglong(BAD_ID, i, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j];     /* out of boundary check */
-            err = nc_put_var1_ulonglong(ncid, i, index, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                index[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash_ulonglong(cdf_format, var_type[i], var_rank[i], index,
-                               NCT_ULONGLONG);
-            err = nc_put_var1_ulonglong(ncid, i, index, value);
-            if (canConvert) {
-                if (inRange3(cdf_format, (double)value[0],var_type[i],NCT_ULONGLONG)) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ulonglong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
-
-
-int
-test_nc_put_var_text(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    text value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_text(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_text(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_text(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_text(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_TEXT);
-            if (var_type[i] != NC_CHAR)
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_TEXT);
-        }
-        err = nc_put_var_text(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_text(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_TEXT);
-            if (var_type[i] != NC_CHAR)
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_TEXT);
-        }
-        err = nc_put_var_text(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_text(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_uchar(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    uchar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_uchar(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_uchar(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_uchar(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_uchar(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_UCHAR);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_UCHAR);
-        }
-        err = nc_put_var_uchar(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_uchar(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_UCHAR);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_UCHAR);
-        }
-        err = nc_put_var_uchar(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uchar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_schar(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    schar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_schar(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_schar(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_schar(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_schar(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_SCHAR);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_SCHAR);
-        }
-        err = nc_put_var_schar(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_schar(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_SCHAR);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_SCHAR);
-        }
-        err = nc_put_var_schar(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_schar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_short(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    short value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_short(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_short(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_short(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_short(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_SHORT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_SHORT);
-        }
-        err = nc_put_var_short(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_short(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_SHORT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_SHORT);
-        }
-        err = nc_put_var_short(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_short(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_int(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    int value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_int(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_int(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_int(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_int(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_INT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_INT);
-        }
-        err = nc_put_var_int(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_int(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_INT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_INT);
-        }
-        err = nc_put_var_int(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_int(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_long(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    long value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_long(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_long(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_long(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_long(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_LONG);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_LONG);
-        }
-        err = nc_put_var_long(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_long(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_LONG);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_LONG);
-        }
-        err = nc_put_var_long(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_long(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_float(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    float value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_float(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_float(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_float(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_float(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_FLOAT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_FLOAT);
-        }
-        err = nc_put_var_float(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_float(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_FLOAT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_FLOAT);
-        }
-        err = nc_put_var_float(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_float(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_double(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    double value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_double(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_double(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_double(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_double(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_DOUBLE);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_DOUBLE);
-        }
-        err = nc_put_var_double(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_double(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_DOUBLE);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_DOUBLE);
-        }
-        err = nc_put_var_double(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_double(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_ushort(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    ushort value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_ushort(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_ushort(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_ushort(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_ushort(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_USHORT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_USHORT);
-        }
-        err = nc_put_var_ushort(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_ushort(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_USHORT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_USHORT);
-        }
-        err = nc_put_var_ushort(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ushort(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_uint(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    uint value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_uint(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_uint(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_uint(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_uint(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_UINT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_UINT);
-        }
-        err = nc_put_var_uint(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_uint(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_UINT);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_UINT);
-        }
-        err = nc_put_var_uint(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uint(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_longlong(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    longlong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_longlong(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_longlong(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_longlong(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_longlong(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_LONGLONG);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_LONGLONG);
-        }
-        err = nc_put_var_longlong(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_longlong(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_LONGLONG);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_LONGLONG);
-        }
-        err = nc_put_var_longlong(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_longlong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_var_ulonglong(void)
-{
-    int i, err, ncid, varid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, index[MAX_RANK];
-    ulonglong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var_ulonglong(BAD_ID, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var_ulonglong(ncid, BAD_VARID, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        if (var_dimid[i][0] == RECDIM) continue; /* fixed-size variables only */
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_var_ulonglong(BAD_ID, i, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_ulonglong(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_ULONGLONG);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_ULONGLONG);
-        }
-        err = nc_put_var_ulonglong(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-            
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-        } else { /* should flag wrong type even if nothing to write */
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s",  nc_strerror(err));
-    index[0] = NRECS-1;
-    err = nc_put_var1_text(ncid, varid, index, "x");
-    IF (err != NC_NOERR)
-        error("put_var1_text: %s",  nc_strerror(err));
-
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] != RECDIM) continue; /* only record variables here */
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (allInExtRange = 1, j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[j]= hash_ulonglong(cdf_format,var_type[i], var_rank[i], index,
-                              NCT_ULONGLONG);
-            
-                allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                          var_type[i], NCT_ULONGLONG);
-        }
-        err = nc_put_var_ulonglong(ncid, i, value);
-        if (canConvert) {
-            if (allInExtRange) {
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            } else {
-                IF (err != NC_ERANGE)
-                    error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        } else {
-            IF (err != NC_ECHAR)
-                error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ulonglong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
-
-
-int
-test_nc_put_vara_text(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    text value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_text(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_text(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_text(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_text(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_text(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_text(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_text(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_text(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_TEXT);
-                if (var_type[i] != NC_CHAR)
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_TEXT);
-            }
-            err = nc_put_vara_text(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_text(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_uchar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    uchar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_uchar(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_uchar(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_uchar(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_uchar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_uchar(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_uchar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_uchar(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_uchar(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_UCHAR);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_UCHAR);
-            }
-            err = nc_put_vara_uchar(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uchar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_schar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    schar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_schar(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_schar(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_schar(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_schar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_schar(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_schar(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_schar(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_schar(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_SCHAR);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_SCHAR);
-            }
-            err = nc_put_vara_schar(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_schar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_short(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    short value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_short(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_short(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_short(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_short(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_short(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_short(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_short(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_short(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_SHORT);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_SHORT);
-            }
-            err = nc_put_vara_short(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_short(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_int(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    int value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_int(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_int(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_int(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_int(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_int(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_int(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_int(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_int(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_INT);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_INT);
-            }
-            err = nc_put_vara_int(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_int(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_long(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    long value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_long(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_long(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_long(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_long(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_long(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_long(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_long(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_long(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_LONG);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_LONG);
-            }
-            err = nc_put_vara_long(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_long(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_float(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    float value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_float(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_float(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_float(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_float(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_float(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_float(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_float(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_float(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_FLOAT);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_FLOAT);
-            }
-            err = nc_put_vara_float(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_float(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_double(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    double value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_double(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_double(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_double(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_double(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_double(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_double(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_double(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_double(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_DOUBLE);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_DOUBLE);
-            }
-            err = nc_put_vara_double(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_double(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_ushort(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    ushort value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_ushort(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_ushort(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_ushort(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_ushort(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_ushort(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_ushort(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_ushort(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_ushort(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_USHORT);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_USHORT);
-            }
-            err = nc_put_vara_ushort(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ushort(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_uint(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    uint value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_uint(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_uint(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_uint(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_uint(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_uint(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_uint(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_uint(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_uint(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_UINT);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_UINT);
-            }
-            err = nc_put_vara_uint(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uint(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_longlong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    longlong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_longlong(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_longlong(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_longlong(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_longlong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_longlong(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_longlong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_longlong(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_longlong(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_LONGLONG);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_LONGLONG);
-            }
-            err = nc_put_vara_longlong(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_longlong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vara_ulonglong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;        /* Both text or both numeric */
-    int allInExtRange;     /* all values within external range? */
-    size_t j, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK];
-    size_t mid[MAX_RANK], index[MAX_RANK];
-    ulonglong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara_ulonglong(BAD_ID, 0, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara_ulonglong(ncid, BAD_VARID, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara_ulonglong(BAD_ID, i, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value[j]= hash_ulonglong(cdf_format,var_type[i], var_rank[i], index,
-                                  NCT_ULONGLONG);
-                
-                    allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                              var_type[i], NCT_ULONGLONG);
-            }
-            err = nc_put_vara_ulonglong(ncid, i, start, edge, value);
-            if (canConvert) {
-                if (allInExtRange) {
-                    IF (err != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            } else {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ulonglong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
-
-
-int
-test_nc_put_vars_text(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    text value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_text(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_text(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_text(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_text(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_text(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_text(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_text(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_text(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_TEXT);
-                    if (var_type[i] != NC_CHAR)
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_TEXT);
-                }
-                err = nc_put_vars_text(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_text(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_uchar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    uchar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_uchar(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_uchar(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_uchar(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_uchar(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_uchar(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_UCHAR);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_UCHAR);
-                }
-                err = nc_put_vars_uchar(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uchar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_schar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    schar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_schar(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_schar(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_schar(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_schar(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_schar(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_SCHAR);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_SCHAR);
-                }
-                err = nc_put_vars_schar(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_schar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_short(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    short value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_short(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_short(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_short(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_short(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_short(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_short(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_short(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_short(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_SHORT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_SHORT);
-                }
-                err = nc_put_vars_short(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_short(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_int(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    int value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_int(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_int(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_int(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_int(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_int(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_int(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_int(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_int(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_INT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_INT);
-                }
-                err = nc_put_vars_int(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_int(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_long(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    long value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_long(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_long(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_long(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_long(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_long(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_long(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_long(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_long(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_LONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_LONG);
-                }
-                err = nc_put_vars_long(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_long(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_float(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    float value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_float(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_float(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_float(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_float(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_float(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_float(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_float(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_float(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_FLOAT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_FLOAT);
-                }
-                err = nc_put_vars_float(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_float(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_double(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    double value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_double(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_double(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_double(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_double(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_double(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_double(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_double(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_double(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_DOUBLE);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_DOUBLE);
-                }
-                err = nc_put_vars_double(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_double(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_ushort(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    ushort value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_ushort(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_ushort(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_ushort(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_ushort(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_ushort(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_USHORT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_USHORT);
-                }
-                err = nc_put_vars_ushort(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ushort(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_uint(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    uint value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_uint(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_uint(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_uint(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_uint(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_uint(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_UINT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_UINT);
-                }
-                err = nc_put_vars_uint(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uint(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_longlong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    longlong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_longlong(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_longlong(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_longlong(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_longlong(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_longlong(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_LONGLONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_LONGLONG);
-                }
-                err = nc_put_vars_longlong(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_longlong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_vars_ulonglong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK];
-    ulonglong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars_ulonglong(BAD_ID, 0, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars_ulonglong(ncid, BAD_VARID, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars_ulonglong(BAD_ID, i, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars_ulonglong(ncid, i, start, edge, stride, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_ulonglong(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_ULONGLONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_ULONGLONG);
-                }
-                err = nc_put_vars_ulonglong(ncid, i, index, count, stride, value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ulonglong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
-
-
-int
-test_nc_put_varm_text(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    text value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_text(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_text(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_text(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) ;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_text(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_TEXT);
-                    if (var_type[i] != NC_CHAR)
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_TEXT);
-                }
-                err = nc_put_varm_text(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_text(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_uchar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    uchar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_uchar(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_uchar(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_uchar(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_uchar(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_UCHAR);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_UCHAR);
-                }
-                err = nc_put_varm_uchar(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uchar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_schar(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    schar value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_schar(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_schar(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_schar(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_schar(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_SCHAR);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_SCHAR);
-                }
-                err = nc_put_varm_schar(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_schar(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_short(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    short value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_short(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_short(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_short(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_short(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_SHORT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_SHORT);
-                }
-                err = nc_put_varm_short(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_short(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_int(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    int value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_int(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_int(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_int(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_int(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_INT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_INT);
-                }
-                err = nc_put_varm_int(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_int(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_long(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    long value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_long(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_long(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_long(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_long(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_LONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_LONG);
-                }
-                err = nc_put_varm_long(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_long(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_float(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    float value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_float(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_float(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_float(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_float(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_FLOAT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_FLOAT);
-                }
-                err = nc_put_varm_float(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_float(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_double(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    double value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_double(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_double(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_double(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_double(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_DOUBLE);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_DOUBLE);
-                }
-                err = nc_put_varm_double(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_double(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_ushort(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    ushort value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_ushort(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_ushort(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_ushort(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_USHORT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_ushort(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_ushort(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_USHORT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_USHORT);
-                }
-                err = nc_put_varm_ushort(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ushort(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_uint(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    uint value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_uint(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_uint(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_uint(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_UINT == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_uint(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_uint(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_UINT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_UINT);
-                }
-                err = nc_put_varm_uint(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_uint(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_longlong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    longlong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_longlong(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_longlong(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_longlong(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_LONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_longlong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_longlong(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_LONGLONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_LONGLONG);
-                }
-                err = nc_put_varm_longlong(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_longlong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_varm_ulonglong(void)
-{
-    int i, k, d, err, nslabs, ncid, cdf_format, nok=0;
-    int canConvert;     /* Both text or both numeric */
-    int allInExtRange;  /* all values within external range? */
-    size_t j, m, nels;
-    size_t start[MAX_RANK], edge[MAX_RANK], index[MAX_RANK];
-    size_t index2[MAX_RANK], mid[MAX_RANK], count[MAX_RANK];
-    size_t sstride[MAX_RANK];
-    ptrdiff_t nstarts;   /* number of different starts */
-    ptrdiff_t stride[MAX_RANK], imap[MAX_RANK];
-    ulonglong value[MAX_NELS];
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err =  nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm_ulonglong(BAD_ID, 0, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm_ulonglong(ncid, BAD_VARID, NULL, NULL, NULL, NULL, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5; /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm_ulonglong(BAD_ID, i, NULL, NULL, NULL, NULL, value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        canConvert = (var_type[i] == NC_CHAR) == (NCT_ULONGLONG == NCT_TEXT);
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];   /* out of boundary check */
-            err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            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("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, i.e. edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            if (!canConvert) {
-                IF (err != NC_ECHAR)
-                    error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-                start[j] = 0;
-                continue;
-            }
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm_ulonglong(ncid, i, start, edge, stride, imap, value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
-*/
-                if (var_rank[i] > 0) {
-                    int jj = var_rank[i] - 1;
-                    imap[jj] = 1;
-                    for (; jj > 0; jj--)
-                        imap[jj-1] = imap[jj] * (ptrdiff_t)count[jj];
-                }
-                for (allInExtRange = 1, j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value[j] = hash_ulonglong(cdf_format,var_type[i], var_rank[i],
-                                       index2, NCT_ULONGLONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)value[j],
-                                                  var_type[i], NCT_ULONGLONG);
-                }
-                err = nc_put_varm_ulonglong(ncid,i,index,count,stride,imap,value);
-                if (canConvert) {
-                    if (allInExtRange) {
-                        IF (err != NC_NOERR)
-                            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-                    
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-                } else {
-                    IF (err != NC_ECHAR)
-                        error("expecting NC_ECHAR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    nok += check_vars_ulonglong(scratch, numVars);
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
-
-int
-test_nc_put_att_text(void)
-{
-    int i, j, err, ncid, nok=0;
-    size_t k, ndx[1];
-    text value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_text(BAD_ID, 0, NULL, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_text(ncid, BAD_VARID, NULL, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    {
-        const char *const tval = "value for bad name";
-        const size_t tval_len = (size_t)strlen(tval);
-
-        err = nc_put_att_text(ncid, 0, "", tval_len, tval);
-        IF (err != NC_EBADNAME)
-           error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-        ELSE_NOK
-    }
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    double dtmp = hash(ATT_TYPE(i,j), -1, ndx);
-                    value[k] = (text)dtmp;
-                }
-                err = nc_put_att_text(ncid, i, ATT_NAME(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    nok += check_atts_text(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
-
-int
-test_nc_put_att_uchar(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    uchar value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_uchar(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_uchar(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_uchar(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_uchar(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_UCHAR);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-#if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-#endif
-
-            }
-        }
-    }
-
-    nok += check_atts_uchar(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_schar(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    schar value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_schar(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_schar(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_schar(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_schar(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_SCHAR);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-#if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
-                    else if (cdf_format < NC_FORMAT_CDF5) {
-#else
-                    else {
-#endif
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_schar(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_short(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    short value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_short(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_short(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_short(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_short(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_short(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_SHORT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_short(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_int(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    int value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_int(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_int(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_int(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_int(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_int(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_INT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_int(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_long(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    long value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_long(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_long(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_long(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_long(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_long(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_LONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_long(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_float(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    float value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_float(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_float(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_float(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_float(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_float(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_FLOAT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_float(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_double(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    double value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_double(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_double(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_double(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_double(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_double(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_DOUBLE);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_double(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_ushort(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    ushort value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_ushort(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_ushort(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_ushort(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_ushort(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_ushort(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_USHORT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_ushort(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_uint(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    uint value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_uint(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_uint(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_uint(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_uint(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_uint(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_UINT);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_uint(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_longlong(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    longlong value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_longlong(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_longlong(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_longlong(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_longlong(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_longlong(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_LONGLONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_longlong(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-int
-test_nc_put_att_ulonglong(void)
-{
-    int i, j, err, ncid, cdf_format, nok=0;
-    int allInExtRange;  /* all values within external range? */
-    size_t k, ndx[1];
-    ulonglong value[MAX_NELS];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s",  nc_strerror(err));
-        return nok;
-    }
-
-    err =  nc_inq_format(ncid, &cdf_format);
-    IF (err != NC_NOERR)
-        error("inq_format: %s",  nc_strerror(err));
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* check if can detect a bad file ID */
-    err = nc_put_att_ulonglong(BAD_ID, 0, NULL, 0, 0, NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_att_ulonglong(ncid, BAD_VARID, NULL, 0, 0, NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    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(ncid, BAD_VARID, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
-                IF (err != NC_ENOTVAR)
-                    error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                /* check if can detect a bad name */
-                err = nc_put_att_ulonglong(ncid, i, NULL, 0, 0, NULL);
-                IF (err != NC_EBADNAME)
-                    error("expecting NC_EBADNAME but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                err = nc_put_att_ulonglong(ncid, i, ATT_NAME(i,j), BAD_TYPE, ATT_LEN(i,j), value);
-                IF (err != NC_EBADTYPE)
-                    error("expecting NC_EBADTYPE but got %s",nc_err_code_name(err));
-                ELSE_NOK
-
-                for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    value[k] = hash_ulonglong(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_ULONGLONG);
-                    
-                        allInExtRange &= inRange3(cdf_format, (double)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 != NC_NOERR)
-                        error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                    ELSE_NOK
-                }
-                
-                    else {
-
-                        IF (err != NC_ERANGE)
-                            error("expecting NC_ERANGE but got %s",nc_err_code_name(err));
-                        ELSE_NOK
-                    }
-
-
-            }
-        }
-    }
-
-    nok += check_atts_ulonglong(ncid, numGatts, numVars);
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("delete file %s failed", scratch);
-    return nok;
-}
-
-
diff --git a/nc_test/test_read.c b/nc_test/test_read.c
deleted file mode 100644
index 9df36fb..0000000
--- a/nc_test/test_read.c
+++ /dev/null
@@ -1,1950 +0,0 @@
-/* Do not edit this file. It is produced from the corresponding .m4 source */
-/*
- *  Copyright (C) 2003, Northwestern University and Argonne National Laboratory
- *  See COPYRIGHT notice in top-level directory.
- */
-/* $Id: test_read.m4 2861 2017-02-09 19:38:02Z wkliao $ */
-
-
-#if defined (_WIN32) || defined (_WIN64)
-#include <io.h>
-#endif
-
-#include <sys/types.h> /* open() */
-#include <sys/stat.h>  /* open() */
-#include <fcntl.h>     /* open() */
-#ifdef _MSC_VER
-#include <io.h>
-#else
-#include <unistd.h>    /* unlink(), write() */
-#endif
-#include <errno.h>     /* errno, strerror() */
-
-#include "tests.h"
-
-
-
-
-
-
-/*
- * Test  nc_strerror.
- *    Try on a bad error status.
- *    Test for each defined error status.
- */
-int
-test_nc_strerror(void)
-{
-    int i;
-    const char *message, *expected_msg;
-    int nok=0;
-
-    static const struct {
-        int status;
-        const char *msg;
-    } ncerrs[] = {
-        {NC_NOERR, "No error"},
-        {NC_EBADID, "NetCDF: Not a valid ID"},
-        {NC_ENFILE, "NetCDF: Too many files open"},
-        {NC_EEXIST, "NetCDF: File exists && NC_NOCLOBBER"},
-        {NC_EINVAL, "NetCDF: Invalid argument"},
-        {NC_EPERM, "NetCDF: Write to read only"},
-        {NC_ENOTINDEFINE, "NetCDF: Operation not allowed in data mode"},
-        {NC_EINDEFINE, "NetCDF: Operation not allowed in define mode"},
-        {NC_EINVALCOORDS, "NetCDF: Index exceeds dimension bound"},
-        {NC_EMAXDIMS, "NetCDF: NC_MAX_DIMS exceeded"},
-        {NC_ENAMEINUSE, "NetCDF: String match to name in use"},
-        {NC_ENOTATT, "NetCDF: Attribute not found"},
-        {NC_EMAXATTS, "NetCDF: NC_MAX_ATTRS exceeded"},
-        {NC_EBADTYPE, "NetCDF: Not a valid data type or _FillValue type mismatch"},
-        {NC_EBADDIM, "NetCDF: Invalid dimension ID or name"},
-        {NC_EUNLIMPOS, "NetCDF: NC_UNLIMITED in the wrong index"},
-        {NC_EMAXVARS, "NetCDF: NC_MAX_VARS exceeded"},
-        {NC_ENOTVAR, "NetCDF: Variable not found"},
-        {NC_EGLOBAL, "NetCDF: Action prohibited on NC_GLOBAL varid"},
-        {NC_ENOTNC, "NetCDF: Unknown file format"},
-        {NC_ESTS, "NetCDF: In Fortran, string too short"},
-        {NC_EMAXNAME, "NetCDF: NC_MAX_NAME exceeded"},
-        {NC_EUNLIMIT, "NetCDF: NC_UNLIMITED size already in use"},
-        {NC_ENORECVARS, "NetCDF: nc_rec op when there are no record vars"},
-        {NC_ECHAR, "NetCDF: Attempt to convert between text & numbers"},
-        {NC_EEDGE, "NetCDF: Start+count exceeds dimension bound"},
-        {NC_ESTRIDE, "NetCDF: Illegal stride"},
-        {NC_EBADNAME, "NetCDF: Name contains illegal characters"},
-        {NC_ERANGE, "NetCDF: Numeric conversion not representable"},
-        {NC_ENOMEM, "NetCDF: Memory allocation (malloc) failure"},
-        {NC_EVARSIZE, "NetCDF: One or more variable sizes violate format constraints"},
-        {NC_EDIMSIZE, "NetCDF: Invalid dimension size"}
-    };
-
-    /* Try on a bad error status */
-    message =  nc_strerror(-666);/* should fail */
-    expected_msg = "Unknown Error";
-    IF (strncmp(message, expected_msg, strlen(expected_msg)) != 0)
-        error(" nc_strerror on bad error status returned: %s", message);
-    ELSE_NOK
-
-    /* Try on each legitimate error status */
-    for (i=0; i<LEN_OF(ncerrs); i++) {
-        const char *message =  nc_strerror(ncerrs[i].status);
-        IF (strcmp(message, ncerrs[i].msg) != 0)
-            error(" nc_strerror(%d) should return %s, not %s",
-                  ncerrs[i].status, ncerrs[i].msg, message);
-        ELSE_NOK
-    }
-    return nok;
-}
-
-
-/*
- * Test  nc_open.
- * If in read-only section of tests,
- *    Try to open a non-existent netCDF file, check error return.
- *    Open a file that is not a netCDF file, check error return.
- *    Open a netCDF file with a bad mode argument, check error return.
- *    Open a netCDF file with NC_NOWRITE, read-only mode, try to write, check error.
- *    Try to open a netcdf twice, check whether returned netcdf ids different.
- * If in writable section of tests,
- *    Open a netCDF file with NC_WRITE mode, write something, close it.
- * On exit, any open netCDF files are closed.
- */
-#define NOT_NC_FILE "dummy_not_nc_file"
-int
-test_nc_open(void)
-{
-    int err, ncid, ncid2, nok=0;
-#if 0
-    int fd;
-    ssize_t w_len;
-#endif
-
-    /* Try to open a nonexistent file */
-    err = file_open("tooth-fairy.nc", NC_NOWRITE, &ncid); /* should fail */
-
-    /* on some systems (such as Lustre), opening an nonexisting file will
-     * actually create the file. In this case, we print the error messages on
-     * screen and move on to the next test, instead of aborting the entire test.
-     * The created file will be of zero-length and PnetCDF should complain it
-     * is not an NC file, i.e. NC_ENOTNC.
-     */
-    IF (err == NC_NOERR) {
-        error("opening a nonexistent file expects to fail, but got NC_NOERR\n");
-    }
-
-#ifndef USE_PARALLEL
-    IF (! NC_ISSYSERR(err))
-        error("nc_open of nonexistent file should have returned system error");
-#endif
-
-    /* Open a file that is not a netCDF file.  But need a portable
-     * test that also works for cross-compiles ... */
-    /* err = nc_open("nc_test.o", NC_NOWRITE, &ncid);/\* should fail *\/ */
-    /* IF (err != NC_ENOTNC) */
-    /*  error("nc_open of non-netCDF file: status = %d", err); */
-
-#if 0
-    /* create a not-nc file */
-    fd = open(NOT_NC_FILE, O_CREAT|O_WRONLY, 0600);
-    IF (fd == -1) {
-        error("Error: creating a non-CDF file (%s)", strerror(errno));
-    }
-    else {
-        w_len = write(fd, "0123456789abcdefghijklmnopqrstuvwxyz", 36);
-        assert(w_len >= 0);
-        close(fd);
-    }
-
-    /* Open a file that is not a netCDF file. */
-    err = file_open(NOT_NC_FILE, NC_NOWRITE, &ncid); /* should fail */
-    IF (err != NC_ENOTNC)
-        error("expecting NC_ENOTNC or NC_EFILE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* delete the not-nc file */
-    unlink(NOT_NC_FILE);
-#endif
-
-    /* Open a netCDF file in read-only mode, check that write fails */
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    ELSE_NOK
-    err =  nc_redef(ncid);        /* should fail */
-    IF (err != NC_EPERM)
-        error("expecting NC_EPERM but got %s", nc_err_code_name(err));
-    /* Opened OK, see if can open again and get a different netCDF ID */
-    err = file_open(testfile, NC_NOWRITE, &ncid2);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    else {
-         nc_close(ncid2);
-        nok++;
-    }
-    IF (ncid2 == ncid)
-        error("netCDF IDs for first and second open calls should differ");
-
-    
-    {   /* tests using netCDF scratch file */
-        err = file_create(scratch, NC_NOCLOBBER, &ncid2);
-        IF (err != NC_NOERR)
-            error("create: %s",  nc_strerror(err));
-        else
-             nc_close(ncid2);
-        err = file_open(scratch, NC_WRITE, &ncid2);
-        IF (err != NC_NOERR)
-            error("open: %s",  nc_strerror(err));
-        else {
-             nc_close(ncid2);
-            nok++;
-        }
-        err = nc_delete(scratch);
-        IF (err != NC_NOERR)
-            error("remove of %s failed", scratch);
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-/*
- * Test  nc_close.
- *    Try to close a netCDF file twice, check whether second close fails.
- *    Try on bad handle, check error return.
- *    Try in define mode and data mode.
- */
-int
-test_nc_close(void)
-{
-    int ncid, nok=0;
-    int err = file_open(testfile, NC_NOWRITE, &ncid);
-
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    /* Close a netCDF file twice, second time should fail */
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close failed: %s",  nc_strerror(err));
-    ELSE_NOK
-    err =  nc_close(ncid);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* Try with a bad netCDF ID */
-    err =  nc_close(BAD_ID);/* should fail */
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* Close in data mode */
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close in data mode failed: %s",  nc_strerror(err));
-    ELSE_NOK
-
-    
-    {   /* tests using netCDF scratch file */
-        err = file_create(scratch, NC_NOCLOBBER, &ncid);
-        IF (err != NC_NOERR)
-            error("create: %s",  nc_strerror(err));
-        err =  nc_close(ncid);
-        IF (err != NC_NOERR)
-            error("close in define mode: %s",  nc_strerror(err));
-        ELSE_NOK
-        err = nc_delete(scratch);
-        IF (err != NC_NOERR)
-            error("remove of %s failed", scratch);
-    }
-    return nok;
-}
-
-
-/*
- * Test  nc_inq
- *    Try on bad handle, check error return.
- *    Try in data mode, check returned values.
- *    Try asking for subsets of info.
- * If in writable section of tests,
- *    Try in define mode, after adding an unlimited dimension, variable.
- * On exit, any open netCDF files are closed.
- */
-int
-test_nc_inq(void)
-{
-    int ncid;
-    int ndims;                        /* number of dimensions */
-    int nvars;                        /* number of variables */
-    int ngatts;                       /* number of global attributes */
-    int recdim;                       /* id of unlimited dimension */
-    int err;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    /* Try on bad handle */
-    err =  nc_inq(BAD_ID, 0, 0, 0, 0);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    err =  nc_inq(ncid, &ndims, &nvars, &ngatts, &recdim);
-    IF (err != NC_NOERR)
-        error("inq: %s",  nc_strerror(err));
-    else IF (ndims != NDIMS)
-        error("inq: wrong number of dimensions returned, %d", ndims);
-    else IF (nvars != numVars)
-        error("inq: wrong number of variables returned, %d", nvars);
-    else IF (ngatts != numGatts)
-        error("inq: wrong number of global atts returned, %d", ngatts);
-    else IF (recdim != RECDIM)
-        error("inq: wrong record dimension ID returned, %d", recdim);
-    ELSE_NOK
-
-    /* Inguire for no info (useless, but should still work) */
-    err =  nc_inq(ncid, 0, 0, 0, 0);
-    IF (err != NC_NOERR)
-        error("inq for no info failed: %s",  nc_strerror(err));
-    ELSE_NOK
-
-    /* Inguire for subsets of info */
-    ngatts = numGatts - 1;        /* wipe out previous correct value */
-    err =  nc_inq(ncid, 0, 0, &ngatts, 0);
-    IF (err != NC_NOERR)
-        error("inq for one item failed: %s",  nc_strerror(err));
-    else IF (ngatts != numGatts)
-        error("inq subset: wrong number of global atts returned, %d", ngatts);
-    ELSE_NOK
-    ndims = NDIMS - 1;
-    nvars = numVars - 1;
-    err =  nc_inq(ncid, &ndims, &nvars, 0, 0);
-    IF (err != NC_NOERR)
-        error("inq for two items failed: %s",  nc_strerror(err));
-    else IF (ndims != NDIMS)
-        error("inq subset: wrong number of dimensions returned, %d", ndims);
-    else IF (nvars != numVars)
-        error("inq subset: wrong number of variables returned, %d", nvars);
-    ELSE_NOK
-
-    
-    {   /* tests using netCDF scratch file */
-        int ncid2;              /* for scratch netCDF dataset */
-
-        err = file_create(scratch, NC_NOCLOBBER, &ncid2);
-        IF (err != NC_NOERR) {
-            error("create: %s",  nc_strerror(err));
-        } else {                /* add dim, var, gatt, check inq */
-            int ndims0;
-            int nvars0;
-            int ngatts0;
-            int recdim0;
-            err =  nc_enddef(ncid2); /* enter data mode */
-            err =  nc_inq(ncid2, &ndims0, &nvars0, &ngatts0, &recdim0);
-            IF (err != NC_NOERR)
-                error("inq: %s",  nc_strerror(err));
-            ELSE_NOK
-            err =  nc_redef(ncid2); /* enter define mode */
-            /* Check that inquire still works in define mode */
-            err =  nc_inq(ncid2, &ndims, &nvars, &ngatts, &recdim);
-            IF (err != NC_NOERR)
-                error("inq in define mode: %s",  nc_strerror(err));
-            else IF (ndims != ndims0)
-                error("inq in define mode: ndims wrong, %d", ndims);
-            else IF (nvars != nvars0)
-                error("inq in define mode: nvars wrong, %d", nvars);
-            else IF (ngatts != ngatts0)
-                error("inq in define mode: ngatts wrong, %d", ngatts);
-            else IF (recdim != recdim0)
-                error("inq in define mode: recdim wrong, %d", recdim);
-            ELSE_NOK
-
-            {
-                int did, vid;
-                /* Add dim, var, global att */
-                err =  nc_def_dim(ncid2, "inqd", 1L, &did);
-                IF (err != NC_NOERR)
-                    error("def_dim: %s",  nc_strerror(err));
-                err =  nc_def_var(ncid2, "inqv", NC_FLOAT, 0, 0, &vid);
-                IF (err != NC_NOERR)
-                    error("def_var: %s",  nc_strerror(err));
-            }
-            err =  nc_put_att_text(ncid2, NC_GLOBAL, "inqa", 1+strlen("stuff"),
-                                   "stuff");
-            IF (err != NC_NOERR)
-                error("put_att_text: %s",  nc_strerror(err));
-
-            /* Make sure  nc_inq sees the additions while in define mode */
-            err =  nc_inq(ncid2, &ndims, &nvars, &ngatts, &recdim);
-            IF (err != NC_NOERR)
-                error("inq in define mode: %s",  nc_strerror(err));
-            else IF (ndims != ndims0 + 1)
-                error("inq in define mode: ndims wrong, %d", ndims);
-            else IF (nvars != nvars0 + 1)
-                error("inq in define mode: nvars wrong, %d", nvars);
-            else IF (ngatts != ngatts0 + 1)
-                error("inq in define mode: ngatts wrong, %d", ngatts);
-            ELSE_NOK
-            err =  nc_enddef(ncid2);
-            IF (err != NC_NOERR)
-                error("enddef: %s",  nc_strerror(err));
-
-            /* Make sure  nc_inq stills sees additions in data mode */
-            err =  nc_inq(ncid2, &ndims, &nvars, &ngatts, &recdim);
-            IF (err != NC_NOERR)
-                error("inq failed in data mode: %s",  nc_strerror(err));
-            else IF (ndims != ndims0 + 1)
-                error("inq in define mode: ndims wrong, %d", ndims);
-            else IF (nvars != nvars0 + 1)
-                error("inq in define mode: nvars wrong, %d", nvars);
-            else IF (ngatts != ngatts0 + 1)
-                error("inq in define mode: ngatts wrong, %d", ngatts);
-            ELSE_NOK
-             nc_close(ncid2);
-            err = nc_delete(scratch);
-            IF (err != NC_NOERR)
-                error("remove of %s failed", scratch);
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_natts(void)
-{
-    int ncid;
-    int ngatts;                        /* number of global attributes */
-    int err, nok=0;
-
-    err =  nc_inq_natts(BAD_ID, &ngatts);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    err =  nc_inq_natts(ncid, &ngatts);
-    IF (err != NC_NOERR)
-        error("inq_natts: %s",  nc_strerror(err));
-    else IF (ngatts != numGatts)
-        error("inq_natts: wrong number of global atts returned, %d", ngatts);
-    ELSE_NOK
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_ndims(void)
-{
-    int ncid;
-    int ndims;
-    int err;
-    int nok=0;
-
-    err =  nc_inq_ndims(BAD_ID, &ndims);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    err =  nc_inq_ndims(ncid, &ndims);
-    IF (err != NC_NOERR)
-        error("inq_ndims: %s",  nc_strerror(err));
-    else IF (ndims != NDIMS)
-        error("inq_ndims: wrong number returned, %d", ndims);
-    ELSE_NOK
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_nvars(void)
-{
-    int ncid;
-    int nvars;
-    int err;
-    int nok=0;
-
-    err =  nc_inq_nvars(BAD_ID, &nvars);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    err =  nc_inq_nvars(ncid, &nvars);
-    IF (err != NC_NOERR)
-        error("inq_nvars: %s",  nc_strerror(err));
-    else IF (nvars != numVars)
-        error("inq_nvars: wrong number returned, %d", nvars);
-    ELSE_NOK
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_unlimdim(void)
-{
-    int ncid;
-    int unlimdim;
-    int err;
-    int nok=0;
-
-    err =  nc_inq_unlimdim(BAD_ID, &unlimdim);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    err =  nc_inq_unlimdim(ncid, &unlimdim);
-    IF (err != NC_NOERR)
-        error("inq_unlimdim: %s",  nc_strerror(err));
-    else IF (unlimdim != RECDIM)
-        error("inq_unlimdim: wrong number returned, %d", unlimdim);
-    ELSE_NOK
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_dimid(void)
-{
-    int ncid;
-    int dimid;
-    int i;
-    int err;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    err =  nc_inq_dimid(ncid, "noSuch", &dimid);
-    IF (err != NC_EBADDIM)
-        error("expecting NC_EBADDIM but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    for (i = 0; i < NDIMS; i++) {
-        err =  nc_inq_dimid(BAD_ID, dim_name[i], &dimid);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dimid(ncid, dim_name[i], &dimid);
-        IF (err != NC_NOERR)
-            error("inq_dimid: %s",  nc_strerror(err));
-        else IF (dimid != i)
-            error("expected %d, got %d", i, dimid);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_dim(void)
-{
-    int ncid;
-    int i;
-    int err;
-    char name[NC_MAX_NAME];
-    size_t length;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < NDIMS; i++) {
-        err =  nc_inq_dim(BAD_ID, i, name, &length);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dim(ncid, BAD_DIMID, name, &length);
-        IF (err != NC_EBADDIM)
-            error("expecting NC_EBADDIM but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dim(ncid, i, 0, 0);
-        IF (err != NC_NOERR)
-            error("inq_dim: %s",  nc_strerror(err));
-        ELSE_NOK
-        err =  nc_inq_dim(ncid, i, name, &length);
-        IF (err != NC_NOERR)
-            error("inq_dim: %s",  nc_strerror(err));
-        else IF (strcmp(dim_name[i],name))
-            error("name expected: %s, got: %s",dim_name[i],name);
-        else IF (dim_len[i] != length)
-            error("size expected: %d, got: %d",dim_len[i],length);
-        ELSE_NOK
-        err =  nc_inq_dim(ncid, i, name, 0);
-        IF (err != NC_NOERR)
-            error("inq_dim: %s",  nc_strerror(err));
-        else IF (strcmp(dim_name[i],name))
-            error("name expected: %s, got: %s",dim_name[i],name);
-        ELSE_NOK
-        err =  nc_inq_dim(ncid, i, 0, &length);
-        IF (err != NC_NOERR)
-            error("inq_dim: %s",  nc_strerror(err));
-        else IF (dim_len[i] != length)
-            error("size expected: %d, got: %d",dim_len[i],length);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_dimlen(void)
-{
-    int ncid;
-    int i;
-    int err;
-    size_t  length;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < NDIMS; i++) {
-        err =  nc_inq_dimlen(BAD_ID, i, &length);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dimlen(ncid, BAD_DIMID, &length);
-        IF (err != NC_EBADDIM)
-            error("expecting NC_EBADDIM but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dimlen(ncid, i, &length);
-        IF (err != NC_NOERR)
-            error("inq_dimlen: %s",  nc_strerror(err));
-        else IF (dim_len[i] != length)
-            error("size expected: %d, got: %d",dim_len[i],length);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_dimname(void)
-{
-    int ncid;
-    int i;
-    int err;
-    char name[NC_MAX_NAME];
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < NDIMS; i++) {
-        err =  nc_inq_dimname(BAD_ID, i, name);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dimname(ncid, BAD_DIMID, name);
-        IF (err != NC_EBADDIM)
-            error("expecting NC_EBADDIM but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_dimname(ncid, i, name);
-        IF (err != NC_NOERR)
-            error("inq_dimname: %s",  nc_strerror(err));
-        else IF (strcmp(dim_name[i],name))
-            error("name expected: %s, got: %s",dim_name[i],name);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_varid(void)
-{
-    int ncid;
-    int varid;
-    int i;
-    int err;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    err =  nc_inq_varid(ncid, "noSuch", &varid);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        err =  nc_inq_varid(BAD_ID, var_name[i], &varid);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_varid(ncid, var_name[i], &varid);
-        IF (err != NC_NOERR)
-            error("inq_varid: %s",  nc_strerror(err));
-        else IF (varid != i)
-            error("expected %d, got %d", i, varid);
-        ELSE_NOK
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_var(void)
-{
-    int ncid;
-    int i;
-    int err;
-    char name[NC_MAX_NAME];
-    nc_type datatype;
-    int ndims;
-    int dimids[MAX_RANK];
-    int natts;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        err =  nc_inq_var(BAD_ID, i, name, &datatype, &ndims, dimids, &natts);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_var(ncid,BAD_VARID,name,&datatype,&ndims,dimids,&natts);
-        IF (err != NC_ENOTVAR)
-            error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, 0, 0, 0, 0, 0);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, &natts);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        else IF (strcmp(var_name[i],name))
-            error("name expected: %s, got: %s",var_name[i],name);
-        else IF (var_type[i] != datatype)
-            error("type expected: %d, got: %d",var_type[i],datatype);
-        else IF (var_rank[i] != ndims)
-            error("ndims expected: %d, got: %d",var_rank[i],ndims);
-        else IF (!int_vec_eq(var_dimid[i],dimids,ndims))
-            error("unexpected dimid");
-        else IF (var_natts[i] != natts)
-            error("natts expected: %d, got: %d",var_natts[i],natts);
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, name, 0, 0, 0, 0);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        else IF (strcmp(var_name[i],name))
-            error("name expected: %s, got: %s",var_name[i],name);
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, 0, &datatype, 0, 0, 0);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        else IF (var_type[i] != datatype)
-            error("type expected: %d, got: %d",var_type[i],datatype);
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, 0, 0, &ndims, 0, 0);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        else IF (var_rank[i] != ndims)
-            error("ndims expected: %d, got: %d",var_rank[i],ndims);
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, 0, 0, 0, dimids, 0);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        else IF (!int_vec_eq(var_dimid[i],dimids,ndims))
-            error("unexpected dimid");
-        ELSE_NOK
-        err =  nc_inq_var(ncid, i, 0, 0, 0, 0, &natts);
-        IF (err != NC_NOERR)
-            error("inq_var: %s",  nc_strerror(err));
-        else IF (var_natts[i] != natts)
-            error("natts expected: %d, got: %d",var_natts[i],natts);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_vardimid(void)
-{
-    int ncid;
-    int i;
-    int err;
-    int dimids[MAX_RANK];
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        err =  nc_inq_vardimid(BAD_ID, i, dimids);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_vardimid(ncid, BAD_VARID, dimids);
-        IF (err != NC_ENOTVAR)
-            error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_vardimid(ncid, i, dimids);
-        IF (err != NC_NOERR)
-            error("inq_vardimid: %s",  nc_strerror(err));
-        else IF (!int_vec_eq(var_dimid[i], dimids, var_rank[i]))
-            error("unexpected dimid");
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_varname(void)
-{
-    int ncid;
-    int i;
-    int err;
-    char name[NC_MAX_NAME];
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        err =  nc_inq_varname(BAD_ID, i, name);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        nok++;
-        err =  nc_inq_varname(ncid, BAD_VARID, name);
-        IF (err != NC_ENOTVAR)
-            error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_varname(ncid, i, name);
-        IF (err != NC_NOERR)
-            error("inq_varname: %s",  nc_strerror(err));
-        else IF (strcmp(var_name[i],name))
-            error("name expected: %s, got: %s",var_name[i],name);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_varnatts(void)
-{
-    int ncid;
-    int i;
-    int err;
-    int natts;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = -1; i < numVars; i++) {
-        err =  nc_inq_varnatts(BAD_ID, i, &natts);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_varnatts(ncid, BAD_VARID, &natts);
-        IF (err != NC_ENOTVAR)
-            error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_varnatts(ncid, VARID(i), &natts);
-        IF (err != NC_NOERR)
-            error("inq_varnatts: %s",  nc_strerror(err));
-        else IF (NATTS(i) != natts)
-            error("natts expected: %d, got: %d",NATTS(i),natts);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_varndims(void)
-{
-    int ncid;
-    int i;
-    int err;
-    int ndims;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        err =  nc_inq_varndims(BAD_ID, i, &ndims);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_varndims(ncid, BAD_VARID, &ndims);
-        IF (err != NC_ENOTVAR)
-            error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_varndims(ncid, i, &ndims);
-        IF (err != NC_NOERR)
-            error("inq_varndims: %s",  nc_strerror(err));
-        else IF (var_rank[i] != ndims)
-            error("ndims expected: %d, got: %d",var_rank[i],ndims);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_vartype(void)
-{
-    int ncid;
-    int i;
-    int err;
-    nc_type datatype;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        err =  nc_inq_vartype(BAD_ID, i, &datatype);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_vartype(ncid, BAD_VARID, &datatype);
-        IF (err != NC_ENOTVAR)
-            error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_vartype(ncid, i, &datatype);
-        IF (err != NC_NOERR)
-            error("inq_vartype: %s",  nc_strerror(err));
-        else IF (var_type[i] != datatype)
-            error("type expected: %d, got: %d", var_type[i], datatype);
-        ELSE_NOK
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-/*
- * Test nc_get_var1(,,,)
- */
-int
-test_nc_get_var1(void)
-{
-    int ncid;
-    int i;
-    int err;
-    double expect;
-    int nok = 0;                /* count of valid comparisons */
-    double buf[1];              /* (void *) buffer */
-    double value[1];
-    size_t j, index[MAX_RANK];
-    
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR) error("open: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_var1(BAD_ID,0,NULL,NULL);
-    IF (err != NC_EBADID) error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_var1(ncid,BAD_VARID,NULL,NULL);
-    IF (err != NC_ENOTVAR) error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_var1(BAD_ID,i,NULL,value);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) {
-            index[j] = var_shape[i][j];
-            err = nc_get_var1(ncid,i,index,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-        err = nc_get_var1(ncid,i,index,value);
-        IF (err != NC_NOERR)
-            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        /* check if the contents are supposed to be */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect = hash( var_type[i], var_rank[i], index );
-            err = nc_get_var1(ncid,i,index,buf);
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            err = nc2dbl( var_type[i], buf, &value[0]);
-            IF (err)
-                error("error in nc2dbl");
-            if (inRange(expect,var_type[i])) {
-                IF (!equal2(value[0],expect,var_type[i]))
-                    error("expected: %G, got: %G", expect, value[0]);
-                ELSE_NOK
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-/*
- * Test nc_get_vara(,,,,)
- * Choose a random point dividing each dim into 2 parts
- * Get 2^rank (nslabs) slabs so defined
- * Each get overwrites buffer, so check after each get.
- */
-int
-test_nc_get_vara(void)
-{
-    int ncid, d, i, k, err, nslabs;
-    int nok = 0;      /* count of valid comparisons */
-    size_t j, nels;
-    size_t start[MAX_RANK];
-    size_t edge[MAX_RANK];
-    size_t index[MAX_RANK];
-    size_t mid[MAX_RANK];
-    
-    double buf[MAX_NELS];        /* (void *) buffer */
-    double expect;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_vara(BAD_ID,0,NULL,NULL,NULL);
-    IF (err != NC_EBADID) error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_vara(ncid,BAD_VARID,NULL,NULL,NULL);
-    IF (err != NC_ENOTVAR) error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vara(BAD_ID,i,NULL,NULL,buf);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* test NC_EINVALCOORDS, first when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            index[j] = var_shape[i][j];
-            err = nc_get_vara(ncid,i,index,edge,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-            edge[j] = var_shape[i][j] + 1;  /* edge error check */
-            err = nc_get_vara(ncid,i,start,edge,buf);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vara(ncid,i,start,edge,buf);
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1;  /* out of boundary check */
-            err = nc_get_vara(ncid,i,start,edge,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 1;
-
-        err = nc_get_vara(ncid,i,start,edge,buf);
-        IF (err != NC_NOERR)
-            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        /* 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];
-            }
-            err = nc_get_vara(ncid,i,start,edge,buf);
-            IF (err != NC_NOERR)
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-            ELSE_NOK
-
-            for (j = 0; j < nels; j++) {
-                double got;
-                char *p = (char *) buf;
-                p += j * (size_t)nctypelen(var_type[i]);
-                err = nc2dbl( var_type[i], p, & got );
-                IF (err) error("error in nc2dbl");
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                expect = hash(var_type[i], var_rank[i], index);
-                if (inRange(expect,var_type[i])) {
-                    IF (!equal2(got,expect,var_type[i])) {
-                        error("buf 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);
-                            error("got: %g", got);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-/*
- * Test nc_get_vars(,,,,,)
- * Choose a random point dividing each dim into 2 parts
- * Get 2^rank (nslabs) slabs so defined
- * Each get overwrites buffer, so check after each get.
- */
-int
-test_nc_get_vars(void)
-{
-    int ncid;
-    int d;
-    int i;
-    int k;
-    int err;
-    int nslabs;
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* total count of valid comparisons */
-    int n;              /* count of valid comparisons within var */
-    size_t j, m, nels;
-    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];
-    
-    double buf[MAX_NELS];     /* (void *) buffer */
-    char *p;                  /* (void *) pointer */
-    double expect;
-    double got;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_vars(BAD_ID,0,NULL,NULL,NULL,NULL);
-    IF (err != NC_EBADID) error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_vars(ncid,BAD_VARID,NULL,NULL,NULL,NULL);
-    IF (err != NC_ENOTVAR) error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_vars(BAD_ID,i,NULL,NULL,NULL,buf);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* test NC_EINVALCOORDS, first when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j];
-            err = nc_get_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_get_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_vars(ncid,i,start,edge,stride,buf);
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1;  /* out of boundary check */
-            err = nc_get_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 1;
-
-        err = nc_get_vars(ncid,i,start,edge,stride,buf);
-        IF (err != NC_NOERR)
-            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        /* 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 */
-        n = 0;
-        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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                err = nc_get_vars(ncid,i,index,count,stride,buf);
-                IF (err != NC_NOERR)
-                    error("%s",  nc_strerror(err));
-                ELSE_NOK
-
-                for (j = 0; j < nels; j++) {
-                    p = (char *) buf;
-                    p += j * (size_t)nctypelen(var_type[i]);
-                    err = nc2dbl( var_type[i], p, & got );
-                    IF (err != NC_NOERR)
-                        error("error in nc2dbl");
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    expect = hash(var_type[i], var_rank[i], index2);
-                    if (inRange(expect,var_type[i])) {
-                        IF (!equal2(got,expect,var_type[i])) {
-                            error("buf 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);
-                                error("got: %g ", got);
-                            }
-                        }
-                        ELSE_NOK
-                    }
-                    n++;
-                }
-            }
-        }
-        IF (n != var_nels[i]) {
-            error("count != nels");
-            if (verbose) {
-                error("\n");
-                error("varid: %d, ", i);
-                error("var_name: %s, ", var_name[i]);
-                error("count: %d, ", n);
-                error("nels: %d ", var_nels[i]);
-            }
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-/*
- * Test nc_get_varm(,,,,,,)
- * Choose a random point dividing each dim into 2 parts
- * Get 2^rank (nslabs) slabs so defined
- * Choose random stride from 1 to edge
- * Buffer should end up being bit image of external variable.
- * So all gets for a variable store in different elements of buffer
- */
-int
-test_nc_get_varm(void)
-{
-    int ncid;
-    int i;
-    int k;
-    int err;
-    int nslabs;
-    ptrdiff_t nstarts;   /* number of different starts */
-    int nok = 0;        /* total count of valid comparisons */
-    size_t j, m, nels;
-    size_t start[MAX_RANK];
-    size_t edge[MAX_RANK];
-    size_t index[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];
-    ptrdiff_t imap2[MAX_RANK];
-    
-    double buf[MAX_NELS];        /* (void *) buffer */
-    char *p;                     /* (void *) pointer */
-    double expect;
-    double got;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_get_varm(BAD_ID,0,NULL,NULL,NULL,NULL,NULL);
-    IF (err != NC_EBADID) error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-
-    /* check if can detect a bad variable ID */
-    err = nc_get_varm(ncid,BAD_VARID,NULL,NULL,NULL,NULL,NULL);
-    IF (err != NC_ENOTVAR) error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        /* check if can detect a bad file ID */
-        err = nc_get_varm(BAD_ID,i,NULL,NULL,NULL,NULL,buf);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* test NC_EINVALCOORDS, first when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = var_shape[i][j];
-            err = nc_get_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_get_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDGE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;
-            err = nc_get_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check non-scalars for correct error returned even when there is
-         * nothing to get (edge[j]==0) */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_get_varm(ncid,i,start,edge,stride,imap,buf);
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1;  /* out of boundary check */
-            err = nc_get_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 1;
-
-        err = nc_get_varm(ncid,i,start,edge,stride,imap,buf);
-        IF (err != NC_NOERR)
-            error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        if (var_rank[i] > 0) {
-            int jj = var_rank[i] - 1;
-            /* imap[jj] = nctypelen(var_type[i]); */
-            imap[jj] = 1; /* in numbers of elements */
-            for (; jj > 0; jj--)
-                imap[jj-1] = imap[jj] * (ptrdiff_t)var_shape[i][jj];
-        }
-
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                imap2[j] = imap[j] * stride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                if (var_rank[i] == 0 && i%2 ) {
-                    err = nc_get_varm(ncid,i,NULL,NULL,NULL,NULL,buf);
-                } else {
-                    err = toMixedBase(m, var_rank[i], sstride, index);
-                    IF (err != 0) error("error in toMixedBase");
-                    nels = 1;
-                    for (j = 0; j < var_rank[i]; j++) {
-                        count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)stride[j];
-                        index[j] += start[j];
-                        nels *= count[j];
-                    }
-                    /* Random choice of forward or backward */
-/* TODO
-                    if ( roll(2) ) {
-                        for (j = 0; j < var_rank[i]; j++) {
-                            index[j] += (count[j] - 1) * (size_t)stride[j];
-                            stride[j] = -stride[j];
-                        }
-                    }
- */
-                    j = fromMixedBase(var_rank[i], index, var_shape[i]);
-                    p = (char *) buf + j * (size_t)nctypelen(var_type[i]);
-                    err = nc_get_varm(ncid,i,index,count,stride,imap2,p);
-                }
-                IF (err != NC_NOERR)
-                    error("%s",  nc_strerror(err));
-                ELSE_NOK
-            }
-        }
-        p = (char *) buf;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            expect = hash( var_type[i], var_rank[i], index);
-            err = nc2dbl( var_type[i], p, & got );
-            IF (err != NC_NOERR)
-                error("error in nc2dbl");
-            if (inRange(expect,var_type[i])) {
-                IF (!equal2(got,expect,var_type[i])) {
-                    error("buf 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);
-                        error("got: %g ", got);
-                    }
-                }
-                ELSE_NOK
-            }
-            p += nctypelen(var_type[i]);
-        }
-    }
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_get_att(void)
-{
-    int ncid;
-    int i;
-    int j;
-    size_t k, ndx[1];
-    int err;
-    double buf[MAX_NELS];        /* (void *) buffer */
-    char *p;                     /* (void *) pointer */
-    double expect;
-    double got;
-    int nok = 0;      /* count of valid comparisons */
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        for (j = 0; j < NATTS(i); j++) {
-            err =  nc_get_att(BAD_ID, i, ATT_NAME(i,j), buf);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_get_att(ncid, BAD_VARID, ATT_NAME(i,j), buf);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_get_att(ncid, i, "noSuch", buf);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_get_att(ncid, i, ATT_NAME(i,j), buf);
-            IF (err != NC_NOERR) {
-                error("%s",  nc_strerror(err));
-            } else {
-                nok++;
-                for (k = 0; k < ATT_LEN(i,j); k++) {
-                    ndx[0] = k;
-                    expect = hash(ATT_TYPE(i,j), -1, ndx);
-                    p = (char *) buf;
-                    p += k * (size_t)nctypelen(ATT_TYPE(i,j));
-                    err = nc2dbl( ATT_TYPE(i,j), p, &got );
-                    IF (err != NC_NOERR)
-                        error("error in nc2dbl");
-                    if (inRange(expect,ATT_TYPE(i,j))) {
-                        IF (!equal2(got,expect,ATT_TYPE(i,j))) {
-                            error("buf read not that expected");
-                            if (verbose) {
-                                error("\n");
-                                error("varid: %d, ", i);
-                                error("var_name: %s, ",
-                                        i >= 0 ? var_name[i] : "Global");
-                                error("att_name: %s, ", ATT_NAME(i,j));
-                                error("element number: %d\n", k);
-                                error("expect: %-23.16e\n", expect);
-                                error("   got: %-23.16e", got);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_att(void)
-{
-    int ncid;
-    int i;
-    int j;
-    int err;
-    nc_type t;
-    size_t n;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        for (j = 0; j < NATTS(i); j++) {
-            err =  nc_inq_att(BAD_ID, i, ATT_NAME(i,j), &t, &n);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_att(ncid, BAD_VARID, ATT_NAME(i,j), &t, &n);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_att(ncid, i, "noSuch", &t, &n);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_att(ncid, i, ATT_NAME(i,j), &t, &n);
-            IF (err != NC_NOERR) {
-                error("%s",  nc_strerror(err));
-            } else {
-                IF (t != ATT_TYPE(i,j))
-                    error("type not that expected");
-                ELSE_NOK
-                IF (n != ATT_LEN(i,j))
-                    error("length not that expected");
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_attlen(void)
-{
-    int ncid;
-    int i;
-    int j;
-    int err;
-    size_t len;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        err =  nc_inq_attlen(ncid, i, "noSuch", &len);
-        IF (err != NC_ENOTATT)
-            error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        for (j = 0; j < NATTS(i); j++) {
-            err =  nc_inq_attlen(BAD_ID, i, ATT_NAME(i,j), &len);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_attlen(ncid, BAD_VARID, ATT_NAME(i,j), &len);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_attlen(ncid, i, ATT_NAME(i,j), &len);
-            IF (err != NC_NOERR) {
-                error("%s",  nc_strerror(err));
-            } else {
-                IF (len != ATT_LEN(i,j))
-                    error("len not that expected");
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_atttype(void)
-{
-    int ncid;
-    int i;
-    int j;
-    int err;
-    nc_type datatype;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        err =  nc_inq_atttype(ncid, i, "noSuch", &datatype);
-        IF (err != NC_ENOTATT)
-            error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        for (j = 0; j < NATTS(i); j++) {
-            err =  nc_inq_atttype(BAD_ID, i, ATT_NAME(i,j), &datatype);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_atttype(ncid, BAD_VARID, ATT_NAME(i,j), &datatype);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_atttype(ncid, i, ATT_NAME(i,j), &datatype);
-            IF (err != NC_NOERR) {
-                error("%s",  nc_strerror(err));
-            } else {
-                IF (datatype != ATT_TYPE(i,j))
-                    error("type not that expected");
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_attname(void)
-{
-    int ncid;
-    int i;
-    int j;
-    int err;
-    char name[NC_MAX_NAME];
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        err =  nc_inq_attname(ncid, i, BAD_ATTNUM, name);
-        IF (err != NC_ENOTATT)
-            error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err =  nc_inq_attname(ncid, i, NATTS(i), name);
-        IF (err != NC_ENOTATT)
-            error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        for (j = 0; j < NATTS(i); j++) {
-            err =  nc_inq_attname(BAD_ID, i, j, name);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_attname(ncid, BAD_VARID, j, name);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_attname(ncid, i, j, name);
-            IF (err != NC_NOERR) {
-                error("%s",  nc_strerror(err));
-            } else {
-                IF (strcmp(ATT_NAME(i,j), name) != 0)
-                    error("name not that expected");
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
-
-
-int
-test_nc_inq_attid(void)
-{
-    int ncid;
-    int i;
-    int j;
-    int err;
-    int attnum;
-    int nok=0;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s",  nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        err =  nc_inq_attid(ncid, i, "noSuch", &attnum);
-        IF (err != NC_ENOTATT)
-            error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        for (j = 0; j < NATTS(i); j++) {
-            err =  nc_inq_attid(BAD_ID, i, ATT_NAME(i,j), &attnum);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_attid(ncid, BAD_VARID, ATT_NAME(i,j), &attnum);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err =  nc_inq_attid(ncid, i, ATT_NAME(i,j), &attnum);
-            IF (err != NC_NOERR) {
-                error("%s",  nc_strerror(err));
-            } else {
-                IF (attnum != j)
-                    error("attnum not that expected");
-                ELSE_NOK
-            }
-        }
-    }
-
-    err =  nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s",  nc_strerror(err));
-    return nok;
-}
diff --git a/nc_test/test_write.c b/nc_test/test_write.c
deleted file mode 100644
index a554f68..0000000
--- a/nc_test/test_write.c
+++ /dev/null
@@ -1,2376 +0,0 @@
-/* Do not edit this file. It is produced from the corresponding .m4 source */
-/*
- *  Copyright (C) 2003, Northwestern University and Argonne National Laboratory
- *  See COPYRIGHT notice in top-level directory.
- */
-/* $Id: test_write.m4 2687 2016-12-08 18:32:13Z wkliao $ */
-
-
-#if defined (_WIN32) || defined (_WIN64)
-#include <io.h>
-#endif
-
-#include <sys/types.h>  /* open() */
-#include <sys/stat.h>   /* open() */
-#include <fcntl.h>      /* open() */
-#ifdef _MSC_VER
-#include <io.h>
-#else
-#include <unistd.h>     /* read() */
-#endif
-
-#include "tests.h"
-#include "math.h"
-
-
-
-
-
-
-
-
-/*
- * Test nc_create
- *    For mode in NC_NOCLOBBER, NC_CLOBBER do:
- *       create netcdf file 'scratch.nc' with no data, close it
- *       test that it can be opened, do nc_inq to check nvars = 0, etc.
- *    Try again in NC_NOCLOBBER mode, check error return
- * On exit, delete this file
- */
-int
-test_nc_create(void)
-{
-    int clobber; /* 0 for NC_NOCLOBBER, 1 for NC_CLOBBER */
-    int err;
-    int ncid;
-    int ndims;   /* number of dimensions */
-    int nvars;   /* number of variables */
-    int ngatts;  /* number of global attributes */
-    int recdim;  /* id of unlimited dimension */
-    int nok=0;
-
-    for (clobber = 0; clobber < 2; clobber++) {
-        err = file_create(scratch, clobber ? NC_CLOBBER : NC_NOCLOBBER, &ncid);
-        IF (err != NC_NOERR)
-            error("create: %s", nc_strerror(err));
-        ELSE_NOK
-        err = nc_close(ncid);
-        IF (err != NC_NOERR)
-            error("close: %s", nc_strerror(err));
-        err = file_open(scratch, NC_NOWRITE, &ncid);
-        IF (err != NC_NOERR)
-            error("open: %s", nc_strerror(err));
-        err = nc_inq(ncid, &ndims, &nvars, &ngatts, &recdim);
-        IF (err != NC_NOERR)
-            error("inq: %s", nc_strerror(err));
-        else IF (ndims != 0)
-            error("inq: wrong number of dimensions returned, %d", ndims);
-        else IF (nvars != 0)
-            error("inq: wrong number of variables returned, %d", nvars);
-        else IF (ngatts != 0)
-            error("inq: wrong number of global atts returned, %d", ngatts);
-        else IF (recdim != -1)
-            error("inq: wrong record dimension ID returned, %d", recdim);
-        ELSE_NOK
-        err = nc_close(ncid);
-        IF (err != NC_NOERR)
-            error("close: %s", nc_strerror(err));
-    }
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_EEXIST)
-        error("expecting NC_EEXIST but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_redef
- * (In fact also tests nc_enddef - called from test_nc_enddef)
- *    BAD_ID
- *    attempt redef (error) & enddef on read-only file
- *    create file, define dims & vars.
- *    attempt put var (error)
- *    attempt redef (error) & enddef.
- *    put vars
- *    attempt def new dims (error)
- *    redef
- *    def new dims, vars.
- *    put atts
- *    enddef
- *    put vars
- *    close
- *    check file: vars & atts
- *    check reopening with NC_WRITE and adding new dims, atts, vars
- */
-int
-test_nc_redef(void)
-{
-    int ncid;          /* netcdf id */
-    /* used to force effective test of ncio->move() in redef */
-    size_t sizehint = 8192;
-    int dimid;         /* dimension id */
-    int varid;         /* variable id */
-    int varid1;        /* variable id */
-    int nok=0, err;
-    const char * title = "Not funny";
-    double var;
-    char name[NC_MAX_NAME];
-    size_t length;
-    int fmt_variant1, fmt_variant2;
-
-    /* BAD_ID tests */
-    err = nc_redef(BAD_ID);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_enddef(BAD_ID);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* read-only tests */
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    err = nc_redef(ncid);
-    IF (err != NC_EPERM)
-        error("expecting NC_EPERM but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_enddef(ncid);
-    IF (err != NC_ENOTINDEFINE)
-        error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    /* tests using scratch file */
-    err = file__create(scratch, NC_NOCLOBBER, 0, &sizehint, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    /* limit for ncio implementations which have infinite chunksize */
-    if(sizehint > 32768) sizehint = 16384;
-    def_dims(ncid);
-    def_vars(ncid);
-    put_atts(ncid);
-    err = nc_inq_varid(ncid, "d", &varid);
-    IF (err != NC_NOERR)
-        error("inq_varid: %s", nc_strerror(err));
-    var = 1.0;
-
-
-    err = nc_put_var1_double(ncid, varid, NULL, &var);
-    IF (err != NC_EINDEFINE)
-        error("expecting NC_EINDEFINE but got %s", nc_err_code_name(err));
-
-
-    err = nc_redef(ncid);
-    IF (err != NC_EINDEFINE)
-        error("expecting NC_EINDEFINE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    ELSE_NOK
-    put_vars(ncid);
-    err = nc_def_dim(ncid, "abc", sizehint, &dimid);
-    IF (err != NC_ENOTINDEFINE)
-        error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-    err = nc_redef(ncid);
-    IF (err != NC_NOERR)
-        error("redef: %s", nc_strerror(err));
-    ELSE_NOK
-
-    err = nc_set_fill(ncid, NC_NOFILL, NULL);
-    IF (err != NC_NOERR)
-        error("set_fill: %s", nc_strerror(err));
-
-    err = nc_def_dim(ncid, "abc", sizehint, &dimid);
-    IF (err != NC_NOERR)
-        error("def_dim: %s", nc_strerror(err));
-    err = nc_def_var(ncid, "abcScalar", NC_INT, 0, NULL, &varid);
-    IF (err != NC_NOERR)
-        error("def_var: %s", nc_strerror(err));
-    err = nc_def_var(ncid, "abc", NC_INT, 1, &dimid, &varid1);
-    IF (err != NC_NOERR)
-        error("def_var: %s", nc_strerror(err));
-    {
-        int dimids[NDIMS +1];
-        int ii = 0;
-        for(ii = 0; ii < NDIMS; ii++) dimids[ii] = ii;
-        dimids[NDIMS] = dimid;
-        err = nc_def_var(ncid, "abcRec", NC_INT, NDIMS, dimids, &varid1);
-        IF (err != NC_NOERR)
-            error("def_var: %s", nc_strerror(err));
-    }
-    err = nc_put_att_text(ncid, NC_GLOBAL, "title", 1+strlen(title), title);
-    IF (err != NC_NOERR)
-        error("put_att_text: %s", nc_strerror(err));
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    ELSE_NOK
-    var = 1.0;
-
-
-    err = nc_put_var1_double(ncid, varid, NULL, &var);
-    IF (err != NC_NOERR)
-        error("put_var1_double: %s", nc_strerror(err));
-    err = nc_inq_format(ncid, &fmt_variant1);
-    IF (err)
-        error("inq_format: %s", nc_strerror(err));
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    /* check scratch file written as expected */
-    check_file(scratch); /* checks all except "abc" stuff added above */
-
-    IF ((err = file_open(scratch, NC_NOWRITE, &ncid)))
-        error("open: %s", nc_strerror(err));
-    IF ((err = nc_inq_dim(ncid, dimid, name, &length)))
-        error("inq_dim: %s", nc_strerror(err));
-    IF (strcmp(name, "abc") != 0)
-        error("Unexpected dim name");
-    IF (length != sizehint)
-        error("Unexpected dim length");
-    IF ((err = nc_get_var1_double(ncid, varid, NULL, &var)))
-        error("get_var1_double: %s", nc_strerror(err));
-    IF (var != 1.0)
-        error("get_var1_double: unexpected value");
-    IF ((err = nc_close(ncid)))
-        error("close: %s", nc_strerror(err));
-
-    /* open scratch file for writing, add another dim, var, att, then check */
-    IF ((err = file_open(scratch, NC_WRITE, &ncid)))
-        error("open: %s", nc_strerror(err));
-    IF ((err = nc_redef(ncid)))
-        error("redef: %s", nc_strerror(err));
-    IF ((err = nc_def_dim(ncid, "def", sizehint, &dimid)))
-        error("def_dim: %s", nc_strerror(err));
-    IF ((err = nc_def_var(ncid, "defScalar", NC_INT, 0, NULL, &varid)))
-        error("def_var: %s", nc_strerror(err));
-    IF ((err = nc_def_var(ncid, "def", NC_INT, 1, &dimid, &varid1)))
-        error("def_var: %s", nc_strerror(err));
-    IF ((err = nc_put_att_text(ncid, NC_GLOBAL, "Credits", 1+strlen("Thanks!"), "Thanks!")))
-        error("put_att_text: %s", nc_strerror(err));
-    IF ((err = nc_enddef(ncid)))
-        error("enddef: %s", nc_strerror(err));
-    var = 2.0;
-    IF ((err = nc_put_var1_double(ncid, varid, NULL, &var)))
-        error("put_var1_double: %s", nc_strerror(err));
-    IF ((err = nc_close(ncid)))
-        error("close: %s", nc_strerror(err));
-
-    /* check scratch file written as expected */
-    check_file(scratch);
-
-    err = file_open(scratch, NC_NOWRITE, &ncid);
-    IF (err)
-        error("open: %s", nc_strerror(err));
-    err = nc_inq_dim(ncid, dimid, name, &length);
-    IF (err)
-        error("inq_dim: %s", nc_strerror(err));
-    IF (strcmp(name, "def") != 0)
-        error("Unexpected dim name");
-    IF (length != sizehint)
-        error("Unexpected dim length");
-    err = nc_get_var1_double(ncid, varid, NULL, &var);
-    IF (err)
-        error("get_var1_double: %s", nc_strerror(err));
-    IF (var != 2.0)
-        error("get_var1_double: unexpected value");
-    /* make sure format variant hasn't changed from when created */
-    err = nc_inq_format(ncid, &fmt_variant2);
-    IF (err)
-        error("inq_format: %s", nc_strerror(err));
-    IF (fmt_variant1 != fmt_variant2)
-        error("enddef changed format variant");
-    err = nc_close(ncid);
-    IF (err)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_enddef
- * Simply calls test_nc_redef which tests both nc_redef & nc_enddef
- */
-int
-test_nc_enddef(void)
-{
-    return test_nc_redef();
-}
-
-
-/*
- * Test nc_sync
- *    try with bad handle, check error
- *    try in define mode, check error
- *    try writing with one handle, reading with another on same netCDF
- */
-int
-test_nc_sync(void)
-{
-    int ncidw;         /* netcdf id for writing */
-    int ncidr;         /* netcdf id for reading */
-    int nok=0, err;
-
-    /* BAD_ID test */
-    err = nc_sync(BAD_ID);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* create scratch file & try nc_sync in define mode */
-    err = file_create(scratch, NC_NOCLOBBER, &ncidw);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_sync(ncidw);
-    IF (err != NC_EINDEFINE)
-        error("expecting NC_EINDEFINE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* write using same handle */
-    def_dims(ncidw);
-    def_vars(ncidw);
-    put_atts(ncidw);
-    err = nc_enddef(ncidw);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    put_vars(ncidw);
-    err = nc_sync(ncidw);
-    IF (err != NC_NOERR)
-        error("sync of ncidw failed: %s", nc_strerror(err));
-    ELSE_NOK
-
-    /* open another handle, nc_sync, read (check) */
-    err = file_open(scratch, NC_NOWRITE, &ncidr);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    err = nc_sync(ncidr);
-    IF (err != NC_NOERR)
-        error("sync of ncidr failed: %s", nc_strerror(err));
-    ELSE_NOK
-    check_dims(ncidr);
-    check_atts(ncidr);
-    check_vars(ncidr);
-
-    /* close both handles */
-    err = nc_close(ncidr);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_close(ncidw);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_abort
- *    try with bad handle, check error
- *    try in define mode before anything written, check that file was deleted
- *    try after nc_enddef, nc_redef, define new dims, vars, atts
- *    try after writing variable
- */
-int
-test_nc_abort(void)
-{
-    int ncid;          /* netcdf id */
-    int err;
-    int ndims;
-    int nvars;
-    int ngatts;
-    int nok=0;
-
-    /* BAD_ID test */
-    err = nc_abort(BAD_ID);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* create scratch file & try nc_abort in define mode */
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    def_vars(ncid);
-    put_atts(ncid);
-    err = nc_abort(ncid);
-    IF (err != NC_NOERR)
-        error("abort of ncid failed: %s", nc_strerror(err));
-    ELSE_NOK
-    err = nc_close(ncid);        /* should already be closed */
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    err = nc_delete(scratch);        /* should already be deleted */
-IF (err != ENOENT && err != NC_EIO)
-        error("expecting ENOENT or NC_EIO but got %s", nc_err_code_name(err));
-    /*
-     * create scratch file
-     * do nc_enddef & nc_redef
-     * define new dims, vars, atts
-     * try nc_abort: should restore previous state (no dims, vars, atts)
-     */
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    err = nc_redef(ncid);
-    IF (err != NC_NOERR)
-        error("redef: %s", nc_strerror(err));
-    def_dims(ncid);
-    def_vars(ncid);
-    put_atts(ncid);
-    err = nc_abort(ncid);
-    IF (err != NC_NOERR)
-        error("abort of ncid failed: %s", nc_strerror(err));
-    ELSE_NOK
-    err = nc_close(ncid);        /* should already be closed */
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    err = file_open(scratch, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    err = nc_inq(ncid, &ndims, &nvars, &ngatts, NULL);
-    IF (err != NC_NOERR)
-        error("inq: %s", nc_strerror(err));
-    IF (ndims != 0)
-        error("ndims should be 0");
-    IF (nvars != 0)
-        error("nvars should be 0");
-    IF (ngatts != 0)
-        error("ngatts should be 0");
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    /* try nc_abort in data mode - should just close */
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    def_vars(ncid);
-    put_atts(ncid);
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    put_vars(ncid);
-    err = nc_abort(ncid);
-    IF (err != NC_NOERR)
-        error("abort of ncid failed: %s", nc_strerror(err));
-    ELSE_NOK
-    err = nc_close(ncid);       /* should already be closed */
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    check_file(scratch);
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_def_dim
- *    try with bad netCDF handle, check error
- *    try in data mode, check error
- *    check that returned id is one more than previous id
- *    try adding same dimension twice, check error
- *    try with illegal sizes, check error
- *    make sure unlimited size works, shows up in nc_inq_unlimdim
- *    try to define a second unlimited dimension, check error
- */
-int
-test_nc_def_dim(void)
-{
-    int ncid;
-    int  err;           /* status */
-    int  i, nok=0;
-    int  dimid;         /* dimension id */
-    size_t length;
-
-    /* BAD_ID test */
-    err = nc_def_dim(BAD_ID, "abc", 8, &dimid);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* data mode test */
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    err = nc_def_dim(ncid, "abc", 8, &dimid);
-    IF (err != NC_ENOTINDEFINE)
-        error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* define-mode tests: unlimited dim */
-    err = nc_redef(ncid);
-    IF (err != NC_NOERR)
-        error("redef: %s", nc_strerror(err));
-    err = nc_def_dim(ncid, dim_name[0], NC_UNLIMITED, &dimid);
-    IF (err != NC_NOERR)
-        error("def_dim: %s", nc_strerror(err));
-    ELSE_NOK
-    IF (dimid != 0)
-        error("Unexpected dimid");
-    ELSE_NOK
-    err = nc_inq_unlimdim(ncid, &dimid);
-    IF (err != NC_NOERR)
-        error("inq_unlimdim: %s", nc_strerror(err));
-    IF (dimid != 0)
-        error("Unexpected recdim");
-    err = nc_inq_dimlen(ncid, dimid, &length);
-    IF (length != 0)
-        error("Unexpected length");
-    err = nc_def_dim(ncid, "abc", NC_UNLIMITED, &dimid);
-    IF (err != NC_EUNLIMIT)
-        error("expecting NC_EUNLIMIT but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* define-mode tests: remaining dims */
-    for (i = 1; i < NDIMS; i++) {
-        err = nc_def_dim(ncid, dim_name[i-1], dim_len[i], &dimid);
-        IF (err != NC_ENAMEINUSE)
-            error("expecting NC_ENAMEINUSE but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err = nc_def_dim(ncid, BAD_NAME, dim_len[i], &dimid);
-        IF (err != NC_EBADNAME)
-            error("expecting NC_EBADNAME but got %s", nc_err_code_name(err));
-        ELSE_NOK
-if(sizeof(long) > 4) /* Fix: dmh 11/4/2011: works only if sizeof(long) > 4 */
-        {
-            err = nc_def_dim(ncid, dim_name[i], (size_t)(NC_UNLIMITED-1), &dimid);
-            IF (err != NC_EDIMSIZE)
-                error("expecting NC_EDIMSIZE but got %s", nc_err_code_name(err));
-            ELSE_NOK
-        }
-        err = nc_def_dim(ncid, dim_name[i], dim_len[i], &dimid);
-        IF (err != NC_NOERR)
-            error("def_dim: %s", nc_strerror(err));
-        ELSE_NOK
-        IF (dimid != i)
-            error("Unexpected dimid");
-    }
-
-    /* Following just to expand unlimited dim */
-    def_vars(ncid);
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    put_vars(ncid);
-
-    /* Check all dims */
-    check_dims(ncid);
-
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_rename_dim
- *    try with bad netCDF handle, check error
- *    check that proper rename worked with nc_inq_dim
- *    try renaming to existing dimension name, check error
- *    try with bad dimension handle, check error
- */
-int
-test_nc_rename_dim(void)
-{
-    int ncid;
-    int  err, nok=0;             /* status */
-    char name[NC_MAX_NAME];
-
-    /* BAD_ID test */
-    err = nc_rename_dim(BAD_ID, 0, "abc");
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* main tests */
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    err = nc_rename_dim(ncid, BAD_DIMID, "abc");
-    IF (err != NC_EBADDIM)
-        error("expecting NC_EBADDIM but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_rename_dim(ncid, 2, "abc");
-    IF (err != NC_NOERR)
-        error("rename_dim: %s", nc_strerror(err));
-    ELSE_NOK
-    err = nc_inq_dimname(ncid, 2, name);
-    IF (strcmp(name, "abc") != 0)
-        error("Unexpected name: %s", name);
-    err = nc_rename_dim(ncid, 0, "abc");
-    IF (err != NC_ENAMEINUSE)
-        error("expecting NC_ENAMEINUSE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_def_var
- *    try with bad netCDF handle, check error
- *    try with bad name, check error
- *    scalar tests:
- *      check that proper define worked with nc_inq_var
- *      try redefining an existing variable, check error
- *      try with bad datatype, check error
- *      try with bad number of dimensions, check error
- *      try in data mode, check error
- *    check that returned id is one more than previous id
- *    try with bad dimension ids, check error
- */
-int
-test_nc_def_var(void)
-{
-    int  ncid;
-    int  varid;
-    int  err, nok=0;             /* status */
-    int  i;
-    int  ndims;
-    int  natts;
-    char name[NC_MAX_NAME];
-    int dimids[MAX_RANK];
-    nc_type datatype;
-
-    /* BAD_ID test */
-    err = nc_def_var(BAD_ID, "abc", NC_SHORT, 0, NULL, &varid);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* scalar tests */
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_def_var(ncid, "abc", NC_SHORT, 0, NULL, &varid);
-    IF (err != NC_NOERR)
-        error("def_var: %s", nc_strerror(err));
-    ELSE_NOK
-    err = nc_inq_var(ncid, varid, name, &datatype, &ndims, dimids, &natts);
-    IF (err != NC_NOERR)
-        error("inq_var: %s", nc_strerror(err));
-    IF (strcmp(name, "abc") != 0)
-        error("Unexpected name: %s", name);
-    IF (datatype != NC_SHORT)
-        error("Unexpected datatype");
-    IF (ndims != 0)
-        error("Unexpected rank");
-    err = nc_def_var(ncid, BAD_NAME, NC_SHORT, 0, NULL, &varid);
-    IF (err != NC_EBADNAME)
-        error("expecting NC_EBADNAME but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_def_var(ncid, "abc", NC_SHORT, 0, NULL, &varid);
-    IF (err != NC_ENAMEINUSE)
-        error("expecting NC_ENAMEINUSE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_def_var(ncid, "ABC", BAD_TYPE, -1, dimids, &varid);
-    IF (err != NC_EBADTYPE)
-        error("expecting NC_EBADTYPE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_def_var(ncid, "ABC", NC_SHORT, -1, dimids, &varid);
-    IF (err != NC_EINVAL)
-        error("expecting NC_EINVAL but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    err = nc_def_var(ncid, "ABC", NC_SHORT, 0, dimids, &varid);
-    IF (err != NC_ENOTINDEFINE)
-        error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-
-    /* general tests using global vars */
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    for (i = 0; i < numVars; i++) {
-        err = nc_def_var(ncid, var_name[i], var_type[i], var_rank[i],
-            var_dimid[i], &varid);
-        IF (err != NC_NOERR)
-            error("def_var: %s", nc_strerror(err));
-        ELSE_NOK
-        IF (varid != i)
-            error("Unexpected varid");
-        ELSE_NOK
-    }
-
-    /* try bad dim ids */
-    dimids[0] = BAD_DIMID;
-    err = nc_def_var(ncid, "abc", NC_SHORT, 1, dimids, &varid);
-    IF (err != NC_EBADDIM)
-        error("expecting NC_EBADDIM but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_put_var1(,,,)
- */
-int
-test_nc_put_var1(void)
-{
-    int i, err, ncid, nok=0;
-    size_t j, index[MAX_RANK];
-    double value[1];
-    double buf[1];                /* (void *) buffer */
-    
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_var1(BAD_ID,0,NULL,NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_var1(ncid,BAD_VARID,NULL,NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        value[0] = 5;  /* reset to a value within bounds */
-
-        
-
-
-        /* test NC_EINVALCOORDS */
-        for (j = 0; j < var_rank[i]; j++) index[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            index[j] = var_shape[i][j]; /* out of boundary check */
-            err = nc_put_var1(ncid,i,index,value);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            index[j] = 0;
-        }
-
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value[0] = hash(var_type[i], var_rank[i], index);
-            if (inRange(value[0], var_type[i])) {
-                err = dbl2nc(value[0], var_type[i], buf);
-                IF (err != NC_NOERR)
-                    error("error in dbl2nc var:%s type:%s",
-                          var_name[i],s_nc_type(var_type[i]));
-                err = nc_put_var1(ncid,i,index,buf);
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    check_vars(ncid);
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_put_vara(,,,,)
- * Choose a random point dividing each dim into 2 parts
- * Put 2^rank (nslabs) slabs so defined
- * Redefine buffer for each put.
- * At end check all variables using check_vars()
- */
-int
-test_nc_put_vara(void)
-{
-    int d, i, k, err, nslabs, ncid, nok=0;
-    size_t j, nels;
-    size_t start[MAX_RANK];
-    size_t edge[MAX_RANK];
-    size_t index[MAX_RANK];
-    size_t mid[MAX_RANK];
-    double buf[MAX_NELS];         /* (void *) buffer */
-    char *p;                      /* (void *) pointer */
-    double value;
-    
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vara(BAD_ID,0,start,edge,buf);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vara(ncid,BAD_VARID,start,edge,buf);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        buf[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vara(BAD_ID,i,start,edge,buf);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara(ncid,i,start,edge,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;
-            err = nc_put_vara(ncid,i,start,edge,buf);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-        }
-        /* Check correct error returned when nothing to put, when edge[*]==0 */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == RECDIM) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vara(ncid,i,start,edge,buf);
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vara(ncid,i,start,edge,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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];
-            }
-            p = (char *) buf;
-            for (j = 0; j < nels; j++) {
-                err = toMixedBase(j, var_rank[i], edge, index);
-                IF (err != 0) error("error in toMixedBase");
-                for (d = 0; d < var_rank[i]; d++)
-                    index[d] += start[d];
-                value = hash(var_type[i], var_rank[i], index);
-                if (!inRange(value, var_type[i]))
-                    value = 0;
-                err = dbl2nc(value, var_type[i], p);
-                IF (err != NC_NOERR)
-                    error("error in dbl2nc");
-                p += nctypelen(var_type[i]);
-            }
-            err = nc_put_vara(ncid,i,start,edge,buf);
-            IF (err != NC_NOERR)
-                error("%s", nc_strerror(err));
-            ELSE_NOK
-        }
-    }
-
-    check_vars(ncid);
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_put_vars(,,,,,)
- * Choose a random point dividing each dim into 2 parts
- * Put 2^rank (nslabs) slabs so defined
- * Choose random stride from 1 to edge
- * Redefine buffer for each put.
- * At end check all variables using check_vars()
- */
-int
-test_nc_put_vars(void)
-{
-    int ncid, d, i, k, err, nslabs, nok=0;
-    ptrdiff_t nstarts;        /* number of different starts */
-    size_t j, m, nels;
-    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];
-    double buf[MAX_NELS]; /* (void *) buffer */
-    char *p;              /* (void *) pointer */
-    double value;
-    
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_vars(BAD_ID,0,NULL,NULL,NULL,NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_vars(ncid,BAD_VARID,NULL,NULL,NULL,NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        buf[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_vars(BAD_ID,i,NULL,NULL,NULL,buf);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == 0) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;  /* edge error check */
-            err = nc_put_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;  /* strided edge error check */
-            err = nc_put_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == 0) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_vars(ncid,i,start,edge,stride,buf);
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_vars(ncid,i,start,edge,stride,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        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 */
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                err = toMixedBase(m, var_rank[i], sstride, index);
-                IF (err != 0) error("error in toMixedBase");
-                nels = 1;
-                for (j = 0; j < var_rank[i]; j++) {
-                    count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)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) * (size_t)stride[j];
-                        stride[j] = -stride[j];
-                    }
-                }
- */
-                p = (char *) buf;
-                for (j = 0; j < nels; j++) {
-                    err = toMixedBase(j, var_rank[i], count, index2);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (d = 0; d < var_rank[i]; d++)
-                        index2[d] = index[d] + index2[d] * (size_t)stride[d];
-                    value = hash(var_type[i], var_rank[i], index2);
-                    if (!inRange(value, var_type[i]))
-                        value = 0;
-                    err = dbl2nc(value, var_type[i], p);
-                    IF (err != NC_NOERR)
-                        error("error in dbl2nc");
-                    p += nctypelen(var_type[i]);
-                }
-                err = nc_put_vars(ncid,i,index,count,stride,buf);
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    check_vars(ncid);
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_put_varm(,,,,,,)
- * Choose a random point dividing each dim into 2 parts
- * Put 2^rank (nslabs) slabs so defined
- * Choose random stride from 1 to edge
- * Buffer is bit image of whole external variable.
- * So all puts for a variable put different elements of buffer
- * At end check all variables using check_vars()
- */
-int
-test_nc_put_varm(void)
-{
-    int ncid, nok=0;
-    int i;
-    int k;
-    int err;
-    int nslabs;
-    size_t j, m;
-    ptrdiff_t nstarts;        /* number of different starts */
-    size_t start[MAX_RANK];
-    size_t edge[MAX_RANK];
-    size_t index[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];
-    ptrdiff_t imap2[MAX_RANK];
-    
-    double buf[MAX_NELS];       /* (void *) buffer */
-    char *p;                    /* (void *) pointer */
-    double value;
-    
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-
-    def_dims(ncid);
-    def_vars(ncid);
-
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-
-    /* check if can detect a bad file ID */
-    err = nc_put_varm(NC_EBADID,0,NULL,NULL,NULL,NULL,NULL);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    /* check if can detect a bad variable ID */
-    err = nc_put_varm(ncid,BAD_VARID,NULL,NULL,NULL,NULL,NULL);
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s",nc_err_code_name(err));
-    ELSE_NOK
-
-    for (i = 0; i < numVars; i++) {
-        assert(var_rank[i] <= MAX_RANK);
-        assert(var_nels[i] <= MAX_NELS);
-
-        buf[0] = 5;  /* reset to a value within bounds */
-
-        /* check if can detect a bad file ID */
-        err = nc_put_varm(BAD_ID,i,NULL,NULL,NULL,NULL,buf);
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s",nc_err_code_name(err));
-        ELSE_NOK
-
-        
-
-        for (j = 0; j < var_rank[i]; j++) {
-            start[j] = 0;
-            edge[j] = 1;
-            stride[j] = 1;
-            imap[j] = 1;
-        }
-
-
-        /* first test when edge[*] > 0 */
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == 0) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-            edge[j] = var_shape[i][j] + 1;  /* edge error check */
-            err = nc_put_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_EEDGE)
-                error("expecting NC_EEDG but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            edge[j] = 1;
-            stride[j] = 0;  /* strided edge error check */
-            err = nc_put_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_ESTRIDE)
-                error("expecting NC_ESTRIDE but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            stride[j] = 1;
-        }
-        /* Check correct error returned even when nothing to put */
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 0;
-
-        for (j = 0; j < var_rank[i]; j++) {
-            if (var_dimid[i][j] == 0) continue; /* skip record dim */
-            start[j] = var_shape[i][j];
-            err = nc_put_varm(ncid,i,start,edge,stride,imap,buf);
-#ifdef RELAX_COORD_BOUND
-            IF (err != NC_NOERR) /* allowed when edge[j]==0 */
-                error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-#else
-            IF (err != NC_EINVALCOORDS) /* not allowed even when edge[j]==0 */
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-#endif
-            ELSE_NOK
-            start[j] = var_shape[i][j]+1; /* out of boundary check */
-            err = nc_put_varm(ncid,i,start,edge,stride,imap,buf);
-            IF (err != NC_EINVALCOORDS)
-                error("expecting NC_EINVALCOORDS but got %s",nc_err_code_name(err));
-            ELSE_NOK
-            start[j] = 0;
-        }
-        for (j = 0; j < var_rank[i]; j++) edge[j] = 1;
-
-        if (var_rank[i] > 0) {
-            int jj = var_rank[i] - 1;
-            imap[jj] = nctypelen(var_type[i]); /*  netCDF considers imap in bytes */
-            imap[jj] = 1;                      /* PnetCDF considers imap in elements */
-            for (; jj > 0; jj--)
-                imap[jj-1] = imap[jj] * (ptrdiff_t)var_shape[i][jj];
-        }
-        p = (char *) buf;
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            value = hash(var_type[i], var_rank[i], index);
-            if (!inRange(value, var_type[i]))
-                value = 0;
-            err = dbl2nc(value, var_type[i], p);
-            IF (err != NC_NOERR)
-                error("error in dbl2nc");
-            p += nctypelen(var_type[i]);
-        }
-
-        /* 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] = edge[j] > 0 ? 1+roll(edge[j]) : 1;
-                stride[j] = (ptrdiff_t)sstride[j];
-                imap2[j] = imap[j] * (ptrdiff_t)sstride[j];
-                nstarts *= stride[j];
-            }
-            for (m = 0; m < nstarts; m++) {
-                if (var_rank[i] == 0 && i%2 == 0) {
-                    err = nc_put_varm(ncid,i,NULL,NULL,NULL,NULL,buf);
-                } else {
-                    err = toMixedBase(m, var_rank[i], sstride, index);
-                    IF (err != 0) error("error in toMixedBase");
-                    for (j = 0; j < var_rank[i]; j++) {
-                        count[j] = 1 + (edge[j] - index[j] - 1) / (size_t)stride[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) * (size_t)stride[j];
-                            stride[j] = -stride[j];
-                        }
-                    }
- */
-                    j = fromMixedBase(var_rank[i], index, var_shape[i]);
-                    p = (char *) buf + (int)j * nctypelen(var_type[i]);
-                    
-                    err = nc_put_varm(ncid,i,index,count,stride,imap2,p);
-                }
-                IF (err != NC_NOERR)
-                    error("expecting NC_NOERR but got %s",nc_err_code_name(err));
-                ELSE_NOK
-            }
-        }
-    }
-
-    check_vars(ncid);
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_rename_var
- *    try with bad netCDF handle, check error
- *    try with bad variable handle, check error
- *    try renaming to existing variable name, check error
- *    check that proper rename worked with nc_inq_varid
- *    try in data mode, check error
- */
-int
-test_nc_rename_var(void)
-{
-    int ncid;
-    int varid;
-    int err, nok=0;
-    int i;
-    char name[NC_MAX_NAME];
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_rename_var(ncid, BAD_VARID, "newName");
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* Prefix "new_" to each name */
-    for (i = 0; i < numVars; i++) {
-        err = nc_rename_var(BAD_ID, i, "newName");
-        IF (err != NC_EBADID)
-            error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err = nc_rename_var(ncid, i, var_name[numVars-1]);
-        IF (err != NC_ENAMEINUSE)
-            error("expecting NC_ENAMEINUSE but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        strcpy(name, "new_");
-        strcat(name, var_name[i]);
-        err = nc_rename_var(ncid, i, name);
-        IF (err != NC_NOERR)
-            error("rename_var: %s", nc_strerror(err));
-        ELSE_NOK
-        err = nc_inq_varid(ncid, name, &varid);
-        IF (err != NC_NOERR)
-            error("inq_varid: %s", nc_strerror(err));
-        IF (varid != i)
-            error("Unexpected varid");
-    }
-
-    /* Change to data mode */
-    /* Try making names even longer. Then restore original names */
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        strcpy(name, "even_longer_");
-        strcat(name, var_name[i]);
-        err = nc_rename_var(ncid, i, name);
-        IF (err != NC_ENOTINDEFINE)
-            error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-        ELSE_NOK
-        err = nc_rename_var(ncid, i, var_name[i]);
-        IF (err != NC_NOERR)
-            error("rename_var: %s", nc_strerror(err));
-        ELSE_NOK
-        err = nc_inq_varid(ncid, var_name[i], &varid);
-        IF (err != NC_NOERR)
-            error("inq_varid: %s", nc_strerror(err));
-        IF (varid != i)
-            error("Unexpected varid");
-    }
-
-    put_vars(ncid);
-    check_vars(ncid);
-
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-int
-test_nc_put_att(void)
-{
-    int ncid, nok=0;
-    int varid;
-    int i;
-    int j;
-    size_t k, ndx[1];
-    int err;
-    double buf[MAX_NELS];       /* (void *) buffer */
-    char *p;                    /* (void *) pointer */
-    char *name;                 /* of att */
-    nc_type datatype;           /* of att */
-    size_t length;             /* of att */
-    double value;
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    def_vars(ncid);
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        for (j = 0; j < NATTS(i); j++) {
-            name = ATT_NAME(i,j);
-            datatype = ATT_TYPE(i,j);
-            length = ATT_LEN(i,j);
-            err = nc_put_att(BAD_ID, varid, name, datatype, length, buf);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_put_att(ncid, varid, BAD_NAME, datatype, length, buf);
-            IF (err != NC_EBADNAME)
-                error("expecting NC_EBADNAME but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_put_att(ncid, BAD_VARID, name, datatype, length, buf);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_put_att(ncid, varid, name, BAD_TYPE, length, buf);
-            IF (err != NC_EBADTYPE)
-                error("expecting NC_EBADTYPE but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            p = (char *) buf;
-            for (k=0; k<length; k++) {
-                ndx[0] = k;
-                value = hash(datatype, -1, ndx);
-                if (!inRange(value, datatype))
-                    value = 0;
-                err = dbl2nc(value, datatype, p);
-                IF (err != NC_NOERR)
-                    error("error in dbl2nc");
-                p += nctypelen(datatype);
-            }
-            err = nc_put_att(ncid, varid, name, datatype, length, buf);
-            IF (err != NC_NOERR)
-                error("%s", nc_strerror(err));
-            ELSE_NOK
-        }
-    }
-
-    check_atts(ncid);
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_copy_att
- *    try with bad source or target netCDF handles, check error
- *    try with bad source or target variable handle, check error
- *    try with nonexisting attribute, check error
- *    check that NC_GLOBAL variable for source or target works
- *    check that new attribute put works with target in define mode
- *    check that old attribute put works with target in data mode
- *    check that changing type and length of an attribute work OK
- *    try with same ncid for source and target, different variables
- *    try with same ncid for source and target, same variable
- */
-int
-test_nc_copy_att(void)
-{
-    int ncid_in;
-    int ncid_out;
-    int varid;
-    int err, nok=0;
-    int i;
-    int j=0;
-    char *name;                 /* of att */
-    nc_type datatype;           /* of att */
-    size_t length;             /* of att */
-    char  value;
-
-    err = file_open(testfile, NC_NOWRITE, &ncid_in);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    err = file_create(scratch, NC_NOCLOBBER, &ncid_out);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid_out);
-    def_vars(ncid_out);
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        for (j = 0; j < NATTS(i); j++) {
-            name = ATT_NAME(i,j);
-            err = nc_copy_att(ncid_in, BAD_VARID, name, ncid_out, varid);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_copy_att(ncid_in, varid, name, ncid_out, BAD_VARID);
-            IF (err != NC_ENOTVAR)
-                error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_copy_att(BAD_ID, varid, name, ncid_out, varid);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_copy_att(ncid_in, varid, name, BAD_ID, varid);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_copy_att(ncid_in, varid, "noSuch", ncid_out, varid);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_copy_att(ncid_in, varid, name, ncid_out, varid);
-            IF (err != NC_NOERR)
-                error("copy_att: %s", nc_strerror(err));
-            ELSE_NOK
-            err = nc_copy_att(ncid_out, varid, name, ncid_out, varid);
-            IF (err != NC_NOERR)
-                error("source = target: %s", nc_strerror(err));
-            ELSE_NOK
-        }
-    }
-
-    err = nc_close(ncid_in);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    /* Close scratch. Reopen & check attributes */
-    err = nc_close(ncid_out);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = file_open(scratch, NC_WRITE, &ncid_out);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    check_atts(ncid_out);
-
-   /*
-    * change to define mode
-    * define single char. global att. ':a' with value 'A'
-    * This will be used as source for following copies
-    */
-    err = nc_redef(ncid_out);
-    IF (err != NC_NOERR)
-        error("redef: %s", nc_strerror(err));
-    err = nc_put_att_text(ncid_out, NC_GLOBAL, "a", 1, "A");
-    IF (err != NC_NOERR)
-        error("put_att_text: %s", nc_strerror(err));
-
-   /*
-    * change to data mode
-    * Use scratch as both source & dest.
-    * try copy to existing att. change type & decrease length
-    * rename 1st existing att of each var (if any) 'a'
-    * if this att. exists them copy ':a' to it
-    */
-    err = nc_enddef(ncid_out);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        if (NATTS(i) > 0 && ATT_LEN(i,j) > 0) {
-            err = nc_rename_att(ncid_out, i, att_name[i][0], "a");
-            IF (err != NC_NOERR)
-                error("rename_att: %s", nc_strerror(err));
-            err = nc_copy_att(ncid_out, NC_GLOBAL, "a", ncid_out, i);
-            IF (err != NC_NOERR)
-                error("copy_att: %s", nc_strerror(err));
-            ELSE_NOK
-        }
-    }
-    err = nc_close(ncid_out);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    /* Reopen & check */
-    err = file_open(scratch, NC_WRITE, &ncid_out);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    for (i = 0; i < numVars; i++) {
-        if (NATTS(i) > 0 && ATT_LEN(i,j) > 0) {
-            err = nc_inq_att(ncid_out, i, "a", &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s", nc_strerror(err));
-            IF (datatype != NC_CHAR)
-                error("Unexpected type");
-            IF (length != 1)
-                error("Unexpected length");
-            err = nc_get_att_text(ncid_out, i, "a", &value);
-            IF (err != NC_NOERR)
-                error("get_att_text: %s", nc_strerror(err));
-            IF (value != 'A')
-                error("Unexpected value");
-        }
-    }
-
-    err = nc_close(ncid_out);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_rename_att
- *    try with bad netCDF handle, check error
- *    try with bad variable handle, check error
- *    try with nonexisting att name, check error
- *    try renaming to existing att name, check error
- *    check that proper rename worked with nc_inq_attid
- *    try in data mode, check error
- */
-int
-test_nc_rename_att(void)
-{
-    int ncid;
-    int varid;
-    int err;
-    int i;
-    int j;
-    size_t k, ndx[1];
-    int attnum;
-    char *attname;
-    char name[NC_MAX_NAME];
-    char oldname[NC_MAX_NAME];
-    char newname[NC_MAX_NAME];
-    int nok = 0;      /* count of valid comparisons */
-    nc_type datatype;
-    nc_type atttype;
-    size_t length;
-    size_t attlength;
-    char  text[MAX_NELS];
-    double value[MAX_NELS];
-    double expect;
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_rename_att(ncid, BAD_VARID, "abc", "newName");
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    def_dims(ncid);
-    def_vars(ncid);
-    put_atts(ncid);
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        for (j = 0; j < NATTS(i); j++) {
-            attname = ATT_NAME(i,j);
-            err = nc_rename_att(BAD_ID, varid, attname, "newName");
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_rename_att(ncid, varid, "noSuch", "newName");
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            strcpy(newname, "new_");
-            strcat(newname, attname);
-            err = nc_rename_att(ncid, varid, attname, newname);
-            IF (err != NC_NOERR)
-                error("rename_att: %s", nc_strerror(err));
-            ELSE_NOK
-            err = nc_inq_attid(ncid, varid, newname, &attnum);
-            IF (err != NC_NOERR)
-                error("inq_attid: %s", nc_strerror(err));
-            IF (attnum != j)
-                error("Unexpected attnum");
-        }
-    }
-
-    /* Close. Reopen & check */
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = file_open(scratch, NC_WRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        for (j = 0; j < NATTS(i); j++) {
-            attname = ATT_NAME(i,j);
-            atttype = ATT_TYPE(i,j);
-            attlength = ATT_LEN(i,j);
-            strcpy(newname, "new_");
-            strcat(newname, attname);
-            err = nc_inq_attname(ncid, varid, j, name);
-            IF (err != NC_NOERR)
-                error("inq_attname: %s", nc_strerror(err));
-            IF (strcmp(name, newname) != 0)
-                error("inq_attname: unexpected name");
-            err = nc_inq_att(ncid, varid, name, &datatype, &length);
-            IF (err != NC_NOERR)
-                error("inq_att: %s", nc_strerror(err));
-            IF (datatype != atttype)
-                error("inq_att: unexpected type");
-            IF (length != attlength)
-                error("inq_att: unexpected length");
-            if (datatype == NC_CHAR) {
-                err = nc_get_att_text(ncid, varid, name, text);
-                IF (err != NC_NOERR)
-                    error("get_att_text: %s", nc_strerror(err));
-                for (k = 0; k < attlength; k++) {
-                    ndx[0] = k;
-                    expect = hash(datatype, -1, ndx);
-                    IF (text[k] != (char)expect)
-                        error("get_att_text: unexpected value");
-                }
-            } else {
-                err = nc_get_att_double(ncid, varid, name, value);
-                IF (err != NC_NOERR)
-                    error("get_att_double: %s", nc_strerror(err));
-                for (k = 0; k < attlength; k++) {
-                    ndx[0] = k;
-                    expect = hash(datatype, -1, ndx);
-                    if (inRange(expect, datatype)) {
-                        IF (!equal(value[k],expect,datatype,NCT_DOUBLE))
-                            error("get_att_double: unexpected value");
-                    }
-                }
-            }
-        }
-    }
-
-    /* Now in data mode */
-    /* Try making names even longer. Then restore original names */
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        for (j = 0; j < NATTS(i); j++) {
-            attname = ATT_NAME(i,j);
-            strcpy(oldname, "new_");
-            strcat(oldname, attname);
-            strcpy(newname, "even_longer_");
-            strcat(newname, attname);
-            err = nc_rename_att(ncid, varid, oldname, newname);
-            IF (err != NC_ENOTINDEFINE)
-                error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_rename_att(ncid, varid, oldname, attname);
-            IF (err != NC_NOERR)
-                error("rename_att: %s", nc_strerror(err));
-            ELSE_NOK
-            err = nc_inq_attid(ncid, varid, attname, &attnum);
-            IF (err != NC_NOERR)
-                error("inq_attid: %s", nc_strerror(err));
-            IF (attnum != j)
-                error("Unexpected attnum");
-        }
-    }
-
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_del_att
- *    try with bad netCDF handle, check error
- *    try with bad variable handle, check error
- *    try with nonexisting att name, check error
- *    check that proper delete worked using:
- *      nc_inq_attid, nc_inq_natts, nc_inq_varnatts
- */
-int
-test_nc_del_att(void)
-{
-    int ncid;
-    int err, nok=0;
-    int i;
-    int j;
-    int attnum;
-    int natts;
-    int numatts;
-    int varid;
-    char *name;                 /* of att */
-
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    err = nc_del_att(ncid, BAD_VARID, "abc");
-    IF (err != NC_ENOTVAR)
-        error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
-    ELSE_NOK
-    def_dims(ncid);
-    def_vars(ncid);
-    put_atts(ncid);
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        numatts = NATTS(i);
-        for (j = 0; j < numatts; j++) {
-            name = ATT_NAME(i,j);
-            err = nc_del_att(BAD_ID, varid, name);
-            IF (err != NC_EBADID)
-                error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_del_att(ncid, varid, "noSuch");
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-            ELSE_NOK
-            err = nc_del_att(ncid, varid, name);
-            IF (err != NC_NOERR)
-                error("del_att: %s", nc_strerror(err));
-            ELSE_NOK
-            err = nc_inq_attid(ncid, varid, name, &attnum);
-            IF (err != NC_ENOTATT)
-                error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
-            if (i < 0) {
-                err = nc_inq_natts(ncid, &natts);
-                IF (err != NC_NOERR)
-                    error("inq_natts: %s", nc_strerror(err));
-                IF (natts != numatts-j-1)
-                    error("natts: expected %d, got %d", numatts-j-1, natts);
-            }
-            err = nc_inq_varnatts(ncid, varid, &natts);
-            IF (err != NC_NOERR)
-                error("inq_natts: %s", nc_strerror(err));
-            IF (natts != numatts-j-1)
-                error("natts: expected %d, got %d", numatts-j-1, natts);
-        }
-    }
-
-    /* Close. Reopen & check no attributes left */
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = file_open(scratch, NC_WRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    err = nc_inq_natts(ncid, &natts);
-    IF (err != NC_NOERR)
-        error("inq_natts: %s", nc_strerror(err));
-    IF (natts != 0)
-        error("natts: expected %d, got %d", 0, natts);
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        err = nc_inq_varnatts(ncid, varid, &natts);
-        IF (err != NC_NOERR)
-            error("inq_natts: %s", nc_strerror(err));
-        IF (natts != 0)
-            error("natts: expected %d, got %d", 0, natts);
-    }
-
-    /* restore attributes. change to data mode. try to delete */
-    err = nc_redef(ncid);
-    IF (err != NC_NOERR)
-        error("redef: %s", nc_strerror(err));
-    put_atts(ncid);
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-
-    for (i = -1; i < numVars; i++) {
-        varid = VARID(i);
-        numatts = NATTS(i);
-        for (j = 0; j < numatts; j++) {
-            name = ATT_NAME(i,j);
-            err = nc_del_att(ncid, varid, name);
-            IF (err != NC_ENOTINDEFINE)
-                error("expecting NC_ENOTINDEFINE but got %s", nc_err_code_name(err));
-            ELSE_NOK
-        }
-    }
-
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    return nok;
-}
-
-
-/*
- * Test nc_set_fill
- *    try with bad netCDF handle, check error
- *    try in read-only mode, check error
- *    try with bad new_fillmode, check error
- *    try in data mode, check error
- *    check that proper set to NC_FILL works for record & non-record variables
- *    (note that it is not possible to test NC_NOFILL mode!)
- *    close file & create again for test using attribute _FillValue
- */
-int
-test_nc_set_fill(void)
-{
-    int ncid;
-    int varid;
-    int err;
-    int i;
-    size_t j;
-    int old_fillmode;
-    int nok = 0;      /* count of valid comparisons */
-    char text = 0;
-    double value = 0;
-    double fill;
-    size_t index[MAX_RANK];
-
-    /* bad ncid */
-    err = nc_set_fill(BAD_ID, NC_NOFILL, &old_fillmode);
-    IF (err != NC_EBADID)
-        error("expecting NC_EBADID but got %s", nc_err_code_name(err));
-
-    /* try in read-only mode */
-    err = file_open(testfile, NC_NOWRITE, &ncid);
-    IF (err != NC_NOERR)
-        error("open: %s", nc_strerror(err));
-    err = nc_set_fill(ncid, NC_NOFILL, &old_fillmode);
-    IF (err != NC_EPERM)
-        error("expecting NC_EPERM but got %s", nc_err_code_name(err));
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-
-    /* create scratch */
-    err = file_create(scratch, NC_NOCLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-
-    /* BAD_FILLMODE */
-    err = nc_set_fill(ncid, BAD_FILLMODE, &old_fillmode);
-    IF (err != NC_EINVAL)
-        error("expecting NC_EINVAL but got %s", nc_err_code_name(err));
-
-    /* proper calls */
-    err = nc_set_fill(ncid, NC_NOFILL, &old_fillmode);
-    IF (err != NC_NOERR)
-        error("set_fill: %s", nc_strerror(err));
-    IF (old_fillmode != NC_NOFILL)
-        error("Unexpected old fill mode: %d", old_fillmode);
-    err = nc_set_fill(ncid, NC_FILL, &old_fillmode);
-    IF (err != NC_NOERR)
-        error("set_fill: %s", nc_strerror(err));
-    IF (old_fillmode != NC_NOFILL)
-        error("Unexpected old fill mode: %d", old_fillmode);
-
-    /* define dims & vars */
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* Change to data mode. Set fillmode again */
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    err = nc_set_fill(ncid, NC_FILL, &old_fillmode);
-IF (err)
-        error("nc_set_fill: %s", nc_strerror(err));
-    IF (old_fillmode != NC_FILL)
-        error("Unexpected old fill mode: %d", old_fillmode);
-    /* 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 != NC_NOERR)
-        error("inq_varid: %s", nc_strerror(err));
-    index[0] = NRECS;
-
-
-    err = nc_put_var1_text(ncid, varid, index, &text);
-    IF (err != NC_NOERR)
-        error("put_var1_text_all: %s", nc_strerror(err));
-
-    /* get all variables & check all values equal default fill */
-    for (i = 0; i < numVars; i++) {
-        
-        switch (var_type[i]) {
-            case NC_CHAR:   fill = (double)NC_FILL_CHAR;   break;
-            case NC_BYTE:   fill = (double)NC_FILL_BYTE;   break;
-            case NC_SHORT:  fill = (double)NC_FILL_SHORT;  break;
-            case NC_INT:    fill = (double)NC_FILL_INT;    break;
-            case NC_FLOAT:  fill = (double)NC_FILL_FLOAT;  break;
-            case NC_DOUBLE: fill = (double)NC_FILL_DOUBLE; break;
-            case NC_UBYTE:  fill = (double)NC_FILL_UBYTE;  break;
-            case NC_USHORT: fill = (double)NC_FILL_USHORT; break;
-            case NC_UINT:   fill = (double)NC_FILL_UINT;   break;
-            case NC_INT64:  fill = (double)NC_FILL_INT64;  break;
-            case NC_UINT64: fill = (double)NC_FILL_UINT64; break;
-            default: assert(0);
-        }
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            if (var_type[i] == NC_CHAR) {
-                err = nc_get_var1_text(ncid, i, index, &text);
-                IF (err != NC_NOERR)
-                    error("get_var1_text_all failed: %s", nc_strerror(err));
-                value = text;
-            } else {
-                err = nc_get_var1_double(ncid, i, index, &value);
-                IF (err != NC_NOERR)
-                    error("get_var1_double_all failed: %s", nc_strerror(err));
-            }
-            IF (value != fill && fabs((fill - value)/fill) > DBL_EPSILON)
-                error("\n\t\t%s Value expected: %-23.17e,\n\t\t          read: %-23.17e\n",
-                        var_name[i],fill, value);
-            ELSE_NOK
-        }
-    }
-
-    /* close scratch & create again for test using attribute _FillValue */
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR) {
-        error("create: %s", nc_strerror(err));
-        return nok;
-    }
-    def_dims(ncid);
-    def_vars(ncid);
-
-    /* set _FillValue = 42 for all vars */
-    fill = 42;
-    text = 42;
-    for (i = 0; i < numVars; i++) {
-        if (var_type[i] == NC_CHAR) {
-            err = nc_put_att_text(ncid, i, "_FillValue", 1, &text);
-            IF (err != NC_NOERR)
-                error("put_att_text: %s", nc_strerror(err));
-        } else {
-            err = nc_put_att_double(ncid, i, "_FillValue",var_type[i],1,&fill);
-            IF (err != NC_NOERR)
-                error("put_att_double: %s", nc_strerror(err));
-        }
-    }
-
-    /* data mode. write records */
-    err = nc_enddef(ncid);
-    IF (err != NC_NOERR)
-        error("enddef: %s", nc_strerror(err));
-    index[0] = NRECS;
-
-
-    err = nc_put_var1_text(ncid, varid, index, &text);
-    IF (err != NC_NOERR)
-        error("put_var1_text_all: %s", nc_strerror(err));
-
-    /* get all variables & check all values equal 42 */
-    for (i = 0; i < numVars; i++) {
-        if (var_dimid[i][0] == RECDIM) continue; /* skip record variables */
-        for (j = 0; j < var_nels[i]; j++) {
-            err = toMixedBase(j, var_rank[i], var_shape[i], index);
-            IF (err != 0) error("error in toMixedBase");
-            if (var_type[i] == NC_CHAR) {
-                err = nc_get_var1_text(ncid, i, index, &text);
-                IF (err != NC_NOERR)
-                    error("get_var1_text_all failed: %s", nc_strerror(err));
-                value = text;
-            } else {
-                err = nc_get_var1_double(ncid, i, index, &value);
-                IF (err != NC_NOERR)
-                    error("get_var1_double_all failed: %s", nc_strerror(err));
-            }
-            IF (value != fill)
-                error(" %s Value expected: %g, read: %g\n", var_name[i],fill, value);
-            ELSE_NOK
-        }
-    }
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-
-    return nok;
-}
-
-
-/* This function gets the version of a netCDF file, 1 is for netCDF
-   classic, 2 for 64-bit offset format, (someday) 3 for HDF5 format,
-   5 for 64-bit data format (CDF-5).
-*/
-#define MAGIC_NUM_LEN 4
-static
-int
-nc_get_file_version(char *path, int *version)
-{
-   int fd;
-   ssize_t read_len;
-   char magic[MAGIC_NUM_LEN];
-
-   /* Need two valid pointers - check for NULL. */
-   if (!version || !path)
-      return NC_EINVAL;
-
-   /* Figure out if this is a netcdf or hdf5 file. */
-   fd = open(path, O_RDONLY, 0600);
-   if (fd == -1) return errno;
-
-   read_len = read(fd, magic, MAGIC_NUM_LEN);
-   if (-1 == close(fd)) return errno;
-
-   if (read_len == -1)
-       return errno;
-
-   if (read_len != MAGIC_NUM_LEN) {
-       printf("Error: reading NC magic string unexpected short read\n");
-       return 0;
-   }
-
-   if (strncmp(magic, "CDF", MAGIC_NUM_LEN-1)==0) {
-      if (magic[MAGIC_NUM_LEN-1] == NC_FORMAT_CLASSIC ||
-          magic[MAGIC_NUM_LEN-1] == NC_FORMAT_64BIT_OFFSET ||
-          magic[MAGIC_NUM_LEN-1] == NC_FORMAT_CDF5)
-         *version = magic[MAGIC_NUM_LEN-1];
-      else
-        return NC_ENOTNC;
-   }
-   /*   tomorrow, tomorrow, I love you tomorrow, you're always a day
-       away! */
-   /*if (magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F')
-      *version = 3;*/
-   return NC_NOERR;
-}
-
-/*
- * Test nc_set_default_format
- *    try with bad default format
- *    try with NULL old_formatp
- *    try in data mode, check error
- *    check that proper set to NC_FILL works for record & non-record variables
- *    (note that it is not possible to test NC_NOFILL mode!)
- *    close file & create again for test using attribute _FillValue
- */
-int
-test_nc_set_default_format(void)
-{
-    int ncid, nok=0;
-    int err;
-    int i;
-    int version=1;
-    int old_format;
-
-    /* bad format */
-    err = nc_set_default_format(BAD_DEFAULT_FORMAT, &old_format);
-    IF (err != NC_EINVAL)
-        error("expecting NC_EINVAL but got %s", nc_err_code_name(err));
-    ELSE_NOK
-
-    /* NULL old_formatp */
-    err = nc_set_default_format(NC_FORMAT_64BIT_OFFSET, NULL);
-    IF (err != NC_NOERR)
-       error("null old_fortmatp: status = %d", err);
-    ELSE_NOK
-
-    /* Cycle through available formats. */
-    for(i=NC_FORMAT_CLASSIC; i<NC_FORMAT_64BIT_DATA; i++)
-    {
-       if (i == NC_FORMAT_NETCDF4 || i == NC_FORMAT_NETCDF4_CLASSIC)
-           continue; /* test classic formats only */
-       if ((err = nc_set_default_format(i, NULL)))
-           error("setting classic format: status = %d", err);
-       ELSE_NOK
-       err = file_create(scratch, NC_CLOBBER, &ncid);
-       if (err != NC_NOERR)
-           error("bad nc_create: status = %d", err);
-       err = nc_put_att_text(ncid, NC_GLOBAL, "testatt", sizeof("blah"), "blah");
-       if (err != NC_NOERR)
-           error("bad put_att: status = %d", err);
-       err = nc_close(ncid);
-       if (err != NC_NOERR)
-           error("bad close: status = %d", err);
-       err = nc_get_file_version(scratch, &version);
-       if (err != NC_NOERR)
-           error("bad file version = %d", err);
-       if (version != i) {
-#if 0
-          if (i == 4) {
-              if (version == 3) continue;
-              printf("expect version 3 but got %d (file=%s)",version,scratch);
-              continue;
-          }
-#endif
-          printf("expect version %d but got %d (file=%s)",i,version,scratch);
-          error("bad file version = %d", version);
-        }
-    }
-
-    /* Remove the left-over file. */
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-
-    return nok;
-}
-
-
-
-
-/*
- * Test nc_delete()
- *         create netcdf file 'scratch.nc' with no data, close it
- *         delete the file
- */
-int
-test_nc_delete(void)
-{
-    int err, nok=0;;
-    int ncid;
-
-    err = file_create(scratch, NC_CLOBBER, &ncid);
-    IF (err != NC_NOERR)
-        error("error creating scratch file %s, status = %d\n", scratch,err);
-    err = nc_close(ncid);
-    IF (err != NC_NOERR)
-        error("close: %s", nc_strerror(err));
-    err = nc_delete(scratch);
-    IF (err != NC_NOERR)
-        error("remove of %s failed", scratch);
-    ELSE_NOK
-    return nok;
-}
diff --git a/nc_test/tst_utf8_phrases.c b/nc_test/tst_utf8_phrases.c
index 3a4ef67..7a9478f 100644
--- a/nc_test/tst_utf8_phrases.c
+++ b/nc_test/tst_utf8_phrases.c
@@ -269,7 +269,7 @@ trim(const char* s)
     int i;
     size_t l = strlen(s);
     char* t = strdup(s);
-    for(i=l-1;l >= 0; i--) {
+    for(i=l-1;i >= 0; i--) {
         if(t[i] != ' ') break;
     }
     t[i+1] = '\0';
diff --git a/nc_test/tst_utf8_validate.c b/nc_test/tst_utf8_validate.c
index ccb9641..c7b53b1 100644
Binary files a/nc_test/tst_utf8_validate.c and b/nc_test/tst_utf8_validate.c differ
diff --git a/nc_test4/Makefile.in b/nc_test4/Makefile.in
index 0245568..3061379 100644
--- a/nc_test4/Makefile.in
+++ b/nc_test4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/ncdap_test/CMakeLists.txt b/ncdap_test/CMakeLists.txt
index 4b4a70d..d548b68 100644
--- a/ncdap_test/CMakeLists.txt
+++ b/ncdap_test/CMakeLists.txt
@@ -28,6 +28,7 @@ IF(ENABLE_TESTS)
     BUILD_BIN_TEST(findtestserver)
 
     IF(BUILD_UTILITIES)
+      add_sh_test(ncdap tst_ber)
       add_sh_test(ncdap tst_remote3)
 # not yet      add_sh_test(ncdap tst_hyrax)
     ENDIF(BUILD_UTILITIES)
diff --git a/ncdap_test/Makefile.am b/ncdap_test/Makefile.am
index 875a186..0338733 100644
--- a/ncdap_test/Makefile.am
+++ b/ncdap_test/Makefile.am
@@ -8,6 +8,9 @@
 # Put together AM_CPPFLAGS and AM_LDFLAGS.
 include $(top_srcdir)/lib_flags.am
 
+#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+
 LDADD = ${top_builddir}/liblib/libnetcdf.la
 AM_CPPFLAGS += -I$(top_srcdir)/liblib
 AM_CPPFLAGS += -DTOPSRCDIR=${abs_top_srcdir}
@@ -34,7 +37,7 @@ check_PROGRAMS += findtestserver
 findtestserver_SOURCES = findtestserver.c
 
 if BUILD_UTILITIES
-TESTS += tst_remote3.sh tst_formatx.sh
+TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh
 endif
 
 TESTS += test_partvar testurl.sh
@@ -79,7 +82,7 @@ EXTRA_DIST = tst_ncdap3.sh  \
              tst_longremote3.sh \
              tst_ncdap.sh tst_ncdap_shared.sh tst_remote.sh \
 	     t_dap.c CMakeLists.txt tst_formatx.sh testauth.sh testurl.sh \
-			t_ncf330.c
+	     t_ncf330.c tst_ber.sh
 
 CLEANFILES = test_varm3 test_cvt3 results/*.dmp results/*.das results/*.dds datadds* t_dap3a test_nstride_cached *.exe
 
@@ -89,9 +92,6 @@ t_dap3a.c: t_dap.c
 	echo "#define NETCDF3ONLY" > ./t_dap3a.c
 	cat t_dap.c >> t_dap3a.c
 
-t_dap4a.c: t_dap.c
-	cat t_dap.c >> ./t_dap4a.c
-
 # One last thing
 BUILT_SOURCES = .dodsrc
 
diff --git a/ncdap_test/Makefile.in b/ncdap_test/Makefile.in
index 0226fc8..cad91ee 100644
--- a/ncdap_test/Makefile.in
+++ b/ncdap_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -122,7 +122,7 @@ TESTS = $(am__EXEEXT_3) $(am__append_6) $(am__EXEEXT_4) \
 @ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE@	t_misc \
 @ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE@	test_varm3 \
 @ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE@	t_ncf330
- at BUILD_UTILITIES_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE at am__append_6 = tst_remote3.sh tst_formatx.sh
+ at BUILD_UTILITIES_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE at am__append_6 = tst_ber.sh tst_remote3.sh tst_formatx.sh
 @ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE at am__append_7 = test_partvar testurl.sh
 @ENABLE_DAP_LONG_TESTS_TRUE@@ENABLE_DAP_REMOTE_TESTS_TRUE@@ENABLE_DAP_TRUE at am__append_8 = tst_longremote3.sh
 #TESTS += t_ncf330
@@ -704,6 +704,9 @@ top_srcdir = @top_srcdir@
 AM_TESTS_ENVIRONMENT = export DTOPSRCDIR=${abs_top_srcdir}; export DTOPBUILDDIR=${abs_top_builddir}; 
 
 # Put together AM_CPPFLAGS and AM_LDFLAGS.
+
+#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
 LDADD = ${top_builddir}/liblib/libnetcdf.la
 t_dap3a_SOURCES = t_dap3a.c t_srcdir.h
 test_cvt3_SOURCES = test_cvt.c t_srcdir.h
@@ -723,7 +726,7 @@ EXTRA_DIST = tst_ncdap3.sh  \
              tst_longremote3.sh \
              tst_ncdap.sh tst_ncdap_shared.sh tst_remote.sh \
 	     t_dap.c CMakeLists.txt tst_formatx.sh testauth.sh testurl.sh \
-			t_ncf330.c
+	     t_ncf330.c tst_ber.sh
 
 CLEANFILES = test_varm3 test_cvt3 results/*.dmp results/*.das results/*.dds datadds* t_dap3a test_nstride_cached *.exe
 
@@ -1124,6 +1127,13 @@ tst_ncdap3.sh.log: tst_ncdap3.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)
+tst_ber.sh.log: tst_ber.sh
+	@p='tst_ber.sh'; \
+	b='tst_ber.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_remote3.sh.log: tst_remote3.sh
 	@p='tst_remote3.sh'; \
 	b='tst_remote3.sh'; \
@@ -1399,9 +1409,6 @@ t_dap3a.c: t_dap.c
 	echo "#define NETCDF3ONLY" > ./t_dap3a.c
 	cat t_dap.c >> t_dap3a.c
 
-t_dap4a.c: t_dap.c
-	cat t_dap.c >> ./t_dap4a.c
-
 .dodsrc:
 	echo "#DODSRC" >.dodsrc
 
diff --git a/ncdap_test/expected3/123.nc.dmp b/ncdap_test/expected3/123.nc.dmp
index 84ba36a..448818a 100644
--- a/ncdap_test/expected3/123.nc.dmp
+++ b/ncdap_test/expected3/123.nc.dmp
@@ -7,8 +7,7 @@ dimensions:
 variables:
 	short l(l) ;
 	char bears(i, j, maxStrlen64) ;
-		bears:act = "text string\n",
-			"\t123" ;
+		bears:act = "text string\\012\\011123" ;
 		bears:acs = -40s ;
 		bears:acl = 17000 ;
 		bears:acf = -2.f, 1.f, 0.f ;
@@ -20,9 +19,7 @@ variables:
 	double cross(i, j) ;
 
 // global attributes:
-		:history = "This is an example of a multi-line global\n",
-			"attribute.  It could be used for representing the\n",
-			"processing history of the data, for example." ;
+		:history = "This is an example of a multi-line global\\012attribute.  It could be used for representing the\\012processing history of the data, for example." ;
 		:DODS_EXTRA.Unlimited_Dimension = "k" ;
 data:
 
diff --git a/ncdap_test/expected3/123bears.nc.dmp b/ncdap_test/expected3/123bears.nc.dmp
index 9379de3..4611b98 100644
--- a/ncdap_test/expected3/123bears.nc.dmp
+++ b/ncdap_test/expected3/123bears.nc.dmp
@@ -7,8 +7,7 @@ dimensions:
 variables:
 	short l(l) ;
 	char bears(i, j, maxStrlen64) ;
-		bears:act = "text string\n",
-			"\t123" ;
+		bears:act = "text string\\012\\011123" ;
 		bears:acs = -40s ;
 		bears:acl = 17000 ;
 		bears:acf = -2.f, 1.f, 0.f ;
@@ -20,9 +19,7 @@ variables:
 	double cross(i, j) ;
 
 // global attributes:
-		:history = "This is an example of a multi-line global\n",
-			"attribute.  It could be used for representing the\n",
-			"processing history of the data, for example." ;
+		:history = "This is an example of a multi-line global\\012attribute.  It could be used for representing the\\012processing history of the data, for example." ;
 		:DODS_EXTRA.Unlimited_Dimension = "k" ;
 data:
 
diff --git a/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp b/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp
index 05e6fc6..5b482df 100644
--- a/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp
+++ b/ncdap_test/expected3/1990-S1700101.HDF.WVC_Lat.dmp
@@ -14,29 +14,284 @@ variables:
 		NSCAT%20Rev%2017.WVC_Lat:valid_range = -6281s, 8051s ;
 
 // global attributes:
-		:Producer_Agency = "NASA" ;
-		:Producer_Institution = "JPL" ;
-		:Sensor_Name = "NSCAT" ;
-		:Project_ID = "NSCAT" ;
-		:SIS_ID = "697-512-23/1994-08-29" ;
-		:Build_ID = "SciSim 3.0" ;
-		:ADEOS_Data_Package_ID = "SIMULATED DATA PRODUCT TEST" ;
-		:ADEOS_Data_Package_Type = "S" ;
-		:Product_Creation_Time = "1995-278T23:30:04.000" ;
-		:Data_Type = "L17" ;
-		:Data_Status = "COMPLETE" ;
+		:Producer_Agency = "NASA\\000" ;
+		:Producer_Institution = "JPL\\000" ;
+		:Sensor_Name = "NSCAT\\000" ;
+		:Project_ID = "NSCAT\\000" ;
+		:SIS_ID = "697-512-23/1994-08-29\\000" ;
+		:Build_ID = "SciSim 3.0\\000" ;
+		:ADEOS_Data_Package_ID = "SIMULATED DATA PRODUCT TEST\\000" ;
+		:ADEOS_Data_Package_Type = "S\\000" ;
+		:Product_Creation_Time = "1995-278T23:30:04.000\\000" ;
+		:Data_Type = "L17\\000" ;
+		:Data_Status = "COMPLETE\\000" ;
 		:First_Rev_Number = 101 ;
-		:First_Rev_Eq_Crossing_Time = "1996-215T01:31:07.223" ;
+		:First_Rev_Eq_Crossing_Time = "1996-215T01:31:07.223\\000" ;
 		:First_Rev_Eq_Crossing_Lon = 54.952f ;
-		:First_Data_Time = "1996-215T01:13:28.456" ;
-		:Last_Data_Time = "1996-215T02:40:22.631" ;
+		:First_Data_Time = "1996-215T01:13:28.456\\000" ;
+		:Last_Data_Time = "1996-215T02:40:22.631\\000" ;
 		:Num_Expected_Output_Records = 558 ;
 		:Num_Actual_Output_Records = 558 ;
-		:HDF_Build_ID = "JPL D-xxxxx 12/15/94" ;
-		:HDF_SIS_ID = "JPL D-12059 12/15/94" ;
-		:HDF_Conversion_Organization = "JPL PO.DAAC" ;
+		:HDF_Build_ID = "JPL D-xxxxx 12/15/94\\000" ;
+		:HDF_SIS_ID = "JPL D-12059 12/15/94\\000" ;
+		:HDF_Conversion_Organization = "JPL PO.DAAC\\000" ;
 		:HDF_Conversion_Time = "1996-047T11:13:05       " ;
-		:Data_Format_Type = "HDF" ;
+		:Data_Format_Type = "HDF\\000" ;
+		:WVC_Lat_dim_0.name = "row" ;
+		:WVC_Lat_dim_0.long_name = "WVC row index" ;
+		:WVC_Lat_dim_1.name = "WVC" ;
+		:WVC_Lat_dim_1.long_name = "WVC index within a row" ;
+		:WVC_Lon.long_name = "longitude" ;
+		:WVC_Lon.units = "deg" ;
+		:WVC_Lon.scale_factor = 0.01 ;
+		:WVC_Lon.scale_factor_err = 0. ;
+		:WVC_Lon.add_offset = 0. ;
+		:WVC_Lon.add_offset_err = 0. ;
+		:WVC_Lon.calibrated_nt = 22 ;
+		:WVC_Lon.valid_range = 0s, -29545s ;
+		:WVC_Lon_dim_0.name = "row" ;
+		:WVC_Lon_dim_0.long_name = "WVC row index" ;
+		:WVC_Lon_dim_1.name = "WVC" ;
+		:WVC_Lon_dim_1.long_name = "WVC index within a row" ;
+		:Num_Sigma0.long_name = "The total number of sigma-0 measurements" ;
+		:Num_Sigma0.units = "counts" ;
+		:Num_Sigma0.scale_factor = 1. ;
+		:Num_Sigma0.scale_factor_err = 0. ;
+		:Num_Sigma0.add_offset = 0. ;
+		:Num_Sigma0.add_offset_err = 0. ;
+		:Num_Sigma0.calibrated_nt = 21 ;
+		:Num_Sigma0.valid_range = 0, 21 ;
+		:Num_Sigma0_dim_0.name = "row" ;
+		:Num_Sigma0_dim_0.long_name = "WVC row index" ;
+		:Num_Sigma0_dim_1.name = "WVC" ;
+		:Num_Sigma0_dim_1.long_name = "WVC index within a row" ;
+		:Num_Good_Sigma0.long_name = "The number of good sigma-0 measurements" ;
+		:Num_Good_Sigma0.units = "counts" ;
+		:Num_Good_Sigma0.scale_factor = 1. ;
+		:Num_Good_Sigma0.scale_factor_err = 0. ;
+		:Num_Good_Sigma0.add_offset = 0. ;
+		:Num_Good_Sigma0.add_offset_err = 0. ;
+		:Num_Good_Sigma0.calibrated_nt = 21 ;
+		:Num_Good_Sigma0.valid_range = 0, 21 ;
+		:Num_Good_Sigma0_dim_0.name = "row" ;
+		:Num_Good_Sigma0_dim_0.long_name = "WVC row index" ;
+		:Num_Good_Sigma0_dim_1.name = "WVC" ;
+		:Num_Good_Sigma0_dim_1.long_name = "WVC index within a row" ;
+		:Num_Beam_12.long_name = "The total number of sigma-0s received from beam 1 or 2" ;
+		:Num_Beam_12.units = "counts" ;
+		:Num_Beam_12.scale_factor = 1. ;
+		:Num_Beam_12.scale_factor_err = 0. ;
+		:Num_Beam_12.add_offset = 0. ;
+		:Num_Beam_12.add_offset_err = 0. ;
+		:Num_Beam_12.calibrated_nt = 21 ;
+		:Num_Beam_12.valid_range = 0, 6 ;
+		:Num_Beam_12_dim_0.name = "row" ;
+		:Num_Beam_12_dim_0.long_name = "WVC row index" ;
+		:Num_Beam_12_dim_1.name = "WVC" ;
+		:Num_Beam_12_dim_1.long_name = "WVC index within a row" ;
+		:Num_Beam_34.long_name = "The total number of sigma-0s received from beam 3 or 4" ;
+		:Num_Beam_34.units = "counts" ;
+		:Num_Beam_34.scale_factor = 1. ;
+		:Num_Beam_34.scale_factor_err = 0. ;
+		:Num_Beam_34.add_offset = 0. ;
+		:Num_Beam_34.add_offset_err = 0. ;
+		:Num_Beam_34.calibrated_nt = 21 ;
+		:Num_Beam_34.valid_range = 0, 6 ;
+		:Num_Beam_34_dim_0.name = "row" ;
+		:Num_Beam_34_dim_0.long_name = "WVC row index" ;
+		:Num_Beam_34_dim_1.name = "WVC" ;
+		:Num_Beam_34_dim_1.long_name = "WVC index within a row" ;
+		:Num_Beam_56.long_name = "The total number of sigma-0s received from beam 5 or 6" ;
+		:Num_Beam_56.units = "counts" ;
+		:Num_Beam_56.scale_factor = 1. ;
+		:Num_Beam_56.scale_factor_err = 0. ;
+		:Num_Beam_56.add_offset = 0. ;
+		:Num_Beam_56.add_offset_err = 0. ;
+		:Num_Beam_56.calibrated_nt = 21 ;
+		:Num_Beam_56.valid_range = 0, 6 ;
+		:Num_Beam_56_dim_0.name = "row" ;
+		:Num_Beam_56_dim_0.long_name = "WVC row index" ;
+		:Num_Beam_56_dim_1.name = "WVC" ;
+		:Num_Beam_56_dim_1.long_name = "WVC index within a row" ;
+		:Num_Beam_78.long_name = "The total number of sigma-0s received from beam 7 or 8" ;
+		:Num_Beam_78.units = "counts" ;
+		:Num_Beam_78.scale_factor = 1. ;
+		:Num_Beam_78.scale_factor_err = 0. ;
+		:Num_Beam_78.add_offset = 0. ;
+		:Num_Beam_78.add_offset_err = 0. ;
+		:Num_Beam_78.calibrated_nt = 21 ;
+		:Num_Beam_78.valid_range = 0, 6 ;
+		:Num_Beam_78_dim_0.name = "row" ;
+		:Num_Beam_78_dim_0.long_name = "WVC row index" ;
+		:Num_Beam_78_dim_1.name = "WVC" ;
+		:Num_Beam_78_dim_1.long_name = "WVC index within a row" ;
+		:WVC_Quality_Flag.long_name = "WVC Quality Flag" ;
+		:WVC_Quality_Flag.scale_factor = 1. ;
+		:WVC_Quality_Flag.scale_factor_err = 0. ;
+		:WVC_Quality_Flag.add_offset = 0. ;
+		:WVC_Quality_Flag.add_offset_err = 0. ;
+		:WVC_Quality_Flag.calibrated_nt = 21 ;
+		:WVC_Quality_Flag.valid_range = 0, 3 ;
+		:WVC_Quality_Flag_dim_0.name = "row" ;
+		:WVC_Quality_Flag_dim_0.long_name = "WVC row index" ;
+		:WVC_Quality_Flag_dim_1.name = "WVC" ;
+		:WVC_Quality_Flag_dim_1.long_name = "WVC index within a row" ;
+		:Cen_Lat.long_name = "The center geodetic latitude of a sigma-0 cell" ;
+		:Cen_Lat.units = "deg" ;
+		:Cen_Lat.scale_factor = 0.001 ;
+		:Cen_Lat.scale_factor_err = 0. ;
+		:Cen_Lat.add_offset = 0. ;
+		:Cen_Lat.add_offset_err = 0. ;
+		:Cen_Lat.calibrated_nt = 24 ;
+		:Cen_Lat.valid_range = -62862, 80490 ;
+		:Cen_Lat_dim_0.name = "row" ;
+		:Cen_Lat_dim_0.long_name = "WVC row index" ;
+		:Cen_Lat_dim_1.name = "WVC" ;
+		:Cen_Lat_dim_1.long_name = "WVC index within a row" ;
+		:Cen_Lat_dim_2.name = "Sigma0-Dimension" ;
+		:Cen_Lat_dim_2.long_name = "Sigma0 position index" ;
+		:Cen_Lon.long_name = "The center longitude of a sigma-0 cell" ;
+		:Cen_Lon.units = "deg" ;
+		:Cen_Lon.scale_factor = 0.001 ;
+		:Cen_Lon.scale_factor_err = 0. ;
+		:Cen_Lon.add_offset = 0. ;
+		:Cen_Lon.add_offset_err = 0. ;
+		:Cen_Lon.calibrated_nt = 25 ;
+		:Cen_Lon.valid_range = 0, 359997 ;
+		:Cen_Lon_dim_0.name = "row" ;
+		:Cen_Lon_dim_0.long_name = "WVC row index" ;
+		:Cen_Lon_dim_1.name = "WVC" ;
+		:Cen_Lon_dim_1.long_name = "WVC index within a row" ;
+		:Cen_Lon_dim_2.name = "Sigma0-Dimension" ;
+		:Cen_Lon_dim_2.long_name = "Sigma0 position index" ;
+		:Cell_Azimuth.long_name = "The center longitude of a sigma-0 cell" ;
+		:Cell_Azimuth.units = "deg" ;
+		:Cell_Azimuth.scale_factor = 0.01 ;
+		:Cell_Azimuth.scale_factor_err = 0. ;
+		:Cell_Azimuth.add_offset = 0. ;
+		:Cell_Azimuth.add_offset_err = 0. ;
+		:Cell_Azimuth.calibrated_nt = 23 ;
+		:Cell_Azimuth.valid_range = 0s, -30784s ;
+		:Cell_Azimuth_dim_0.name = "row" ;
+		:Cell_Azimuth_dim_0.long_name = "WVC row index" ;
+		:Cell_Azimuth_dim_1.name = "WVC" ;
+		:Cell_Azimuth_dim_1.long_name = "WVC index within a row" ;
+		:Cell_Azimuth_dim_2.name = "Sigma0-Dimension" ;
+		:Cell_Azimuth_dim_2.long_name = "Sigma0 position index" ;
+		:Incidence_Angle.long_name = "The angle between the local normal vector and cell center direction vector" ;
+		:Incidence_Angle.units = "deg" ;
+		:Incidence_Angle.scale_factor = 0.01 ;
+		:Incidence_Angle.scale_factor_err = 0. ;
+		:Incidence_Angle.add_offset = 0. ;
+		:Incidence_Angle.add_offset_err = 0. ;
+		:Incidence_Angle.calibrated_nt = 23 ;
+		:Incidence_Angle.valid_range = 0s, 6259s ;
+		:Incidence_Angle_dim_0.name = "row" ;
+		:Incidence_Angle_dim_0.long_name = "WVC row index" ;
+		:Incidence_Angle_dim_1.name = "WVC" ;
+		:Incidence_Angle_dim_1.long_name = "WVC index within a row" ;
+		:Incidence_Angle_dim_2.name = "Sigma0-Dimension" ;
+		:Incidence_Angle_dim_2.long_name = "Sigma0 position index" ;
+		:Sigma0.long_name = "The sigma-0 measurement corresponding to each WVC" ;
+		:Sigma0.units = "dB" ;
+		:Sigma0.scale_factor = 0.01 ;
+		:Sigma0.scale_factor_err = 0. ;
+		:Sigma0.add_offset = 0. ;
+		:Sigma0.add_offset_err = 0. ;
+		:Sigma0.calibrated_nt = 22 ;
+		:Sigma0.valid_range = -6069s, 344s ;
+		:Sigma0_dim_0.name = "row" ;
+		:Sigma0_dim_0.long_name = "WVC row index" ;
+		:Sigma0_dim_1.name = "WVC" ;
+		:Sigma0_dim_1.long_name = "WVC index within a row" ;
+		:Sigma0_dim_2.name = "Sigma0-Dimension" ;
+		:Sigma0_dim_2.long_name = "Sigma0 position index" ;
+		:Coeff_A.long_name = "The coefficient (alpha) of sigma-0 squared in the sigma-0 variance equation" ;
+		:Coeff_A.scale_factor = 1.e-05 ;
+		:Coeff_A.scale_factor_err = 0. ;
+		:Coeff_A.add_offset = 0. ;
+		:Coeff_A.add_offset_err = 0. ;
+		:Coeff_A.calibrated_nt = 23 ;
+		:Coeff_A.valid_range = 0s, 5235s ;
+		:Coeff_A_dim_0.name = "row" ;
+		:Coeff_A_dim_0.long_name = "WVC row index" ;
+		:Coeff_A_dim_1.name = "WVC" ;
+		:Coeff_A_dim_1.long_name = "WVC index within a row" ;
+		:Coeff_A_dim_2.name = "Sigma0-Dimension" ;
+		:Coeff_A_dim_2.long_name = "Sigma0 position index" ;
+		:Coeff_B.long_name = "The coefficient (beta) of sigma-0 in the sigma-0 variance equation" ;
+		:Coeff_B.scale_factor = 1.e-07 ;
+		:Coeff_B.scale_factor_err = 0. ;
+		:Coeff_B.add_offset = 0. ;
+		:Coeff_B.add_offset_err = 0. ;
+		:Coeff_B.calibrated_nt = 23 ;
+		:Coeff_B.valid_range = 0s, 793s ;
+		:Coeff_B_dim_0.name = "row" ;
+		:Coeff_B_dim_0.long_name = "WVC row index" ;
+		:Coeff_B_dim_1.name = "WVC" ;
+		:Coeff_B_dim_1.long_name = "WVC index within a row" ;
+		:Coeff_B_dim_2.name = "Sigma0-Dimension" ;
+		:Coeff_B_dim_2.long_name = "Sigma0 position index" ;
+		:Coeff_C.long_name = "The coefficient (gamma) representing the constant term in the sigma-0 variance equation" ;
+		:Coeff_C.scale_factor = 1.e-09 ;
+		:Coeff_C.scale_factor_err = 0. ;
+		:Coeff_C.add_offset = 0. ;
+		:Coeff_C.add_offset_err = 0. ;
+		:Coeff_C.calibrated_nt = 23 ;
+		:Coeff_C.valid_range = 0s, 61s ;
+		:Coeff_C_dim_0.name = "row" ;
+		:Coeff_C_dim_0.long_name = "WVC row index" ;
+		:Coeff_C_dim_1.name = "WVC" ;
+		:Coeff_C_dim_1.long_name = "WVC index within a row" ;
+		:Coeff_C_dim_2.name = "Sigma0-Dimension" ;
+		:Coeff_C_dim_2.long_name = "Sigma0 position index" ;
+		:Sigma0_Quality_Flag.long_name = "Bit flags indicating the quality of sigma-0 measurements" ;
+		:Sigma0_Quality_Flag.valid_range = 0s, 1s ;
+		:Sigma0_Quality_Flag_dim_0.name = "row" ;
+		:Sigma0_Quality_Flag_dim_0.long_name = "WVC row index" ;
+		:Sigma0_Quality_Flag_dim_1.name = "WVC" ;
+		:Sigma0_Quality_Flag_dim_1.long_name = "WVC index within a row" ;
+		:Sigma0_Quality_Flag_dim_2.name = "Sigma0-Dimension" ;
+		:Sigma0_Quality_Flag_dim_2.long_name = "Sigma0 position index" ;
+		:K_Polar.long_name = "The polarization index to the model function table" ;
+		:K_Polar.scale_factor = 1. ;
+		:K_Polar.scale_factor_err = 0. ;
+		:K_Polar.add_offset = 0. ;
+		:K_Polar.add_offset_err = 0. ;
+		:K_Polar.calibrated_nt = 21 ;
+		:K_Polar.valid_range = 0, 2 ;
+		:K_Polar_dim_0.name = "row" ;
+		:K_Polar_dim_0.long_name = "WVC row index" ;
+		:K_Polar_dim_1.name = "WVC" ;
+		:K_Polar_dim_1.long_name = "WVC index within a row" ;
+		:K_Polar_dim_2.name = "Sigma0-Dimension" ;
+		:K_Polar_dim_2.long_name = "Sigma0 position index" ;
+		:Sigma0_Usable_Flag_1.long_name = "Eight bit flags indicating whether or not the first set of eight sigma-0 measurements is usable for wind retrieval" ;
+		:Sigma0_Usable_Flag_1.valid_range = 0, 0 ;
+		:Sigma0_Usable_Flag_1_dim_0.name = "row" ;
+		:Sigma0_Usable_Flag_1_dim_0.long_name = "WVC row index" ;
+		:Sigma0_Usable_Flag_1_dim_1.name = "WVC" ;
+		:Sigma0_Usable_Flag_1_dim_1.long_name = "WVC index within a row" ;
+		:Sigma0_Usable_Flag_2.long_name = "Eight bit flags indicating whether or not the second set of eight sigma-0 measurements is usable for wind retrieval" ;
+		:Sigma0_Usable_Flag_2.valid_range = 0, 0 ;
+		:Sigma0_Usable_Flag_2_dim_0.name = "row" ;
+		:Sigma0_Usable_Flag_2_dim_0.long_name = "WVC row index" ;
+		:Sigma0_Usable_Flag_2_dim_1.name = "WVC" ;
+		:Sigma0_Usable_Flag_2_dim_1.long_name = "WVC index within a row" ;
+		:Sigma0_Usable_Flag_3.long_name = "Eight bit flags indicating whether or not the third set of eight sigma-0 measurements is usable for wind retrieval" ;
+		:Sigma0_Usable_Flag_3.valid_range = 0, 0 ;
+		:Sigma0_Usable_Flag_3_dim_0.name = "row" ;
+		:Sigma0_Usable_Flag_3_dim_0.long_name = "WVC row index" ;
+		:Sigma0_Usable_Flag_3_dim_1.name = "WVC" ;
+		:Sigma0_Usable_Flag_3_dim_1.long_name = "WVC index within a row" ;
+		:Surface_Flag.long_name = "Bit flags indicating land and ice contamination of data" ;
+		:Surface_Flag.valid_range = 0, 0 ;
+		:Surface_Flag_dim_0.name = "row" ;
+		:Surface_Flag_dim_0.long_name = "WVC row index" ;
+		:Surface_Flag_dim_1.name = "WVC" ;
+		:Surface_Flag_dim_1.long_name = "WVC index within a row" ;
+		:Surface_Flag_dim_2.name = "Sigma0-Dimension" ;
+		:Surface_Flag_dim_2.long_name = "Sigma0 position index" ;
 data:
 
  NSCAT%20Rev%2017.WVC_Lat =
diff --git a/ncdap_test/expected3/D1.dmp b/ncdap_test/expected3/D1.dmp
index 3568ff9..07c1e2a 100644
--- a/ncdap_test/expected3/D1.dmp
+++ b/ncdap_test/expected3/D1.dmp
@@ -7,6 +7,9 @@ variables:
 	char Drifters.location(Drifters, maxStrlen64) ;
 	double Drifters.latitude(Drifters) ;
 	double Drifters.longitude(Drifters) ;
+
+// global attributes:
+		:_location.Description = "String describing general location (southern ocean,oregon coast, etc.) of drifter deployment." ;
 data:
 
  Drifters.instrument_id =
diff --git a/ncdap_test/expected3/Drifters.dmp b/ncdap_test/expected3/Drifters.dmp
index c38354b..5f89b31 100644
--- a/ncdap_test/expected3/Drifters.dmp
+++ b/ncdap_test/expected3/Drifters.dmp
@@ -63,6 +63,12 @@ variables:
 		Drifters.Calibration_File:Description = "Path to the file on our file server of the calibration file for the drifter." ;
 	char Drifters.Drifter_Type(Drifters, maxStrlen64) ;
 		Drifters.Drifter_Type:Description = "Type of drifter." ;
+
+// global attributes:
+		:Facility.PrincipleInvestigator = "Mark Abbott\n",
+			"Ph.D" ;
+		:Facility.DataCenter = "COAS Environmental Computer Facility" ;
+		:Facility.DrifterType = "MetOcean WOCE/OCM" ;
 data:
 
  Drifters.Drifter_ID =
diff --git a/ncdap_test/expected3/EOSDB.dmp b/ncdap_test/expected3/EOSDB.dmp
index a804d9b..5413b4f 100644
--- a/ncdap_test/expected3/EOSDB.dmp
+++ b/ncdap_test/expected3/EOSDB.dmp
@@ -104,6 +104,23 @@ variables:
 // global attributes:
 		:history = "FERRET V4.11 (debug/no GUI) 19-Nov-95FERRET V4.20 (debug/no GUI) 12-Mar-96" ;
 		:title = "COADS Surface Marine Observations (1854-1993)" ;
+		:Facility.PrincipleInvestigator = "Mark Abbott" ;
+		:Facility.DataCenter = "COAS Environmental Computer Facility" ;
+		:LON.units = "degrees_east" ;
+		:LON.modulo = " " ;
+		:LON.point_spacing = "even" ;
+		:LAT.units = "degrees_north" ;
+		:LAT.point_spacing = "even" ;
+		:TIME.units = "days since 1700-01-01 00:00:00" ;
+		:TIME.time_origin = "1-JAN-1700" ;
+		:TIME.point_spacing = "uneven" ;
+		:TIME.edges = "TIMEedges" ;
+		:TIMEedges.edges = " " ;
+		:SST.missing_value = -9.9999998e+33 ;
+		:SST._FillValue = -9.9999998e+33 ;
+		:SST.long_name = "Sea Surface Temperature" ;
+		:SST.history = "From all_coads_grid" ;
+		:SST.units = "deg C" ;
 data:
 
  Abbott_Image_Data.Image_Name =
diff --git a/ncdap_test/expected3/Makefile.am b/ncdap_test/expected3/Makefile.am
index 9c920c6..f1b4c22 100644
--- a/ncdap_test/expected3/Makefile.am
+++ b/ncdap_test/expected3/Makefile.am
@@ -34,7 +34,7 @@ test.sds4.dmp test.sds5.dmp test.sds6.dmp \
 test.sds7.dmp test.vs1.dmp test.vs2.dmp \
 test.vs3.dmp test.vs4.dmp test.vs5.dmp \
 text.nc.dmp whoi.dmp \
-testData.nc.dmp \
+testData.nc.dmp kwcase.nc.dmp \
 CMakeLists.txt
 
  
diff --git a/ncdap_test/expected3/Makefile.in b/ncdap_test/expected3/Makefile.in
index 4965c5d..704a75c 100644
--- a/ncdap_test/expected3/Makefile.in
+++ b/ncdap_test/expected3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -334,7 +334,7 @@ test.sds4.dmp test.sds5.dmp test.sds6.dmp \
 test.sds7.dmp test.vs1.dmp test.vs2.dmp \
 test.vs3.dmp test.vs4.dmp test.vs5.dmp \
 text.nc.dmp whoi.dmp \
-testData.nc.dmp \
+testData.nc.dmp kwcase.nc.dmp \
 CMakeLists.txt
 
 all: all-am
diff --git a/ncdap_test/expected3/OverideExample.dmp b/ncdap_test/expected3/OverideExample.dmp
index 1dc27f3..dec4ed6 100644
--- a/ncdap_test/expected3/OverideExample.dmp
+++ b/ncdap_test/expected3/OverideExample.dmp
@@ -11,6 +11,15 @@ variables:
 	int exp.i(exp.i_0) ;
 	int exp.data.i ;
 	double exp.data.f(exp.data.f_0) ;
+
+// global attributes:
+		:GeneralInfo.Author = "Nathan\n",
+			"Potter" ;
+		:GeneralInfo.Facility = "Oregon State University\n",
+			"College of Oceanic and Atmospheric Sciences" ;
+		:GeneralInfo.Example = "This dataset is a simple example of how to use a .ovr file\n",
+			"in the INFO directory to override the default .info service output\n",
+			"of the OPeNDAP servlet." ;
 data:
 
  exp.ThreeD =
diff --git a/ncdap_test/expected3/SimpleDrdsExample.dmp b/ncdap_test/expected3/SimpleDrdsExample.dmp
index 861aecb..23b3f8a 100644
--- a/ncdap_test/expected3/SimpleDrdsExample.dmp
+++ b/ncdap_test/expected3/SimpleDrdsExample.dmp
@@ -157,6 +157,12 @@ variables:
 	double Drifters.rellon3hr(Drifters) ;
 		Drifters.rellon3hr:Description = "Relative Longitude: Change in longitude in the last 3 hours as determined by the GPS subsystem (Rlon3)" ;
 		Drifters.rellon3hr:units = "degrees_east" ;
+
+// global attributes:
+		:Facility.PrincipleInvestigator = "Mark Abbott\n",
+			"Ph.D" ;
+		:Facility.DataCenter = "COAS Environmental Computer Facility" ;
+		:Facility.DrifterType = "MetOcean WOCE/OCM" ;
 data:
 
  Drifters.battery = 1000, 886.994922779284, 573.519986072456, 
diff --git a/ncdap_test/expected3/b31.dmp b/ncdap_test/expected3/b31.dmp
index 67d94f2..b5d4c96 100644
--- a/ncdap_test/expected3/b31.dmp
+++ b/ncdap_test/expected3/b31.dmp
@@ -11,6 +11,10 @@ variables:
 		b31.class:long_name = "class is dismissed" ;
 	char b31.text(b31, maxStrlen64) ;
 		b31.text:long_name = "textually yours" ;
+
+// global attributes:
+		:b31.foo.long_name = "It is beyond all recognition" ;
+		:b31.foo.short_name = "foobar" ;
 data:
 
  b32 = 1 ;
diff --git a/ncdap_test/expected3/bears.nc.dmp b/ncdap_test/expected3/bears.nc.dmp
index a167934..5ad2b9f 100644
--- a/ncdap_test/expected3/bears.nc.dmp
+++ b/ncdap_test/expected3/bears.nc.dmp
@@ -7,8 +7,7 @@ dimensions:
 variables:
 	short l(l) ;
 	char bears(i, j, maxStrlen64) ;
-		bears:act = "text string\n",
-			"\t123" ;
+		bears:act = "text string\\012\\011123" ;
 		bears:acs = -40s ;
 		bears:acl = 17000 ;
 		bears:acf = -2.f, 1.f, 0.f ;
@@ -20,10 +19,10 @@ variables:
 	double cross(i, j) ;
 
 // global attributes:
-		:history = "This is an example of a multi-line global\n",
-			"attribute.  It could be used for representing the\n",
-			"processing history of the data, for example." ;
+		:history = "This is an example of a multi-line global\\012attribute.  It could be used for representing the\\012processing history of the data, for example." ;
 		:DODS_EXTRA.Unlimited_Dimension = "k" ;
+		:i.i_1.attr3_1 = "17" ;
+		:i.i_1.attr3_2 = 19., 23., 27. ;
 data:
 
  l = 10, 9, 8 ;
diff --git a/ncdap_test/expected3/ber-2002-10-01.nc.dmp b/ncdap_test/expected3/ber-2002-10-01.nc.dmp
index da16446..9f56820 100644
--- a/ncdap_test/expected3/ber-2002-10-01.nc.dmp
+++ b/ncdap_test/expected3/ber-2002-10-01.nc.dmp
@@ -21,6 +21,379 @@ variables:
 // global attributes:
 		:Conventions = "CF-1.0" ;
 		:Institution = "CSISS,GMU" ;
+		:Lineage.History = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
+			"<History xmlns:smXML=\"http://www.isotc211.org/smXML\" \n",
+			" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n",
+			" xmlns:gml=\"http://www.opengis.net/gml\">\n",
+			"\n",
+			"     <lineage>\n",
+			"        <LI_Lineage>\n",
+			"          <statement>\n",
+			"\t\t <CharacterString>\n",
+			"               This lineage information documents the source and processing performed by the WCS server in the CEOP satellite data server.\n",
+			"             </CharacterString>\n",
+			"          </statement>\n",
+			"          <processStep>\n",
+			"            <LI_ProcessStep>\n",
+			"              <description>\n",
+			"                 <CharacterString>\n",
+			"\t                  <Reprojection>\n",
+			"\t\t\t\t    <Name>SatelliteSwathToLatitudeLongitude</Name>\n",
+			"\t\t\t\t    <Method>ForwardMapping</Method>\n",
+			"\t\t\t\t</Reprojection>\n",
+			"                 </CharacterString>\n",
+			"              </description>\n",
+			"              <rationale>\n",
+			"                <CharacterString>\n",
+			"\t\t\t Perform georectification by transforming satellite swath coordinate system to Latitude-Longitude coordinate system.  \n",
+			"                </CharacterString>\n",
+			"              </rationale>\n",
+			"              <dateTime>\n",
+			"                <DateTime>2008-05-21T20:12:12.00000Z</DateTime>\n",
+			"              </dateTime>\n",
+			"              <processor>\n",
+			"                <CI_ResponsibleParty>\n",
+			"                  <individualName>\n",
+			"                    <CharacterString>Wenli Yang</CharacterString>\n",
+			"                  </individualName>\n",
+			"                  <organisationName>\n",
+			"                    <CharacterString>NASA GES DISC</CharacterString>\n",
+			"                  </organisationName>\n",
+			"                  <contactInfo>\n",
+			"                    <CI_Contact>\n",
+			"                      <phone>\n",
+			"                        <CI_Telephone>\n",
+			"                          <voice>\n",
+			"                            <CharacterString>301-614-5312</CharacterString>\n",
+			"                          </voice>\n",
+			"                        </CI_Telephone>\n",
+			"                      </phone>\n",
+			"                          <electronicMailAddress>\n",
+			"                            <CharacterString>Wenli.Yang at nasa.gov</CharacterString>\n",
+			"                          </electronicMailAddress>\n",
+			"                    </CI_Contact>\n",
+			"                  </contactInfo>\n",
+			"                </CI_ResponsibleParty>\n",
+			"              </processor>\n",
+			"          </LI_ProcessStep>\n",
+			"           <LI_ProcessStep>\n",
+			"              <description>\n",
+			"                 <CharacterString>\n",
+			"\t\t\t\t<Interpolation>\n",
+			"\t\t\t\t    <Name>Interpolation</Name>\n",
+			"\t\t\t\t    <Method> NearestNeighbor Interpolation </Method>\n",
+			"\t\t\t\t</Interpolation>\n",
+			"                 </CharacterString>\n",
+			"              </description>\n",
+			"              <rationale>\n",
+			"                <CharacterString>Interpolatiion is needed for output cells containing no valid input values.</CharacterString>\n",
+			"              </rationale>\n",
+			"              <dateTime>\n",
+			"                <DateTime>2008-05-21T20:12:12.000000Z</DateTime>\n",
+			"              </dateTime>\n",
+			"              <processor>\n",
+			"                <CI_ResponsibleParty>\n",
+			"                  <individualName>\n",
+			"                    <CharacterString>Wenli Yang</CharacterString>\n",
+			"                  </individualName>\n",
+			"                  <organisationName>\n",
+			"                    <CharacterString>NASA GES DISC</CharacterString>\n",
+			"                  </organisationName>\n",
+			"                  <contactInfo>\n",
+			"                    <CI_Contact>\n",
+			"                      <phone>\n",
+			"                        <CI_Telephone>\n",
+			"                          <voice>\n",
+			"                            <CharacterString>301-614-5312</CharacterString>\n",
+			"                          </voice>\n",
+			"                        </CI_Telephone>\n",
+			"                      </phone>\n",
+			"                          <electronicMailAddress>\n",
+			"                            <CharacterString>Wenli.Yang at nasa.gov</CharacterString>\n",
+			"                          </electronicMailAddress>\n",
+			"                    </CI_Contact>\n",
+			"                  </contactInfo>\n",
+			"                </CI_ResponsibleParty>\n",
+			"              </processor>\n",
+			"          </LI_ProcessStep>\n",
+			"           <LI_ProcessStep>\n",
+			"              <description>\n",
+			"                 <CharacterString>\n",
+			"\t\t\t\t<QualityScreen>\n",
+			"\t\t\t\t    <Name>QualityScreen</Name>\n",
+			"\t\t\t\t    <Method>AIRSPerPixelQAFiltering</Method>\n",
+			"\t\t\t\t</QualityScreen>\n",
+			"                 </CharacterString>\n",
+			"              </description>\n",
+			"              <rationale>\n",
+			"                <CharacterString>Input cells not meeting QA criteria must be excluded in the resultant coverage.</CharacterString>\n",
+			"              </rationale>\n",
+			"              <dateTime>\n",
+			"                <DateTime>2008-05-21T20:12:12.000000Z</DateTime>\n",
+			"              </dateTime>\n",
+			"              <processor>\n",
+			"                <CI_ResponsibleParty>\n",
+			"                  <individualName>\n",
+			"                    <CharacterString>Wenli Yang</CharacterString>\n",
+			"                  </individualName>\n",
+			"                  <organisationName>\n",
+			"                    <CharacterString>NASA GES DISC</CharacterString>\n",
+			"                  </organisationName>\n",
+			"                  <contactInfo>\n",
+			"                    <CI_Contact>\n",
+			"                      <phone>\n",
+			"                        <CI_Telephone>\n",
+			"                          <voice>\n",
+			"                            <CharacterString>301-614-5312</CharacterString>\n",
+			"                          </voice>\n",
+			"                        </CI_Telephone>\n",
+			"                      </phone>\n",
+			"                          <electronicMailAddress>\n",
+			"                            <CharacterString>Wenli.Yang at nasa.gov</CharacterString>\n",
+			"                          </electronicMailAddress>\n",
+			"                    </CI_Contact>\n",
+			"                  </contactInfo>\n",
+			"                </CI_ResponsibleParty>\n",
+			"              </processor>\n",
+			"          </LI_ProcessStep>\n",
+			"         </processStep>\n",
+			"\n",
+			"\n",
+			"          <source>\n",
+			"              <LI_Source>\n",
+			"                  <description>\n",
+			"                    <CharacterString>Input AIRS Release 5 Level 2 granule</CharacterString>\n",
+			"                  </description>\n",
+			"                  <sourceReferenceSystem>\n",
+			"                    <MD_ReferenceSystem>\n",
+			"                      <referenceSystemIdentifier>\n",
+			"                        <RS_Identifier>\n",
+			"\t\t\t\t\t<code>\n",
+			"\t\t\t\t\t\t<CharacterString>OGC:Swath</CharacterString>\n",
+			"\t\t\t\t\t</code>\n",
+			"\t\t\t\t\t<codeSpace>\n",
+			"\t\t\t\t\t\t<CharacterString>OGC</CharacterString>\n",
+			"\t\t\t\t\t</codeSpace>\n",
+			"\t\t\t\t</RS_Identifier>\n",
+			"\t\t\t   </referenceSystemIdentifier>\n",
+			"\t\t       </MD_ReferenceSystem>\n",
+			"                  </sourceReferenceSystem>\n",
+			"                  <sourceCitation>\n",
+			"                    <CI_Citation>\n",
+			"                      <title>\n",
+			"                        <CharacterString>Input AIRS Release 5 Level 2 granule</CharacterString>\n",
+			"                      </title>\n",
+			"                      <date>\n",
+			"                        <CI_Date>\n",
+			"                          <date>\n",
+			"                            <Date>2004-10-01</Date>\n",
+			"                          </date>\n",
+			"                          <dateType>\n",
+			"                            <CI_DateTypeCode>publication</CI_DateTypeCode>\n",
+			"                          </dateType>\n",
+			"                        </CI_Date>\n",
+			"                      </date>\n",
+			"                      <identifier>\n",
+			"                        <MD_Identifier>\n",
+			"                          <authority />\n",
+			"                          <code>\n",
+			"                            <CharacterString />\n",
+			"                          </code>\n",
+			"                        </MD_Identifier>\n",
+			"                      </identifier>\n",
+			"                      <citedResponsibleParty>\n",
+			"                        <CI_ResponsibleParty>\n",
+			"                          <organisationName>\n",
+			"                            <CharacterString>NASA GES DISC</CharacterString>\n",
+			"                          </organisationName>\n",
+			"                          <contactInfo>\n",
+			"                            <CI_Contact>\n",
+			"                              <onlineResource>\n",
+			"                                <CI_OnlineResource>\n",
+			"                                  <linkage>\n",
+			"                                    <URL>ftp://airspar1u.ecs.nasa.gov/data/s4pa/Aqua_AIRS_Level2/AIRX2RET.005/2002/274/AIRS.2002.10.01.097.L2.RetStd.v5.0.14.0.G07227014224.hdf</URL>\n",
+			"                                  </linkage>\n",
+			"                                  <protocol>\n",
+			"                                    <CharacterString>ftp</CharacterString>\n",
+			"                                  </protocol>\n",
+			"                                  <function>\n",
+			"                                    <CI_OnLineFunctionCode>download</CI_OnLineFunctionCode>\n",
+			"                                  </function>\n",
+			"                                </CI_OnlineResource>\n",
+			"                              </onlineResource>\n",
+			"                            </CI_Contact>\n",
+			"                          </contactInfo>\n",
+			"                          <role>\n",
+			"                            <CI_RoleCode>originator</CI_RoleCode>\n",
+			"                          </role>\n",
+			"                        </CI_ResponsibleParty>\n",
+			"                      </citedResponsibleParty>\n",
+			"                      <presentationForm>\n",
+			"                        <CI_PresentationFormCode codeSpace=\"\" codeList=\"\" codeListValue=\"\" />\n",
+			"                      </presentationForm>\n",
+			"                    </CI_Citation>\n",
+			"                  </sourceCitation>\n",
+			"                  <sourceExtent>\n",
+			"                    <EX_Extent>\n",
+			"                      <description>\n",
+			"                        <CharacterString />\n",
+			"                      </description>\n",
+			"\t\t\t\t<geographicElement>\n",
+			"\t\t\t\t\t<EX_BoundingPolygon>\n",
+			"\t\t\t\t\t\t<polygon>\n",
+			"\t\t\t\t\t\t\t<gml:Polygon srsName=\"urn:EPSG:geographicCRS:4326\">\n",
+			"\t\t\t\t\t\t\t\t<gml:outerBoundaryIs>\n",
+			"\t\t\t\t\t\t\t\t\t<gml:LinearRing>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>59.542054 -91.525519</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>64.006578 -122.761953</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>42.866636 -126.317500</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>40.097498 -106.352680</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t</gml:LinearRing>\n",
+			"\t\t\t\t\t\t\t\t</gml:outerBoundaryIs>\n",
+			"\t\t\t\t\t\t\t</gml:Polygon>\n",
+			"\t\t\t\t\t\t</polygon>\n",
+			"\t\t\t\t\t</EX_BoundingPolygon>\n",
+			"\t\t\t\t</geographicElement>\n",
+			"                       <temporalElement>\n",
+			"\t\t\t\t\t<EX_TemporalExtent>\n",
+			"\t\t\t\t\t\t<extent>\n",
+			"\t\t\t\t\t\t\t<gml:TimePeriod>\n",
+			"\t\t\t\t\t\t\t\t<gml:begin>\n",
+			"\t\t\t\t\t\t\t\t\t<gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:timePosition>2002-10-01T09:18:00.000000Z</gml:timePosition>\n",
+			"\t\t\t\t\t\t\t\t\t</gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t</gml:begin>\n",
+			"\t\t\t\t\t\t\t\t<gml:end>\n",
+			"\t\t\t\t\t\t\t\t\t<gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:timePosition>2002-10-01T09:23:59.999999Z</gml:timePosition>\n",
+			"\t\t\t\t\t\t\t\t\t</gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t</gml:end>\n",
+			"\t\t\t\t\t\t\t</gml:TimePeriod>\n",
+			"\t\t\t\t\t\t</extent>\n",
+			"\t\t\t\t\t</EX_TemporalExtent>\n",
+			"\t\t\t\t</temporalElement>\n",
+			"                    </EX_Extent>\n",
+			"                  </sourceExtent>\n",
+			"              </LI_Source>\n",
+			"              <LI_Source>\n",
+			"                  <description>\n",
+			"                    <CharacterString>Input AIRS Release 5 Level 2 granule</CharacterString>\n",
+			"                  </description>\n",
+			"                  <sourceReferenceSystem>\n",
+			"                    <MD_ReferenceSystem>\n",
+			"                      <referenceSystemIdentifier>\n",
+			"                        <RS_Identifier>\n",
+			"\t\t\t\t\t<code>\n",
+			"\t\t\t\t\t\t<CharacterString>OGC:Swath</CharacterString>\n",
+			"\t\t\t\t\t</code>\n",
+			"\t\t\t\t\t<codeSpace>\n",
+			"\t\t\t\t\t\t<CharacterString>OGC</CharacterString>\n",
+			"\t\t\t\t\t</codeSpace>\n",
+			"\t\t\t\t</RS_Identifier>\n",
+			"\t\t\t   </referenceSystemIdentifier>\n",
+			"\t\t       </MD_ReferenceSystem>\n",
+			"                  </sourceReferenceSystem>\n",
+			"                  <sourceCitation>\n",
+			"                    <CI_Citation>\n",
+			"                      <title>\n",
+			"                        <CharacterString>Input AIRS Release 5 Level 2 granule</CharacterString>\n",
+			"                      </title>\n",
+			"                      <date>\n",
+			"                        <CI_Date>\n",
+			"                          <date>\n",
+			"                            <Date>2004-10-01</Date>\n",
+			"                          </date>\n",
+			"                          <dateType>\n",
+			"                            <CI_DateTypeCode>publication</CI_DateTypeCode>\n",
+			"                          </dateType>\n",
+			"                        </CI_Date>\n",
+			"                      </date>\n",
+			"                      <identifier>\n",
+			"                        <MD_Identifier>\n",
+			"                          <authority />\n",
+			"                          <code>\n",
+			"                            <CharacterString />\n",
+			"                          </code>\n",
+			"                        </MD_Identifier>\n",
+			"                      </identifier>\n",
+			"                      <citedResponsibleParty>\n",
+			"                        <CI_ResponsibleParty>\n",
+			"                          <organisationName>\n",
+			"                            <CharacterString>NASA GES DISC</CharacterString>\n",
+			"                          </organisationName>\n",
+			"                          <contactInfo>\n",
+			"                            <CI_Contact>\n",
+			"                              <onlineResource>\n",
+			"                                <CI_OnlineResource>\n",
+			"                                  <linkage>\n",
+			"                                    <URL>ftp://airspar1u.ecs.nasa.gov/data/s4pa/Aqua_AIRS_Level2/AIRX2RET.005/2002/274/AIRS.2002.10.01.193.L2.RetStd.v5.0.14.0.G07227072611.hdf</URL>\n",
+			"                                  </linkage>\n",
+			"                                  <protocol>\n",
+			"                                    <CharacterString>ftp</CharacterString>\n",
+			"                                  </protocol>\n",
+			"                                  <function>\n",
+			"                                    <CI_OnLineFunctionCode>download</CI_OnLineFunctionCode>\n",
+			"                                  </function>\n",
+			"                                </CI_OnlineResource>\n",
+			"                              </onlineResource>\n",
+			"                            </CI_Contact>\n",
+			"                          </contactInfo>\n",
+			"                          <role>\n",
+			"                            <CI_RoleCode>originator</CI_RoleCode>\n",
+			"                          </role>\n",
+			"                        </CI_ResponsibleParty>\n",
+			"                      </citedResponsibleParty>\n",
+			"                      <presentationForm>\n",
+			"                        <CI_PresentationFormCode codeSpace=\"\" codeList=\"\" codeListValue=\"\" />\n",
+			"                      </presentationForm>\n",
+			"                    </CI_Citation>\n",
+			"                  </sourceCitation>\n",
+			"                  <sourceExtent>\n",
+			"                    <EX_Extent>\n",
+			"                      <description>\n",
+			"                        <CharacterString />\n",
+			"                      </description>\n",
+			"\t\t\t\t<geographicElement>\n",
+			"\t\t\t\t\t<EX_BoundingPolygon>\n",
+			"\t\t\t\t\t\t<polygon>\n",
+			"\t\t\t\t\t\t\t<gml:Polygon srsName=\"urn:EPSG:geographicCRS:4326\">\n",
+			"\t\t\t\t\t\t\t\t<gml:outerBoundaryIs>\n",
+			"\t\t\t\t\t\t\t\t\t<gml:LinearRing>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>50.182469 -108.424849</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>53.793611 -84.244362</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>74.889234 -88.293173</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:pos>68.007927 -132.994761</gml:pos>\n",
+			"\t\t\t\t\t\t\t\t\t</gml:LinearRing>\n",
+			"\t\t\t\t\t\t\t\t</gml:outerBoundaryIs>\n",
+			"\t\t\t\t\t\t\t</gml:Polygon>\n",
+			"\t\t\t\t\t\t</polygon>\n",
+			"\t\t\t\t\t</EX_BoundingPolygon>\n",
+			"\t\t\t\t</geographicElement>\n",
+			"                       <temporalElement>\n",
+			"\t\t\t\t\t<EX_TemporalExtent>\n",
+			"\t\t\t\t\t\t<extent>\n",
+			"\t\t\t\t\t\t\t<gml:TimePeriod>\n",
+			"\t\t\t\t\t\t\t\t<gml:begin>\n",
+			"\t\t\t\t\t\t\t\t\t<gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:timePosition>2002-10-01T19:46:00.000000Z</gml:timePosition>\n",
+			"\t\t\t\t\t\t\t\t\t</gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t</gml:begin>\n",
+			"\t\t\t\t\t\t\t\t<gml:end>\n",
+			"\t\t\t\t\t\t\t\t\t<gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t\t\t<gml:timePosition>2002-10-01T19:51:59.999999Z</gml:timePosition>\n",
+			"\t\t\t\t\t\t\t\t\t</gml:TimeInstant>\n",
+			"\t\t\t\t\t\t\t\t</gml:end>\n",
+			"\t\t\t\t\t\t\t</gml:TimePeriod>\n",
+			"\t\t\t\t\t\t</extent>\n",
+			"\t\t\t\t\t</EX_TemporalExtent>\n",
+			"\t\t\t\t</temporalElement>\n",
+			"                    </EX_Extent>\n",
+			"                  </sourceExtent>\n",
+			"              </LI_Source>\n",
+			"          </source>\n",
+			"        </LI_Lineage>\n",
+			"      </lineage>\n",
+			"</History> " ;
 data:
 
  TSurfAir =
diff --git a/ncdap_test/expected3/in.nc.dmp b/ncdap_test/expected3/in.nc.dmp
index 4cc0058..0e5ddb6 100644
--- a/ncdap_test/expected3/in.nc.dmp
+++ b/ncdap_test/expected3/in.nc.dmp
@@ -118,18 +118,14 @@ variables:
 	float one_dmn_var(bnd) ;
 	float att_var ;
 		att_var:byte_att = 0b ;
-		att_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		att_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		att_var:short_att = 37s ;
 		att_var:int_att = 73 ;
 		att_var:float_att = 73.f, 72.f, 71.f ;
 		att_var:double_att = 73. ;
 	int bnd_var(lev, bnd) ;
 		bnd_var:byte_att = 0b ;
-		bnd_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		bnd_var:short_att = 37s ;
 		bnd_var:int_att = 73 ;
 		bnd_var:float_att = 73.f ;
@@ -325,8 +321,7 @@ variables:
 
 // global attributes:
 		:Conventions = "NCAR-CSM" ;
-		:history = "History global attribute.\n",
-			"" ;
+		:history = "History global attribute.\\012" ;
 		:julian_day = 200000.04 ;
 		:DODS_EXTRA.Unlimited_Dimension = "time" ;
 data:
diff --git a/ncdap_test/expected3/in1.nc.dmp b/ncdap_test/expected3/in1.nc.dmp
index d31d7d3..85e2b74 100644
--- a/ncdap_test/expected3/in1.nc.dmp
+++ b/ncdap_test/expected3/in1.nc.dmp
@@ -125,18 +125,14 @@ variables:
 	float one_dmn_var(bnd) ;
 	float att_var ;
 		att_var:byte_att = 0b ;
-		att_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		att_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		att_var:short_att = 37s ;
 		att_var:int_att = 73 ;
 		att_var:float_att = 73.f, 72.f, 71.f ;
 		att_var:double_att = 73. ;
 	int bnd_var(lev, bnd) ;
 		bnd_var:byte_att = 0b ;
-		bnd_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		bnd_var:short_att = 37s ;
 		bnd_var:int_att = 73 ;
 		bnd_var:float_att = 73.f ;
@@ -345,8 +341,7 @@ variables:
 
 // global attributes:
 		:Conventions = "NCAR-CSM" ;
-		:history = "History global attribute.\n",
-			"" ;
+		:history = "History global attribute.\\012" ;
 		:julian_day = 200000.04 ;
 		:DODS_EXTRA.Unlimited_Dimension = "time" ;
 data:
diff --git a/ncdap_test/expected3/in_2.nc.dmp b/ncdap_test/expected3/in_2.nc.dmp
index 17c5083..6063823 100644
--- a/ncdap_test/expected3/in_2.nc.dmp
+++ b/ncdap_test/expected3/in_2.nc.dmp
@@ -119,18 +119,14 @@ variables:
 	float one_dmn_var(bnd) ;
 	float att_var ;
 		att_var:byte_att = 0b ;
-		att_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		att_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		att_var:short_att = 37s ;
 		att_var:int_att = 73 ;
 		att_var:float_att = 73.f, 72.f, 71.f ;
 		att_var:double_att = 73. ;
 	int bnd_var(lev, bnd) ;
 		bnd_var:byte_att = 0b ;
-		bnd_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		bnd_var:short_att = 37s ;
 		bnd_var:int_att = 73 ;
 		bnd_var:float_att = 73.f ;
@@ -327,8 +323,7 @@ variables:
 
 // global attributes:
 		:Conventions = "NCAR-CSM" ;
-		:history = "History global attribute.\n",
-			"" ;
+		:history = "History global attribute.\\012" ;
 		:julian_day = 200000.04 ;
 		:DODS_EXTRA.Unlimited_Dimension = "time" ;
 data:
diff --git a/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp b/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp
index ca15ca5..4984abc 100644
--- a/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp
+++ b/ncdap_test/expected3/in_no_three_double_dmn.nc.dmp
@@ -118,18 +118,14 @@ variables:
 	float one_dmn_var(bnd) ;
 	float att_var ;
 		att_var:byte_att = 0b ;
-		att_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		att_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		att_var:short_att = 37s ;
 		att_var:int_att = 73 ;
 		att_var:float_att = 73.f, 72.f, 71.f ;
 		att_var:double_att = 73. ;
 	int bnd_var(lev, bnd) ;
 		bnd_var:byte_att = 0b ;
-		bnd_var:char_att = "Sentence one.\n",
-			"Sentence two.\n",
-			"" ;
+		bnd_var:char_att = "Sentence one.\\012Sentence two.\\012" ;
 		bnd_var:short_att = 37s ;
 		bnd_var:int_att = 73 ;
 		bnd_var:float_att = 73.f ;
@@ -325,8 +321,7 @@ variables:
 
 // global attributes:
 		:Conventions = "NCAR-CSM" ;
-		:history = "History global attribute.\n",
-			"" ;
+		:history = "History global attribute.\\012" ;
 		:julian_day = 200000.04 ;
 		:DODS_EXTRA.Unlimited_Dimension = "time" ;
 data:
diff --git a/ncdap_test/expected3/in_v.nc.dmp b/ncdap_test/expected3/in_v.nc.dmp
index 94a2e63..ee4d04c 100644
--- a/ncdap_test/expected3/in_v.nc.dmp
+++ b/ncdap_test/expected3/in_v.nc.dmp
@@ -8,8 +8,7 @@ variables:
 
 // global attributes:
 		:Conventions = "NCAR-CSM" ;
-		:history = "History global attribute.\n",
-			"" ;
+		:history = "History global attribute.\\012" ;
 		:julian_day = 200000.04 ;
 		:DODS_EXTRA.Unlimited_Dimension = "time" ;
 data:
diff --git a/ncdap_test/expected3/kwcase.nc.dmp b/ncdap_test/expected3/kwcase.nc.dmp
new file mode 100644
index 0000000..a743e2e
--- /dev/null
+++ b/ncdap_test/expected3/kwcase.nc.dmp
@@ -0,0 +1,27 @@
+netcdf kwcase {
+dimensions:
+	Grid = UNLIMITED ; // (12 currently)
+variables:
+	double Grid(Grid) ;
+		Grid:units = "hour" ;
+		Grid:time_origin = "1-JAN-0000 00:00:00" ;
+		Grid:modulo = " " ;
+	float SST(Grid) ;
+		SST:missing_value = -1.e+34f ;
+		SST:_FillValue = -1.e+34f ;
+		SST:long_name = "SEA SURFACE TEMPERATURE" ;
+		SST:long_name_mod = "X=0E(360)@ITP, Y=0 at ITP" ;
+		SST:history = "From coads-climatology" ;
+		SST:units = "Deg C" ;
+
+// global attributes:
+		:history = "FERRET V3.20 (development) 24-Jan-95" ;
+		:DODS_EXTRA.Unlimited_Dimension = "Grid" ;
+data:
+
+ Grid = 366, 1096.485, 1826.97, 2557.455, 3287.94, 4018.425, 4748.91, 
+    5479.395, 6209.88, 6940.365, 7670.85, 8401.335 ;
+
+ SST = 27.54567, 28.3144, 28.61936, 28.66284, 27.93789, 25.67098, 24.74051, 
+    24.5248, 25.00667, 25.83214, 26.57257, 27.17107 ;
+}
diff --git a/ncdap_test/expected3/nestedDAS.dmp b/ncdap_test/expected3/nestedDAS.dmp
index 36995a4..972365d 100644
--- a/ncdap_test/expected3/nestedDAS.dmp
+++ b/ncdap_test/expected3/nestedDAS.dmp
@@ -6,6 +6,20 @@ variables:
 	char b32(maxStrlen64) ;
 		b32:billy = "Bob is my real name" ;
 		b32:Robert = "Really wants to be called Billy" ;
+
+// global attributes:
+		:humans.position = "There are too many humans." ;
+		:humans.offer = "Here are a few..." ;
+		:b31.class.text.long_name = "textually yours" ;
+		:b31.class.text.short_name = "ty" ;
+		:b31.class.long_name = "class is dismissed" ;
+		:b31.class.short_name = "cid\n",
+			"kid\n",
+			"bid\n",
+			"did" ;
+		:b31.foo.long_name = "It is beyond all recognition" ;
+		:b31.foo.short_name = "foobar" ;
+		:b31.foo.SS_number = "304-66-9876" ;
 data:
 
  b31 = 0 ;
diff --git a/ncdap_test/expected3/pbug0001b.dmp b/ncdap_test/expected3/pbug0001b.dmp
index c187bbb..d2a47af 100644
--- a/ncdap_test/expected3/pbug0001b.dmp
+++ b/ncdap_test/expected3/pbug0001b.dmp
@@ -8,8 +8,8 @@ variables:
 	float \3H(ISTA, IZ) ;
 
 // global attributes:
-		:bs5 = "foo\foo\\" ;
-		:dsp_ing_tiros_ourid = "NO11****C��5>B�\\" ;
+		:bs5 = "foo\\foo\\" ;
+ 		:dsp_ing_tiros_ourid = "NO11****C\\224\\2705>B\\217\\" ;
 		:bung = 0.f, 1.f, 2.3f, -2.23456f ;
 data:
 
diff --git a/ncdap_test/expected3/synth1.dmp b/ncdap_test/expected3/synth1.dmp
index fd0dedb..f1128b7 100644
--- a/ncdap_test/expected3/synth1.dmp
+++ b/ncdap_test/expected3/synth1.dmp
@@ -3,7 +3,7 @@ dimensions:
 	S1.v1_0 = 3 ;
 variables:
 	int S1.v1(S1.v1_0) ;
-		S1.v1:a%201 = 32 ;
+ 		S1.v1:a%201 = 32 ;
 data:
 
  S1.v1 = 132, 232, 332 ;
diff --git a/ncdap_test/expected3/synth4.dmp b/ncdap_test/expected3/synth4.dmp
index 382416c..1d40a7d 100644
--- a/ncdap_test/expected3/synth4.dmp
+++ b/ncdap_test/expected3/synth4.dmp
@@ -21,6 +21,7 @@ variables:
 // global attributes:
 		:g1 = 3, 8, 16, 32 ;
 		:s1 = "gvalue1" ;
+		:S2.lost1 = "value1" ;
 data:
 
  S1.v1 =
diff --git a/ncdap_test/expected3/synth5.dmp b/ncdap_test/expected3/synth5.dmp
index 98ec3e4..b544a4d 100644
--- a/ncdap_test/expected3/synth5.dmp
+++ b/ncdap_test/expected3/synth5.dmp
@@ -4,6 +4,9 @@ dimensions:
 	long = 2 ;
 variables:
 	float G1(lat, long) ;
+
+// global attributes:
+		:S1.v2.a1 = 32 ;
 data:
 
  G1 =
diff --git a/ncdap_test/expected3/synth6.dmp b/ncdap_test/expected3/synth6.dmp
index 3f26359..622e09b 100644
--- a/ncdap_test/expected3/synth6.dmp
+++ b/ncdap_test/expected3/synth6.dmp
@@ -12,9 +12,19 @@ dimensions:
 variables:
 	byte S1.v1(S1.v1_0, S1.v1_1) ;
 	int S1.v3(S1.v3_0, S1.v3_1) ;
+		S1.v3:a1 = 32 ;
 	double S1.v5(S1.v5_0, S1.v5_1) ;
 	short Q1.v2(Q1, Q1.v2_1) ;
 	float Q1.v4(Q1, Q1.v4_1) ;
+
+// global attributes:
+		:globalattr = 177 ;
+		:CoreMetadata.OrbitNumber.Value = 375 ;
+		:CoreMetadata.OrbitNumber.Data_Location = "PGE" ;
+		:CoreMetadata.OrbitNumber.Mandatory = "FALSE" ;
+		:CoreMetadata.RangeBeginningDate.Value = "1997/12/21" ;
+		:CoreMetadata.RangeBeginningDate.Data_Location = "PGE" ;
+		:CoreMetadata.RangeBeginningDate.Mandatory = "FALSE" ;
 data:
 
  S1.v1 =
diff --git a/ncdap_test/expected3/test.01.dmp b/ncdap_test/expected3/test.01.dmp
index a874406..e238449 100644
--- a/ncdap_test/expected3/test.01.dmp
+++ b/ncdap_test/expected3/test.01.dmp
@@ -15,6 +15,12 @@ variables:
 	double f64 ;
 	char s(maxStrlen64) ;
 	char u(maxStrlen64) ;
+
+// global attributes:
+		:Facility.PrincipleInvestigator = "Mark Abbott\n",
+			"Ph.D" ;
+		:Facility.DataCenter = "COAS Environmental Computer Facility" ;
+		:Facility.DrifterType = "MetOcean WOCE/OCM" ;
 data:
 
  b = 0 ;
diff --git a/ncdap_test/expected3/test.21.dmp b/ncdap_test/expected3/test.21.dmp
index c037432..3c37480 100644
--- a/ncdap_test/expected3/test.21.dmp
+++ b/ncdap_test/expected3/test.21.dmp
@@ -10,12 +10,6 @@ variables:
 	int exp.i ;
 	short exp.g(exp.g_0, exp.g_1, exp.g_2) ;
 	short exp.f(exp.f_0, exp.f_1) ;
-
-// global attributes:
-		:Facility.PrincipleInvestigator = "Mark Abbott\n",
-			"Ph.D" ;
-		:Facility.DataCenter = "COAS Environmental Computer Facility" ;
-		:Facility.DrifterType = "MetOcean WOCE/OCM" ;
 data:
 
  exp.j = 1 ;
diff --git a/ncdap_test/expected3/test.nc.dmp b/ncdap_test/expected3/test.nc.dmp
index 464750a..775bd03 100644
--- a/ncdap_test/expected3/test.nc.dmp
+++ b/ncdap_test/expected3/test.nc.dmp
@@ -19,7 +19,7 @@ variables:
 		i:d = -1.79769313486232e+308, 1.79769313486232e+308, -1., 1., 660. ;
 	float f ;
 	double d ;
-		d:c = "�\177AZ$&" ;
+		d:c = "\\200\\177AZ$&" ;
 	char cr(Dr, maxStrlen64) ;
 	byte br(Dr) ;
 	short sr(Dr) ;
@@ -152,7 +152,7 @@ variables:
 	int i444(D4, D4, D4) ;
 
 // global attributes:
-		:Gc = "�" ;
+		:Gc = "\\200" ;
 		:Gb = -128b, 127b ;
 		:Gs = -32768s, 32767s, 32767s ;
 		:Gi = -2147483648, 2147483647, -2147483648, 2147483647 ;
diff --git a/ncdap_test/expected3/text.nc.dmp b/ncdap_test/expected3/text.nc.dmp
index cdc0ed2..614aa67 100644
--- a/ncdap_test/expected3/text.nc.dmp
+++ b/ncdap_test/expected3/text.nc.dmp
@@ -19,7 +19,7 @@ variables:
 		i:d = -1.79769313486232e+308, 1.79769313486232e+308, -1., 1., 660. ;
 	float f ;
 	double d ;
-		d:c = "�\177AZ$&" ;
+		d:c = "\\200\\177AZ$&" ;
 	char cr(Dr, maxStrlen64) ;
 	byte br(Dr) ;
 	short sr(Dr) ;
@@ -152,7 +152,7 @@ variables:
 	int i444(D4, D4, D4) ;
 
 // global attributes:
-		:Gc = "�" ;
+		:Gc = "\\200" ;
 		:Gb = -128b, 127b ;
 		:Gs = -32768s, 32767s, 32767s ;
 		:Gi = -2147483648, 2147483647, -2147483648, 2147483647 ;
diff --git a/ncdap_test/expectremote3/Makefile.in b/ncdap_test/expectremote3/Makefile.in
index 0c9e869..9b8b4e3 100644
--- a/ncdap_test/expectremote3/Makefile.in
+++ b/ncdap_test/expectremote3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/ncdap_test/t_dap.c b/ncdap_test/t_dap.c
index ae7160b..ba3bdac 100644
--- a/ncdap_test/t_dap.c
+++ b/ncdap_test/t_dap.c
@@ -307,6 +307,7 @@ int main()
         printf("ncstat=%d %s",ncstat,nc_strerror(ncstat));
         exit(1);
     }
+    nc_close(ncid);
     return 0;
 }
 
diff --git a/ncdap_test/t_dap3a.c b/ncdap_test/t_dap3a.c
index 64bcb1b..1ee3744 100644
--- a/ncdap_test/t_dap3a.c
+++ b/ncdap_test/t_dap3a.c
@@ -308,6 +308,7 @@ int main()
         printf("ncstat=%d %s",ncstat,nc_strerror(ncstat));
         exit(1);
     }
+    nc_close(ncid);
     return 0;
 }
 
diff --git a/ncdap_test/test_cvt.c b/ncdap_test/test_cvt.c
index 112b2b4..2e9500a 100644
--- a/ncdap_test/test_cvt.c
+++ b/ncdap_test/test_cvt.c
@@ -307,6 +307,7 @@ int main()
         printf("ncstat=%d %s",ncstat,nc_strerror(ncstat));
         exit(1);
     }
+    nc_close(ncid);
     return 0;
 }
 
diff --git a/ncdap_test/test_varm3.c b/ncdap_test/test_varm3.c
index 84bd767..30c5782 100644
--- a/ncdap_test/test_varm3.c
+++ b/ncdap_test/test_varm3.c
@@ -251,6 +251,7 @@ main()
     }
     printf("*** %s: stride case 3\n",(fail?"Fail":"Pass"));
 
+    nc_close(ncid);
     return fail;
 
 }
diff --git a/ncdap_test/testauth.sh b/ncdap_test/testauth.sh
index 536a227..02dd676 100755
--- a/ncdap_test/testauth.sh
+++ b/ncdap_test/testauth.sh
@@ -3,6 +3,9 @@
 if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 . ../test_common.sh
 
+# Enable if using localhost
+LOCAL=1
+
 RCEMBED=1
 RCLOCAL=1
 RCHOME=1
@@ -40,10 +43,13 @@ fi
 
 BASICCOMBO="tiggeUser:tigge"
 BADCOMBO="tiggeUser:xxxxx"
-URLSERVER="remotetest.unidata.ucar.edu"
-#http://remotetest.unidata.ucar.edu/thredds/dodsC/restrict/testData.nc.html
-URLPATH="thredds/dodsC/restrict/testData.nc"
+URLPATH="thredds/dodsC/testRestrictedDataset/testData2.nc"
 PROTO=http
+if test "x$LOCAL" = x ; then
+URLSERVER="remotetest.unidata.ucar.edu"
+else
+URLSERVER="localhost:8081"
+fi
 
 # See if we need to override
 if test "x$URS" != "x" ; then
diff --git a/ncdap_test/testdata3/Makefile.am b/ncdap_test/testdata3/Makefile.am
index e3578bb..2defd0d 100644
--- a/ncdap_test/testdata3/Makefile.am
+++ b/ncdap_test/testdata3/Makefile.am
@@ -93,6 +93,7 @@ test.vs4.das test.vs4.dds test.vs4.dods \
 test.vs5.das test.vs5.dds test.vs5.dods \
 text.nc.das text.nc.dds text.nc.dods \
 whoi.das whoi.dds whoi.dods \
+kwcase.nc.das kwcase.nc.dds kwcase.nc.dods \
 CMakeLists.txt
 
 # following are not legally convertible to dap2
diff --git a/ncdap_test/testdata3/Makefile.in b/ncdap_test/testdata3/Makefile.in
index 60a2434..b03af8d 100644
--- a/ncdap_test/testdata3/Makefile.in
+++ b/ncdap_test/testdata3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -393,6 +393,7 @@ test.vs4.das test.vs4.dds test.vs4.dods \
 test.vs5.das test.vs5.dds test.vs5.dods \
 text.nc.das text.nc.dds text.nc.dods \
 whoi.das whoi.dds whoi.dods \
+kwcase.nc.das kwcase.nc.dds kwcase.nc.dods \
 CMakeLists.txt
 
 all: all-am
diff --git a/ncdap_test/testdata3/kwcase.nc.das b/ncdap_test/testdata3/kwcase.nc.das
new file mode 100644
index 0000000..186df3d
--- /dev/null
+++ b/ncdap_test/testdata3/kwcase.nc.das
@@ -0,0 +1,21 @@
+Attributes {
+    Grid {
+        String units "hour";
+        String time_origin "1-JAN-0000 00:00:00";
+        String modulo " ";
+    }
+    SST {
+        Float32 missing_value -9.999999790e+33;
+        Float32 _FillValue -9.999999790e+33;
+        String long_name "SEA SURFACE TEMPERATURE";
+        String long_name_mod "X=0E(360)@ITP, Y=0 at ITP";
+        String history "From coads-climatology";
+        String units "Deg C";
+    }
+    NC_GLOBAL {
+        String history "FERRET V3.20 (development) 24-Jan-95";
+    }
+    DODS_EXTRA {
+        String Unlimited_Dimension "Grid";
+    }
+}
diff --git a/ncdap_test/testdata3/kwcase.nc.dds b/ncdap_test/testdata3/kwcase.nc.dds
new file mode 100644
index 0000000..77b856d
--- /dev/null
+++ b/ncdap_test/testdata3/kwcase.nc.dds
@@ -0,0 +1,9 @@
+Dataset {
+    Float64 Grid[Grid = 12];
+    Grid {
+      Array:
+        Float32 SST[Grid = 12];
+      Maps:
+        Float64 Grid[Grid = 12];
+    } SST;
+} kwcase.nc;
diff --git a/ncdap_test/testdata3/kwcase.nc.dods b/ncdap_test/testdata3/kwcase.nc.dods
new file mode 100644
index 0000000..ffd3a48
Binary files /dev/null and b/ncdap_test/testdata3/kwcase.nc.dods differ
diff --git a/ncdap_test/tst_ber.sh b/ncdap_test/tst_ber.sh
new file mode 100755
index 0000000..fe1d3ab
--- /dev/null
+++ b/ncdap_test/tst_ber.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+export SETX=1
+#export NCPATHDEBUG=1
+
+if test "x$srcdir" = x ; then srcdir=`pwd`; fi
+. ../test_common.sh
+
+F="ber-2002-10-01.nc"
+EXPECTED="${srcdir}/expected3"
+
+URL='[log][cache]file://'
+URL="${URL}${srcdir}/testdata3/$F"
+rm -f ./tmp
+${NCDUMP} "${URL}" | sed 's/\\r//g' > ./tmp
+diff -w ${EXPECTED}/$F.dmp ./tmp
+#cleanup
+rm -f ./tmp
+exit
diff --git a/ncdap_test/tst_ncdap.sh b/ncdap_test/tst_ncdap.sh
index cc58538..bf12df1 100755
--- a/ncdap_test/tst_ncdap.sh
+++ b/ncdap_test/tst_ncdap.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+if test "x$SETX" != x ; then set -x ; fi
+
 quiet=0
 leakcheck=0
 
@@ -17,26 +19,14 @@ mode="$3"
 # Locate the testdata and expected directory
 testdata3="${srcdir}/testdata3"
 expected3="${srcdir}/expected3"
-expected4="${srcdir}/expected4"
+
+TITLE="DAP to netCDF-3 translation"
+EXPECTED="$expected3"
+PARAMS="${PARAMS}[cache]"
 
 # get the list of test files
 . ${srcdir}/tst_ncdap_shared.sh
 
-FLAGS=
-
-case "$mode" in
-*3)
-    EXPECTED="$expected3"
-    TITLE="DAP to netCDF-3 translation"
-    PARAMS="${PARAMS}[cache]"
-    ;;
-*4)
-    EXPECTED="$expected4"
-    TITLE="DAP to netCDF-4 translation"
-    PARAMS="${PARAMS}[netcdf4][cache]"
-    ;;
-esac
-
 case "$mode" in
 file*)
     TESTURL="$FILEURL"
@@ -55,8 +45,7 @@ remote*)
 esac
 
 RESULTSDIR="./results"
-# Locate some tools
-NCDUMP="${builddir}/ncdump/ncdump $FLAGS"
+#
 if test "x$leakcheck" = "x1" ; then
 VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
 fi
@@ -84,9 +73,10 @@ for x in ${TESTSET} ; do
     if test "x${t}" = "x${x}" ; then isxfail=1; fi
   done
   ok=1
-  if ${VALGRIND} ${NCDUMP} "${url}" > ${x}.dmp ; then ok=$ok; else ok=0; fi
+  echo command: ${VALGRIND} ${NCDUMP} ${FLAGS} "${url}"
+  if ${VALGRIND} ${NCDUMP} ${FLAGS} "${url}" | sed 's/\\r//g' > ${x}.dmp ; then ok=$ok; else ok=0; fi
   # compare with expected
-  if diff -w ${EXPECTED}/${x}.dmp ${x}.dmp ; then ok=$ok; else ok=0; fi
+  if diff -w ${EXPECTED}/${x}.dmp ${x}.dmp  ; then ok=$ok; else ok=0; fi
   if test "$ok" = 1 ; then
     status=0  # succeed
   elif test "x$isxfail" = "x0" ; then
@@ -94,7 +84,7 @@ for x in ${TESTSET} ; do
   else
     status=2  # xfail
   fi
-  
+
   case "$status" in
   0)
     passcount=`expr $passcount + 1`
@@ -120,7 +110,6 @@ echo "pwd=" `pwd`
 totalcount=`expr $passcount + $failcount + $xfailcount`
 okcount=`expr $passcount + $xfailcount`
 
-
 echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
 
 #failcount=0
diff --git a/ncdap_test/tst_ncdap3.sh b/ncdap_test/tst_ncdap3.sh
index 0f82ff7..4b82159 100755
--- a/ncdap_test/tst_ncdap3.sh
+++ b/ncdap_test/tst_ncdap3.sh
@@ -8,6 +8,6 @@ set -e
 #X="-x"
 #grind="checkleaks"
 
-#exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "file3" $grind
-exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "dds3" $grind
+exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "file" $grind
+#exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "dds" $grind
 
diff --git a/ncdap_test/tst_ncdap_shared.sh b/ncdap_test/tst_ncdap_shared.sh
index 8fbbe7e..00bee51 100755
--- a/ncdap_test/tst_ncdap_shared.sh
+++ b/ncdap_test/tst_ncdap_shared.sh
@@ -1,9 +1,9 @@
-# $Id: tst_ncdap_shared.sh,v 1.9 2009/12/03 03:42:39 dmh Exp $
-
 ##################################################
 # Local test info
 ##################################################
 
+if test "x$SETX" != x ; then set -x ; fi
+
 # Define the complete URLS
 
 FILEURL="file://${testdata3}"
@@ -34,11 +34,13 @@ test.vs2 test.vs3 test.vs4 test.vs5 whoi"
 
 ACTUALDATA2=\
 "123bears.nc 123.nc bears.nc \
-ber-2002-10-01.nc ceopL2AIRS2-2.nc \
+ceopL2AIRS2-2.nc \
 data.nc fnoc1.nc \
 in1.nc in_2.nc in.nc \
 in_no_three_double_dmn.nc in_v.nc saco1.nc \
-test.nc text.nc"
+test.nc text.nc \
+ber-2002-10-01.nc \
+kwcase.nc"
 
 # XFAIL tests should be a subset of the other tests; this is used
 # only to detect which are considered XFAIL tests.
@@ -46,7 +48,7 @@ XFAILTESTS=""
 
 # For now, remove some tests from windows platform.
 if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then
-    XFAILTESTS="$XFAILTESTS EOSDB OverideExample SimpleDrdsExample test.67 test.gr5 123bears.nc 123.nc bears.nc ber-2002-10-01 data.nc in1.nc in_2.nc in_no_three_double_dmn.nc test.nc text.nc test.22 test.23 test.gr1 in.nc ber-2002-10-01.nc"
+    XFAILTESTS="$XFAILTESTS EOSDB OverideExample SimpleDrdsExample test.67 test.gr5 123bears.nc 123.nc bears.nc ber-2002-10-01 data.nc in1.nc in_2.nc in_no_three_double_dmn.nc test.nc text.nc test.22 test.23 test.gr1 in.nc ber-2002-10-01.nc kwcase.nc"
 fi
 
 FILETESTS="${SYNTHETICDATA} ${ACTUALDATA1} ${ACTUALDATA2}"
diff --git a/ncdap_test/tst_remote.sh b/ncdap_test/tst_remote.sh
index f232f81..23042ff 100755
--- a/ncdap_test/tst_remote.sh
+++ b/ncdap_test/tst_remote.sh
@@ -1,8 +1,6 @@
 #!/bin/sh
 
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
+if test "x$SETX" != x ; then set -x ; fi
 set -e
 
 quiet=0
@@ -29,7 +27,7 @@ OCLOGFILE="" ; export OCLOGFILE
 # Capture arguments
 srcdir="$1"
 builddir="$2"
-mode="$3"
+#ignored mode="$3"
 if test "x$4" = "x" ; then cache=1 ; else cache=0; fi
 longtests="$5"
 
@@ -183,22 +181,11 @@ testfile.nc \
 text.nc \
 "
 
-case "$mode" in
-3)
-    EXPECTED="$expected3"
-    TITLE="DAP to netCDF-3 translation"
-    PARAMS="${PARAMS}[netcdf3]"
-    XFAILTESTS="$XFAILTESTS3"
-    SVCFAILTESTS="$SVCFAILTESTS3"
-    ;;
-4)
-    EXPECTED="$expected4"
-    TITLE="DAP to netCDF-4 translation"
-    PARAMS="${PARAMS}[netcdf4]"
-    XFAILTESTS="$XFAILTESTS4"
-    SVCFAILTESTS="$SVCFAILTESTS4"
-    ;;
-esac
+TITLE="DAP to netCDF-3 translation"
+EXPECTED="$expected3"
+PARAMS="${PARAMS}[netcdf3]"
+XFAILTESTS="$XFAILTESTS3"
+SVCFAILTESTS="$SVCFAILTESTS3"
 
 RESULTSDIR="./results"
 # Locate some tools
diff --git a/ncdump/Makefile.in b/ncdump/Makefile.in
index 5f2e373..a009b68 100644
--- a/ncdump/Makefile.in
+++ b/ncdump/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/ncdump/cdl/Makefile.in b/ncdump/cdl/Makefile.in
index 4ff0374..588bdec 100644
--- a/ncdump/cdl/Makefile.in
+++ b/ncdump/cdl/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/ncdump/expected/Makefile.in b/ncdump/expected/Makefile.in
index 80dd2e8..4c6cb07 100644
--- a/ncdump/expected/Makefile.in
+++ b/ncdump/expected/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/ncgen/CMakeLists.txt b/ncgen/CMakeLists.txt
index 6feb4b9..7314ace 100644
--- a/ncgen/CMakeLists.txt
+++ b/ncgen/CMakeLists.txt
@@ -3,7 +3,7 @@ IF(BUILD_SHARED_LIBS AND WIN32)
   remove_definitions(-DDLL_NETCDF)
 ENDIF()
 
-SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c ncgen.h)
+SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ncgen.h)
 
 # don't add the automatically determined parts of the RPATH
 # which point to directories outside the build tree to the install RPATH
diff --git a/ncgen/ConvertUTF.c b/ncgen/ConvertUTF.c
deleted file mode 100644
index 0be73c3..0000000
--- a/ncgen/ConvertUTF.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Copyright 2001-2004 Unicode, Inc.
- * 
- * Disclaimer
- * 
- * This source code is provided as is by Unicode, Inc. No claims are
- * made as to fitness for any particular purpose. No warranties of any
- * kind are expressed or implied. The recipient agrees to determine
- * applicability of information provided. If this file has been
- * purchased on magnetic or optical media from Unicode, Inc., the
- * sole remedy for any claim will be exchange of defective media
- * within 90 days of receipt.
- * 
- * Limitations on Rights to Redistribute This Code
- * 
- * Unicode, Inc. hereby grants the right to freely use the information
- * supplied in this file in the creation of products supporting the
- * Unicode Standard, and to make copies of this file in any form
- * for internal or external distribution as long as this notice
- * remains attached.
- */
-
-/* ---------------------------------------------------------------------
-
-    Conversions between UTF32, UTF-16, and UTF-8. Source code file.
-    Author: Mark E. Davis, 1994.
-    Rev History: Rick McGowan, fixes & updates May 2001.
-    Sept 2001: fixed const & error conditions per
-	mods suggested by S. Parent & A. Lillich.
-    June 2002: Tim Dodd added detection and handling of incomplete
-	source sequences, enhanced error detection, added casts
-	to eliminate compiler warnings.
-    July 2003: slight mods to back out aggressive FFFE detection.
-    Jan 2004: updated switches in from-UTF8 conversions.
-    Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
-
-    See the header file "ConvertUTF.h" for complete documentation.
-
------------------------------------------------------------------------- */
-
-#include "config.h"
-#include "ConvertUTF.h"
-#ifdef CVTUTF_DEBUG
-#include <stdio.h>
-#endif
-
-static const int halfShift  = 10; /* used for shifting by 10 bits */
-
-static const UTF32 halfBase = 0x0010000UL;
-static const UTF32 halfMask = 0x3FFUL;
-
-#define UNI_SUR_HIGH_START  (UTF32)0xD800
-#define UNI_SUR_HIGH_END    (UTF32)0xDBFF
-#define UNI_SUR_LOW_START   (UTF32)0xDC00
-#define UNI_SUR_LOW_END     (UTF32)0xDFFF
-#define false	   0
-#define true	    1
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF32toUTF16 (
-	const UTF32** sourceStart, const UTF32* sourceEnd, 
-	UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
-    ConversionResult result = conversionOK;
-    const UTF32* source = *sourceStart;
-    UTF16* target = *targetStart;
-    while (source < sourceEnd) {
-	UTF32 ch;
-	if (target >= targetEnd) {
-	    result = targetExhausted; break;
-	}
-	ch = *source++;
-	if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
-	    /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
-	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
-		if (flags == strictConversion) {
-		    --source; /* return to the illegal value itself */
-		    result = sourceIllegal;
-		    break;
-		} else {
-		    *target++ = UNI_REPLACEMENT_CHAR;
-		}
-	    } else {
-		*target++ = (UTF16)ch; /* normal case */
-	    }
-	} else if (ch > UNI_MAX_LEGAL_UTF32) {
-	    if (flags == strictConversion) {
-		result = sourceIllegal;
-	    } else {
-		*target++ = UNI_REPLACEMENT_CHAR;
-	    }
-	} else {
-	    /* target is a character in range 0xFFFF - 0x10FFFF. */
-	    if (target + 1 >= targetEnd) {
-		--source; /* Back up source pointer! */
-		result = targetExhausted; break;
-	    }
-	    ch -= halfBase;
-	    *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
-	    *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
-	}
-    }
-    *sourceStart = source;
-    *targetStart = target;
-    return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF16toUTF32 (
-	const UTF16** sourceStart, const UTF16* sourceEnd, 
-	UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
-    ConversionResult result = conversionOK;
-    const UTF16* source = *sourceStart;
-    UTF32* target = *targetStart;
-    UTF32 ch, ch2;
-    while (source < sourceEnd) {
-	const UTF16* oldSource = source; /*  In case we have to back up because of target overflow. */
-	ch = *source++;
-	/* If we have a surrogate pair, convert to UTF32 first. */
-	if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
-	    /* If the 16 bits following the high surrogate are in the source buffer... */
-	    if (source < sourceEnd) {
-		ch2 = *source;
-		/* If it's a low surrogate, convert to UTF32. */
-		if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
-		    ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
-			+ (ch2 - UNI_SUR_LOW_START) + halfBase;
-		    ++source;
-		} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
-		    --source; /* return to the illegal value itself */
-		    result = sourceIllegal;
-		    break;
-		}
-	    } else { /* We don't have the 16 bits following the high surrogate. */
-		--source; /* return to the high surrogate */
-		result = sourceExhausted;
-		break;
-	    }
-	} else if (flags == strictConversion) {
-	    /* UTF-16 surrogate values are illegal in UTF-32 */
-	    if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
-		--source; /* return to the illegal value itself */
-		result = sourceIllegal;
-		break;
-	    }
-	}
-	if (target >= targetEnd) {
-	    source = oldSource; /* Back up source pointer! */
-	    result = targetExhausted; break;
-	}
-	*target++ = ch;
-    }
-    *sourceStart = source;
-    *targetStart = target;
-#ifdef CVTUTF_DEBUG
-if (result == sourceIllegal) {
-    fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
-    fflush(stderr);
-}
-#endif
-    return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Index into the table below with the first byte of a UTF-8 sequence to
- * get the number of trailing bytes that are supposed to follow it.
- * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
- * left as-is for anyone who may want to do such conversion, which was
- * allowed in earlier algorithms.
- */
-static const char trailingBytesForUTF8[256] = {
-    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,
-    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,
-    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,
-    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,
-    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,
-    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,
-    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
-};
-
-/*
- * Magic values subtracted from a buffer value during UTF8 conversion.
- * This table contains as many values as there might be trailing bytes
- * in a UTF-8 sequence.
- */
-static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 
-		     0x03C82080UL, 0xFA082080UL, 0x82082080UL };
-
-/*
- * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
- * into the first byte, depending on how many bytes follow.  There are
- * as many entries in this table as there are UTF-8 sequence types.
- * (I.e., one byte sequence, two byte... etc.). Remember that sequencs
- * for *legal* UTF-8 will be 4 or fewer bytes total.
- */
-static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
-/* --------------------------------------------------------------------- */
-
-/* The interface converts a whole buffer to avoid function-call overhead.
- * Constants have been gathered. Loops & conditionals have been removed as
- * much as possible for efficiency, in favor of drop-through switches.
- * (See "Note A" at the bottom of the file for equivalent code.)
- * If your compiler supports it, the "isLegalUTF8" call can be turned
- * into an inline function.
- */
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF16toUTF8 (
-	const UTF16** sourceStart, const UTF16* sourceEnd, 
-	UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
-    ConversionResult result = conversionOK;
-    const UTF16* source = *sourceStart;
-    UTF8* target = *targetStart;
-    while (source < sourceEnd) {
-	UTF32 ch;
-	unsigned short bytesToWrite = 0;
-	const UTF32 byteMask = 0xBF;
-	const UTF32 byteMark = 0x80; 
-	const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
-	ch = *source++;
-	/* If we have a surrogate pair, convert to UTF32 first. */
-	if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
-	    /* If the 16 bits following the high surrogate are in the source buffer... */
-	    if (source < sourceEnd) {
-		UTF32 ch2 = *source;
-		/* If it's a low surrogate, convert to UTF32. */
-		if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
-		    ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
-			+ (ch2 - UNI_SUR_LOW_START) + halfBase;
-		    ++source;
-		} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
-		    --source; /* return to the illegal value itself */
-		    result = sourceIllegal;
-		    break;
-		}
-	    } else { /* We don't have the 16 bits following the high surrogate. */
-		--source; /* return to the high surrogate */
-		result = sourceExhausted;
-		break;
-	    }
-	} else if (flags == strictConversion) {
-	    /* UTF-16 surrogate values are illegal in UTF-32 */
-	    if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
-		--source; /* return to the illegal value itself */
-		result = sourceIllegal;
-		break;
-	    }
-	}
-	/* Figure out how many bytes the result will require */
-	if (ch < (UTF32)0x80) {	     bytesToWrite = 1;
-	} else if (ch < (UTF32)0x800) {     bytesToWrite = 2;
-	} else if (ch < (UTF32)0x10000) {   bytesToWrite = 3;
-	} else if (ch < (UTF32)0x110000) {  bytesToWrite = 4;
-	} else {			    bytesToWrite = 3;
-					    ch = UNI_REPLACEMENT_CHAR;
-	}
-
-	target += bytesToWrite;
-	if (target > targetEnd) {
-	    source = oldSource; /* Back up source pointer! */
-	    target -= bytesToWrite; result = targetExhausted; break;
-	}
-	switch (bytesToWrite) { /* note: everything falls through. */
-	    case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
-	    case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
-	    case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
-	    case 1: *--target =  (UTF8)(ch | firstByteMark[bytesToWrite]);
-	}
-	target += bytesToWrite;
-    }
-    *sourceStart = source;
-    *targetStart = target;
-    return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Utility routine to tell whether a sequence of bytes is legal UTF-8.
- * This must be called with the length pre-determined by the first byte.
- * If not calling this from ConvertUTF8to*, then the length can be set by:
- *  length = trailingBytesForUTF8[*source]+1;
- * and the sequence is illegal right away if there aren't that many bytes
- * available.
- * If presented with a length > 4, this returns false.  The Unicode
- * definition of UTF-8 goes up to 4-byte sequences.
- */
-
-static Boolean isLegalUTF8(const UTF8 *source, int length) {
-    UTF8 a;
-    const UTF8 *srcptr = source+length;
-    switch (length) {
-    default: return false;
-	/* Everything else falls through when "true"... */
-    case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
-    case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
-    case 2: if ((a = (*--srcptr)) > 0xBF) return false;
-
-	switch (*source) {
-	    /* no fall-through in this inner switch */
-	    case 0xE0: if (a < 0xA0) return false; break;
-	    case 0xED: if (a > 0x9F) return false; break;
-	    case 0xF0: if (a < 0x90) return false; break;
-	    case 0xF4: if (a > 0x8F) return false; break;
-	    default:   if (a < 0x80) return false;
-	}
-
-    case 1: if (*source >= 0x80 && *source < 0xC2) return false;
-    }
-    if (*source > 0xF4) return false;
-    return true;
-}
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Exported function to return whether a UTF-8 sequence is legal or not.
- * This is not used here; it's just exported.
- */
-Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
-    int length = trailingBytesForUTF8[*source]+1;
-    if (source+length > sourceEnd) {
-	return false;
-    }
-    return isLegalUTF8(source, length);
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF8toUTF16 (
-	const UTF8** sourceStart, const UTF8* sourceEnd, 
-	UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
-    ConversionResult result = conversionOK;
-    const UTF8* source = *sourceStart;
-    UTF16* target = *targetStart;
-    while (source < sourceEnd) {
-	UTF32 ch = 0;
-	unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
-	if (source + extraBytesToRead >= sourceEnd) {
-	    result = sourceExhausted; break;
-	}
-	/* Do this check whether lenient or strict */
-	if (! isLegalUTF8(source, extraBytesToRead+1)) {
-	    result = sourceIllegal;
-	    break;
-	}
-	/*
-	 * The cases all fall through. See "Note A" below.
-	 */
-	switch (extraBytesToRead) {
-	    case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
-	    case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
-	    case 3: ch += *source++; ch <<= 6;
-	    case 2: ch += *source++; ch <<= 6;
-	    case 1: ch += *source++; ch <<= 6;
-	    case 0: ch += *source++;
-	}
-	ch -= offsetsFromUTF8[extraBytesToRead];
-
-	if (target >= targetEnd) {
-	    source -= (extraBytesToRead+1); /* Back up source pointer! */
-	    result = targetExhausted; break;
-	}
-	if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
-	    /* UTF-16 surrogate values are illegal in UTF-32 */
-	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
-		if (flags == strictConversion) {
-		    source -= (extraBytesToRead+1); /* return to the illegal value itself */
-		    result = sourceIllegal;
-		    break;
-		} else {
-		    *target++ = UNI_REPLACEMENT_CHAR;
-		}
-	    } else {
-		*target++ = (UTF16)ch; /* normal case */
-	    }
-	} else if (ch > UNI_MAX_UTF16) {
-	    if (flags == strictConversion) {
-		result = sourceIllegal;
-		source -= (extraBytesToRead+1); /* return to the start */
-		break; /* Bail out; shouldn't continue */
-	    } else {
-		*target++ = UNI_REPLACEMENT_CHAR;
-	    }
-	} else {
-	    /* target is a character in range 0xFFFF - 0x10FFFF. */
-	    if (target + 1 >= targetEnd) {
-		source -= (extraBytesToRead+1); /* Back up source pointer! */
-		result = targetExhausted; break;
-	    }
-	    ch -= halfBase;
-	    *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
-	    *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
-	}
-    }
-    *sourceStart = source;
-    *targetStart = target;
-    return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF32toUTF8 (
-	const UTF32** sourceStart, const UTF32* sourceEnd, 
-	UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
-    ConversionResult result = conversionOK;
-    const UTF32* source = *sourceStart;
-    UTF8* target = *targetStart;
-    while (source < sourceEnd) {
-	UTF32 ch;
-	unsigned short bytesToWrite = 0;
-	const UTF32 byteMask = 0xBF;
-	const UTF32 byteMark = 0x80; 
-	ch = *source++;
-	if (flags == strictConversion ) {
-	    /* UTF-16 surrogate values are illegal in UTF-32 */
-	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
-		--source; /* return to the illegal value itself */
-		result = sourceIllegal;
-		break;
-	    }
-	}
-	/*
-	 * Figure out how many bytes the result will require. Turn any
-	 * illegally large UTF32 things (> Plane 17) into replacement chars.
-	 */
-	if (ch < (UTF32)0x80) {	     bytesToWrite = 1;
-	} else if (ch < (UTF32)0x800) {     bytesToWrite = 2;
-	} else if (ch < (UTF32)0x10000) {   bytesToWrite = 3;
-	} else if (ch <= UNI_MAX_LEGAL_UTF32) {  bytesToWrite = 4;
-	} else {			    bytesToWrite = 3;
-					    ch = UNI_REPLACEMENT_CHAR;
-					    result = sourceIllegal;
-	}
-	
-	target += bytesToWrite;
-	if (target > targetEnd) {
-	    --source; /* Back up source pointer! */
-	    target -= bytesToWrite; result = targetExhausted; break;
-	}
-	switch (bytesToWrite) { /* note: everything falls through. */
-	    case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
-	    case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
-	    case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
-	    case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
-	}
-	target += bytesToWrite;
-    }
-    *sourceStart = source;
-    *targetStart = target;
-    return result;
-}
-
-/* --------------------------------------------------------------------- */
-
-ConversionResult ConvertUTF8toUTF32 (
-	const UTF8** sourceStart, const UTF8* sourceEnd, 
-	UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
-    ConversionResult result = conversionOK;
-    const UTF8* source = *sourceStart;
-    UTF32* target = *targetStart;
-    while (source < sourceEnd) {
-	UTF32 ch = 0;
-	unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
-	if (source + extraBytesToRead >= sourceEnd) {
-	    result = sourceExhausted; break;
-	}
-	/* Do this check whether lenient or strict */
-	if (! isLegalUTF8(source, extraBytesToRead+1)) {
-	    result = sourceIllegal;
-	    break;
-	}
-	/*
-	 * The cases all fall through. See "Note A" below.
-	 */
-	switch (extraBytesToRead) {
-	    case 5: ch += *source++; ch <<= 6;
-	    case 4: ch += *source++; ch <<= 6;
-	    case 3: ch += *source++; ch <<= 6;
-	    case 2: ch += *source++; ch <<= 6;
-	    case 1: ch += *source++; ch <<= 6;
-	    case 0: ch += *source++;
-	}
-	ch -= offsetsFromUTF8[extraBytesToRead];
-
-	if (target >= targetEnd) {
-	    source -= (extraBytesToRead+1); /* Back up the source pointer! */
-	    result = targetExhausted; break;
-	}
-	if (ch <= UNI_MAX_LEGAL_UTF32) {
-	    /*
-	     * UTF-16 surrogate values are illegal in UTF-32, and anything
-	     * over Plane 17 (> 0x10FFFF) is illegal.
-	     */
-	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
-		if (flags == strictConversion) {
-		    source -= (extraBytesToRead+1); /* return to the illegal value itself */
-		    result = sourceIllegal;
-		    break;
-		} else {
-		    *target++ = UNI_REPLACEMENT_CHAR;
-		}
-	    } else {
-		*target++ = ch;
-	    }
-	} else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
-	    result = sourceIllegal;
-	    *target++ = UNI_REPLACEMENT_CHAR;
-	}
-    }
-    *sourceStart = source;
-    *targetStart = target;
-    return result;
-}
-
-/* ---------------------------------------------------------------------
-
-    Note A.
-    The fall-through switches in UTF-8 reading code save a
-    temp variable, some decrements & conditionals.  The switches
-    are equivalent to the following loop:
-	{
-	    int tmpBytesToRead = extraBytesToRead+1;
-	    do {
-		ch += *source++;
-		--tmpBytesToRead;
-		if (tmpBytesToRead) ch <<= 6;
-	    } while (tmpBytesToRead > 0);
-	}
-    In UTF-8 writing code, the switches on "bytesToWrite" are
-    similarly unrolled loops.
-
-   --------------------------------------------------------------------- */
diff --git a/ncgen/ConvertUTF.h b/ncgen/ConvertUTF.h
deleted file mode 100644
index e26e7c9..0000000
--- a/ncgen/ConvertUTF.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2001-2004 Unicode, Inc.
- * 
- * Disclaimer
- * 
- * This source code is provided as is by Unicode, Inc. No claims are
- * made as to fitness for any particular purpose. No warranties of any
- * kind are expressed or implied. The recipient agrees to determine
- * applicability of information provided. If this file has been
- * purchased on magnetic or optical media from Unicode, Inc., the
- * sole remedy for any claim will be exchange of defective media
- * within 90 days of receipt.
- * 
- * Limitations on Rights to Redistribute This Code
- * 
- * Unicode, Inc. hereby grants the right to freely use the information
- * supplied in this file in the creation of products supporting the
- * Unicode Standard, and to make copies of this file in any form
- * for internal or external distribution as long as this notice
- * remains attached.
- */
-
-/* ---------------------------------------------------------------------
-
-    Conversions between UTF32, UTF-16, and UTF-8.  Header file.
-
-    Several functions are included here, forming a complete set of
-    conversions between the three formats.  UTF-7 is not included
-    here, but is handled in a separate source file.
-
-    Each of these routines takes pointers to input buffers and output
-    buffers.  The input buffers are const.
-
-    Each routine converts the text between *sourceStart and sourceEnd,
-    putting the result into the buffer between *targetStart and
-    targetEnd. Note: the end pointers are *after* the last item: e.g. 
-    *(sourceEnd - 1) is the last item.
-
-    The return result indicates whether the conversion was successful,
-    and if not, whether the problem was in the source or target buffers.
-    (Only the first encountered problem is indicated.)
-
-    After the conversion, *sourceStart and *targetStart are both
-    updated to point to the end of last text successfully converted in
-    the respective buffers.
-
-    Input parameters:
-	sourceStart - pointer to a pointer to the source buffer.
-		The contents of this are modified on return so that
-		it points at the next thing to be converted.
-	targetStart - similarly, pointer to pointer to the target buffer.
-	sourceEnd, targetEnd - respectively pointers to the ends of the
-		two buffers, for overflow checking only.
-
-    These conversion functions take a ConversionFlags argument. When this
-    flag is set to strict, both irregular sequences and isolated surrogates
-    will cause an error.  When the flag is set to lenient, both irregular
-    sequences and isolated surrogates are converted.
-
-    Whether the flag is strict or lenient, all illegal sequences will cause
-    an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
-    or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
-    must check for illegal sequences.
-
-    When the flag is set to lenient, characters over 0x10FFFF are converted
-    to the replacement character; otherwise (when the flag is set to strict)
-    they constitute an error.
-
-    Output parameters:
-	The value "sourceIllegal" is returned from some routines if the input
-	sequence is malformed.  When "sourceIllegal" is returned, the source
-	value will point to the illegal value that caused the problem. E.g.,
-	in UTF-8 when a sequence is malformed, it points to the start of the
-	malformed sequence.  
-
-    Author: Mark E. Davis, 1994.
-    Rev History: Rick McGowan, fixes & updates May 2001.
-		 Fixes & updates, Sept 2001.
-
------------------------------------------------------------------------- */
-
-/* ---------------------------------------------------------------------
-    The following 4 definitions are compiler-specific.
-    The C standard does not guarantee that wchar_t has at least
-    16 bits, so wchar_t is no less portable than unsigned short!
-    All should be unsigned values to avoid sign extension during
-    bit mask & shift operations.
------------------------------------------------------------------------- */
-
-typedef unsigned long	UTF32;	/* at least 32 bits */
-typedef unsigned short	UTF16;	/* at least 16 bits */
-typedef unsigned char	UTF8;	/* typically 8 bits */
-typedef unsigned char	Boolean; /* 0 or 1 */
-
-/* Some fundamental constants */
-#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
-#define UNI_MAX_BMP (UTF32)0x0000FFFF
-#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
-#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
-#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
-
-typedef enum {
-	conversionOK, 		/* conversion successful */
-	sourceExhausted,	/* partial character in source, but hit end */
-	targetExhausted,	/* insuff. room in target for conversion */
-	sourceIllegal		/* source sequence is illegal/malformed */
-} ConversionResult;
-
-typedef enum {
-	strictConversion = 0,
-	lenientConversion
-} ConversionFlags;
-
-/* This is for C++ and does no harm in C */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ConversionResult ConvertUTF8toUTF16 (
-		const UTF8** sourceStart, const UTF8* sourceEnd, 
-		UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF16toUTF8 (
-		const UTF16** sourceStart, const UTF16* sourceEnd, 
-		UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-		
-ConversionResult ConvertUTF8toUTF32 (
-		const UTF8** sourceStart, const UTF8* sourceEnd, 
-		UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF32toUTF8 (
-		const UTF32** sourceStart, const UTF32* sourceEnd, 
-		UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-		
-ConversionResult ConvertUTF16toUTF32 (
-		const UTF16** sourceStart, const UTF16* sourceEnd, 
-		UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
-
-ConversionResult ConvertUTF32toUTF16 (
-		const UTF32** sourceStart, const UTF32* sourceEnd, 
-		UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
-
-Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
-
-#ifdef __cplusplus
-}
-#endif
-
-/* --------------------------------------------------------------------- */
diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am
index f7a8a05..ee9ec34 100644
--- a/ncgen/Makefile.am
+++ b/ncgen/Makefile.am
@@ -14,7 +14,7 @@ escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c	\
 semantics.c dump.c util.c bytebuffer.c list.c data.h		\
 debug.h generr.h genlib.h includes.h ncgen.h odom.h  dump.h	\
 util.h bytebuffer.h list.h genf77.c f77data.c genj.c jdata.c nc_iter.h	\
-nc_iter.c ConvertUTF.c ConvertUTF.h \
+nc_iter.c \
 ncgeny.c ncgeny.h
 
 # This is the man page.
diff --git a/ncgen/Makefile.in b/ncgen/Makefile.in
index cea3c3d..c2fe4de 100644
--- a/ncgen/Makefile.in
+++ b/ncgen/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -128,7 +128,7 @@ am_ncgen_OBJECTS = generate.$(OBJEXT) main.$(OBJEXT) cdata.$(OBJEXT) \
 	semantics.$(OBJEXT) dump.$(OBJEXT) util.$(OBJEXT) \
 	bytebuffer.$(OBJEXT) list.$(OBJEXT) genf77.$(OBJEXT) \
 	f77data.$(OBJEXT) genj.$(OBJEXT) jdata.$(OBJEXT) \
-	nc_iter.$(OBJEXT) ConvertUTF.$(OBJEXT) ncgeny.$(OBJEXT)
+	nc_iter.$(OBJEXT) ncgeny.$(OBJEXT)
 ncgen_OBJECTS = $(am_ncgen_OBJECTS)
 ncgen_LDADD = $(LDADD)
 ncgen_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
@@ -414,7 +414,7 @@ escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c	\
 semantics.c dump.c util.c bytebuffer.c list.c data.h		\
 debug.h generr.h genlib.h includes.h ncgen.h odom.h  dump.h	\
 util.h bytebuffer.h list.h genf77.c f77data.c genj.c jdata.c nc_iter.h	\
-nc_iter.c ConvertUTF.c ConvertUTF.h \
+nc_iter.c \
 ncgeny.c ncgeny.h
 
 
@@ -539,7 +539,6 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ConvertUTF.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bindata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bytebuffer.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdata.Po at am__quote@
diff --git a/ncgen/escapes.c b/ncgen/escapes.c
index 5f24fa9..3211728 100644
--- a/ncgen/escapes.c
+++ b/ncgen/escapes.c
@@ -5,7 +5,7 @@
  *********************************************************************/
 
 #include "includes.h"
-#include "ConvertUTF.h"
+#include "ncutf8.h"
 
 #define HEXCHARS "0123456789abcdefABCDEF"
 #define OCTCHARS "01234567"
@@ -16,48 +16,6 @@ static char* ccodify(const char*);
 static char* f77codify(const char*);
 static char* jcodify(const char*);
 
-#if 0
-/*
- * Replace escaped chars in CDL representation of name such as
- * 'abc\:def\ gh\\i' with unescaped version, such as 'abc:def gh\i'.
- */
-/* ?? This seems redundant over expand_escapes*/
-void
-deescapify(char* name)
-{
-    const char *cp = name;
-    char *sp;
-    size_t len = strlen(name);
-    char *newname;
-
-    if(strchr(name, '\\') == NULL)
-	return;
-
-    newname = (char *) emalloc(len + 1);
-    cp = name;
-    sp = newname;
-    while(*cp != '\0') { /* delete '\' chars, except change '\\' to '\' */
-	switch (*cp) {
-	case '\\':
-	    if(*(cp+1) == '\\') {
-		*sp++ = '\\';
-		cp++;
-	    }
-	    break;
-	default:
-	    *sp++ = *cp;
-	    break;
-	}
-	cp++;
-    }
-    *sp = '\0';
-    /* ASSERT(strlen(newname) <= strlen(name)); */
-    strncpy(name, newname, len+1); /* watch out for trailing null*/
-    efree(newname);
-    return;
-}
-#endif /*0*/
-
 /*
 Given a character c, fill s with the character suitably escaped.
 E.g. c = '\t' => s="\t"
@@ -368,7 +326,7 @@ to suitably escape c for use with Java.
 */
 
 static void
-jescapifychar(UTF16 c, int quote, Bytebuffer* s)
+jescapifychar(unsigned short c, int quote, Bytebuffer* s)
 {
     /* Separate out ascii from UTF16 */
     if(c <= '\177') {
@@ -422,25 +380,21 @@ jescapifychar(UTF16 c, int quote, Bytebuffer* s)
 char*
 jescapify(char* s0, int quote, size_t len)
 {
+    int stat = NC_NOERR;
     int i;
-    char* result;
-    UTF8* s8;
-    UTF16* s16; /* for storing the utf16 string */
-    UTF16* tmp16; /* for storing the utf16 string */
-    ConversionResult status;
+    char* result = NULL;
+    unsigned char* s8 = NULL;
+    unsigned short* s16 = NULL; /* for storing the utf16 string */
     Bytebuffer* escaped = bbNew();
     size_t len16;
 
-    s16 = emalloc((1+len)*sizeof(UTF16));
-    s8 = (UTF8*)s0;
-    tmp16 = s16;
-    status = ConvertUTF8toUTF16((const UTF8**)&s8,s8+len,&tmp16,tmp16+len,lenientConversion);
-    if(status != conversionOK) {
+    s8 = (unsigned char*)s0;
+    stat = nc_utf8_to_utf16(s8, &s16, &len16);
+    if(stat != NC_NOERR) {
 	derror("Cannot convert UTF8 string to UTF16: %s",s0);
-	return NULL;	
+	if(s16) efree(s16);
+	return NULL;
     }
-    /* Get the length of the utf16 string */
-    len16 = (tmp16 - s16);
     for(i=0;i<len16;i++) {
 	jescapifychar(s16[i],quote,escaped);
     }
diff --git a/ncgen/includes.h b/ncgen/includes.h
index d002bf4..507e9a9 100644
--- a/ncgen/includes.h
+++ b/ncgen/includes.h
@@ -33,6 +33,7 @@
 
 #include "list.h"
 #include "bytebuffer.h"
+#include "nctime.h"
 
 /* Local Configuration flags*/
 #define ENABLE_BINARY
diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c
index 55cd2ef..6e9e8b0 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
 
@@ -26,8 +26,8 @@
 
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -65,7 +65,6 @@ typedef int16_t flex_int16_t;
 typedef uint16_t flex_uint16_t;
 typedef int32_t flex_int32_t;
 typedef uint32_t flex_uint32_t;
-typedef uint64_t flex_uint64_t;
 #else
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
@@ -73,7 +72,6 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -104,6 +102,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -160,7 +160,15 @@ typedef unsigned int flex_uint32_t;
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
 #define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -186,6 +194,7 @@ extern FILE *ncgin, *ncgout;
 #define EOB_ACT_LAST_MATCH 2
 
     #define YY_LESS_LINENO(n)
+    #define YY_LINENO_REWIND_TO(ptr)
     
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
@@ -220,7 +229,7 @@ struct yy_buffer_state
 	/* Number of characters read into yy_ch_buf, not including EOB
 	 * characters.
 	 */
-	yy_size_t yy_n_chars;
+	int yy_n_chars;
 
 	/* Whether we "own" the buffer - i.e., we know we created it,
 	 * and can realloc() it to grow it, and should free() it to
@@ -290,7 +299,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
 /* yy_hold_char holds the character lost when ncgtext is formed. */
 static char yy_hold_char;
-static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
 yy_size_t ncgleng;
 
 /* Points to current character in buffer. */
@@ -362,11 +371,17 @@ extern int ncglineno;
 int ncglineno = 1;
 
 extern char *ncgtext;
+#ifdef yytext_ptr
+#undef yytext_ptr
+#endif
 #define yytext_ptr ncgtext
 
 static yy_state_type yy_get_previous_state (void );
 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
 static int yy_get_next_buffer (void );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
 static void yy_fatal_error (yyconst char msg[]  );
 
 /* Done after the current pattern has been matched and before the
@@ -374,7 +389,7 @@ static void yy_fatal_error (yyconst char msg[]  );
  */
 #define YY_DO_BEFORE_ACTION \
 	(yytext_ptr) = yy_bp; \
-	ncgleng = (yy_size_t) (yy_cp - yy_bp); \
+	ncgleng = (size_t) (yy_cp - yy_bp); \
 	(yy_hold_char) = *yy_cp; \
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
@@ -438,7 +453,7 @@ static yyconst flex_int16_t yy_accept[417] =
        34,   34,   34,   34,   34,    0
     } ;
 
-static yyconst flex_int32_t yy_ec[256] =
+static yyconst YY_CHAR yy_ec[256] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    2,    2,    1,    1,    1,    1,    1,    1,    1,
@@ -470,7 +485,7 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[69] =
+static yyconst YY_CHAR yy_meta[69] =
     {   0,
         1,    1,    2,    1,    1,    1,    3,    4,    5,    5,
         6,    7,    8,    8,    8,    8,    8,    8,    8,    1,
@@ -481,7 +496,7 @@ static yyconst flex_int32_t yy_meta[69] =
        11,   11,   11,   14,    1,   11,   11,   11
     } ;
 
-static yyconst flex_int16_t yy_base[435] =
+static yyconst flex_uint16_t yy_base[435] =
     {   0,
         0,    0,  325,  321,  264,  255,  318, 2347,   67, 2347,
        64,  269,   61,   62,   95,   77,  136,  259,   51,   61,
@@ -585,7 +600,7 @@ static yyconst flex_int16_t yy_def[435] =
       416,  416,  416,  416
     } ;
 
-static yyconst flex_int16_t yy_nxt[2416] =
+static yyconst flex_uint16_t yy_nxt[2416] =
     {   0,
         8,    9,   10,    9,    8,   11,   12,    8,   13,   14,
        15,   16,   17,   18,   18,   18,   18,   18,   18,    8,
@@ -1320,7 +1335,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 1339 "ncgenl.c"
 
 #define INITIAL 0
 #define ST_C_COMMENT 1
@@ -1355,11 +1370,11 @@ void ncgset_extra (YY_EXTRA_TYPE user_defined  );
 
 FILE *ncgget_in (void );
 
-void ncgset_in  (FILE * in_str  );
+void ncgset_in  (FILE * _in_str  );
 
 FILE *ncgget_out (void );
 
-void ncgset_out  (FILE * out_str  );
+void ncgset_out  (FILE * _out_str  );
 
 yy_size_t ncgget_leng (void );
 
@@ -1367,7 +1382,7 @@ char *ncgget_text (void );
 
 int ncgget_lineno (void );
 
-void ncgset_lineno (int line_number  );
+void ncgset_lineno (int _line_number  );
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -1381,8 +1396,12 @@ extern int ncgwrap (void );
 #endif
 #endif
 
+#ifndef YY_NO_UNPUT
+    
     static void yyunput (int c,char *buf_ptr  );
     
+#endif
+
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char *,yyconst char *,int );
 #endif
@@ -1403,7 +1422,12 @@ static int input (void );
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
 #define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -1411,7 +1435,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout )
+#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -1422,7 +1446,7 @@ static int input (void );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		yy_size_t n; \
+		size_t n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -1490,7 +1514,7 @@ extern int ncglex (void);
 
 /* Code executed at the end of each rule. */
 #ifndef YY_BREAK
-#define YY_BREAK break;
+#define YY_BREAK /*LINTED*/break;
 #endif
 
 #define YY_RULE_SETUP \
@@ -1500,14 +1524,10 @@ extern int ncglex (void);
  */
 YY_DECL
 {
-	register yy_state_type yy_current_state;
-	register char *yy_cp, *yy_bp;
-	register int yy_act;
+	yy_state_type yy_current_state;
+	char *yy_cp, *yy_bp;
+	int yy_act;
     
-#line 217 "ncgen.l"
-
-#line 1510 "lex.ncg.c"
-
 	if ( !(yy_init) )
 		{
 		(yy_init) = 1;
@@ -1534,7 +1554,12 @@ YY_DECL
 		ncg_load_buffer_state( );
 		}
 
-	while ( 1 )		/* loops until end-of-file is reached */
+	{
+#line 217 "ncgen.l"
+
+#line 1561 "ncgenl.c"
+
+	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
 		yy_cp = (yy_c_buf_p);
 
@@ -1550,7 +1575,7 @@ YY_DECL
 yy_match:
 		do
 			{
-			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
 			if ( yy_accept[yy_current_state] )
 				{
 				(yy_last_accepting_state) = yy_current_state;
@@ -2119,7 +2144,7 @@ YY_RULE_SETUP
 #line 570 "ncgen.l"
 ECHO;
 	YY_BREAK
-#line 2123 "lex.ncg.c"
+#line 2148 "ncgenl.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(TEXT):
 	yyterminate();
@@ -2251,6 +2276,7 @@ case YY_STATE_EOF(TEXT):
 			"fatal flex scanner internal error--no action found" );
 	} /* end of action switch */
 		} /* end of scanning one token */
+	} /* end of user's declarations */
 } /* end of ncglex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -2262,9 +2288,9 @@ case YY_STATE_EOF(TEXT):
  */
 static int yy_get_next_buffer (void)
 {
-    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-	register char *source = (yytext_ptr);
-	register int number_to_move, i;
+    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	char *source = (yytext_ptr);
+	yy_size_t number_to_move, i;
 	int ret_val;
 
 	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@@ -2293,7 +2319,7 @@ static int yy_get_next_buffer (void)
 	/* Try to read more data. */
 
 	/* First move last chars to start of buffer. */
-	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+	number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 
 	for ( i = 0; i < number_to_move; ++i )
 		*(dest++) = *(source++);
@@ -2313,7 +2339,7 @@ static int yy_get_next_buffer (void)
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
@@ -2375,9 +2401,9 @@ static int yy_get_next_buffer (void)
 	else
 		ret_val = EOB_ACT_CONTINUE_SCAN;
 
-	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+	if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 		/* Extend the array by 50%, plus the number we really need. */
-		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+		int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@@ -2396,14 +2422,14 @@ static int yy_get_next_buffer (void)
 
     static yy_state_type yy_get_previous_state (void)
 {
-	register yy_state_type yy_current_state;
-	register char *yy_cp;
+	yy_state_type yy_current_state;
+	char *yy_cp;
     
 	yy_current_state = (yy_start);
 
 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
 		{
-		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
 		if ( yy_accept[yy_current_state] )
 			{
 			(yy_last_accepting_state) = yy_current_state;
@@ -2428,10 +2454,10 @@ static int yy_get_next_buffer (void)
  */
     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 {
-	register int yy_is_jam;
-    	register char *yy_cp = (yy_c_buf_p);
+	int yy_is_jam;
+    	char *yy_cp = (yy_c_buf_p);
 
-	register YY_CHAR yy_c = 1;
+	YY_CHAR yy_c = 1;
 	if ( yy_accept[yy_current_state] )
 		{
 		(yy_last_accepting_state) = yy_current_state;
@@ -2446,12 +2472,14 @@ static int yy_get_next_buffer (void)
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 	yy_is_jam = (yy_current_state == 416);
 
-	return yy_is_jam ? 0 : yy_current_state;
+		return yy_is_jam ? 0 : yy_current_state;
 }
 
-    static void yyunput (int c, register char * yy_bp )
+#ifndef YY_NO_UNPUT
+
+    static void yyunput (int c, char * yy_bp )
 {
-	register char *yy_cp;
+	char *yy_cp;
     
     yy_cp = (yy_c_buf_p);
 
@@ -2461,10 +2489,10 @@ static int yy_get_next_buffer (void)
 	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
 		{ /* need to shift things up to make room */
 		/* +2 for EOB chars. */
-		register yy_size_t number_to_move = (yy_n_chars) + 2;
-		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+		yy_size_t number_to_move = (yy_n_chars) + 2;
+		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
 					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-		register char *source =
+		char *source =
 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
 		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@@ -2486,6 +2514,8 @@ static int yy_get_next_buffer (void)
 	(yy_c_buf_p) = yy_cp;
 }
 
+#endif
+
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
     static int yyinput (void)
@@ -2534,7 +2564,7 @@ static int yy_get_next_buffer (void)
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( ncgwrap( ) )
-						return 0;
+						return EOF;
 
 					if ( ! (yy_did_buffer_switch_on_eof) )
 						YY_NEW_FILE;
@@ -2635,7 +2665,7 @@ static void ncg_load_buffer_state  (void)
 	if ( ! b )
 		YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" );
 
-	b->yy_buf_size = size;
+	b->yy_buf_size = (yy_size_t)size;
 
 	/* yy_ch_buf has to be 2 characters longer than the size given because
 	 * we need to put in 2 end-of-buffer characters.
@@ -2670,10 +2700,6 @@ static void ncg_load_buffer_state  (void)
 	ncgfree((void *) b  );
 }
 
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a ncgrestart() or at EOF.
@@ -2794,7 +2820,7 @@ static void ncgensure_buffer_stack (void)
 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 		 * immediate realloc on the next call.
          */
-		num_to_alloc = 1;
+		num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
 		(yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								);
@@ -2811,7 +2837,7 @@ static void ncgensure_buffer_stack (void)
 	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 
 		/* Increase the buffer to prepare for a possible push. */
-		int grow_size = 8 /* arbitrary grow size */;
+		yy_size_t grow_size = 8 /* arbitrary grow size */;
 
 		num_to_alloc = (yy_buffer_stack_max) + grow_size;
 		(yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc
@@ -2878,8 +2904,8 @@ YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr )
 
 /** Setup the input buffer state to scan the given bytes. The next call to ncglex() will
  * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * 
  * @return the newly allocated buffer state object.
  */
@@ -2887,7 +2913,8 @@ YY_BUFFER_STATE ncg_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len
 {
 	YY_BUFFER_STATE b;
 	char *buf;
-	yy_size_t n, i;
+	yy_size_t n;
+	yy_size_t i;
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
@@ -2918,7 +2945,7 @@ YY_BUFFER_STATE ncg_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len
 
 static void yy_fatal_error (yyconst char* msg )
 {
-    	(void) fprintf( stderr, "%s\n", msg );
+			(void) fprintf( stderr, "%s\n", msg );
 	exit( YY_EXIT_FAILURE );
 }
 
@@ -2984,29 +3011,29 @@ char *ncgget_text  (void)
 }
 
 /** Set the current line number.
- * @param line_number
+ * @param _line_number line number
  * 
  */
-void ncgset_lineno (int  line_number )
+void ncgset_lineno (int  _line_number )
 {
     
-    ncglineno = line_number;
+    ncglineno = _line_number;
 }
 
 /** Set the input stream. This does not discard the current
  * input buffer.
- * @param in_str A readable stream.
+ * @param _in_str A readable stream.
  * 
  * @see ncg_switch_to_buffer
  */
-void ncgset_in (FILE *  in_str )
+void ncgset_in (FILE *  _in_str )
 {
-        ncgin = in_str ;
+        ncgin = _in_str ;
 }
 
-void ncgset_out (FILE *  out_str )
+void ncgset_out (FILE *  _out_str )
 {
-        ncgout = out_str ;
+        ncgout = _out_str ;
 }
 
 int ncgget_debug  (void)
@@ -3014,9 +3041,9 @@ int ncgget_debug  (void)
         return ncg_flex_debug;
 }
 
-void ncgset_debug (int  bdebug )
+void ncgset_debug (int  _bdebug )
 {
-        ncg_flex_debug = bdebug ;
+        ncg_flex_debug = _bdebug ;
 }
 
 static int yy_init_globals (void)
@@ -3076,7 +3103,8 @@ int ncglex_destroy  (void)
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
 {
-	register int i;
+		
+	int i;
 	for ( i = 0; i < n; ++i )
 		s1[i] = s2[i];
 }
@@ -3085,7 +3113,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
 #ifdef YY_NEED_STRLEN
 static int yy_flex_strlen (yyconst char * s )
 {
-	register int n;
+	int n;
 	for ( n = 0; s[n]; ++n )
 		;
 
@@ -3095,11 +3123,12 @@ static int yy_flex_strlen (yyconst char * s )
 
 void *ncgalloc (yy_size_t  size )
 {
-	return (void *) malloc( size );
+			return (void *) malloc( size );
 }
 
 void *ncgrealloc  (void * ptr, yy_size_t  size )
 {
+		
 	/* The cast to (char *) in the following accommodates both
 	 * implementations that use char* generic pointers, and those
 	 * that use void* generic pointers.  It works with the latter
@@ -3112,7 +3141,7 @@ void *ncgrealloc  (void * ptr, yy_size_t  size )
 
 void ncgfree (void * ptr )
 {
-	free( (char *) ptr );	/* see ncgrealloc() for (char *) cast */
+			free( (char *) ptr );	/* see ncgrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
diff --git a/ncgen/ncgeny.c b/ncgen/ncgeny.c
index 61ad4e3..da81d60 100644
--- a/ncgen/ncgeny.c
+++ b/ncgen/ncgeny.c
@@ -1,14 +1,13 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
+/* A Bison parser, made by GNU Bison 3.0.4.  */
 
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   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
+   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 2, or (at your option)
-   any later version.
+   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
@@ -16,9 +15,7 @@
    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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -47,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "3.0.4"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -55,136 +52,25 @@
 /* Pure parsers.  */
 #define YYPURE 0
 
-/* Using locations.  */
-#define YYLSP_NEEDED 0
+/* Push parsers.  */
+#define YYPUSH 0
 
-/* Substitute the variable and function names.  */
-#define yyparse ncgparse
-#define yylex   ncglex
-#define yyerror ncgerror
-#define yylval  ncglval
-#define yychar  ncgchar
-#define yydebug ncgdebug
-#define yynerrs ncgnerrs
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     NC_UNLIMITED_K = 258,
-     CHAR_K = 259,
-     BYTE_K = 260,
-     SHORT_K = 261,
-     INT_K = 262,
-     FLOAT_K = 263,
-     DOUBLE_K = 264,
-     UBYTE_K = 265,
-     USHORT_K = 266,
-     UINT_K = 267,
-     INT64_K = 268,
-     UINT64_K = 269,
-     IDENT = 270,
-     TERMSTRING = 271,
-     CHAR_CONST = 272,
-     BYTE_CONST = 273,
-     SHORT_CONST = 274,
-     INT_CONST = 275,
-     INT64_CONST = 276,
-     UBYTE_CONST = 277,
-     USHORT_CONST = 278,
-     UINT_CONST = 279,
-     UINT64_CONST = 280,
-     FLOAT_CONST = 281,
-     DOUBLE_CONST = 282,
-     DIMENSIONS = 283,
-     VARIABLES = 284,
-     NETCDF = 285,
-     DATA = 286,
-     TYPES = 287,
-     COMPOUND = 288,
-     ENUM = 289,
-     OPAQUE_ = 290,
-     OPAQUESTRING = 291,
-     GROUP = 292,
-     PATH = 293,
-     FILLMARKER = 294,
-     NIL = 295,
-     _FILLVALUE = 296,
-     _FORMAT = 297,
-     _STORAGE = 298,
-     _CHUNKSIZES = 299,
-     _DEFLATELEVEL = 300,
-     _SHUFFLE = 301,
-     _ENDIANNESS = 302,
-     _NOFILL = 303,
-     _FLETCHER32 = 304,
-     _NCPROPS = 305,
-     _ISNETCDF4 = 306,
-     _SUPERBLOCK = 307,
-     DATASETID = 308
-   };
-#endif
-/* Tokens.  */
-#define NC_UNLIMITED_K 258
-#define CHAR_K 259
-#define BYTE_K 260
-#define SHORT_K 261
-#define INT_K 262
-#define FLOAT_K 263
-#define DOUBLE_K 264
-#define UBYTE_K 265
-#define USHORT_K 266
-#define UINT_K 267
-#define INT64_K 268
-#define UINT64_K 269
-#define IDENT 270
-#define TERMSTRING 271
-#define CHAR_CONST 272
-#define BYTE_CONST 273
-#define SHORT_CONST 274
-#define INT_CONST 275
-#define INT64_CONST 276
-#define UBYTE_CONST 277
-#define USHORT_CONST 278
-#define UINT_CONST 279
-#define UINT64_CONST 280
-#define FLOAT_CONST 281
-#define DOUBLE_CONST 282
-#define DIMENSIONS 283
-#define VARIABLES 284
-#define NETCDF 285
-#define DATA 286
-#define TYPES 287
-#define COMPOUND 288
-#define ENUM 289
-#define OPAQUE_ 290
-#define OPAQUESTRING 291
-#define GROUP 292
-#define PATH 293
-#define FILLMARKER 294
-#define NIL 295
-#define _FILLVALUE 296
-#define _FORMAT 297
-#define _STORAGE 298
-#define _CHUNKSIZES 299
-#define _DEFLATELEVEL 300
-#define _SHUFFLE 301
-#define _ENDIANNESS 302
-#define _NOFILL 303
-#define _FLETCHER32 304
-#define _NCPROPS 305
-#define _ISNETCDF4 306
-#define _SUPERBLOCK 307
-#define DATASETID 308
+/* Pull parsers.  */
+#define YYPULL 1
 
 
+/* Substitute the variable and function names.  */
+#define yyparse         ncgparse
+#define yylex           ncglex
+#define yyerror         ncgerror
+#define yydebug         ncgdebug
+#define yynerrs         ncgnerrs
 
+#define yylval          ncglval
+#define yychar          ncgchar
 
 /* Copy the first part of user declarations.  */
-#line 11 "ncgen.y"
+#line 11 "ncgen.y" /* yacc.c:339  */
 
 /*
 static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
@@ -309,11 +195,15 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl;
 extern int lex_init(void);
 
 
+#line 199 "ncgeny.c" /* yacc.c:339  */
 
-/* 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
@@ -323,37 +213,109 @@ extern int lex_init(void);
 # 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 "ncgeny.h".  */
+#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
+# define YY_NCG_NCGEN_TAB_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+#if YYDEBUG
+extern int ncgdebug;
 #endif
 
+/* Token type.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    NC_UNLIMITED_K = 258,
+    CHAR_K = 259,
+    BYTE_K = 260,
+    SHORT_K = 261,
+    INT_K = 262,
+    FLOAT_K = 263,
+    DOUBLE_K = 264,
+    UBYTE_K = 265,
+    USHORT_K = 266,
+    UINT_K = 267,
+    INT64_K = 268,
+    UINT64_K = 269,
+    IDENT = 270,
+    TERMSTRING = 271,
+    CHAR_CONST = 272,
+    BYTE_CONST = 273,
+    SHORT_CONST = 274,
+    INT_CONST = 275,
+    INT64_CONST = 276,
+    UBYTE_CONST = 277,
+    USHORT_CONST = 278,
+    UINT_CONST = 279,
+    UINT64_CONST = 280,
+    FLOAT_CONST = 281,
+    DOUBLE_CONST = 282,
+    DIMENSIONS = 283,
+    VARIABLES = 284,
+    NETCDF = 285,
+    DATA = 286,
+    TYPES = 287,
+    COMPOUND = 288,
+    ENUM = 289,
+    OPAQUE_ = 290,
+    OPAQUESTRING = 291,
+    GROUP = 292,
+    PATH = 293,
+    FILLMARKER = 294,
+    NIL = 295,
+    _FILLVALUE = 296,
+    _FORMAT = 297,
+    _STORAGE = 298,
+    _CHUNKSIZES = 299,
+    _DEFLATELEVEL = 300,
+    _SHUFFLE = 301,
+    _ENDIANNESS = 302,
+    _NOFILL = 303,
+    _FLETCHER32 = 304,
+    _NCPROPS = 305,
+    _ISNETCDF4 = 306,
+    _SUPERBLOCK = 307,
+    DATASETID = 308
+  };
+#endif
+
+/* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 138 "ncgen.y"
+
+union YYSTYPE
 {
+#line 138 "ncgen.y" /* yacc.c:355  */
+
 Symbol* sym;
 unsigned long  size; /* allow for zero size to indicate e.g. UNLIMITED*/
 long           mark; /* track indices into the sequence*/
 int            nctype; /* for tracking attribute list type*/
 Datalist*      datalist;
 NCConstant       constant;
-}
-/* Line 193 of yacc.c.  */
-#line 344 "ncgen.tab.c"
-	YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
+
+#line 302 "ncgeny.c" /* yacc.c:355  */
+};
+
+typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
 #endif
 
 
+extern YYSTYPE ncglval;
 
-/* Copy the second part of user declarations.  */
+int ncgparse (void);
 
+#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED  */
 
-/* Line 216 of yacc.c.  */
-#line 357 "ncgen.tab.c"
+/* Copy the second part of user declarations.  */
+
+#line 319 "ncgeny.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -367,11 +329,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
@@ -391,8 +350,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
@@ -406,38 +364,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)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma ("GCC diagnostic pop")
 #else
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int i)
-#else
-static int
-YYID (i)
-    int i;
+# define YY_INITIAL_VALUE(Value) Value
 #endif
-{
-  return i;
-}
+#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
 
@@ -456,11 +443,11 @@ YYID (i)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (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 */
-#     ifndef _STDLIB_H
-#      define _STDLIB_H 1
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
 #     endif
 #    endif
 #   endif
@@ -468,8 +455,8 @@ YYID (i)
 # 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
@@ -483,25 +470,23 @@ YYID (i)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
+#  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 _STDLIB_H
-#    define _STDLIB_H 1
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
 #   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined _STDLIB_H && (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 _STDLIB_H && (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
@@ -511,14 +496,14 @@ 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
 {
-  yytype_int16 yyss;
-  YYSTYPE yyvs;
-  };
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -529,42 +514,46 @@ union yyalloc
      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
       + YYSTACK_GAP_MAXIMUM)
 
-/* Copy COUNT objects from FROM to TO.  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)))
-#  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  YYSIZE_T yyi;				\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (YYID (0))
-#  endif
-# endif
+# define YYCOPY_NEEDED 1
 
 /* Relocate STACK from its old location to the new one.  The
    local variables YYSIZE and YYSTACKSIZE give the old and new number of
    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)					\
-    do									\
-      {									\
-	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack, Stack, yysize);				\
-	Stack = &yyptr->Stack;						\
-	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 SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+#  else
+#   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 */
+
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  5
 /* YYLAST -- Last index in YYTABLE.  */
@@ -576,17 +565,19 @@ union yyalloc
 #define YYNNTS  67
 /* YYNRULES -- Number of rules.  */
 #define YYNRULES  151
-/* YYNRULES -- Number of states.  */
+/* YYNSTATES -- Number of states.  */
 #define YYNSTATES  258
 
-/* 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   308
 
-#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,
@@ -623,79 +614,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,     7,     9,    14,    20,    21,    24,    25,
-      26,    36,    37,    39,    42,    44,    47,    49,    51,    54,
-      57,    60,    63,    66,    67,    69,    76,    78,    82,    86,
-      92,    98,   104,   107,   111,   114,   116,   118,   120,   122,
-     124,   126,   128,   130,   132,   134,   136,   137,   139,   142,
-     145,   149,   151,   153,   155,   159,   163,   167,   169,   170,
-     172,   175,   178,   182,   184,   186,   189,   191,   195,   198,
-     199,   203,   205,   209,   211,   213,   217,   220,   221,   225,
-     227,   231,   233,   235,   237,   239,   241,   243,   244,   248,
-     253,   258,   263,   268,   275,   281,   287,   294,   300,   306,
-     312,   318,   324,   330,   336,   341,   343,   345,   346,   348,
-     351,   354,   358,   362,   364,   366,   367,   369,   373,   375,
-     379,   381,   383,   385,   387,   389,   391,   393,   398,   400,
-     404,   406,   408,   410,   412,   414,   416,   418,   420,   422,
-     424,   426,   428,   430,   434,   436,   438,   440,   442,   444,
-     446,   448
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int16 yyrhs[] =
-{
-      64,     0,    -1,    30,    65,    66,    -1,    53,    -1,    54,
-      67,    68,    55,    -1,   110,    72,    87,    93,   113,    -1,
-      -1,    68,    69,    -1,    -1,    -1,    37,   129,    54,    70,
-      67,    68,    71,    55,   110,    -1,    -1,    32,    -1,    32,
-      73,    -1,    75,    -1,    73,    75,    -1,   129,    -1,    76,
-      -1,   111,    56,    -1,    78,    77,    -1,    83,    77,    -1,
-      82,    77,    -1,    81,    77,    -1,    -1,    56,    -1,    86,
-      34,    74,    54,    79,    55,    -1,    80,    -1,    79,    57,
-      80,    -1,   129,    58,   126,    -1,    35,    59,    20,    60,
-      74,    -1,   108,    59,    61,    60,    74,    -1,    33,    74,
-      54,    84,    55,    -1,    85,    56,    -1,    84,    85,    56,
-      -1,   108,   102,    -1,     4,    -1,     5,    -1,     6,    -1,
-       7,    -1,     8,    -1,     9,    -1,    10,    -1,    11,    -1,
-      12,    -1,    13,    -1,    14,    -1,    -1,    28,    -1,    28,
-      88,    -1,    89,    56,    -1,    88,    89,    56,    -1,    90,
-      -1,   111,    -1,    91,    -1,    90,    57,    91,    -1,    92,
-      58,   126,    -1,    92,    58,     3,    -1,   129,    -1,    -1,
-      29,    -1,    29,    94,    -1,    95,    56,    -1,    94,    95,
-      56,    -1,    96,    -1,   111,    -1,   108,    97,    -1,    98,
-      -1,    97,    57,    98,    -1,   129,    99,    -1,    -1,    59,
-     100,    60,    -1,   101,    -1,   100,    57,   101,    -1,   112,
-      -1,   103,    -1,   102,    57,   103,    -1,   129,   104,    -1,
-      -1,    59,   105,    60,    -1,   106,    -1,   105,    57,   106,
-      -1,    24,    -1,    20,    -1,   109,    -1,   109,    -1,   112,
-      -1,    86,    -1,    -1,   111,    56,   110,    -1,    62,    50,
-      58,   127,    -1,    62,    51,    58,   128,    -1,    62,    52,
-      58,   126,    -1,    62,   129,    58,   116,    -1,   108,   109,
-      62,   129,    58,   116,    -1,   109,    62,   129,    58,   116,
-      -1,   109,    62,    41,    58,   116,    -1,   108,   109,    62,
-      41,    58,   116,    -1,   109,    62,    43,    58,   127,    -1,
-     109,    62,    44,    58,   125,    -1,   109,    62,    49,    58,
-     128,    -1,   109,    62,    45,    58,   126,    -1,   109,    62,
-      46,    58,   128,    -1,   109,    62,    47,    58,   127,    -1,
-     109,    62,    48,    58,   128,    -1,    62,    42,    58,   127,
-      -1,   129,    -1,    38,    -1,    -1,    31,    -1,    31,   114,
-      -1,   115,    56,    -1,   114,   115,    56,    -1,   107,    58,
-     116,    -1,   117,    -1,   118,    -1,    -1,   119,    -1,   116,
-      57,   119,    -1,   120,    -1,    54,   116,    55,    -1,   124,
-      -1,    36,    -1,    39,    -1,    40,    -1,   121,    -1,   122,
-      -1,   112,    -1,   129,    59,   123,    60,    -1,   124,    -1,
-     123,    57,   124,    -1,    17,    -1,    18,    -1,    19,    -1,
-      20,    -1,    21,    -1,    22,    -1,    23,    -1,    24,    -1,
-      25,    -1,    26,    -1,    27,    -1,    16,    -1,   126,    -1,
-     125,    57,   126,    -1,    20,    -1,    24,    -1,    21,    -1,
-      25,    -1,    16,    -1,   127,    -1,   126,    -1,    15,    -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,   218,   218,   224,   226,   233,   240,   240,   243,   252,
@@ -717,7 +636,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[] =
@@ -734,24 +653,24 @@ static const char *const yytname[] =
   "_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", "DATASETID", "'{'", "'}'",
   "';'", "','", "'='", "'('", "')'", "'*'", "':'", "$accept", "ncdesc",
   "datasetid", "rootgroup", "groupbody", "subgrouplist", "namedgroup",
-  "@1", "@2", "typesection", "typedecls", "typename", "type_or_attr_decl",
-  "typedecl", "optsemicolon", "enumdecl", "enumidlist", "enumid",
-  "opaquedecl", "vlendecl", "compounddecl", "fields", "field", "primtype",
-  "dimsection", "dimdecls", "dim_or_attr_decl", "dimdeclist", "dimdecl",
-  "dimd", "vasection", "vadecls", "vadecl_or_attr", "vardecl", "varlist",
-  "varspec", "dimspec", "dimlist", "dimref", "fieldlist", "fieldspec",
-  "fielddimspec", "fielddimlist", "fielddim", "varref", "typeref",
-  "type_var_ref", "attrdecllist", "attrdecl", "path", "datasection",
-  "datadecls", "datadecl", "datalist", "datalist0", "datalist1",
-  "dataitem", "constdata", "econstref", "function", "arglist",
-  "simpleconstant", "intlist", "constint", "conststring", "constbool",
-  "ident", 0
+  "$@1", "$@2", "typesection", "typedecls", "typename",
+  "type_or_attr_decl", "typedecl", "optsemicolon", "enumdecl",
+  "enumidlist", "enumid", "opaquedecl", "vlendecl", "compounddecl",
+  "fields", "field", "primtype", "dimsection", "dimdecls",
+  "dim_or_attr_decl", "dimdeclist", "dimdecl", "dimd", "vasection",
+  "vadecls", "vadecl_or_attr", "vardecl", "varlist", "varspec", "dimspec",
+  "dimlist", "dimref", "fieldlist", "fieldspec", "fielddimspec",
+  "fielddimlist", "fielddim", "varref", "typeref", "type_var_ref",
+  "attrdecllist", "attrdecl", "path", "datasection", "datadecls",
+  "datadecl", "datalist", "datalist0", "datalist1", "dataitem",
+  "constdata", "econstref", "function", "arglist", "simpleconstant",
+  "intlist", "constint", "conststring", "constbool", "ident", 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,
@@ -764,96 +683,18 @@ static const yytype_uint16 yytoknum[] =
 };
 # endif
 
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    63,    64,    65,    66,    67,    68,    68,    70,    71,
-      69,    72,    72,    72,    73,    73,    74,    75,    75,    76,
-      76,    76,    76,    77,    77,    78,    79,    79,    80,    81,
-      82,    83,    84,    84,    85,    86,    86,    86,    86,    86,
-      86,    86,    86,    86,    86,    86,    87,    87,    87,    88,
-      88,    89,    89,    90,    90,    91,    91,    92,    93,    93,
-      93,    94,    94,    95,    95,    96,    97,    97,    98,    99,
-      99,   100,   100,   101,   102,   102,   103,   104,   104,   105,
-     105,   106,   106,   107,   108,   109,   109,   110,   110,   111,
-     111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
-     111,   111,   111,   111,   111,   112,   112,   113,   113,   113,
-     114,   114,   115,   116,   116,   117,   118,   118,   119,   119,
-     120,   120,   120,   120,   120,   120,   121,   122,   123,   123,
-     124,   124,   124,   124,   124,   124,   124,   124,   124,   124,
-     124,   124,   125,   125,   126,   126,   126,   126,   127,   128,
-     128,   129
-};
+#define YYPACT_NINF -133
 
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     3,     1,     4,     5,     0,     2,     0,     0,
-       9,     0,     1,     2,     1,     2,     1,     1,     2,     2,
-       2,     2,     2,     0,     1,     6,     1,     3,     3,     5,
-       5,     5,     2,     3,     2,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     0,     1,     2,     2,
-       3,     1,     1,     1,     3,     3,     3,     1,     0,     1,
-       2,     2,     3,     1,     1,     2,     1,     3,     2,     0,
-       3,     1,     3,     1,     1,     3,     2,     0,     3,     1,
-       3,     1,     1,     1,     1,     1,     1,     0,     3,     4,
-       4,     4,     4,     6,     5,     5,     6,     5,     5,     5,
-       5,     5,     5,     5,     4,     1,     1,     0,     1,     2,
-       2,     3,     3,     1,     1,     0,     1,     3,     1,     3,
-       1,     1,     1,     1,     1,     1,     1,     4,     1,     3,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     3,     1,     1,     1,     1,     1,     1,
-       1,     1
-};
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-133)))
 
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       0,     0,     0,     3,     0,     1,    87,     2,    35,    36,
-      37,    38,    39,    40,    41,    42,    43,    44,    45,   151,
-     106,     0,     6,    86,     0,    84,    11,     0,    85,   105,
-       0,     0,     0,     0,     0,     0,     0,     0,    12,    46,
-      87,     0,     0,     0,     0,   115,     0,     4,     7,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    13,    14,    17,    23,    23,    23,    23,    86,     0,
-       0,    47,    58,    88,   148,   104,    89,   144,   146,   145,
-     147,   150,   149,    90,    91,   141,   130,   131,   132,   133,
-     134,   135,   136,   137,   138,   139,   140,   121,   122,   123,
-     115,   126,    92,   113,   114,   116,   118,   124,   125,   120,
-     105,     0,     0,     0,   115,     0,     0,     0,     0,     0,
-       0,     0,   115,     0,    16,     0,    15,    24,    19,    22,
-      21,    20,     0,     0,    18,    48,     0,    51,    53,     0,
-      52,   105,    59,   107,     0,     0,     0,     8,   115,   115,
-      95,    97,    98,   142,   100,   101,   102,   103,    99,    94,
-       0,     0,     0,     0,     0,    49,     0,     0,    60,     0,
-      63,     0,    64,   108,     5,   119,   117,     0,   128,    87,
-      96,    93,     0,     0,     0,     0,    84,     0,     0,     0,
-      50,    54,    57,    56,    55,     0,    61,    65,    66,    69,
-       0,    83,   109,     0,     0,   127,     6,   143,    31,     0,
-      32,    34,    74,    77,    29,     0,    26,     0,    30,    62,
-       0,     0,    68,   115,     0,   110,   129,     9,    33,     0,
-       0,    76,    25,     0,     0,    67,    69,     0,    71,    73,
-     112,   111,     0,    75,    82,    81,     0,    79,    27,    28,
-       0,    70,    87,     0,    78,    72,    10,    80
-};
+#define YYTABLE_NINF -106
 
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int16 yydefgoto[] =
-{
-      -1,     2,     4,     7,    22,    35,    48,   179,   242,    39,
-      61,   123,    62,    63,   128,    64,   215,   216,    65,    66,
-      67,   183,   184,    23,    72,   135,   136,   137,   138,   139,
-     143,   168,   169,   170,   197,   198,   222,   237,   238,   211,
-     212,   231,   246,   247,   200,    24,    25,    26,    27,    28,
-     174,   202,   203,   102,   103,   104,   105,   106,   107,   108,
-     177,   109,   152,    81,    82,    83,    29
-};
+#define yytable_value_is_error(Yytable_value) \
+  0
 
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -133
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
 static const yytype_int16 yypact[] =
 {
      -11,   -48,    20,  -133,   -19,  -133,   210,  -133,  -133,  -133,
@@ -884,7 +725,40 @@ static const yytype_int16 yypact[] =
      -12,  -133,   210,    -2,  -133,  -133,  -133,  -133
 };
 
-/* YYPGOTO[NTERM-NUM].  */
+  /* 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,     0,     0,     3,     0,     1,    87,     2,    35,    36,
+      37,    38,    39,    40,    41,    42,    43,    44,    45,   151,
+     106,     0,     6,    86,     0,    84,    11,     0,    85,   105,
+       0,     0,     0,     0,     0,     0,     0,     0,    12,    46,
+      87,     0,     0,     0,     0,   115,     0,     4,     7,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    13,    14,    17,    23,    23,    23,    23,    86,     0,
+       0,    47,    58,    88,   148,   104,    89,   144,   146,   145,
+     147,   150,   149,    90,    91,   141,   130,   131,   132,   133,
+     134,   135,   136,   137,   138,   139,   140,   121,   122,   123,
+     115,   126,    92,   113,   114,   116,   118,   124,   125,   120,
+     105,     0,     0,     0,   115,     0,     0,     0,     0,     0,
+       0,     0,   115,     0,    16,     0,    15,    24,    19,    22,
+      21,    20,     0,     0,    18,    48,     0,    51,    53,     0,
+      52,   105,    59,   107,     0,     0,     0,     8,   115,   115,
+      95,    97,    98,   142,   100,   101,   102,   103,    99,    94,
+       0,     0,     0,     0,     0,    49,     0,     0,    60,     0,
+      63,     0,    64,   108,     5,   119,   117,     0,   128,    87,
+      96,    93,     0,     0,     0,     0,    84,     0,     0,     0,
+      50,    54,    57,    56,    55,     0,    61,    65,    66,    69,
+       0,    83,   109,     0,     0,   127,     6,   143,    31,     0,
+      32,    34,    74,    77,    29,     0,    26,     0,    30,    62,
+       0,     0,    68,   115,     0,   110,   129,     9,    33,     0,
+       0,    76,    25,     0,     0,    67,    69,     0,    71,    73,
+     112,   111,     0,    75,    82,    81,     0,    79,    27,    28,
+       0,    70,    87,     0,    78,    72,    10,    80
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
     -133,  -133,  -133,  -133,    28,     4,  -133,  -133,  -133,  -133,
@@ -896,11 +770,21 @@ static const yytype_int16 yypgoto[] =
     -133,  -132,  -133,   -42,   -31,   -76,   -21
 };
 
-/* 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 zero, do what YYDEFACT says.
-   If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -106
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int16 yydefgoto[] =
+{
+      -1,     2,     4,     7,    22,    35,    48,   179,   242,    39,
+      61,   123,    62,    63,   128,    64,   215,   216,    65,    66,
+      67,   183,   184,    23,    72,   135,   136,   137,   138,   139,
+     143,   168,   169,   170,   197,   198,   222,   237,   238,   211,
+     212,   231,   246,   247,   200,    24,    25,    26,    27,    28,
+     174,   202,   203,   102,   103,   104,   105,   106,   107,   108,
+     177,   109,   152,    81,    82,    83,    29
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int16 yytable[] =
 {
       34,    73,    84,    19,   101,     3,    36,   144,    70,    69,
@@ -985,8 +869,8 @@ static const yytype_int16 yycheck[] =
       38
 };
 
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
        0,    30,    64,    53,    65,     0,    54,    66,     4,     5,
@@ -1017,96 +901,84 @@ static const yytype_uint8 yystos[] =
       57,    60,    55,    57,    60,   101,   110,   106
 };
 
-#define yyerrok		(yyerrstatus = 0)
-#define yyclearin	(yychar = YYEMPTY)
-#define YYEMPTY		(-2)
-#define YYEOF		0
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    63,    64,    65,    66,    67,    68,    68,    70,    71,
+      69,    72,    72,    72,    73,    73,    74,    75,    75,    76,
+      76,    76,    76,    77,    77,    78,    79,    79,    80,    81,
+      82,    83,    84,    84,    85,    86,    86,    86,    86,    86,
+      86,    86,    86,    86,    86,    86,    87,    87,    87,    88,
+      88,    89,    89,    90,    90,    91,    91,    92,    93,    93,
+      93,    94,    94,    95,    95,    96,    97,    97,    98,    99,
+      99,   100,   100,   101,   102,   102,   103,   104,   104,   105,
+     105,   106,   106,   107,   108,   109,   109,   110,   110,   111,
+     111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
+     111,   111,   111,   111,   111,   112,   112,   113,   113,   113,
+     114,   114,   115,   116,   116,   117,   118,   118,   119,   119,
+     120,   120,   120,   120,   120,   120,   121,   122,   123,   123,
+     124,   124,   124,   124,   124,   124,   124,   124,   124,   124,
+     124,   124,   125,   125,   126,   126,   126,   126,   127,   128,
+     128,   129
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     3,     1,     4,     5,     0,     2,     0,     0,
+       9,     0,     1,     2,     1,     2,     1,     1,     2,     2,
+       2,     2,     2,     0,     1,     6,     1,     3,     3,     5,
+       5,     5,     2,     3,     2,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     0,     1,     2,     2,
+       3,     1,     1,     1,     3,     3,     3,     1,     0,     1,
+       2,     2,     3,     1,     1,     2,     1,     3,     2,     0,
+       3,     1,     3,     1,     1,     3,     2,     0,     3,     1,
+       3,     1,     1,     1,     1,     1,     1,     0,     3,     4,
+       4,     4,     4,     6,     5,     5,     6,     5,     5,     5,
+       5,     5,     5,     5,     4,     1,     1,     0,     1,     2,
+       2,     3,     3,     1,     1,     0,     1,     3,     1,     3,
+       1,     1,     1,     1,     1,     1,     1,     4,     1,     3,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     3,     1,     1,     1,     1,     1,     1,
+       1,     1
+};
 
-#define YYACCEPT	goto yyacceptlab
-#define YYABORT		goto yyabortlab
-#define YYERROR		goto yyerrorlab
 
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
 
-/* 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.  */
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
 
-#define YYFAIL		goto yyerrlab
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)					\
-do								\
-  if (yychar == YYEMPTY && yylen == 1)				\
-    {								\
-      yychar = (Token);						\
-      yylval = (Value);						\
-      yytoken = YYTRANSLATE (yychar);				\
-      YYPOPSTACK (1);						\
-      goto yybackup;						\
-    }								\
-  else								\
-    {								\
+#define YYBACKUP(Token, Value)                                  \
+do                                                              \
+  if (yychar == YYEMPTY)                                        \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      YYPOPSTACK (yylen);                                       \
+      yystate = *yyssp;                                         \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
       yyerror (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
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
 
+/* Error token number */
+#define YYTERROR        1
+#define YYERRCODE       256
 
-/* YY_LOCATION_PRINT -- Print the location on the stream.
-   This macro was not mandated originally: define only if we know
-   we won't break user code: when these are the locations we know.  */
-
-#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-#  define YY_LOCATION_PRINT(File, Loc)			\
-     fprintf (File, "%d.%d-%d.%d",			\
-	      (Loc).first_line, (Loc).first_column,	\
-	      (Loc).last_line,  (Loc).last_column)
-# else
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
 
 
-/* YYLEX -- calling `yylex' with the right arguments.  */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
-
 /* Enable debugging if requested.  */
 #if YYDEBUG
 
@@ -1115,54 +987,46 @@ 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)
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
-do {									  \
-  if (yydebug)								  \
-    {									  \
-      YYFPRINTF (stderr, "%s ", Title);					  \
-      yy_symbol_print (stderr,						  \
-		  Type, Value); \
-      YYFPRINTF (stderr, "\n");						  \
-    }									  \
-} while (YYID (0))
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+/*----------------------------------------.
+| 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)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
 {
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
-  YYUSE (yyoutput);
 # endif
-  switch (yytype)
-    {
-      default:
-	break;
-    }
+  YYUSE (yytype);
 }
 
 
@@ -1170,22 +1034,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
 {
-  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);
   YYFPRINTF (yyoutput, ")");
@@ -1196,66 +1049,54 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
-#else
-static void
-yy_stack_print (bottom, top)
-    yytype_int16 *bottom;
-    yytype_int16 *top;
-#endif
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   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)
-#else
 static void
-yy_reduce_print (yyvsp, yyrule)
-    YYSTYPE *yyvsp;
-    int yyrule;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
 {
+  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++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-		       &(yyvsp[(yyi + 1) - (yynrhs)])
-		       		       );
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                                              );
+      YYFPRINTF (stderr, "\n");
     }
 }
 
-# define YY_REDUCE_PRINT(Rule)		\
-do {					\
-  if (yydebug)				\
-    yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -1269,7 +1110,7 @@ int yydebug;
 
 
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef	YYINITDEPTH
+#ifndef YYINITDEPTH
 # define YYINITDEPTH 200
 #endif
 
@@ -1284,7 +1125,6 @@ int yydebug;
 # define YYMAXDEPTH 10000
 #endif
 
-

 
 #if YYERROR_VERBOSE
 
@@ -1293,15 +1133,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++)
@@ -1317,16 +1150,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;
@@ -1356,27 +1181,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: ;
     }
 
@@ -1387,211 +1212,209 @@ yytnamerr (char *yyres, const char *yystr)
 }
 # endif
 
-/* Copy into YYRESULT an error message about the unexpected token
-   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
-   including the terminating null byte.  If YYRESULT is null, do not
-   copy anything; just return the number of bytes that would be
-   copied.  As a special case, return 0 if an ordinary "syntax error"
-   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
-   size calculation.  */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
+
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
 {
-  int yyn = yypact[yystate];
+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULLPTR;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
+    {
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                {
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
+              }
+        }
+    }
 
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
-    return 0;
-  else
+  switch (yycount)
     {
-      int yytype = YYTRANSLATE (yychar);
-      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
-      YYSIZE_T yysize = yysize0;
-      YYSIZE_T yysize1;
-      int yysize_overflow = 0;
-      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-      int yyx;
-
-# if 0
-      /* This is so xgettext sees the translatable formats that are
-	 constructed on the fly.  */
-      YY_("syntax error, unexpected %s");
-      YY_("syntax error, unexpected %s, expecting %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
-      char *yyfmt;
-      char const *yyf;
-      static char const yyunexpected[] = "syntax error, unexpected %s";
-      static char const yyexpecting[] = ", expecting %s";
-      static char const yyor[] = " or %s";
-      char yyformat[sizeof yyunexpected
-		    + sizeof yyexpecting - 1
-		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
-		       * (sizeof yyor - 1))];
-      char const *yyprefix = yyexpecting;
-
-      /* Start YYX at -YYN if negative to avoid negative indexes in
-	 YYCHECK.  */
-      int yyxbegin = yyn < 0 ? -yyn : 0;
-
-      /* Stay within bounds of both yycheck and yytname.  */
-      int yychecklim = YYLAST - yyn + 1;
-      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-      int yycount = 1;
-
-      yyarg[0] = yytname[yytype];
-      yyfmt = yystpcpy (yyformat, yyunexpected);
-
-      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-	  {
-	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-	      {
-		yycount = 1;
-		yysize = yysize0;
-		yyformat[sizeof yyunexpected - 1] = '\0';
-		break;
-	      }
-	    yyarg[yycount++] = yytname[yyx];
-	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-	    yysize_overflow |= (yysize1 < yysize);
-	    yysize = yysize1;
-	    yyfmt = yystpcpy (yyfmt, yyprefix);
-	    yyprefix = yyor;
-	  }
-
-      yyf = YY_(yyformat);
-      yysize1 = yysize + yystrlen (yyf);
-      yysize_overflow |= (yysize1 < yysize);
-      yysize = yysize1;
-
-      if (yysize_overflow)
-	return YYSIZE_MAXIMUM;
-
-      if (yyresult)
-	{
-	  /* Avoid sprintf, as that infringes on the user's name space.
-	     Don't have undefined behavior even if the translation
-	     produced a string with the wrong number of "%s"s.  */
-	  char *yyp = yyresult;
-	  int yyi = 0;
-	  while ((*yyp = *yyf) != '\0')
-	    {
-	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
-		{
-		  yyp += yytnamerr (yyp, yyarg[yyi++]);
-		  yyf += 2;
-		}
-	      else
-		{
-		  yyp++;
-		  yyf++;
-		}
-	    }
-	}
-      return yysize;
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
     }
+
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
+
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
+    }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
 }
 #endif /* YYERROR_VERBOSE */
-

 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-#endif
 {
   YYUSE (yyvaluep);
-
   if (!yymsg)
     yymsg = "Deleting";
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
-  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 (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
 
 
-
-/* The look-ahead symbol.  */
+/* The lookahead symbol.  */
 int yychar;
 
-/* The semantic value of the look-ahead symbol.  */
+/* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
-
 /* Number of syntax errors so far.  */
 int yynerrs;
 
 
-
 /*----------.
 | yyparse.  |
 `----------*/
 
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 int
 yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
 {
-  
-  int yystate;
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
+
+    /* The stacks and their tools:
+       'yyss': related to states.
+       'yyvs': related to semantic values.
+
+       Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
+
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
+
+    YYSIZE_T yystacksize;
+
   int yyn;
   int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
+  /* Lookahead token as an internal (translated) token number.  */
   int yytoken = 0;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
 #if YYERROR_VERBOSE
   /* Buffer for error messages, and its allocated size.  */
   char yymsgbuf[128];
@@ -1599,54 +1422,22 @@ yyparse ()
   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 #endif
 
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
-
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
-
-  /* The state stack.  */
-  yytype_int16 yyssa[YYINITDEPTH];
-  yytype_int16 *yyss = yyssa;
-  yytype_int16 *yyssp;
-
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  YYSTYPE *yyvsp;
-
-
-
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
-  YYSIZE_T yystacksize = YYINITDEPTH;
-
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
-
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
+  yyssp = yyss = yyssa;
+  yyvsp = yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY;		/* Cause a token to be read.  */
-
-  /* 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;
-
+  yychar = YYEMPTY; /* Cause a token to be read.  */
   goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -1667,25 +1458,23 @@ yyparse ()
 
 #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
@@ -1693,23 +1482,22 @@ yyparse ()
 # 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);
-	YYSTACK_RELOCATE (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 */
@@ -1717,16 +1505,18 @@ yyparse ()
       yyssp = yyss + yysize - 1;
       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));
 
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
   goto yybackup;
 
 /*-----------.
@@ -1735,20 +1525,20 @@ yyparse ()
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
+     lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to look-ahead token.  */
+  /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
-  if (yyn == YYPACT_NINF)
+  if (yypact_value_is_default (yyn))
     goto yydefault;
 
-  /* Not known => get a look-ahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
+      yychar = yylex ();
     }
 
   if (yychar <= YYEOF)
@@ -1770,29 +1560,27 @@ yybackup:
   yyn = yytable[yyn];
   if (yyn <= 0)
     {
-      if (yyn == 0 || yyn == YYTABLE_NINF)
-	goto yyerrlab;
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the look-ahead token.  */
+  /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
 
   yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
   goto yynewstate;
 
@@ -1815,7 +1603,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
@@ -1829,75 +1617,84 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 221 "ncgen.y"
-    {if (error_count > 0) YYABORT;;}
+#line 221 "ncgen.y" /* yacc.c:1646  */
+    {if (error_count > 0) YYABORT;}
+#line 1623 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 3:
-#line 224 "ncgen.y"
-    {createrootgroup(datasetname);;}
+#line 224 "ncgen.y" /* yacc.c:1646  */
+    {createrootgroup(datasetname);}
+#line 1629 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 8:
-#line 243 "ncgen.y"
+#line 243 "ncgen.y" /* yacc.c:1646  */
     {
-		Symbol* id = (yyvsp[(2) - (3)].sym);
+		Symbol* id = (yyvsp[-1].sym);
                 markcdf4("Group specification");
 		if(creategroup(id) == NULL)
                     yyerror("duplicate group declaration within parent group for %s",
                                 id->name);
-            ;}
+            }
+#line 1641 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 9:
-#line 252 "ncgen.y"
-    {listpop(groupstack);;}
+#line 252 "ncgen.y" /* yacc.c:1646  */
+    {listpop(groupstack);}
+#line 1647 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 12:
-#line 258 "ncgen.y"
-    {;}
+#line 258 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1653 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 13:
-#line 260 "ncgen.y"
-    {markcdf4("Type specification");;}
+#line 260 "ncgen.y" /* yacc.c:1646  */
+    {markcdf4("Type specification");}
+#line 1659 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 16:
-#line 266 "ncgen.y"
+#line 266 "ncgen.y" /* yacc.c:1646  */
     { /* Use when defining a type */
-              (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE;
-              if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym)))
+              (yyvsp[0].sym)->objectclass = NC_TYPE;
+              if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym)))
                     yyerror("duplicate type declaration for %s",
-                            (yyvsp[(1) - (1)].sym)->name);
-              listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym));
-	    ;}
+                            (yyvsp[0].sym)->name);
+              listpush(typdefs,(void*)(yyvsp[0].sym));
+	    }
+#line 1671 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 17:
-#line 275 "ncgen.y"
-    {;}
+#line 275 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1677 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 275 "ncgen.y"
-    {;}
+#line 275 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1683 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 25:
-#line 289 "ncgen.y"
+#line 289 "ncgen.y" /* yacc.c:1646  */
     {
 		int i;
-                addtogroup((yyvsp[(3) - (6)].sym)); /* sets prefix*/
-                (yyvsp[(3) - (6)].sym)->objectclass=NC_TYPE;
-                (yyvsp[(3) - (6)].sym)->subclass=NC_ENUM;
-                (yyvsp[(3) - (6)].sym)->typ.basetype=(yyvsp[(1) - (6)].sym);
-                (yyvsp[(3) - (6)].sym)->typ.size = (yyvsp[(1) - (6)].sym)->typ.size;
-                (yyvsp[(3) - (6)].sym)->typ.alignment = (yyvsp[(1) - (6)].sym)->typ.alignment;
-                stackbase=(yyvsp[(5) - (6)].mark);
+                addtogroup((yyvsp[-3].sym)); /* sets prefix*/
+                (yyvsp[-3].sym)->objectclass=NC_TYPE;
+                (yyvsp[-3].sym)->subclass=NC_ENUM;
+                (yyvsp[-3].sym)->typ.basetype=(yyvsp[-5].sym);
+                (yyvsp[-3].sym)->typ.size = (yyvsp[-5].sym)->typ.size;
+                (yyvsp[-3].sym)->typ.alignment = (yyvsp[-5].sym)->typ.alignment;
+                stackbase=(yyvsp[-1].mark);
                 stacklen=listlength(stack);
-                (yyvsp[(3) - (6)].sym)->subnodes = listnew();
+                (yyvsp[-3].sym)->subnodes = listnew();
                 /* Variety of field fixups*/
 		/* 1. add in the enum values*/
 		/* 2. make this type be their container*/
@@ -1907,83 +1704,89 @@ yyreduce:
                    Symbol* eid = (Symbol*)listget(stack,i);
 		   assert(eid->subclass == NC_ECONST);
 		   addtogroup(eid);
-                   listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid);
-                   eid->container = (yyvsp[(3) - (6)].sym);
-		   eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype;
+                   listpush((yyvsp[-3].sym)->subnodes,(void*)eid);
+                   eid->container = (yyvsp[-3].sym);
+		   eid->typ.basetype = (yyvsp[-3].sym)->typ.basetype;
                 }
                 listsetlength(stack,stackbase);/* remove stack nodes*/
-              ;}
+              }
+#line 1714 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 318 "ncgen.y"
-    {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;}
+#line 318 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 1720 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 320 "ncgen.y"
+#line 320 "ncgen.y" /* yacc.c:1646  */
     {
 		    int i;
-		    (yyval.mark)=(yyvsp[(1) - (3)].mark);
+		    (yyval.mark)=(yyvsp[-2].mark);
 		    /* check for duplicates*/
-		    stackbase=(yyvsp[(1) - (3)].mark);
+		    stackbase=(yyvsp[-2].mark);
 		    stacklen=listlength(stack);
 		    for(i=stackbase;i<stacklen;i++) {
 		      Symbol* elem = (Symbol*)listget(stack,i);
-		      if(strcmp((yyvsp[(3) - (3)].sym)->name,elem->name)==0)
+		      if(strcmp((yyvsp[0].sym)->name,elem->name)==0)
   	                yyerror("duplicate enum declaration for %s",
         	                 elem->name);
 		    }
-		    listpush(stack,(void*)(yyvsp[(3) - (3)].sym));
-		;}
+		    listpush(stack,(void*)(yyvsp[0].sym));
+		}
+#line 1739 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 337 "ncgen.y"
+#line 337 "ncgen.y" /* yacc.c:1646  */
     {
-            (yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE;
-            (yyvsp[(1) - (3)].sym)->subclass=NC_ECONST;
-            (yyvsp[(1) - (3)].sym)->typ.econst=(yyvsp[(3) - (3)].constant);
-	    (yyval.sym)=(yyvsp[(1) - (3)].sym);
-        ;}
+            (yyvsp[-2].sym)->objectclass=NC_TYPE;
+            (yyvsp[-2].sym)->subclass=NC_ECONST;
+            (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant);
+	    (yyval.sym)=(yyvsp[-2].sym);
+        }
+#line 1750 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 346 "ncgen.y"
+#line 346 "ncgen.y" /* yacc.c:1646  */
     {
 		    vercheck(NC_OPAQUE);
-                    addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/
-                    (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE;
-                    (yyvsp[(5) - (5)].sym)->subclass=NC_OPAQUE;
-                    (yyvsp[(5) - (5)].sym)->typ.typecode=NC_OPAQUE;
-                    (yyvsp[(5) - (5)].sym)->typ.size=int32_val;
-                    (yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
-                ;}
+                    addtogroup((yyvsp[0].sym)); /*sets prefix*/
+                    (yyvsp[0].sym)->objectclass=NC_TYPE;
+                    (yyvsp[0].sym)->subclass=NC_OPAQUE;
+                    (yyvsp[0].sym)->typ.typecode=NC_OPAQUE;
+                    (yyvsp[0].sym)->typ.size=int32_val;
+                    (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
+                }
+#line 1764 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 30:
-#line 358 "ncgen.y"
+#line 358 "ncgen.y" /* yacc.c:1646  */
     {
-                    Symbol* basetype = (yyvsp[(1) - (5)].sym);
+                    Symbol* basetype = (yyvsp[-4].sym);
 		    vercheck(NC_VLEN);
-                    addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/
-                    (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE;
-                    (yyvsp[(5) - (5)].sym)->subclass=NC_VLEN;
-                    (yyvsp[(5) - (5)].sym)->typ.basetype=basetype;
-                    (yyvsp[(5) - (5)].sym)->typ.typecode=NC_VLEN;
-                    (yyvsp[(5) - (5)].sym)->typ.size=VLENSIZE;
-                    (yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_VLEN);
-                ;}
+                    addtogroup((yyvsp[0].sym)); /*sets prefix*/
+                    (yyvsp[0].sym)->objectclass=NC_TYPE;
+                    (yyvsp[0].sym)->subclass=NC_VLEN;
+                    (yyvsp[0].sym)->typ.basetype=basetype;
+                    (yyvsp[0].sym)->typ.typecode=NC_VLEN;
+                    (yyvsp[0].sym)->typ.size=VLENSIZE;
+                    (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_VLEN);
+                }
+#line 1780 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 31:
-#line 372 "ncgen.y"
+#line 372 "ncgen.y" /* yacc.c:1646  */
     {
 	    int i,j;
 	    vercheck(NC_COMPOUND);
-            addtogroup((yyvsp[(2) - (5)].sym));
+            addtogroup((yyvsp[-3].sym));
 	    /* check for duplicate field names*/
-	    stackbase=(yyvsp[(4) - (5)].mark);
+	    stackbase=(yyvsp[-1].mark);
 	    stacklen=listlength(stack);
 	    for(i=stackbase;i<stacklen;i++) {
 	      Symbol* elem1 = (Symbol*)listget(stack,i);
@@ -1994,180 +1797,206 @@ yyreduce:
 		  }
 	      }
 	    }
-	    (yyvsp[(2) - (5)].sym)->objectclass=NC_TYPE;
-            (yyvsp[(2) - (5)].sym)->subclass=NC_COMPOUND;
-            (yyvsp[(2) - (5)].sym)->typ.basetype=NULL;
-            (yyvsp[(2) - (5)].sym)->typ.typecode=NC_COMPOUND;
-	    (yyvsp[(2) - (5)].sym)->subnodes = listnew();
+	    (yyvsp[-3].sym)->objectclass=NC_TYPE;
+            (yyvsp[-3].sym)->subclass=NC_COMPOUND;
+            (yyvsp[-3].sym)->typ.basetype=NULL;
+            (yyvsp[-3].sym)->typ.typecode=NC_COMPOUND;
+	    (yyvsp[-3].sym)->subnodes = listnew();
 	    /* Add in the fields*/
 	    for(i=stackbase;i<stacklen;i++) {
 	        Symbol* fsym = (Symbol*)listget(stack,i);
-		fsym->container = (yyvsp[(2) - (5)].sym);
- 	        listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym);
+		fsym->container = (yyvsp[-3].sym);
+ 	        listpush((yyvsp[-3].sym)->subnodes,(void*)fsym);
 	    }
 	    listsetlength(stack,stackbase);/* remove stack nodes*/
-          ;}
+          }
+#line 1814 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 32:
-#line 404 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(1) - (2)].mark);;}
+#line 404 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-1].mark);}
+#line 1820 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 405 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(1) - (3)].mark);;}
+#line 405 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-2].mark);}
+#line 1826 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 409 "ncgen.y"
+#line 409 "ncgen.y" /* yacc.c:1646  */
     {
 	    int i;
-	    (yyval.mark)=(yyvsp[(2) - (2)].mark);
-	    stackbase=(yyvsp[(2) - (2)].mark);
+	    (yyval.mark)=(yyvsp[0].mark);
+	    stackbase=(yyvsp[0].mark);
 	    stacklen=listlength(stack);
 	    /* process each field in the fieldlist*/
             for(i=stackbase;i<stacklen;i++) {
                 Symbol* f = (Symbol*)listget(stack,i);
-		f->typ.basetype = (yyvsp[(1) - (2)].sym);
+		f->typ.basetype = (yyvsp[-1].sym);
             }
-        ;}
+        }
+#line 1842 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 35:
-#line 422 "ncgen.y"
-    { (yyval.sym) = primsymbols[NC_CHAR]; ;}
+#line 422 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym) = primsymbols[NC_CHAR]; }
+#line 1848 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 36:
-#line 423 "ncgen.y"
-    { (yyval.sym) = primsymbols[NC_BYTE]; ;}
+#line 423 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym) = primsymbols[NC_BYTE]; }
+#line 1854 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 424 "ncgen.y"
-    { (yyval.sym) = primsymbols[NC_SHORT]; ;}
+#line 424 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym) = primsymbols[NC_SHORT]; }
+#line 1860 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 425 "ncgen.y"
-    { (yyval.sym) = primsymbols[NC_INT]; ;}
+#line 425 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym) = primsymbols[NC_INT]; }
+#line 1866 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 426 "ncgen.y"
-    { (yyval.sym) = primsymbols[NC_FLOAT]; ;}
+#line 426 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym) = primsymbols[NC_FLOAT]; }
+#line 1872 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 427 "ncgen.y"
-    { (yyval.sym) = primsymbols[NC_DOUBLE]; ;}
+#line 427 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym) = primsymbols[NC_DOUBLE]; }
+#line 1878 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 428 "ncgen.y"
-    { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; ;}
+#line 428 "ncgen.y" /* yacc.c:1646  */
+    { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; }
+#line 1884 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 429 "ncgen.y"
-    { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; ;}
+#line 429 "ncgen.y" /* yacc.c:1646  */
+    { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; }
+#line 1890 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 430 "ncgen.y"
-    { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; ;}
+#line 430 "ncgen.y" /* yacc.c:1646  */
+    { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; }
+#line 1896 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 431 "ncgen.y"
-    { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; ;}
+#line 431 "ncgen.y" /* yacc.c:1646  */
+    { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; }
+#line 1902 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 432 "ncgen.y"
-    { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; ;}
+#line 432 "ncgen.y" /* yacc.c:1646  */
+    { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; }
+#line 1908 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 436 "ncgen.y"
-    {;}
+#line 436 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1914 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 437 "ncgen.y"
-    {;}
+#line 437 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1920 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 51:
-#line 444 "ncgen.y"
-    {;}
+#line 444 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1926 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 444 "ncgen.y"
-    {;}
+#line 444 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1932 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 55:
-#line 452 "ncgen.y"
+#line 452 "ncgen.y" /* yacc.c:1646  */
     {
-		(yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)extractint((yyvsp[(3) - (3)].constant));
+		(yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant));
 #ifdef GENDEBUG1
-fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long long)(yyvsp[(1) - (3)].sym)->dim.declsize);
+fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize);
 #endif
-	      ;}
+	      }
+#line 1943 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 459 "ncgen.y"
+#line 459 "ncgen.y" /* yacc.c:1646  */
     {
-		        (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED;
-		        (yyvsp[(1) - (3)].sym)->dim.isunlimited = 1;
+		        (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED;
+		        (yyvsp[-2].sym)->dim.isunlimited = 1;
 #ifdef GENDEBUG1
-fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
+fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 #endif
-		   ;}
+		   }
+#line 1955 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 469 "ncgen.y"
+#line 469 "ncgen.y" /* yacc.c:1646  */
     {
-                     (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM;
-                     if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym)))
+                     (yyvsp[0].sym)->objectclass=NC_DIM;
+                     if(dupobjectcheck(NC_DIM,(yyvsp[0].sym)))
                         yyerror( "Duplicate dimension declaration for %s",
-                                (yyvsp[(1) - (1)].sym)->name);
-		     addtogroup((yyvsp[(1) - (1)].sym));
-		     (yyval.sym)=(yyvsp[(1) - (1)].sym);
-		     listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym));
-                   ;}
+                                (yyvsp[0].sym)->name);
+		     addtogroup((yyvsp[0].sym));
+		     (yyval.sym)=(yyvsp[0].sym);
+		     listpush(dimdefs,(void*)(yyvsp[0].sym));
+                   }
+#line 1969 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 59:
-#line 481 "ncgen.y"
-    {;}
+#line 481 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1975 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 482 "ncgen.y"
-    {;}
+#line 482 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1981 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 489 "ncgen.y"
-    {;}
+#line 489 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1987 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 489 "ncgen.y"
-    {;}
+#line 489 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 1993 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 65:
-#line 492 "ncgen.y"
+#line 492 "ncgen.y" /* yacc.c:1646  */
     {
 		    int i;
-		    stackbase=(yyvsp[(2) - (2)].mark);
+		    stackbase=(yyvsp[0].mark);
 		    stacklen=listlength(stack);
 		    /* process each variable in the varlist*/
 	            for(i=stackbase;i<stacklen;i++) {
@@ -2177,37 +2006,40 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
                             yyerror("Duplicate variable declaration for %s",
                                     sym->name);
 			} else {
-		  	    sym->typ.basetype = (yyvsp[(1) - (2)].sym);
+		  	    sym->typ.basetype = (yyvsp[-1].sym);
 	                    addtogroup(sym);
 		            listpush(vardefs,(void*)sym);
 			}
 		    }
 		    listsetlength(stack,stackbase);/* remove stack nodes*/
-		;}
+		}
+#line 2017 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 514 "ncgen.y"
+#line 514 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack);
-                 listpush(stack,(void*)(yyvsp[(1) - (1)].sym));
-		;}
+                 listpush(stack,(void*)(yyvsp[0].sym));
+		}
+#line 2025 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 518 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
+#line 518 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 2031 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 522 "ncgen.y"
+#line 522 "ncgen.y" /* yacc.c:1646  */
     {
 		    int i;
 		    Dimset dimset;
 		    stacklen=listlength(stack);
-		    stackbase=(yyvsp[(2) - (2)].mark);
+		    stackbase=(yyvsp[0].mark);
 		    count = stacklen - stackbase;
 		    if(count >= NC_MAX_VAR_DIMS) {
-			yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name);
+			yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name);
 			count = NC_MAX_VAR_DIMS - 1;
 			stacklen = stackbase + count;
 		    }
@@ -2218,70 +2050,78 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
 			    Symbol* dsym = (Symbol*)listget(stack,stackbase+i);
 			    dimset.dimsyms[i] = dsym;
 			}
-			(yyvsp[(1) - (2)].sym)->typ.dimset = dimset;
+			(yyvsp[-1].sym)->typ.dimset = dimset;
 		    }
-		    (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/
-                    (yyvsp[(1) - (2)].sym)->objectclass=NC_VAR;
+		    (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/
+                    (yyvsp[-1].sym)->objectclass=NC_VAR;
 		    listsetlength(stack,stackbase);/* remove stack nodes*/
-		    ;}
+		    }
+#line 2060 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 548 "ncgen.y"
-    {(yyval.mark)=listlength(stack);;}
+#line 548 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=listlength(stack);}
+#line 2066 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 549 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(2) - (3)].mark);;}
+#line 549 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-1].mark);}
+#line 2072 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 552 "ncgen.y"
-    {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;}
+#line 552 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 2078 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 554 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
+#line 554 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 2084 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 558 "ncgen.y"
-    {Symbol* dimsym = (yyvsp[(1) - (1)].sym);
+#line 558 "ncgen.y" /* yacc.c:1646  */
+    {Symbol* dimsym = (yyvsp[0].sym);
 		dimsym->objectclass = NC_DIM;
 		/* Find the actual dimension*/
 		dimsym = locate(dimsym);
 		if(dimsym == NULL) {
-		    derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name);
+		    derror("Undefined or forward referenced dimension: %s",(yyvsp[0].sym)->name);
 		    YYABORT;
 		}
 		(yyval.sym)=dimsym;
-	    ;}
+	    }
+#line 2099 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 572 "ncgen.y"
+#line 572 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack);
-             listpush(stack,(void*)(yyvsp[(1) - (1)].sym));
-	    ;}
+             listpush(stack,(void*)(yyvsp[0].sym));
+	    }
+#line 2107 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 576 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
+#line 576 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 2113 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 581 "ncgen.y"
+#line 581 "ncgen.y" /* yacc.c:1646  */
     {
 		int i;
 		Dimset dimset;
-		stackbase=(yyvsp[(2) - (2)].mark);
+		stackbase=(yyvsp[0].mark);
 		stacklen=listlength(stack);
 		count = stacklen - stackbase;
 		if(count >= NC_MAX_VAR_DIMS) {
-		    yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name);
+		    yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name);
 		    count = NC_MAX_VAR_DIMS - 1;
 		    stacklen = stackbase + count;
 		}
@@ -2292,38 +2132,43 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
 		        Symbol* dsym = (Symbol*)listget(stack,stackbase+i);
 		        dimset.dimsyms[i] = dsym;
 		    }
-		    (yyvsp[(1) - (2)].sym)->typ.dimset = dimset;
+		    (yyvsp[-1].sym)->typ.dimset = dimset;
 		}
-		(yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/
-                (yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE;
-                (yyvsp[(1) - (2)].sym)->subclass=NC_FIELD;
+		(yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/
+                (yyvsp[-1].sym)->objectclass=NC_TYPE;
+                (yyvsp[-1].sym)->subclass=NC_FIELD;
 		listsetlength(stack,stackbase);/* remove stack nodes*/
-		(yyval.sym) = (yyvsp[(1) - (2)].sym);
-	    ;}
+		(yyval.sym) = (yyvsp[-1].sym);
+	    }
+#line 2144 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 609 "ncgen.y"
-    {(yyval.mark)=listlength(stack);;}
+#line 609 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=listlength(stack);}
+#line 2150 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 610 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(2) - (3)].mark);;}
+#line 610 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-1].mark);}
+#line 2156 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 614 "ncgen.y"
-    {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;}
+#line 614 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 2162 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 616 "ncgen.y"
-    {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
+#line 616 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
+#line 2168 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 621 "ncgen.y"
+#line 621 "ncgen.y" /* yacc.c:1646  */
     {  /* Anonymous integer dimension.
 	         Can only occur in type definitions*/
 	     char anon[32];
@@ -2332,11 +2177,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
 	     (yyval.sym)->objectclass = NC_DIM;
 	     (yyval.sym)->dim.isconstant = 1;
 	     (yyval.sym)->dim.declsize = uint32_val;
-	    ;}
+	    }
+#line 2182 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 631 "ncgen.y"
+#line 631 "ncgen.y" /* yacc.c:1646  */
     {  /* Anonymous integer dimension.
 	         Can only occur in type definitions*/
 	     char anon[32];
@@ -2349,34 +2195,37 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
 	     (yyval.sym)->objectclass = NC_DIM;
 	     (yyval.sym)->dim.isconstant = 1;
 	     (yyval.sym)->dim.declsize = int32_val;
-	    ;}
+	    }
+#line 2200 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 651 "ncgen.y"
-    {Symbol* vsym = (yyvsp[(1) - (1)].sym);
+#line 651 "ncgen.y" /* yacc.c:1646  */
+    {Symbol* vsym = (yyvsp[0].sym);
 		if(vsym->objectclass != NC_VAR) {
 		    derror("Undefined or forward referenced variable: %s",vsym->name);
 		    YYABORT;
 		}
 		(yyval.sym)=vsym;
-	    ;}
+	    }
+#line 2212 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 662 "ncgen.y"
-    {Symbol* tsym = (yyvsp[(1) - (1)].sym);
+#line 662 "ncgen.y" /* yacc.c:1646  */
+    {Symbol* tsym = (yyvsp[0].sym);
 		if(tsym->objectclass != NC_TYPE) {
 		    derror("Undefined or forward referenced type: %s",tsym->name);
 		    YYABORT;
 		}
 		(yyval.sym)=tsym;
-	    ;}
+	    }
+#line 2224 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 673 "ncgen.y"
-    {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym;
+#line 673 "ncgen.y" /* yacc.c:1646  */
+    {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym;
 		/* disambiguate*/
 		tvsym->objectclass = NC_VAR;
 		sym = locate(tvsym);
@@ -2384,359 +2233,432 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
 		    tvsym->objectclass = NC_TYPE;
 		    sym = locate(tvsym);
 		    if(tvsym == NULL) {
-		        derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name);
+		        derror("Undefined or forward referenced name: %s",(yyvsp[0].sym)->name);
 		        YYABORT;
 		    } else tvsym = sym;
 		} else tvsym = sym;
 		if(tvsym == NULL) {
-		    derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name);
+		    derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name);
 		    YYABORT;
 		}
 		(yyval.sym)=tvsym;
-	    ;}
+	    }
+#line 2247 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 691 "ncgen.y"
-    {(yyval.sym)=(yyvsp[(1) - (1)].sym);;}
+#line 691 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym)=(yyvsp[0].sym);}
+#line 2253 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 698 "ncgen.y"
-    {;}
+#line 698 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 2259 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 698 "ncgen.y"
-    {;}
+#line 698 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 2265 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 702 "ncgen.y"
-    {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;}
+#line 702 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
+#line 2271 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 704 "ncgen.y"
-    {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;}
+#line 704 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
+#line 2277 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 706 "ncgen.y"
-    {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;}
+#line 706 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
+#line 2283 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 708 "ncgen.y"
-    { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);;}
+#line 708 "ncgen.y" /* yacc.c:1646  */
+    { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
+#line 2289 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 710 "ncgen.y"
-    {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym);
+#line 710 "ncgen.y" /* yacc.c:1646  */
+    {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym);
 		if(vsym->objectclass == NC_VAR) {
-		    (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR);
+		    (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR);
 		} else {
 		    derror("Doubly typed attribute: %s",asym->name);
 		    YYABORT;
 		}
-	    ;}
+	    }
+#line 2302 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 719 "ncgen.y"
-    {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym);
+#line 719 "ncgen.y" /* yacc.c:1646  */
+    {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym);
 		if(sym->objectclass == NC_VAR) {
-		    (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR);
+		    (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR);
 		} else if(sym->objectclass == NC_TYPE) {
-		    (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL);
+		    (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[0].datalist),ATTRGLOBAL);
 		} else {
 		    derror("Attribute prefix not a variable or type: %s",asym->name);
 		    YYABORT;
 		}
-	    ;}
+	    }
+#line 2317 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 730 "ncgen.y"
-    {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);;}
+#line 730 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
+#line 2323 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 732 "ncgen.y"
-    {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),0);;}
+#line 732 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);}
+#line 2329 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 734 "ncgen.y"
-    {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
+#line 734 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2335 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 98:
-#line 736 "ncgen.y"
-    {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);;}
+#line 736 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
+#line 2341 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 99:
-#line 738 "ncgen.y"
-    {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
+#line 738 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2347 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 100:
-#line 740 "ncgen.y"
-    {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
+#line 740 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2353 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 101:
-#line 742 "ncgen.y"
-    {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
+#line 742 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2359 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 102:
-#line 744 "ncgen.y"
-    {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
+#line 744 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2365 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 103:
-#line 746 "ncgen.y"
-    {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
+#line 746 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2371 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 104:
-#line 748 "ncgen.y"
-    {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),1);;}
+#line 748 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);}
+#line 2377 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 105:
-#line 753 "ncgen.y"
+#line 753 "ncgen.y" /* yacc.c:1646  */
     {
-	        (yyval.sym)=(yyvsp[(1) - (1)].sym);
-                (yyvsp[(1) - (1)].sym)->ref.is_ref=1;
-                (yyvsp[(1) - (1)].sym)->is_prefixed=0;
-                setpathcurrent((yyvsp[(1) - (1)].sym));
-	    ;}
+	        (yyval.sym)=(yyvsp[0].sym);
+                (yyvsp[0].sym)->ref.is_ref=1;
+                (yyvsp[0].sym)->is_prefixed=0;
+                setpathcurrent((yyvsp[0].sym));
+	    }
+#line 2388 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 106:
-#line 760 "ncgen.y"
+#line 760 "ncgen.y" /* yacc.c:1646  */
     {
-	        (yyval.sym)=(yyvsp[(1) - (1)].sym);
-                (yyvsp[(1) - (1)].sym)->ref.is_ref=1;
-                (yyvsp[(1) - (1)].sym)->is_prefixed=1;
+	        (yyval.sym)=(yyvsp[0].sym);
+                (yyvsp[0].sym)->ref.is_ref=1;
+                (yyvsp[0].sym)->is_prefixed=1;
 	        /* path is set in ncgen.l*/
-	    ;}
+	    }
+#line 2399 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 108:
-#line 769 "ncgen.y"
-    {;}
+#line 769 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 2405 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 109:
-#line 770 "ncgen.y"
-    {;}
+#line 770 "ncgen.y" /* yacc.c:1646  */
+    {}
+#line 2411 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 112:
-#line 778 "ncgen.y"
-    {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);;}
+#line 778 "ncgen.y" /* yacc.c:1646  */
+    {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);}
+#line 2417 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 113:
-#line 781 "ncgen.y"
-    {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;}
+#line 781 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist) = (yyvsp[0].datalist);}
+#line 2423 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 114:
-#line 782 "ncgen.y"
-    {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;}
+#line 782 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist) = (yyvsp[0].datalist);}
+#line 2429 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 115:
-#line 786 "ncgen.y"
-    {(yyval.datalist) = builddatalist(0);;}
+#line 786 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist) = builddatalist(0);}
+#line 2435 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 116:
-#line 790 "ncgen.y"
-    {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;}
+#line 790 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
+#line 2441 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 117:
-#line 792 "ncgen.y"
-    {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;}
+#line 792 "ncgen.y" /* yacc.c:1646  */
+    {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
+#line 2447 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 118:
-#line 796 "ncgen.y"
-    {(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
+#line 796 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=(yyvsp[0].constant);}
+#line 2453 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 119:
-#line 797 "ncgen.y"
-    {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));;}
+#line 797 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));}
+#line 2459 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 120:
-#line 801 "ncgen.y"
-    {(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
+#line 801 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=(yyvsp[0].constant);}
+#line 2465 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 121:
-#line 802 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_OPAQUE);;}
+#line 802 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_OPAQUE);}
+#line 2471 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 122:
-#line 803 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_FILLVALUE);;}
+#line 803 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_FILLVALUE);}
+#line 2477 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 123:
-#line 804 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_NIL);;}
+#line 804 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_NIL);}
+#line 2483 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 124:
-#line 805 "ncgen.y"
-    {(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
+#line 805 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=(yyvsp[0].constant);}
+#line 2489 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 126:
-#line 810 "ncgen.y"
-    {(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));;}
+#line 810 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant) = makeenumconstref((yyvsp[0].sym));}
+#line 2495 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 127:
-#line 814 "ncgen.y"
-    {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));;}
+#line 814 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));}
+#line 2501 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 128:
-#line 819 "ncgen.y"
-    {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;}
+#line 819 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
+#line 2507 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 129:
-#line 821 "ncgen.y"
-    {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;}
+#line 821 "ncgen.y" /* yacc.c:1646  */
+    {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
+#line 2513 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 130:
-#line 825 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_CHAR);;}
+#line 825 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_CHAR);}
+#line 2519 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 131:
-#line 826 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_BYTE);;}
+#line 826 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_BYTE);}
+#line 2525 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 132:
-#line 827 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_SHORT);;}
+#line 827 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_SHORT);}
+#line 2531 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 133:
-#line 828 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_INT);;}
+#line 828 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_INT);}
+#line 2537 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 134:
-#line 829 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_INT64);;}
+#line 829 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_INT64);}
+#line 2543 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 135:
-#line 830 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_UBYTE);;}
+#line 830 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_UBYTE);}
+#line 2549 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 136:
-#line 831 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_USHORT);;}
+#line 831 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_USHORT);}
+#line 2555 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 137:
-#line 832 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_UINT);;}
+#line 832 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_UINT);}
+#line 2561 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 138:
-#line 833 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_UINT64);;}
+#line 833 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_UINT64);}
+#line 2567 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 139:
-#line 834 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_FLOAT);;}
+#line 834 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_FLOAT);}
+#line 2573 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 140:
-#line 835 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_DOUBLE);;}
+#line 835 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_DOUBLE);}
+#line 2579 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 141:
-#line 836 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_STRING);;}
+#line 836 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_STRING);}
+#line 2585 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 142:
-#line 840 "ncgen.y"
-    {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;}
+#line 840 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
+#line 2591 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 143:
-#line 841 "ncgen.y"
-    {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant)));;}
+#line 841 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));}
+#line 2597 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 144:
-#line 846 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_INT);;}
+#line 846 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_INT);}
+#line 2603 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 145:
-#line 848 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_UINT);;}
+#line 848 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_UINT);}
+#line 2609 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 146:
-#line 850 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_INT64);;}
+#line 850 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_INT64);}
+#line 2615 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 147:
-#line 852 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_UINT64);;}
+#line 852 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_UINT64);}
+#line 2621 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 148:
-#line 856 "ncgen.y"
-    {(yyval.constant)=makeconstdata(NC_STRING);;}
+#line 856 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=makeconstdata(NC_STRING);}
+#line 2627 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 149:
-#line 860 "ncgen.y"
-    {(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
+#line 860 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=(yyvsp[0].constant);}
+#line 2633 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 150:
-#line 861 "ncgen.y"
-    {(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
+#line 861 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.constant)=(yyvsp[0].constant);}
+#line 2639 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 151:
-#line 867 "ncgen.y"
-    {(yyval.sym)=(yyvsp[(1) - (1)].sym);;}
+#line 867 "ncgen.y" /* yacc.c:1646  */
+    {(yyval.sym)=(yyvsp[0].sym);}
+#line 2645 "ncgeny.c" /* yacc.c:1646  */
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 2738 "ncgen.tab.c"
+#line 2649 "ncgeny.c" /* yacc.c:1646  */
       default: break;
     }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
@@ -2745,8 +2667,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
 
   *++yyvsp = yyval;
 
-
-  /* Now `shift' the result of the reduction.  Determine what state
+  /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
 
@@ -2761,10 +2682,14 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
   goto yynewstate;
 
 
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
 yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
@@ -2772,37 +2697,36 @@ yyerrlab:
 #if ! YYERROR_VERBOSE
       yyerror (YY_("syntax error"));
 #else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
       {
-	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
-	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
-	  {
-	    YYSIZE_T yyalloc = 2 * yysize;
-	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
-	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
-	    if (yymsg != yymsgbuf)
-	      YYSTACK_FREE (yymsg);
-	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
-	    if (yymsg)
-	      yymsg_alloc = yyalloc;
-	    else
-	      {
-		yymsg = yymsgbuf;
-		yymsg_alloc = sizeof yymsgbuf;
-	      }
-	  }
-
-	if (0 < yysize && yysize <= yymsg_alloc)
-	  {
-	    (void) yysyntax_error (yymsg, yystate, yychar);
-	    yyerror (yymsg);
-	  }
-	else
-	  {
-	    yyerror (YY_("syntax error"));
-	    if (yysize != 0)
-	      goto yyexhaustedlab;
-	  }
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
       }
+# undef YYSYNTAX_ERROR
 #endif
     }
 
@@ -2810,24 +2734,24 @@ yyerrlab:
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse look-ahead token after an
-	 error, discard it.  */
+      /* If just tried and failed to reuse lookahead token after an
+         error, discard it.  */
 
       if (yychar <= YYEOF)
-	{
-	  /* Return failure if at end of input.  */
-	  if (yychar == YYEOF)
-	    YYABORT;
-	}
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
       else
-	{
-	  yydestruct ("Error: discarding",
-		      yytoken, &yylval);
-	  yychar = YYEMPTY;
-	}
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval);
+          yychar = YYEMPTY;
+        }
     }
 
-  /* Else will try to reuse look-ahead token after shifting the error
+  /* Else will try to reuse lookahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
@@ -2843,7 +2767,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;
@@ -2856,38 +2780,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 (yyn != YYPACT_NINF)
-	{
-	  yyn += YYTERROR;
-	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-	    {
-	      yyn = yytable[yyn];
-	      if (0 < yyn)
-		break;
-	    }
-	}
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYTERROR;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
 
       /* Pop the current state because it cannot handle the error token.  */
       if (yyssp == yyss)
-	YYABORT;
+        YYABORT;
 
 
       yydestruct ("Error: popping",
-		  yystos[yystate], yyvsp);
+                  yystos[yystate], yyvsp);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
   /* Shift the error token.  */
@@ -2911,7 +2834,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#ifndef yyoverflow
+#if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -2922,17 +2845,22 @@ yyexhaustedlab:
 #endif
 
 yyreturn:
-  if (yychar != YYEOF && yychar != YYEMPTY)
-     yydestruct ("Cleanup: discarding lookahead",
-		 yytoken, &yylval);
-  /* Do not reclaim the symbols of the rule which action triggered
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
+  /* 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);
+                  yystos[*yyssp], yyvsp);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
@@ -2943,12 +2871,9 @@ yyreturn:
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
 #endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
+  return yyresult;
 }
-
-
-#line 870 "ncgen.y"
+#line 870 "ncgen.y" /* yacc.c:1906  */
 
 
 #ifndef NO_STDARG
@@ -3576,4 +3501,3 @@ evaluate(Symbol* fcn, Datalist* arglist)
 done:
     return result;
 }
-
diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h
index cbd5b52..4d09af5 100644
--- a/ncgen/ncgeny.h
+++ b/ncgen/ncgeny.h
@@ -1,14 +1,13 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
+/* A Bison parser, made by GNU Bison 3.0.4.  */
 
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   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
+   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 2, or (at your option)
-   any later version.
+   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
@@ -16,9 +15,7 @@
    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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -33,139 +30,100 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-/* Tokens.  */
+#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
+# define YY_NCG_NCGEN_TAB_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+#if YYDEBUG
+extern int ncgdebug;
+#endif
+
+/* Token type.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     NC_UNLIMITED_K = 258,
-     CHAR_K = 259,
-     BYTE_K = 260,
-     SHORT_K = 261,
-     INT_K = 262,
-     FLOAT_K = 263,
-     DOUBLE_K = 264,
-     UBYTE_K = 265,
-     USHORT_K = 266,
-     UINT_K = 267,
-     INT64_K = 268,
-     UINT64_K = 269,
-     IDENT = 270,
-     TERMSTRING = 271,
-     CHAR_CONST = 272,
-     BYTE_CONST = 273,
-     SHORT_CONST = 274,
-     INT_CONST = 275,
-     INT64_CONST = 276,
-     UBYTE_CONST = 277,
-     USHORT_CONST = 278,
-     UINT_CONST = 279,
-     UINT64_CONST = 280,
-     FLOAT_CONST = 281,
-     DOUBLE_CONST = 282,
-     DIMENSIONS = 283,
-     VARIABLES = 284,
-     NETCDF = 285,
-     DATA = 286,
-     TYPES = 287,
-     COMPOUND = 288,
-     ENUM = 289,
-     OPAQUE_ = 290,
-     OPAQUESTRING = 291,
-     GROUP = 292,
-     PATH = 293,
-     FILLMARKER = 294,
-     NIL = 295,
-     _FILLVALUE = 296,
-     _FORMAT = 297,
-     _STORAGE = 298,
-     _CHUNKSIZES = 299,
-     _DEFLATELEVEL = 300,
-     _SHUFFLE = 301,
-     _ENDIANNESS = 302,
-     _NOFILL = 303,
-     _FLETCHER32 = 304,
-     _NCPROPS = 305,
-     _ISNETCDF4 = 306,
-     _SUPERBLOCK = 307,
-     DATASETID = 308
-   };
+  enum yytokentype
+  {
+    NC_UNLIMITED_K = 258,
+    CHAR_K = 259,
+    BYTE_K = 260,
+    SHORT_K = 261,
+    INT_K = 262,
+    FLOAT_K = 263,
+    DOUBLE_K = 264,
+    UBYTE_K = 265,
+    USHORT_K = 266,
+    UINT_K = 267,
+    INT64_K = 268,
+    UINT64_K = 269,
+    IDENT = 270,
+    TERMSTRING = 271,
+    CHAR_CONST = 272,
+    BYTE_CONST = 273,
+    SHORT_CONST = 274,
+    INT_CONST = 275,
+    INT64_CONST = 276,
+    UBYTE_CONST = 277,
+    USHORT_CONST = 278,
+    UINT_CONST = 279,
+    UINT64_CONST = 280,
+    FLOAT_CONST = 281,
+    DOUBLE_CONST = 282,
+    DIMENSIONS = 283,
+    VARIABLES = 284,
+    NETCDF = 285,
+    DATA = 286,
+    TYPES = 287,
+    COMPOUND = 288,
+    ENUM = 289,
+    OPAQUE_ = 290,
+    OPAQUESTRING = 291,
+    GROUP = 292,
+    PATH = 293,
+    FILLMARKER = 294,
+    NIL = 295,
+    _FILLVALUE = 296,
+    _FORMAT = 297,
+    _STORAGE = 298,
+    _CHUNKSIZES = 299,
+    _DEFLATELEVEL = 300,
+    _SHUFFLE = 301,
+    _ENDIANNESS = 302,
+    _NOFILL = 303,
+    _FLETCHER32 = 304,
+    _NCPROPS = 305,
+    _ISNETCDF4 = 306,
+    _SUPERBLOCK = 307,
+    DATASETID = 308
+  };
 #endif
-/* Tokens.  */
-#define NC_UNLIMITED_K 258
-#define CHAR_K 259
-#define BYTE_K 260
-#define SHORT_K 261
-#define INT_K 262
-#define FLOAT_K 263
-#define DOUBLE_K 264
-#define UBYTE_K 265
-#define USHORT_K 266
-#define UINT_K 267
-#define INT64_K 268
-#define UINT64_K 269
-#define IDENT 270
-#define TERMSTRING 271
-#define CHAR_CONST 272
-#define BYTE_CONST 273
-#define SHORT_CONST 274
-#define INT_CONST 275
-#define INT64_CONST 276
-#define UBYTE_CONST 277
-#define USHORT_CONST 278
-#define UINT_CONST 279
-#define UINT64_CONST 280
-#define FLOAT_CONST 281
-#define DOUBLE_CONST 282
-#define DIMENSIONS 283
-#define VARIABLES 284
-#define NETCDF 285
-#define DATA 286
-#define TYPES 287
-#define COMPOUND 288
-#define ENUM 289
-#define OPAQUE_ 290
-#define OPAQUESTRING 291
-#define GROUP 292
-#define PATH 293
-#define FILLMARKER 294
-#define NIL 295
-#define _FILLVALUE 296
-#define _FORMAT 297
-#define _STORAGE 298
-#define _CHUNKSIZES 299
-#define _DEFLATELEVEL 300
-#define _SHUFFLE 301
-#define _ENDIANNESS 302
-#define _NOFILL 303
-#define _FLETCHER32 304
-#define _NCPROPS 305
-#define _ISNETCDF4 306
-#define _SUPERBLOCK 307
-#define DATASETID 308
-
-
-
 
+/* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 138 "ncgen.y"
+
+union YYSTYPE
 {
+#line 138 "ncgen.y" /* yacc.c:1909  */
+
 Symbol* sym;
 unsigned long  size; /* allow for zero size to indicate e.g. UNLIMITED*/
 long           mark; /* track indices into the sequence*/
 int            nctype; /* for tracking attribute list type*/
 Datalist*      datalist;
 NCConstant       constant;
-}
-/* Line 1529 of yacc.c.  */
-#line 164 "ncgen.tab.h"
-	YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
+
+#line 117 "ncgeny.h" /* yacc.c:1909  */
+};
+
+typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
 #endif
 
+
 extern YYSTYPE ncglval;
 
+int ncgparse (void);
+
+#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED  */
diff --git a/ncgen3/Makefile.in b/ncgen3/Makefile.in
index 74a29a7..16f7f52 100644
--- a/ncgen3/Makefile.in
+++ b/ncgen3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/nctest/Makefile.in b/nctest/Makefile.in
index 81c5cf0..18acaaa 100644
--- a/nctest/Makefile.in
+++ b/nctest/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/oc2/Makefile.am b/oc2/Makefile.am
index d85ee81..aa3d65f 100644
--- a/oc2/Makefile.am
+++ b/oc2/Makefile.am
@@ -46,5 +46,3 @@ bison:: dap.y
 	rm -f dap.tab.c dap.tab.h
 	bison --debug -d -p dap dap.y
 	mv dap.tab.c dapy.c; mv dap.tab.h dapy.h
-
-
diff --git a/oc2/Makefile.in b/oc2/Makefile.in
index 6872fc0..29d1ca9 100644
--- a/oc2/Makefile.in
+++ b/oc2/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/oc2/dap.y b/oc2/dap.y
index e201539..9154c61 100644
--- a/oc2/dap.y
+++ b/oc2/dap.y
@@ -52,7 +52,7 @@ int dapdebug = 0;
 
 start:
 	  dataset datasetbody
-	| dataset datasetbody SCAN_DATA
+	| dataset datasetbody SCAN_DATA /* The SCAN_DATA indicates serialized data follows */
 	| attr attributebody
 	| err errorbody
         | error {dap_unrecognizedresponse(parsestate); YYABORT;}
@@ -245,29 +245,29 @@ errorprog : /*empty*/ {$$=null;} | SCAN_PROG    '=' WORD_WORD ';' {$$=$3;}
 */
 name:
           WORD_WORD      {$$=dapdecode(parsestate->lexstate,$1);}
-	| SCAN_ALIAS     {$$=strdup("alias");}
-	| SCAN_ARRAY     {$$=strdup("array");}
-	| SCAN_ATTR      {$$=strdup("attributes");}
-	| SCAN_BYTE      {$$=strdup("byte");}
-	| SCAN_DATASET   {$$=strdup("dataset");}
-	| SCAN_DATA      {$$=strdup("data");}
-	| SCAN_ERROR     {$$=strdup("error");}
-	| SCAN_FLOAT32   {$$=strdup("float32");}
-	| SCAN_FLOAT64   {$$=strdup("float64");}
-	| SCAN_GRID      {$$=strdup("grid");}
-	| SCAN_INT16     {$$=strdup("int16");}
-	| SCAN_INT32     {$$=strdup("int32");}
-	| SCAN_MAPS      {$$=strdup("maps");}
-	| SCAN_SEQUENCE  {$$=strdup("sequence");}
-	| SCAN_STRING    {$$=strdup("string");}
-	| SCAN_STRUCTURE {$$=strdup("structure");}
-	| SCAN_UINT16    {$$=strdup("uint16");}
-	| SCAN_UINT32    {$$=strdup("uint32");}
-	| SCAN_URL       {$$=strdup("url");}
-	| SCAN_CODE      {$$=strdup("code");}
-	| SCAN_MESSAGE   {$$=strdup("message");}
-	| SCAN_PROG      {$$=strdup("program");}
-	| SCAN_PTYPE     {$$=strdup("program_type");}
+	| SCAN_ALIAS     {$$=strdup($1);}
+	| SCAN_ARRAY     {$$=strdup($1);}
+	| SCAN_ATTR      {$$=strdup($1);}
+	| SCAN_BYTE      {$$=strdup($1);}
+	| SCAN_DATASET   {$$=strdup($1);}
+	| SCAN_DATA      {$$=strdup($1);}
+	| SCAN_ERROR     {$$=strdup($1);}
+	| SCAN_FLOAT32   {$$=strdup($1);}
+	| SCAN_FLOAT64   {$$=strdup($1);}
+	| SCAN_GRID      {$$=strdup($1);}
+	| SCAN_INT16     {$$=strdup($1);}
+	| SCAN_INT32     {$$=strdup($1);}
+	| SCAN_MAPS      {$$=strdup($1);}
+	| SCAN_SEQUENCE  {$$=strdup($1);}
+	| SCAN_STRING    {$$=strdup($1);}
+	| SCAN_STRUCTURE {$$=strdup($1);}
+	| SCAN_UINT16    {$$=strdup($1);}
+	| SCAN_UINT32    {$$=strdup($1);}
+	| SCAN_URL       {$$=strdup($1);}
+	| SCAN_CODE      {$$=strdup($1);}
+	| SCAN_MESSAGE   {$$=strdup($1);}
+	| SCAN_PROG      {$$=strdup($1);}
+	| SCAN_PTYPE     {$$=strdup($1);}
 	;
 
 %%
diff --git a/oc2/dapy.c b/oc2/dapy.c
index d1cfa63..c4031eb 100644
--- a/oc2/dapy.c
+++ b/oc2/dapy.c
@@ -1875,139 +1875,139 @@ yyreduce:
 
   case 84:
 #line 248 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("alias");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1880 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 85:
 #line 249 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("array");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1886 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 86:
 #line 250 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("attributes");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1892 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 87:
 #line 251 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("byte");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1898 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 88:
 #line 252 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("dataset");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1904 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 89:
 #line 253 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("data");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1910 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 90:
 #line 254 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("error");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1916 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 91:
 #line 255 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("float32");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1922 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 92:
 #line 256 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("float64");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1928 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 93:
 #line 257 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("grid");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1934 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 94:
 #line 258 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("int16");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1940 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 95:
 #line 259 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("int32");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1946 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 96:
 #line 260 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("maps");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1952 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 97:
 #line 261 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("sequence");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1958 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 98:
 #line 262 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("string");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1964 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 99:
 #line 263 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("structure");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1970 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 100:
 #line 264 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("uint16");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1976 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 101:
 #line 265 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("uint32");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1982 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 102:
 #line 266 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("url");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1988 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 103:
 #line 267 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("code");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 1994 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 104:
 #line 268 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("message");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 2000 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 105:
 #line 269 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("program");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 2006 "dap.tab.c" /* yacc.c:1646  */
     break;
 
   case 106:
 #line 270 "dap.y" /* yacc.c:1646  */
-    {(yyval)=strdup("program_type");}
+    {(yyval)=strdup((yyvsp[0]));}
 #line 2012 "dap.tab.c" /* yacc.c:1646  */
     break;
 
diff --git a/oc2/oc.c b/oc2/oc.c
index 2d9df83..a3740c7 100644
--- a/oc2/oc.c
+++ b/oc2/oc.c
@@ -14,6 +14,7 @@
 #include "occlientparams.h"
 #include "occurlfunctions.h"
 #include "ochttp.h"
+#include "ncwinpath.h"
 
 #undef TRACK
 
@@ -2085,11 +2086,10 @@ oc_set_netrc(OClink* link, const char* file)
     if(file == NULL || strlen(file) == 0)
 	return OC_EINVAL;
     nclog(OCLOGDBG,"OC: using netrc file: %s",file);
-    /* See if it exists and is readable; complain if not */
-    f = fopen(file,"r");
-    if(f == NULL)
-	nclog(NCLOGWARN,"OC: netrc file is not readable; continuing");
-    else {
+    /* See if it exists and is readable; ignore if not */
+    f = NCfopen(file,"r");
+    if(f != NULL) { /* Log what rc file is being used */
+	nclog(NCLOGNOTE,"OC: netrc file found: %s",file);
 	fclose(f);
     }
     return OCTHROW(ocset_netrc(state,file));
@@ -2142,7 +2142,7 @@ oc_set_rcfile(const char* rcfile)
     if(rcfile == NULL) {
 	ocglobalstate.rc.ignore = 1;
     } else {
-        FILE* f = fopen(rcfile,"r");
+        FILE* f = NCfopen(rcfile,"r");
         if(f == NULL) {
 	    stat = (OC_ERCFILE);
 	    goto done;
diff --git a/oc2/ocinternal.c b/oc2/ocinternal.c
index 34cd03e..29a74ed 100644
--- a/oc2/ocinternal.c
+++ b/oc2/ocinternal.c
@@ -10,12 +10,16 @@
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
-#if defined(_WIN32) || defined(_WIN64)
+#if _MSC_VER
 #include <io.h>
 #include <direct.h>
 #include <process.h>
 #endif
 
+#ifdef HAVE_FTW_H
+#include <ftw.h>
+#endif
+
 #include <errno.h>
 
 #include "ocinternal.h"
@@ -25,31 +29,20 @@
 #include "ochttp.h"
 #include "ocread.h"
 #include "dapparselex.h"
+#include "ncwinpath.h"
 
 #define DATADDSFILE "datadds"
 
-#if 0
-/* Note: TMPPATH must end in '/' */
-#ifdef __CYGWIN__
-#define TMPPATH1 "/cygdrive/c/temp/datadds"
-#define TMPPATH2 "./datadds"
-#elif defined(_WIN32) || defined(_WIN64)
-#define TMPPATH1 "c:\\temp\\datadds"
-#define TMPPATH2 ".\\datadds"
-#else
-#define TMPPATH1 "/tmp/datadds"
-#define TMPPATH2 "./datadds"
-#endif
-#endif
-
 #define CLBRACE '{'
 #define CRBRACE '}'
 
+/*Forward*/
 static OCerror ocextractddsinmemory(OCstate*,OCtree*,int);
 static OCerror ocextractddsinfile(OCstate*,OCtree*,int);
 static char* constraintescape(const char* url);
 static OCerror createtempfile(OCstate*,OCtree*);
 static int dataError(XXDR* xdrs, OCstate*);
+static void ocremovefile(const char* path);
 
 static OCerror ocset_curlproperties(OCstate*);
 
@@ -88,7 +81,7 @@ ocinternalinitialize(void)
 	char* p;
 	char* q;
 	char cwd[4096];
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _MSC_VER
         tempdir = getenv("TEMP");
 #else
 	tempdir = "/tmp";
@@ -105,7 +98,7 @@ ocinternalinitialize(void)
 	    *q = *p;
 	}
 	*q = '\0';
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _MSC_VER
 #else
         /* Canonicalize */
 	for(p=ocglobalstate.tempdir;*p;p++) {
@@ -132,7 +125,7 @@ ocinternalinitialize(void)
 	    *q = *p;
 	}
 	*q = '\0';
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _MSC_VER
 #else
         /* Canonicalize */
 	for(p=home;*p;p++) {
@@ -387,10 +380,11 @@ createtempfile(OCstate* state, OCtree* tree)
 #endif
     tree->data.filename = name; /* remember our tmp file name */
     name = NULL;
-    tree->data.file = fopen(tree->data.filename,"w+");
+    tree->data.file = NCfopen(tree->data.filename,"w+");
     if(tree->data.file == NULL) return OC_EOPEN;
-    /* unlink the temp file so it will automatically be reclaimed */
-    if(ocdebug == 0) unlink(tree->data.filename);
+    /* make the temp file so it will automatically be reclaimed on close */
+    if(ocdebug == 0)
+	ocremovefile(tree->data.filename);
     return stat;
 
 fail:
@@ -422,19 +416,11 @@ occlose(OCstate* state)
     ocfree(state->error.message);
     ocfree(state->curlflags.useragent);
     if(state->curlflags.cookiejar) {
-#if 0
         if(state->curlflags.createdflags & COOKIECREATED)
-	    unlink(state->curlflags.cookiejar);
-#endif
+            ocremovefile(state->curlflags.cookiejar);
 	ocfree(state->curlflags.cookiejar);
     }
-    if(state->curlflags.netrc != NULL) {
-#if 0
-        if(state->curlflags.createdflags & NETRCCREATED)
-	    unlink(state->curlflags.netrc);
-#endif
-	ocfree(state->curlflags.netrc);
-    }
+    ocfree(state->curlflags.netrc);
     ocfree(state->ssl.certificate);
     ocfree(state->ssl.key);
     ocfree(state->ssl.keypasswd);
@@ -606,26 +592,23 @@ ocset_curlproperties(OCstate* state)
 
     if(state->curlflags.cookiejar == NULL) {
 	/* If no cookie file was defined, define a default */
-	char tmp[OCPATHMAX+1];
         int stat;
-#if defined(_WIN32) || defined(_WIN64)
-	int pid = _getpid();
-#else
-	pid_t pid = getpid();
-#endif
-	snprintf(tmp,sizeof(tmp)-1,"%s/%s.%ld/",ocglobalstate.tempdir,OCDIR,(long)pid);
-#ifdef _WIN32
-	stat = mkdir(tmp);
-#else
-	stat = mkdir(tmp,S_IRUSR | S_IWUSR | S_IXUSR);
-#endif
-	if(stat != 0 && errno != EEXIST) {
-	    fprintf(stderr,"Cannot create cookie directory\n");
-	    goto fail;
-	}
+        char* path = NULL;
+        char* name = NULL;
+        int len;
 	errno = 0;
 	/* Create the unique cookie file name */
-	stat = ocmktmp(tmp,&state->curlflags.cookiejar);
+        len =
+	  strlen(ocglobalstate.tempdir)
+	  + 1 /* '/' */
+	  + strlen("occookies");
+        path = (char*)malloc(len+1);
+        if(path == NULL) return OC_ENOMEM;
+        occopycat(path,len,3,ocglobalstate.tempdir,"/","occookies");
+        stat = ocmktmp(path,&name);
+fprintf(stderr,"%s => %s\n",state->uri->uri,name); fflush(stderr);
+        free(path);
+	state->curlflags.cookiejar = name;
 	state->curlflags.createdflags |= COOKIECREATED;
 	if(stat != OC_NOERR && errno != EEXIST) {
 	    fprintf(stderr,"Cannot create cookie file\n");
@@ -640,17 +623,17 @@ ocset_curlproperties(OCstate* state)
 	FILE* f = NULL;
 	char* fname = state->curlflags.cookiejar;
 	/* See if the file exists already */
-        f = fopen(fname,"r");
+        f = NCfopen(fname,"r");
 	if(f == NULL) {
 	    /* Ok, create it */
-	    f = fopen(fname,"w+");
+	    f = NCfopen(fname,"w+");
 	    if(f == NULL) {
 	        fprintf(stderr,"Cookie file cannot be read and written: %s\n",fname);
 	        {stat = OC_EPERM; goto fail;}
 	    }
 	} else { /* test if file can be written */
 	    fclose(f);
-	    f = fopen(fname,"r+");
+	    f = NCfopen(fname,"r+");
 	    if(f == NULL) {
 	        fprintf(stderr,"Cookie file is cannot be written: %s\n",fname);
 	        {stat = OC_EPERM; goto fail;}
@@ -756,3 +739,13 @@ ocset_netrc(OCstate* state, const char* path)
     stat = ocset_curlflag(state,CURLOPT_NETRC);
     return stat;
 }
+
+static void
+ocremovefile(const char* path)
+{
+#ifdef _MSC_VER
+    DeleteFile(path);
+#else
+    remove(path);
+#endif
+}
diff --git a/oc2/ocinternal.h b/oc2/ocinternal.h
index b1a75a0..a954c3c 100644
--- a/oc2/ocinternal.h
+++ b/oc2/ocinternal.h
@@ -116,7 +116,7 @@ typedef struct OCheader {
 #define nullstring(s) (s==NULL?"(null)":s)
 #define PATHSEPARATOR "."
 
-#define OCDIR "oc"
+#define OCCOOKIEDIR "occookies"
 
 /* Define infinity for memory size */
 #if SIZEOF_SIZE_T == 4 
@@ -199,7 +199,6 @@ struct OCstate {
 	char* useragent; /*CURLOPT_USERAGENT*/
 	/* track which of these are created by oc */
 #define COOKIECREATED 1
-#define NETRCCREATED 2
 	int createdflags;
 	char* cookiejar; /*CURLOPT_COOKIEJAR,CURLOPT_COOKIEFILE*/
 	char* netrc; /*CURLOPT_NETRC,CURLOPT_NETRC_FILE*/
diff --git a/oc2/ocrc.c b/oc2/ocrc.c
index 6ffc6a9..d000e75 100644
--- a/oc2/ocrc.c
+++ b/oc2/ocrc.c
@@ -13,6 +13,7 @@
 #include "ocinternal.h"
 #include "ocdebug.h"
 #include "nclog.h"
+#include "ncwinpath.h"
 
 #define OCRCFILEENV "DAPRCFILE"
 
@@ -279,7 +280,7 @@ ocrc_compile(const char* path)
 
     ocrc->ntriples = 0; /* reset; nothing to free */
 
-    in_file = fopen(path, "r"); /* Open the file to read it */
+    in_file = NCfopen(path, "r"); /* Open the file to read it */
     if (in_file == NULL) {
         nclog(NCLOGERR, "Could not open configuration file: %s",path);
         return OC_EPERM;
@@ -714,9 +715,7 @@ rc_search(const char* prefix, const char* rcname, char** pathp)
 	goto done;
     }
     /* see if file is readable */
-    f = fopen(path,"r");
-    if(f != NULL)
-        nclog(NCLOGDBG, "Found rc file=%s",path);
+    f = NCfopen(path,"r");
 done:
     if(f == NULL || stat != OC_NOERR) {
       if(path != NULL)
diff --git a/oc2/ocread.c b/oc2/ocread.c
index aec7232..95d8e28 100644
--- a/oc2/ocread.c
+++ b/oc2/ocread.c
@@ -13,12 +13,16 @@
 #endif
 #ifdef _WIN32
 #include <io.h>
+#ifndef O_BINARY
+#define O_BINARY _O_BINARY
+#endif
 #endif
 #include "ocinternal.h"
 #include "ocdebug.h"
 #include "ochttp.h"
 #include "ocread.h"
 #include "occurlfunctions.h"
+#include "ncwinpath.h"
 
 /*Forward*/
 static int readpacket(OCstate* state, NCURI*, NCbytes*, OCdxd, long*);
@@ -214,10 +218,11 @@ readfile(const char* path, const char* suffix, NCbytes* packet)
 #ifdef O_BINARY
     flags |= O_BINARY;
 #endif
-    fd = open(filename,flags);
+    fd = NCopen2(filename,flags);
     if(fd < 0) {
-	nclog(NCLOGERR,"open failed:%s",filename);
-	return OCTHROW(OC_EOPEN);
+	nclog(NCLOGERR,"open failed: %s file=|%s|",ocerrstring(errno),filename);
+	stat = OC_EOPEN;
+	goto done;
     }
     /* Get the file size */
     filesize = lseek(fd,(off_t)0,SEEK_END);
diff --git a/oc2/ocutil.c b/oc2/ocutil.c
index 5ad4200..bfa7143 100644
--- a/oc2/ocutil.c
+++ b/oc2/ocutil.c
@@ -721,9 +721,9 @@ ocmktmp(const char* base, char** tmpnamep)
 	    return OC_EOVERRUN;
         }
 #if defined(_WIN32) || defined(_WIN64)
-        fd=open(tmpname,O_RDWR|O_BINARY|O_CREAT, _S_IREAD|_S_IWRITE);
+        fd=NCopen3(tmpname,O_RDWR|O_BINARY|O_CREAT, _S_IREAD|_S_IWRITE);
 #  else
-        fd=open(tmpname,O_RDWR|O_CREAT|O_EXCL, S_IRWXU);
+        fd=NCopen3(tmpname,O_RDWR|O_CREAT|O_EXCL, S_IRWXU);
 #  endif
     }
 #endif /* !HAVE_MKSTEMP */
diff --git a/test-driver b/test-driver
index 8e575b0..0218a01 100755
--- a/test-driver
+++ b/test-driver
@@ -1,9 +1,9 @@
 #! /bin/sh
 # test-driver - basic testsuite driver script.
 
-scriptversion=2013-07-13.22; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 2011-2014 Free Software Foundation, Inc.
+# Copyright (C) 2011-2017 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
@@ -143,6 +143,6 @@ echo ":copy-in-global-log: $gcopy" >> $trs_file
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/test_common.in b/test_common.in
index 553b242..d559dd3 100644
--- a/test_common.in
+++ b/test_common.in
@@ -1,7 +1,7 @@
 set -e
 
-TOPSRCDIR=@TOPSRCDIR@
-TOPBUILDDIR=@TOPBUILDDIR@
+TOPSRCDIR=@abs_top_srcdir@
+TOPBUILDDIR=@abs_top_builddir@
 
 # Figure out various locations in the src/build tree.
 # This is relatively fragile code and is essentially
@@ -20,7 +20,7 @@ TOPBUILDDIR=@TOPBUILDDIR@
 #    the src and build trees are distinct.
 # 4. Cmake on windows using cygwin or msys.
 #    The src and build trees are distinct.
-# 
+#
 # For now, an explicit build using the Visual C(++) compiler
 # is not supported. The big issue is the handling of executables
 # and the notion of a VS configuration/build type like Debug or Release.
@@ -29,11 +29,11 @@ TOPBUILDDIR=@TOPBUILDDIR@
 # Thus one finds ncdump.exe in $top_builddir/ncdump/Debug instead of
 # $top_builddir/ncdump. An additional issue is the extension of an
 # executable: .exe vs nothing. This code attempts to figure out which is used.
-# 
+#
 # For possible future fixes, a placeholder is left in place in the
 # following code named VS. If it were set to the build type, then,
 # in theory, this code would work with Visual C. It is disabled for now.
-# 
+#
 # The goal, then, of this common code is to set up some useful
 #constants for use in test shell scripts.
 # 1. srcdir - absolute path to the source dir (e.g. ${top_srcdir}/ncgen)
@@ -115,12 +115,12 @@ else
   ext=""
 fi
 
-# We need to locate certain executables (and other things)
-# and capture absolute paths
-NCDUMP="${top_builddir}/ncdump${VS}/ncdump${ext}"
-NCCOPY="${top_builddir}/ncdump${VS}/nccopy${ext}"
-NCGEN="${top_builddir}/ncgen${VS}/ncgen${ext}"
-NCGEN3="${top_builddir}/ncgen3${VS}/ncgen3${ext}"
+# We need to locate certain executables (and other things),
+# capture absolute paths, and make visible
+export NCDUMP="${top_builddir}/ncdump${VS}/ncdump${ext}"
+export NCCOPY="${top_builddir}/ncdump${VS}/nccopy${ext}"
+export NCGEN="${top_builddir}/ncgen${VS}/ncgen${ext}"
+export NCGEN3="${top_builddir}/ncgen3${VS}/ncgen3${ext}"
 
 # Temporary hacks (until we have a test_utils directory)
 # to locate certain specific test files

-- 
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