From fab66699d1e1b5055230eca4fc6bc42255307556 Mon Sep 17 00:00:00 2001 From: dmh Date: Fri, 14 Aug 2015 20:38:30 -0600 Subject: [PATCH] Moved libsrc5 to libsrcp because pnetcdf is used for more than CDF-5 files. --- CMakeLists.txt | 2 +- Makefile.am | 4 +- configure.ac | 2 +- include/ncdispatch.h | 7 +- libdispatch/ddispatch.c | 7 - libdispatch/dfile.c | 14 +- liblib/Makefile.am | 4 +- liblib/stub.c | 4 +- libsrc/attr.c | 339 + libsrc/ncx.c | 5957 +++++++++++++- libsrc/ncx.m4 | 2 +- libsrc/putget.c | 2 +- libsrc5/CMakeLists.txt | 5 - libsrcp/CMakeLists.txt | 5 + {libsrc5 => libsrcp}/Makefile.am | 8 +- .../nc5dispatch.c => libsrcp/ncpdispatch.c | 396 +- nc_test/test_get.c | 6161 ++++++++++++++ nc_test/test_put.c | 7206 +++++++++++++++++ ncgen/ncgentab.c | 2051 +++-- ncgen/ncgentab.h | 149 +- 20 files changed, 21162 insertions(+), 1163 deletions(-) delete mode 100644 libsrc5/CMakeLists.txt create mode 100644 libsrcp/CMakeLists.txt rename {libsrc5 => libsrcp}/Makefile.am (78%) rename libsrc5/nc5dispatch.c => libsrcp/ncpdispatch.c (76%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8447090f2..32abed99e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1334,7 +1334,7 @@ add_subdirectory(libdispatch) add_subdirectory(libsrc) IF(USE_PNETCDF) - add_subdirectory(libsrc5) + add_subdirectory(libsrcp) ENDIF(USE_PNETCDF) IF(USE_HDF5) diff --git a/Makefile.am b/Makefile.am index 3cc1ac5e0..93fb69b35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -64,7 +64,7 @@ endif # Build pnetcdf if USE_PNETCDF -LIBSRC5 = libsrc5 +LIBSRCP = libsrcp endif # Build UDUNITS? @@ -86,7 +86,7 @@ endif # and run. ncgen must come before ncdump, because their tests # depend on it. SUBDIRS = include $(OCLIB) $(H5_TEST_DIR) libdispatch libsrc \ -$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRC5) liblib \ +$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRCP) liblib \ $(NCGEN3) $(NCGEN) $(NCDUMP) \ $(TESTDIRS) \ docs $(EXAMPLES) \ diff --git a/configure.ac b/configure.ac index f4e4f9357..c11295ca6 100644 --- a/configure.ac +++ b/configure.ac @@ -1167,7 +1167,7 @@ AC_CONFIG_FILES([Makefile docs/images/Makefile libsrc/Makefile libsrc4/Makefile - libsrc5/Makefile + libsrcp/Makefile nctest/Makefile nc_test4/Makefile nc_test/Makefile diff --git a/include/ncdispatch.h b/include/ncdispatch.h index a42ad4e49..32d985ec2 100644 --- a/include/ncdispatch.h +++ b/include/ncdispatch.h @@ -61,8 +61,7 @@ #define NC_DISPATCH_NC3 1 #define NC_DISPATCH_NC4 2 #define NC_DISPATCH_NCD 4 -#define NC_DISPATCH_NCR 8 -#define NC_DISPATCH_NC5 16 +#define NC_DISPATCH_NCP 8 /* Define a type for use when doing e.g. nc_get_vara_long, etc. */ @@ -123,8 +122,8 @@ extern int NCD2_initialize(void); #endif #ifdef USE_PNETCDF -extern NC_Dispatch* NC5_dispatch_table; -extern int NC5_initialize(void); +extern NC_Dispatch* NCP_dispatch_table; +extern int NCP_initialize(void); #endif #ifdef USE_NETCDF4 diff --git a/libdispatch/ddispatch.c b/libdispatch/ddispatch.c index c8082129c..6d7b3469f 100644 --- a/libdispatch/ddispatch.c +++ b/libdispatch/ddispatch.c @@ -21,10 +21,6 @@ static struct NCPROTOCOLLIST { {"file",NULL,NC_DISPATCH_NCD}, {"dods","http",NC_DISPATCH_NCD}, {"dodss","https",NC_DISPATCH_NCD}, - {"cdmr","http",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {"cdmrs","https",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {"cdmremote","http",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, - {"cdmremotes","https",NC_DISPATCH_NCR|NC_DISPATCH_NC4}, {NULL,NULL,0} /* Terminate search */ }; @@ -151,9 +147,6 @@ NC_urlmodel(const char* path) } else if(ncurilookup(tmpurl,"netcdf3",NULL) || ncurilookup(tmpurl,"netcdf-3",NULL)) { model = (NC_DISPATCH_NC3|NC_DISPATCH_NCD); - } else if(ncurilookup(tmpurl,"cdmremote",NULL) - || ncurilookup(tmpurl,"cdmr",NULL)) { - model = (NC_DISPATCH_NCR|NC_DISPATCH_NC4); } if(model == 0) { diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c index a839bbfbd..1516224d7 100644 --- a/libdispatch/dfile.c +++ b/libdispatch/dfile.c @@ -106,7 +106,7 @@ NC_interpret_magic_number(char* magic, int* model, int* version, int use_paralle #endif else {status = NC_ENOTNC; goto done;} - *model = (use_parallel || *version == 5)?NC_DISPATCH_NC5:NC_DISPATCH_NC3; + *model = (use_parallel || *version == 5)?NC_DISPATCH_NCP:NC_DISPATCH_NC3; } else {status = NC_ENOTNC; goto done;} done: @@ -1627,7 +1627,7 @@ NC_create(const char *path, int cmode, size_t initialsz, #endif #ifdef USE_PNETCDF if(cmode & NC_PNETCDF) - model = NC_DISPATCH_NC5; + model = NC_DISPATCH_NCP; else #endif if(cmode & NC_CLASSIC_MODEL) @@ -1686,8 +1686,8 @@ NC_create(const char *path, int cmode, size_t initialsz, else #endif #ifdef USE_PNETCDF - if(model == (NC_DISPATCH_NC5)) - dispatcher = NC5_dispatch_table; + if(model == (NC_DISPATCH_NCP)) + dispatcher = NCP_dispatch_table; else #endif if(model == (NC_DISPATCH_NC3)) @@ -1797,7 +1797,7 @@ NC_open(const char *path, int cmode, else if(model & NC_DISPATCH_NC3) { cmode &= ~NC_NETCDF4; /* must be netcdf-3 */ if(version == 2) cmode |= NC_64BIT_OFFSET; - } else if(model & NC_DISPATCH_NC5) { + } else if(model & NC_DISPATCH_NCP) { #if 0 It appears that pnetcdf can read NC_64_BIT_OFFSET cmode &= ~(NC_NETCDF4 | NC_64BIT_OFFSET); /* must be pnetcdf */ @@ -1826,8 +1826,8 @@ It appears that pnetcdf can read NC_64_BIT_OFFSET else #endif #if defined(USE_PNETCDF) - if(model == (NC_DISPATCH_NC5)) - dispatcher = NC5_dispatch_table; + if(model == (NC_DISPATCH_NCP)) + dispatcher = NCP_dispatch_table; else #endif #if defined(USE_NETCDF4) diff --git a/liblib/Makefile.am b/liblib/Makefile.am index 9b5df4fc6..b390d695e 100755 --- a/liblib/Makefile.am +++ b/liblib/Makefile.am @@ -43,8 +43,8 @@ libnetcdf_la_LIBADD += ${top_builddir}/libdispatch/libdispatch.la \ # + pnetcdf if USE_PNETCDF -AM_CPPFLAGS += -I${top_srcdir}/libsrc5 -libnetcdf_la_LIBADD += ${top_builddir}/libsrc5/libnetcdf5.la +AM_CPPFLAGS += -I${top_srcdir}/libsrcp +libnetcdf_la_LIBADD += ${top_builddir}/libsrcp/libnetcdfp.la endif # USE_PNETCDF # + dap diff --git a/liblib/stub.c b/liblib/stub.c index cfdd9e16d..58c39fcc6 100644 --- a/liblib/stub.c +++ b/liblib/stub.c @@ -23,7 +23,7 @@ extern int NCCR_initialize(void); #endif #ifdef USE_PNETCDF -extern int NC5_initialize(void); +extern int NCP_initialize(void); #endif /** @@ -51,7 +51,7 @@ NC_initialize(void) #endif #ifdef USE_PNETCDF - if((stat = NC5_initialize())) return stat; + if((stat = NCP_initialize())) return stat; #endif #ifdef USE_NETCDF4 diff --git a/libsrc/attr.c b/libsrc/attr.c index 3c1c66833..22a961d43 100644 --- a/libsrc/attr.c +++ b/libsrc/attr.c @@ -1,4 +1,6 @@ +#line 5 "attr.m4" /* Do not edit this file. It is produced from the corresponding .m4 source */ +#line 7 /* * Copyright 1996, University Corporation for Atmospheric Research * See netcdf/COPYRIGHT file for copying and redistribution conditions. @@ -611,367 +613,704 @@ NC3_del_att(int ncid, int varid, const char *uname) return NC_NOERR; } +#line 674 static int +#line 675 ncx_pad_putn_Iuchar(void **xpp, size_t nelems, const uchar *tp, nc_type type) +#line 675 { +#line 675 switch(type) { +#line 675 case NC_CHAR: +#line 675 return NC_ECHAR; +#line 675 case NC_BYTE: +#line 675 return ncx_pad_putn_schar_uchar(xpp, nelems, tp); +#line 675 case NC_SHORT: +#line 675 return ncx_pad_putn_short_uchar(xpp, nelems, tp); +#line 675 case NC_INT: +#line 675 return ncx_putn_int_uchar(xpp, nelems, tp); +#line 675 case NC_FLOAT: +#line 675 return ncx_putn_float_uchar(xpp, nelems, tp); +#line 675 case NC_DOUBLE: +#line 675 return ncx_putn_double_uchar(xpp, nelems, tp); +#line 675 default: +#line 675 assert("ncx_pad_putn_Iuchar invalid type" == 0); +#line 675 } +#line 675 return NC_EBADTYPE; +#line 675 } +#line 675 static int +#line 676 ncx_pad_getn_Iuchar(const void **xpp, size_t nelems, uchar *tp, nc_type type) +#line 676 { +#line 676 switch(type) { +#line 676 case NC_CHAR: +#line 676 return NC_ECHAR; +#line 676 case NC_BYTE: +#line 676 return ncx_pad_getn_schar_uchar(xpp, nelems, tp); +#line 676 case NC_SHORT: +#line 676 return ncx_pad_getn_short_uchar(xpp, nelems, tp); +#line 676 case NC_INT: +#line 676 return ncx_getn_int_uchar(xpp, nelems, tp); +#line 676 case NC_FLOAT: +#line 676 return ncx_getn_float_uchar(xpp, nelems, tp); +#line 676 case NC_DOUBLE: +#line 676 return ncx_getn_double_uchar(xpp, nelems, tp); +#line 676 default: +#line 676 assert("ncx_pad_getn_Iuchar invalid type" == 0); +#line 676 } +#line 676 return NC_EBADTYPE; +#line 676 } +#line 676 static int +#line 678 ncx_pad_putn_Ischar(void **xpp, size_t nelems, const schar *tp, nc_type type) +#line 678 { +#line 678 switch(type) { +#line 678 case NC_CHAR: +#line 678 return NC_ECHAR; +#line 678 case NC_BYTE: +#line 678 return ncx_pad_putn_schar_schar(xpp, nelems, tp); +#line 678 case NC_SHORT: +#line 678 return ncx_pad_putn_short_schar(xpp, nelems, tp); +#line 678 case NC_INT: +#line 678 return ncx_putn_int_schar(xpp, nelems, tp); +#line 678 case NC_FLOAT: +#line 678 return ncx_putn_float_schar(xpp, nelems, tp); +#line 678 case NC_DOUBLE: +#line 678 return ncx_putn_double_schar(xpp, nelems, tp); +#line 678 default: +#line 678 assert("ncx_pad_putn_Ischar invalid type" == 0); +#line 678 } +#line 678 return NC_EBADTYPE; +#line 678 } +#line 678 static int +#line 679 ncx_pad_getn_Ischar(const void **xpp, size_t nelems, schar *tp, nc_type type) +#line 679 { +#line 679 switch(type) { +#line 679 case NC_CHAR: +#line 679 return NC_ECHAR; +#line 679 case NC_BYTE: +#line 679 return ncx_pad_getn_schar_schar(xpp, nelems, tp); +#line 679 case NC_SHORT: +#line 679 return ncx_pad_getn_short_schar(xpp, nelems, tp); +#line 679 case NC_INT: +#line 679 return ncx_getn_int_schar(xpp, nelems, tp); +#line 679 case NC_FLOAT: +#line 679 return ncx_getn_float_schar(xpp, nelems, tp); +#line 679 case NC_DOUBLE: +#line 679 return ncx_getn_double_schar(xpp, nelems, tp); +#line 679 default: +#line 679 assert("ncx_pad_getn_Ischar invalid type" == 0); +#line 679 } +#line 679 return NC_EBADTYPE; +#line 679 } +#line 679 static int +#line 681 ncx_pad_putn_Ishort(void **xpp, size_t nelems, const short *tp, nc_type type) +#line 681 { +#line 681 switch(type) { +#line 681 case NC_CHAR: +#line 681 return NC_ECHAR; +#line 681 case NC_BYTE: +#line 681 return ncx_pad_putn_schar_short(xpp, nelems, tp); +#line 681 case NC_SHORT: +#line 681 return ncx_pad_putn_short_short(xpp, nelems, tp); +#line 681 case NC_INT: +#line 681 return ncx_putn_int_short(xpp, nelems, tp); +#line 681 case NC_FLOAT: +#line 681 return ncx_putn_float_short(xpp, nelems, tp); +#line 681 case NC_DOUBLE: +#line 681 return ncx_putn_double_short(xpp, nelems, tp); +#line 681 default: +#line 681 assert("ncx_pad_putn_Ishort invalid type" == 0); +#line 681 } +#line 681 return NC_EBADTYPE; +#line 681 } +#line 681 static int +#line 682 ncx_pad_getn_Ishort(const void **xpp, size_t nelems, short *tp, nc_type type) +#line 682 { +#line 682 switch(type) { +#line 682 case NC_CHAR: +#line 682 return NC_ECHAR; +#line 682 case NC_BYTE: +#line 682 return ncx_pad_getn_schar_short(xpp, nelems, tp); +#line 682 case NC_SHORT: +#line 682 return ncx_pad_getn_short_short(xpp, nelems, tp); +#line 682 case NC_INT: +#line 682 return ncx_getn_int_short(xpp, nelems, tp); +#line 682 case NC_FLOAT: +#line 682 return ncx_getn_float_short(xpp, nelems, tp); +#line 682 case NC_DOUBLE: +#line 682 return ncx_getn_double_short(xpp, nelems, tp); +#line 682 default: +#line 682 assert("ncx_pad_getn_Ishort invalid type" == 0); +#line 682 } +#line 682 return NC_EBADTYPE; +#line 682 } +#line 682 static int +#line 684 ncx_pad_putn_Iint(void **xpp, size_t nelems, const int *tp, nc_type type) +#line 684 { +#line 684 switch(type) { +#line 684 case NC_CHAR: +#line 684 return NC_ECHAR; +#line 684 case NC_BYTE: +#line 684 return ncx_pad_putn_schar_int(xpp, nelems, tp); +#line 684 case NC_SHORT: +#line 684 return ncx_pad_putn_short_int(xpp, nelems, tp); +#line 684 case NC_INT: +#line 684 return ncx_putn_int_int(xpp, nelems, tp); +#line 684 case NC_FLOAT: +#line 684 return ncx_putn_float_int(xpp, nelems, tp); +#line 684 case NC_DOUBLE: +#line 684 return ncx_putn_double_int(xpp, nelems, tp); +#line 684 default: +#line 684 assert("ncx_pad_putn_Iint invalid type" == 0); +#line 684 } +#line 684 return NC_EBADTYPE; +#line 684 } +#line 684 static int +#line 685 ncx_pad_getn_Iint(const void **xpp, size_t nelems, int *tp, nc_type type) +#line 685 { +#line 685 switch(type) { +#line 685 case NC_CHAR: +#line 685 return NC_ECHAR; +#line 685 case NC_BYTE: +#line 685 return ncx_pad_getn_schar_int(xpp, nelems, tp); +#line 685 case NC_SHORT: +#line 685 return ncx_pad_getn_short_int(xpp, nelems, tp); +#line 685 case NC_INT: +#line 685 return ncx_getn_int_int(xpp, nelems, tp); +#line 685 case NC_FLOAT: +#line 685 return ncx_getn_float_int(xpp, nelems, tp); +#line 685 case NC_DOUBLE: +#line 685 return ncx_getn_double_int(xpp, nelems, tp); +#line 685 default: +#line 685 assert("ncx_pad_getn_Iint invalid type" == 0); +#line 685 } +#line 685 return NC_EBADTYPE; +#line 685 } +#line 685 static int +#line 687 ncx_pad_putn_Ifloat(void **xpp, size_t nelems, const float *tp, nc_type type) +#line 687 { +#line 687 switch(type) { +#line 687 case NC_CHAR: +#line 687 return NC_ECHAR; +#line 687 case NC_BYTE: +#line 687 return ncx_pad_putn_schar_float(xpp, nelems, tp); +#line 687 case NC_SHORT: +#line 687 return ncx_pad_putn_short_float(xpp, nelems, tp); +#line 687 case NC_INT: +#line 687 return ncx_putn_int_float(xpp, nelems, tp); +#line 687 case NC_FLOAT: +#line 687 return ncx_putn_float_float(xpp, nelems, tp); +#line 687 case NC_DOUBLE: +#line 687 return ncx_putn_double_float(xpp, nelems, tp); +#line 687 default: +#line 687 assert("ncx_pad_putn_Ifloat invalid type" == 0); +#line 687 } +#line 687 return NC_EBADTYPE; +#line 687 } +#line 687 static int +#line 688 ncx_pad_getn_Ifloat(const void **xpp, size_t nelems, float *tp, nc_type type) +#line 688 { +#line 688 switch(type) { +#line 688 case NC_CHAR: +#line 688 return NC_ECHAR; +#line 688 case NC_BYTE: +#line 688 return ncx_pad_getn_schar_float(xpp, nelems, tp); +#line 688 case NC_SHORT: +#line 688 return ncx_pad_getn_short_float(xpp, nelems, tp); +#line 688 case NC_INT: +#line 688 return ncx_getn_int_float(xpp, nelems, tp); +#line 688 case NC_FLOAT: +#line 688 return ncx_getn_float_float(xpp, nelems, tp); +#line 688 case NC_DOUBLE: +#line 688 return ncx_getn_double_float(xpp, nelems, tp); +#line 688 default: +#line 688 assert("ncx_pad_getn_Ifloat invalid type" == 0); +#line 688 } +#line 688 return NC_EBADTYPE; +#line 688 } +#line 688 static int +#line 690 ncx_pad_putn_Idouble(void **xpp, size_t nelems, const double *tp, nc_type type) +#line 690 { +#line 690 switch(type) { +#line 690 case NC_CHAR: +#line 690 return NC_ECHAR; +#line 690 case NC_BYTE: +#line 690 return ncx_pad_putn_schar_double(xpp, nelems, tp); +#line 690 case NC_SHORT: +#line 690 return ncx_pad_putn_short_double(xpp, nelems, tp); +#line 690 case NC_INT: +#line 690 return ncx_putn_int_double(xpp, nelems, tp); +#line 690 case NC_FLOAT: +#line 690 return ncx_putn_float_double(xpp, nelems, tp); +#line 690 case NC_DOUBLE: +#line 690 return ncx_putn_double_double(xpp, nelems, tp); +#line 690 default: +#line 690 assert("ncx_pad_putn_Idouble invalid type" == 0); +#line 690 } +#line 690 return NC_EBADTYPE; +#line 690 } +#line 690 static int +#line 691 ncx_pad_getn_Idouble(const void **xpp, size_t nelems, double *tp, nc_type type) +#line 691 { +#line 691 switch(type) { +#line 691 case NC_CHAR: +#line 691 return NC_ECHAR; +#line 691 case NC_BYTE: +#line 691 return ncx_pad_getn_schar_double(xpp, nelems, tp); +#line 691 case NC_SHORT: +#line 691 return ncx_pad_getn_short_double(xpp, nelems, tp); +#line 691 case NC_INT: +#line 691 return ncx_getn_int_double(xpp, nelems, tp); +#line 691 case NC_FLOAT: +#line 691 return ncx_getn_float_double(xpp, nelems, tp); +#line 691 case NC_DOUBLE: +#line 691 return ncx_getn_double_double(xpp, nelems, tp); +#line 691 default: +#line 691 assert("ncx_pad_getn_Idouble invalid type" == 0); +#line 691 } +#line 691 return NC_EBADTYPE; +#line 691 } +#line 691 #ifdef IGNORE static int +#line 694 ncx_pad_putn_Ilong(void **xpp, size_t nelems, const long *tp, nc_type type) +#line 694 { +#line 694 switch(type) { +#line 694 case NC_CHAR: +#line 694 return NC_ECHAR; +#line 694 case NC_BYTE: +#line 694 return ncx_pad_putn_schar_long(xpp, nelems, tp); +#line 694 case NC_SHORT: +#line 694 return ncx_pad_putn_short_long(xpp, nelems, tp); +#line 694 case NC_INT: +#line 694 return ncx_putn_int_long(xpp, nelems, tp); +#line 694 case NC_FLOAT: +#line 694 return ncx_putn_float_long(xpp, nelems, tp); +#line 694 case NC_DOUBLE: +#line 694 return ncx_putn_double_long(xpp, nelems, tp); +#line 694 default: +#line 694 assert("ncx_pad_putn_Ilong invalid type" == 0); +#line 694 } +#line 694 return NC_EBADTYPE; +#line 694 } +#line 694 static int +#line 695 ncx_pad_getn_Ilong(const void **xpp, size_t nelems, long *tp, nc_type type) +#line 695 { +#line 695 switch(type) { +#line 695 case NC_CHAR: +#line 695 return NC_ECHAR; +#line 695 case NC_BYTE: +#line 695 return ncx_pad_getn_schar_long(xpp, nelems, tp); +#line 695 case NC_SHORT: +#line 695 return ncx_pad_getn_short_long(xpp, nelems, tp); +#line 695 case NC_INT: +#line 695 return ncx_getn_int_long(xpp, nelems, tp); +#line 695 case NC_FLOAT: +#line 695 return ncx_getn_float_long(xpp, nelems, tp); +#line 695 case NC_DOUBLE: +#line 695 return ncx_getn_double_long(xpp, nelems, tp); +#line 695 default: +#line 695 assert("ncx_pad_getn_Ilong invalid type" == 0); +#line 695 } +#line 695 return NC_EBADTYPE; +#line 695 } +#line 695 #endif static int +#line 698 ncx_pad_putn_Ilonglong(void **xpp, size_t nelems, const longlong *tp, nc_type type) +#line 698 { +#line 698 switch(type) { +#line 698 case NC_CHAR: +#line 698 return NC_ECHAR; +#line 698 case NC_BYTE: +#line 698 return ncx_pad_putn_schar_longlong(xpp, nelems, tp); +#line 698 case NC_SHORT: +#line 698 return ncx_pad_putn_short_longlong(xpp, nelems, tp); +#line 698 case NC_INT: +#line 698 return ncx_putn_int_longlong(xpp, nelems, tp); +#line 698 case NC_FLOAT: +#line 698 return ncx_putn_float_longlong(xpp, nelems, tp); +#line 698 case NC_DOUBLE: +#line 698 return ncx_putn_double_longlong(xpp, nelems, tp); +#line 698 default: +#line 698 assert("ncx_pad_putn_Ilonglong invalid type" == 0); +#line 698 } +#line 698 return NC_EBADTYPE; +#line 698 } +#line 698 static int +#line 699 ncx_pad_getn_Ilonglong(const void **xpp, size_t nelems, longlong *tp, nc_type type) +#line 699 { +#line 699 switch(type) { +#line 699 case NC_CHAR: +#line 699 return NC_ECHAR; +#line 699 case NC_BYTE: +#line 699 return ncx_pad_getn_schar_longlong(xpp, nelems, tp); +#line 699 case NC_SHORT: +#line 699 return ncx_pad_getn_short_longlong(xpp, nelems, tp); +#line 699 case NC_INT: +#line 699 return ncx_getn_int_longlong(xpp, nelems, tp); +#line 699 case NC_FLOAT: +#line 699 return ncx_getn_float_longlong(xpp, nelems, tp); +#line 699 case NC_DOUBLE: +#line 699 return ncx_getn_double_longlong(xpp, nelems, tp); +#line 699 default: +#line 699 assert("ncx_pad_getn_Ilonglong invalid type" == 0); +#line 699 } +#line 699 return NC_EBADTYPE; +#line 699 } +#line 699 diff --git a/libsrc/ncx.c b/libsrc/ncx.c index ba6c58249..31f53f904 100644 --- a/libsrc/ncx.c +++ b/libsrc/ncx.c @@ -1,4 +1,6 @@ +#line 11 "ncx.m4" /* Do not edit this file. It is produced from the corresponding .m4 source */ +#line 13 /* * Copyright 1996, University Corporation for Atmospheric Research * See netcdf/COPYRIGHT file for copying and redistribution conditions. @@ -998,105 +1000,196 @@ static struct sgl_limits min = { { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } /* Min IEEE */ }; +#line 1064 static void get_ix_float(const void *xp, float *ip) { struct vax_single *const vsp = (struct vax_single *) ip; +#line 1067 const struct ieee_single *const isp = +#line 1067 (const struct ieee_single *) xp; +#line 1067 unsigned exp = isp->exp_hi << 1 | isp->exp_lo; +#line 1067 +#line 1067 switch(exp) { +#line 1067 case 0 : +#line 1067 /* ieee subnormal */ +#line 1067 if(isp->mant_hi == min.ieee.mant_hi +#line 1067 && isp->mant_lo_hi == min.ieee.mant_lo_hi +#line 1067 && isp->mant_lo_lo == min.ieee.mant_lo_lo) +#line 1067 { +#line 1067 *vsp = min.s; +#line 1067 } +#line 1067 else +#line 1067 { +#line 1067 unsigned mantissa = (isp->mant_hi << 16) +#line 1067 | isp->mant_lo_hi << 8 +#line 1067 | isp->mant_lo_lo; +#line 1067 unsigned tmp = mantissa >> 20; +#line 1067 if(tmp >= 4) { +#line 1067 vsp->exp = 2; +#line 1067 } else if (tmp >= 2) { +#line 1067 vsp->exp = 1; +#line 1067 } else { +#line 1067 *vsp = min.s; +#line 1067 break; +#line 1067 } /* else */ +#line 1067 tmp = mantissa - (1 << (20 + vsp->exp )); +#line 1067 tmp <<= 3 - vsp->exp; +#line 1067 vsp->mantissa2 = tmp; +#line 1067 vsp->mantissa1 = (tmp >> 16); +#line 1067 } +#line 1067 break; +#line 1067 case 0xfe : +#line 1067 case 0xff : +#line 1067 *vsp = max.s; +#line 1067 break; +#line 1067 default : +#line 1067 vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS; +#line 1067 vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo; +#line 1067 vsp->mantissa1 = isp->mant_hi; +#line 1067 } +#line 1067 +#line 1067 vsp->sign = isp->sign; +#line 1067 } +#line 1121 static void put_ix_float(void *xp, const float *ip) { const struct vax_single *const vsp = +#line 1125 (const struct vax_single *)ip; +#line 1125 struct ieee_single *const isp = (struct ieee_single *) xp; +#line 1125 +#line 1125 switch(vsp->exp){ +#line 1125 case 0 : +#line 1125 /* all vax float with zero exponent map to zero */ +#line 1125 *isp = min.ieee; +#line 1125 break; +#line 1125 case 2 : +#line 1125 case 1 : +#line 1125 { +#line 1125 /* These will map to subnormals */ +#line 1125 unsigned mantissa = (vsp->mantissa1 << 16) +#line 1125 | vsp->mantissa2; +#line 1125 mantissa >>= 3 - vsp->exp; +#line 1125 mantissa += (1 << (20 + vsp->exp)); +#line 1125 isp->mant_lo_lo = mantissa; +#line 1125 isp->mant_lo_hi = mantissa >> 8; +#line 1125 isp->mant_hi = mantissa >> 16; +#line 1125 isp->exp_lo = 0; +#line 1125 isp->exp_hi = 0; +#line 1125 } +#line 1125 break; +#line 1125 case 0xff : /* max.s.exp */ +#line 1125 if( vsp->mantissa2 == max.s.mantissa2 +#line 1125 && vsp->mantissa1 == max.s.mantissa1) +#line 1125 { +#line 1125 /* map largest vax float to ieee infinity */ +#line 1125 *isp = max.ieee; +#line 1125 break; +#line 1125 } /* else, fall thru */ +#line 1125 default : +#line 1125 { +#line 1125 unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS; +#line 1125 isp->exp_hi = exp >> 1; +#line 1125 isp->exp_lo = exp; +#line 1125 isp->mant_lo_lo = vsp->mantissa2; +#line 1125 isp->mant_lo_hi = vsp->mantissa2 >> 8; +#line 1125 isp->mant_hi = vsp->mantissa1; +#line 1125 } +#line 1125 } +#line 1125 +#line 1125 isp->sign = vsp->sign; +#line 1125 } @@ -1156,6 +1249,7 @@ static const int cs_ieis_bias = 0x4000 - 0x7f; static const int cs_id_bias = 0x4000 - 0x3ff; +#line 1260 static void get_ix_float(const void *xp, float *ip) @@ -1165,48 +1259,86 @@ get_ix_float(const void *xp, float *ip) { const ieee_single_hi *isp = (const ieee_single_hi *) xp; cray_single *csp = (cray_single *) ip; +#line 1268 +#line 1268 if(isp->exp == 0) +#line 1268 { +#line 1268 /* ieee subnormal */ +#line 1268 *ip = (double)isp->mant; +#line 1268 if(isp->mant != 0) +#line 1268 { +#line 1268 csp->exp -= (ieee_single_bias + 22); +#line 1268 } +#line 1268 } +#line 1268 else +#line 1268 { +#line 1268 csp->exp = isp->exp + cs_ieis_bias + 1; +#line 1268 csp->mant = isp->mant << (48 - 1 - 23); +#line 1268 csp->mant |= (1 << (48 - 1)); +#line 1268 } +#line 1268 csp->sign = isp->sign; +#line 1268 +#line 1268 } else { const ieee_single_lo *isp = (const ieee_single_lo *) xp; cray_single *csp = (cray_single *) ip; +#line 1273 +#line 1273 if(isp->exp == 0) +#line 1273 { +#line 1273 /* ieee subnormal */ +#line 1273 *ip = (double)isp->mant; +#line 1273 if(isp->mant != 0) +#line 1273 { +#line 1273 csp->exp -= (ieee_single_bias + 22); +#line 1273 } +#line 1273 } +#line 1273 else +#line 1273 { +#line 1273 csp->exp = isp->exp + cs_ieis_bias + 1; +#line 1273 csp->mant = isp->mant << (48 - 1 - 23); +#line 1273 csp->mant |= (1 << (48 - 1)); +#line 1273 } +#line 1273 csp->sign = isp->sign; +#line 1273 +#line 1273 } } @@ -1218,96 +1350,182 @@ put_ix_float(void *xp, const float *ip) { ieee_single_hi *isp = (ieee_single_hi*)xp; const cray_single *csp = (const cray_single *) ip; +#line 1283 int ieee_exp = csp->exp - cs_ieis_bias -1; +#line 1283 +#line 1283 isp->sign = csp->sign; +#line 1283 +#line 1283 if(ieee_exp >= 0xff) +#line 1283 { +#line 1283 /* NC_ERANGE => ieee Inf */ +#line 1283 isp->exp = 0xff; +#line 1283 isp->mant = 0x0; +#line 1283 } +#line 1283 else if(ieee_exp > 0) +#line 1283 { +#line 1283 /* normal ieee representation */ +#line 1283 isp->exp = ieee_exp; +#line 1283 /* assumes cray rep is in normal form */ +#line 1283 assert(csp->mant & 0x800000000000); +#line 1283 isp->mant = (((csp->mant << 1) & +#line 1283 0xffffffffffff) >> (48 - 23)); +#line 1283 } +#line 1283 else if(ieee_exp > -23) +#line 1283 { +#line 1283 /* ieee subnormal, right shift */ +#line 1283 const int rshift = (48 - 23 - ieee_exp); +#line 1283 +#line 1283 isp->mant = csp->mant >> rshift; +#line 1283 +#line 1283 #if 0 +#line 1283 if(csp->mant & (1 << (rshift -1))) +#line 1283 { +#line 1283 /* round up */ +#line 1283 isp->mant++; +#line 1283 } +#line 1283 #endif +#line 1283 +#line 1283 isp->exp = 0; +#line 1283 } +#line 1283 else +#line 1283 { +#line 1283 /* smaller than ieee can represent */ +#line 1283 isp->exp = 0; +#line 1283 isp->mant = 0; +#line 1283 } +#line 1283 } else { ieee_single_lo *isp = (ieee_single_lo*)xp; const cray_single *csp = (const cray_single *) ip; +#line 1288 int ieee_exp = csp->exp - cs_ieis_bias -1; +#line 1288 +#line 1288 isp->sign = csp->sign; +#line 1288 +#line 1288 if(ieee_exp >= 0xff) +#line 1288 { +#line 1288 /* NC_ERANGE => ieee Inf */ +#line 1288 isp->exp = 0xff; +#line 1288 isp->mant = 0x0; +#line 1288 } +#line 1288 else if(ieee_exp > 0) +#line 1288 { +#line 1288 /* normal ieee representation */ +#line 1288 isp->exp = ieee_exp; +#line 1288 /* assumes cray rep is in normal form */ +#line 1288 assert(csp->mant & 0x800000000000); +#line 1288 isp->mant = (((csp->mant << 1) & +#line 1288 0xffffffffffff) >> (48 - 23)); +#line 1288 } +#line 1288 else if(ieee_exp > -23) +#line 1288 { +#line 1288 /* ieee subnormal, right shift */ +#line 1288 const int rshift = (48 - 23 - ieee_exp); +#line 1288 +#line 1288 isp->mant = csp->mant >> rshift; +#line 1288 +#line 1288 #if 0 +#line 1288 if(csp->mant & (1 << (rshift -1))) +#line 1288 { +#line 1288 /* round up */ +#line 1288 isp->mant++; +#line 1288 } +#line 1288 #endif +#line 1288 +#line 1288 isp->exp = 0; +#line 1288 } +#line 1288 else +#line 1288 { +#line 1288 /* smaller than ieee can represent */ +#line 1288 isp->exp = 0; +#line 1288 isp->mant = 0; +#line 1288 } +#line 1288 } } @@ -1640,116 +1858,218 @@ static const struct dbl_limits { }; +#line 1668 static void get_ix_double(const void *xp, double *ip) { struct vax_double *const vdp = +#line 1671 (struct vax_double *)ip; +#line 1671 const struct ieee_double *const idp = +#line 1671 (const struct ieee_double *) xp; +#line 1671 { +#line 1671 const struct dbl_limits *lim; +#line 1671 int ii; +#line 1671 for (ii = 0, lim = dbl_limits; +#line 1671 ii < sizeof(dbl_limits)/sizeof(struct dbl_limits); +#line 1671 ii++, lim++) +#line 1671 { +#line 1671 if ((idp->mant_lo == lim->ieee.mant_lo) +#line 1671 && (idp->mant_4 == lim->ieee.mant_4) +#line 1671 && (idp->mant_5 == lim->ieee.mant_5) +#line 1671 && (idp->mant_6 == lim->ieee.mant_6) +#line 1671 && (idp->exp_lo == lim->ieee.exp_lo) +#line 1671 && (idp->exp_hi == lim->ieee.exp_hi) +#line 1671 ) +#line 1671 { +#line 1671 *vdp = lim->d; +#line 1671 goto doneit; +#line 1671 } +#line 1671 } +#line 1671 } +#line 1671 { +#line 1671 unsigned exp = idp->exp_hi << 4 | idp->exp_lo; +#line 1671 vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS; +#line 1671 } +#line 1671 { +#line 1671 unsigned mant_hi = ((idp->mant_6 << 16) +#line 1671 | (idp->mant_5 << 8) +#line 1671 | idp->mant_4); +#line 1671 unsigned mant_lo = SWAP4(idp->mant_lo); +#line 1671 vdp->mantissa1 = (mant_hi >> 13); +#line 1671 vdp->mantissa2 = ((mant_hi & MASK(13)) << 3) +#line 1671 | (mant_lo >> 29); +#line 1671 vdp->mantissa3 = (mant_lo >> 13); +#line 1671 vdp->mantissa4 = (mant_lo << 3); +#line 1671 } +#line 1671 doneit: +#line 1671 vdp->sign = idp->sign; +#line 1671 } +#line 1741 static void put_ix_double(void *xp, const double *ip) { const struct vax_double *const vdp = +#line 1744 (const struct vax_double *)ip; +#line 1744 struct ieee_double *const idp = +#line 1744 (struct ieee_double *) xp; +#line 1744 +#line 1744 if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) && +#line 1744 (vdp->mantissa3 == dbl_limits[0].d.mantissa3) && +#line 1744 (vdp->mantissa2 == dbl_limits[0].d.mantissa2) && +#line 1744 (vdp->mantissa1 == dbl_limits[0].d.mantissa1) && +#line 1744 (vdp->exp == dbl_limits[0].d.exp)) +#line 1744 { +#line 1744 *idp = dbl_limits[0].ieee; +#line 1744 goto shipit; +#line 1744 } +#line 1744 if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) && +#line 1744 (vdp->mantissa3 == dbl_limits[1].d.mantissa3) && +#line 1744 (vdp->mantissa2 == dbl_limits[1].d.mantissa2) && +#line 1744 (vdp->mantissa1 == dbl_limits[1].d.mantissa1) && +#line 1744 (vdp->exp == dbl_limits[1].d.exp)) +#line 1744 { +#line 1744 *idp = dbl_limits[1].ieee; +#line 1744 goto shipit; +#line 1744 } +#line 1744 +#line 1744 { +#line 1744 unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS; +#line 1744 +#line 1744 unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) | +#line 1744 (vdp->mantissa3 << 13) | +#line 1744 ((vdp->mantissa4 >> 3) & MASK(13)); +#line 1744 +#line 1744 unsigned mant_hi = (vdp->mantissa1 << 13) +#line 1744 | (vdp->mantissa2 >> 3); +#line 1744 +#line 1744 if((vdp->mantissa4 & 7) > 4) +#line 1744 { +#line 1744 /* round up */ +#line 1744 mant_lo++; +#line 1744 if(mant_lo == 0) +#line 1744 { +#line 1744 mant_hi++; +#line 1744 if(mant_hi > 0xffffff) +#line 1744 { +#line 1744 mant_hi = 0; +#line 1744 exp++; +#line 1744 } +#line 1744 } +#line 1744 } +#line 1744 +#line 1744 idp->mant_lo = SWAP4(mant_lo); +#line 1744 idp->mant_6 = mant_hi >> 16; +#line 1744 idp->mant_5 = (mant_hi & 0xff00) >> 8; +#line 1744 idp->mant_4 = mant_hi; +#line 1744 idp->exp_hi = exp >> 4; +#line 1744 idp->exp_lo = exp; +#line 1744 } +#line 1744 +#line 1744 shipit: +#line 1744 idp->sign = vdp->sign; +#line 1744 } @@ -1911,7 +2231,7 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip) { double xx; get_ix_double(xp, &xx); - *ip = (unsigned longlong) xx; + *ip = (unsigned long long) xx; if(xx > ULONG_LONG_MAX || xx < 0) return NC_ERANGE; return ENOERR; @@ -2191,791 +2511,1505 @@ ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t) /* * Aggregate numeric conversion functions. */ +#line 2632 +#line 2639 /* schar */ +#line 2643 int ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *tp) { (void) memcpy(tp, *xpp, nelems); +#line 2646 *xpp = (void *)((char *)(*xpp) + nelems); +#line 2646 return ENOERR; +#line 2646 } +#line 2649 int ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp) { (void) memcpy(tp, *xpp, nelems); +#line 2652 *xpp = (void *)((char *)(*xpp) + nelems); +#line 2652 return ENOERR; +#line 2652 } int +#line 2654 ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp) +#line 2654 { +#line 2654 schar *xp = (schar *)(*xpp); +#line 2654 +#line 2654 while(nelems-- != 0) +#line 2654 { +#line 2654 *tp++ = *xp++; +#line 2654 } +#line 2654 +#line 2654 *xpp = (const void *)xp; +#line 2654 return ENOERR; +#line 2654 } +#line 2654 int +#line 2655 ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp) +#line 2655 { +#line 2655 schar *xp = (schar *)(*xpp); +#line 2655 +#line 2655 while(nelems-- != 0) +#line 2655 { +#line 2655 *tp++ = *xp++; +#line 2655 } +#line 2655 +#line 2655 *xpp = (const void *)xp; +#line 2655 return ENOERR; +#line 2655 } +#line 2655 int +#line 2656 ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp) +#line 2656 { +#line 2656 schar *xp = (schar *)(*xpp); +#line 2656 +#line 2656 while(nelems-- != 0) +#line 2656 { +#line 2656 *tp++ = *xp++; +#line 2656 } +#line 2656 +#line 2656 *xpp = (const void *)xp; +#line 2656 return ENOERR; +#line 2656 } +#line 2656 int +#line 2657 ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp) +#line 2657 { +#line 2657 schar *xp = (schar *)(*xpp); +#line 2657 +#line 2657 while(nelems-- != 0) +#line 2657 { +#line 2657 *tp++ = *xp++; +#line 2657 } +#line 2657 +#line 2657 *xpp = (const void *)xp; +#line 2657 return ENOERR; +#line 2657 } +#line 2657 int +#line 2658 ncx_getn_schar_uint(const void **xpp, size_t nelems, uint *tp) +#line 2658 { +#line 2658 schar *xp = (schar *)(*xpp); +#line 2658 +#line 2658 while(nelems-- != 0) +#line 2658 { +#line 2658 *tp++ = *xp++; +#line 2658 } +#line 2658 +#line 2658 *xpp = (const void *)xp; +#line 2658 return ENOERR; +#line 2658 } +#line 2658 int +#line 2659 ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2659 { +#line 2659 schar *xp = (schar *)(*xpp); +#line 2659 +#line 2659 while(nelems-- != 0) +#line 2659 { +#line 2659 *tp++ = *xp++; +#line 2659 } +#line 2659 +#line 2659 *xpp = (const void *)xp; +#line 2659 return ENOERR; +#line 2659 } +#line 2659 int +#line 2660 ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2660 { +#line 2660 schar *xp = (schar *)(*xpp); +#line 2660 +#line 2660 while(nelems-- != 0) +#line 2660 { +#line 2660 *tp++ = *xp++; +#line 2660 } +#line 2660 +#line 2660 *xpp = (const void *)xp; +#line 2660 return ENOERR; +#line 2660 } +#line 2660 +#line 2663 int ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp) { size_t rndup = nelems % X_ALIGN; +#line 2666 +#line 2666 if(rndup) +#line 2666 rndup = X_ALIGN - rndup; +#line 2666 +#line 2666 (void) memcpy(tp, *xpp, nelems); +#line 2666 *xpp = (void *)((char *)(*xpp) + nelems + rndup); +#line 2666 +#line 2666 return ENOERR; +#line 2666 } +#line 2669 int ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp) { size_t rndup = nelems % X_ALIGN; +#line 2672 +#line 2672 if(rndup) +#line 2672 rndup = X_ALIGN - rndup; +#line 2672 +#line 2672 (void) memcpy(tp, *xpp, nelems); +#line 2672 *xpp = (void *)((char *)(*xpp) + nelems + rndup); +#line 2672 +#line 2672 return ENOERR; +#line 2672 } int +#line 2674 ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp) +#line 2674 { +#line 2674 size_t rndup = nelems % X_ALIGN; +#line 2674 schar *xp = (schar *) *xpp; +#line 2674 +#line 2674 if(rndup) +#line 2674 rndup = X_ALIGN - rndup; +#line 2674 +#line 2674 while(nelems-- != 0) +#line 2674 { +#line 2674 *tp++ = *xp++; +#line 2674 } +#line 2674 +#line 2674 *xpp = (void *)(xp + rndup); +#line 2674 return ENOERR; +#line 2674 } +#line 2674 int +#line 2675 ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp) +#line 2675 { +#line 2675 size_t rndup = nelems % X_ALIGN; +#line 2675 schar *xp = (schar *) *xpp; +#line 2675 +#line 2675 if(rndup) +#line 2675 rndup = X_ALIGN - rndup; +#line 2675 +#line 2675 while(nelems-- != 0) +#line 2675 { +#line 2675 *tp++ = *xp++; +#line 2675 } +#line 2675 +#line 2675 *xpp = (void *)(xp + rndup); +#line 2675 return ENOERR; +#line 2675 } +#line 2675 int +#line 2676 ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp) +#line 2676 { +#line 2676 size_t rndup = nelems % X_ALIGN; +#line 2676 schar *xp = (schar *) *xpp; +#line 2676 +#line 2676 if(rndup) +#line 2676 rndup = X_ALIGN - rndup; +#line 2676 +#line 2676 while(nelems-- != 0) +#line 2676 { +#line 2676 *tp++ = *xp++; +#line 2676 } +#line 2676 +#line 2676 *xpp = (void *)(xp + rndup); +#line 2676 return ENOERR; +#line 2676 } +#line 2676 int +#line 2677 ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp) +#line 2677 { +#line 2677 size_t rndup = nelems % X_ALIGN; +#line 2677 schar *xp = (schar *) *xpp; +#line 2677 +#line 2677 if(rndup) +#line 2677 rndup = X_ALIGN - rndup; +#line 2677 +#line 2677 while(nelems-- != 0) +#line 2677 { +#line 2677 *tp++ = *xp++; +#line 2677 } +#line 2677 +#line 2677 *xpp = (void *)(xp + rndup); +#line 2677 return ENOERR; +#line 2677 } +#line 2677 int +#line 2678 ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, uint *tp) +#line 2678 { +#line 2678 size_t rndup = nelems % X_ALIGN; +#line 2678 schar *xp = (schar *) *xpp; +#line 2678 +#line 2678 if(rndup) +#line 2678 rndup = X_ALIGN - rndup; +#line 2678 +#line 2678 while(nelems-- != 0) +#line 2678 { +#line 2678 *tp++ = *xp++; +#line 2678 } +#line 2678 +#line 2678 *xpp = (void *)(xp + rndup); +#line 2678 return ENOERR; +#line 2678 } +#line 2678 int +#line 2679 ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2679 { +#line 2679 size_t rndup = nelems % X_ALIGN; +#line 2679 schar *xp = (schar *) *xpp; +#line 2679 +#line 2679 if(rndup) +#line 2679 rndup = X_ALIGN - rndup; +#line 2679 +#line 2679 while(nelems-- != 0) +#line 2679 { +#line 2679 *tp++ = *xp++; +#line 2679 } +#line 2679 +#line 2679 *xpp = (void *)(xp + rndup); +#line 2679 return ENOERR; +#line 2679 } +#line 2679 int +#line 2680 ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2680 { +#line 2680 size_t rndup = nelems % X_ALIGN; +#line 2680 schar *xp = (schar *) *xpp; +#line 2680 +#line 2680 if(rndup) +#line 2680 rndup = X_ALIGN - rndup; +#line 2680 +#line 2680 while(nelems-- != 0) +#line 2680 { +#line 2680 *tp++ = *xp++; +#line 2680 } +#line 2680 +#line 2680 *xpp = (void *)(xp + rndup); +#line 2680 return ENOERR; +#line 2680 } +#line 2680 +#line 2683 int ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp) { (void) memcpy(*xpp, tp, nelems); +#line 2686 *xpp = (void *)((char *)(*xpp) + nelems); +#line 2686 +#line 2686 return ENOERR; +#line 2686 } +#line 2689 int ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp) { (void) memcpy(*xpp, tp, nelems); +#line 2692 *xpp = (void *)((char *)(*xpp) + nelems); +#line 2692 +#line 2692 return ENOERR; +#line 2692 } int +#line 2694 ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp) +#line 2694 { +#line 2694 int status = ENOERR; +#line 2694 schar *xp = (schar *) *xpp; +#line 2694 +#line 2694 while(nelems-- != 0) +#line 2694 { +#line 2694 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2694 status = NC_ERANGE; +#line 2694 *xp++ = (schar) *tp++; +#line 2694 } +#line 2694 +#line 2694 *xpp = (void *)xp; +#line 2694 return status; +#line 2694 } +#line 2694 int +#line 2695 ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp) +#line 2695 { +#line 2695 int status = ENOERR; +#line 2695 schar *xp = (schar *) *xpp; +#line 2695 +#line 2695 while(nelems-- != 0) +#line 2695 { +#line 2695 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2695 status = NC_ERANGE; +#line 2695 *xp++ = (schar) *tp++; +#line 2695 } +#line 2695 +#line 2695 *xpp = (void *)xp; +#line 2695 return status; +#line 2695 } +#line 2695 int +#line 2696 ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp) +#line 2696 { +#line 2696 int status = ENOERR; +#line 2696 schar *xp = (schar *) *xpp; +#line 2696 +#line 2696 while(nelems-- != 0) +#line 2696 { +#line 2696 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2696 status = NC_ERANGE; +#line 2696 *xp++ = (schar) *tp++; +#line 2696 } +#line 2696 +#line 2696 *xpp = (void *)xp; +#line 2696 return status; +#line 2696 } +#line 2696 int +#line 2697 ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp) +#line 2697 { +#line 2697 int status = ENOERR; +#line 2697 schar *xp = (schar *) *xpp; +#line 2697 +#line 2697 while(nelems-- != 0) +#line 2697 { +#line 2697 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2697 status = NC_ERANGE; +#line 2697 *xp++ = (schar) *tp++; +#line 2697 } +#line 2697 +#line 2697 *xpp = (void *)xp; +#line 2697 return status; +#line 2697 } +#line 2697 int +#line 2698 ncx_putn_schar_uint(void **xpp, size_t nelems, const uint *tp) +#line 2698 { +#line 2698 int status = ENOERR; +#line 2698 schar *xp = (schar *) *xpp; +#line 2698 +#line 2698 while(nelems-- != 0) +#line 2698 { +#line 2698 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2698 status = NC_ERANGE; +#line 2698 *xp++ = (schar) *tp++; +#line 2698 } +#line 2698 +#line 2698 *xpp = (void *)xp; +#line 2698 return status; +#line 2698 } +#line 2698 int +#line 2699 ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 2699 { +#line 2699 int status = ENOERR; +#line 2699 schar *xp = (schar *) *xpp; +#line 2699 +#line 2699 while(nelems-- != 0) +#line 2699 { +#line 2699 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2699 status = NC_ERANGE; +#line 2699 *xp++ = (schar) *tp++; +#line 2699 } +#line 2699 +#line 2699 *xpp = (void *)xp; +#line 2699 return status; +#line 2699 } +#line 2699 int +#line 2700 ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 2700 { +#line 2700 int status = ENOERR; +#line 2700 schar *xp = (schar *) *xpp; +#line 2700 +#line 2700 while(nelems-- != 0) +#line 2700 { +#line 2700 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2700 status = NC_ERANGE; +#line 2700 *xp++ = (schar) *tp++; +#line 2700 } +#line 2700 +#line 2700 *xpp = (void *)xp; +#line 2700 return status; +#line 2700 } +#line 2700 +#line 2703 int ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp) { size_t rndup = nelems % X_ALIGN; +#line 2706 +#line 2706 if(rndup) +#line 2706 rndup = X_ALIGN - rndup; +#line 2706 +#line 2706 (void) memcpy(*xpp, tp, nelems); +#line 2706 *xpp = (void *)((char *)(*xpp) + nelems); +#line 2706 +#line 2706 if(rndup) +#line 2706 { +#line 2706 (void) memcpy(*xpp, nada, rndup); +#line 2706 *xpp = (void *)((char *)(*xpp) + rndup); +#line 2706 } +#line 2706 +#line 2706 return ENOERR; +#line 2706 } +#line 2709 int ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp) { size_t rndup = nelems % X_ALIGN; +#line 2712 +#line 2712 if(rndup) +#line 2712 rndup = X_ALIGN - rndup; +#line 2712 +#line 2712 (void) memcpy(*xpp, tp, nelems); +#line 2712 *xpp = (void *)((char *)(*xpp) + nelems); +#line 2712 +#line 2712 if(rndup) +#line 2712 { +#line 2712 (void) memcpy(*xpp, nada, rndup); +#line 2712 *xpp = (void *)((char *)(*xpp) + rndup); +#line 2712 } +#line 2712 +#line 2712 return ENOERR; +#line 2712 } int +#line 2714 ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp) +#line 2714 { +#line 2714 int status = ENOERR; +#line 2714 size_t rndup = nelems % X_ALIGN; +#line 2714 schar *xp = (schar *) *xpp; +#line 2714 +#line 2714 if(rndup) +#line 2714 rndup = X_ALIGN - rndup; +#line 2714 +#line 2714 while(nelems-- != 0) +#line 2714 { +#line 2714 /* N.B. schar as signed */ +#line 2714 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2714 status = NC_ERANGE; +#line 2714 *xp++ = (schar) *tp++; +#line 2714 } +#line 2714 +#line 2714 +#line 2714 if(rndup) +#line 2714 { +#line 2714 (void) memcpy(xp, nada, rndup); +#line 2714 xp += rndup; +#line 2714 } +#line 2714 +#line 2714 *xpp = (void *)xp; +#line 2714 return status; +#line 2714 } +#line 2714 int +#line 2715 ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp) +#line 2715 { +#line 2715 int status = ENOERR; +#line 2715 size_t rndup = nelems % X_ALIGN; +#line 2715 schar *xp = (schar *) *xpp; +#line 2715 +#line 2715 if(rndup) +#line 2715 rndup = X_ALIGN - rndup; +#line 2715 +#line 2715 while(nelems-- != 0) +#line 2715 { +#line 2715 /* N.B. schar as signed */ +#line 2715 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2715 status = NC_ERANGE; +#line 2715 *xp++ = (schar) *tp++; +#line 2715 } +#line 2715 +#line 2715 +#line 2715 if(rndup) +#line 2715 { +#line 2715 (void) memcpy(xp, nada, rndup); +#line 2715 xp += rndup; +#line 2715 } +#line 2715 +#line 2715 *xpp = (void *)xp; +#line 2715 return status; +#line 2715 } +#line 2715 int +#line 2716 ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp) +#line 2716 { +#line 2716 int status = ENOERR; +#line 2716 size_t rndup = nelems % X_ALIGN; +#line 2716 schar *xp = (schar *) *xpp; +#line 2716 +#line 2716 if(rndup) +#line 2716 rndup = X_ALIGN - rndup; +#line 2716 +#line 2716 while(nelems-- != 0) +#line 2716 { +#line 2716 /* N.B. schar as signed */ +#line 2716 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2716 status = NC_ERANGE; +#line 2716 *xp++ = (schar) *tp++; +#line 2716 } +#line 2716 +#line 2716 +#line 2716 if(rndup) +#line 2716 { +#line 2716 (void) memcpy(xp, nada, rndup); +#line 2716 xp += rndup; +#line 2716 } +#line 2716 +#line 2716 *xpp = (void *)xp; +#line 2716 return status; +#line 2716 } +#line 2716 int +#line 2717 ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp) +#line 2717 { +#line 2717 int status = ENOERR; +#line 2717 size_t rndup = nelems % X_ALIGN; +#line 2717 schar *xp = (schar *) *xpp; +#line 2717 +#line 2717 if(rndup) +#line 2717 rndup = X_ALIGN - rndup; +#line 2717 +#line 2717 while(nelems-- != 0) +#line 2717 { +#line 2717 /* N.B. schar as signed */ +#line 2717 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2717 status = NC_ERANGE; +#line 2717 *xp++ = (schar) *tp++; +#line 2717 } +#line 2717 +#line 2717 +#line 2717 if(rndup) +#line 2717 { +#line 2717 (void) memcpy(xp, nada, rndup); +#line 2717 xp += rndup; +#line 2717 } +#line 2717 +#line 2717 *xpp = (void *)xp; +#line 2717 return status; +#line 2717 } +#line 2717 int +#line 2718 ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const uint *tp) +#line 2718 { +#line 2718 int status = ENOERR; +#line 2718 size_t rndup = nelems % X_ALIGN; +#line 2718 schar *xp = (schar *) *xpp; +#line 2718 +#line 2718 if(rndup) +#line 2718 rndup = X_ALIGN - rndup; +#line 2718 +#line 2718 while(nelems-- != 0) +#line 2718 { +#line 2718 /* N.B. schar as signed */ +#line 2718 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2718 status = NC_ERANGE; +#line 2718 *xp++ = (schar) *tp++; +#line 2718 } +#line 2718 +#line 2718 +#line 2718 if(rndup) +#line 2718 { +#line 2718 (void) memcpy(xp, nada, rndup); +#line 2718 xp += rndup; +#line 2718 } +#line 2718 +#line 2718 *xpp = (void *)xp; +#line 2718 return status; +#line 2718 } +#line 2718 int +#line 2719 ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 2719 { +#line 2719 int status = ENOERR; +#line 2719 size_t rndup = nelems % X_ALIGN; +#line 2719 schar *xp = (schar *) *xpp; +#line 2719 +#line 2719 if(rndup) +#line 2719 rndup = X_ALIGN - rndup; +#line 2719 +#line 2719 while(nelems-- != 0) +#line 2719 { +#line 2719 /* N.B. schar as signed */ +#line 2719 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2719 status = NC_ERANGE; +#line 2719 *xp++ = (schar) *tp++; +#line 2719 } +#line 2719 +#line 2719 +#line 2719 if(rndup) +#line 2719 { +#line 2719 (void) memcpy(xp, nada, rndup); +#line 2719 xp += rndup; +#line 2719 } +#line 2719 +#line 2719 *xpp = (void *)xp; +#line 2719 return status; +#line 2719 } +#line 2719 int +#line 2720 ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 2720 { +#line 2720 int status = ENOERR; +#line 2720 size_t rndup = nelems % X_ALIGN; +#line 2720 schar *xp = (schar *) *xpp; +#line 2720 +#line 2720 if(rndup) +#line 2720 rndup = X_ALIGN - rndup; +#line 2720 +#line 2720 while(nelems-- != 0) +#line 2720 { +#line 2720 /* N.B. schar as signed */ +#line 2720 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN) +#line 2720 status = NC_ERANGE; +#line 2720 *xp++ = (schar) *tp++; +#line 2720 } +#line 2720 +#line 2720 +#line 2720 if(rndup) +#line 2720 { +#line 2720 (void) memcpy(xp, nada, rndup); +#line 2720 xp += rndup; +#line 2720 } +#line 2720 +#line 2720 *xpp = (void *)xp; +#line 2720 return status; +#line 2720 } +#line 2720 /* short */ int +#line 2725 ncx_getn_short_schar(const void **xpp, size_t nelems, schar *tp) +#line 2725 { +#line 2725 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2725 +#line 2725 /* basic algorithm is: +#line 2725 * - ensure sane alignment of input data +#line 2725 * - copy (conversion happens automatically) input data +#line 2725 * to output +#line 2725 * - update xpp to point at next unconverted input, and tp to point +#line 2725 * at next location for converted output +#line 2725 */ +#line 2725 long i, j, ni; +#line 2725 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2725 short *xp; +#line 2725 int nrange = 0; /* number of range errors */ +#line 2725 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2725 long cxp = (long) *((char**)xpp); +#line 2725 +#line 2725 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2725 /* sjl: manually stripmine so we can limit amount of +#line 2725 * vector work space reserved to LOOPCNT elements. Also +#line 2725 * makes vectorisation easy */ +#line 2725 for (j=0; j SCHAR_MAX; +#line 2725 } +#line 2725 /* update xpp and tp */ +#line 2725 if (realign) xp = (short *) *xpp; +#line 2725 xp += ni; +#line 2725 tp += ni; +#line 2725 *xpp = (void*)xp; +#line 2725 } +#line 2725 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2725 +#line 2725 #else /* not SX */ +#line 2725 const char *xp = (const char *) *xpp; +#line 2725 int status = ENOERR; +#line 2725 +#line 2725 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2725 { +#line 2725 const int lstatus = ncx_get_short_schar(xp, tp); +#line 2725 if(lstatus != ENOERR) +#line 2725 status = lstatus; +#line 2725 } +#line 2725 +#line 2725 *xpp = (const void *)xp; +#line 2725 return status; +#line 2725 # endif +#line 2725 } +#line 2725 int +#line 2726 ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp) +#line 2726 { +#line 2726 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2726 +#line 2726 /* basic algorithm is: +#line 2726 * - ensure sane alignment of input data +#line 2726 * - copy (conversion happens automatically) input data +#line 2726 * to output +#line 2726 * - update xpp to point at next unconverted input, and tp to point +#line 2726 * at next location for converted output +#line 2726 */ +#line 2726 long i, j, ni; +#line 2726 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2726 short *xp; +#line 2726 int nrange = 0; /* number of range errors */ +#line 2726 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2726 long cxp = (long) *((char**)xpp); +#line 2726 +#line 2726 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2726 /* sjl: manually stripmine so we can limit amount of +#line 2726 * vector work space reserved to LOOPCNT elements. Also +#line 2726 * makes vectorisation easy */ +#line 2726 for (j=0; j UCHAR_MAX; +#line 2726 } +#line 2726 /* update xpp and tp */ +#line 2726 if (realign) xp = (short *) *xpp; +#line 2726 xp += ni; +#line 2726 tp += ni; +#line 2726 *xpp = (void*)xp; +#line 2726 } +#line 2726 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2726 +#line 2726 #else /* not SX */ +#line 2726 const char *xp = (const char *) *xpp; +#line 2726 int status = ENOERR; +#line 2726 +#line 2726 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2726 { +#line 2726 const int lstatus = ncx_get_short_uchar(xp, tp); +#line 2726 if(lstatus != ENOERR) +#line 2726 status = lstatus; +#line 2726 } +#line 2726 +#line 2726 *xpp = (const void *)xp; +#line 2726 return status; +#line 2726 # endif +#line 2726 } +#line 2726 #if X_SIZEOF_SHORT == SIZEOF_SHORT /* optimized version */ @@ -2992,782 +4026,1539 @@ ncx_getn_short_short(const void **xpp, size_t nelems, short *tp) } #else int +#line 2741 ncx_getn_short_short(const void **xpp, size_t nelems, short *tp) +#line 2741 { +#line 2741 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2741 +#line 2741 /* basic algorithm is: +#line 2741 * - ensure sane alignment of input data +#line 2741 * - copy (conversion happens automatically) input data +#line 2741 * to output +#line 2741 * - update xpp to point at next unconverted input, and tp to point +#line 2741 * at next location for converted output +#line 2741 */ +#line 2741 long i, j, ni; +#line 2741 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2741 short *xp; +#line 2741 int nrange = 0; /* number of range errors */ +#line 2741 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2741 long cxp = (long) *((char**)xpp); +#line 2741 +#line 2741 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2741 /* sjl: manually stripmine so we can limit amount of +#line 2741 * vector work space reserved to LOOPCNT elements. Also +#line 2741 * makes vectorisation easy */ +#line 2741 for (j=0; j SHORT_MAX; +#line 2741 } +#line 2741 /* update xpp and tp */ +#line 2741 if (realign) xp = (short *) *xpp; +#line 2741 xp += ni; +#line 2741 tp += ni; +#line 2741 *xpp = (void*)xp; +#line 2741 } +#line 2741 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2741 +#line 2741 #else /* not SX */ +#line 2741 const char *xp = (const char *) *xpp; +#line 2741 int status = ENOERR; +#line 2741 +#line 2741 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2741 { +#line 2741 const int lstatus = ncx_get_short_short(xp, tp); +#line 2741 if(lstatus != ENOERR) +#line 2741 status = lstatus; +#line 2741 } +#line 2741 +#line 2741 *xpp = (const void *)xp; +#line 2741 return status; +#line 2741 # endif +#line 2741 } +#line 2741 #endif int +#line 2743 ncx_getn_short_int(const void **xpp, size_t nelems, int *tp) +#line 2743 { +#line 2743 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2743 +#line 2743 /* basic algorithm is: +#line 2743 * - ensure sane alignment of input data +#line 2743 * - copy (conversion happens automatically) input data +#line 2743 * to output +#line 2743 * - update xpp to point at next unconverted input, and tp to point +#line 2743 * at next location for converted output +#line 2743 */ +#line 2743 long i, j, ni; +#line 2743 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2743 short *xp; +#line 2743 int nrange = 0; /* number of range errors */ +#line 2743 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2743 long cxp = (long) *((char**)xpp); +#line 2743 +#line 2743 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2743 /* sjl: manually stripmine so we can limit amount of +#line 2743 * vector work space reserved to LOOPCNT elements. Also +#line 2743 * makes vectorisation easy */ +#line 2743 for (j=0; j INT_MAX; +#line 2743 } +#line 2743 /* update xpp and tp */ +#line 2743 if (realign) xp = (short *) *xpp; +#line 2743 xp += ni; +#line 2743 tp += ni; +#line 2743 *xpp = (void*)xp; +#line 2743 } +#line 2743 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2743 +#line 2743 #else /* not SX */ +#line 2743 const char *xp = (const char *) *xpp; +#line 2743 int status = ENOERR; +#line 2743 +#line 2743 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2743 { +#line 2743 const int lstatus = ncx_get_short_int(xp, tp); +#line 2743 if(lstatus != ENOERR) +#line 2743 status = lstatus; +#line 2743 } +#line 2743 +#line 2743 *xpp = (const void *)xp; +#line 2743 return status; +#line 2743 # endif +#line 2743 } +#line 2743 int +#line 2744 ncx_getn_short_float(const void **xpp, size_t nelems, float *tp) +#line 2744 { +#line 2744 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2744 +#line 2744 /* basic algorithm is: +#line 2744 * - ensure sane alignment of input data +#line 2744 * - copy (conversion happens automatically) input data +#line 2744 * to output +#line 2744 * - update xpp to point at next unconverted input, and tp to point +#line 2744 * at next location for converted output +#line 2744 */ +#line 2744 long i, j, ni; +#line 2744 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2744 short *xp; +#line 2744 int nrange = 0; /* number of range errors */ +#line 2744 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2744 long cxp = (long) *((char**)xpp); +#line 2744 +#line 2744 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2744 /* sjl: manually stripmine so we can limit amount of +#line 2744 * vector work space reserved to LOOPCNT elements. Also +#line 2744 * makes vectorisation easy */ +#line 2744 for (j=0; j FLOAT_MAX; +#line 2744 } +#line 2744 /* update xpp and tp */ +#line 2744 if (realign) xp = (short *) *xpp; +#line 2744 xp += ni; +#line 2744 tp += ni; +#line 2744 *xpp = (void*)xp; +#line 2744 } +#line 2744 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2744 +#line 2744 #else /* not SX */ +#line 2744 const char *xp = (const char *) *xpp; +#line 2744 int status = ENOERR; +#line 2744 +#line 2744 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2744 { +#line 2744 const int lstatus = ncx_get_short_float(xp, tp); +#line 2744 if(lstatus != ENOERR) +#line 2744 status = lstatus; +#line 2744 } +#line 2744 +#line 2744 *xpp = (const void *)xp; +#line 2744 return status; +#line 2744 # endif +#line 2744 } +#line 2744 int +#line 2745 ncx_getn_short_double(const void **xpp, size_t nelems, double *tp) +#line 2745 { +#line 2745 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2745 +#line 2745 /* basic algorithm is: +#line 2745 * - ensure sane alignment of input data +#line 2745 * - copy (conversion happens automatically) input data +#line 2745 * to output +#line 2745 * - update xpp to point at next unconverted input, and tp to point +#line 2745 * at next location for converted output +#line 2745 */ +#line 2745 long i, j, ni; +#line 2745 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2745 short *xp; +#line 2745 int nrange = 0; /* number of range errors */ +#line 2745 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2745 long cxp = (long) *((char**)xpp); +#line 2745 +#line 2745 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2745 /* sjl: manually stripmine so we can limit amount of +#line 2745 * vector work space reserved to LOOPCNT elements. Also +#line 2745 * makes vectorisation easy */ +#line 2745 for (j=0; j DOUBLE_MAX; +#line 2745 } +#line 2745 /* update xpp and tp */ +#line 2745 if (realign) xp = (short *) *xpp; +#line 2745 xp += ni; +#line 2745 tp += ni; +#line 2745 *xpp = (void*)xp; +#line 2745 } +#line 2745 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2745 +#line 2745 #else /* not SX */ +#line 2745 const char *xp = (const char *) *xpp; +#line 2745 int status = ENOERR; +#line 2745 +#line 2745 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2745 { +#line 2745 const int lstatus = ncx_get_short_double(xp, tp); +#line 2745 if(lstatus != ENOERR) +#line 2745 status = lstatus; +#line 2745 } +#line 2745 +#line 2745 *xpp = (const void *)xp; +#line 2745 return status; +#line 2745 # endif +#line 2745 } +#line 2745 int +#line 2746 ncx_getn_short_uint(const void **xpp, size_t nelems, uint *tp) +#line 2746 { +#line 2746 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2746 +#line 2746 /* basic algorithm is: +#line 2746 * - ensure sane alignment of input data +#line 2746 * - copy (conversion happens automatically) input data +#line 2746 * to output +#line 2746 * - update xpp to point at next unconverted input, and tp to point +#line 2746 * at next location for converted output +#line 2746 */ +#line 2746 long i, j, ni; +#line 2746 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2746 short *xp; +#line 2746 int nrange = 0; /* number of range errors */ +#line 2746 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2746 long cxp = (long) *((char**)xpp); +#line 2746 +#line 2746 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2746 /* sjl: manually stripmine so we can limit amount of +#line 2746 * vector work space reserved to LOOPCNT elements. Also +#line 2746 * makes vectorisation easy */ +#line 2746 for (j=0; j UINT_MAX; +#line 2746 } +#line 2746 /* update xpp and tp */ +#line 2746 if (realign) xp = (short *) *xpp; +#line 2746 xp += ni; +#line 2746 tp += ni; +#line 2746 *xpp = (void*)xp; +#line 2746 } +#line 2746 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2746 +#line 2746 #else /* not SX */ +#line 2746 const char *xp = (const char *) *xpp; +#line 2746 int status = ENOERR; +#line 2746 +#line 2746 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2746 { +#line 2746 const int lstatus = ncx_get_short_uint(xp, tp); +#line 2746 if(lstatus != ENOERR) +#line 2746 status = lstatus; +#line 2746 } +#line 2746 +#line 2746 *xpp = (const void *)xp; +#line 2746 return status; +#line 2746 # endif +#line 2746 } +#line 2746 int +#line 2747 ncx_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2747 { +#line 2747 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2747 +#line 2747 /* basic algorithm is: +#line 2747 * - ensure sane alignment of input data +#line 2747 * - copy (conversion happens automatically) input data +#line 2747 * to output +#line 2747 * - update xpp to point at next unconverted input, and tp to point +#line 2747 * at next location for converted output +#line 2747 */ +#line 2747 long i, j, ni; +#line 2747 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2747 short *xp; +#line 2747 int nrange = 0; /* number of range errors */ +#line 2747 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2747 long cxp = (long) *((char**)xpp); +#line 2747 +#line 2747 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2747 /* sjl: manually stripmine so we can limit amount of +#line 2747 * vector work space reserved to LOOPCNT elements. Also +#line 2747 * makes vectorisation easy */ +#line 2747 for (j=0; j LONGLONG_MAX; +#line 2747 } +#line 2747 /* update xpp and tp */ +#line 2747 if (realign) xp = (short *) *xpp; +#line 2747 xp += ni; +#line 2747 tp += ni; +#line 2747 *xpp = (void*)xp; +#line 2747 } +#line 2747 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2747 +#line 2747 #else /* not SX */ +#line 2747 const char *xp = (const char *) *xpp; +#line 2747 int status = ENOERR; +#line 2747 +#line 2747 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2747 { +#line 2747 const int lstatus = ncx_get_short_longlong(xp, tp); +#line 2747 if(lstatus != ENOERR) +#line 2747 status = lstatus; +#line 2747 } +#line 2747 +#line 2747 *xpp = (const void *)xp; +#line 2747 return status; +#line 2747 # endif +#line 2747 } +#line 2747 int +#line 2748 ncx_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2748 { +#line 2748 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2748 +#line 2748 /* basic algorithm is: +#line 2748 * - ensure sane alignment of input data +#line 2748 * - copy (conversion happens automatically) input data +#line 2748 * to output +#line 2748 * - update xpp to point at next unconverted input, and tp to point +#line 2748 * at next location for converted output +#line 2748 */ +#line 2748 long i, j, ni; +#line 2748 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2748 short *xp; +#line 2748 int nrange = 0; /* number of range errors */ +#line 2748 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2748 long cxp = (long) *((char**)xpp); +#line 2748 +#line 2748 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2748 /* sjl: manually stripmine so we can limit amount of +#line 2748 * vector work space reserved to LOOPCNT elements. Also +#line 2748 * makes vectorisation easy */ +#line 2748 for (j=0; j ULONGLONG_MAX; +#line 2748 } +#line 2748 /* update xpp and tp */ +#line 2748 if (realign) xp = (short *) *xpp; +#line 2748 xp += ni; +#line 2748 tp += ni; +#line 2748 *xpp = (void*)xp; +#line 2748 } +#line 2748 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2748 +#line 2748 #else /* not SX */ +#line 2748 const char *xp = (const char *) *xpp; +#line 2748 int status = ENOERR; +#line 2748 +#line 2748 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2748 { +#line 2748 const int lstatus = ncx_get_short_ulonglong(xp, tp); +#line 2748 if(lstatus != ENOERR) +#line 2748 status = lstatus; +#line 2748 } +#line 2748 +#line 2748 *xpp = (const void *)xp; +#line 2748 return status; +#line 2748 # endif +#line 2748 } +#line 2748 int +#line 2750 ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *tp) +#line 2750 { +#line 2750 const size_t rndup = nelems % 2; +#line 2750 +#line 2750 const char *xp = (const char *) *xpp; +#line 2750 int status = ENOERR; +#line 2750 +#line 2750 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2750 { +#line 2750 const int lstatus = ncx_get_short_schar(xp, tp); +#line 2750 if(lstatus != ENOERR) +#line 2750 status = lstatus; +#line 2750 } +#line 2750 +#line 2750 if(rndup != 0) +#line 2750 xp += X_SIZEOF_SHORT; +#line 2750 +#line 2750 *xpp = (void *)xp; +#line 2750 return status; +#line 2750 } +#line 2750 int +#line 2751 ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp) +#line 2751 { +#line 2751 const size_t rndup = nelems % 2; +#line 2751 +#line 2751 const char *xp = (const char *) *xpp; +#line 2751 int status = ENOERR; +#line 2751 +#line 2751 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2751 { +#line 2751 const int lstatus = ncx_get_short_uchar(xp, tp); +#line 2751 if(lstatus != ENOERR) +#line 2751 status = lstatus; +#line 2751 } +#line 2751 +#line 2751 if(rndup != 0) +#line 2751 xp += X_SIZEOF_SHORT; +#line 2751 +#line 2751 *xpp = (void *)xp; +#line 2751 return status; +#line 2751 } +#line 2751 int +#line 2752 ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *tp) +#line 2752 { +#line 2752 const size_t rndup = nelems % 2; +#line 2752 +#line 2752 const char *xp = (const char *) *xpp; +#line 2752 int status = ENOERR; +#line 2752 +#line 2752 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2752 { +#line 2752 const int lstatus = ncx_get_short_short(xp, tp); +#line 2752 if(lstatus != ENOERR) +#line 2752 status = lstatus; +#line 2752 } +#line 2752 +#line 2752 if(rndup != 0) +#line 2752 xp += X_SIZEOF_SHORT; +#line 2752 +#line 2752 *xpp = (void *)xp; +#line 2752 return status; +#line 2752 } +#line 2752 int +#line 2753 ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp) +#line 2753 { +#line 2753 const size_t rndup = nelems % 2; +#line 2753 +#line 2753 const char *xp = (const char *) *xpp; +#line 2753 int status = ENOERR; +#line 2753 +#line 2753 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2753 { +#line 2753 const int lstatus = ncx_get_short_int(xp, tp); +#line 2753 if(lstatus != ENOERR) +#line 2753 status = lstatus; +#line 2753 } +#line 2753 +#line 2753 if(rndup != 0) +#line 2753 xp += X_SIZEOF_SHORT; +#line 2753 +#line 2753 *xpp = (void *)xp; +#line 2753 return status; +#line 2753 } +#line 2753 int +#line 2754 ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp) +#line 2754 { +#line 2754 const size_t rndup = nelems % 2; +#line 2754 +#line 2754 const char *xp = (const char *) *xpp; +#line 2754 int status = ENOERR; +#line 2754 +#line 2754 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2754 { +#line 2754 const int lstatus = ncx_get_short_float(xp, tp); +#line 2754 if(lstatus != ENOERR) +#line 2754 status = lstatus; +#line 2754 } +#line 2754 +#line 2754 if(rndup != 0) +#line 2754 xp += X_SIZEOF_SHORT; +#line 2754 +#line 2754 *xpp = (void *)xp; +#line 2754 return status; +#line 2754 } +#line 2754 int +#line 2755 ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp) +#line 2755 { +#line 2755 const size_t rndup = nelems % 2; +#line 2755 +#line 2755 const char *xp = (const char *) *xpp; +#line 2755 int status = ENOERR; +#line 2755 +#line 2755 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2755 { +#line 2755 const int lstatus = ncx_get_short_double(xp, tp); +#line 2755 if(lstatus != ENOERR) +#line 2755 status = lstatus; +#line 2755 } +#line 2755 +#line 2755 if(rndup != 0) +#line 2755 xp += X_SIZEOF_SHORT; +#line 2755 +#line 2755 *xpp = (void *)xp; +#line 2755 return status; +#line 2755 } +#line 2755 int +#line 2756 ncx_pad_getn_short_uint(const void **xpp, size_t nelems, uint *tp) +#line 2756 { +#line 2756 const size_t rndup = nelems % 2; +#line 2756 +#line 2756 const char *xp = (const char *) *xpp; +#line 2756 int status = ENOERR; +#line 2756 +#line 2756 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2756 { +#line 2756 const int lstatus = ncx_get_short_uint(xp, tp); +#line 2756 if(lstatus != ENOERR) +#line 2756 status = lstatus; +#line 2756 } +#line 2756 +#line 2756 if(rndup != 0) +#line 2756 xp += X_SIZEOF_SHORT; +#line 2756 +#line 2756 *xpp = (void *)xp; +#line 2756 return status; +#line 2756 } +#line 2756 int +#line 2757 ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2757 { +#line 2757 const size_t rndup = nelems % 2; +#line 2757 +#line 2757 const char *xp = (const char *) *xpp; +#line 2757 int status = ENOERR; +#line 2757 +#line 2757 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2757 { +#line 2757 const int lstatus = ncx_get_short_longlong(xp, tp); +#line 2757 if(lstatus != ENOERR) +#line 2757 status = lstatus; +#line 2757 } +#line 2757 +#line 2757 if(rndup != 0) +#line 2757 xp += X_SIZEOF_SHORT; +#line 2757 +#line 2757 *xpp = (void *)xp; +#line 2757 return status; +#line 2757 } +#line 2757 int +#line 2758 ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2758 { +#line 2758 const size_t rndup = nelems % 2; +#line 2758 +#line 2758 const char *xp = (const char *) *xpp; +#line 2758 int status = ENOERR; +#line 2758 +#line 2758 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2758 { +#line 2758 const int lstatus = ncx_get_short_ulonglong(xp, tp); +#line 2758 if(lstatus != ENOERR) +#line 2758 status = lstatus; +#line 2758 } +#line 2758 +#line 2758 if(rndup != 0) +#line 2758 xp += X_SIZEOF_SHORT; +#line 2758 +#line 2758 *xpp = (void *)xp; +#line 2758 return status; +#line 2758 } +#line 2758 int +#line 2760 ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp) +#line 2760 { +#line 2760 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2760 +#line 2760 /* basic algorithm is: +#line 2760 * - ensure sane alignment of output data +#line 2760 * - copy (conversion happens automatically) input data +#line 2760 * to output +#line 2760 * - update tp to point at next unconverted input, and xpp to point +#line 2760 * at next location for converted output +#line 2760 */ +#line 2760 long i, j, ni; +#line 2760 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2760 short *xp; +#line 2760 int nrange = 0; /* number of range errors */ +#line 2760 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2760 long cxp = (long) *((char**)xpp); +#line 2760 +#line 2760 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2760 /* sjl: manually stripmine so we can limit amount of +#line 2760 * vector work space reserved to LOOPCNT elements. Also +#line 2760 * makes vectorisation easy */ +#line 2760 for (j=0; j X_SHORT_MAX; +#line 2760 } +#line 2760 /* copy workspace back if necessary */ +#line 2760 if (realign) { +#line 2760 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2760 xp = (short *) *xpp; +#line 2760 } +#line 2760 /* update xpp and tp */ +#line 2760 xp += ni; +#line 2760 tp += ni; +#line 2760 *xpp = (void*)xp; +#line 2760 } +#line 2760 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2760 +#line 2760 #else /* not SX */ +#line 2760 +#line 2760 char *xp = (char *) *xpp; +#line 2760 int status = ENOERR; +#line 2760 +#line 2760 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2760 { +#line 2760 int lstatus = ncx_put_short_schar(xp, tp); +#line 2760 if(lstatus != ENOERR) +#line 2760 status = lstatus; +#line 2760 } +#line 2760 +#line 2760 *xpp = (void *)xp; +#line 2760 return status; +#line 2760 #endif +#line 2760 } +#line 2760 int +#line 2761 ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp) +#line 2761 { +#line 2761 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2761 +#line 2761 /* basic algorithm is: +#line 2761 * - ensure sane alignment of output data +#line 2761 * - copy (conversion happens automatically) input data +#line 2761 * to output +#line 2761 * - update tp to point at next unconverted input, and xpp to point +#line 2761 * at next location for converted output +#line 2761 */ +#line 2761 long i, j, ni; +#line 2761 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2761 short *xp; +#line 2761 int nrange = 0; /* number of range errors */ +#line 2761 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2761 long cxp = (long) *((char**)xpp); +#line 2761 +#line 2761 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2761 /* sjl: manually stripmine so we can limit amount of +#line 2761 * vector work space reserved to LOOPCNT elements. Also +#line 2761 * makes vectorisation easy */ +#line 2761 for (j=0; j X_SHORT_MAX; +#line 2761 } +#line 2761 /* copy workspace back if necessary */ +#line 2761 if (realign) { +#line 2761 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2761 xp = (short *) *xpp; +#line 2761 } +#line 2761 /* update xpp and tp */ +#line 2761 xp += ni; +#line 2761 tp += ni; +#line 2761 *xpp = (void*)xp; +#line 2761 } +#line 2761 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2761 +#line 2761 #else /* not SX */ +#line 2761 +#line 2761 char *xp = (char *) *xpp; +#line 2761 int status = ENOERR; +#line 2761 +#line 2761 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2761 { +#line 2761 int lstatus = ncx_put_short_uchar(xp, tp); +#line 2761 if(lstatus != ENOERR) +#line 2761 status = lstatus; +#line 2761 } +#line 2761 +#line 2761 *xpp = (void *)xp; +#line 2761 return status; +#line 2761 #endif +#line 2761 } +#line 2761 #if X_SIZEOF_SHORT == SIZEOF_SHORT /* optimized version */ @@ -3784,900 +5575,1771 @@ ncx_putn_short_short(void **xpp, size_t nelems, const short *tp) } #else int +#line 2776 ncx_putn_short_short(void **xpp, size_t nelems, const short *tp) +#line 2776 { +#line 2776 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2776 +#line 2776 /* basic algorithm is: +#line 2776 * - ensure sane alignment of output data +#line 2776 * - copy (conversion happens automatically) input data +#line 2776 * to output +#line 2776 * - update tp to point at next unconverted input, and xpp to point +#line 2776 * at next location for converted output +#line 2776 */ +#line 2776 long i, j, ni; +#line 2776 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2776 short *xp; +#line 2776 int nrange = 0; /* number of range errors */ +#line 2776 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2776 long cxp = (long) *((char**)xpp); +#line 2776 +#line 2776 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2776 /* sjl: manually stripmine so we can limit amount of +#line 2776 * vector work space reserved to LOOPCNT elements. Also +#line 2776 * makes vectorisation easy */ +#line 2776 for (j=0; j X_SHORT_MAX; +#line 2776 } +#line 2776 /* copy workspace back if necessary */ +#line 2776 if (realign) { +#line 2776 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2776 xp = (short *) *xpp; +#line 2776 } +#line 2776 /* update xpp and tp */ +#line 2776 xp += ni; +#line 2776 tp += ni; +#line 2776 *xpp = (void*)xp; +#line 2776 } +#line 2776 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2776 +#line 2776 #else /* not SX */ +#line 2776 +#line 2776 char *xp = (char *) *xpp; +#line 2776 int status = ENOERR; +#line 2776 +#line 2776 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2776 { +#line 2776 int lstatus = ncx_put_short_short(xp, tp); +#line 2776 if(lstatus != ENOERR) +#line 2776 status = lstatus; +#line 2776 } +#line 2776 +#line 2776 *xpp = (void *)xp; +#line 2776 return status; +#line 2776 #endif +#line 2776 } +#line 2776 #endif int +#line 2778 ncx_putn_short_int(void **xpp, size_t nelems, const int *tp) +#line 2778 { +#line 2778 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2778 +#line 2778 /* basic algorithm is: +#line 2778 * - ensure sane alignment of output data +#line 2778 * - copy (conversion happens automatically) input data +#line 2778 * to output +#line 2778 * - update tp to point at next unconverted input, and xpp to point +#line 2778 * at next location for converted output +#line 2778 */ +#line 2778 long i, j, ni; +#line 2778 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2778 short *xp; +#line 2778 int nrange = 0; /* number of range errors */ +#line 2778 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2778 long cxp = (long) *((char**)xpp); +#line 2778 +#line 2778 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2778 /* sjl: manually stripmine so we can limit amount of +#line 2778 * vector work space reserved to LOOPCNT elements. Also +#line 2778 * makes vectorisation easy */ +#line 2778 for (j=0; j X_SHORT_MAX; +#line 2778 } +#line 2778 /* copy workspace back if necessary */ +#line 2778 if (realign) { +#line 2778 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2778 xp = (short *) *xpp; +#line 2778 } +#line 2778 /* update xpp and tp */ +#line 2778 xp += ni; +#line 2778 tp += ni; +#line 2778 *xpp = (void*)xp; +#line 2778 } +#line 2778 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2778 +#line 2778 #else /* not SX */ +#line 2778 +#line 2778 char *xp = (char *) *xpp; +#line 2778 int status = ENOERR; +#line 2778 +#line 2778 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2778 { +#line 2778 int lstatus = ncx_put_short_int(xp, tp); +#line 2778 if(lstatus != ENOERR) +#line 2778 status = lstatus; +#line 2778 } +#line 2778 +#line 2778 *xpp = (void *)xp; +#line 2778 return status; +#line 2778 #endif +#line 2778 } +#line 2778 int +#line 2779 ncx_putn_short_float(void **xpp, size_t nelems, const float *tp) +#line 2779 { +#line 2779 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2779 +#line 2779 /* basic algorithm is: +#line 2779 * - ensure sane alignment of output data +#line 2779 * - copy (conversion happens automatically) input data +#line 2779 * to output +#line 2779 * - update tp to point at next unconverted input, and xpp to point +#line 2779 * at next location for converted output +#line 2779 */ +#line 2779 long i, j, ni; +#line 2779 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2779 short *xp; +#line 2779 int nrange = 0; /* number of range errors */ +#line 2779 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2779 long cxp = (long) *((char**)xpp); +#line 2779 +#line 2779 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2779 /* sjl: manually stripmine so we can limit amount of +#line 2779 * vector work space reserved to LOOPCNT elements. Also +#line 2779 * makes vectorisation easy */ +#line 2779 for (j=0; j X_SHORT_MAX; +#line 2779 } +#line 2779 /* copy workspace back if necessary */ +#line 2779 if (realign) { +#line 2779 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2779 xp = (short *) *xpp; +#line 2779 } +#line 2779 /* update xpp and tp */ +#line 2779 xp += ni; +#line 2779 tp += ni; +#line 2779 *xpp = (void*)xp; +#line 2779 } +#line 2779 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2779 +#line 2779 #else /* not SX */ +#line 2779 +#line 2779 char *xp = (char *) *xpp; +#line 2779 int status = ENOERR; +#line 2779 +#line 2779 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2779 { +#line 2779 int lstatus = ncx_put_short_float(xp, tp); +#line 2779 if(lstatus != ENOERR) +#line 2779 status = lstatus; +#line 2779 } +#line 2779 +#line 2779 *xpp = (void *)xp; +#line 2779 return status; +#line 2779 #endif +#line 2779 } +#line 2779 int +#line 2780 ncx_putn_short_double(void **xpp, size_t nelems, const double *tp) +#line 2780 { +#line 2780 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2780 +#line 2780 /* basic algorithm is: +#line 2780 * - ensure sane alignment of output data +#line 2780 * - copy (conversion happens automatically) input data +#line 2780 * to output +#line 2780 * - update tp to point at next unconverted input, and xpp to point +#line 2780 * at next location for converted output +#line 2780 */ +#line 2780 long i, j, ni; +#line 2780 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2780 short *xp; +#line 2780 int nrange = 0; /* number of range errors */ +#line 2780 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2780 long cxp = (long) *((char**)xpp); +#line 2780 +#line 2780 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2780 /* sjl: manually stripmine so we can limit amount of +#line 2780 * vector work space reserved to LOOPCNT elements. Also +#line 2780 * makes vectorisation easy */ +#line 2780 for (j=0; j X_SHORT_MAX; +#line 2780 } +#line 2780 /* copy workspace back if necessary */ +#line 2780 if (realign) { +#line 2780 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2780 xp = (short *) *xpp; +#line 2780 } +#line 2780 /* update xpp and tp */ +#line 2780 xp += ni; +#line 2780 tp += ni; +#line 2780 *xpp = (void*)xp; +#line 2780 } +#line 2780 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2780 +#line 2780 #else /* not SX */ +#line 2780 +#line 2780 char *xp = (char *) *xpp; +#line 2780 int status = ENOERR; +#line 2780 +#line 2780 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2780 { +#line 2780 int lstatus = ncx_put_short_double(xp, tp); +#line 2780 if(lstatus != ENOERR) +#line 2780 status = lstatus; +#line 2780 } +#line 2780 +#line 2780 *xpp = (void *)xp; +#line 2780 return status; +#line 2780 #endif +#line 2780 } +#line 2780 int +#line 2781 ncx_putn_short_uint(void **xpp, size_t nelems, const uint *tp) +#line 2781 { +#line 2781 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2781 +#line 2781 /* basic algorithm is: +#line 2781 * - ensure sane alignment of output data +#line 2781 * - copy (conversion happens automatically) input data +#line 2781 * to output +#line 2781 * - update tp to point at next unconverted input, and xpp to point +#line 2781 * at next location for converted output +#line 2781 */ +#line 2781 long i, j, ni; +#line 2781 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2781 short *xp; +#line 2781 int nrange = 0; /* number of range errors */ +#line 2781 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2781 long cxp = (long) *((char**)xpp); +#line 2781 +#line 2781 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2781 /* sjl: manually stripmine so we can limit amount of +#line 2781 * vector work space reserved to LOOPCNT elements. Also +#line 2781 * makes vectorisation easy */ +#line 2781 for (j=0; j X_SHORT_MAX; +#line 2781 } +#line 2781 /* copy workspace back if necessary */ +#line 2781 if (realign) { +#line 2781 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2781 xp = (short *) *xpp; +#line 2781 } +#line 2781 /* update xpp and tp */ +#line 2781 xp += ni; +#line 2781 tp += ni; +#line 2781 *xpp = (void*)xp; +#line 2781 } +#line 2781 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2781 +#line 2781 #else /* not SX */ +#line 2781 +#line 2781 char *xp = (char *) *xpp; +#line 2781 int status = ENOERR; +#line 2781 +#line 2781 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2781 { +#line 2781 int lstatus = ncx_put_short_uint(xp, tp); +#line 2781 if(lstatus != ENOERR) +#line 2781 status = lstatus; +#line 2781 } +#line 2781 +#line 2781 *xpp = (void *)xp; +#line 2781 return status; +#line 2781 #endif +#line 2781 } +#line 2781 int +#line 2782 ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 2782 { +#line 2782 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2782 +#line 2782 /* basic algorithm is: +#line 2782 * - ensure sane alignment of output data +#line 2782 * - copy (conversion happens automatically) input data +#line 2782 * to output +#line 2782 * - update tp to point at next unconverted input, and xpp to point +#line 2782 * at next location for converted output +#line 2782 */ +#line 2782 long i, j, ni; +#line 2782 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2782 short *xp; +#line 2782 int nrange = 0; /* number of range errors */ +#line 2782 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2782 long cxp = (long) *((char**)xpp); +#line 2782 +#line 2782 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2782 /* sjl: manually stripmine so we can limit amount of +#line 2782 * vector work space reserved to LOOPCNT elements. Also +#line 2782 * makes vectorisation easy */ +#line 2782 for (j=0; j X_SHORT_MAX; +#line 2782 } +#line 2782 /* copy workspace back if necessary */ +#line 2782 if (realign) { +#line 2782 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2782 xp = (short *) *xpp; +#line 2782 } +#line 2782 /* update xpp and tp */ +#line 2782 xp += ni; +#line 2782 tp += ni; +#line 2782 *xpp = (void*)xp; +#line 2782 } +#line 2782 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2782 +#line 2782 #else /* not SX */ +#line 2782 +#line 2782 char *xp = (char *) *xpp; +#line 2782 int status = ENOERR; +#line 2782 +#line 2782 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2782 { +#line 2782 int lstatus = ncx_put_short_longlong(xp, tp); +#line 2782 if(lstatus != ENOERR) +#line 2782 status = lstatus; +#line 2782 } +#line 2782 +#line 2782 *xpp = (void *)xp; +#line 2782 return status; +#line 2782 #endif +#line 2782 } +#line 2782 int +#line 2783 ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 2783 { +#line 2783 #if _SX && X_SIZEOF_SHORT == SIZEOF_SHORT +#line 2783 +#line 2783 /* basic algorithm is: +#line 2783 * - ensure sane alignment of output data +#line 2783 * - copy (conversion happens automatically) input data +#line 2783 * to output +#line 2783 * - update tp to point at next unconverted input, and xpp to point +#line 2783 * at next location for converted output +#line 2783 */ +#line 2783 long i, j, ni; +#line 2783 short tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2783 short *xp; +#line 2783 int nrange = 0; /* number of range errors */ +#line 2783 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2783 long cxp = (long) *((char**)xpp); +#line 2783 +#line 2783 realign = (cxp & 7) % SIZEOF_SHORT; +#line 2783 /* sjl: manually stripmine so we can limit amount of +#line 2783 * vector work space reserved to LOOPCNT elements. Also +#line 2783 * makes vectorisation easy */ +#line 2783 for (j=0; j X_SHORT_MAX; +#line 2783 } +#line 2783 /* copy workspace back if necessary */ +#line 2783 if (realign) { +#line 2783 memcpy(*xpp, tmp, ni*X_SIZEOF_SHORT); +#line 2783 xp = (short *) *xpp; +#line 2783 } +#line 2783 /* update xpp and tp */ +#line 2783 xp += ni; +#line 2783 tp += ni; +#line 2783 *xpp = (void*)xp; +#line 2783 } +#line 2783 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2783 +#line 2783 #else /* not SX */ +#line 2783 +#line 2783 char *xp = (char *) *xpp; +#line 2783 int status = ENOERR; +#line 2783 +#line 2783 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2783 { +#line 2783 int lstatus = ncx_put_short_ulonglong(xp, tp); +#line 2783 if(lstatus != ENOERR) +#line 2783 status = lstatus; +#line 2783 } +#line 2783 +#line 2783 *xpp = (void *)xp; +#line 2783 return status; +#line 2783 #endif +#line 2783 } +#line 2783 int +#line 2785 ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp) +#line 2785 { +#line 2785 const size_t rndup = nelems % 2; +#line 2785 +#line 2785 char *xp = (char *) *xpp; +#line 2785 int status = ENOERR; +#line 2785 +#line 2785 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2785 { +#line 2785 int lstatus = ncx_put_short_schar(xp, tp); +#line 2785 if(lstatus != ENOERR) +#line 2785 status = lstatus; +#line 2785 } +#line 2785 +#line 2785 if(rndup != 0) +#line 2785 { +#line 2785 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2785 xp += X_SIZEOF_SHORT; +#line 2785 } +#line 2785 +#line 2785 *xpp = (void *)xp; +#line 2785 return status; +#line 2785 } +#line 2785 int +#line 2786 ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp) +#line 2786 { +#line 2786 const size_t rndup = nelems % 2; +#line 2786 +#line 2786 char *xp = (char *) *xpp; +#line 2786 int status = ENOERR; +#line 2786 +#line 2786 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2786 { +#line 2786 int lstatus = ncx_put_short_uchar(xp, tp); +#line 2786 if(lstatus != ENOERR) +#line 2786 status = lstatus; +#line 2786 } +#line 2786 +#line 2786 if(rndup != 0) +#line 2786 { +#line 2786 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2786 xp += X_SIZEOF_SHORT; +#line 2786 } +#line 2786 +#line 2786 *xpp = (void *)xp; +#line 2786 return status; +#line 2786 } +#line 2786 int +#line 2787 ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *tp) +#line 2787 { +#line 2787 const size_t rndup = nelems % 2; +#line 2787 +#line 2787 char *xp = (char *) *xpp; +#line 2787 int status = ENOERR; +#line 2787 +#line 2787 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2787 { +#line 2787 int lstatus = ncx_put_short_short(xp, tp); +#line 2787 if(lstatus != ENOERR) +#line 2787 status = lstatus; +#line 2787 } +#line 2787 +#line 2787 if(rndup != 0) +#line 2787 { +#line 2787 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2787 xp += X_SIZEOF_SHORT; +#line 2787 } +#line 2787 +#line 2787 *xpp = (void *)xp; +#line 2787 return status; +#line 2787 } +#line 2787 int +#line 2788 ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp) +#line 2788 { +#line 2788 const size_t rndup = nelems % 2; +#line 2788 +#line 2788 char *xp = (char *) *xpp; +#line 2788 int status = ENOERR; +#line 2788 +#line 2788 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2788 { +#line 2788 int lstatus = ncx_put_short_int(xp, tp); +#line 2788 if(lstatus != ENOERR) +#line 2788 status = lstatus; +#line 2788 } +#line 2788 +#line 2788 if(rndup != 0) +#line 2788 { +#line 2788 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2788 xp += X_SIZEOF_SHORT; +#line 2788 } +#line 2788 +#line 2788 *xpp = (void *)xp; +#line 2788 return status; +#line 2788 } +#line 2788 int +#line 2789 ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp) +#line 2789 { +#line 2789 const size_t rndup = nelems % 2; +#line 2789 +#line 2789 char *xp = (char *) *xpp; +#line 2789 int status = ENOERR; +#line 2789 +#line 2789 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2789 { +#line 2789 int lstatus = ncx_put_short_float(xp, tp); +#line 2789 if(lstatus != ENOERR) +#line 2789 status = lstatus; +#line 2789 } +#line 2789 +#line 2789 if(rndup != 0) +#line 2789 { +#line 2789 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2789 xp += X_SIZEOF_SHORT; +#line 2789 } +#line 2789 +#line 2789 *xpp = (void *)xp; +#line 2789 return status; +#line 2789 } +#line 2789 int +#line 2790 ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp) +#line 2790 { +#line 2790 const size_t rndup = nelems % 2; +#line 2790 +#line 2790 char *xp = (char *) *xpp; +#line 2790 int status = ENOERR; +#line 2790 +#line 2790 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2790 { +#line 2790 int lstatus = ncx_put_short_double(xp, tp); +#line 2790 if(lstatus != ENOERR) +#line 2790 status = lstatus; +#line 2790 } +#line 2790 +#line 2790 if(rndup != 0) +#line 2790 { +#line 2790 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2790 xp += X_SIZEOF_SHORT; +#line 2790 } +#line 2790 +#line 2790 *xpp = (void *)xp; +#line 2790 return status; +#line 2790 } +#line 2790 int +#line 2791 ncx_pad_putn_short_uint(void **xpp, size_t nelems, const uint *tp) +#line 2791 { +#line 2791 const size_t rndup = nelems % 2; +#line 2791 +#line 2791 char *xp = (char *) *xpp; +#line 2791 int status = ENOERR; +#line 2791 +#line 2791 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2791 { +#line 2791 int lstatus = ncx_put_short_uint(xp, tp); +#line 2791 if(lstatus != ENOERR) +#line 2791 status = lstatus; +#line 2791 } +#line 2791 +#line 2791 if(rndup != 0) +#line 2791 { +#line 2791 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2791 xp += X_SIZEOF_SHORT; +#line 2791 } +#line 2791 +#line 2791 *xpp = (void *)xp; +#line 2791 return status; +#line 2791 } +#line 2791 int +#line 2792 ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 2792 { +#line 2792 const size_t rndup = nelems % 2; +#line 2792 +#line 2792 char *xp = (char *) *xpp; +#line 2792 int status = ENOERR; +#line 2792 +#line 2792 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2792 { +#line 2792 int lstatus = ncx_put_short_longlong(xp, tp); +#line 2792 if(lstatus != ENOERR) +#line 2792 status = lstatus; +#line 2792 } +#line 2792 +#line 2792 if(rndup != 0) +#line 2792 { +#line 2792 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2792 xp += X_SIZEOF_SHORT; +#line 2792 } +#line 2792 +#line 2792 *xpp = (void *)xp; +#line 2792 return status; +#line 2792 } +#line 2792 int +#line 2793 ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 2793 { +#line 2793 const size_t rndup = nelems % 2; +#line 2793 +#line 2793 char *xp = (char *) *xpp; +#line 2793 int status = ENOERR; +#line 2793 +#line 2793 for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) +#line 2793 { +#line 2793 int lstatus = ncx_put_short_ulonglong(xp, tp); +#line 2793 if(lstatus != ENOERR) +#line 2793 status = lstatus; +#line 2793 } +#line 2793 +#line 2793 if(rndup != 0) +#line 2793 { +#line 2793 (void) memcpy(xp, nada, X_SIZEOF_SHORT); +#line 2793 xp += X_SIZEOF_SHORT; +#line 2793 } +#line 2793 +#line 2793 *xpp = (void *)xp; +#line 2793 return status; +#line 2793 } +#line 2793 /* int */ int +#line 2798 ncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp) +#line 2798 { +#line 2798 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2798 +#line 2798 /* basic algorithm is: +#line 2798 * - ensure sane alignment of input data +#line 2798 * - copy (conversion happens automatically) input data +#line 2798 * to output +#line 2798 * - update xpp to point at next unconverted input, and tp to point +#line 2798 * at next location for converted output +#line 2798 */ +#line 2798 long i, j, ni; +#line 2798 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2798 int *xp; +#line 2798 int nrange = 0; /* number of range errors */ +#line 2798 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2798 long cxp = (long) *((char**)xpp); +#line 2798 +#line 2798 realign = (cxp & 7) % SIZEOF_INT; +#line 2798 /* sjl: manually stripmine so we can limit amount of +#line 2798 * vector work space reserved to LOOPCNT elements. Also +#line 2798 * makes vectorisation easy */ +#line 2798 for (j=0; j SCHAR_MAX; +#line 2798 } +#line 2798 /* update xpp and tp */ +#line 2798 if (realign) xp = (int *) *xpp; +#line 2798 xp += ni; +#line 2798 tp += ni; +#line 2798 *xpp = (void*)xp; +#line 2798 } +#line 2798 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2798 +#line 2798 #else /* not SX */ +#line 2798 const char *xp = (const char *) *xpp; +#line 2798 int status = ENOERR; +#line 2798 +#line 2798 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2798 { +#line 2798 const int lstatus = ncx_get_int_schar(xp, tp); +#line 2798 if(lstatus != ENOERR) +#line 2798 status = lstatus; +#line 2798 } +#line 2798 +#line 2798 *xpp = (const void *)xp; +#line 2798 return status; +#line 2798 # endif +#line 2798 } +#line 2798 int +#line 2799 ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp) +#line 2799 { +#line 2799 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2799 +#line 2799 /* basic algorithm is: +#line 2799 * - ensure sane alignment of input data +#line 2799 * - copy (conversion happens automatically) input data +#line 2799 * to output +#line 2799 * - update xpp to point at next unconverted input, and tp to point +#line 2799 * at next location for converted output +#line 2799 */ +#line 2799 long i, j, ni; +#line 2799 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2799 int *xp; +#line 2799 int nrange = 0; /* number of range errors */ +#line 2799 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2799 long cxp = (long) *((char**)xpp); +#line 2799 +#line 2799 realign = (cxp & 7) % SIZEOF_INT; +#line 2799 /* sjl: manually stripmine so we can limit amount of +#line 2799 * vector work space reserved to LOOPCNT elements. Also +#line 2799 * makes vectorisation easy */ +#line 2799 for (j=0; j UCHAR_MAX; +#line 2799 } +#line 2799 /* update xpp and tp */ +#line 2799 if (realign) xp = (int *) *xpp; +#line 2799 xp += ni; +#line 2799 tp += ni; +#line 2799 *xpp = (void*)xp; +#line 2799 } +#line 2799 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2799 +#line 2799 #else /* not SX */ +#line 2799 const char *xp = (const char *) *xpp; +#line 2799 int status = ENOERR; +#line 2799 +#line 2799 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2799 { +#line 2799 const int lstatus = ncx_get_int_uchar(xp, tp); +#line 2799 if(lstatus != ENOERR) +#line 2799 status = lstatus; +#line 2799 } +#line 2799 +#line 2799 *xpp = (const void *)xp; +#line 2799 return status; +#line 2799 # endif +#line 2799 } +#line 2799 int +#line 2800 ncx_getn_int_short(const void **xpp, size_t nelems, short *tp) +#line 2800 { +#line 2800 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2800 +#line 2800 /* basic algorithm is: +#line 2800 * - ensure sane alignment of input data +#line 2800 * - copy (conversion happens automatically) input data +#line 2800 * to output +#line 2800 * - update xpp to point at next unconverted input, and tp to point +#line 2800 * at next location for converted output +#line 2800 */ +#line 2800 long i, j, ni; +#line 2800 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2800 int *xp; +#line 2800 int nrange = 0; /* number of range errors */ +#line 2800 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2800 long cxp = (long) *((char**)xpp); +#line 2800 +#line 2800 realign = (cxp & 7) % SIZEOF_INT; +#line 2800 /* sjl: manually stripmine so we can limit amount of +#line 2800 * vector work space reserved to LOOPCNT elements. Also +#line 2800 * makes vectorisation easy */ +#line 2800 for (j=0; j SHORT_MAX; +#line 2800 } +#line 2800 /* update xpp and tp */ +#line 2800 if (realign) xp = (int *) *xpp; +#line 2800 xp += ni; +#line 2800 tp += ni; +#line 2800 *xpp = (void*)xp; +#line 2800 } +#line 2800 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2800 +#line 2800 #else /* not SX */ +#line 2800 const char *xp = (const char *) *xpp; +#line 2800 int status = ENOERR; +#line 2800 +#line 2800 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2800 { +#line 2800 const int lstatus = ncx_get_int_short(xp, tp); +#line 2800 if(lstatus != ENOERR) +#line 2800 status = lstatus; +#line 2800 } +#line 2800 +#line 2800 *xpp = (const void *)xp; +#line 2800 return status; +#line 2800 # endif +#line 2800 } +#line 2800 #if X_SIZEOF_INT == SIZEOF_INT /* optimized version */ @@ -4705,590 +7367,1163 @@ ncx_getn_int_uint(const void **xpp, size_t nelems, unsigned int *tp) } #else int +#line 2826 ncx_getn_int_int(const void **xpp, size_t nelems, int *tp) +#line 2826 { +#line 2826 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2826 +#line 2826 /* basic algorithm is: +#line 2826 * - ensure sane alignment of input data +#line 2826 * - copy (conversion happens automatically) input data +#line 2826 * to output +#line 2826 * - update xpp to point at next unconverted input, and tp to point +#line 2826 * at next location for converted output +#line 2826 */ +#line 2826 long i, j, ni; +#line 2826 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2826 int *xp; +#line 2826 int nrange = 0; /* number of range errors */ +#line 2826 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2826 long cxp = (long) *((char**)xpp); +#line 2826 +#line 2826 realign = (cxp & 7) % SIZEOF_INT; +#line 2826 /* sjl: manually stripmine so we can limit amount of +#line 2826 * vector work space reserved to LOOPCNT elements. Also +#line 2826 * makes vectorisation easy */ +#line 2826 for (j=0; j INT_MAX; +#line 2826 } +#line 2826 /* update xpp and tp */ +#line 2826 if (realign) xp = (int *) *xpp; +#line 2826 xp += ni; +#line 2826 tp += ni; +#line 2826 *xpp = (void*)xp; +#line 2826 } +#line 2826 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2826 +#line 2826 #else /* not SX */ +#line 2826 const char *xp = (const char *) *xpp; +#line 2826 int status = ENOERR; +#line 2826 +#line 2826 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2826 { +#line 2826 const int lstatus = ncx_get_int_int(xp, tp); +#line 2826 if(lstatus != ENOERR) +#line 2826 status = lstatus; +#line 2826 } +#line 2826 +#line 2826 *xpp = (const void *)xp; +#line 2826 return status; +#line 2826 # endif +#line 2826 } +#line 2826 int +#line 2827 ncx_getn_int_uint(const void **xpp, size_t nelems, uint *tp) +#line 2827 { +#line 2827 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2827 +#line 2827 /* basic algorithm is: +#line 2827 * - ensure sane alignment of input data +#line 2827 * - copy (conversion happens automatically) input data +#line 2827 * to output +#line 2827 * - update xpp to point at next unconverted input, and tp to point +#line 2827 * at next location for converted output +#line 2827 */ +#line 2827 long i, j, ni; +#line 2827 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2827 int *xp; +#line 2827 int nrange = 0; /* number of range errors */ +#line 2827 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2827 long cxp = (long) *((char**)xpp); +#line 2827 +#line 2827 realign = (cxp & 7) % SIZEOF_INT; +#line 2827 /* sjl: manually stripmine so we can limit amount of +#line 2827 * vector work space reserved to LOOPCNT elements. Also +#line 2827 * makes vectorisation easy */ +#line 2827 for (j=0; j UINT_MAX; +#line 2827 } +#line 2827 /* update xpp and tp */ +#line 2827 if (realign) xp = (int *) *xpp; +#line 2827 xp += ni; +#line 2827 tp += ni; +#line 2827 *xpp = (void*)xp; +#line 2827 } +#line 2827 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2827 +#line 2827 #else /* not SX */ +#line 2827 const char *xp = (const char *) *xpp; +#line 2827 int status = ENOERR; +#line 2827 +#line 2827 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2827 { +#line 2827 const int lstatus = ncx_get_int_uint(xp, tp); +#line 2827 if(lstatus != ENOERR) +#line 2827 status = lstatus; +#line 2827 } +#line 2827 +#line 2827 *xpp = (const void *)xp; +#line 2827 return status; +#line 2827 # endif +#line 2827 } +#line 2827 #endif int +#line 2830 ncx_getn_int_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2830 { +#line 2830 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2830 +#line 2830 /* basic algorithm is: +#line 2830 * - ensure sane alignment of input data +#line 2830 * - copy (conversion happens automatically) input data +#line 2830 * to output +#line 2830 * - update xpp to point at next unconverted input, and tp to point +#line 2830 * at next location for converted output +#line 2830 */ +#line 2830 long i, j, ni; +#line 2830 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2830 int *xp; +#line 2830 int nrange = 0; /* number of range errors */ +#line 2830 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2830 long cxp = (long) *((char**)xpp); +#line 2830 +#line 2830 realign = (cxp & 7) % SIZEOF_INT; +#line 2830 /* sjl: manually stripmine so we can limit amount of +#line 2830 * vector work space reserved to LOOPCNT elements. Also +#line 2830 * makes vectorisation easy */ +#line 2830 for (j=0; j LONGLONG_MAX; +#line 2830 } +#line 2830 /* update xpp and tp */ +#line 2830 if (realign) xp = (int *) *xpp; +#line 2830 xp += ni; +#line 2830 tp += ni; +#line 2830 *xpp = (void*)xp; +#line 2830 } +#line 2830 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2830 +#line 2830 #else /* not SX */ +#line 2830 const char *xp = (const char *) *xpp; +#line 2830 int status = ENOERR; +#line 2830 +#line 2830 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2830 { +#line 2830 const int lstatus = ncx_get_int_longlong(xp, tp); +#line 2830 if(lstatus != ENOERR) +#line 2830 status = lstatus; +#line 2830 } +#line 2830 +#line 2830 *xpp = (const void *)xp; +#line 2830 return status; +#line 2830 # endif +#line 2830 } +#line 2830 int +#line 2831 ncx_getn_int_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2831 { +#line 2831 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2831 +#line 2831 /* basic algorithm is: +#line 2831 * - ensure sane alignment of input data +#line 2831 * - copy (conversion happens automatically) input data +#line 2831 * to output +#line 2831 * - update xpp to point at next unconverted input, and tp to point +#line 2831 * at next location for converted output +#line 2831 */ +#line 2831 long i, j, ni; +#line 2831 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2831 int *xp; +#line 2831 int nrange = 0; /* number of range errors */ +#line 2831 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2831 long cxp = (long) *((char**)xpp); +#line 2831 +#line 2831 realign = (cxp & 7) % SIZEOF_INT; +#line 2831 /* sjl: manually stripmine so we can limit amount of +#line 2831 * vector work space reserved to LOOPCNT elements. Also +#line 2831 * makes vectorisation easy */ +#line 2831 for (j=0; j ULONGLONG_MAX; +#line 2831 } +#line 2831 /* update xpp and tp */ +#line 2831 if (realign) xp = (int *) *xpp; +#line 2831 xp += ni; +#line 2831 tp += ni; +#line 2831 *xpp = (void*)xp; +#line 2831 } +#line 2831 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2831 +#line 2831 #else /* not SX */ +#line 2831 const char *xp = (const char *) *xpp; +#line 2831 int status = ENOERR; +#line 2831 +#line 2831 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2831 { +#line 2831 const int lstatus = ncx_get_int_ulonglong(xp, tp); +#line 2831 if(lstatus != ENOERR) +#line 2831 status = lstatus; +#line 2831 } +#line 2831 +#line 2831 *xpp = (const void *)xp; +#line 2831 return status; +#line 2831 # endif +#line 2831 } +#line 2831 int +#line 2833 ncx_getn_int_float(const void **xpp, size_t nelems, float *tp) +#line 2833 { +#line 2833 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2833 +#line 2833 /* basic algorithm is: +#line 2833 * - ensure sane alignment of input data +#line 2833 * - copy (conversion happens automatically) input data +#line 2833 * to output +#line 2833 * - update xpp to point at next unconverted input, and tp to point +#line 2833 * at next location for converted output +#line 2833 */ +#line 2833 long i, j, ni; +#line 2833 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2833 int *xp; +#line 2833 int nrange = 0; /* number of range errors */ +#line 2833 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2833 long cxp = (long) *((char**)xpp); +#line 2833 +#line 2833 realign = (cxp & 7) % SIZEOF_INT; +#line 2833 /* sjl: manually stripmine so we can limit amount of +#line 2833 * vector work space reserved to LOOPCNT elements. Also +#line 2833 * makes vectorisation easy */ +#line 2833 for (j=0; j FLOAT_MAX; +#line 2833 } +#line 2833 /* update xpp and tp */ +#line 2833 if (realign) xp = (int *) *xpp; +#line 2833 xp += ni; +#line 2833 tp += ni; +#line 2833 *xpp = (void*)xp; +#line 2833 } +#line 2833 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2833 +#line 2833 #else /* not SX */ +#line 2833 const char *xp = (const char *) *xpp; +#line 2833 int status = ENOERR; +#line 2833 +#line 2833 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2833 { +#line 2833 const int lstatus = ncx_get_int_float(xp, tp); +#line 2833 if(lstatus != ENOERR) +#line 2833 status = lstatus; +#line 2833 } +#line 2833 +#line 2833 *xpp = (const void *)xp; +#line 2833 return status; +#line 2833 # endif +#line 2833 } +#line 2833 int +#line 2834 ncx_getn_int_double(const void **xpp, size_t nelems, double *tp) +#line 2834 { +#line 2834 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2834 +#line 2834 /* basic algorithm is: +#line 2834 * - ensure sane alignment of input data +#line 2834 * - copy (conversion happens automatically) input data +#line 2834 * to output +#line 2834 * - update xpp to point at next unconverted input, and tp to point +#line 2834 * at next location for converted output +#line 2834 */ +#line 2834 long i, j, ni; +#line 2834 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2834 int *xp; +#line 2834 int nrange = 0; /* number of range errors */ +#line 2834 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2834 long cxp = (long) *((char**)xpp); +#line 2834 +#line 2834 realign = (cxp & 7) % SIZEOF_INT; +#line 2834 /* sjl: manually stripmine so we can limit amount of +#line 2834 * vector work space reserved to LOOPCNT elements. Also +#line 2834 * makes vectorisation easy */ +#line 2834 for (j=0; j DOUBLE_MAX; +#line 2834 } +#line 2834 /* update xpp and tp */ +#line 2834 if (realign) xp = (int *) *xpp; +#line 2834 xp += ni; +#line 2834 tp += ni; +#line 2834 *xpp = (void*)xp; +#line 2834 } +#line 2834 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2834 +#line 2834 #else /* not SX */ +#line 2834 const char *xp = (const char *) *xpp; +#line 2834 int status = ENOERR; +#line 2834 +#line 2834 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2834 { +#line 2834 const int lstatus = ncx_get_int_double(xp, tp); +#line 2834 if(lstatus != ENOERR) +#line 2834 status = lstatus; +#line 2834 } +#line 2834 +#line 2834 *xpp = (const void *)xp; +#line 2834 return status; +#line 2834 # endif +#line 2834 } +#line 2834 int +#line 2836 ncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp) +#line 2836 { +#line 2836 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2836 +#line 2836 /* basic algorithm is: +#line 2836 * - ensure sane alignment of output data +#line 2836 * - copy (conversion happens automatically) input data +#line 2836 * to output +#line 2836 * - update tp to point at next unconverted input, and xpp to point +#line 2836 * at next location for converted output +#line 2836 */ +#line 2836 long i, j, ni; +#line 2836 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2836 int *xp; +#line 2836 int nrange = 0; /* number of range errors */ +#line 2836 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2836 long cxp = (long) *((char**)xpp); +#line 2836 +#line 2836 realign = (cxp & 7) % SIZEOF_INT; +#line 2836 /* sjl: manually stripmine so we can limit amount of +#line 2836 * vector work space reserved to LOOPCNT elements. Also +#line 2836 * makes vectorisation easy */ +#line 2836 for (j=0; j X_INT_MAX; +#line 2836 } +#line 2836 /* copy workspace back if necessary */ +#line 2836 if (realign) { +#line 2836 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2836 xp = (int *) *xpp; +#line 2836 } +#line 2836 /* update xpp and tp */ +#line 2836 xp += ni; +#line 2836 tp += ni; +#line 2836 *xpp = (void*)xp; +#line 2836 } +#line 2836 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2836 +#line 2836 #else /* not SX */ +#line 2836 +#line 2836 char *xp = (char *) *xpp; +#line 2836 int status = ENOERR; +#line 2836 +#line 2836 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2836 { +#line 2836 int lstatus = ncx_put_int_schar(xp, tp); +#line 2836 if(lstatus != ENOERR) +#line 2836 status = lstatus; +#line 2836 } +#line 2836 +#line 2836 *xpp = (void *)xp; +#line 2836 return status; +#line 2836 #endif +#line 2836 } +#line 2836 int +#line 2837 ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp) +#line 2837 { +#line 2837 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2837 +#line 2837 /* basic algorithm is: +#line 2837 * - ensure sane alignment of output data +#line 2837 * - copy (conversion happens automatically) input data +#line 2837 * to output +#line 2837 * - update tp to point at next unconverted input, and xpp to point +#line 2837 * at next location for converted output +#line 2837 */ +#line 2837 long i, j, ni; +#line 2837 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2837 int *xp; +#line 2837 int nrange = 0; /* number of range errors */ +#line 2837 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2837 long cxp = (long) *((char**)xpp); +#line 2837 +#line 2837 realign = (cxp & 7) % SIZEOF_INT; +#line 2837 /* sjl: manually stripmine so we can limit amount of +#line 2837 * vector work space reserved to LOOPCNT elements. Also +#line 2837 * makes vectorisation easy */ +#line 2837 for (j=0; j X_INT_MAX; +#line 2837 } +#line 2837 /* copy workspace back if necessary */ +#line 2837 if (realign) { +#line 2837 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2837 xp = (int *) *xpp; +#line 2837 } +#line 2837 /* update xpp and tp */ +#line 2837 xp += ni; +#line 2837 tp += ni; +#line 2837 *xpp = (void*)xp; +#line 2837 } +#line 2837 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2837 +#line 2837 #else /* not SX */ +#line 2837 +#line 2837 char *xp = (char *) *xpp; +#line 2837 int status = ENOERR; +#line 2837 +#line 2837 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2837 { +#line 2837 int lstatus = ncx_put_int_uchar(xp, tp); +#line 2837 if(lstatus != ENOERR) +#line 2837 status = lstatus; +#line 2837 } +#line 2837 +#line 2837 *xpp = (void *)xp; +#line 2837 return status; +#line 2837 #endif +#line 2837 } +#line 2837 int +#line 2838 ncx_putn_int_short(void **xpp, size_t nelems, const short *tp) +#line 2838 { +#line 2838 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2838 +#line 2838 /* basic algorithm is: +#line 2838 * - ensure sane alignment of output data +#line 2838 * - copy (conversion happens automatically) input data +#line 2838 * to output +#line 2838 * - update tp to point at next unconverted input, and xpp to point +#line 2838 * at next location for converted output +#line 2838 */ +#line 2838 long i, j, ni; +#line 2838 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2838 int *xp; +#line 2838 int nrange = 0; /* number of range errors */ +#line 2838 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2838 long cxp = (long) *((char**)xpp); +#line 2838 +#line 2838 realign = (cxp & 7) % SIZEOF_INT; +#line 2838 /* sjl: manually stripmine so we can limit amount of +#line 2838 * vector work space reserved to LOOPCNT elements. Also +#line 2838 * makes vectorisation easy */ +#line 2838 for (j=0; j X_INT_MAX; +#line 2838 } +#line 2838 /* copy workspace back if necessary */ +#line 2838 if (realign) { +#line 2838 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2838 xp = (int *) *xpp; +#line 2838 } +#line 2838 /* update xpp and tp */ +#line 2838 xp += ni; +#line 2838 tp += ni; +#line 2838 *xpp = (void*)xp; +#line 2838 } +#line 2838 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2838 +#line 2838 #else /* not SX */ +#line 2838 +#line 2838 char *xp = (char *) *xpp; +#line 2838 int status = ENOERR; +#line 2838 +#line 2838 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2838 { +#line 2838 int lstatus = ncx_put_int_short(xp, tp); +#line 2838 if(lstatus != ENOERR) +#line 2838 status = lstatus; +#line 2838 } +#line 2838 +#line 2838 *xpp = (void *)xp; +#line 2838 return status; +#line 2838 #endif +#line 2838 } +#line 2838 #if X_SIZEOF_INT == SIZEOF_INT /* optimized version */ @@ -5316,671 +8551,1322 @@ ncx_putn_int_uint(void **xpp, size_t nelems, const unsigned int *tp) } #else int +#line 2864 ncx_putn_int_int(void **xpp, size_t nelems, const int *tp) +#line 2864 { +#line 2864 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2864 +#line 2864 /* basic algorithm is: +#line 2864 * - ensure sane alignment of output data +#line 2864 * - copy (conversion happens automatically) input data +#line 2864 * to output +#line 2864 * - update tp to point at next unconverted input, and xpp to point +#line 2864 * at next location for converted output +#line 2864 */ +#line 2864 long i, j, ni; +#line 2864 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2864 int *xp; +#line 2864 int nrange = 0; /* number of range errors */ +#line 2864 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2864 long cxp = (long) *((char**)xpp); +#line 2864 +#line 2864 realign = (cxp & 7) % SIZEOF_INT; +#line 2864 /* sjl: manually stripmine so we can limit amount of +#line 2864 * vector work space reserved to LOOPCNT elements. Also +#line 2864 * makes vectorisation easy */ +#line 2864 for (j=0; j X_INT_MAX; +#line 2864 } +#line 2864 /* copy workspace back if necessary */ +#line 2864 if (realign) { +#line 2864 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2864 xp = (int *) *xpp; +#line 2864 } +#line 2864 /* update xpp and tp */ +#line 2864 xp += ni; +#line 2864 tp += ni; +#line 2864 *xpp = (void*)xp; +#line 2864 } +#line 2864 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2864 +#line 2864 #else /* not SX */ +#line 2864 +#line 2864 char *xp = (char *) *xpp; +#line 2864 int status = ENOERR; +#line 2864 +#line 2864 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2864 { +#line 2864 int lstatus = ncx_put_int_int(xp, tp); +#line 2864 if(lstatus != ENOERR) +#line 2864 status = lstatus; +#line 2864 } +#line 2864 +#line 2864 *xpp = (void *)xp; +#line 2864 return status; +#line 2864 #endif +#line 2864 } +#line 2864 int +#line 2865 ncx_putn_int_uint(void **xpp, size_t nelems, const uint *tp) +#line 2865 { +#line 2865 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2865 +#line 2865 /* basic algorithm is: +#line 2865 * - ensure sane alignment of output data +#line 2865 * - copy (conversion happens automatically) input data +#line 2865 * to output +#line 2865 * - update tp to point at next unconverted input, and xpp to point +#line 2865 * at next location for converted output +#line 2865 */ +#line 2865 long i, j, ni; +#line 2865 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2865 int *xp; +#line 2865 int nrange = 0; /* number of range errors */ +#line 2865 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2865 long cxp = (long) *((char**)xpp); +#line 2865 +#line 2865 realign = (cxp & 7) % SIZEOF_INT; +#line 2865 /* sjl: manually stripmine so we can limit amount of +#line 2865 * vector work space reserved to LOOPCNT elements. Also +#line 2865 * makes vectorisation easy */ +#line 2865 for (j=0; j X_INT_MAX; +#line 2865 } +#line 2865 /* copy workspace back if necessary */ +#line 2865 if (realign) { +#line 2865 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2865 xp = (int *) *xpp; +#line 2865 } +#line 2865 /* update xpp and tp */ +#line 2865 xp += ni; +#line 2865 tp += ni; +#line 2865 *xpp = (void*)xp; +#line 2865 } +#line 2865 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2865 +#line 2865 #else /* not SX */ +#line 2865 +#line 2865 char *xp = (char *) *xpp; +#line 2865 int status = ENOERR; +#line 2865 +#line 2865 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2865 { +#line 2865 int lstatus = ncx_put_int_uint(xp, tp); +#line 2865 if(lstatus != ENOERR) +#line 2865 status = lstatus; +#line 2865 } +#line 2865 +#line 2865 *xpp = (void *)xp; +#line 2865 return status; +#line 2865 #endif +#line 2865 } +#line 2865 #endif int +#line 2868 ncx_putn_int_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 2868 { +#line 2868 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2868 +#line 2868 /* basic algorithm is: +#line 2868 * - ensure sane alignment of output data +#line 2868 * - copy (conversion happens automatically) input data +#line 2868 * to output +#line 2868 * - update tp to point at next unconverted input, and xpp to point +#line 2868 * at next location for converted output +#line 2868 */ +#line 2868 long i, j, ni; +#line 2868 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2868 int *xp; +#line 2868 int nrange = 0; /* number of range errors */ +#line 2868 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2868 long cxp = (long) *((char**)xpp); +#line 2868 +#line 2868 realign = (cxp & 7) % SIZEOF_INT; +#line 2868 /* sjl: manually stripmine so we can limit amount of +#line 2868 * vector work space reserved to LOOPCNT elements. Also +#line 2868 * makes vectorisation easy */ +#line 2868 for (j=0; j X_INT_MAX; +#line 2868 } +#line 2868 /* copy workspace back if necessary */ +#line 2868 if (realign) { +#line 2868 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2868 xp = (int *) *xpp; +#line 2868 } +#line 2868 /* update xpp and tp */ +#line 2868 xp += ni; +#line 2868 tp += ni; +#line 2868 *xpp = (void*)xp; +#line 2868 } +#line 2868 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2868 +#line 2868 #else /* not SX */ +#line 2868 +#line 2868 char *xp = (char *) *xpp; +#line 2868 int status = ENOERR; +#line 2868 +#line 2868 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2868 { +#line 2868 int lstatus = ncx_put_int_longlong(xp, tp); +#line 2868 if(lstatus != ENOERR) +#line 2868 status = lstatus; +#line 2868 } +#line 2868 +#line 2868 *xpp = (void *)xp; +#line 2868 return status; +#line 2868 #endif +#line 2868 } +#line 2868 int +#line 2869 ncx_putn_int_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 2869 { +#line 2869 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2869 +#line 2869 /* basic algorithm is: +#line 2869 * - ensure sane alignment of output data +#line 2869 * - copy (conversion happens automatically) input data +#line 2869 * to output +#line 2869 * - update tp to point at next unconverted input, and xpp to point +#line 2869 * at next location for converted output +#line 2869 */ +#line 2869 long i, j, ni; +#line 2869 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2869 int *xp; +#line 2869 int nrange = 0; /* number of range errors */ +#line 2869 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2869 long cxp = (long) *((char**)xpp); +#line 2869 +#line 2869 realign = (cxp & 7) % SIZEOF_INT; +#line 2869 /* sjl: manually stripmine so we can limit amount of +#line 2869 * vector work space reserved to LOOPCNT elements. Also +#line 2869 * makes vectorisation easy */ +#line 2869 for (j=0; j X_INT_MAX; +#line 2869 } +#line 2869 /* copy workspace back if necessary */ +#line 2869 if (realign) { +#line 2869 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2869 xp = (int *) *xpp; +#line 2869 } +#line 2869 /* update xpp and tp */ +#line 2869 xp += ni; +#line 2869 tp += ni; +#line 2869 *xpp = (void*)xp; +#line 2869 } +#line 2869 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2869 +#line 2869 #else /* not SX */ +#line 2869 +#line 2869 char *xp = (char *) *xpp; +#line 2869 int status = ENOERR; +#line 2869 +#line 2869 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2869 { +#line 2869 int lstatus = ncx_put_int_ulonglong(xp, tp); +#line 2869 if(lstatus != ENOERR) +#line 2869 status = lstatus; +#line 2869 } +#line 2869 +#line 2869 *xpp = (void *)xp; +#line 2869 return status; +#line 2869 #endif +#line 2869 } +#line 2869 int +#line 2870 ncx_putn_int_float(void **xpp, size_t nelems, const float *tp) +#line 2870 { +#line 2870 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2870 +#line 2870 /* basic algorithm is: +#line 2870 * - ensure sane alignment of output data +#line 2870 * - copy (conversion happens automatically) input data +#line 2870 * to output +#line 2870 * - update tp to point at next unconverted input, and xpp to point +#line 2870 * at next location for converted output +#line 2870 */ +#line 2870 long i, j, ni; +#line 2870 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2870 int *xp; +#line 2870 double d; /* special case for ncx_putn_int_float */ +#line 2870 int nrange = 0; /* number of range errors */ +#line 2870 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2870 long cxp = (long) *((char**)xpp); +#line 2870 +#line 2870 realign = (cxp & 7) % SIZEOF_INT; +#line 2870 /* sjl: manually stripmine so we can limit amount of +#line 2870 * vector work space reserved to LOOPCNT elements. Also +#line 2870 * makes vectorisation easy */ +#line 2870 for (j=0; j X_INT_MAX; +#line 2870 } +#line 2870 /* copy workspace back if necessary */ +#line 2870 if (realign) { +#line 2870 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2870 xp = (int *) *xpp; +#line 2870 } +#line 2870 /* update xpp and tp */ +#line 2870 xp += ni; +#line 2870 tp += ni; +#line 2870 *xpp = (void*)xp; +#line 2870 } +#line 2870 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2870 +#line 2870 #else /* not SX */ +#line 2870 +#line 2870 char *xp = (char *) *xpp; +#line 2870 int status = ENOERR; +#line 2870 +#line 2870 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2870 { +#line 2870 int lstatus = ncx_put_int_float(xp, tp); +#line 2870 if(lstatus != ENOERR) +#line 2870 status = lstatus; +#line 2870 } +#line 2870 +#line 2870 *xpp = (void *)xp; +#line 2870 return status; +#line 2870 #endif +#line 2870 } +#line 2870 int +#line 2871 ncx_putn_int_double(void **xpp, size_t nelems, const double *tp) +#line 2871 { +#line 2871 #if _SX && X_SIZEOF_INT == SIZEOF_INT +#line 2871 +#line 2871 /* basic algorithm is: +#line 2871 * - ensure sane alignment of output data +#line 2871 * - copy (conversion happens automatically) input data +#line 2871 * to output +#line 2871 * - update tp to point at next unconverted input, and xpp to point +#line 2871 * at next location for converted output +#line 2871 */ +#line 2871 long i, j, ni; +#line 2871 int tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2871 int *xp; +#line 2871 int nrange = 0; /* number of range errors */ +#line 2871 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2871 long cxp = (long) *((char**)xpp); +#line 2871 +#line 2871 realign = (cxp & 7) % SIZEOF_INT; +#line 2871 /* sjl: manually stripmine so we can limit amount of +#line 2871 * vector work space reserved to LOOPCNT elements. Also +#line 2871 * makes vectorisation easy */ +#line 2871 for (j=0; j X_INT_MAX; +#line 2871 } +#line 2871 /* copy workspace back if necessary */ +#line 2871 if (realign) { +#line 2871 memcpy(*xpp, tmp, ni*X_SIZEOF_INT); +#line 2871 xp = (int *) *xpp; +#line 2871 } +#line 2871 /* update xpp and tp */ +#line 2871 xp += ni; +#line 2871 tp += ni; +#line 2871 *xpp = (void*)xp; +#line 2871 } +#line 2871 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2871 +#line 2871 #else /* not SX */ +#line 2871 +#line 2871 char *xp = (char *) *xpp; +#line 2871 int status = ENOERR; +#line 2871 +#line 2871 for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) +#line 2871 { +#line 2871 int lstatus = ncx_put_int_double(xp, tp); +#line 2871 if(lstatus != ENOERR) +#line 2871 status = lstatus; +#line 2871 } +#line 2871 +#line 2871 *xpp = (void *)xp; +#line 2871 return status; +#line 2871 #endif +#line 2871 } +#line 2871 /* float */ int +#line 2876 ncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp) +#line 2876 { +#line 2876 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2876 +#line 2876 /* basic algorithm is: +#line 2876 * - ensure sane alignment of input data +#line 2876 * - copy (conversion happens automatically) input data +#line 2876 * to output +#line 2876 * - update xpp to point at next unconverted input, and tp to point +#line 2876 * at next location for converted output +#line 2876 */ +#line 2876 long i, j, ni; +#line 2876 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2876 float *xp; +#line 2876 int nrange = 0; /* number of range errors */ +#line 2876 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2876 long cxp = (long) *((char**)xpp); +#line 2876 +#line 2876 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2876 /* sjl: manually stripmine so we can limit amount of +#line 2876 * vector work space reserved to LOOPCNT elements. Also +#line 2876 * makes vectorisation easy */ +#line 2876 for (j=0; j SCHAR_MAX; +#line 2876 } +#line 2876 /* update xpp and tp */ +#line 2876 if (realign) xp = (float *) *xpp; +#line 2876 xp += ni; +#line 2876 tp += ni; +#line 2876 *xpp = (void*)xp; +#line 2876 } +#line 2876 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2876 +#line 2876 #else /* not SX */ +#line 2876 const char *xp = (const char *) *xpp; +#line 2876 int status = ENOERR; +#line 2876 +#line 2876 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2876 { +#line 2876 const int lstatus = ncx_get_float_schar(xp, tp); +#line 2876 if(lstatus != ENOERR) +#line 2876 status = lstatus; +#line 2876 } +#line 2876 +#line 2876 *xpp = (const void *)xp; +#line 2876 return status; +#line 2876 # endif +#line 2876 } +#line 2876 int +#line 2877 ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp) +#line 2877 { +#line 2877 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2877 +#line 2877 /* basic algorithm is: +#line 2877 * - ensure sane alignment of input data +#line 2877 * - copy (conversion happens automatically) input data +#line 2877 * to output +#line 2877 * - update xpp to point at next unconverted input, and tp to point +#line 2877 * at next location for converted output +#line 2877 */ +#line 2877 long i, j, ni; +#line 2877 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2877 float *xp; +#line 2877 int nrange = 0; /* number of range errors */ +#line 2877 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2877 long cxp = (long) *((char**)xpp); +#line 2877 +#line 2877 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2877 /* sjl: manually stripmine so we can limit amount of +#line 2877 * vector work space reserved to LOOPCNT elements. Also +#line 2877 * makes vectorisation easy */ +#line 2877 for (j=0; j UCHAR_MAX; +#line 2877 } +#line 2877 /* update xpp and tp */ +#line 2877 if (realign) xp = (float *) *xpp; +#line 2877 xp += ni; +#line 2877 tp += ni; +#line 2877 *xpp = (void*)xp; +#line 2877 } +#line 2877 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2877 +#line 2877 #else /* not SX */ +#line 2877 const char *xp = (const char *) *xpp; +#line 2877 int status = ENOERR; +#line 2877 +#line 2877 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2877 { +#line 2877 const int lstatus = ncx_get_float_uchar(xp, tp); +#line 2877 if(lstatus != ENOERR) +#line 2877 status = lstatus; +#line 2877 } +#line 2877 +#line 2877 *xpp = (const void *)xp; +#line 2877 return status; +#line 2877 # endif +#line 2877 } +#line 2877 int +#line 2878 ncx_getn_float_short(const void **xpp, size_t nelems, short *tp) +#line 2878 { +#line 2878 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2878 +#line 2878 /* basic algorithm is: +#line 2878 * - ensure sane alignment of input data +#line 2878 * - copy (conversion happens automatically) input data +#line 2878 * to output +#line 2878 * - update xpp to point at next unconverted input, and tp to point +#line 2878 * at next location for converted output +#line 2878 */ +#line 2878 long i, j, ni; +#line 2878 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2878 float *xp; +#line 2878 int nrange = 0; /* number of range errors */ +#line 2878 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2878 long cxp = (long) *((char**)xpp); +#line 2878 +#line 2878 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2878 /* sjl: manually stripmine so we can limit amount of +#line 2878 * vector work space reserved to LOOPCNT elements. Also +#line 2878 * makes vectorisation easy */ +#line 2878 for (j=0; j SHORT_MAX; +#line 2878 } +#line 2878 /* update xpp and tp */ +#line 2878 if (realign) xp = (float *) *xpp; +#line 2878 xp += ni; +#line 2878 tp += ni; +#line 2878 *xpp = (void*)xp; +#line 2878 } +#line 2878 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2878 +#line 2878 #else /* not SX */ +#line 2878 const char *xp = (const char *) *xpp; +#line 2878 int status = ENOERR; +#line 2878 +#line 2878 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2878 { +#line 2878 const int lstatus = ncx_get_float_short(xp, tp); +#line 2878 if(lstatus != ENOERR) +#line 2878 status = lstatus; +#line 2878 } +#line 2878 +#line 2878 *xpp = (const void *)xp; +#line 2878 return status; +#line 2878 # endif +#line 2878 } +#line 2878 int +#line 2879 ncx_getn_float_int(const void **xpp, size_t nelems, int *tp) +#line 2879 { +#line 2879 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2879 +#line 2879 /* basic algorithm is: +#line 2879 * - ensure sane alignment of input data +#line 2879 * - copy (conversion happens automatically) input data +#line 2879 * to output +#line 2879 * - update xpp to point at next unconverted input, and tp to point +#line 2879 * at next location for converted output +#line 2879 */ +#line 2879 long i, j, ni; +#line 2879 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2879 float *xp; +#line 2879 int nrange = 0; /* number of range errors */ +#line 2879 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2879 long cxp = (long) *((char**)xpp); +#line 2879 +#line 2879 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2879 /* sjl: manually stripmine so we can limit amount of +#line 2879 * vector work space reserved to LOOPCNT elements. Also +#line 2879 * makes vectorisation easy */ +#line 2879 for (j=0; j INT_MAX; +#line 2879 } +#line 2879 /* update xpp and tp */ +#line 2879 if (realign) xp = (float *) *xpp; +#line 2879 xp += ni; +#line 2879 tp += ni; +#line 2879 *xpp = (void*)xp; +#line 2879 } +#line 2879 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2879 +#line 2879 #else /* not SX */ +#line 2879 const char *xp = (const char *) *xpp; +#line 2879 int status = ENOERR; +#line 2879 +#line 2879 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2879 { +#line 2879 const int lstatus = ncx_get_float_int(xp, tp); +#line 2879 if(lstatus != ENOERR) +#line 2879 status = lstatus; +#line 2879 } +#line 2879 +#line 2879 *xpp = (const void *)xp; +#line 2879 return status; +#line 2879 # endif +#line 2879 } +#line 2879 #if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT) /* optimized version */ @@ -6004,50 +9890,95 @@ ncx_getn_float_float(const void **xpp, size_t nfloats, float *ip) while(ip < end) { struct vax_single *const vsp = (struct vax_single *) ip; +#line 2901 const struct ieee_single *const isp = +#line 2901 (const struct ieee_single *) (*xpp); +#line 2901 unsigned exp = isp->exp_hi << 1 | isp->exp_lo; +#line 2901 +#line 2901 switch(exp) { +#line 2901 case 0 : +#line 2901 /* ieee subnormal */ +#line 2901 if(isp->mant_hi == min.ieee.mant_hi +#line 2901 && isp->mant_lo_hi == min.ieee.mant_lo_hi +#line 2901 && isp->mant_lo_lo == min.ieee.mant_lo_lo) +#line 2901 { +#line 2901 *vsp = min.s; +#line 2901 } +#line 2901 else +#line 2901 { +#line 2901 unsigned mantissa = (isp->mant_hi << 16) +#line 2901 | isp->mant_lo_hi << 8 +#line 2901 | isp->mant_lo_lo; +#line 2901 unsigned tmp = mantissa >> 20; +#line 2901 if(tmp >= 4) { +#line 2901 vsp->exp = 2; +#line 2901 } else if (tmp >= 2) { +#line 2901 vsp->exp = 1; +#line 2901 } else { +#line 2901 *vsp = min.s; +#line 2901 break; +#line 2901 } /* else */ +#line 2901 tmp = mantissa - (1 << (20 + vsp->exp )); +#line 2901 tmp <<= 3 - vsp->exp; +#line 2901 vsp->mantissa2 = tmp; +#line 2901 vsp->mantissa1 = (tmp >> 16); +#line 2901 } +#line 2901 break; +#line 2901 case 0xfe : +#line 2901 case 0xff : +#line 2901 *vsp = max.s; +#line 2901 break; +#line 2901 default : +#line 2901 vsp->exp = exp - IEEE_SNG_BIAS + VAX_SNG_BIAS; +#line 2901 vsp->mantissa2 = isp->mant_lo_hi << 8 | isp->mant_lo_lo; +#line 2901 vsp->mantissa1 = isp->mant_hi; +#line 2901 } +#line 2901 +#line 2901 vsp->sign = isp->sign; +#line 2901 ip++; @@ -6075,529 +10006,1045 @@ ncx_getn_float_float(const void **xpp, size_t nelems, float *tp) #endif int +#line 2927 ncx_getn_float_double(const void **xpp, size_t nelems, double *tp) +#line 2927 { +#line 2927 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2927 +#line 2927 /* basic algorithm is: +#line 2927 * - ensure sane alignment of input data +#line 2927 * - copy (conversion happens automatically) input data +#line 2927 * to output +#line 2927 * - update xpp to point at next unconverted input, and tp to point +#line 2927 * at next location for converted output +#line 2927 */ +#line 2927 long i, j, ni; +#line 2927 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2927 float *xp; +#line 2927 int nrange = 0; /* number of range errors */ +#line 2927 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2927 long cxp = (long) *((char**)xpp); +#line 2927 +#line 2927 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2927 /* sjl: manually stripmine so we can limit amount of +#line 2927 * vector work space reserved to LOOPCNT elements. Also +#line 2927 * makes vectorisation easy */ +#line 2927 for (j=0; j DOUBLE_MAX; +#line 2927 } +#line 2927 /* update xpp and tp */ +#line 2927 if (realign) xp = (float *) *xpp; +#line 2927 xp += ni; +#line 2927 tp += ni; +#line 2927 *xpp = (void*)xp; +#line 2927 } +#line 2927 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2927 +#line 2927 #else /* not SX */ +#line 2927 const char *xp = (const char *) *xpp; +#line 2927 int status = ENOERR; +#line 2927 +#line 2927 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2927 { +#line 2927 const int lstatus = ncx_get_float_double(xp, tp); +#line 2927 if(lstatus != ENOERR) +#line 2927 status = lstatus; +#line 2927 } +#line 2927 +#line 2927 *xpp = (const void *)xp; +#line 2927 return status; +#line 2927 # endif +#line 2927 } +#line 2927 int +#line 2928 ncx_getn_float_uint(const void **xpp, size_t nelems, uint *tp) +#line 2928 { +#line 2928 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2928 +#line 2928 /* basic algorithm is: +#line 2928 * - ensure sane alignment of input data +#line 2928 * - copy (conversion happens automatically) input data +#line 2928 * to output +#line 2928 * - update xpp to point at next unconverted input, and tp to point +#line 2928 * at next location for converted output +#line 2928 */ +#line 2928 long i, j, ni; +#line 2928 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2928 float *xp; +#line 2928 int nrange = 0; /* number of range errors */ +#line 2928 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2928 long cxp = (long) *((char**)xpp); +#line 2928 +#line 2928 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2928 /* sjl: manually stripmine so we can limit amount of +#line 2928 * vector work space reserved to LOOPCNT elements. Also +#line 2928 * makes vectorisation easy */ +#line 2928 for (j=0; j UINT_MAX; +#line 2928 } +#line 2928 /* update xpp and tp */ +#line 2928 if (realign) xp = (float *) *xpp; +#line 2928 xp += ni; +#line 2928 tp += ni; +#line 2928 *xpp = (void*)xp; +#line 2928 } +#line 2928 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2928 +#line 2928 #else /* not SX */ +#line 2928 const char *xp = (const char *) *xpp; +#line 2928 int status = ENOERR; +#line 2928 +#line 2928 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2928 { +#line 2928 const int lstatus = ncx_get_float_uint(xp, tp); +#line 2928 if(lstatus != ENOERR) +#line 2928 status = lstatus; +#line 2928 } +#line 2928 +#line 2928 *xpp = (const void *)xp; +#line 2928 return status; +#line 2928 # endif +#line 2928 } +#line 2928 int +#line 2929 ncx_getn_float_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2929 { +#line 2929 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2929 +#line 2929 /* basic algorithm is: +#line 2929 * - ensure sane alignment of input data +#line 2929 * - copy (conversion happens automatically) input data +#line 2929 * to output +#line 2929 * - update xpp to point at next unconverted input, and tp to point +#line 2929 * at next location for converted output +#line 2929 */ +#line 2929 long i, j, ni; +#line 2929 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2929 float *xp; +#line 2929 int nrange = 0; /* number of range errors */ +#line 2929 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2929 long cxp = (long) *((char**)xpp); +#line 2929 +#line 2929 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2929 /* sjl: manually stripmine so we can limit amount of +#line 2929 * vector work space reserved to LOOPCNT elements. Also +#line 2929 * makes vectorisation easy */ +#line 2929 for (j=0; j LONGLONG_MAX; +#line 2929 } +#line 2929 /* update xpp and tp */ +#line 2929 if (realign) xp = (float *) *xpp; +#line 2929 xp += ni; +#line 2929 tp += ni; +#line 2929 *xpp = (void*)xp; +#line 2929 } +#line 2929 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2929 +#line 2929 #else /* not SX */ +#line 2929 const char *xp = (const char *) *xpp; +#line 2929 int status = ENOERR; +#line 2929 +#line 2929 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2929 { +#line 2929 const int lstatus = ncx_get_float_longlong(xp, tp); +#line 2929 if(lstatus != ENOERR) +#line 2929 status = lstatus; +#line 2929 } +#line 2929 +#line 2929 *xpp = (const void *)xp; +#line 2929 return status; +#line 2929 # endif +#line 2929 } +#line 2929 int +#line 2930 ncx_getn_float_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2930 { +#line 2930 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2930 +#line 2930 /* basic algorithm is: +#line 2930 * - ensure sane alignment of input data +#line 2930 * - copy (conversion happens automatically) input data +#line 2930 * to output +#line 2930 * - update xpp to point at next unconverted input, and tp to point +#line 2930 * at next location for converted output +#line 2930 */ +#line 2930 long i, j, ni; +#line 2930 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2930 float *xp; +#line 2930 int nrange = 0; /* number of range errors */ +#line 2930 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2930 long cxp = (long) *((char**)xpp); +#line 2930 +#line 2930 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2930 /* sjl: manually stripmine so we can limit amount of +#line 2930 * vector work space reserved to LOOPCNT elements. Also +#line 2930 * makes vectorisation easy */ +#line 2930 for (j=0; j ULONGLONG_MAX; +#line 2930 } +#line 2930 /* update xpp and tp */ +#line 2930 if (realign) xp = (float *) *xpp; +#line 2930 xp += ni; +#line 2930 tp += ni; +#line 2930 *xpp = (void*)xp; +#line 2930 } +#line 2930 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2930 +#line 2930 #else /* not SX */ +#line 2930 const char *xp = (const char *) *xpp; +#line 2930 int status = ENOERR; +#line 2930 +#line 2930 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2930 { +#line 2930 const int lstatus = ncx_get_float_ulonglong(xp, tp); +#line 2930 if(lstatus != ENOERR) +#line 2930 status = lstatus; +#line 2930 } +#line 2930 +#line 2930 *xpp = (const void *)xp; +#line 2930 return status; +#line 2930 # endif +#line 2930 } +#line 2930 int +#line 2932 ncx_putn_float_schar(void **xpp, size_t nelems, const schar *tp) +#line 2932 { +#line 2932 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2932 +#line 2932 /* basic algorithm is: +#line 2932 * - ensure sane alignment of output data +#line 2932 * - copy (conversion happens automatically) input data +#line 2932 * to output +#line 2932 * - update tp to point at next unconverted input, and xpp to point +#line 2932 * at next location for converted output +#line 2932 */ +#line 2932 long i, j, ni; +#line 2932 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2932 float *xp; +#line 2932 int nrange = 0; /* number of range errors */ +#line 2932 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2932 long cxp = (long) *((char**)xpp); +#line 2932 +#line 2932 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2932 /* sjl: manually stripmine so we can limit amount of +#line 2932 * vector work space reserved to LOOPCNT elements. Also +#line 2932 * makes vectorisation easy */ +#line 2932 for (j=0; j X_FLOAT_MAX; +#line 2932 } +#line 2932 /* copy workspace back if necessary */ +#line 2932 if (realign) { +#line 2932 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2932 xp = (float *) *xpp; +#line 2932 } +#line 2932 /* update xpp and tp */ +#line 2932 xp += ni; +#line 2932 tp += ni; +#line 2932 *xpp = (void*)xp; +#line 2932 } +#line 2932 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2932 +#line 2932 #else /* not SX */ +#line 2932 +#line 2932 char *xp = (char *) *xpp; +#line 2932 int status = ENOERR; +#line 2932 +#line 2932 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2932 { +#line 2932 int lstatus = ncx_put_float_schar(xp, tp); +#line 2932 if(lstatus != ENOERR) +#line 2932 status = lstatus; +#line 2932 } +#line 2932 +#line 2932 *xpp = (void *)xp; +#line 2932 return status; +#line 2932 #endif +#line 2932 } +#line 2932 int +#line 2933 ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *tp) +#line 2933 { +#line 2933 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2933 +#line 2933 /* basic algorithm is: +#line 2933 * - ensure sane alignment of output data +#line 2933 * - copy (conversion happens automatically) input data +#line 2933 * to output +#line 2933 * - update tp to point at next unconverted input, and xpp to point +#line 2933 * at next location for converted output +#line 2933 */ +#line 2933 long i, j, ni; +#line 2933 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2933 float *xp; +#line 2933 int nrange = 0; /* number of range errors */ +#line 2933 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2933 long cxp = (long) *((char**)xpp); +#line 2933 +#line 2933 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2933 /* sjl: manually stripmine so we can limit amount of +#line 2933 * vector work space reserved to LOOPCNT elements. Also +#line 2933 * makes vectorisation easy */ +#line 2933 for (j=0; j X_FLOAT_MAX; +#line 2933 } +#line 2933 /* copy workspace back if necessary */ +#line 2933 if (realign) { +#line 2933 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2933 xp = (float *) *xpp; +#line 2933 } +#line 2933 /* update xpp and tp */ +#line 2933 xp += ni; +#line 2933 tp += ni; +#line 2933 *xpp = (void*)xp; +#line 2933 } +#line 2933 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2933 +#line 2933 #else /* not SX */ +#line 2933 +#line 2933 char *xp = (char *) *xpp; +#line 2933 int status = ENOERR; +#line 2933 +#line 2933 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2933 { +#line 2933 int lstatus = ncx_put_float_uchar(xp, tp); +#line 2933 if(lstatus != ENOERR) +#line 2933 status = lstatus; +#line 2933 } +#line 2933 +#line 2933 *xpp = (void *)xp; +#line 2933 return status; +#line 2933 #endif +#line 2933 } +#line 2933 int +#line 2934 ncx_putn_float_short(void **xpp, size_t nelems, const short *tp) +#line 2934 { +#line 2934 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2934 +#line 2934 /* basic algorithm is: +#line 2934 * - ensure sane alignment of output data +#line 2934 * - copy (conversion happens automatically) input data +#line 2934 * to output +#line 2934 * - update tp to point at next unconverted input, and xpp to point +#line 2934 * at next location for converted output +#line 2934 */ +#line 2934 long i, j, ni; +#line 2934 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2934 float *xp; +#line 2934 int nrange = 0; /* number of range errors */ +#line 2934 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2934 long cxp = (long) *((char**)xpp); +#line 2934 +#line 2934 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2934 /* sjl: manually stripmine so we can limit amount of +#line 2934 * vector work space reserved to LOOPCNT elements. Also +#line 2934 * makes vectorisation easy */ +#line 2934 for (j=0; j X_FLOAT_MAX; +#line 2934 } +#line 2934 /* copy workspace back if necessary */ +#line 2934 if (realign) { +#line 2934 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2934 xp = (float *) *xpp; +#line 2934 } +#line 2934 /* update xpp and tp */ +#line 2934 xp += ni; +#line 2934 tp += ni; +#line 2934 *xpp = (void*)xp; +#line 2934 } +#line 2934 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2934 +#line 2934 #else /* not SX */ +#line 2934 +#line 2934 char *xp = (char *) *xpp; +#line 2934 int status = ENOERR; +#line 2934 +#line 2934 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2934 { +#line 2934 int lstatus = ncx_put_float_short(xp, tp); +#line 2934 if(lstatus != ENOERR) +#line 2934 status = lstatus; +#line 2934 } +#line 2934 +#line 2934 *xpp = (void *)xp; +#line 2934 return status; +#line 2934 #endif +#line 2934 } +#line 2934 int +#line 2935 ncx_putn_float_int(void **xpp, size_t nelems, const int *tp) +#line 2935 { +#line 2935 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2935 +#line 2935 /* basic algorithm is: +#line 2935 * - ensure sane alignment of output data +#line 2935 * - copy (conversion happens automatically) input data +#line 2935 * to output +#line 2935 * - update tp to point at next unconverted input, and xpp to point +#line 2935 * at next location for converted output +#line 2935 */ +#line 2935 long i, j, ni; +#line 2935 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2935 float *xp; +#line 2935 int nrange = 0; /* number of range errors */ +#line 2935 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2935 long cxp = (long) *((char**)xpp); +#line 2935 +#line 2935 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2935 /* sjl: manually stripmine so we can limit amount of +#line 2935 * vector work space reserved to LOOPCNT elements. Also +#line 2935 * makes vectorisation easy */ +#line 2935 for (j=0; j X_FLOAT_MAX; +#line 2935 } +#line 2935 /* copy workspace back if necessary */ +#line 2935 if (realign) { +#line 2935 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2935 xp = (float *) *xpp; +#line 2935 } +#line 2935 /* update xpp and tp */ +#line 2935 xp += ni; +#line 2935 tp += ni; +#line 2935 *xpp = (void*)xp; +#line 2935 } +#line 2935 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2935 +#line 2935 #else /* not SX */ +#line 2935 +#line 2935 char *xp = (char *) *xpp; +#line 2935 int status = ENOERR; +#line 2935 +#line 2935 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2935 { +#line 2935 int lstatus = ncx_put_float_int(xp, tp); +#line 2935 if(lstatus != ENOERR) +#line 2935 status = lstatus; +#line 2935 } +#line 2935 +#line 2935 *xpp = (void *)xp; +#line 2935 return status; +#line 2935 #endif +#line 2935 } +#line 2935 #if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT) /* optimized version */ @@ -6621,49 +11068,93 @@ ncx_putn_float_float(void **xpp, size_t nfloats, const float *ip) while(ip < end) { const struct vax_single *const vsp = +#line 2957 (const struct vax_single *)ip; +#line 2957 struct ieee_single *const isp = (struct ieee_single *) (*xpp); +#line 2957 +#line 2957 switch(vsp->exp){ +#line 2957 case 0 : +#line 2957 /* all vax float with zero exponent map to zero */ +#line 2957 *isp = min.ieee; +#line 2957 break; +#line 2957 case 2 : +#line 2957 case 1 : +#line 2957 { +#line 2957 /* These will map to subnormals */ +#line 2957 unsigned mantissa = (vsp->mantissa1 << 16) +#line 2957 | vsp->mantissa2; +#line 2957 mantissa >>= 3 - vsp->exp; +#line 2957 mantissa += (1 << (20 + vsp->exp)); +#line 2957 isp->mant_lo_lo = mantissa; +#line 2957 isp->mant_lo_hi = mantissa >> 8; +#line 2957 isp->mant_hi = mantissa >> 16; +#line 2957 isp->exp_lo = 0; +#line 2957 isp->exp_hi = 0; +#line 2957 } +#line 2957 break; +#line 2957 case 0xff : /* max.s.exp */ +#line 2957 if( vsp->mantissa2 == max.s.mantissa2 +#line 2957 && vsp->mantissa1 == max.s.mantissa1) +#line 2957 { +#line 2957 /* map largest vax float to ieee infinity */ +#line 2957 *isp = max.ieee; +#line 2957 break; +#line 2957 } /* else, fall thru */ +#line 2957 default : +#line 2957 { +#line 2957 unsigned exp = vsp->exp - VAX_SNG_BIAS + IEEE_SNG_BIAS; +#line 2957 isp->exp_hi = exp >> 1; +#line 2957 isp->exp_lo = exp; +#line 2957 isp->mant_lo_lo = vsp->mantissa2; +#line 2957 isp->mant_lo_hi = vsp->mantissa2 >> 8; +#line 2957 isp->mant_hi = vsp->mantissa1; +#line 2957 } +#line 2957 } +#line 2957 +#line 2957 isp->sign = vsp->sign; +#line 2957 ip++; @@ -6691,783 +11182,1548 @@ ncx_putn_float_float(void **xpp, size_t nelems, const float *tp) #endif int +#line 2983 ncx_putn_float_double(void **xpp, size_t nelems, const double *tp) +#line 2983 { +#line 2983 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2983 +#line 2983 /* basic algorithm is: +#line 2983 * - ensure sane alignment of output data +#line 2983 * - copy (conversion happens automatically) input data +#line 2983 * to output +#line 2983 * - update tp to point at next unconverted input, and xpp to point +#line 2983 * at next location for converted output +#line 2983 */ +#line 2983 long i, j, ni; +#line 2983 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2983 float *xp; +#line 2983 int nrange = 0; /* number of range errors */ +#line 2983 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2983 long cxp = (long) *((char**)xpp); +#line 2983 +#line 2983 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2983 /* sjl: manually stripmine so we can limit amount of +#line 2983 * vector work space reserved to LOOPCNT elements. Also +#line 2983 * makes vectorisation easy */ +#line 2983 for (j=0; j X_FLOAT_MAX; +#line 2983 } +#line 2983 /* copy workspace back if necessary */ +#line 2983 if (realign) { +#line 2983 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2983 xp = (float *) *xpp; +#line 2983 } +#line 2983 /* update xpp and tp */ +#line 2983 xp += ni; +#line 2983 tp += ni; +#line 2983 *xpp = (void*)xp; +#line 2983 } +#line 2983 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2983 +#line 2983 #else /* not SX */ +#line 2983 +#line 2983 char *xp = (char *) *xpp; +#line 2983 int status = ENOERR; +#line 2983 +#line 2983 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2983 { +#line 2983 int lstatus = ncx_put_float_double(xp, tp); +#line 2983 if(lstatus != ENOERR) +#line 2983 status = lstatus; +#line 2983 } +#line 2983 +#line 2983 *xpp = (void *)xp; +#line 2983 return status; +#line 2983 #endif +#line 2983 } +#line 2983 int +#line 2984 ncx_putn_float_uint(void **xpp, size_t nelems, const uint *tp) +#line 2984 { +#line 2984 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2984 +#line 2984 /* basic algorithm is: +#line 2984 * - ensure sane alignment of output data +#line 2984 * - copy (conversion happens automatically) input data +#line 2984 * to output +#line 2984 * - update tp to point at next unconverted input, and xpp to point +#line 2984 * at next location for converted output +#line 2984 */ +#line 2984 long i, j, ni; +#line 2984 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2984 float *xp; +#line 2984 int nrange = 0; /* number of range errors */ +#line 2984 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2984 long cxp = (long) *((char**)xpp); +#line 2984 +#line 2984 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2984 /* sjl: manually stripmine so we can limit amount of +#line 2984 * vector work space reserved to LOOPCNT elements. Also +#line 2984 * makes vectorisation easy */ +#line 2984 for (j=0; j X_FLOAT_MAX; +#line 2984 } +#line 2984 /* copy workspace back if necessary */ +#line 2984 if (realign) { +#line 2984 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2984 xp = (float *) *xpp; +#line 2984 } +#line 2984 /* update xpp and tp */ +#line 2984 xp += ni; +#line 2984 tp += ni; +#line 2984 *xpp = (void*)xp; +#line 2984 } +#line 2984 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2984 +#line 2984 #else /* not SX */ +#line 2984 +#line 2984 char *xp = (char *) *xpp; +#line 2984 int status = ENOERR; +#line 2984 +#line 2984 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2984 { +#line 2984 int lstatus = ncx_put_float_uint(xp, tp); +#line 2984 if(lstatus != ENOERR) +#line 2984 status = lstatus; +#line 2984 } +#line 2984 +#line 2984 *xpp = (void *)xp; +#line 2984 return status; +#line 2984 #endif +#line 2984 } +#line 2984 int +#line 2985 ncx_putn_float_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 2985 { +#line 2985 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2985 +#line 2985 /* basic algorithm is: +#line 2985 * - ensure sane alignment of output data +#line 2985 * - copy (conversion happens automatically) input data +#line 2985 * to output +#line 2985 * - update tp to point at next unconverted input, and xpp to point +#line 2985 * at next location for converted output +#line 2985 */ +#line 2985 long i, j, ni; +#line 2985 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2985 float *xp; +#line 2985 int nrange = 0; /* number of range errors */ +#line 2985 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2985 long cxp = (long) *((char**)xpp); +#line 2985 +#line 2985 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2985 /* sjl: manually stripmine so we can limit amount of +#line 2985 * vector work space reserved to LOOPCNT elements. Also +#line 2985 * makes vectorisation easy */ +#line 2985 for (j=0; j X_FLOAT_MAX; +#line 2985 } +#line 2985 /* copy workspace back if necessary */ +#line 2985 if (realign) { +#line 2985 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2985 xp = (float *) *xpp; +#line 2985 } +#line 2985 /* update xpp and tp */ +#line 2985 xp += ni; +#line 2985 tp += ni; +#line 2985 *xpp = (void*)xp; +#line 2985 } +#line 2985 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2985 +#line 2985 #else /* not SX */ +#line 2985 +#line 2985 char *xp = (char *) *xpp; +#line 2985 int status = ENOERR; +#line 2985 +#line 2985 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2985 { +#line 2985 int lstatus = ncx_put_float_longlong(xp, tp); +#line 2985 if(lstatus != ENOERR) +#line 2985 status = lstatus; +#line 2985 } +#line 2985 +#line 2985 *xpp = (void *)xp; +#line 2985 return status; +#line 2985 #endif +#line 2985 } +#line 2985 int +#line 2986 ncx_putn_float_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 2986 { +#line 2986 #if _SX && X_SIZEOF_FLOAT == SIZEOF_FLOAT +#line 2986 +#line 2986 /* basic algorithm is: +#line 2986 * - ensure sane alignment of output data +#line 2986 * - copy (conversion happens automatically) input data +#line 2986 * to output +#line 2986 * - update tp to point at next unconverted input, and xpp to point +#line 2986 * at next location for converted output +#line 2986 */ +#line 2986 long i, j, ni; +#line 2986 float tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2986 float *xp; +#line 2986 int nrange = 0; /* number of range errors */ +#line 2986 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2986 long cxp = (long) *((char**)xpp); +#line 2986 +#line 2986 realign = (cxp & 7) % SIZEOF_FLOAT; +#line 2986 /* sjl: manually stripmine so we can limit amount of +#line 2986 * vector work space reserved to LOOPCNT elements. Also +#line 2986 * makes vectorisation easy */ +#line 2986 for (j=0; j X_FLOAT_MAX; +#line 2986 } +#line 2986 /* copy workspace back if necessary */ +#line 2986 if (realign) { +#line 2986 memcpy(*xpp, tmp, ni*X_SIZEOF_FLOAT); +#line 2986 xp = (float *) *xpp; +#line 2986 } +#line 2986 /* update xpp and tp */ +#line 2986 xp += ni; +#line 2986 tp += ni; +#line 2986 *xpp = (void*)xp; +#line 2986 } +#line 2986 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2986 +#line 2986 #else /* not SX */ +#line 2986 +#line 2986 char *xp = (char *) *xpp; +#line 2986 int status = ENOERR; +#line 2986 +#line 2986 for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) +#line 2986 { +#line 2986 int lstatus = ncx_put_float_ulonglong(xp, tp); +#line 2986 if(lstatus != ENOERR) +#line 2986 status = lstatus; +#line 2986 } +#line 2986 +#line 2986 *xpp = (void *)xp; +#line 2986 return status; +#line 2986 #endif +#line 2986 } +#line 2986 /* double */ int +#line 2990 ncx_getn_double_schar(const void **xpp, size_t nelems, schar *tp) +#line 2990 { +#line 2990 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2990 +#line 2990 /* basic algorithm is: +#line 2990 * - ensure sane alignment of input data +#line 2990 * - copy (conversion happens automatically) input data +#line 2990 * to output +#line 2990 * - update xpp to point at next unconverted input, and tp to point +#line 2990 * at next location for converted output +#line 2990 */ +#line 2990 long i, j, ni; +#line 2990 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2990 double *xp; +#line 2990 int nrange = 0; /* number of range errors */ +#line 2990 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2990 long cxp = (long) *((char**)xpp); +#line 2990 +#line 2990 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2990 /* sjl: manually stripmine so we can limit amount of +#line 2990 * vector work space reserved to LOOPCNT elements. Also +#line 2990 * makes vectorisation easy */ +#line 2990 for (j=0; j SCHAR_MAX; +#line 2990 } +#line 2990 /* update xpp and tp */ +#line 2990 if (realign) xp = (double *) *xpp; +#line 2990 xp += ni; +#line 2990 tp += ni; +#line 2990 *xpp = (void*)xp; +#line 2990 } +#line 2990 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2990 +#line 2990 #else /* not SX */ +#line 2990 const char *xp = (const char *) *xpp; +#line 2990 int status = ENOERR; +#line 2990 +#line 2990 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2990 { +#line 2990 const int lstatus = ncx_get_double_schar(xp, tp); +#line 2990 if(lstatus != ENOERR) +#line 2990 status = lstatus; +#line 2990 } +#line 2990 +#line 2990 *xpp = (const void *)xp; +#line 2990 return status; +#line 2990 # endif +#line 2990 } +#line 2990 int +#line 2991 ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *tp) +#line 2991 { +#line 2991 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2991 +#line 2991 /* basic algorithm is: +#line 2991 * - ensure sane alignment of input data +#line 2991 * - copy (conversion happens automatically) input data +#line 2991 * to output +#line 2991 * - update xpp to point at next unconverted input, and tp to point +#line 2991 * at next location for converted output +#line 2991 */ +#line 2991 long i, j, ni; +#line 2991 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2991 double *xp; +#line 2991 int nrange = 0; /* number of range errors */ +#line 2991 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2991 long cxp = (long) *((char**)xpp); +#line 2991 +#line 2991 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2991 /* sjl: manually stripmine so we can limit amount of +#line 2991 * vector work space reserved to LOOPCNT elements. Also +#line 2991 * makes vectorisation easy */ +#line 2991 for (j=0; j UCHAR_MAX; +#line 2991 } +#line 2991 /* update xpp and tp */ +#line 2991 if (realign) xp = (double *) *xpp; +#line 2991 xp += ni; +#line 2991 tp += ni; +#line 2991 *xpp = (void*)xp; +#line 2991 } +#line 2991 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2991 +#line 2991 #else /* not SX */ +#line 2991 const char *xp = (const char *) *xpp; +#line 2991 int status = ENOERR; +#line 2991 +#line 2991 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2991 { +#line 2991 const int lstatus = ncx_get_double_uchar(xp, tp); +#line 2991 if(lstatus != ENOERR) +#line 2991 status = lstatus; +#line 2991 } +#line 2991 +#line 2991 *xpp = (const void *)xp; +#line 2991 return status; +#line 2991 # endif +#line 2991 } +#line 2991 int +#line 2992 ncx_getn_double_short(const void **xpp, size_t nelems, short *tp) +#line 2992 { +#line 2992 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2992 +#line 2992 /* basic algorithm is: +#line 2992 * - ensure sane alignment of input data +#line 2992 * - copy (conversion happens automatically) input data +#line 2992 * to output +#line 2992 * - update xpp to point at next unconverted input, and tp to point +#line 2992 * at next location for converted output +#line 2992 */ +#line 2992 long i, j, ni; +#line 2992 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2992 double *xp; +#line 2992 int nrange = 0; /* number of range errors */ +#line 2992 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2992 long cxp = (long) *((char**)xpp); +#line 2992 +#line 2992 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2992 /* sjl: manually stripmine so we can limit amount of +#line 2992 * vector work space reserved to LOOPCNT elements. Also +#line 2992 * makes vectorisation easy */ +#line 2992 for (j=0; j SHORT_MAX; +#line 2992 } +#line 2992 /* update xpp and tp */ +#line 2992 if (realign) xp = (double *) *xpp; +#line 2992 xp += ni; +#line 2992 tp += ni; +#line 2992 *xpp = (void*)xp; +#line 2992 } +#line 2992 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2992 +#line 2992 #else /* not SX */ +#line 2992 const char *xp = (const char *) *xpp; +#line 2992 int status = ENOERR; +#line 2992 +#line 2992 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2992 { +#line 2992 const int lstatus = ncx_get_double_short(xp, tp); +#line 2992 if(lstatus != ENOERR) +#line 2992 status = lstatus; +#line 2992 } +#line 2992 +#line 2992 *xpp = (const void *)xp; +#line 2992 return status; +#line 2992 # endif +#line 2992 } +#line 2992 int +#line 2993 ncx_getn_double_int(const void **xpp, size_t nelems, int *tp) +#line 2993 { +#line 2993 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2993 +#line 2993 /* basic algorithm is: +#line 2993 * - ensure sane alignment of input data +#line 2993 * - copy (conversion happens automatically) input data +#line 2993 * to output +#line 2993 * - update xpp to point at next unconverted input, and tp to point +#line 2993 * at next location for converted output +#line 2993 */ +#line 2993 long i, j, ni; +#line 2993 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2993 double *xp; +#line 2993 int nrange = 0; /* number of range errors */ +#line 2993 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2993 long cxp = (long) *((char**)xpp); +#line 2993 +#line 2993 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2993 /* sjl: manually stripmine so we can limit amount of +#line 2993 * vector work space reserved to LOOPCNT elements. Also +#line 2993 * makes vectorisation easy */ +#line 2993 for (j=0; j INT_MAX; +#line 2993 } +#line 2993 /* update xpp and tp */ +#line 2993 if (realign) xp = (double *) *xpp; +#line 2993 xp += ni; +#line 2993 tp += ni; +#line 2993 *xpp = (void*)xp; +#line 2993 } +#line 2993 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2993 +#line 2993 #else /* not SX */ +#line 2993 const char *xp = (const char *) *xpp; +#line 2993 int status = ENOERR; +#line 2993 +#line 2993 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2993 { +#line 2993 const int lstatus = ncx_get_double_int(xp, tp); +#line 2993 if(lstatus != ENOERR) +#line 2993 status = lstatus; +#line 2993 } +#line 2993 +#line 2993 *xpp = (const void *)xp; +#line 2993 return status; +#line 2993 # endif +#line 2993 } +#line 2993 int +#line 2994 ncx_getn_double_float(const void **xpp, size_t nelems, float *tp) +#line 2994 { +#line 2994 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2994 +#line 2994 /* basic algorithm is: +#line 2994 * - ensure sane alignment of input data +#line 2994 * - copy (conversion happens automatically) input data +#line 2994 * to output +#line 2994 * - update xpp to point at next unconverted input, and tp to point +#line 2994 * at next location for converted output +#line 2994 */ +#line 2994 long i, j, ni; +#line 2994 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2994 double *xp; +#line 2994 int nrange = 0; /* number of range errors */ +#line 2994 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2994 long cxp = (long) *((char**)xpp); +#line 2994 +#line 2994 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2994 /* sjl: manually stripmine so we can limit amount of +#line 2994 * vector work space reserved to LOOPCNT elements. Also +#line 2994 * makes vectorisation easy */ +#line 2994 for (j=0; j FLOAT_MAX; +#line 2994 } +#line 2994 /* update xpp and tp */ +#line 2994 if (realign) xp = (double *) *xpp; +#line 2994 xp += ni; +#line 2994 tp += ni; +#line 2994 *xpp = (void*)xp; +#line 2994 } +#line 2994 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2994 +#line 2994 #else /* not SX */ +#line 2994 const char *xp = (const char *) *xpp; +#line 2994 int status = ENOERR; +#line 2994 +#line 2994 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2994 { +#line 2994 const int lstatus = ncx_get_double_float(xp, tp); +#line 2994 if(lstatus != ENOERR) +#line 2994 status = lstatus; +#line 2994 } +#line 2994 +#line 2994 *xpp = (const void *)xp; +#line 2994 return status; +#line 2994 # endif +#line 2994 } +#line 2994 +#line 2996 int +#line 2996 ncx_getn_double_uint(const void **xpp, size_t nelems, uint *tp) +#line 2996 { +#line 2996 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2996 +#line 2996 /* basic algorithm is: +#line 2996 * - ensure sane alignment of input data +#line 2996 * - copy (conversion happens automatically) input data +#line 2996 * to output +#line 2996 * - update xpp to point at next unconverted input, and tp to point +#line 2996 * at next location for converted output +#line 2996 */ +#line 2996 long i, j, ni; +#line 2996 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2996 double *xp; +#line 2996 int nrange = 0; /* number of range errors */ +#line 2996 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2996 long cxp = (long) *((char**)xpp); +#line 2996 +#line 2996 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2996 /* sjl: manually stripmine so we can limit amount of +#line 2996 * vector work space reserved to LOOPCNT elements. Also +#line 2996 * makes vectorisation easy */ +#line 2996 for (j=0; j UINT_MAX; +#line 2996 } +#line 2996 /* update xpp and tp */ +#line 2996 if (realign) xp = (double *) *xpp; +#line 2996 xp += ni; +#line 2996 tp += ni; +#line 2996 *xpp = (void*)xp; +#line 2996 } +#line 2996 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2996 +#line 2996 #else /* not SX */ +#line 2996 const char *xp = (const char *) *xpp; +#line 2996 int status = ENOERR; +#line 2996 +#line 2996 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2996 { +#line 2996 const int lstatus = ncx_get_double_uint(xp, tp); +#line 2996 if(lstatus != ENOERR) +#line 2996 status = lstatus; +#line 2996 } +#line 2996 +#line 2996 *xpp = (const void *)xp; +#line 2996 return status; +#line 2996 # endif +#line 2996 } +#line 2996 int +#line 2997 ncx_getn_double_longlong(const void **xpp, size_t nelems, longlong *tp) +#line 2997 { +#line 2997 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2997 +#line 2997 /* basic algorithm is: +#line 2997 * - ensure sane alignment of input data +#line 2997 * - copy (conversion happens automatically) input data +#line 2997 * to output +#line 2997 * - update xpp to point at next unconverted input, and tp to point +#line 2997 * at next location for converted output +#line 2997 */ +#line 2997 long i, j, ni; +#line 2997 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2997 double *xp; +#line 2997 int nrange = 0; /* number of range errors */ +#line 2997 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2997 long cxp = (long) *((char**)xpp); +#line 2997 +#line 2997 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2997 /* sjl: manually stripmine so we can limit amount of +#line 2997 * vector work space reserved to LOOPCNT elements. Also +#line 2997 * makes vectorisation easy */ +#line 2997 for (j=0; j LONGLONG_MAX; +#line 2997 } +#line 2997 /* update xpp and tp */ +#line 2997 if (realign) xp = (double *) *xpp; +#line 2997 xp += ni; +#line 2997 tp += ni; +#line 2997 *xpp = (void*)xp; +#line 2997 } +#line 2997 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2997 +#line 2997 #else /* not SX */ +#line 2997 const char *xp = (const char *) *xpp; +#line 2997 int status = ENOERR; +#line 2997 +#line 2997 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2997 { +#line 2997 const int lstatus = ncx_get_double_longlong(xp, tp); +#line 2997 if(lstatus != ENOERR) +#line 2997 status = lstatus; +#line 2997 } +#line 2997 +#line 2997 *xpp = (const void *)xp; +#line 2997 return status; +#line 2997 # endif +#line 2997 } +#line 2997 int +#line 2998 ncx_getn_double_ulonglong(const void **xpp, size_t nelems, ulonglong *tp) +#line 2998 { +#line 2998 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 2998 +#line 2998 /* basic algorithm is: +#line 2998 * - ensure sane alignment of input data +#line 2998 * - copy (conversion happens automatically) input data +#line 2998 * to output +#line 2998 * - update xpp to point at next unconverted input, and tp to point +#line 2998 * at next location for converted output +#line 2998 */ +#line 2998 long i, j, ni; +#line 2998 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 2998 double *xp; +#line 2998 int nrange = 0; /* number of range errors */ +#line 2998 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 2998 long cxp = (long) *((char**)xpp); +#line 2998 +#line 2998 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 2998 /* sjl: manually stripmine so we can limit amount of +#line 2998 * vector work space reserved to LOOPCNT elements. Also +#line 2998 * makes vectorisation easy */ +#line 2998 for (j=0; j ULONGLONG_MAX; +#line 2998 } +#line 2998 /* update xpp and tp */ +#line 2998 if (realign) xp = (double *) *xpp; +#line 2998 xp += ni; +#line 2998 tp += ni; +#line 2998 *xpp = (void*)xp; +#line 2998 } +#line 2998 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 2998 +#line 2998 #else /* not SX */ +#line 2998 const char *xp = (const char *) *xpp; +#line 2998 int status = ENOERR; +#line 2998 +#line 2998 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 2998 { +#line 2998 const int lstatus = ncx_get_double_ulonglong(xp, tp); +#line 2998 if(lstatus != ENOERR) +#line 2998 status = lstatus; +#line 2998 } +#line 2998 +#line 2998 *xpp = (const void *)xp; +#line 2998 return status; +#line 2998 # endif +#line 2998 } +#line 2998 #if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT) /* optimized version */ @@ -7491,46 +12747,87 @@ ncx_getn_double_double(const void **xpp, size_t ndoubles, double *ip) while(ip < end) { struct vax_double *const vdp = +#line 3020 (struct vax_double *)ip; +#line 3020 const struct ieee_double *const idp = +#line 3020 (const struct ieee_double *) (*xpp); +#line 3020 { +#line 3020 const struct dbl_limits *lim; +#line 3020 int ii; +#line 3020 for (ii = 0, lim = dbl_limits; +#line 3020 ii < sizeof(dbl_limits)/sizeof(struct dbl_limits); +#line 3020 ii++, lim++) +#line 3020 { +#line 3020 if ((idp->mant_lo == lim->ieee.mant_lo) +#line 3020 && (idp->mant_4 == lim->ieee.mant_4) +#line 3020 && (idp->mant_5 == lim->ieee.mant_5) +#line 3020 && (idp->mant_6 == lim->ieee.mant_6) +#line 3020 && (idp->exp_lo == lim->ieee.exp_lo) +#line 3020 && (idp->exp_hi == lim->ieee.exp_hi) +#line 3020 ) +#line 3020 { +#line 3020 *vdp = lim->d; +#line 3020 goto doneit; +#line 3020 } +#line 3020 } +#line 3020 } +#line 3020 { +#line 3020 unsigned exp = idp->exp_hi << 4 | idp->exp_lo; +#line 3020 vdp->exp = exp - IEEE_DBL_BIAS + VAX_DBL_BIAS; +#line 3020 } +#line 3020 { +#line 3020 unsigned mant_hi = ((idp->mant_6 << 16) +#line 3020 | (idp->mant_5 << 8) +#line 3020 | idp->mant_4); +#line 3020 unsigned mant_lo = SWAP4(idp->mant_lo); +#line 3020 vdp->mantissa1 = (mant_hi >> 13); +#line 3020 vdp->mantissa2 = ((mant_hi & MASK(13)) << 3) +#line 3020 | (mant_lo >> 29); +#line 3020 vdp->mantissa3 = (mant_lo >> 13); +#line 3020 vdp->mantissa4 = (mant_lo << 3); +#line 3020 } +#line 3020 doneit: +#line 3020 vdp->sign = idp->sign; +#line 3020 ip++; *xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE; @@ -7559,548 +12856,1085 @@ ncx_getn_double_double(const void **xpp, size_t nelems, double *tp) #endif int +#line 3047 ncx_putn_double_schar(void **xpp, size_t nelems, const schar *tp) +#line 3047 { +#line 3047 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3047 +#line 3047 /* basic algorithm is: +#line 3047 * - ensure sane alignment of output data +#line 3047 * - copy (conversion happens automatically) input data +#line 3047 * to output +#line 3047 * - update tp to point at next unconverted input, and xpp to point +#line 3047 * at next location for converted output +#line 3047 */ +#line 3047 long i, j, ni; +#line 3047 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3047 double *xp; +#line 3047 int nrange = 0; /* number of range errors */ +#line 3047 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3047 long cxp = (long) *((char**)xpp); +#line 3047 +#line 3047 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3047 /* sjl: manually stripmine so we can limit amount of +#line 3047 * vector work space reserved to LOOPCNT elements. Also +#line 3047 * makes vectorisation easy */ +#line 3047 for (j=0; j X_DOUBLE_MAX; +#line 3047 } +#line 3047 /* copy workspace back if necessary */ +#line 3047 if (realign) { +#line 3047 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3047 xp = (double *) *xpp; +#line 3047 } +#line 3047 /* update xpp and tp */ +#line 3047 xp += ni; +#line 3047 tp += ni; +#line 3047 *xpp = (void*)xp; +#line 3047 } +#line 3047 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3047 +#line 3047 #else /* not SX */ +#line 3047 +#line 3047 char *xp = (char *) *xpp; +#line 3047 int status = ENOERR; +#line 3047 +#line 3047 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3047 { +#line 3047 int lstatus = ncx_put_double_schar(xp, tp); +#line 3047 if(lstatus != ENOERR) +#line 3047 status = lstatus; +#line 3047 } +#line 3047 +#line 3047 *xpp = (void *)xp; +#line 3047 return status; +#line 3047 #endif +#line 3047 } +#line 3047 int +#line 3048 ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *tp) +#line 3048 { +#line 3048 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3048 +#line 3048 /* basic algorithm is: +#line 3048 * - ensure sane alignment of output data +#line 3048 * - copy (conversion happens automatically) input data +#line 3048 * to output +#line 3048 * - update tp to point at next unconverted input, and xpp to point +#line 3048 * at next location for converted output +#line 3048 */ +#line 3048 long i, j, ni; +#line 3048 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3048 double *xp; +#line 3048 int nrange = 0; /* number of range errors */ +#line 3048 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3048 long cxp = (long) *((char**)xpp); +#line 3048 +#line 3048 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3048 /* sjl: manually stripmine so we can limit amount of +#line 3048 * vector work space reserved to LOOPCNT elements. Also +#line 3048 * makes vectorisation easy */ +#line 3048 for (j=0; j X_DOUBLE_MAX; +#line 3048 } +#line 3048 /* copy workspace back if necessary */ +#line 3048 if (realign) { +#line 3048 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3048 xp = (double *) *xpp; +#line 3048 } +#line 3048 /* update xpp and tp */ +#line 3048 xp += ni; +#line 3048 tp += ni; +#line 3048 *xpp = (void*)xp; +#line 3048 } +#line 3048 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3048 +#line 3048 #else /* not SX */ +#line 3048 +#line 3048 char *xp = (char *) *xpp; +#line 3048 int status = ENOERR; +#line 3048 +#line 3048 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3048 { +#line 3048 int lstatus = ncx_put_double_uchar(xp, tp); +#line 3048 if(lstatus != ENOERR) +#line 3048 status = lstatus; +#line 3048 } +#line 3048 +#line 3048 *xpp = (void *)xp; +#line 3048 return status; +#line 3048 #endif +#line 3048 } +#line 3048 int +#line 3049 ncx_putn_double_short(void **xpp, size_t nelems, const short *tp) +#line 3049 { +#line 3049 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3049 +#line 3049 /* basic algorithm is: +#line 3049 * - ensure sane alignment of output data +#line 3049 * - copy (conversion happens automatically) input data +#line 3049 * to output +#line 3049 * - update tp to point at next unconverted input, and xpp to point +#line 3049 * at next location for converted output +#line 3049 */ +#line 3049 long i, j, ni; +#line 3049 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3049 double *xp; +#line 3049 int nrange = 0; /* number of range errors */ +#line 3049 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3049 long cxp = (long) *((char**)xpp); +#line 3049 +#line 3049 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3049 /* sjl: manually stripmine so we can limit amount of +#line 3049 * vector work space reserved to LOOPCNT elements. Also +#line 3049 * makes vectorisation easy */ +#line 3049 for (j=0; j X_DOUBLE_MAX; +#line 3049 } +#line 3049 /* copy workspace back if necessary */ +#line 3049 if (realign) { +#line 3049 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3049 xp = (double *) *xpp; +#line 3049 } +#line 3049 /* update xpp and tp */ +#line 3049 xp += ni; +#line 3049 tp += ni; +#line 3049 *xpp = (void*)xp; +#line 3049 } +#line 3049 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3049 +#line 3049 #else /* not SX */ +#line 3049 +#line 3049 char *xp = (char *) *xpp; +#line 3049 int status = ENOERR; +#line 3049 +#line 3049 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3049 { +#line 3049 int lstatus = ncx_put_double_short(xp, tp); +#line 3049 if(lstatus != ENOERR) +#line 3049 status = lstatus; +#line 3049 } +#line 3049 +#line 3049 *xpp = (void *)xp; +#line 3049 return status; +#line 3049 #endif +#line 3049 } +#line 3049 int +#line 3050 ncx_putn_double_int(void **xpp, size_t nelems, const int *tp) +#line 3050 { +#line 3050 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3050 +#line 3050 /* basic algorithm is: +#line 3050 * - ensure sane alignment of output data +#line 3050 * - copy (conversion happens automatically) input data +#line 3050 * to output +#line 3050 * - update tp to point at next unconverted input, and xpp to point +#line 3050 * at next location for converted output +#line 3050 */ +#line 3050 long i, j, ni; +#line 3050 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3050 double *xp; +#line 3050 int nrange = 0; /* number of range errors */ +#line 3050 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3050 long cxp = (long) *((char**)xpp); +#line 3050 +#line 3050 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3050 /* sjl: manually stripmine so we can limit amount of +#line 3050 * vector work space reserved to LOOPCNT elements. Also +#line 3050 * makes vectorisation easy */ +#line 3050 for (j=0; j X_DOUBLE_MAX; +#line 3050 } +#line 3050 /* copy workspace back if necessary */ +#line 3050 if (realign) { +#line 3050 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3050 xp = (double *) *xpp; +#line 3050 } +#line 3050 /* update xpp and tp */ +#line 3050 xp += ni; +#line 3050 tp += ni; +#line 3050 *xpp = (void*)xp; +#line 3050 } +#line 3050 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3050 +#line 3050 #else /* not SX */ +#line 3050 +#line 3050 char *xp = (char *) *xpp; +#line 3050 int status = ENOERR; +#line 3050 +#line 3050 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3050 { +#line 3050 int lstatus = ncx_put_double_int(xp, tp); +#line 3050 if(lstatus != ENOERR) +#line 3050 status = lstatus; +#line 3050 } +#line 3050 +#line 3050 *xpp = (void *)xp; +#line 3050 return status; +#line 3050 #endif +#line 3050 } +#line 3050 int +#line 3051 ncx_putn_double_float(void **xpp, size_t nelems, const float *tp) +#line 3051 { +#line 3051 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3051 +#line 3051 /* basic algorithm is: +#line 3051 * - ensure sane alignment of output data +#line 3051 * - copy (conversion happens automatically) input data +#line 3051 * to output +#line 3051 * - update tp to point at next unconverted input, and xpp to point +#line 3051 * at next location for converted output +#line 3051 */ +#line 3051 long i, j, ni; +#line 3051 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3051 double *xp; +#line 3051 int nrange = 0; /* number of range errors */ +#line 3051 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3051 long cxp = (long) *((char**)xpp); +#line 3051 +#line 3051 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3051 /* sjl: manually stripmine so we can limit amount of +#line 3051 * vector work space reserved to LOOPCNT elements. Also +#line 3051 * makes vectorisation easy */ +#line 3051 for (j=0; j X_DOUBLE_MAX; +#line 3051 } +#line 3051 /* copy workspace back if necessary */ +#line 3051 if (realign) { +#line 3051 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3051 xp = (double *) *xpp; +#line 3051 } +#line 3051 /* update xpp and tp */ +#line 3051 xp += ni; +#line 3051 tp += ni; +#line 3051 *xpp = (void*)xp; +#line 3051 } +#line 3051 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3051 +#line 3051 #else /* not SX */ +#line 3051 +#line 3051 char *xp = (char *) *xpp; +#line 3051 int status = ENOERR; +#line 3051 +#line 3051 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3051 { +#line 3051 int lstatus = ncx_put_double_float(xp, tp); +#line 3051 if(lstatus != ENOERR) +#line 3051 status = lstatus; +#line 3051 } +#line 3051 +#line 3051 *xpp = (void *)xp; +#line 3051 return status; +#line 3051 #endif +#line 3051 } +#line 3051 +#line 3053 int +#line 3053 ncx_putn_double_uint(void **xpp, size_t nelems, const uint *tp) +#line 3053 { +#line 3053 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3053 +#line 3053 /* basic algorithm is: +#line 3053 * - ensure sane alignment of output data +#line 3053 * - copy (conversion happens automatically) input data +#line 3053 * to output +#line 3053 * - update tp to point at next unconverted input, and xpp to point +#line 3053 * at next location for converted output +#line 3053 */ +#line 3053 long i, j, ni; +#line 3053 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3053 double *xp; +#line 3053 int nrange = 0; /* number of range errors */ +#line 3053 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3053 long cxp = (long) *((char**)xpp); +#line 3053 +#line 3053 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3053 /* sjl: manually stripmine so we can limit amount of +#line 3053 * vector work space reserved to LOOPCNT elements. Also +#line 3053 * makes vectorisation easy */ +#line 3053 for (j=0; j X_DOUBLE_MAX; +#line 3053 } +#line 3053 /* copy workspace back if necessary */ +#line 3053 if (realign) { +#line 3053 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3053 xp = (double *) *xpp; +#line 3053 } +#line 3053 /* update xpp and tp */ +#line 3053 xp += ni; +#line 3053 tp += ni; +#line 3053 *xpp = (void*)xp; +#line 3053 } +#line 3053 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3053 +#line 3053 #else /* not SX */ +#line 3053 +#line 3053 char *xp = (char *) *xpp; +#line 3053 int status = ENOERR; +#line 3053 +#line 3053 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3053 { +#line 3053 int lstatus = ncx_put_double_uint(xp, tp); +#line 3053 if(lstatus != ENOERR) +#line 3053 status = lstatus; +#line 3053 } +#line 3053 +#line 3053 *xpp = (void *)xp; +#line 3053 return status; +#line 3053 #endif +#line 3053 } +#line 3053 int +#line 3054 ncx_putn_double_longlong(void **xpp, size_t nelems, const longlong *tp) +#line 3054 { +#line 3054 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3054 +#line 3054 /* basic algorithm is: +#line 3054 * - ensure sane alignment of output data +#line 3054 * - copy (conversion happens automatically) input data +#line 3054 * to output +#line 3054 * - update tp to point at next unconverted input, and xpp to point +#line 3054 * at next location for converted output +#line 3054 */ +#line 3054 long i, j, ni; +#line 3054 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3054 double *xp; +#line 3054 int nrange = 0; /* number of range errors */ +#line 3054 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3054 long cxp = (long) *((char**)xpp); +#line 3054 +#line 3054 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3054 /* sjl: manually stripmine so we can limit amount of +#line 3054 * vector work space reserved to LOOPCNT elements. Also +#line 3054 * makes vectorisation easy */ +#line 3054 for (j=0; j X_DOUBLE_MAX; +#line 3054 } +#line 3054 /* copy workspace back if necessary */ +#line 3054 if (realign) { +#line 3054 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3054 xp = (double *) *xpp; +#line 3054 } +#line 3054 /* update xpp and tp */ +#line 3054 xp += ni; +#line 3054 tp += ni; +#line 3054 *xpp = (void*)xp; +#line 3054 } +#line 3054 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3054 +#line 3054 #else /* not SX */ +#line 3054 +#line 3054 char *xp = (char *) *xpp; +#line 3054 int status = ENOERR; +#line 3054 +#line 3054 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3054 { +#line 3054 int lstatus = ncx_put_double_longlong(xp, tp); +#line 3054 if(lstatus != ENOERR) +#line 3054 status = lstatus; +#line 3054 } +#line 3054 +#line 3054 *xpp = (void *)xp; +#line 3054 return status; +#line 3054 #endif +#line 3054 } +#line 3054 int +#line 3055 ncx_putn_double_ulonglong(void **xpp, size_t nelems, const ulonglong *tp) +#line 3055 { +#line 3055 #if _SX && X_SIZEOF_DOUBLE == SIZEOF_DOUBLE +#line 3055 +#line 3055 /* basic algorithm is: +#line 3055 * - ensure sane alignment of output data +#line 3055 * - copy (conversion happens automatically) input data +#line 3055 * to output +#line 3055 * - update tp to point at next unconverted input, and xpp to point +#line 3055 * at next location for converted output +#line 3055 */ +#line 3055 long i, j, ni; +#line 3055 double tmp[LOOPCNT]; /* in case input is misaligned */ +#line 3055 double *xp; +#line 3055 int nrange = 0; /* number of range errors */ +#line 3055 int realign = 0; /* "do we need to fix input data alignment?" */ +#line 3055 long cxp = (long) *((char**)xpp); +#line 3055 +#line 3055 realign = (cxp & 7) % SIZEOF_DOUBLE; +#line 3055 /* sjl: manually stripmine so we can limit amount of +#line 3055 * vector work space reserved to LOOPCNT elements. Also +#line 3055 * makes vectorisation easy */ +#line 3055 for (j=0; j X_DOUBLE_MAX; +#line 3055 } +#line 3055 /* copy workspace back if necessary */ +#line 3055 if (realign) { +#line 3055 memcpy(*xpp, tmp, ni*X_SIZEOF_DOUBLE); +#line 3055 xp = (double *) *xpp; +#line 3055 } +#line 3055 /* update xpp and tp */ +#line 3055 xp += ni; +#line 3055 tp += ni; +#line 3055 *xpp = (void*)xp; +#line 3055 } +#line 3055 return nrange == 0 ? ENOERR : NC_ERANGE; +#line 3055 +#line 3055 #else /* not SX */ +#line 3055 +#line 3055 char *xp = (char *) *xpp; +#line 3055 int status = ENOERR; +#line 3055 +#line 3055 for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++) +#line 3055 { +#line 3055 int lstatus = ncx_put_double_ulonglong(xp, tp); +#line 3055 if(lstatus != ENOERR) +#line 3055 status = lstatus; +#line 3055 } +#line 3055 +#line 3055 *xpp = (void *)xp; +#line 3055 return status; +#line 3055 #endif +#line 3055 } +#line 3055 #if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT) /* optimized version */ @@ -8124,64 +13958,123 @@ ncx_putn_double_double(void **xpp, size_t ndoubles, const double *ip) while(ip < end) { const struct vax_double *const vdp = +#line 3077 (const struct vax_double *)ip; +#line 3077 struct ieee_double *const idp = +#line 3077 (struct ieee_double *) (*xpp); +#line 3077 +#line 3077 if ((vdp->mantissa4 > (dbl_limits[0].d.mantissa4 - 3)) && +#line 3077 (vdp->mantissa3 == dbl_limits[0].d.mantissa3) && +#line 3077 (vdp->mantissa2 == dbl_limits[0].d.mantissa2) && +#line 3077 (vdp->mantissa1 == dbl_limits[0].d.mantissa1) && +#line 3077 (vdp->exp == dbl_limits[0].d.exp)) +#line 3077 { +#line 3077 *idp = dbl_limits[0].ieee; +#line 3077 goto shipit; +#line 3077 } +#line 3077 if ((vdp->mantissa4 == dbl_limits[1].d.mantissa4) && +#line 3077 (vdp->mantissa3 == dbl_limits[1].d.mantissa3) && +#line 3077 (vdp->mantissa2 == dbl_limits[1].d.mantissa2) && +#line 3077 (vdp->mantissa1 == dbl_limits[1].d.mantissa1) && +#line 3077 (vdp->exp == dbl_limits[1].d.exp)) +#line 3077 { +#line 3077 *idp = dbl_limits[1].ieee; +#line 3077 goto shipit; +#line 3077 } +#line 3077 +#line 3077 { +#line 3077 unsigned exp = vdp->exp - VAX_DBL_BIAS + IEEE_DBL_BIAS; +#line 3077 +#line 3077 unsigned mant_lo = ((vdp->mantissa2 & MASK(3)) << 29) | +#line 3077 (vdp->mantissa3 << 13) | +#line 3077 ((vdp->mantissa4 >> 3) & MASK(13)); +#line 3077 +#line 3077 unsigned mant_hi = (vdp->mantissa1 << 13) +#line 3077 | (vdp->mantissa2 >> 3); +#line 3077 +#line 3077 if((vdp->mantissa4 & 7) > 4) +#line 3077 { +#line 3077 /* round up */ +#line 3077 mant_lo++; +#line 3077 if(mant_lo == 0) +#line 3077 { +#line 3077 mant_hi++; +#line 3077 if(mant_hi > 0xffffff) +#line 3077 { +#line 3077 mant_hi = 0; +#line 3077 exp++; +#line 3077 } +#line 3077 } +#line 3077 } +#line 3077 +#line 3077 idp->mant_lo = SWAP4(mant_lo); +#line 3077 idp->mant_6 = mant_hi >> 16; +#line 3077 idp->mant_5 = (mant_hi & 0xff00) >> 8; +#line 3077 idp->mant_4 = mant_hi; +#line 3077 idp->exp_hi = exp >> 4; +#line 3077 idp->exp_lo = exp; +#line 3077 } +#line 3077 +#line 3077 shipit: +#line 3077 idp->sign = vdp->sign; +#line 3077 ip++; *xpp = (char *)(*xpp) + X_SIZEOF_DOUBLE; @@ -8220,8 +14113,11 @@ int ncx_getn_text(const void **xpp, size_t nelems, char *tp) { (void) memcpy(tp, *xpp, nelems); +#line 3114 *xpp = (void *)((char *)(*xpp) + nelems); +#line 3114 return ENOERR; +#line 3114 } @@ -8229,14 +14125,23 @@ int ncx_pad_getn_text(const void **xpp, size_t nelems, char *tp) { size_t rndup = nelems % X_ALIGN; +#line 3120 +#line 3120 if(rndup) +#line 3120 rndup = X_ALIGN - rndup; +#line 3120 +#line 3120 (void) memcpy(tp, *xpp, nelems); +#line 3120 *xpp = (void *)((char *)(*xpp) + nelems + rndup); +#line 3120 +#line 3120 return ENOERR; +#line 3120 } @@ -8244,9 +14149,13 @@ int ncx_putn_text(void **xpp, size_t nelems, const char *tp) { (void) memcpy(*xpp, tp, nelems); +#line 3126 *xpp = (void *)((char *)(*xpp) + nelems); +#line 3126 +#line 3126 return ENOERR; +#line 3126 } @@ -8254,20 +14163,35 @@ int ncx_pad_putn_text(void **xpp, size_t nelems, const char *tp) { size_t rndup = nelems % X_ALIGN; +#line 3132 +#line 3132 if(rndup) +#line 3132 rndup = X_ALIGN - rndup; +#line 3132 +#line 3132 (void) memcpy(*xpp, tp, nelems); +#line 3132 *xpp = (void *)((char *)(*xpp) + nelems); +#line 3132 +#line 3132 if(rndup) +#line 3132 { +#line 3132 (void) memcpy(*xpp, nada, rndup); +#line 3132 *xpp = (void *)((char *)(*xpp) + rndup); +#line 3132 } +#line 3132 +#line 3132 return ENOERR; +#line 3132 } @@ -8278,8 +14202,11 @@ int ncx_getn_void(const void **xpp, size_t nelems, void *tp) { (void) memcpy(tp, *xpp, nelems); +#line 3141 *xpp = (void *)((char *)(*xpp) + nelems); +#line 3141 return ENOERR; +#line 3141 } @@ -8287,14 +14214,23 @@ int ncx_pad_getn_void(const void **xpp, size_t nelems, void *tp) { size_t rndup = nelems % X_ALIGN; +#line 3147 +#line 3147 if(rndup) +#line 3147 rndup = X_ALIGN - rndup; +#line 3147 +#line 3147 (void) memcpy(tp, *xpp, nelems); +#line 3147 *xpp = (void *)((char *)(*xpp) + nelems + rndup); +#line 3147 +#line 3147 return ENOERR; +#line 3147 } @@ -8302,9 +14238,13 @@ int ncx_putn_void(void **xpp, size_t nelems, const void *tp) { (void) memcpy(*xpp, tp, nelems); +#line 3153 *xpp = (void *)((char *)(*xpp) + nelems); +#line 3153 +#line 3153 return ENOERR; +#line 3153 } @@ -8312,19 +14252,34 @@ int ncx_pad_putn_void(void **xpp, size_t nelems, const void *tp) { size_t rndup = nelems % X_ALIGN; +#line 3159 +#line 3159 if(rndup) +#line 3159 rndup = X_ALIGN - rndup; +#line 3159 +#line 3159 (void) memcpy(*xpp, tp, nelems); +#line 3159 *xpp = (void *)((char *)(*xpp) + nelems); +#line 3159 +#line 3159 if(rndup) +#line 3159 { +#line 3159 (void) memcpy(*xpp, nada, rndup); +#line 3159 *xpp = (void *)((char *)(*xpp) + rndup); +#line 3159 } +#line 3159 +#line 3159 return ENOERR; +#line 3159 } diff --git a/libsrc/ncx.m4 b/libsrc/ncx.m4 index 015ab13e5..71668e452 100644 --- a/libsrc/ncx.m4 +++ b/libsrc/ncx.m4 @@ -1902,7 +1902,7 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip) { double xx; get_ix_double(xp, &xx); - *ip = (unsigned longlong) xx; + *ip = (unsigned long long) xx; if(xx > ULONG_LONG_MAX || xx < 0) return NC_ERANGE; return ENOERR; diff --git a/libsrc/putget.c b/libsrc/putget.c index d1430b2f3..da4de4d5d 100644 --- a/libsrc/putget.c +++ b/libsrc/putget.c @@ -1,4 +1,4 @@ -#line 9 "../../libsrc/putget.m4" +#line 9 "putget.m4" /* Do not edit this file. It is produced from the corresponding .m4 source */ #line 11 /* diff --git a/libsrc5/CMakeLists.txt b/libsrc5/CMakeLists.txt deleted file mode 100644 index 5859425aa..000000000 --- a/libsrc5/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -SET(libsrc5_SOURCES nc5dispatch.c) - -add_library(netcdf5 OBJECT ${libsrc5_SOURCES}) - -ADD_EXTRA_DIST(${libsrc5_SOURCES} CMakeLists.txt) diff --git a/libsrcp/CMakeLists.txt b/libsrcp/CMakeLists.txt new file mode 100644 index 000000000..7d8ab9cf3 --- /dev/null +++ b/libsrcp/CMakeLists.txt @@ -0,0 +1,5 @@ +SET(libsrcp_SOURCES ncpdispatch.c) + +add_library(netcdfp OBJECT ${libsrcp_SOURCES}) + +ADD_EXTRA_DIST(${libsrcp_SOURCES} CMakeLists.txt) diff --git a/libsrc5/Makefile.am b/libsrcp/Makefile.am similarity index 78% rename from libsrc5/Makefile.am rename to libsrcp/Makefile.am index 8ba7431f8..9e59f0c3e 100644 --- a/libsrc5/Makefile.am +++ b/libsrcp/Makefile.am @@ -6,19 +6,19 @@ include $(top_srcdir)/lib_flags.am -libnetcdf5_la_CPPFLAGS = ${AM_CPPFLAGS} +libnetcdfp_la_CPPFLAGS = ${AM_CPPFLAGS} # This is the code for a dispatch table for pnetcdf # (which has CDF5 as its magic number) # Turn on a pre-processor flag when building a DLL for windows. if BUILD_DLL -libnetcdf5_la_CPPFLAGS += -DDLL_EXPORT +libnetcdfp_la_CPPFLAGS += -DDLL_EXPORT endif # BUILD_DLL # These files comprise the pnetcdf dispatch library code. -libnetcdf5_la_SOURCES = nc5dispatch.c +libnetcdfp_la_SOURCES = ncpdispatch.c -noinst_LTLIBRARIES = libnetcdf5.la +noinst_LTLIBRARIES = libnetcdfp.la EXTRA_DIST = CMakeLists.txt diff --git a/libsrc5/nc5dispatch.c b/libsrcp/ncpdispatch.c similarity index 76% rename from libsrc5/nc5dispatch.c rename to libsrcp/ncpdispatch.c index cba9cbe9d..c3a9494b8 100644 --- a/libsrc5/nc5dispatch.c +++ b/libsrcp/ncpdispatch.c @@ -1,6 +1,6 @@ /********************************************************************* * Copyright 1993, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. - * $Header: /upc/share/CVS/netcdf-3/libsrc4/NC5dispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $ + * $Header: /upc/share/CVS/netcdf-3/libsrc4/NCPdispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $ *********************************************************************/ /* WARNING: Order of mpi.h, nc.h, and pnetcdf.h is important */ @@ -12,7 +12,7 @@ /* Must follow netcdf.h */ #include -typedef struct NC5_INFO +typedef struct NCP_INFO { /* pnetcdf_file will be true if the file is created/opened with the * parallel-netcdf library. pnetcdf_access_mode keeps track of @@ -23,11 +23,11 @@ typedef struct NC5_INFO * to find out the number of dims, because these are collective in * pnetcdf.) */ int pnetcdf_access_mode; -} NC5_INFO; +} NCP_INFO; /* Define accessors for the dispatchdata */ -#define NC5_DATA(nc) ((NC5_INFO*)(nc)->dispatchdata) -#define NC5_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data)) +#define NCP_DATA(nc) ((NCP_INFO*)(nc)->dispatchdata) +#define NCP_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data)) #define LEGAL_CREATE_FLAGS (NC_NOCLOBBER | NC_64BIT_OFFSET | NC_CLASSIC_MODEL | NC_SHARE | NC_MPIIO | NC_MPIPOSIX | NC_LOCK | NC_PNETCDF) @@ -37,13 +37,13 @@ typedef struct NC5_INFO /**************************************************/ static int -NC5_create(const char *path, int cmode, +NCP_create(const char *path, int cmode, size_t initialsz, int basepe, size_t *chunksizehintp, int use_parallel, void* mpidata, struct NC_Dispatch* table, NC* nc) { int res; - NC5_INFO* nc5; + NCP_INFO* ncp; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; @@ -62,12 +62,12 @@ NC5_create(const char *path, int cmode, comm = ((NC_MPI_INFO *)mpidata)->comm; info = ((NC_MPI_INFO *)mpidata)->info; - /* Create our specific NC5_INFO instance */ - nc5 = (NC5_INFO*)calloc(1,sizeof(NC5_INFO)); - if(nc5 == NULL) return NC_ENOMEM; + /* Create our specific NCP_INFO instance */ + ncp = (NCP_INFO*)calloc(1,sizeof(NCP_INFO)); + if(ncp == NULL) return NC_ENOMEM; - /* Link nc5 and nc */ - NC5_DATA_SET(nc,nc5); + /* Link ncp and nc */ + NCP_DATA_SET(nc,ncp); /* Fix up the cmode by keeping only essential flags; these are the flags that are the same in netcf.h and pnetcdf.h @@ -90,18 +90,18 @@ NC5_create(const char *path, int cmode, cmode |= (NC_NETCDF4); res = ncmpi_create(comm, path, cmode, info, &(nc->int_ncid)); - if(res && nc5 != NULL) free(nc5); /* reclaim allocated space */ + if(res && ncp != NULL) free(ncp); /* reclaim allocated space */ return res; } static int -NC5_open(const char *path, int cmode, +NCP_open(const char *path, int cmode, int basepe, size_t *chunksizehintp, int use_parallel, void* mpidata, struct NC_Dispatch* table, NC* nc) { int res; - NC5_INFO* nc5; + NCP_INFO* ncp; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; @@ -130,28 +130,28 @@ NC5_open(const char *path, int cmode, */ cmode &= (NC_WRITE | NC_NOCLOBBER | NC_LOCK | NC_SHARE | NC_64BIT_OFFSET); - cmode |= (NC_NETCDF4); /* see comment in NC5_create */ + cmode |= (NC_NETCDF4); /* see comment in NCP_create */ - /* Create our specific NC5_INFO instance */ - nc5 = (NC5_INFO*)calloc(1,sizeof(NC5_INFO)); - if(nc5 == NULL) return NC_ENOMEM; + /* Create our specific NCP_INFO instance */ + ncp = (NCP_INFO*)calloc(1,sizeof(NCP_INFO)); + if(ncp == NULL) return NC_ENOMEM; - /* Link nc5 and nc */ - NC5_DATA_SET(nc,nc5); + /* Link ncp and nc */ + NCP_DATA_SET(nc,ncp); res = ncmpi_open(comm, path, cmode, info, &(nc->int_ncid)); /* Default to independent access, like netCDF-4/HDF5 files. */ if(!res) { res = ncmpi_begin_indep_data(nc->int_ncid); - nc5->pnetcdf_access_mode = NC_INDEPENDENT; + ncp->pnetcdf_access_mode = NC_INDEPENDENT; } return res; } static int -NC5_redef(int ncid) +NCP_redef(int ncid) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -160,35 +160,35 @@ NC5_redef(int ncid) } static int -NC5_enddef(int ncid) +NCP_enddef(int ncid) { int status; NC* nc; - NC5_INFO* nc5; + NCP_INFO* ncp; status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - nc5 = NC5_DATA(nc); - assert(nc5); + ncp = NCP_DATA(nc); + assert(ncp); status = ncmpi_enddef(nc->int_ncid); if(!status) { - if (nc5->pnetcdf_access_mode == NC_INDEPENDENT) + if (ncp->pnetcdf_access_mode == NC_INDEPENDENT) status = ncmpi_begin_indep_data(nc->int_ncid); } return status; } static int -NC5__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align) +NCP__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align) { - return NC5_enddef(ncid); + return NCP_enddef(ncid); } static int -NC5_sync(int ncid) +NCP_sync(int ncid) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -197,40 +197,40 @@ NC5_sync(int ncid) } static int -NC5_abort(int ncid) +NCP_abort(int ncid) { NC* nc; - NC5_INFO* nc5; + NCP_INFO* ncp; int status = NC_check_id(ncid, &nc); if(status != NC_NOERR) goto done; status = ncmpi_abort(nc->int_ncid); done: - nc5 = NC5_DATA(nc); - if(nc5 != NULL) free(nc5); /* reclaim allocated space */ + ncp = NCP_DATA(nc); + if(ncp != NULL) free(ncp); /* reclaim allocated space */ return status; } static int -NC5_close(int ncid) +NCP_close(int ncid) { NC* nc; - NC5_INFO* nc5; + NCP_INFO* ncp; int status = NC_check_id(ncid, &nc); if(status != NC_NOERR) goto done; status = ncmpi_close(nc->int_ncid); done: - nc5 = NC5_DATA(nc); - if(nc5 != NULL) free(nc5); /* reclaim allocated space */ + ncp = NCP_DATA(nc); + if(ncp != NULL) free(ncp); /* reclaim allocated space */ return status; } static int -NC5_set_fill(int ncid, int fillmode, int *old_mode_ptr) +NCP_set_fill(int ncid, int fillmode, int *old_mode_ptr) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -239,20 +239,20 @@ NC5_set_fill(int ncid, int fillmode, int *old_mode_ptr) } static int -NC5_inq_base_pe(int ncid, int* pep) +NCP_inq_base_pe(int ncid, int* pep) { if(pep) *pep = 0; return NC_NOERR; } static int -NC5_set_base_pe(int ncid, int pe) +NCP_set_base_pe(int ncid, int pe) { return NC_NOERR; } static int -NC5_inq_format(int ncid, int* formatp) +NCP_inq_format(int ncid, int* formatp) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -261,7 +261,7 @@ NC5_inq_format(int ncid, int* formatp) } static int -NC5_inq_format_extended(int ncid, int* formatp, int *modep) +NCP_inq_format_extended(int ncid, int* formatp, int *modep) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -272,7 +272,7 @@ NC5_inq_format_extended(int ncid, int* formatp, int *modep) } static int -NC5_inq(int ncid, +NCP_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, @@ -294,7 +294,7 @@ atomic_name[6][NC_MAX_NAME + 1] = { }; static int -NC5_inq_type(int ncid, nc_type typeid, char* name, size_t* size) +NCP_inq_type(int ncid, nc_type typeid, char* name, size_t* size) { if(typeid < NC_BYTE || typeid > NC_DOUBLE) return NC_EBADTYPE; @@ -310,24 +310,24 @@ NC5_inq_type(int ncid, nc_type typeid, char* name, size_t* size) } static int -NC5_def_dim(int ncid, const char* name, size_t len, int* idp) +NCP_def_dim(int ncid, const char* name, size_t len, int* idp) { int status; - NC5_INFO* nc5; + NCP_INFO* ncp; NC* nc; status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - nc5 = NC5_DATA(nc); - assert(nc5); + ncp = NCP_DATA(nc); + assert(ncp); return ncmpi_def_dim(nc->int_ncid, name, len, idp); } static int -NC5_inq_dimid(int ncid, const char *name, int *idp) +NCP_inq_dimid(int ncid, const char *name, int *idp) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -336,7 +336,7 @@ NC5_inq_dimid(int ncid, const char *name, int *idp) } static int -NC5_inq_dim(int ncid, int dimid, char *name, size_t* lenp) +NCP_inq_dim(int ncid, int dimid, char *name, size_t* lenp) { int status; NC* nc; @@ -349,7 +349,7 @@ NC5_inq_dim(int ncid, int dimid, char *name, size_t* lenp) } static int -NC5_inq_unlimdim(int ncid, int *unlimdimidp) +NCP_inq_unlimdim(int ncid, int *unlimdimidp) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -358,7 +358,7 @@ NC5_inq_unlimdim(int ncid, int *unlimdimidp) } static int -NC5_rename_dim(int ncid, int dimid, const char* newname) +NCP_rename_dim(int ncid, int dimid, const char* newname) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -367,7 +367,7 @@ NC5_rename_dim(int ncid, int dimid, const char* newname) } static int -NC5_inq_att(int ncid, int varid, const char* name, nc_type* xtypep, size_t* lenp) +NCP_inq_att(int ncid, int varid, const char* name, nc_type* xtypep, size_t* lenp) { NC* nc; MPI_Offset mpilen; @@ -379,7 +379,7 @@ NC5_inq_att(int ncid, int varid, const char* name, nc_type* xtypep, size_t* lenp } static int -NC5_inq_attid(int ncid, int varid, const char *name, int *idp) +NCP_inq_attid(int ncid, int varid, const char *name, int *idp) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -388,7 +388,7 @@ NC5_inq_attid(int ncid, int varid, const char *name, int *idp) } static int -NC5_inq_attname(int ncid, int varid, int attnum, char *name) +NCP_inq_attname(int ncid, int varid, int attnum, char *name) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -398,7 +398,7 @@ NC5_inq_attname(int ncid, int varid, int attnum, char *name) } static int -NC5_rename_att(int ncid, int varid, const char *name, +NCP_rename_att(int ncid, int varid, const char *name, const char *newname) { NC* nc; @@ -408,7 +408,7 @@ NC5_rename_att(int ncid, int varid, const char *name, } static int -NC5_del_att(int ncid, int varid, const char *name) +NCP_del_att(int ncid, int varid, const char *name) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -417,7 +417,7 @@ NC5_del_att(int ncid, int varid, const char *name) } int -NC5_get_att( +NCP_get_att( int ncid, int varid, const char *name, @@ -431,7 +431,7 @@ NC5_get_att( status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - status = NC5_inq_att(ncid,varid,name,&xtype,NULL); + status = NCP_inq_att(ncid,varid,name,&xtype,NULL); if(memtype == NC_NAT) memtype = xtype; @@ -459,7 +459,7 @@ NC5_get_att( } int -NC5_put_att( +NCP_put_att( int ncid, int varid, const char *name, @@ -509,24 +509,24 @@ NC5_put_att( } static int -NC5_def_var(int ncid, const char *name, nc_type xtype, +NCP_def_var(int ncid, const char *name, nc_type xtype, int ndims, const int *dimidsp, int *varidp) { NC* nc; - NC5_INFO* nc5; + NCP_INFO* ncp; int status; status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - nc5 = NC5_DATA(nc); - assert(nc5); + ncp = NCP_DATA(nc); + assert(ncp); status = ncmpi_def_var(nc->int_ncid,name,xtype,ndims,dimidsp,varidp); return status; } static int -NC5_inq_varid(int ncid, const char *name, int *varidp) +NCP_inq_varid(int ncid, const char *name, int *varidp) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -535,7 +535,7 @@ NC5_inq_varid(int ncid, const char *name, int *varidp) } static int -NC5_rename_var(int ncid, int varid, const char *name) +NCP_rename_var(int ncid, int varid, const char *name) { NC* nc; int status = NC_check_id(ncid, &nc); @@ -544,7 +544,7 @@ NC5_rename_var(int ncid, int varid, const char *name) } static int -NC5_get_vara(int ncid, +NCP_get_vara(int ncid, int varid, const size_t* startp, const size_t* countp, @@ -552,7 +552,7 @@ NC5_get_vara(int ncid, nc_type memtype) { NC* nc; - NC5_INFO* nc5; + NCP_INFO* ncp; int status; MPI_Offset mpi_start[NC_MAX_VAR_DIMS], mpi_count[NC_MAX_VAR_DIMS]; int d; @@ -561,8 +561,8 @@ NC5_get_vara(int ncid, status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - nc5 = NC5_DATA(nc); - assert(nc5); + ncp = NCP_DATA(nc); + assert(ncp); /* get variable's rank */ status= ncmpi_inq_varndims(nc->int_ncid, varid, &rank); @@ -574,7 +574,7 @@ NC5_get_vara(int ncid, mpi_count[d] = countp[d]; } - if(nc5->pnetcdf_access_mode == NC_INDEPENDENT) { + if(ncp->pnetcdf_access_mode == NC_INDEPENDENT) { switch(memtype) { case NC_BYTE: status=ncmpi_get_vara_schar(nc->int_ncid, varid, mpi_start, mpi_count, ip); break; @@ -621,7 +621,7 @@ NC5_get_vara(int ncid, } static int -NC5_put_vara(int ncid, +NCP_put_vara(int ncid, int varid, const size_t* startp, const size_t* countp, @@ -629,7 +629,7 @@ NC5_put_vara(int ncid, nc_type memtype) { NC* nc; - NC5_INFO* nc5; + NCP_INFO* ncp; int status; MPI_Offset mpi_start[NC_MAX_VAR_DIMS], mpi_count[NC_MAX_VAR_DIMS]; int d; @@ -638,8 +638,8 @@ NC5_put_vara(int ncid, status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - nc5 = NC5_DATA(nc); - assert(nc5); + ncp = NCP_DATA(nc); + assert(ncp); /* get variable's rank */ status = ncmpi_inq_varndims(nc->int_ncid, varid, &rank); @@ -651,7 +651,7 @@ NC5_put_vara(int ncid, mpi_count[d] = countp[d]; } - if(nc5->pnetcdf_access_mode == NC_INDEPENDENT) { + if(ncp->pnetcdf_access_mode == NC_INDEPENDENT) { switch(memtype) { case NC_BYTE: status = ncmpi_put_vara_schar(nc->int_ncid, varid, mpi_start, mpi_count, ip); break; @@ -698,7 +698,7 @@ NC5_put_vara(int ncid, } static int -NC5_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, +NCP_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp, int *shufflep, int *deflatep, int *deflate_levelp, int *fletcher32p, int *contiguousp, size_t *chunksizesp, @@ -724,10 +724,10 @@ NC5_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, } static int -NC5_var_par_access(int ncid, int varid, int par_access) +NCP_var_par_access(int ncid, int varid, int par_access) { NC *nc; - NC5_INFO* nc5; + NCP_INFO* ncp; int status; if (par_access != NC_INDEPENDENT && par_access != NC_COLLECTIVE) @@ -736,12 +736,12 @@ NC5_var_par_access(int ncid, int varid, int par_access) status = NC_check_id(ncid, &nc); if(status != NC_NOERR) return status; - nc5 = NC5_DATA(nc); - assert(nc5); + ncp = NCP_DATA(nc); + assert(ncp); - if(par_access == nc5->pnetcdf_access_mode) + if(par_access == ncp->pnetcdf_access_mode) return NC_NOERR; - nc5->pnetcdf_access_mode = par_access; + ncp->pnetcdf_access_mode = par_access; if (par_access == NC_INDEPENDENT) return ncmpi_begin_indep_data(nc->int_ncid); else @@ -751,18 +751,18 @@ NC5_var_par_access(int ncid, int varid, int par_access) #ifdef USE_NETCDF4 static int -NC5_show_metadata(int ncid) +NCP_show_metadata(int ncid) { return NC_NOERR; } static int -NC5_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp) +NCP_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp) { int retval; int unlimid; - if((retval = NC5_inq_unlimdim(ncid, &unlimid))) + if((retval = NCP_inq_unlimdim(ncid, &unlimid))) return retval; if(unlimid != -1) { if(ndimsp) *ndimsp = 1; @@ -774,7 +774,7 @@ NC5_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp) } static int -NC5_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int* equalp) +NCP_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int* equalp) { /* Check input. */ if(equalp == NULL) return NC_NOERR; @@ -805,26 +805,26 @@ NC5_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int* } static int -NC5_def_grp(int parent_ncid, const char *name, int *new_ncid) +NCP_def_grp(int parent_ncid, const char *name, int *new_ncid) { return NC_ENOTNC4; } static int -NC5_rename_grp(int ncid, const char *name) +NCP_rename_grp(int ncid, const char *name) { return NC_ENOTNC4; } static int -NC5_inq_ncid(int ncid, const char *name, int *grp_ncid) +NCP_inq_ncid(int ncid, const char *name, int *grp_ncid) { if(grp_ncid) *grp_ncid = ncid; return NC_NOERR; } static int -NC5_inq_grps(int ncid, int *numgrps, int *ncids) +NCP_inq_grps(int ncid, int *numgrps, int *ncids) { if(numgrps) *numgrps = 0; @@ -832,7 +832,7 @@ NC5_inq_grps(int ncid, int *numgrps, int *ncids) } static int -NC5_inq_grpname(int ncid, char *name) +NCP_inq_grpname(int ncid, char *name) { if(name) strcpy(name, "/"); @@ -840,7 +840,7 @@ NC5_inq_grpname(int ncid, char *name) } static int -NC5_inq_grpname_full(int ncid, size_t *lenp, char *full_name) +NCP_inq_grpname_full(int ncid, size_t *lenp, char *full_name) { if(full_name) strcpy(full_name, "/"); @@ -849,24 +849,24 @@ NC5_inq_grpname_full(int ncid, size_t *lenp, char *full_name) } static int -NC5_inq_grp_parent(int ncid, int *parent_ncid) +NCP_inq_grp_parent(int ncid, int *parent_ncid) { return NC_ENOGRP; } static int -NC5_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) +NCP_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid) { return NC_ENOGRP; } static int -NC5_inq_varids(int ncid, int *nvarsp, int *varids) +NCP_inq_varids(int ncid, int *nvarsp, int *varids) { int retval,v,nvars; /* This is, effectively, a netcdf-3 file, there is only one group, the root group, and its vars have ids 0 thru nvars - 1. */ - if((retval = NC5_inq(ncid, NULL, &nvars, NULL, NULL))) + if((retval = NCP_inq(ncid, NULL, &nvars, NULL, NULL))) return retval; if(nvarsp) *nvarsp = nvars; if(varids) @@ -876,12 +876,12 @@ NC5_inq_varids(int ncid, int *nvarsp, int *varids) } static int -NC5_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents) +NCP_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents) { int retval,d,ndims; /* If this is like a netcdf-3 file, then the dimids are going to be 0 thru ndims-1, so just provide them. */ - if((retval = NC5_inq(ncid, &ndims, NULL, NULL, NULL))) + if((retval = NCP_inq(ncid, &ndims, NULL, NULL, NULL))) return retval; if(ndimsp) *ndimsp = ndims; if(dimids) @@ -891,7 +891,7 @@ NC5_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents) } static int -NC5_inq_typeid(int ncid, const char *name, nc_type *typeidp) +NCP_inq_typeid(int ncid, const char *name, nc_type *typeidp) { int i; for (i = 0; i <= ATOMICTYPEMAX; i++) @@ -903,34 +903,34 @@ NC5_inq_typeid(int ncid, const char *name, nc_type *typeidp) } static int -NC5_inq_typeids(int ncid, int *ntypes, int *typeids) +NCP_inq_typeids(int ncid, int *ntypes, int *typeids) { if(ntypes) *ntypes = 0; return NC_NOERR; } static int -NC5_inq_user_type(int ncid, nc_type typeid, char *name, size_t *size, +NCP_inq_user_type(int ncid, nc_type typeid, char *name, size_t *size, nc_type *base_nc_typep, size_t *nfieldsp, int *classp) { return NC_ENOTNC4; } static int -NC5_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp) +NCP_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp) { return NC_ENOTNC4; } static int -NC5_insert_compound(int ncid, nc_type typeid, const char *name, size_t offset, +NCP_insert_compound(int ncid, nc_type typeid, const char *name, size_t offset, nc_type field_typeid) { return NC_ENOTNC4; } static int -NC5_insert_array_compound(int ncid, nc_type typeid, const char *name, +NCP_insert_array_compound(int ncid, nc_type typeid, const char *name, size_t offset, nc_type field_typeid, int ndims, const int *dim_sizes) { @@ -939,7 +939,7 @@ NC5_insert_array_compound(int ncid, nc_type typeid, const char *name, static int -NC5_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name, +NCP_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name, size_t *offsetp, nc_type *field_typeidp, int *ndimsp, int *dim_sizesp) { @@ -947,103 +947,103 @@ NC5_inq_compound_field(int ncid, nc_type typeid, int fieldid, char *name, } static int -NC5_inq_compound_fieldindex(int ncid, nc_type typeid, const char *name, int *fieldidp) +NCP_inq_compound_fieldindex(int ncid, nc_type typeid, const char *name, int *fieldidp) { return NC_ENOTNC4; } static int -NC5_def_opaque(int ncid, size_t datum_size, const char *name, nc_type* xtypep) +NCP_def_opaque(int ncid, size_t datum_size, const char *name, nc_type* xtypep) { return NC_ENOTNC4; } static int -NC5_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type* xtypep) +NCP_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type* xtypep) { return NC_ENOTNC4; } static int -NC5_def_enum(int ncid, nc_type base_typeid, const char *name, +NCP_def_enum(int ncid, nc_type base_typeid, const char *name, nc_type *typeidp) { return NC_ENOTNC4; } static int -NC5_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier) +NCP_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier) { return NC_ENOTNC4; } static int -NC5_inq_enum_member(int ncid, nc_type typeid, int idx, char *identifier, +NCP_inq_enum_member(int ncid, nc_type typeid, int idx, char *identifier, void *value) { return NC_ENOTNC4; } static int -NC5_insert_enum(int ncid, nc_type typeid, const char *identifier, +NCP_insert_enum(int ncid, nc_type typeid, const char *identifier, const void *value) { return NC_ENOTNC4; } static int -NC5_put_vlen_element(int ncid, int typeid, void *vlen_element, +NCP_put_vlen_element(int ncid, int typeid, void *vlen_element, size_t len, const void *data) { return NC_ENOTNC4; } static int -NC5_get_vlen_element(int ncid, int typeid, const void *vlen_element, +NCP_get_vlen_element(int ncid, int typeid, const void *vlen_element, size_t *len, void *data) { return NC_ENOTNC4; } static int -NC5_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption) +NCP_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption) { return NC_ENOTNC4; } static int -NC5_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp) +NCP_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp) { return NC_ENOTNC4; } static int -NC5_def_var_deflate(int ncid, int varid, int shuffle, int deflate, +NCP_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level) { return NC_ENOTNC4; } static int -NC5_def_var_fletcher32(int ncid, int varid, int fletcher32) +NCP_def_var_fletcher32(int ncid, int varid, int fletcher32) { return NC_ENOTNC4; } static int -NC5_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp) +NCP_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp) { return NC_ENOTNC4; } static int -NC5_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) +NCP_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) { return NC_ENOTNC4; } static int -NC5_def_var_endian(int ncid, int varid, int endianness) +NCP_def_var_endian(int ncid, int varid, int endianness) { return NC_ENOTNC4; } @@ -1053,103 +1053,103 @@ NC5_def_var_endian(int ncid, int varid, int endianness) /**************************************************/ /* Pnetcdf Dispatch table */ -NC_Dispatch NC5_dispatcher = { +NC_Dispatch NCP_dispatcher = { -NC_DISPATCH_NC5, +NC_DISPATCH_NCP, -NC5_create, -NC5_open, +NCP_create, +NCP_open, -NC5_redef, -NC5__enddef, -NC5_sync, -NC5_abort, -NC5_close, -NC5_set_fill, -NC5_inq_base_pe, -NC5_set_base_pe, -NC5_inq_format, -NC5_inq_format_extended, +NCP_redef, +NCP__enddef, +NCP_sync, +NCP_abort, +NCP_close, +NCP_set_fill, +NCP_inq_base_pe, +NCP_set_base_pe, +NCP_inq_format, +NCP_inq_format_extended, -NC5_inq, -NC5_inq_type, +NCP_inq, +NCP_inq_type, -NC5_def_dim, -NC5_inq_dimid, -NC5_inq_dim, -NC5_inq_unlimdim, -NC5_rename_dim, +NCP_def_dim, +NCP_inq_dimid, +NCP_inq_dim, +NCP_inq_unlimdim, +NCP_rename_dim, -NC5_inq_att, -NC5_inq_attid, -NC5_inq_attname, -NC5_rename_att, -NC5_del_att, -NC5_get_att, -NC5_put_att, +NCP_inq_att, +NCP_inq_attid, +NCP_inq_attname, +NCP_rename_att, +NCP_del_att, +NCP_get_att, +NCP_put_att, -NC5_def_var, -NC5_inq_varid, -NC5_rename_var, -NC5_get_vara, -NC5_put_vara, +NCP_def_var, +NCP_inq_varid, +NCP_rename_var, +NCP_get_vara, +NCP_put_vara, NCDEFAULT_get_vars, NCDEFAULT_put_vars, NCDEFAULT_get_varm, NCDEFAULT_put_varm, -NC5_inq_var_all, +NCP_inq_var_all, -NC5_var_par_access, +NCP_var_par_access, #ifdef USE_NETCDF4 -NC5_show_metadata, -NC5_inq_unlimdims, +NCP_show_metadata, +NCP_inq_unlimdims, -NC5_inq_ncid, -NC5_inq_grps, -NC5_inq_grpname, -NC5_inq_grpname_full, -NC5_inq_grp_parent, -NC5_inq_grp_full_ncid, -NC5_inq_varids, -NC5_inq_dimids, -NC5_inq_typeids, -NC5_inq_type_equal, -NC5_def_grp, -NC5_rename_grp, -NC5_inq_user_type, -NC5_inq_typeid, +NCP_inq_ncid, +NCP_inq_grps, +NCP_inq_grpname, +NCP_inq_grpname_full, +NCP_inq_grp_parent, +NCP_inq_grp_full_ncid, +NCP_inq_varids, +NCP_inq_dimids, +NCP_inq_typeids, +NCP_inq_type_equal, +NCP_def_grp, +NCP_rename_grp, +NCP_inq_user_type, +NCP_inq_typeid, -NC5_def_compound, -NC5_insert_compound, -NC5_insert_array_compound, -NC5_inq_compound_field, -NC5_inq_compound_fieldindex, -NC5_def_vlen, -NC5_put_vlen_element, -NC5_get_vlen_element, -NC5_def_enum, -NC5_insert_enum, -NC5_inq_enum_member, -NC5_inq_enum_ident, -NC5_def_opaque, -NC5_def_var_deflate, -NC5_def_var_fletcher32, -NC5_def_var_chunking, -NC5_def_var_fill, -NC5_def_var_endian, -NC5_set_var_chunk_cache, -NC5_get_var_chunk_cache, +NCP_def_compound, +NCP_insert_compound, +NCP_insert_array_compound, +NCP_inq_compound_field, +NCP_inq_compound_fieldindex, +NCP_def_vlen, +NCP_put_vlen_element, +NCP_get_vlen_element, +NCP_def_enum, +NCP_insert_enum, +NCP_inq_enum_member, +NCP_inq_enum_ident, +NCP_def_opaque, +NCP_def_var_deflate, +NCP_def_var_fletcher32, +NCP_def_var_chunking, +NCP_def_var_fill, +NCP_def_var_endian, +NCP_set_var_chunk_cache, +NCP_get_var_chunk_cache, #endif /*USE_NETCDF4*/ }; -NC_Dispatch* NC5_dispatch_table = NULL; /* moved here from ddispatch.c */ +NC_Dispatch* NCP_dispatch_table = NULL; /* moved here from ddispatch.c */ int -NC5_initialize(void) +NCP_initialize(void) { - NC5_dispatch_table = &NC5_dispatcher; + NCP_dispatch_table = &NCP_dispatcher; return NC_NOERR; } diff --git a/nc_test/test_get.c b/nc_test/test_get.c index d22a990bb..039543888 100644 --- a/nc_test/test_get.c +++ b/nc_test/test_get.c @@ -1,6227 +1,12388 @@ +#line 5 "test_get.m4" /* Do not edit this file. It is produced from the corresponding .m4 source */ +#line 7 /********************************************************************* * Copyright 1996, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. * $Id: test_get.m4,v 1.16 2005/03/08 03:04:19 ed Exp $ *********************************************************************/ +#line 31 #include "tests.h" +#line 116 void +#line 117 test_nc_get_var1_text(void) +#line 117 { +#line 117 int ncid; +#line 117 int i; +#line 117 int j; +#line 117 int err; +#line 117 int nok = 0; /* count of valid comparisons */ +#line 117 size_t index[MAX_RANK]; +#line 117 double expect; +#line 117 int canConvert; /* Both text or both numeric */ +#line 117 text value; +#line 117 +#line 117 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 117 IF (err) +#line 117 error("nc_open: %s", nc_strerror(err)); +#line 117 for (i = 0; i < NVARS; i++) { +#line 117 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 117 for (j = 0; j < var_rank[i]; j++) +#line 117 index[j] = 0; +#line 117 err = nc_get_var1_text(BAD_ID, i, index, &value); +#line 117 IF (err != NC_EBADID) +#line 117 error("bad ncid: status = %d", err); +#line 117 err = nc_get_var1_text(ncid, BAD_VARID, index, &value); +#line 117 IF (err != NC_ENOTVAR) +#line 117 error("bad var id: status = %d", err); +#line 117 for (j = 0; j < var_rank[i]; j++) { +#line 117 index[j] = var_shape[i][j]; +#line 117 err = nc_get_var1_text(ncid, i, index, &value); +#line 117 if(!canConvert) { +#line 117 IF(err != NC_ECHAR) +#line 117 error("conversion: status = %d", err); +#line 117 } else IF (err != NC_EINVALCOORDS) +#line 117 error("bad index: status = %d", err); +#line 117 index[j] = 0; +#line 117 } +#line 117 for (j = 0; j < var_nels[i]; j++) { +#line 117 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 117 IF (err) +#line 117 error("error in toMixedBase 1"); +#line 117 expect = hash4( var_type[i], var_rank[i], index, NCT_TEXT ); +#line 117 if (var_rank[i] == 0 && i%2 ) +#line 117 err = nc_get_var1_text(ncid, i, NULL, &value); +#line 117 else +#line 117 err = nc_get_var1_text(ncid, i, index, &value); +#line 117 if (canConvert) { +#line 117 if (inRange3(expect,var_type[i], NCT_TEXT)) { +#line 117 if (expect >= text_min && expect <= text_max) { +#line 117 IF (err) { +#line 117 error("%s", nc_strerror(err)); +#line 117 } else { +#line 117 IF (!equal(value,expect,var_type[i],NCT_TEXT)) { +#line 117 error("expected: %G, got: %G", expect, +#line 117 (double) value); +#line 117 } else { +#line 117 nok++; +#line 117 } +#line 117 } +#line 117 } else { +#line 117 IF (err != NC_ERANGE) +#line 117 error("Range error: status = %d", err); +#line 117 } +#line 117 } else { +#line 117 IF (err != 0 && err != NC_ERANGE) +#line 117 error("OK or Range error: status = %d", err); +#line 117 } +#line 117 } else { +#line 117 IF (err != NC_ECHAR) +#line 117 error("wrong type: status = %d", err); +#line 117 } +#line 117 } +#line 117 } +#line 117 err = nc_close(ncid); +#line 117 IF (err) +#line 117 error("nc_close: %s", nc_strerror(err)); +#line 117 print_nok(nok); +#line 117 } +#line 117 void +#line 118 test_nc_get_var1_uchar(void) +#line 118 { +#line 118 int ncid; +#line 118 int i; +#line 118 int j; +#line 118 int err; +#line 118 int nok = 0; /* count of valid comparisons */ +#line 118 size_t index[MAX_RANK]; +#line 118 double expect; +#line 118 int canConvert; /* Both text or both numeric */ +#line 118 uchar value; +#line 118 +#line 118 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 118 IF (err) +#line 118 error("nc_open: %s", nc_strerror(err)); +#line 118 for (i = 0; i < NVARS; i++) { +#line 118 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 118 for (j = 0; j < var_rank[i]; j++) +#line 118 index[j] = 0; +#line 118 err = nc_get_var1_uchar(BAD_ID, i, index, &value); +#line 118 IF (err != NC_EBADID) +#line 118 error("bad ncid: status = %d", err); +#line 118 err = nc_get_var1_uchar(ncid, BAD_VARID, index, &value); +#line 118 IF (err != NC_ENOTVAR) +#line 118 error("bad var id: status = %d", err); +#line 118 for (j = 0; j < var_rank[i]; j++) { +#line 118 index[j] = var_shape[i][j]; +#line 118 err = nc_get_var1_uchar(ncid, i, index, &value); +#line 118 if(!canConvert) { +#line 118 IF(err != NC_ECHAR) +#line 118 error("conversion: status = %d", err); +#line 118 } else IF (err != NC_EINVALCOORDS) +#line 118 error("bad index: status = %d", err); +#line 118 index[j] = 0; +#line 118 } +#line 118 for (j = 0; j < var_nels[i]; j++) { +#line 118 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 118 IF (err) +#line 118 error("error in toMixedBase 1"); +#line 118 expect = hash4( var_type[i], var_rank[i], index, NCT_UCHAR ); +#line 118 if (var_rank[i] == 0 && i%2 ) +#line 118 err = nc_get_var1_uchar(ncid, i, NULL, &value); +#line 118 else +#line 118 err = nc_get_var1_uchar(ncid, i, index, &value); +#line 118 if (canConvert) { +#line 118 if (inRange3(expect,var_type[i], NCT_UCHAR)) { +#line 118 if (expect >= uchar_min && expect <= uchar_max) { +#line 118 IF (err) { +#line 118 error("%s", nc_strerror(err)); +#line 118 } else { +#line 118 IF (!equal(value,expect,var_type[i],NCT_UCHAR)) { +#line 118 error("expected: %G, got: %G", expect, +#line 118 (double) value); +#line 118 } else { +#line 118 nok++; +#line 118 } +#line 118 } +#line 118 } else { +#line 118 IF (err != NC_ERANGE) +#line 118 error("Range error: status = %d", err); +#line 118 } +#line 118 } else { +#line 118 IF (err != 0 && err != NC_ERANGE) +#line 118 error("OK or Range error: status = %d", err); +#line 118 } +#line 118 } else { +#line 118 IF (err != NC_ECHAR) +#line 118 error("wrong type: status = %d", err); +#line 118 } +#line 118 } +#line 118 } +#line 118 err = nc_close(ncid); +#line 118 IF (err) +#line 118 error("nc_close: %s", nc_strerror(err)); +#line 118 print_nok(nok); +#line 118 } +#line 118 void +#line 119 test_nc_get_var1_schar(void) +#line 119 { +#line 119 int ncid; +#line 119 int i; +#line 119 int j; +#line 119 int err; +#line 119 int nok = 0; /* count of valid comparisons */ +#line 119 size_t index[MAX_RANK]; +#line 119 double expect; +#line 119 int canConvert; /* Both text or both numeric */ +#line 119 schar value; +#line 119 +#line 119 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 119 IF (err) +#line 119 error("nc_open: %s", nc_strerror(err)); +#line 119 for (i = 0; i < NVARS; i++) { +#line 119 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 119 for (j = 0; j < var_rank[i]; j++) +#line 119 index[j] = 0; +#line 119 err = nc_get_var1_schar(BAD_ID, i, index, &value); +#line 119 IF (err != NC_EBADID) +#line 119 error("bad ncid: status = %d", err); +#line 119 err = nc_get_var1_schar(ncid, BAD_VARID, index, &value); +#line 119 IF (err != NC_ENOTVAR) +#line 119 error("bad var id: status = %d", err); +#line 119 for (j = 0; j < var_rank[i]; j++) { +#line 119 index[j] = var_shape[i][j]; +#line 119 err = nc_get_var1_schar(ncid, i, index, &value); +#line 119 if(!canConvert) { +#line 119 IF(err != NC_ECHAR) +#line 119 error("conversion: status = %d", err); +#line 119 } else IF (err != NC_EINVALCOORDS) +#line 119 error("bad index: status = %d", err); +#line 119 index[j] = 0; +#line 119 } +#line 119 for (j = 0; j < var_nels[i]; j++) { +#line 119 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 119 IF (err) +#line 119 error("error in toMixedBase 1"); +#line 119 expect = hash4( var_type[i], var_rank[i], index, NCT_SCHAR ); +#line 119 if (var_rank[i] == 0 && i%2 ) +#line 119 err = nc_get_var1_schar(ncid, i, NULL, &value); +#line 119 else +#line 119 err = nc_get_var1_schar(ncid, i, index, &value); +#line 119 if (canConvert) { +#line 119 if (inRange3(expect,var_type[i], NCT_SCHAR)) { +#line 119 if (expect >= schar_min && expect <= schar_max) { +#line 119 IF (err) { +#line 119 error("%s", nc_strerror(err)); +#line 119 } else { +#line 119 IF (!equal(value,expect,var_type[i],NCT_SCHAR)) { +#line 119 error("expected: %G, got: %G", expect, +#line 119 (double) value); +#line 119 } else { +#line 119 nok++; +#line 119 } +#line 119 } +#line 119 } else { +#line 119 IF (err != NC_ERANGE) +#line 119 error("Range error: status = %d", err); +#line 119 } +#line 119 } else { +#line 119 IF (err != 0 && err != NC_ERANGE) +#line 119 error("OK or Range error: status = %d", err); +#line 119 } +#line 119 } else { +#line 119 IF (err != NC_ECHAR) +#line 119 error("wrong type: status = %d", err); +#line 119 } +#line 119 } +#line 119 } +#line 119 err = nc_close(ncid); +#line 119 IF (err) +#line 119 error("nc_close: %s", nc_strerror(err)); +#line 119 print_nok(nok); +#line 119 } +#line 119 void +#line 120 test_nc_get_var1_short(void) +#line 120 { +#line 120 int ncid; +#line 120 int i; +#line 120 int j; +#line 120 int err; +#line 120 int nok = 0; /* count of valid comparisons */ +#line 120 size_t index[MAX_RANK]; +#line 120 double expect; +#line 120 int canConvert; /* Both text or both numeric */ +#line 120 short value; +#line 120 +#line 120 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 120 IF (err) +#line 120 error("nc_open: %s", nc_strerror(err)); +#line 120 for (i = 0; i < NVARS; i++) { +#line 120 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 120 for (j = 0; j < var_rank[i]; j++) +#line 120 index[j] = 0; +#line 120 err = nc_get_var1_short(BAD_ID, i, index, &value); +#line 120 IF (err != NC_EBADID) +#line 120 error("bad ncid: status = %d", err); +#line 120 err = nc_get_var1_short(ncid, BAD_VARID, index, &value); +#line 120 IF (err != NC_ENOTVAR) +#line 120 error("bad var id: status = %d", err); +#line 120 for (j = 0; j < var_rank[i]; j++) { +#line 120 index[j] = var_shape[i][j]; +#line 120 err = nc_get_var1_short(ncid, i, index, &value); +#line 120 if(!canConvert) { +#line 120 IF(err != NC_ECHAR) +#line 120 error("conversion: status = %d", err); +#line 120 } else IF (err != NC_EINVALCOORDS) +#line 120 error("bad index: status = %d", err); +#line 120 index[j] = 0; +#line 120 } +#line 120 for (j = 0; j < var_nels[i]; j++) { +#line 120 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 120 IF (err) +#line 120 error("error in toMixedBase 1"); +#line 120 expect = hash4( var_type[i], var_rank[i], index, NCT_SHORT ); +#line 120 if (var_rank[i] == 0 && i%2 ) +#line 120 err = nc_get_var1_short(ncid, i, NULL, &value); +#line 120 else +#line 120 err = nc_get_var1_short(ncid, i, index, &value); +#line 120 if (canConvert) { +#line 120 if (inRange3(expect,var_type[i], NCT_SHORT)) { +#line 120 if (expect >= short_min && expect <= short_max) { +#line 120 IF (err) { +#line 120 error("%s", nc_strerror(err)); +#line 120 } else { +#line 120 IF (!equal(value,expect,var_type[i],NCT_SHORT)) { +#line 120 error("expected: %G, got: %G", expect, +#line 120 (double) value); +#line 120 } else { +#line 120 nok++; +#line 120 } +#line 120 } +#line 120 } else { +#line 120 IF (err != NC_ERANGE) +#line 120 error("Range error: status = %d", err); +#line 120 } +#line 120 } else { +#line 120 IF (err != 0 && err != NC_ERANGE) +#line 120 error("OK or Range error: status = %d", err); +#line 120 } +#line 120 } else { +#line 120 IF (err != NC_ECHAR) +#line 120 error("wrong type: status = %d", err); +#line 120 } +#line 120 } +#line 120 } +#line 120 err = nc_close(ncid); +#line 120 IF (err) +#line 120 error("nc_close: %s", nc_strerror(err)); +#line 120 print_nok(nok); +#line 120 } +#line 120 void +#line 121 test_nc_get_var1_int(void) +#line 121 { +#line 121 int ncid; +#line 121 int i; +#line 121 int j; +#line 121 int err; +#line 121 int nok = 0; /* count of valid comparisons */ +#line 121 size_t index[MAX_RANK]; +#line 121 double expect; +#line 121 int canConvert; /* Both text or both numeric */ +#line 121 int value; +#line 121 +#line 121 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 121 IF (err) +#line 121 error("nc_open: %s", nc_strerror(err)); +#line 121 for (i = 0; i < NVARS; i++) { +#line 121 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 121 for (j = 0; j < var_rank[i]; j++) +#line 121 index[j] = 0; +#line 121 err = nc_get_var1_int(BAD_ID, i, index, &value); +#line 121 IF (err != NC_EBADID) +#line 121 error("bad ncid: status = %d", err); +#line 121 err = nc_get_var1_int(ncid, BAD_VARID, index, &value); +#line 121 IF (err != NC_ENOTVAR) +#line 121 error("bad var id: status = %d", err); +#line 121 for (j = 0; j < var_rank[i]; j++) { +#line 121 index[j] = var_shape[i][j]; +#line 121 err = nc_get_var1_int(ncid, i, index, &value); +#line 121 if(!canConvert) { +#line 121 IF(err != NC_ECHAR) +#line 121 error("conversion: status = %d", err); +#line 121 } else IF (err != NC_EINVALCOORDS) +#line 121 error("bad index: status = %d", err); +#line 121 index[j] = 0; +#line 121 } +#line 121 for (j = 0; j < var_nels[i]; j++) { +#line 121 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 121 IF (err) +#line 121 error("error in toMixedBase 1"); +#line 121 expect = hash4( var_type[i], var_rank[i], index, NCT_INT ); +#line 121 if (var_rank[i] == 0 && i%2 ) +#line 121 err = nc_get_var1_int(ncid, i, NULL, &value); +#line 121 else +#line 121 err = nc_get_var1_int(ncid, i, index, &value); +#line 121 if (canConvert) { +#line 121 if (inRange3(expect,var_type[i], NCT_INT)) { +#line 121 if (expect >= int_min && expect <= int_max) { +#line 121 IF (err) { +#line 121 error("%s", nc_strerror(err)); +#line 121 } else { +#line 121 IF (!equal(value,expect,var_type[i],NCT_INT)) { +#line 121 error("expected: %G, got: %G", expect, +#line 121 (double) value); +#line 121 } else { +#line 121 nok++; +#line 121 } +#line 121 } +#line 121 } else { +#line 121 IF (err != NC_ERANGE) +#line 121 error("Range error: status = %d", err); +#line 121 } +#line 121 } else { +#line 121 IF (err != 0 && err != NC_ERANGE) +#line 121 error("OK or Range error: status = %d", err); +#line 121 } +#line 121 } else { +#line 121 IF (err != NC_ECHAR) +#line 121 error("wrong type: status = %d", err); +#line 121 } +#line 121 } +#line 121 } +#line 121 err = nc_close(ncid); +#line 121 IF (err) +#line 121 error("nc_close: %s", nc_strerror(err)); +#line 121 print_nok(nok); +#line 121 } +#line 121 void +#line 122 test_nc_get_var1_long(void) +#line 122 { +#line 122 int ncid; +#line 122 int i; +#line 122 int j; +#line 122 int err; +#line 122 int nok = 0; /* count of valid comparisons */ +#line 122 size_t index[MAX_RANK]; +#line 122 double expect; +#line 122 int canConvert; /* Both text or both numeric */ +#line 122 long value; +#line 122 +#line 122 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 122 IF (err) +#line 122 error("nc_open: %s", nc_strerror(err)); +#line 122 for (i = 0; i < NVARS; i++) { +#line 122 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 122 for (j = 0; j < var_rank[i]; j++) +#line 122 index[j] = 0; +#line 122 err = nc_get_var1_long(BAD_ID, i, index, &value); +#line 122 IF (err != NC_EBADID) +#line 122 error("bad ncid: status = %d", err); +#line 122 err = nc_get_var1_long(ncid, BAD_VARID, index, &value); +#line 122 IF (err != NC_ENOTVAR) +#line 122 error("bad var id: status = %d", err); +#line 122 for (j = 0; j < var_rank[i]; j++) { +#line 122 index[j] = var_shape[i][j]; +#line 122 err = nc_get_var1_long(ncid, i, index, &value); +#line 122 if(!canConvert) { +#line 122 IF(err != NC_ECHAR) +#line 122 error("conversion: status = %d", err); +#line 122 } else IF (err != NC_EINVALCOORDS) +#line 122 error("bad index: status = %d", err); +#line 122 index[j] = 0; +#line 122 } +#line 122 for (j = 0; j < var_nels[i]; j++) { +#line 122 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 122 IF (err) +#line 122 error("error in toMixedBase 1"); +#line 122 expect = hash4( var_type[i], var_rank[i], index, NCT_LONG ); +#line 122 if (var_rank[i] == 0 && i%2 ) +#line 122 err = nc_get_var1_long(ncid, i, NULL, &value); +#line 122 else +#line 122 err = nc_get_var1_long(ncid, i, index, &value); +#line 122 if (canConvert) { +#line 122 if (inRange3(expect,var_type[i], NCT_LONG)) { +#line 122 if (expect >= long_min && expect <= long_max) { +#line 122 IF (err) { +#line 122 error("%s", nc_strerror(err)); +#line 122 } else { +#line 122 IF (!equal(value,expect,var_type[i],NCT_LONG)) { +#line 122 error("expected: %G, got: %G", expect, +#line 122 (double) value); +#line 122 } else { +#line 122 nok++; +#line 122 } +#line 122 } +#line 122 } else { +#line 122 IF (err != NC_ERANGE) +#line 122 error("Range error: status = %d", err); +#line 122 } +#line 122 } else { +#line 122 IF (err != 0 && err != NC_ERANGE) +#line 122 error("OK or Range error: status = %d", err); +#line 122 } +#line 122 } else { +#line 122 IF (err != NC_ECHAR) +#line 122 error("wrong type: status = %d", err); +#line 122 } +#line 122 } +#line 122 } +#line 122 err = nc_close(ncid); +#line 122 IF (err) +#line 122 error("nc_close: %s", nc_strerror(err)); +#line 122 print_nok(nok); +#line 122 } +#line 122 void +#line 123 test_nc_get_var1_float(void) +#line 123 { +#line 123 int ncid; +#line 123 int i; +#line 123 int j; +#line 123 int err; +#line 123 int nok = 0; /* count of valid comparisons */ +#line 123 size_t index[MAX_RANK]; +#line 123 double expect; +#line 123 int canConvert; /* Both text or both numeric */ +#line 123 float value; +#line 123 +#line 123 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 123 IF (err) +#line 123 error("nc_open: %s", nc_strerror(err)); +#line 123 for (i = 0; i < NVARS; i++) { +#line 123 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 123 for (j = 0; j < var_rank[i]; j++) +#line 123 index[j] = 0; +#line 123 err = nc_get_var1_float(BAD_ID, i, index, &value); +#line 123 IF (err != NC_EBADID) +#line 123 error("bad ncid: status = %d", err); +#line 123 err = nc_get_var1_float(ncid, BAD_VARID, index, &value); +#line 123 IF (err != NC_ENOTVAR) +#line 123 error("bad var id: status = %d", err); +#line 123 for (j = 0; j < var_rank[i]; j++) { +#line 123 index[j] = var_shape[i][j]; +#line 123 err = nc_get_var1_float(ncid, i, index, &value); +#line 123 if(!canConvert) { +#line 123 IF(err != NC_ECHAR) +#line 123 error("conversion: status = %d", err); +#line 123 } else IF (err != NC_EINVALCOORDS) +#line 123 error("bad index: status = %d", err); +#line 123 index[j] = 0; +#line 123 } +#line 123 for (j = 0; j < var_nels[i]; j++) { +#line 123 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 123 IF (err) +#line 123 error("error in toMixedBase 1"); +#line 123 expect = hash4( var_type[i], var_rank[i], index, NCT_FLOAT ); +#line 123 if (var_rank[i] == 0 && i%2 ) +#line 123 err = nc_get_var1_float(ncid, i, NULL, &value); +#line 123 else +#line 123 err = nc_get_var1_float(ncid, i, index, &value); +#line 123 if (canConvert) { +#line 123 if (inRange3(expect,var_type[i], NCT_FLOAT)) { +#line 123 if (expect >= float_min && expect <= float_max) { +#line 123 IF (err) { +#line 123 error("%s", nc_strerror(err)); +#line 123 } else { +#line 123 IF (!equal(value,expect,var_type[i],NCT_FLOAT)) { +#line 123 error("expected: %G, got: %G", expect, +#line 123 (double) value); +#line 123 } else { +#line 123 nok++; +#line 123 } +#line 123 } +#line 123 } else { +#line 123 IF (err != NC_ERANGE) +#line 123 error("Range error: status = %d", err); +#line 123 } +#line 123 } else { +#line 123 IF (err != 0 && err != NC_ERANGE) +#line 123 error("OK or Range error: status = %d", err); +#line 123 } +#line 123 } else { +#line 123 IF (err != NC_ECHAR) +#line 123 error("wrong type: status = %d", err); +#line 123 } +#line 123 } +#line 123 } +#line 123 err = nc_close(ncid); +#line 123 IF (err) +#line 123 error("nc_close: %s", nc_strerror(err)); +#line 123 print_nok(nok); +#line 123 } +#line 123 void +#line 124 test_nc_get_var1_double(void) +#line 124 { +#line 124 int ncid; +#line 124 int i; +#line 124 int j; +#line 124 int err; +#line 124 int nok = 0; /* count of valid comparisons */ +#line 124 size_t index[MAX_RANK]; +#line 124 double expect; +#line 124 int canConvert; /* Both text or both numeric */ +#line 124 double value; +#line 124 +#line 124 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 124 IF (err) +#line 124 error("nc_open: %s", nc_strerror(err)); +#line 124 for (i = 0; i < NVARS; i++) { +#line 124 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 124 for (j = 0; j < var_rank[i]; j++) +#line 124 index[j] = 0; +#line 124 err = nc_get_var1_double(BAD_ID, i, index, &value); +#line 124 IF (err != NC_EBADID) +#line 124 error("bad ncid: status = %d", err); +#line 124 err = nc_get_var1_double(ncid, BAD_VARID, index, &value); +#line 124 IF (err != NC_ENOTVAR) +#line 124 error("bad var id: status = %d", err); +#line 124 for (j = 0; j < var_rank[i]; j++) { +#line 124 index[j] = var_shape[i][j]; +#line 124 err = nc_get_var1_double(ncid, i, index, &value); +#line 124 if(!canConvert) { +#line 124 IF(err != NC_ECHAR) +#line 124 error("conversion: status = %d", err); +#line 124 } else IF (err != NC_EINVALCOORDS) +#line 124 error("bad index: status = %d", err); +#line 124 index[j] = 0; +#line 124 } +#line 124 for (j = 0; j < var_nels[i]; j++) { +#line 124 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 124 IF (err) +#line 124 error("error in toMixedBase 1"); +#line 124 expect = hash4( var_type[i], var_rank[i], index, NCT_DOUBLE ); +#line 124 if (var_rank[i] == 0 && i%2 ) +#line 124 err = nc_get_var1_double(ncid, i, NULL, &value); +#line 124 else +#line 124 err = nc_get_var1_double(ncid, i, index, &value); +#line 124 if (canConvert) { +#line 124 if (inRange3(expect,var_type[i], NCT_DOUBLE)) { +#line 124 if (expect >= double_min && expect <= double_max) { +#line 124 IF (err) { +#line 124 error("%s", nc_strerror(err)); +#line 124 } else { +#line 124 IF (!equal(value,expect,var_type[i],NCT_DOUBLE)) { +#line 124 error("expected: %G, got: %G", expect, +#line 124 (double) value); +#line 124 } else { +#line 124 nok++; +#line 124 } +#line 124 } +#line 124 } else { +#line 124 IF (err != NC_ERANGE) +#line 124 error("Range error: status = %d", err); +#line 124 } +#line 124 } else { +#line 124 IF (err != 0 && err != NC_ERANGE) +#line 124 error("OK or Range error: status = %d", err); +#line 124 } +#line 124 } else { +#line 124 IF (err != NC_ECHAR) +#line 124 error("wrong type: status = %d", err); +#line 124 } +#line 124 } +#line 124 } +#line 124 err = nc_close(ncid); +#line 124 IF (err) +#line 124 error("nc_close: %s", nc_strerror(err)); +#line 124 print_nok(nok); +#line 124 } +#line 124 +#line 221 void +#line 222 test_nc_get_var_text(void) +#line 222 { +#line 222 int ncid; +#line 222 int i; +#line 222 int j; +#line 222 int err; +#line 222 int allInExtRange; /* all values within external range? */ +#line 222 int allInIntRange; /* all values within internal range? */ +#line 222 int nels; +#line 222 int nok = 0; /* count of valid comparisons */ +#line 222 size_t index[MAX_RANK]; +#line 222 int canConvert; /* Both text or both numeric */ +#line 222 text value[MAX_NELS]; +#line 222 double expect[MAX_NELS]; +#line 222 +#line 222 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 222 IF (err) +#line 222 error("nc_open: %s", nc_strerror(err)); +#line 222 for (i = 0; i < NVARS; i++) { +#line 222 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 222 assert(var_rank[i] <= MAX_RANK); +#line 222 assert(var_nels[i] <= MAX_NELS); +#line 222 err = nc_get_var_text(BAD_ID, i, value); +#line 222 IF (err != NC_EBADID) +#line 222 error("bad ncid: status = %d", err); +#line 222 err = nc_get_var_text(ncid, BAD_VARID, value); +#line 222 IF (err != NC_ENOTVAR) +#line 222 error("bad var id: status = %d", err); +#line 222 +#line 222 nels = 1; +#line 222 for (j = 0; j < var_rank[i]; j++) { +#line 222 nels *= var_shape[i][j]; +#line 222 } +#line 222 allInExtRange = allInIntRange = 1; +#line 222 for (j = 0; j < nels; j++) { +#line 222 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 222 IF (err) +#line 222 error("error in toMixedBase 1"); +#line 222 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_TEXT); +#line 222 if (inRange3(expect[j],var_type[i], NCT_TEXT)) { +#line 222 allInIntRange = allInIntRange && expect[j] >= text_min +#line 222 && expect[j] <= text_max; +#line 222 } else { +#line 222 allInExtRange = 0; +#line 222 } +#line 222 } +#line 222 err = nc_get_var_text(ncid, i, value); +#line 222 if (canConvert) { +#line 222 if (allInExtRange) { +#line 222 if (allInIntRange) { +#line 222 IF (err) +#line 222 error("%s", nc_strerror(err)); +#line 222 } else { +#line 222 IF (err != NC_ERANGE) +#line 222 error("Range error: status = %d", err); +#line 222 } +#line 222 } else { +#line 222 IF (err != 0 && err != NC_ERANGE) +#line 222 error("OK or Range error: status = %d", err); +#line 222 } +#line 222 for (j = 0; j < nels; j++) { +#line 222 if (inRange3(expect[j],var_type[i],NCT_TEXT) +#line 222 && expect[j] >= text_min && expect[j] <= text_max) { +#line 222 IF (!equal(value[j],expect[j],var_type[i],NCT_TEXT)){ +#line 222 error("value read not that expected"); +#line 222 if (verbose) { +#line 222 error("\n"); +#line 222 error("varid: %d, ", i); +#line 222 error("var_name: %s, ", var_name[i]); +#line 222 error("element number: %d ", j); +#line 222 error("expect: %g", expect[j]); +#line 222 error("got: %g", (double) value[j]); +#line 222 } +#line 222 } else { +#line 222 nok++; +#line 222 } +#line 222 } +#line 222 } +#line 222 } else { +#line 222 IF (nels > 0 && err != NC_ECHAR) +#line 222 error("wrong type: status = %d", err); +#line 222 } +#line 222 } +#line 222 err = nc_close(ncid); +#line 222 IF (err) +#line 222 error("nc_close: %s", nc_strerror(err)); +#line 222 print_nok(nok); +#line 222 } +#line 222 void +#line 223 test_nc_get_var_uchar(void) +#line 223 { +#line 223 int ncid; +#line 223 int i; +#line 223 int j; +#line 223 int err; +#line 223 int allInExtRange; /* all values within external range? */ +#line 223 int allInIntRange; /* all values within internal range? */ +#line 223 int nels; +#line 223 int nok = 0; /* count of valid comparisons */ +#line 223 size_t index[MAX_RANK]; +#line 223 int canConvert; /* Both text or both numeric */ +#line 223 uchar value[MAX_NELS]; +#line 223 double expect[MAX_NELS]; +#line 223 +#line 223 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 223 IF (err) +#line 223 error("nc_open: %s", nc_strerror(err)); +#line 223 for (i = 0; i < NVARS; i++) { +#line 223 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 223 assert(var_rank[i] <= MAX_RANK); +#line 223 assert(var_nels[i] <= MAX_NELS); +#line 223 err = nc_get_var_uchar(BAD_ID, i, value); +#line 223 IF (err != NC_EBADID) +#line 223 error("bad ncid: status = %d", err); +#line 223 err = nc_get_var_uchar(ncid, BAD_VARID, value); +#line 223 IF (err != NC_ENOTVAR) +#line 223 error("bad var id: status = %d", err); +#line 223 +#line 223 nels = 1; +#line 223 for (j = 0; j < var_rank[i]; j++) { +#line 223 nels *= var_shape[i][j]; +#line 223 } +#line 223 allInExtRange = allInIntRange = 1; +#line 223 for (j = 0; j < nels; j++) { +#line 223 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 223 IF (err) +#line 223 error("error in toMixedBase 1"); +#line 223 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UCHAR); +#line 223 if (inRange3(expect[j],var_type[i], NCT_UCHAR)) { +#line 223 allInIntRange = allInIntRange && expect[j] >= uchar_min +#line 223 && expect[j] <= uchar_max; +#line 223 } else { +#line 223 allInExtRange = 0; +#line 223 } +#line 223 } +#line 223 err = nc_get_var_uchar(ncid, i, value); +#line 223 if (canConvert) { +#line 223 if (allInExtRange) { +#line 223 if (allInIntRange) { +#line 223 IF (err) +#line 223 error("%s", nc_strerror(err)); +#line 223 } else { +#line 223 IF (err != NC_ERANGE) +#line 223 error("Range error: status = %d", err); +#line 223 } +#line 223 } else { +#line 223 IF (err != 0 && err != NC_ERANGE) +#line 223 error("OK or Range error: status = %d", err); +#line 223 } +#line 223 for (j = 0; j < nels; j++) { +#line 223 if (inRange3(expect[j],var_type[i],NCT_UCHAR) +#line 223 && expect[j] >= uchar_min && expect[j] <= uchar_max) { +#line 223 IF (!equal(value[j],expect[j],var_type[i],NCT_UCHAR)){ +#line 223 error("value read not that expected"); +#line 223 if (verbose) { +#line 223 error("\n"); +#line 223 error("varid: %d, ", i); +#line 223 error("var_name: %s, ", var_name[i]); +#line 223 error("element number: %d ", j); +#line 223 error("expect: %g", expect[j]); +#line 223 error("got: %g", (double) value[j]); +#line 223 } +#line 223 } else { +#line 223 nok++; +#line 223 } +#line 223 } +#line 223 } +#line 223 } else { +#line 223 IF (nels > 0 && err != NC_ECHAR) +#line 223 error("wrong type: status = %d", err); +#line 223 } +#line 223 } +#line 223 err = nc_close(ncid); +#line 223 IF (err) +#line 223 error("nc_close: %s", nc_strerror(err)); +#line 223 print_nok(nok); +#line 223 } +#line 223 void +#line 224 test_nc_get_var_schar(void) +#line 224 { +#line 224 int ncid; +#line 224 int i; +#line 224 int j; +#line 224 int err; +#line 224 int allInExtRange; /* all values within external range? */ +#line 224 int allInIntRange; /* all values within internal range? */ +#line 224 int nels; +#line 224 int nok = 0; /* count of valid comparisons */ +#line 224 size_t index[MAX_RANK]; +#line 224 int canConvert; /* Both text or both numeric */ +#line 224 schar value[MAX_NELS]; +#line 224 double expect[MAX_NELS]; +#line 224 +#line 224 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 224 IF (err) +#line 224 error("nc_open: %s", nc_strerror(err)); +#line 224 for (i = 0; i < NVARS; i++) { +#line 224 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 224 assert(var_rank[i] <= MAX_RANK); +#line 224 assert(var_nels[i] <= MAX_NELS); +#line 224 err = nc_get_var_schar(BAD_ID, i, value); +#line 224 IF (err != NC_EBADID) +#line 224 error("bad ncid: status = %d", err); +#line 224 err = nc_get_var_schar(ncid, BAD_VARID, value); +#line 224 IF (err != NC_ENOTVAR) +#line 224 error("bad var id: status = %d", err); +#line 224 +#line 224 nels = 1; +#line 224 for (j = 0; j < var_rank[i]; j++) { +#line 224 nels *= var_shape[i][j]; +#line 224 } +#line 224 allInExtRange = allInIntRange = 1; +#line 224 for (j = 0; j < nels; j++) { +#line 224 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 224 IF (err) +#line 224 error("error in toMixedBase 1"); +#line 224 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SCHAR); +#line 224 if (inRange3(expect[j],var_type[i], NCT_SCHAR)) { +#line 224 allInIntRange = allInIntRange && expect[j] >= schar_min +#line 224 && expect[j] <= schar_max; +#line 224 } else { +#line 224 allInExtRange = 0; +#line 224 } +#line 224 } +#line 224 err = nc_get_var_schar(ncid, i, value); +#line 224 if (canConvert) { +#line 224 if (allInExtRange) { +#line 224 if (allInIntRange) { +#line 224 IF (err) +#line 224 error("%s", nc_strerror(err)); +#line 224 } else { +#line 224 IF (err != NC_ERANGE) +#line 224 error("Range error: status = %d", err); +#line 224 } +#line 224 } else { +#line 224 IF (err != 0 && err != NC_ERANGE) +#line 224 error("OK or Range error: status = %d", err); +#line 224 } +#line 224 for (j = 0; j < nels; j++) { +#line 224 if (inRange3(expect[j],var_type[i],NCT_SCHAR) +#line 224 && expect[j] >= schar_min && expect[j] <= schar_max) { +#line 224 IF (!equal(value[j],expect[j],var_type[i],NCT_SCHAR)){ +#line 224 error("value read not that expected"); +#line 224 if (verbose) { +#line 224 error("\n"); +#line 224 error("varid: %d, ", i); +#line 224 error("var_name: %s, ", var_name[i]); +#line 224 error("element number: %d ", j); +#line 224 error("expect: %g", expect[j]); +#line 224 error("got: %g", (double) value[j]); +#line 224 } +#line 224 } else { +#line 224 nok++; +#line 224 } +#line 224 } +#line 224 } +#line 224 } else { +#line 224 IF (nels > 0 && err != NC_ECHAR) +#line 224 error("wrong type: status = %d", err); +#line 224 } +#line 224 } +#line 224 err = nc_close(ncid); +#line 224 IF (err) +#line 224 error("nc_close: %s", nc_strerror(err)); +#line 224 print_nok(nok); +#line 224 } +#line 224 void +#line 225 test_nc_get_var_short(void) +#line 225 { +#line 225 int ncid; +#line 225 int i; +#line 225 int j; +#line 225 int err; +#line 225 int allInExtRange; /* all values within external range? */ +#line 225 int allInIntRange; /* all values within internal range? */ +#line 225 int nels; +#line 225 int nok = 0; /* count of valid comparisons */ +#line 225 size_t index[MAX_RANK]; +#line 225 int canConvert; /* Both text or both numeric */ +#line 225 short value[MAX_NELS]; +#line 225 double expect[MAX_NELS]; +#line 225 +#line 225 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 225 IF (err) +#line 225 error("nc_open: %s", nc_strerror(err)); +#line 225 for (i = 0; i < NVARS; i++) { +#line 225 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 225 assert(var_rank[i] <= MAX_RANK); +#line 225 assert(var_nels[i] <= MAX_NELS); +#line 225 err = nc_get_var_short(BAD_ID, i, value); +#line 225 IF (err != NC_EBADID) +#line 225 error("bad ncid: status = %d", err); +#line 225 err = nc_get_var_short(ncid, BAD_VARID, value); +#line 225 IF (err != NC_ENOTVAR) +#line 225 error("bad var id: status = %d", err); +#line 225 +#line 225 nels = 1; +#line 225 for (j = 0; j < var_rank[i]; j++) { +#line 225 nels *= var_shape[i][j]; +#line 225 } +#line 225 allInExtRange = allInIntRange = 1; +#line 225 for (j = 0; j < nels; j++) { +#line 225 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 225 IF (err) +#line 225 error("error in toMixedBase 1"); +#line 225 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SHORT); +#line 225 if (inRange3(expect[j],var_type[i], NCT_SHORT)) { +#line 225 allInIntRange = allInIntRange && expect[j] >= short_min +#line 225 && expect[j] <= short_max; +#line 225 } else { +#line 225 allInExtRange = 0; +#line 225 } +#line 225 } +#line 225 err = nc_get_var_short(ncid, i, value); +#line 225 if (canConvert) { +#line 225 if (allInExtRange) { +#line 225 if (allInIntRange) { +#line 225 IF (err) +#line 225 error("%s", nc_strerror(err)); +#line 225 } else { +#line 225 IF (err != NC_ERANGE) +#line 225 error("Range error: status = %d", err); +#line 225 } +#line 225 } else { +#line 225 IF (err != 0 && err != NC_ERANGE) +#line 225 error("OK or Range error: status = %d", err); +#line 225 } +#line 225 for (j = 0; j < nels; j++) { +#line 225 if (inRange3(expect[j],var_type[i],NCT_SHORT) +#line 225 && expect[j] >= short_min && expect[j] <= short_max) { +#line 225 IF (!equal(value[j],expect[j],var_type[i],NCT_SHORT)){ +#line 225 error("value read not that expected"); +#line 225 if (verbose) { +#line 225 error("\n"); +#line 225 error("varid: %d, ", i); +#line 225 error("var_name: %s, ", var_name[i]); +#line 225 error("element number: %d ", j); +#line 225 error("expect: %g", expect[j]); +#line 225 error("got: %g", (double) value[j]); +#line 225 } +#line 225 } else { +#line 225 nok++; +#line 225 } +#line 225 } +#line 225 } +#line 225 } else { +#line 225 IF (nels > 0 && err != NC_ECHAR) +#line 225 error("wrong type: status = %d", err); +#line 225 } +#line 225 } +#line 225 err = nc_close(ncid); +#line 225 IF (err) +#line 225 error("nc_close: %s", nc_strerror(err)); +#line 225 print_nok(nok); +#line 225 } +#line 225 void +#line 226 test_nc_get_var_int(void) +#line 226 { +#line 226 int ncid; +#line 226 int i; +#line 226 int j; +#line 226 int err; +#line 226 int allInExtRange; /* all values within external range? */ +#line 226 int allInIntRange; /* all values within internal range? */ +#line 226 int nels; +#line 226 int nok = 0; /* count of valid comparisons */ +#line 226 size_t index[MAX_RANK]; +#line 226 int canConvert; /* Both text or both numeric */ +#line 226 int value[MAX_NELS]; +#line 226 double expect[MAX_NELS]; +#line 226 +#line 226 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 226 IF (err) +#line 226 error("nc_open: %s", nc_strerror(err)); +#line 226 for (i = 0; i < NVARS; i++) { +#line 226 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 226 assert(var_rank[i] <= MAX_RANK); +#line 226 assert(var_nels[i] <= MAX_NELS); +#line 226 err = nc_get_var_int(BAD_ID, i, value); +#line 226 IF (err != NC_EBADID) +#line 226 error("bad ncid: status = %d", err); +#line 226 err = nc_get_var_int(ncid, BAD_VARID, value); +#line 226 IF (err != NC_ENOTVAR) +#line 226 error("bad var id: status = %d", err); +#line 226 +#line 226 nels = 1; +#line 226 for (j = 0; j < var_rank[i]; j++) { +#line 226 nels *= var_shape[i][j]; +#line 226 } +#line 226 allInExtRange = allInIntRange = 1; +#line 226 for (j = 0; j < nels; j++) { +#line 226 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 226 IF (err) +#line 226 error("error in toMixedBase 1"); +#line 226 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_INT); +#line 226 if (inRange3(expect[j],var_type[i], NCT_INT)) { +#line 226 allInIntRange = allInIntRange && expect[j] >= int_min +#line 226 && expect[j] <= int_max; +#line 226 } else { +#line 226 allInExtRange = 0; +#line 226 } +#line 226 } +#line 226 err = nc_get_var_int(ncid, i, value); +#line 226 if (canConvert) { +#line 226 if (allInExtRange) { +#line 226 if (allInIntRange) { +#line 226 IF (err) +#line 226 error("%s", nc_strerror(err)); +#line 226 } else { +#line 226 IF (err != NC_ERANGE) +#line 226 error("Range error: status = %d", err); +#line 226 } +#line 226 } else { +#line 226 IF (err != 0 && err != NC_ERANGE) +#line 226 error("OK or Range error: status = %d", err); +#line 226 } +#line 226 for (j = 0; j < nels; j++) { +#line 226 if (inRange3(expect[j],var_type[i],NCT_INT) +#line 226 && expect[j] >= int_min && expect[j] <= int_max) { +#line 226 IF (!equal(value[j],expect[j],var_type[i],NCT_INT)){ +#line 226 error("value read not that expected"); +#line 226 if (verbose) { +#line 226 error("\n"); +#line 226 error("varid: %d, ", i); +#line 226 error("var_name: %s, ", var_name[i]); +#line 226 error("element number: %d ", j); +#line 226 error("expect: %g", expect[j]); +#line 226 error("got: %g", (double) value[j]); +#line 226 } +#line 226 } else { +#line 226 nok++; +#line 226 } +#line 226 } +#line 226 } +#line 226 } else { +#line 226 IF (nels > 0 && err != NC_ECHAR) +#line 226 error("wrong type: status = %d", err); +#line 226 } +#line 226 } +#line 226 err = nc_close(ncid); +#line 226 IF (err) +#line 226 error("nc_close: %s", nc_strerror(err)); +#line 226 print_nok(nok); +#line 226 } +#line 226 void +#line 227 test_nc_get_var_long(void) +#line 227 { +#line 227 int ncid; +#line 227 int i; +#line 227 int j; +#line 227 int err; +#line 227 int allInExtRange; /* all values within external range? */ +#line 227 int allInIntRange; /* all values within internal range? */ +#line 227 int nels; +#line 227 int nok = 0; /* count of valid comparisons */ +#line 227 size_t index[MAX_RANK]; +#line 227 int canConvert; /* Both text or both numeric */ +#line 227 long value[MAX_NELS]; +#line 227 double expect[MAX_NELS]; +#line 227 +#line 227 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 227 IF (err) +#line 227 error("nc_open: %s", nc_strerror(err)); +#line 227 for (i = 0; i < NVARS; i++) { +#line 227 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 227 assert(var_rank[i] <= MAX_RANK); +#line 227 assert(var_nels[i] <= MAX_NELS); +#line 227 err = nc_get_var_long(BAD_ID, i, value); +#line 227 IF (err != NC_EBADID) +#line 227 error("bad ncid: status = %d", err); +#line 227 err = nc_get_var_long(ncid, BAD_VARID, value); +#line 227 IF (err != NC_ENOTVAR) +#line 227 error("bad var id: status = %d", err); +#line 227 +#line 227 nels = 1; +#line 227 for (j = 0; j < var_rank[i]; j++) { +#line 227 nels *= var_shape[i][j]; +#line 227 } +#line 227 allInExtRange = allInIntRange = 1; +#line 227 for (j = 0; j < nels; j++) { +#line 227 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 227 IF (err) +#line 227 error("error in toMixedBase 1"); +#line 227 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONG); +#line 227 if (inRange3(expect[j],var_type[i], NCT_LONG)) { +#line 227 allInIntRange = allInIntRange && expect[j] >= long_min +#line 227 && expect[j] <= long_max; +#line 227 } else { +#line 227 allInExtRange = 0; +#line 227 } +#line 227 } +#line 227 err = nc_get_var_long(ncid, i, value); +#line 227 if (canConvert) { +#line 227 if (allInExtRange) { +#line 227 if (allInIntRange) { +#line 227 IF (err) +#line 227 error("%s", nc_strerror(err)); +#line 227 } else { +#line 227 IF (err != NC_ERANGE) +#line 227 error("Range error: status = %d", err); +#line 227 } +#line 227 } else { +#line 227 IF (err != 0 && err != NC_ERANGE) +#line 227 error("OK or Range error: status = %d", err); +#line 227 } +#line 227 for (j = 0; j < nels; j++) { +#line 227 if (inRange3(expect[j],var_type[i],NCT_LONG) +#line 227 && expect[j] >= long_min && expect[j] <= long_max) { +#line 227 IF (!equal(value[j],expect[j],var_type[i],NCT_LONG)){ +#line 227 error("value read not that expected"); +#line 227 if (verbose) { +#line 227 error("\n"); +#line 227 error("varid: %d, ", i); +#line 227 error("var_name: %s, ", var_name[i]); +#line 227 error("element number: %d ", j); +#line 227 error("expect: %g", expect[j]); +#line 227 error("got: %g", (double) value[j]); +#line 227 } +#line 227 } else { +#line 227 nok++; +#line 227 } +#line 227 } +#line 227 } +#line 227 } else { +#line 227 IF (nels > 0 && err != NC_ECHAR) +#line 227 error("wrong type: status = %d", err); +#line 227 } +#line 227 } +#line 227 err = nc_close(ncid); +#line 227 IF (err) +#line 227 error("nc_close: %s", nc_strerror(err)); +#line 227 print_nok(nok); +#line 227 } +#line 227 void +#line 228 test_nc_get_var_float(void) +#line 228 { +#line 228 int ncid; +#line 228 int i; +#line 228 int j; +#line 228 int err; +#line 228 int allInExtRange; /* all values within external range? */ +#line 228 int allInIntRange; /* all values within internal range? */ +#line 228 int nels; +#line 228 int nok = 0; /* count of valid comparisons */ +#line 228 size_t index[MAX_RANK]; +#line 228 int canConvert; /* Both text or both numeric */ +#line 228 float value[MAX_NELS]; +#line 228 double expect[MAX_NELS]; +#line 228 +#line 228 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 228 IF (err) +#line 228 error("nc_open: %s", nc_strerror(err)); +#line 228 for (i = 0; i < NVARS; i++) { +#line 228 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 228 assert(var_rank[i] <= MAX_RANK); +#line 228 assert(var_nels[i] <= MAX_NELS); +#line 228 err = nc_get_var_float(BAD_ID, i, value); +#line 228 IF (err != NC_EBADID) +#line 228 error("bad ncid: status = %d", err); +#line 228 err = nc_get_var_float(ncid, BAD_VARID, value); +#line 228 IF (err != NC_ENOTVAR) +#line 228 error("bad var id: status = %d", err); +#line 228 +#line 228 nels = 1; +#line 228 for (j = 0; j < var_rank[i]; j++) { +#line 228 nels *= var_shape[i][j]; +#line 228 } +#line 228 allInExtRange = allInIntRange = 1; +#line 228 for (j = 0; j < nels; j++) { +#line 228 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 228 IF (err) +#line 228 error("error in toMixedBase 1"); +#line 228 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_FLOAT); +#line 228 if (inRange3(expect[j],var_type[i], NCT_FLOAT)) { +#line 228 allInIntRange = allInIntRange && expect[j] >= float_min +#line 228 && expect[j] <= float_max; +#line 228 } else { +#line 228 allInExtRange = 0; +#line 228 } +#line 228 } +#line 228 err = nc_get_var_float(ncid, i, value); +#line 228 if (canConvert) { +#line 228 if (allInExtRange) { +#line 228 if (allInIntRange) { +#line 228 IF (err) +#line 228 error("%s", nc_strerror(err)); +#line 228 } else { +#line 228 IF (err != NC_ERANGE) +#line 228 error("Range error: status = %d", err); +#line 228 } +#line 228 } else { +#line 228 IF (err != 0 && err != NC_ERANGE) +#line 228 error("OK or Range error: status = %d", err); +#line 228 } +#line 228 for (j = 0; j < nels; j++) { +#line 228 if (inRange3(expect[j],var_type[i],NCT_FLOAT) +#line 228 && expect[j] >= float_min && expect[j] <= float_max) { +#line 228 IF (!equal(value[j],expect[j],var_type[i],NCT_FLOAT)){ +#line 228 error("value read not that expected"); +#line 228 if (verbose) { +#line 228 error("\n"); +#line 228 error("varid: %d, ", i); +#line 228 error("var_name: %s, ", var_name[i]); +#line 228 error("element number: %d ", j); +#line 228 error("expect: %g", expect[j]); +#line 228 error("got: %g", (double) value[j]); +#line 228 } +#line 228 } else { +#line 228 nok++; +#line 228 } +#line 228 } +#line 228 } +#line 228 } else { +#line 228 IF (nels > 0 && err != NC_ECHAR) +#line 228 error("wrong type: status = %d", err); +#line 228 } +#line 228 } +#line 228 err = nc_close(ncid); +#line 228 IF (err) +#line 228 error("nc_close: %s", nc_strerror(err)); +#line 228 print_nok(nok); +#line 228 } +#line 228 void +#line 229 test_nc_get_var_double(void) +#line 229 { +#line 229 int ncid; +#line 229 int i; +#line 229 int j; +#line 229 int err; +#line 229 int allInExtRange; /* all values within external range? */ +#line 229 int allInIntRange; /* all values within internal range? */ +#line 229 int nels; +#line 229 int nok = 0; /* count of valid comparisons */ +#line 229 size_t index[MAX_RANK]; +#line 229 int canConvert; /* Both text or both numeric */ +#line 229 double value[MAX_NELS]; +#line 229 double expect[MAX_NELS]; +#line 229 +#line 229 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 229 IF (err) +#line 229 error("nc_open: %s", nc_strerror(err)); +#line 229 for (i = 0; i < NVARS; i++) { +#line 229 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 229 assert(var_rank[i] <= MAX_RANK); +#line 229 assert(var_nels[i] <= MAX_NELS); +#line 229 err = nc_get_var_double(BAD_ID, i, value); +#line 229 IF (err != NC_EBADID) +#line 229 error("bad ncid: status = %d", err); +#line 229 err = nc_get_var_double(ncid, BAD_VARID, value); +#line 229 IF (err != NC_ENOTVAR) +#line 229 error("bad var id: status = %d", err); +#line 229 +#line 229 nels = 1; +#line 229 for (j = 0; j < var_rank[i]; j++) { +#line 229 nels *= var_shape[i][j]; +#line 229 } +#line 229 allInExtRange = allInIntRange = 1; +#line 229 for (j = 0; j < nels; j++) { +#line 229 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 229 IF (err) +#line 229 error("error in toMixedBase 1"); +#line 229 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 229 if (inRange3(expect[j],var_type[i], NCT_DOUBLE)) { +#line 229 allInIntRange = allInIntRange && expect[j] >= double_min +#line 229 && expect[j] <= double_max; +#line 229 } else { +#line 229 allInExtRange = 0; +#line 229 } +#line 229 } +#line 229 err = nc_get_var_double(ncid, i, value); +#line 229 if (canConvert) { +#line 229 if (allInExtRange) { +#line 229 if (allInIntRange) { +#line 229 IF (err) +#line 229 error("%s", nc_strerror(err)); +#line 229 } else { +#line 229 IF (err != NC_ERANGE) +#line 229 error("Range error: status = %d", err); +#line 229 } +#line 229 } else { +#line 229 IF (err != 0 && err != NC_ERANGE) +#line 229 error("OK or Range error: status = %d", err); +#line 229 } +#line 229 for (j = 0; j < nels; j++) { +#line 229 if (inRange3(expect[j],var_type[i],NCT_DOUBLE) +#line 229 && expect[j] >= double_min && expect[j] <= double_max) { +#line 229 IF (!equal(value[j],expect[j],var_type[i],NCT_DOUBLE)){ +#line 229 error("value read not that expected"); +#line 229 if (verbose) { +#line 229 error("\n"); +#line 229 error("varid: %d, ", i); +#line 229 error("var_name: %s, ", var_name[i]); +#line 229 error("element number: %d ", j); +#line 229 error("expect: %g", expect[j]); +#line 229 error("got: %g", (double) value[j]); +#line 229 } +#line 229 } else { +#line 229 nok++; +#line 229 } +#line 229 } +#line 229 } +#line 229 } else { +#line 229 IF (nels > 0 && err != NC_ECHAR) +#line 229 error("wrong type: status = %d", err); +#line 229 } +#line 229 } +#line 229 err = nc_close(ncid); +#line 229 IF (err) +#line 229 error("nc_close: %s", nc_strerror(err)); +#line 229 print_nok(nok); +#line 229 } +#line 229 +#line 401 void +#line 402 test_nc_get_vara_text(void) +#line 402 { +#line 402 int ncid; +#line 402 int d; +#line 402 int i; +#line 402 int j; +#line 402 int k; +#line 402 int err; +#line 402 int allInExtRange; /* all values within external range? */ +#line 402 int allInIntRange; /* all values within internal range? */ +#line 402 int nels; +#line 402 int nslabs; +#line 402 int nok = 0; /* count of valid comparisons */ +#line 402 size_t start[MAX_RANK]; +#line 402 size_t edge[MAX_RANK]; +#line 402 size_t index[MAX_RANK]; +#line 402 size_t mid[MAX_RANK]; +#line 402 int canConvert; /* Both text or both numeric */ +#line 402 text value[MAX_NELS]; +#line 402 double expect[MAX_NELS]; +#line 402 +#line 402 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 402 IF (err) +#line 402 error("nc_open: %s", nc_strerror(err)); +#line 402 for (i = 0; i < NVARS; i++) { +#line 402 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 402 assert(var_rank[i] <= MAX_RANK); +#line 402 assert(var_nels[i] <= MAX_NELS); +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 start[j] = 0; +#line 402 edge[j] = 1; +#line 402 } +#line 402 err = nc_get_vara_text(BAD_ID, i, start, edge, value); +#line 402 IF (err != NC_EBADID) +#line 402 error("bad ncid: status = %d", err); +#line 402 err = nc_get_vara_text(ncid, BAD_VARID, start, edge, value); +#line 402 IF (err != NC_ENOTVAR) +#line 402 error("bad var id: status = %d", err); +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 start[j] = var_shape[i][j]; +#line 402 err = nc_get_vara_text(ncid, i, start, edge, value); +#line 402 IF (canConvert && err != NC_EINVALCOORDS) +#line 402 error("bad index: status = %d", err); +#line 402 start[j] = 0; +#line 402 edge[j] = var_shape[i][j] + 1; +#line 402 err = nc_get_vara_text(ncid, i, start, edge, value); +#line 402 IF (canConvert && err != NC_EEDGE) +#line 402 error("bad edge: status = %d", err); +#line 402 edge[j] = 1; +#line 402 } +#line 402 /* Check non-scalars for correct error returned even when */ +#line 402 /* there is nothing to get (edge[j]==0) */ +#line 402 if(var_rank[i] > 0) { +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 edge[j] = 0; +#line 402 } +#line 402 err = nc_get_vara_text(BAD_ID, i, start, edge, value); +#line 402 IF (err != NC_EBADID) +#line 402 error("bad ncid: status = %d", err); +#line 402 err = nc_get_vara_text(ncid, BAD_VARID, start, edge, value); +#line 402 IF (err != NC_ENOTVAR) +#line 402 error("bad var id: status = %d", err); +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 402 start[j] = var_shape[i][j]; +#line 402 err = nc_get_vara_text(ncid, i, start, edge, value); +#line 402 IF (canConvert && err != NC_EINVALCOORDS) +#line 402 error("bad start: status = %d", err); +#line 402 start[j] = 0; +#line 402 } +#line 402 } +#line 402 err = nc_get_vara_text(ncid, i, start, edge, value); +#line 402 if (canConvert) { +#line 402 IF (err) +#line 402 error("%s", nc_strerror(err)); +#line 402 } else { +#line 402 IF (err != NC_ECHAR) +#line 402 error("wrong type: status = %d", err); +#line 402 } +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 edge[j] = 1; +#line 402 } +#line 402 } /* Choose a random point dividing each dim into 2 parts */ +#line 402 /* get 2^rank (nslabs) slabs so defined */ +#line 402 nslabs = 1; +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 mid[j] = roll( var_shape[i][j] ); +#line 402 nslabs *= 2; +#line 402 } +#line 402 /* bits of k determine whether to get lower or upper part of dim */ +#line 402 for (k = 0; k < nslabs; k++) { +#line 402 nels = 1; +#line 402 for (j = 0; j < var_rank[i]; j++) { +#line 402 if ((k >> j) & 1) { +#line 402 start[j] = 0; +#line 402 edge[j] = mid[j]; +#line 402 }else{ +#line 402 start[j] = mid[j]; +#line 402 edge[j] = var_shape[i][j] - mid[j]; +#line 402 } +#line 402 nels *= edge[j]; +#line 402 } +#line 402 allInExtRange = allInIntRange = 1; +#line 402 for (j = 0; j < nels; j++) { +#line 402 err = toMixedBase(j, var_rank[i], edge, index); +#line 402 IF (err) +#line 402 error("error in toMixedBase 1"); +#line 402 for (d = 0; d < var_rank[i]; d++) +#line 402 index[d] += start[d]; +#line 402 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_TEXT); +#line 402 if (inRange3(expect[j],var_type[i], NCT_TEXT)) { +#line 402 allInIntRange = allInIntRange && expect[j] >= text_min +#line 402 && expect[j] <= text_max; +#line 402 } else { +#line 402 allInExtRange = 0; +#line 402 } +#line 402 } +#line 402 if (var_rank[i] == 0 && i%2) +#line 402 err = nc_get_vara_text(ncid, i, NULL, NULL, value); +#line 402 else +#line 402 err = nc_get_vara_text(ncid, i, start, edge, value); +#line 402 if (canConvert) { +#line 402 if (allInExtRange) { +#line 402 if (allInIntRange) { +#line 402 IF (err) +#line 402 error("%s", nc_strerror(err)); +#line 402 } else { +#line 402 IF (err != NC_ERANGE) +#line 402 error("Range error: status = %d", err); +#line 402 } +#line 402 } else { +#line 402 IF (err != 0 && err != NC_ERANGE) +#line 402 error("OK or Range error: status = %d", err); +#line 402 } +#line 402 for (j = 0; j < nels; j++) { +#line 402 if (inRange3(expect[j],var_type[i],NCT_TEXT) +#line 402 && expect[j] >= text_min && expect[j] <= text_max) { +#line 402 IF (!equal(value[j],expect[j],var_type[i],NCT_TEXT)){ +#line 402 error("value read not that expected"); +#line 402 if (verbose) { +#line 402 error("\n"); +#line 402 error("varid: %d, ", i); +#line 402 error("var_name: %s, ", var_name[i]); +#line 402 error("element number: %d ", j); +#line 402 error("expect: %g", expect[j]); +#line 402 error("got: %g", (double) value[j]); +#line 402 } +#line 402 } else { +#line 402 nok++; +#line 402 } +#line 402 } +#line 402 } +#line 402 } else { +#line 402 IF (nels > 0 && err != NC_ECHAR) +#line 402 error("wrong type: status = %d", err); +#line 402 } +#line 402 } +#line 402 } +#line 402 err = nc_close(ncid); +#line 402 IF (err) +#line 402 error("nc_close: %s", nc_strerror(err)); +#line 402 print_nok(nok); +#line 402 } +#line 402 void +#line 403 test_nc_get_vara_uchar(void) +#line 403 { +#line 403 int ncid; +#line 403 int d; +#line 403 int i; +#line 403 int j; +#line 403 int k; +#line 403 int err; +#line 403 int allInExtRange; /* all values within external range? */ +#line 403 int allInIntRange; /* all values within internal range? */ +#line 403 int nels; +#line 403 int nslabs; +#line 403 int nok = 0; /* count of valid comparisons */ +#line 403 size_t start[MAX_RANK]; +#line 403 size_t edge[MAX_RANK]; +#line 403 size_t index[MAX_RANK]; +#line 403 size_t mid[MAX_RANK]; +#line 403 int canConvert; /* Both text or both numeric */ +#line 403 uchar value[MAX_NELS]; +#line 403 double expect[MAX_NELS]; +#line 403 +#line 403 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 403 IF (err) +#line 403 error("nc_open: %s", nc_strerror(err)); +#line 403 for (i = 0; i < NVARS; i++) { +#line 403 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 403 assert(var_rank[i] <= MAX_RANK); +#line 403 assert(var_nels[i] <= MAX_NELS); +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 start[j] = 0; +#line 403 edge[j] = 1; +#line 403 } +#line 403 err = nc_get_vara_uchar(BAD_ID, i, start, edge, value); +#line 403 IF (err != NC_EBADID) +#line 403 error("bad ncid: status = %d", err); +#line 403 err = nc_get_vara_uchar(ncid, BAD_VARID, start, edge, value); +#line 403 IF (err != NC_ENOTVAR) +#line 403 error("bad var id: status = %d", err); +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 start[j] = var_shape[i][j]; +#line 403 err = nc_get_vara_uchar(ncid, i, start, edge, value); +#line 403 IF (canConvert && err != NC_EINVALCOORDS) +#line 403 error("bad index: status = %d", err); +#line 403 start[j] = 0; +#line 403 edge[j] = var_shape[i][j] + 1; +#line 403 err = nc_get_vara_uchar(ncid, i, start, edge, value); +#line 403 IF (canConvert && err != NC_EEDGE) +#line 403 error("bad edge: status = %d", err); +#line 403 edge[j] = 1; +#line 403 } +#line 403 /* Check non-scalars for correct error returned even when */ +#line 403 /* there is nothing to get (edge[j]==0) */ +#line 403 if(var_rank[i] > 0) { +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 edge[j] = 0; +#line 403 } +#line 403 err = nc_get_vara_uchar(BAD_ID, i, start, edge, value); +#line 403 IF (err != NC_EBADID) +#line 403 error("bad ncid: status = %d", err); +#line 403 err = nc_get_vara_uchar(ncid, BAD_VARID, start, edge, value); +#line 403 IF (err != NC_ENOTVAR) +#line 403 error("bad var id: status = %d", err); +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 403 start[j] = var_shape[i][j]; +#line 403 err = nc_get_vara_uchar(ncid, i, start, edge, value); +#line 403 IF (canConvert && err != NC_EINVALCOORDS) +#line 403 error("bad start: status = %d", err); +#line 403 start[j] = 0; +#line 403 } +#line 403 } +#line 403 err = nc_get_vara_uchar(ncid, i, start, edge, value); +#line 403 if (canConvert) { +#line 403 IF (err) +#line 403 error("%s", nc_strerror(err)); +#line 403 } else { +#line 403 IF (err != NC_ECHAR) +#line 403 error("wrong type: status = %d", err); +#line 403 } +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 edge[j] = 1; +#line 403 } +#line 403 } /* Choose a random point dividing each dim into 2 parts */ +#line 403 /* get 2^rank (nslabs) slabs so defined */ +#line 403 nslabs = 1; +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 mid[j] = roll( var_shape[i][j] ); +#line 403 nslabs *= 2; +#line 403 } +#line 403 /* bits of k determine whether to get lower or upper part of dim */ +#line 403 for (k = 0; k < nslabs; k++) { +#line 403 nels = 1; +#line 403 for (j = 0; j < var_rank[i]; j++) { +#line 403 if ((k >> j) & 1) { +#line 403 start[j] = 0; +#line 403 edge[j] = mid[j]; +#line 403 }else{ +#line 403 start[j] = mid[j]; +#line 403 edge[j] = var_shape[i][j] - mid[j]; +#line 403 } +#line 403 nels *= edge[j]; +#line 403 } +#line 403 allInExtRange = allInIntRange = 1; +#line 403 for (j = 0; j < nels; j++) { +#line 403 err = toMixedBase(j, var_rank[i], edge, index); +#line 403 IF (err) +#line 403 error("error in toMixedBase 1"); +#line 403 for (d = 0; d < var_rank[i]; d++) +#line 403 index[d] += start[d]; +#line 403 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_UCHAR); +#line 403 if (inRange3(expect[j],var_type[i], NCT_UCHAR)) { +#line 403 allInIntRange = allInIntRange && expect[j] >= uchar_min +#line 403 && expect[j] <= uchar_max; +#line 403 } else { +#line 403 allInExtRange = 0; +#line 403 } +#line 403 } +#line 403 if (var_rank[i] == 0 && i%2) +#line 403 err = nc_get_vara_uchar(ncid, i, NULL, NULL, value); +#line 403 else +#line 403 err = nc_get_vara_uchar(ncid, i, start, edge, value); +#line 403 if (canConvert) { +#line 403 if (allInExtRange) { +#line 403 if (allInIntRange) { +#line 403 IF (err) +#line 403 error("%s", nc_strerror(err)); +#line 403 } else { +#line 403 IF (err != NC_ERANGE) +#line 403 error("Range error: status = %d", err); +#line 403 } +#line 403 } else { +#line 403 IF (err != 0 && err != NC_ERANGE) +#line 403 error("OK or Range error: status = %d", err); +#line 403 } +#line 403 for (j = 0; j < nels; j++) { +#line 403 if (inRange3(expect[j],var_type[i],NCT_UCHAR) +#line 403 && expect[j] >= uchar_min && expect[j] <= uchar_max) { +#line 403 IF (!equal(value[j],expect[j],var_type[i],NCT_UCHAR)){ +#line 403 error("value read not that expected"); +#line 403 if (verbose) { +#line 403 error("\n"); +#line 403 error("varid: %d, ", i); +#line 403 error("var_name: %s, ", var_name[i]); +#line 403 error("element number: %d ", j); +#line 403 error("expect: %g", expect[j]); +#line 403 error("got: %g", (double) value[j]); +#line 403 } +#line 403 } else { +#line 403 nok++; +#line 403 } +#line 403 } +#line 403 } +#line 403 } else { +#line 403 IF (nels > 0 && err != NC_ECHAR) +#line 403 error("wrong type: status = %d", err); +#line 403 } +#line 403 } +#line 403 } +#line 403 err = nc_close(ncid); +#line 403 IF (err) +#line 403 error("nc_close: %s", nc_strerror(err)); +#line 403 print_nok(nok); +#line 403 } +#line 403 void +#line 404 test_nc_get_vara_schar(void) +#line 404 { +#line 404 int ncid; +#line 404 int d; +#line 404 int i; +#line 404 int j; +#line 404 int k; +#line 404 int err; +#line 404 int allInExtRange; /* all values within external range? */ +#line 404 int allInIntRange; /* all values within internal range? */ +#line 404 int nels; +#line 404 int nslabs; +#line 404 int nok = 0; /* count of valid comparisons */ +#line 404 size_t start[MAX_RANK]; +#line 404 size_t edge[MAX_RANK]; +#line 404 size_t index[MAX_RANK]; +#line 404 size_t mid[MAX_RANK]; +#line 404 int canConvert; /* Both text or both numeric */ +#line 404 schar value[MAX_NELS]; +#line 404 double expect[MAX_NELS]; +#line 404 +#line 404 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 404 IF (err) +#line 404 error("nc_open: %s", nc_strerror(err)); +#line 404 for (i = 0; i < NVARS; i++) { +#line 404 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 404 assert(var_rank[i] <= MAX_RANK); +#line 404 assert(var_nels[i] <= MAX_NELS); +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 start[j] = 0; +#line 404 edge[j] = 1; +#line 404 } +#line 404 err = nc_get_vara_schar(BAD_ID, i, start, edge, value); +#line 404 IF (err != NC_EBADID) +#line 404 error("bad ncid: status = %d", err); +#line 404 err = nc_get_vara_schar(ncid, BAD_VARID, start, edge, value); +#line 404 IF (err != NC_ENOTVAR) +#line 404 error("bad var id: status = %d", err); +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 start[j] = var_shape[i][j]; +#line 404 err = nc_get_vara_schar(ncid, i, start, edge, value); +#line 404 IF (canConvert && err != NC_EINVALCOORDS) +#line 404 error("bad index: status = %d", err); +#line 404 start[j] = 0; +#line 404 edge[j] = var_shape[i][j] + 1; +#line 404 err = nc_get_vara_schar(ncid, i, start, edge, value); +#line 404 IF (canConvert && err != NC_EEDGE) +#line 404 error("bad edge: status = %d", err); +#line 404 edge[j] = 1; +#line 404 } +#line 404 /* Check non-scalars for correct error returned even when */ +#line 404 /* there is nothing to get (edge[j]==0) */ +#line 404 if(var_rank[i] > 0) { +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 edge[j] = 0; +#line 404 } +#line 404 err = nc_get_vara_schar(BAD_ID, i, start, edge, value); +#line 404 IF (err != NC_EBADID) +#line 404 error("bad ncid: status = %d", err); +#line 404 err = nc_get_vara_schar(ncid, BAD_VARID, start, edge, value); +#line 404 IF (err != NC_ENOTVAR) +#line 404 error("bad var id: status = %d", err); +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 404 start[j] = var_shape[i][j]; +#line 404 err = nc_get_vara_schar(ncid, i, start, edge, value); +#line 404 IF (canConvert && err != NC_EINVALCOORDS) +#line 404 error("bad start: status = %d", err); +#line 404 start[j] = 0; +#line 404 } +#line 404 } +#line 404 err = nc_get_vara_schar(ncid, i, start, edge, value); +#line 404 if (canConvert) { +#line 404 IF (err) +#line 404 error("%s", nc_strerror(err)); +#line 404 } else { +#line 404 IF (err != NC_ECHAR) +#line 404 error("wrong type: status = %d", err); +#line 404 } +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 edge[j] = 1; +#line 404 } +#line 404 } /* Choose a random point dividing each dim into 2 parts */ +#line 404 /* get 2^rank (nslabs) slabs so defined */ +#line 404 nslabs = 1; +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 mid[j] = roll( var_shape[i][j] ); +#line 404 nslabs *= 2; +#line 404 } +#line 404 /* bits of k determine whether to get lower or upper part of dim */ +#line 404 for (k = 0; k < nslabs; k++) { +#line 404 nels = 1; +#line 404 for (j = 0; j < var_rank[i]; j++) { +#line 404 if ((k >> j) & 1) { +#line 404 start[j] = 0; +#line 404 edge[j] = mid[j]; +#line 404 }else{ +#line 404 start[j] = mid[j]; +#line 404 edge[j] = var_shape[i][j] - mid[j]; +#line 404 } +#line 404 nels *= edge[j]; +#line 404 } +#line 404 allInExtRange = allInIntRange = 1; +#line 404 for (j = 0; j < nels; j++) { +#line 404 err = toMixedBase(j, var_rank[i], edge, index); +#line 404 IF (err) +#line 404 error("error in toMixedBase 1"); +#line 404 for (d = 0; d < var_rank[i]; d++) +#line 404 index[d] += start[d]; +#line 404 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SCHAR); +#line 404 if (inRange3(expect[j],var_type[i], NCT_SCHAR)) { +#line 404 allInIntRange = allInIntRange && expect[j] >= schar_min +#line 404 && expect[j] <= schar_max; +#line 404 } else { +#line 404 allInExtRange = 0; +#line 404 } +#line 404 } +#line 404 if (var_rank[i] == 0 && i%2) +#line 404 err = nc_get_vara_schar(ncid, i, NULL, NULL, value); +#line 404 else +#line 404 err = nc_get_vara_schar(ncid, i, start, edge, value); +#line 404 if (canConvert) { +#line 404 if (allInExtRange) { +#line 404 if (allInIntRange) { +#line 404 IF (err) +#line 404 error("%s", nc_strerror(err)); +#line 404 } else { +#line 404 IF (err != NC_ERANGE) +#line 404 error("Range error: status = %d", err); +#line 404 } +#line 404 } else { +#line 404 IF (err != 0 && err != NC_ERANGE) +#line 404 error("OK or Range error: status = %d", err); +#line 404 } +#line 404 for (j = 0; j < nels; j++) { +#line 404 if (inRange3(expect[j],var_type[i],NCT_SCHAR) +#line 404 && expect[j] >= schar_min && expect[j] <= schar_max) { +#line 404 IF (!equal(value[j],expect[j],var_type[i],NCT_SCHAR)){ +#line 404 error("value read not that expected"); +#line 404 if (verbose) { +#line 404 error("\n"); +#line 404 error("varid: %d, ", i); +#line 404 error("var_name: %s, ", var_name[i]); +#line 404 error("element number: %d ", j); +#line 404 error("expect: %g", expect[j]); +#line 404 error("got: %g", (double) value[j]); +#line 404 } +#line 404 } else { +#line 404 nok++; +#line 404 } +#line 404 } +#line 404 } +#line 404 } else { +#line 404 IF (nels > 0 && err != NC_ECHAR) +#line 404 error("wrong type: status = %d", err); +#line 404 } +#line 404 } +#line 404 } +#line 404 err = nc_close(ncid); +#line 404 IF (err) +#line 404 error("nc_close: %s", nc_strerror(err)); +#line 404 print_nok(nok); +#line 404 } +#line 404 void +#line 405 test_nc_get_vara_short(void) +#line 405 { +#line 405 int ncid; +#line 405 int d; +#line 405 int i; +#line 405 int j; +#line 405 int k; +#line 405 int err; +#line 405 int allInExtRange; /* all values within external range? */ +#line 405 int allInIntRange; /* all values within internal range? */ +#line 405 int nels; +#line 405 int nslabs; +#line 405 int nok = 0; /* count of valid comparisons */ +#line 405 size_t start[MAX_RANK]; +#line 405 size_t edge[MAX_RANK]; +#line 405 size_t index[MAX_RANK]; +#line 405 size_t mid[MAX_RANK]; +#line 405 int canConvert; /* Both text or both numeric */ +#line 405 short value[MAX_NELS]; +#line 405 double expect[MAX_NELS]; +#line 405 +#line 405 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 405 IF (err) +#line 405 error("nc_open: %s", nc_strerror(err)); +#line 405 for (i = 0; i < NVARS; i++) { +#line 405 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 405 assert(var_rank[i] <= MAX_RANK); +#line 405 assert(var_nels[i] <= MAX_NELS); +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 start[j] = 0; +#line 405 edge[j] = 1; +#line 405 } +#line 405 err = nc_get_vara_short(BAD_ID, i, start, edge, value); +#line 405 IF (err != NC_EBADID) +#line 405 error("bad ncid: status = %d", err); +#line 405 err = nc_get_vara_short(ncid, BAD_VARID, start, edge, value); +#line 405 IF (err != NC_ENOTVAR) +#line 405 error("bad var id: status = %d", err); +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 start[j] = var_shape[i][j]; +#line 405 err = nc_get_vara_short(ncid, i, start, edge, value); +#line 405 IF (canConvert && err != NC_EINVALCOORDS) +#line 405 error("bad index: status = %d", err); +#line 405 start[j] = 0; +#line 405 edge[j] = var_shape[i][j] + 1; +#line 405 err = nc_get_vara_short(ncid, i, start, edge, value); +#line 405 IF (canConvert && err != NC_EEDGE) +#line 405 error("bad edge: status = %d", err); +#line 405 edge[j] = 1; +#line 405 } +#line 405 /* Check non-scalars for correct error returned even when */ +#line 405 /* there is nothing to get (edge[j]==0) */ +#line 405 if(var_rank[i] > 0) { +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 edge[j] = 0; +#line 405 } +#line 405 err = nc_get_vara_short(BAD_ID, i, start, edge, value); +#line 405 IF (err != NC_EBADID) +#line 405 error("bad ncid: status = %d", err); +#line 405 err = nc_get_vara_short(ncid, BAD_VARID, start, edge, value); +#line 405 IF (err != NC_ENOTVAR) +#line 405 error("bad var id: status = %d", err); +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 405 start[j] = var_shape[i][j]; +#line 405 err = nc_get_vara_short(ncid, i, start, edge, value); +#line 405 IF (canConvert && err != NC_EINVALCOORDS) +#line 405 error("bad start: status = %d", err); +#line 405 start[j] = 0; +#line 405 } +#line 405 } +#line 405 err = nc_get_vara_short(ncid, i, start, edge, value); +#line 405 if (canConvert) { +#line 405 IF (err) +#line 405 error("%s", nc_strerror(err)); +#line 405 } else { +#line 405 IF (err != NC_ECHAR) +#line 405 error("wrong type: status = %d", err); +#line 405 } +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 edge[j] = 1; +#line 405 } +#line 405 } /* Choose a random point dividing each dim into 2 parts */ +#line 405 /* get 2^rank (nslabs) slabs so defined */ +#line 405 nslabs = 1; +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 mid[j] = roll( var_shape[i][j] ); +#line 405 nslabs *= 2; +#line 405 } +#line 405 /* bits of k determine whether to get lower or upper part of dim */ +#line 405 for (k = 0; k < nslabs; k++) { +#line 405 nels = 1; +#line 405 for (j = 0; j < var_rank[i]; j++) { +#line 405 if ((k >> j) & 1) { +#line 405 start[j] = 0; +#line 405 edge[j] = mid[j]; +#line 405 }else{ +#line 405 start[j] = mid[j]; +#line 405 edge[j] = var_shape[i][j] - mid[j]; +#line 405 } +#line 405 nels *= edge[j]; +#line 405 } +#line 405 allInExtRange = allInIntRange = 1; +#line 405 for (j = 0; j < nels; j++) { +#line 405 err = toMixedBase(j, var_rank[i], edge, index); +#line 405 IF (err) +#line 405 error("error in toMixedBase 1"); +#line 405 for (d = 0; d < var_rank[i]; d++) +#line 405 index[d] += start[d]; +#line 405 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_SHORT); +#line 405 if (inRange3(expect[j],var_type[i], NCT_SHORT)) { +#line 405 allInIntRange = allInIntRange && expect[j] >= short_min +#line 405 && expect[j] <= short_max; +#line 405 } else { +#line 405 allInExtRange = 0; +#line 405 } +#line 405 } +#line 405 if (var_rank[i] == 0 && i%2) +#line 405 err = nc_get_vara_short(ncid, i, NULL, NULL, value); +#line 405 else +#line 405 err = nc_get_vara_short(ncid, i, start, edge, value); +#line 405 if (canConvert) { +#line 405 if (allInExtRange) { +#line 405 if (allInIntRange) { +#line 405 IF (err) +#line 405 error("%s", nc_strerror(err)); +#line 405 } else { +#line 405 IF (err != NC_ERANGE) +#line 405 error("Range error: status = %d", err); +#line 405 } +#line 405 } else { +#line 405 IF (err != 0 && err != NC_ERANGE) +#line 405 error("OK or Range error: status = %d", err); +#line 405 } +#line 405 for (j = 0; j < nels; j++) { +#line 405 if (inRange3(expect[j],var_type[i],NCT_SHORT) +#line 405 && expect[j] >= short_min && expect[j] <= short_max) { +#line 405 IF (!equal(value[j],expect[j],var_type[i],NCT_SHORT)){ +#line 405 error("value read not that expected"); +#line 405 if (verbose) { +#line 405 error("\n"); +#line 405 error("varid: %d, ", i); +#line 405 error("var_name: %s, ", var_name[i]); +#line 405 error("element number: %d ", j); +#line 405 error("expect: %g", expect[j]); +#line 405 error("got: %g", (double) value[j]); +#line 405 } +#line 405 } else { +#line 405 nok++; +#line 405 } +#line 405 } +#line 405 } +#line 405 } else { +#line 405 IF (nels > 0 && err != NC_ECHAR) +#line 405 error("wrong type: status = %d", err); +#line 405 } +#line 405 } +#line 405 } +#line 405 err = nc_close(ncid); +#line 405 IF (err) +#line 405 error("nc_close: %s", nc_strerror(err)); +#line 405 print_nok(nok); +#line 405 } +#line 405 void +#line 406 test_nc_get_vara_int(void) +#line 406 { +#line 406 int ncid; +#line 406 int d; +#line 406 int i; +#line 406 int j; +#line 406 int k; +#line 406 int err; +#line 406 int allInExtRange; /* all values within external range? */ +#line 406 int allInIntRange; /* all values within internal range? */ +#line 406 int nels; +#line 406 int nslabs; +#line 406 int nok = 0; /* count of valid comparisons */ +#line 406 size_t start[MAX_RANK]; +#line 406 size_t edge[MAX_RANK]; +#line 406 size_t index[MAX_RANK]; +#line 406 size_t mid[MAX_RANK]; +#line 406 int canConvert; /* Both text or both numeric */ +#line 406 int value[MAX_NELS]; +#line 406 double expect[MAX_NELS]; +#line 406 +#line 406 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 406 IF (err) +#line 406 error("nc_open: %s", nc_strerror(err)); +#line 406 for (i = 0; i < NVARS; i++) { +#line 406 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 406 assert(var_rank[i] <= MAX_RANK); +#line 406 assert(var_nels[i] <= MAX_NELS); +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 start[j] = 0; +#line 406 edge[j] = 1; +#line 406 } +#line 406 err = nc_get_vara_int(BAD_ID, i, start, edge, value); +#line 406 IF (err != NC_EBADID) +#line 406 error("bad ncid: status = %d", err); +#line 406 err = nc_get_vara_int(ncid, BAD_VARID, start, edge, value); +#line 406 IF (err != NC_ENOTVAR) +#line 406 error("bad var id: status = %d", err); +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 start[j] = var_shape[i][j]; +#line 406 err = nc_get_vara_int(ncid, i, start, edge, value); +#line 406 IF (canConvert && err != NC_EINVALCOORDS) +#line 406 error("bad index: status = %d", err); +#line 406 start[j] = 0; +#line 406 edge[j] = var_shape[i][j] + 1; +#line 406 err = nc_get_vara_int(ncid, i, start, edge, value); +#line 406 IF (canConvert && err != NC_EEDGE) +#line 406 error("bad edge: status = %d", err); +#line 406 edge[j] = 1; +#line 406 } +#line 406 /* Check non-scalars for correct error returned even when */ +#line 406 /* there is nothing to get (edge[j]==0) */ +#line 406 if(var_rank[i] > 0) { +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 edge[j] = 0; +#line 406 } +#line 406 err = nc_get_vara_int(BAD_ID, i, start, edge, value); +#line 406 IF (err != NC_EBADID) +#line 406 error("bad ncid: status = %d", err); +#line 406 err = nc_get_vara_int(ncid, BAD_VARID, start, edge, value); +#line 406 IF (err != NC_ENOTVAR) +#line 406 error("bad var id: status = %d", err); +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 406 start[j] = var_shape[i][j]; +#line 406 err = nc_get_vara_int(ncid, i, start, edge, value); +#line 406 IF (canConvert && err != NC_EINVALCOORDS) +#line 406 error("bad start: status = %d", err); +#line 406 start[j] = 0; +#line 406 } +#line 406 } +#line 406 err = nc_get_vara_int(ncid, i, start, edge, value); +#line 406 if (canConvert) { +#line 406 IF (err) +#line 406 error("%s", nc_strerror(err)); +#line 406 } else { +#line 406 IF (err != NC_ECHAR) +#line 406 error("wrong type: status = %d", err); +#line 406 } +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 edge[j] = 1; +#line 406 } +#line 406 } /* Choose a random point dividing each dim into 2 parts */ +#line 406 /* get 2^rank (nslabs) slabs so defined */ +#line 406 nslabs = 1; +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 mid[j] = roll( var_shape[i][j] ); +#line 406 nslabs *= 2; +#line 406 } +#line 406 /* bits of k determine whether to get lower or upper part of dim */ +#line 406 for (k = 0; k < nslabs; k++) { +#line 406 nels = 1; +#line 406 for (j = 0; j < var_rank[i]; j++) { +#line 406 if ((k >> j) & 1) { +#line 406 start[j] = 0; +#line 406 edge[j] = mid[j]; +#line 406 }else{ +#line 406 start[j] = mid[j]; +#line 406 edge[j] = var_shape[i][j] - mid[j]; +#line 406 } +#line 406 nels *= edge[j]; +#line 406 } +#line 406 allInExtRange = allInIntRange = 1; +#line 406 for (j = 0; j < nels; j++) { +#line 406 err = toMixedBase(j, var_rank[i], edge, index); +#line 406 IF (err) +#line 406 error("error in toMixedBase 1"); +#line 406 for (d = 0; d < var_rank[i]; d++) +#line 406 index[d] += start[d]; +#line 406 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_INT); +#line 406 if (inRange3(expect[j],var_type[i], NCT_INT)) { +#line 406 allInIntRange = allInIntRange && expect[j] >= int_min +#line 406 && expect[j] <= int_max; +#line 406 } else { +#line 406 allInExtRange = 0; +#line 406 } +#line 406 } +#line 406 if (var_rank[i] == 0 && i%2) +#line 406 err = nc_get_vara_int(ncid, i, NULL, NULL, value); +#line 406 else +#line 406 err = nc_get_vara_int(ncid, i, start, edge, value); +#line 406 if (canConvert) { +#line 406 if (allInExtRange) { +#line 406 if (allInIntRange) { +#line 406 IF (err) +#line 406 error("%s", nc_strerror(err)); +#line 406 } else { +#line 406 IF (err != NC_ERANGE) +#line 406 error("Range error: status = %d", err); +#line 406 } +#line 406 } else { +#line 406 IF (err != 0 && err != NC_ERANGE) +#line 406 error("OK or Range error: status = %d", err); +#line 406 } +#line 406 for (j = 0; j < nels; j++) { +#line 406 if (inRange3(expect[j],var_type[i],NCT_INT) +#line 406 && expect[j] >= int_min && expect[j] <= int_max) { +#line 406 IF (!equal(value[j],expect[j],var_type[i],NCT_INT)){ +#line 406 error("value read not that expected"); +#line 406 if (verbose) { +#line 406 error("\n"); +#line 406 error("varid: %d, ", i); +#line 406 error("var_name: %s, ", var_name[i]); +#line 406 error("element number: %d ", j); +#line 406 error("expect: %g", expect[j]); +#line 406 error("got: %g", (double) value[j]); +#line 406 } +#line 406 } else { +#line 406 nok++; +#line 406 } +#line 406 } +#line 406 } +#line 406 } else { +#line 406 IF (nels > 0 && err != NC_ECHAR) +#line 406 error("wrong type: status = %d", err); +#line 406 } +#line 406 } +#line 406 } +#line 406 err = nc_close(ncid); +#line 406 IF (err) +#line 406 error("nc_close: %s", nc_strerror(err)); +#line 406 print_nok(nok); +#line 406 } +#line 406 void +#line 407 test_nc_get_vara_long(void) +#line 407 { +#line 407 int ncid; +#line 407 int d; +#line 407 int i; +#line 407 int j; +#line 407 int k; +#line 407 int err; +#line 407 int allInExtRange; /* all values within external range? */ +#line 407 int allInIntRange; /* all values within internal range? */ +#line 407 int nels; +#line 407 int nslabs; +#line 407 int nok = 0; /* count of valid comparisons */ +#line 407 size_t start[MAX_RANK]; +#line 407 size_t edge[MAX_RANK]; +#line 407 size_t index[MAX_RANK]; +#line 407 size_t mid[MAX_RANK]; +#line 407 int canConvert; /* Both text or both numeric */ +#line 407 long value[MAX_NELS]; +#line 407 double expect[MAX_NELS]; +#line 407 +#line 407 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 407 IF (err) +#line 407 error("nc_open: %s", nc_strerror(err)); +#line 407 for (i = 0; i < NVARS; i++) { +#line 407 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 407 assert(var_rank[i] <= MAX_RANK); +#line 407 assert(var_nels[i] <= MAX_NELS); +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 start[j] = 0; +#line 407 edge[j] = 1; +#line 407 } +#line 407 err = nc_get_vara_long(BAD_ID, i, start, edge, value); +#line 407 IF (err != NC_EBADID) +#line 407 error("bad ncid: status = %d", err); +#line 407 err = nc_get_vara_long(ncid, BAD_VARID, start, edge, value); +#line 407 IF (err != NC_ENOTVAR) +#line 407 error("bad var id: status = %d", err); +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 start[j] = var_shape[i][j]; +#line 407 err = nc_get_vara_long(ncid, i, start, edge, value); +#line 407 IF (canConvert && err != NC_EINVALCOORDS) +#line 407 error("bad index: status = %d", err); +#line 407 start[j] = 0; +#line 407 edge[j] = var_shape[i][j] + 1; +#line 407 err = nc_get_vara_long(ncid, i, start, edge, value); +#line 407 IF (canConvert && err != NC_EEDGE) +#line 407 error("bad edge: status = %d", err); +#line 407 edge[j] = 1; +#line 407 } +#line 407 /* Check non-scalars for correct error returned even when */ +#line 407 /* there is nothing to get (edge[j]==0) */ +#line 407 if(var_rank[i] > 0) { +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 edge[j] = 0; +#line 407 } +#line 407 err = nc_get_vara_long(BAD_ID, i, start, edge, value); +#line 407 IF (err != NC_EBADID) +#line 407 error("bad ncid: status = %d", err); +#line 407 err = nc_get_vara_long(ncid, BAD_VARID, start, edge, value); +#line 407 IF (err != NC_ENOTVAR) +#line 407 error("bad var id: status = %d", err); +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 407 start[j] = var_shape[i][j]; +#line 407 err = nc_get_vara_long(ncid, i, start, edge, value); +#line 407 IF (canConvert && err != NC_EINVALCOORDS) +#line 407 error("bad start: status = %d", err); +#line 407 start[j] = 0; +#line 407 } +#line 407 } +#line 407 err = nc_get_vara_long(ncid, i, start, edge, value); +#line 407 if (canConvert) { +#line 407 IF (err) +#line 407 error("%s", nc_strerror(err)); +#line 407 } else { +#line 407 IF (err != NC_ECHAR) +#line 407 error("wrong type: status = %d", err); +#line 407 } +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 edge[j] = 1; +#line 407 } +#line 407 } /* Choose a random point dividing each dim into 2 parts */ +#line 407 /* get 2^rank (nslabs) slabs so defined */ +#line 407 nslabs = 1; +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 mid[j] = roll( var_shape[i][j] ); +#line 407 nslabs *= 2; +#line 407 } +#line 407 /* bits of k determine whether to get lower or upper part of dim */ +#line 407 for (k = 0; k < nslabs; k++) { +#line 407 nels = 1; +#line 407 for (j = 0; j < var_rank[i]; j++) { +#line 407 if ((k >> j) & 1) { +#line 407 start[j] = 0; +#line 407 edge[j] = mid[j]; +#line 407 }else{ +#line 407 start[j] = mid[j]; +#line 407 edge[j] = var_shape[i][j] - mid[j]; +#line 407 } +#line 407 nels *= edge[j]; +#line 407 } +#line 407 allInExtRange = allInIntRange = 1; +#line 407 for (j = 0; j < nels; j++) { +#line 407 err = toMixedBase(j, var_rank[i], edge, index); +#line 407 IF (err) +#line 407 error("error in toMixedBase 1"); +#line 407 for (d = 0; d < var_rank[i]; d++) +#line 407 index[d] += start[d]; +#line 407 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_LONG); +#line 407 if (inRange3(expect[j],var_type[i], NCT_LONG)) { +#line 407 allInIntRange = allInIntRange && expect[j] >= long_min +#line 407 && expect[j] <= long_max; +#line 407 } else { +#line 407 allInExtRange = 0; +#line 407 } +#line 407 } +#line 407 if (var_rank[i] == 0 && i%2) +#line 407 err = nc_get_vara_long(ncid, i, NULL, NULL, value); +#line 407 else +#line 407 err = nc_get_vara_long(ncid, i, start, edge, value); +#line 407 if (canConvert) { +#line 407 if (allInExtRange) { +#line 407 if (allInIntRange) { +#line 407 IF (err) +#line 407 error("%s", nc_strerror(err)); +#line 407 } else { +#line 407 IF (err != NC_ERANGE) +#line 407 error("Range error: status = %d", err); +#line 407 } +#line 407 } else { +#line 407 IF (err != 0 && err != NC_ERANGE) +#line 407 error("OK or Range error: status = %d", err); +#line 407 } +#line 407 for (j = 0; j < nels; j++) { +#line 407 if (inRange3(expect[j],var_type[i],NCT_LONG) +#line 407 && expect[j] >= long_min && expect[j] <= long_max) { +#line 407 IF (!equal(value[j],expect[j],var_type[i],NCT_LONG)){ +#line 407 error("value read not that expected"); +#line 407 if (verbose) { +#line 407 error("\n"); +#line 407 error("varid: %d, ", i); +#line 407 error("var_name: %s, ", var_name[i]); +#line 407 error("element number: %d ", j); +#line 407 error("expect: %g", expect[j]); +#line 407 error("got: %g", (double) value[j]); +#line 407 } +#line 407 } else { +#line 407 nok++; +#line 407 } +#line 407 } +#line 407 } +#line 407 } else { +#line 407 IF (nels > 0 && err != NC_ECHAR) +#line 407 error("wrong type: status = %d", err); +#line 407 } +#line 407 } +#line 407 } +#line 407 err = nc_close(ncid); +#line 407 IF (err) +#line 407 error("nc_close: %s", nc_strerror(err)); +#line 407 print_nok(nok); +#line 407 } +#line 407 void +#line 408 test_nc_get_vara_float(void) +#line 408 { +#line 408 int ncid; +#line 408 int d; +#line 408 int i; +#line 408 int j; +#line 408 int k; +#line 408 int err; +#line 408 int allInExtRange; /* all values within external range? */ +#line 408 int allInIntRange; /* all values within internal range? */ +#line 408 int nels; +#line 408 int nslabs; +#line 408 int nok = 0; /* count of valid comparisons */ +#line 408 size_t start[MAX_RANK]; +#line 408 size_t edge[MAX_RANK]; +#line 408 size_t index[MAX_RANK]; +#line 408 size_t mid[MAX_RANK]; +#line 408 int canConvert; /* Both text or both numeric */ +#line 408 float value[MAX_NELS]; +#line 408 double expect[MAX_NELS]; +#line 408 +#line 408 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 408 IF (err) +#line 408 error("nc_open: %s", nc_strerror(err)); +#line 408 for (i = 0; i < NVARS; i++) { +#line 408 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 408 assert(var_rank[i] <= MAX_RANK); +#line 408 assert(var_nels[i] <= MAX_NELS); +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 start[j] = 0; +#line 408 edge[j] = 1; +#line 408 } +#line 408 err = nc_get_vara_float(BAD_ID, i, start, edge, value); +#line 408 IF (err != NC_EBADID) +#line 408 error("bad ncid: status = %d", err); +#line 408 err = nc_get_vara_float(ncid, BAD_VARID, start, edge, value); +#line 408 IF (err != NC_ENOTVAR) +#line 408 error("bad var id: status = %d", err); +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 start[j] = var_shape[i][j]; +#line 408 err = nc_get_vara_float(ncid, i, start, edge, value); +#line 408 IF (canConvert && err != NC_EINVALCOORDS) +#line 408 error("bad index: status = %d", err); +#line 408 start[j] = 0; +#line 408 edge[j] = var_shape[i][j] + 1; +#line 408 err = nc_get_vara_float(ncid, i, start, edge, value); +#line 408 IF (canConvert && err != NC_EEDGE) +#line 408 error("bad edge: status = %d", err); +#line 408 edge[j] = 1; +#line 408 } +#line 408 /* Check non-scalars for correct error returned even when */ +#line 408 /* there is nothing to get (edge[j]==0) */ +#line 408 if(var_rank[i] > 0) { +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 edge[j] = 0; +#line 408 } +#line 408 err = nc_get_vara_float(BAD_ID, i, start, edge, value); +#line 408 IF (err != NC_EBADID) +#line 408 error("bad ncid: status = %d", err); +#line 408 err = nc_get_vara_float(ncid, BAD_VARID, start, edge, value); +#line 408 IF (err != NC_ENOTVAR) +#line 408 error("bad var id: status = %d", err); +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 408 start[j] = var_shape[i][j]; +#line 408 err = nc_get_vara_float(ncid, i, start, edge, value); +#line 408 IF (canConvert && err != NC_EINVALCOORDS) +#line 408 error("bad start: status = %d", err); +#line 408 start[j] = 0; +#line 408 } +#line 408 } +#line 408 err = nc_get_vara_float(ncid, i, start, edge, value); +#line 408 if (canConvert) { +#line 408 IF (err) +#line 408 error("%s", nc_strerror(err)); +#line 408 } else { +#line 408 IF (err != NC_ECHAR) +#line 408 error("wrong type: status = %d", err); +#line 408 } +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 edge[j] = 1; +#line 408 } +#line 408 } /* Choose a random point dividing each dim into 2 parts */ +#line 408 /* get 2^rank (nslabs) slabs so defined */ +#line 408 nslabs = 1; +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 mid[j] = roll( var_shape[i][j] ); +#line 408 nslabs *= 2; +#line 408 } +#line 408 /* bits of k determine whether to get lower or upper part of dim */ +#line 408 for (k = 0; k < nslabs; k++) { +#line 408 nels = 1; +#line 408 for (j = 0; j < var_rank[i]; j++) { +#line 408 if ((k >> j) & 1) { +#line 408 start[j] = 0; +#line 408 edge[j] = mid[j]; +#line 408 }else{ +#line 408 start[j] = mid[j]; +#line 408 edge[j] = var_shape[i][j] - mid[j]; +#line 408 } +#line 408 nels *= edge[j]; +#line 408 } +#line 408 allInExtRange = allInIntRange = 1; +#line 408 for (j = 0; j < nels; j++) { +#line 408 err = toMixedBase(j, var_rank[i], edge, index); +#line 408 IF (err) +#line 408 error("error in toMixedBase 1"); +#line 408 for (d = 0; d < var_rank[i]; d++) +#line 408 index[d] += start[d]; +#line 408 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_FLOAT); +#line 408 if (inRange3(expect[j],var_type[i], NCT_FLOAT)) { +#line 408 allInIntRange = allInIntRange && expect[j] >= float_min +#line 408 && expect[j] <= float_max; +#line 408 } else { +#line 408 allInExtRange = 0; +#line 408 } +#line 408 } +#line 408 if (var_rank[i] == 0 && i%2) +#line 408 err = nc_get_vara_float(ncid, i, NULL, NULL, value); +#line 408 else +#line 408 err = nc_get_vara_float(ncid, i, start, edge, value); +#line 408 if (canConvert) { +#line 408 if (allInExtRange) { +#line 408 if (allInIntRange) { +#line 408 IF (err) +#line 408 error("%s", nc_strerror(err)); +#line 408 } else { +#line 408 IF (err != NC_ERANGE) +#line 408 error("Range error: status = %d", err); +#line 408 } +#line 408 } else { +#line 408 IF (err != 0 && err != NC_ERANGE) +#line 408 error("OK or Range error: status = %d", err); +#line 408 } +#line 408 for (j = 0; j < nels; j++) { +#line 408 if (inRange3(expect[j],var_type[i],NCT_FLOAT) +#line 408 && expect[j] >= float_min && expect[j] <= float_max) { +#line 408 IF (!equal(value[j],expect[j],var_type[i],NCT_FLOAT)){ +#line 408 error("value read not that expected"); +#line 408 if (verbose) { +#line 408 error("\n"); +#line 408 error("varid: %d, ", i); +#line 408 error("var_name: %s, ", var_name[i]); +#line 408 error("element number: %d ", j); +#line 408 error("expect: %g", expect[j]); +#line 408 error("got: %g", (double) value[j]); +#line 408 } +#line 408 } else { +#line 408 nok++; +#line 408 } +#line 408 } +#line 408 } +#line 408 } else { +#line 408 IF (nels > 0 && err != NC_ECHAR) +#line 408 error("wrong type: status = %d", err); +#line 408 } +#line 408 } +#line 408 } +#line 408 err = nc_close(ncid); +#line 408 IF (err) +#line 408 error("nc_close: %s", nc_strerror(err)); +#line 408 print_nok(nok); +#line 408 } +#line 408 void +#line 409 test_nc_get_vara_double(void) +#line 409 { +#line 409 int ncid; +#line 409 int d; +#line 409 int i; +#line 409 int j; +#line 409 int k; +#line 409 int err; +#line 409 int allInExtRange; /* all values within external range? */ +#line 409 int allInIntRange; /* all values within internal range? */ +#line 409 int nels; +#line 409 int nslabs; +#line 409 int nok = 0; /* count of valid comparisons */ +#line 409 size_t start[MAX_RANK]; +#line 409 size_t edge[MAX_RANK]; +#line 409 size_t index[MAX_RANK]; +#line 409 size_t mid[MAX_RANK]; +#line 409 int canConvert; /* Both text or both numeric */ +#line 409 double value[MAX_NELS]; +#line 409 double expect[MAX_NELS]; +#line 409 +#line 409 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 409 IF (err) +#line 409 error("nc_open: %s", nc_strerror(err)); +#line 409 for (i = 0; i < NVARS; i++) { +#line 409 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 409 assert(var_rank[i] <= MAX_RANK); +#line 409 assert(var_nels[i] <= MAX_NELS); +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 start[j] = 0; +#line 409 edge[j] = 1; +#line 409 } +#line 409 err = nc_get_vara_double(BAD_ID, i, start, edge, value); +#line 409 IF (err != NC_EBADID) +#line 409 error("bad ncid: status = %d", err); +#line 409 err = nc_get_vara_double(ncid, BAD_VARID, start, edge, value); +#line 409 IF (err != NC_ENOTVAR) +#line 409 error("bad var id: status = %d", err); +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 start[j] = var_shape[i][j]; +#line 409 err = nc_get_vara_double(ncid, i, start, edge, value); +#line 409 IF (canConvert && err != NC_EINVALCOORDS) +#line 409 error("bad index: status = %d", err); +#line 409 start[j] = 0; +#line 409 edge[j] = var_shape[i][j] + 1; +#line 409 err = nc_get_vara_double(ncid, i, start, edge, value); +#line 409 IF (canConvert && err != NC_EEDGE) +#line 409 error("bad edge: status = %d", err); +#line 409 edge[j] = 1; +#line 409 } +#line 409 /* Check non-scalars for correct error returned even when */ +#line 409 /* there is nothing to get (edge[j]==0) */ +#line 409 if(var_rank[i] > 0) { +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 edge[j] = 0; +#line 409 } +#line 409 err = nc_get_vara_double(BAD_ID, i, start, edge, value); +#line 409 IF (err != NC_EBADID) +#line 409 error("bad ncid: status = %d", err); +#line 409 err = nc_get_vara_double(ncid, BAD_VARID, start, edge, value); +#line 409 IF (err != NC_ENOTVAR) +#line 409 error("bad var id: status = %d", err); +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 409 start[j] = var_shape[i][j]; +#line 409 err = nc_get_vara_double(ncid, i, start, edge, value); +#line 409 IF (canConvert && err != NC_EINVALCOORDS) +#line 409 error("bad start: status = %d", err); +#line 409 start[j] = 0; +#line 409 } +#line 409 } +#line 409 err = nc_get_vara_double(ncid, i, start, edge, value); +#line 409 if (canConvert) { +#line 409 IF (err) +#line 409 error("%s", nc_strerror(err)); +#line 409 } else { +#line 409 IF (err != NC_ECHAR) +#line 409 error("wrong type: status = %d", err); +#line 409 } +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 edge[j] = 1; +#line 409 } +#line 409 } /* Choose a random point dividing each dim into 2 parts */ +#line 409 /* get 2^rank (nslabs) slabs so defined */ +#line 409 nslabs = 1; +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 mid[j] = roll( var_shape[i][j] ); +#line 409 nslabs *= 2; +#line 409 } +#line 409 /* bits of k determine whether to get lower or upper part of dim */ +#line 409 for (k = 0; k < nslabs; k++) { +#line 409 nels = 1; +#line 409 for (j = 0; j < var_rank[i]; j++) { +#line 409 if ((k >> j) & 1) { +#line 409 start[j] = 0; +#line 409 edge[j] = mid[j]; +#line 409 }else{ +#line 409 start[j] = mid[j]; +#line 409 edge[j] = var_shape[i][j] - mid[j]; +#line 409 } +#line 409 nels *= edge[j]; +#line 409 } +#line 409 allInExtRange = allInIntRange = 1; +#line 409 for (j = 0; j < nels; j++) { +#line 409 err = toMixedBase(j, var_rank[i], edge, index); +#line 409 IF (err) +#line 409 error("error in toMixedBase 1"); +#line 409 for (d = 0; d < var_rank[i]; d++) +#line 409 index[d] += start[d]; +#line 409 expect[j] = hash4(var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 409 if (inRange3(expect[j],var_type[i], NCT_DOUBLE)) { +#line 409 allInIntRange = allInIntRange && expect[j] >= double_min +#line 409 && expect[j] <= double_max; +#line 409 } else { +#line 409 allInExtRange = 0; +#line 409 } +#line 409 } +#line 409 if (var_rank[i] == 0 && i%2) +#line 409 err = nc_get_vara_double(ncid, i, NULL, NULL, value); +#line 409 else +#line 409 err = nc_get_vara_double(ncid, i, start, edge, value); +#line 409 if (canConvert) { +#line 409 if (allInExtRange) { +#line 409 if (allInIntRange) { +#line 409 IF (err) +#line 409 error("%s", nc_strerror(err)); +#line 409 } else { +#line 409 IF (err != NC_ERANGE) +#line 409 error("Range error: status = %d", err); +#line 409 } +#line 409 } else { +#line 409 IF (err != 0 && err != NC_ERANGE) +#line 409 error("OK or Range error: status = %d", err); +#line 409 } +#line 409 for (j = 0; j < nels; j++) { +#line 409 if (inRange3(expect[j],var_type[i],NCT_DOUBLE) +#line 409 && expect[j] >= double_min && expect[j] <= double_max) { +#line 409 IF (!equal(value[j],expect[j],var_type[i],NCT_DOUBLE)){ +#line 409 error("value read not that expected"); +#line 409 if (verbose) { +#line 409 error("\n"); +#line 409 error("varid: %d, ", i); +#line 409 error("var_name: %s, ", var_name[i]); +#line 409 error("element number: %d ", j); +#line 409 error("expect: %g", expect[j]); +#line 409 error("got: %g", (double) value[j]); +#line 409 } +#line 409 } else { +#line 409 nok++; +#line 409 } +#line 409 } +#line 409 } +#line 409 } else { +#line 409 IF (nels > 0 && err != NC_ECHAR) +#line 409 error("wrong type: status = %d", err); +#line 409 } +#line 409 } +#line 409 } +#line 409 err = nc_close(ncid); +#line 409 IF (err) +#line 409 error("nc_close: %s", nc_strerror(err)); +#line 409 print_nok(nok); +#line 409 } +#line 409 +#line 590 void +#line 591 test_nc_get_vars_text(void) +#line 591 { +#line 591 int ncid; +#line 591 int d; +#line 591 int i; +#line 591 int j; +#line 591 int k; +#line 591 int m; +#line 591 int err; +#line 591 int allInExtRange; /* all values within external range? */ +#line 591 int allInIntRange; /* all values within internal range? */ +#line 591 int nels; +#line 591 int nslabs; +#line 591 int nstarts; /* number of different starts */ +#line 591 int nok = 0; /* count of valid comparisons */ +#line 591 size_t start[MAX_RANK]; +#line 591 size_t edge[MAX_RANK]; +#line 591 size_t index[MAX_RANK]; +#line 591 size_t index2[MAX_RANK]; +#line 591 size_t mid[MAX_RANK]; +#line 591 size_t count[MAX_RANK]; +#line 591 size_t sstride[MAX_RANK]; +#line 591 ptrdiff_t stride[MAX_RANK]; +#line 591 int canConvert; /* Both text or both numeric */ +#line 591 text value[MAX_NELS]; +#line 591 double expect[MAX_NELS]; +#line 591 +#line 591 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 591 IF (err) +#line 591 error("nc_open: %s", nc_strerror(err)); +#line 591 for (i = 0; i < NVARS; i++) { +#line 591 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 591 assert(var_rank[i] <= MAX_RANK); +#line 591 assert(var_nels[i] <= MAX_NELS); +#line 591 for (j = 0; j < var_rank[i]; j++) { +#line 591 start[j] = 0; +#line 591 edge[j] = 1; +#line 591 stride[j] = 1; +#line 591 } +#line 591 err = nc_get_vars_text(BAD_ID, i, start, edge, stride, value); +#line 591 IF (err != NC_EBADID) +#line 591 error("bad ncid: status = %d", err); +#line 591 err = nc_get_vars_text(ncid, BAD_VARID, start, edge, stride, value); +#line 591 IF (err != NC_ENOTVAR) +#line 591 error("bad var id: status = %d", err); +#line 591 for (j = 0; j < var_rank[i]; j++) { +#line 591 start[j] = var_shape[i][j]; +#line 591 err = nc_get_vars_text(ncid, i, start, edge, stride, value); +#line 591 if(!canConvert) { +#line 591 IF (err != NC_ECHAR) +#line 591 error("conversion: status = %d", err); +#line 591 } else { +#line 591 IF (err != NC_EINVALCOORDS) +#line 591 error("bad index: status = %d", err); +#line 591 start[j] = 0; +#line 591 edge[j] = var_shape[i][j] + 1; +#line 591 err = nc_get_vars_text(ncid, i, start, edge, stride, value); +#line 591 IF (err != NC_EEDGE) +#line 591 error("bad edge: status = %d", err); +#line 591 edge[j] = 1; +#line 591 stride[j] = 0; +#line 591 err = nc_get_vars_text(ncid, i, start, edge, stride, value); +#line 591 IF (err != NC_ESTRIDE) +#line 591 error("bad stride: status = %d", err); +#line 591 stride[j] = 1; +#line 591 } +#line 591 } +#line 591 /* Choose a random point dividing each dim into 2 parts */ +#line 591 /* get 2^rank (nslabs) slabs so defined */ +#line 591 nslabs = 1; +#line 591 for (j = 0; j < var_rank[i]; j++) { +#line 591 mid[j] = roll( var_shape[i][j] ); +#line 591 nslabs *= 2; +#line 591 } +#line 591 /* bits of k determine whether to get lower or upper part of dim */ +#line 591 /* choose random stride from 1 to edge */ +#line 591 for (k = 0; k < nslabs; k++) { +#line 591 nstarts = 1; +#line 591 for (j = 0; j < var_rank[i]; j++) { +#line 591 if ((k >> j) & 1) { +#line 591 start[j] = 0; +#line 591 edge[j] = mid[j]; +#line 591 }else{ +#line 591 start[j] = mid[j]; +#line 591 edge[j] = var_shape[i][j] - mid[j]; +#line 591 } +#line 591 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 591 nstarts *= stride[j]; +#line 591 } +#line 591 for (m = 0; m < nstarts; m++) { +#line 591 err = toMixedBase(m, var_rank[i], sstride, index); +#line 591 IF (err) +#line 591 error("error in toMixedBase"); +#line 591 nels = 1; +#line 591 for (j = 0; j < var_rank[i]; j++) { +#line 591 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 591 nels *= count[j]; +#line 591 index[j] += start[j]; +#line 591 } +#line 591 /* Random choice of forward or backward */ +#line 591 /* TODO +#line 591 if ( roll(2) ) { +#line 591 for (j = 0; j < var_rank[i]; j++) { +#line 591 index[j] += (count[j] - 1) * stride[j]; +#line 591 stride[j] = -stride[j]; +#line 591 } +#line 591 } +#line 591 */ +#line 591 allInExtRange = allInIntRange = 1; +#line 591 for (j = 0; j < nels; j++) { +#line 591 err = toMixedBase(j, var_rank[i], count, index2); +#line 591 IF (err) +#line 591 error("error in toMixedBase 1"); +#line 591 for (d = 0; d < var_rank[i]; d++) +#line 591 index2[d] = index[d] + index2[d] * stride[d]; +#line 591 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 591 NCT_TEXT); +#line 591 if (inRange3(expect[j],var_type[i],NCT_TEXT)) { +#line 591 allInIntRange = allInIntRange && expect[j] >= text_min +#line 591 && expect[j] <= text_max; +#line 591 } else { +#line 591 allInExtRange = 0; +#line 591 } +#line 591 } +#line 591 if (var_rank[i] == 0 && i%2 ) +#line 591 err = nc_get_vars_text(ncid, i, NULL, NULL, NULL, value); +#line 591 else +#line 591 err = nc_get_vars_text(ncid, i, index, count, stride, value); +#line 591 if (canConvert) { +#line 591 if (allInExtRange) { +#line 591 if (allInIntRange) { +#line 591 IF (err) +#line 591 error("%s", nc_strerror(err)); +#line 591 } else { +#line 591 IF (err != NC_ERANGE) +#line 591 error("Range error: status = %d", err); +#line 591 } +#line 591 } else { +#line 591 IF (err != 0 && err != NC_ERANGE) +#line 591 error("OK or Range error: status = %d", err); +#line 591 } +#line 591 for (j = 0; j < nels; j++) { +#line 591 if (inRange3(expect[j],var_type[i],NCT_TEXT) +#line 591 && expect[j] >= text_min && expect[j] <= text_max) { +#line 591 IF (!equal(value[j],expect[j],var_type[i], NCT_TEXT)){ +#line 591 error("value read not that expected"); +#line 591 if (verbose) { +#line 591 error("\n"); +#line 591 error("varid: %d, ", i); +#line 591 error("var_name: %s, ", var_name[i]); +#line 591 error("element number: %d ", j); +#line 591 error("expect: %g, ", expect[j]); +#line 591 error("got: %g", (double) value[j]); +#line 591 } +#line 591 } else { +#line 591 nok++; +#line 591 } +#line 591 } +#line 591 } +#line 591 } else { +#line 591 IF (nels > 0 && err != NC_ECHAR) +#line 591 error("wrong type: status = %d", err); +#line 591 } +#line 591 } +#line 591 } +#line 591 +#line 591 } +#line 591 err = nc_close(ncid); +#line 591 IF (err) +#line 591 error("nc_close: %s", nc_strerror(err)); +#line 591 print_nok(nok); +#line 591 } +#line 591 void +#line 592 test_nc_get_vars_uchar(void) +#line 592 { +#line 592 int ncid; +#line 592 int d; +#line 592 int i; +#line 592 int j; +#line 592 int k; +#line 592 int m; +#line 592 int err; +#line 592 int allInExtRange; /* all values within external range? */ +#line 592 int allInIntRange; /* all values within internal range? */ +#line 592 int nels; +#line 592 int nslabs; +#line 592 int nstarts; /* number of different starts */ +#line 592 int nok = 0; /* count of valid comparisons */ +#line 592 size_t start[MAX_RANK]; +#line 592 size_t edge[MAX_RANK]; +#line 592 size_t index[MAX_RANK]; +#line 592 size_t index2[MAX_RANK]; +#line 592 size_t mid[MAX_RANK]; +#line 592 size_t count[MAX_RANK]; +#line 592 size_t sstride[MAX_RANK]; +#line 592 ptrdiff_t stride[MAX_RANK]; +#line 592 int canConvert; /* Both text or both numeric */ +#line 592 uchar value[MAX_NELS]; +#line 592 double expect[MAX_NELS]; +#line 592 +#line 592 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 592 IF (err) +#line 592 error("nc_open: %s", nc_strerror(err)); +#line 592 for (i = 0; i < NVARS; i++) { +#line 592 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 592 assert(var_rank[i] <= MAX_RANK); +#line 592 assert(var_nels[i] <= MAX_NELS); +#line 592 for (j = 0; j < var_rank[i]; j++) { +#line 592 start[j] = 0; +#line 592 edge[j] = 1; +#line 592 stride[j] = 1; +#line 592 } +#line 592 err = nc_get_vars_uchar(BAD_ID, i, start, edge, stride, value); +#line 592 IF (err != NC_EBADID) +#line 592 error("bad ncid: status = %d", err); +#line 592 err = nc_get_vars_uchar(ncid, BAD_VARID, start, edge, stride, value); +#line 592 IF (err != NC_ENOTVAR) +#line 592 error("bad var id: status = %d", err); +#line 592 for (j = 0; j < var_rank[i]; j++) { +#line 592 start[j] = var_shape[i][j]; +#line 592 err = nc_get_vars_uchar(ncid, i, start, edge, stride, value); +#line 592 if(!canConvert) { +#line 592 IF (err != NC_ECHAR) +#line 592 error("conversion: status = %d", err); +#line 592 } else { +#line 592 IF (err != NC_EINVALCOORDS) +#line 592 error("bad index: status = %d", err); +#line 592 start[j] = 0; +#line 592 edge[j] = var_shape[i][j] + 1; +#line 592 err = nc_get_vars_uchar(ncid, i, start, edge, stride, value); +#line 592 IF (err != NC_EEDGE) +#line 592 error("bad edge: status = %d", err); +#line 592 edge[j] = 1; +#line 592 stride[j] = 0; +#line 592 err = nc_get_vars_uchar(ncid, i, start, edge, stride, value); +#line 592 IF (err != NC_ESTRIDE) +#line 592 error("bad stride: status = %d", err); +#line 592 stride[j] = 1; +#line 592 } +#line 592 } +#line 592 /* Choose a random point dividing each dim into 2 parts */ +#line 592 /* get 2^rank (nslabs) slabs so defined */ +#line 592 nslabs = 1; +#line 592 for (j = 0; j < var_rank[i]; j++) { +#line 592 mid[j] = roll( var_shape[i][j] ); +#line 592 nslabs *= 2; +#line 592 } +#line 592 /* bits of k determine whether to get lower or upper part of dim */ +#line 592 /* choose random stride from 1 to edge */ +#line 592 for (k = 0; k < nslabs; k++) { +#line 592 nstarts = 1; +#line 592 for (j = 0; j < var_rank[i]; j++) { +#line 592 if ((k >> j) & 1) { +#line 592 start[j] = 0; +#line 592 edge[j] = mid[j]; +#line 592 }else{ +#line 592 start[j] = mid[j]; +#line 592 edge[j] = var_shape[i][j] - mid[j]; +#line 592 } +#line 592 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 592 nstarts *= stride[j]; +#line 592 } +#line 592 for (m = 0; m < nstarts; m++) { +#line 592 err = toMixedBase(m, var_rank[i], sstride, index); +#line 592 IF (err) +#line 592 error("error in toMixedBase"); +#line 592 nels = 1; +#line 592 for (j = 0; j < var_rank[i]; j++) { +#line 592 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 592 nels *= count[j]; +#line 592 index[j] += start[j]; +#line 592 } +#line 592 /* Random choice of forward or backward */ +#line 592 /* TODO +#line 592 if ( roll(2) ) { +#line 592 for (j = 0; j < var_rank[i]; j++) { +#line 592 index[j] += (count[j] - 1) * stride[j]; +#line 592 stride[j] = -stride[j]; +#line 592 } +#line 592 } +#line 592 */ +#line 592 allInExtRange = allInIntRange = 1; +#line 592 for (j = 0; j < nels; j++) { +#line 592 err = toMixedBase(j, var_rank[i], count, index2); +#line 592 IF (err) +#line 592 error("error in toMixedBase 1"); +#line 592 for (d = 0; d < var_rank[i]; d++) +#line 592 index2[d] = index[d] + index2[d] * stride[d]; +#line 592 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 592 NCT_UCHAR); +#line 592 if (inRange3(expect[j],var_type[i],NCT_UCHAR)) { +#line 592 allInIntRange = allInIntRange && expect[j] >= uchar_min +#line 592 && expect[j] <= uchar_max; +#line 592 } else { +#line 592 allInExtRange = 0; +#line 592 } +#line 592 } +#line 592 if (var_rank[i] == 0 && i%2 ) +#line 592 err = nc_get_vars_uchar(ncid, i, NULL, NULL, NULL, value); +#line 592 else +#line 592 err = nc_get_vars_uchar(ncid, i, index, count, stride, value); +#line 592 if (canConvert) { +#line 592 if (allInExtRange) { +#line 592 if (allInIntRange) { +#line 592 IF (err) +#line 592 error("%s", nc_strerror(err)); +#line 592 } else { +#line 592 IF (err != NC_ERANGE) +#line 592 error("Range error: status = %d", err); +#line 592 } +#line 592 } else { +#line 592 IF (err != 0 && err != NC_ERANGE) +#line 592 error("OK or Range error: status = %d", err); +#line 592 } +#line 592 for (j = 0; j < nels; j++) { +#line 592 if (inRange3(expect[j],var_type[i],NCT_UCHAR) +#line 592 && expect[j] >= uchar_min && expect[j] <= uchar_max) { +#line 592 IF (!equal(value[j],expect[j],var_type[i], NCT_UCHAR)){ +#line 592 error("value read not that expected"); +#line 592 if (verbose) { +#line 592 error("\n"); +#line 592 error("varid: %d, ", i); +#line 592 error("var_name: %s, ", var_name[i]); +#line 592 error("element number: %d ", j); +#line 592 error("expect: %g, ", expect[j]); +#line 592 error("got: %g", (double) value[j]); +#line 592 } +#line 592 } else { +#line 592 nok++; +#line 592 } +#line 592 } +#line 592 } +#line 592 } else { +#line 592 IF (nels > 0 && err != NC_ECHAR) +#line 592 error("wrong type: status = %d", err); +#line 592 } +#line 592 } +#line 592 } +#line 592 +#line 592 } +#line 592 err = nc_close(ncid); +#line 592 IF (err) +#line 592 error("nc_close: %s", nc_strerror(err)); +#line 592 print_nok(nok); +#line 592 } +#line 592 void +#line 593 test_nc_get_vars_schar(void) +#line 593 { +#line 593 int ncid; +#line 593 int d; +#line 593 int i; +#line 593 int j; +#line 593 int k; +#line 593 int m; +#line 593 int err; +#line 593 int allInExtRange; /* all values within external range? */ +#line 593 int allInIntRange; /* all values within internal range? */ +#line 593 int nels; +#line 593 int nslabs; +#line 593 int nstarts; /* number of different starts */ +#line 593 int nok = 0; /* count of valid comparisons */ +#line 593 size_t start[MAX_RANK]; +#line 593 size_t edge[MAX_RANK]; +#line 593 size_t index[MAX_RANK]; +#line 593 size_t index2[MAX_RANK]; +#line 593 size_t mid[MAX_RANK]; +#line 593 size_t count[MAX_RANK]; +#line 593 size_t sstride[MAX_RANK]; +#line 593 ptrdiff_t stride[MAX_RANK]; +#line 593 int canConvert; /* Both text or both numeric */ +#line 593 schar value[MAX_NELS]; +#line 593 double expect[MAX_NELS]; +#line 593 +#line 593 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 593 IF (err) +#line 593 error("nc_open: %s", nc_strerror(err)); +#line 593 for (i = 0; i < NVARS; i++) { +#line 593 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 593 assert(var_rank[i] <= MAX_RANK); +#line 593 assert(var_nels[i] <= MAX_NELS); +#line 593 for (j = 0; j < var_rank[i]; j++) { +#line 593 start[j] = 0; +#line 593 edge[j] = 1; +#line 593 stride[j] = 1; +#line 593 } +#line 593 err = nc_get_vars_schar(BAD_ID, i, start, edge, stride, value); +#line 593 IF (err != NC_EBADID) +#line 593 error("bad ncid: status = %d", err); +#line 593 err = nc_get_vars_schar(ncid, BAD_VARID, start, edge, stride, value); +#line 593 IF (err != NC_ENOTVAR) +#line 593 error("bad var id: status = %d", err); +#line 593 for (j = 0; j < var_rank[i]; j++) { +#line 593 start[j] = var_shape[i][j]; +#line 593 err = nc_get_vars_schar(ncid, i, start, edge, stride, value); +#line 593 if(!canConvert) { +#line 593 IF (err != NC_ECHAR) +#line 593 error("conversion: status = %d", err); +#line 593 } else { +#line 593 IF (err != NC_EINVALCOORDS) +#line 593 error("bad index: status = %d", err); +#line 593 start[j] = 0; +#line 593 edge[j] = var_shape[i][j] + 1; +#line 593 err = nc_get_vars_schar(ncid, i, start, edge, stride, value); +#line 593 IF (err != NC_EEDGE) +#line 593 error("bad edge: status = %d", err); +#line 593 edge[j] = 1; +#line 593 stride[j] = 0; +#line 593 err = nc_get_vars_schar(ncid, i, start, edge, stride, value); +#line 593 IF (err != NC_ESTRIDE) +#line 593 error("bad stride: status = %d", err); +#line 593 stride[j] = 1; +#line 593 } +#line 593 } +#line 593 /* Choose a random point dividing each dim into 2 parts */ +#line 593 /* get 2^rank (nslabs) slabs so defined */ +#line 593 nslabs = 1; +#line 593 for (j = 0; j < var_rank[i]; j++) { +#line 593 mid[j] = roll( var_shape[i][j] ); +#line 593 nslabs *= 2; +#line 593 } +#line 593 /* bits of k determine whether to get lower or upper part of dim */ +#line 593 /* choose random stride from 1 to edge */ +#line 593 for (k = 0; k < nslabs; k++) { +#line 593 nstarts = 1; +#line 593 for (j = 0; j < var_rank[i]; j++) { +#line 593 if ((k >> j) & 1) { +#line 593 start[j] = 0; +#line 593 edge[j] = mid[j]; +#line 593 }else{ +#line 593 start[j] = mid[j]; +#line 593 edge[j] = var_shape[i][j] - mid[j]; +#line 593 } +#line 593 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 593 nstarts *= stride[j]; +#line 593 } +#line 593 for (m = 0; m < nstarts; m++) { +#line 593 err = toMixedBase(m, var_rank[i], sstride, index); +#line 593 IF (err) +#line 593 error("error in toMixedBase"); +#line 593 nels = 1; +#line 593 for (j = 0; j < var_rank[i]; j++) { +#line 593 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 593 nels *= count[j]; +#line 593 index[j] += start[j]; +#line 593 } +#line 593 /* Random choice of forward or backward */ +#line 593 /* TODO +#line 593 if ( roll(2) ) { +#line 593 for (j = 0; j < var_rank[i]; j++) { +#line 593 index[j] += (count[j] - 1) * stride[j]; +#line 593 stride[j] = -stride[j]; +#line 593 } +#line 593 } +#line 593 */ +#line 593 allInExtRange = allInIntRange = 1; +#line 593 for (j = 0; j < nels; j++) { +#line 593 err = toMixedBase(j, var_rank[i], count, index2); +#line 593 IF (err) +#line 593 error("error in toMixedBase 1"); +#line 593 for (d = 0; d < var_rank[i]; d++) +#line 593 index2[d] = index[d] + index2[d] * stride[d]; +#line 593 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 593 NCT_SCHAR); +#line 593 if (inRange3(expect[j],var_type[i],NCT_SCHAR)) { +#line 593 allInIntRange = allInIntRange && expect[j] >= schar_min +#line 593 && expect[j] <= schar_max; +#line 593 } else { +#line 593 allInExtRange = 0; +#line 593 } +#line 593 } +#line 593 if (var_rank[i] == 0 && i%2 ) +#line 593 err = nc_get_vars_schar(ncid, i, NULL, NULL, NULL, value); +#line 593 else +#line 593 err = nc_get_vars_schar(ncid, i, index, count, stride, value); +#line 593 if (canConvert) { +#line 593 if (allInExtRange) { +#line 593 if (allInIntRange) { +#line 593 IF (err) +#line 593 error("%s", nc_strerror(err)); +#line 593 } else { +#line 593 IF (err != NC_ERANGE) +#line 593 error("Range error: status = %d", err); +#line 593 } +#line 593 } else { +#line 593 IF (err != 0 && err != NC_ERANGE) +#line 593 error("OK or Range error: status = %d", err); +#line 593 } +#line 593 for (j = 0; j < nels; j++) { +#line 593 if (inRange3(expect[j],var_type[i],NCT_SCHAR) +#line 593 && expect[j] >= schar_min && expect[j] <= schar_max) { +#line 593 IF (!equal(value[j],expect[j],var_type[i], NCT_SCHAR)){ +#line 593 error("value read not that expected"); +#line 593 if (verbose) { +#line 593 error("\n"); +#line 593 error("varid: %d, ", i); +#line 593 error("var_name: %s, ", var_name[i]); +#line 593 error("element number: %d ", j); +#line 593 error("expect: %g, ", expect[j]); +#line 593 error("got: %g", (double) value[j]); +#line 593 } +#line 593 } else { +#line 593 nok++; +#line 593 } +#line 593 } +#line 593 } +#line 593 } else { +#line 593 IF (nels > 0 && err != NC_ECHAR) +#line 593 error("wrong type: status = %d", err); +#line 593 } +#line 593 } +#line 593 } +#line 593 +#line 593 } +#line 593 err = nc_close(ncid); +#line 593 IF (err) +#line 593 error("nc_close: %s", nc_strerror(err)); +#line 593 print_nok(nok); +#line 593 } +#line 593 void +#line 594 test_nc_get_vars_short(void) +#line 594 { +#line 594 int ncid; +#line 594 int d; +#line 594 int i; +#line 594 int j; +#line 594 int k; +#line 594 int m; +#line 594 int err; +#line 594 int allInExtRange; /* all values within external range? */ +#line 594 int allInIntRange; /* all values within internal range? */ +#line 594 int nels; +#line 594 int nslabs; +#line 594 int nstarts; /* number of different starts */ +#line 594 int nok = 0; /* count of valid comparisons */ +#line 594 size_t start[MAX_RANK]; +#line 594 size_t edge[MAX_RANK]; +#line 594 size_t index[MAX_RANK]; +#line 594 size_t index2[MAX_RANK]; +#line 594 size_t mid[MAX_RANK]; +#line 594 size_t count[MAX_RANK]; +#line 594 size_t sstride[MAX_RANK]; +#line 594 ptrdiff_t stride[MAX_RANK]; +#line 594 int canConvert; /* Both text or both numeric */ +#line 594 short value[MAX_NELS]; +#line 594 double expect[MAX_NELS]; +#line 594 +#line 594 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 594 IF (err) +#line 594 error("nc_open: %s", nc_strerror(err)); +#line 594 for (i = 0; i < NVARS; i++) { +#line 594 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 594 assert(var_rank[i] <= MAX_RANK); +#line 594 assert(var_nels[i] <= MAX_NELS); +#line 594 for (j = 0; j < var_rank[i]; j++) { +#line 594 start[j] = 0; +#line 594 edge[j] = 1; +#line 594 stride[j] = 1; +#line 594 } +#line 594 err = nc_get_vars_short(BAD_ID, i, start, edge, stride, value); +#line 594 IF (err != NC_EBADID) +#line 594 error("bad ncid: status = %d", err); +#line 594 err = nc_get_vars_short(ncid, BAD_VARID, start, edge, stride, value); +#line 594 IF (err != NC_ENOTVAR) +#line 594 error("bad var id: status = %d", err); +#line 594 for (j = 0; j < var_rank[i]; j++) { +#line 594 start[j] = var_shape[i][j]; +#line 594 err = nc_get_vars_short(ncid, i, start, edge, stride, value); +#line 594 if(!canConvert) { +#line 594 IF (err != NC_ECHAR) +#line 594 error("conversion: status = %d", err); +#line 594 } else { +#line 594 IF (err != NC_EINVALCOORDS) +#line 594 error("bad index: status = %d", err); +#line 594 start[j] = 0; +#line 594 edge[j] = var_shape[i][j] + 1; +#line 594 err = nc_get_vars_short(ncid, i, start, edge, stride, value); +#line 594 IF (err != NC_EEDGE) +#line 594 error("bad edge: status = %d", err); +#line 594 edge[j] = 1; +#line 594 stride[j] = 0; +#line 594 err = nc_get_vars_short(ncid, i, start, edge, stride, value); +#line 594 IF (err != NC_ESTRIDE) +#line 594 error("bad stride: status = %d", err); +#line 594 stride[j] = 1; +#line 594 } +#line 594 } +#line 594 /* Choose a random point dividing each dim into 2 parts */ +#line 594 /* get 2^rank (nslabs) slabs so defined */ +#line 594 nslabs = 1; +#line 594 for (j = 0; j < var_rank[i]; j++) { +#line 594 mid[j] = roll( var_shape[i][j] ); +#line 594 nslabs *= 2; +#line 594 } +#line 594 /* bits of k determine whether to get lower or upper part of dim */ +#line 594 /* choose random stride from 1 to edge */ +#line 594 for (k = 0; k < nslabs; k++) { +#line 594 nstarts = 1; +#line 594 for (j = 0; j < var_rank[i]; j++) { +#line 594 if ((k >> j) & 1) { +#line 594 start[j] = 0; +#line 594 edge[j] = mid[j]; +#line 594 }else{ +#line 594 start[j] = mid[j]; +#line 594 edge[j] = var_shape[i][j] - mid[j]; +#line 594 } +#line 594 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 594 nstarts *= stride[j]; +#line 594 } +#line 594 for (m = 0; m < nstarts; m++) { +#line 594 err = toMixedBase(m, var_rank[i], sstride, index); +#line 594 IF (err) +#line 594 error("error in toMixedBase"); +#line 594 nels = 1; +#line 594 for (j = 0; j < var_rank[i]; j++) { +#line 594 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 594 nels *= count[j]; +#line 594 index[j] += start[j]; +#line 594 } +#line 594 /* Random choice of forward or backward */ +#line 594 /* TODO +#line 594 if ( roll(2) ) { +#line 594 for (j = 0; j < var_rank[i]; j++) { +#line 594 index[j] += (count[j] - 1) * stride[j]; +#line 594 stride[j] = -stride[j]; +#line 594 } +#line 594 } +#line 594 */ +#line 594 allInExtRange = allInIntRange = 1; +#line 594 for (j = 0; j < nels; j++) { +#line 594 err = toMixedBase(j, var_rank[i], count, index2); +#line 594 IF (err) +#line 594 error("error in toMixedBase 1"); +#line 594 for (d = 0; d < var_rank[i]; d++) +#line 594 index2[d] = index[d] + index2[d] * stride[d]; +#line 594 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 594 NCT_SHORT); +#line 594 if (inRange3(expect[j],var_type[i],NCT_SHORT)) { +#line 594 allInIntRange = allInIntRange && expect[j] >= short_min +#line 594 && expect[j] <= short_max; +#line 594 } else { +#line 594 allInExtRange = 0; +#line 594 } +#line 594 } +#line 594 if (var_rank[i] == 0 && i%2 ) +#line 594 err = nc_get_vars_short(ncid, i, NULL, NULL, NULL, value); +#line 594 else +#line 594 err = nc_get_vars_short(ncid, i, index, count, stride, value); +#line 594 if (canConvert) { +#line 594 if (allInExtRange) { +#line 594 if (allInIntRange) { +#line 594 IF (err) +#line 594 error("%s", nc_strerror(err)); +#line 594 } else { +#line 594 IF (err != NC_ERANGE) +#line 594 error("Range error: status = %d", err); +#line 594 } +#line 594 } else { +#line 594 IF (err != 0 && err != NC_ERANGE) +#line 594 error("OK or Range error: status = %d", err); +#line 594 } +#line 594 for (j = 0; j < nels; j++) { +#line 594 if (inRange3(expect[j],var_type[i],NCT_SHORT) +#line 594 && expect[j] >= short_min && expect[j] <= short_max) { +#line 594 IF (!equal(value[j],expect[j],var_type[i], NCT_SHORT)){ +#line 594 error("value read not that expected"); +#line 594 if (verbose) { +#line 594 error("\n"); +#line 594 error("varid: %d, ", i); +#line 594 error("var_name: %s, ", var_name[i]); +#line 594 error("element number: %d ", j); +#line 594 error("expect: %g, ", expect[j]); +#line 594 error("got: %g", (double) value[j]); +#line 594 } +#line 594 } else { +#line 594 nok++; +#line 594 } +#line 594 } +#line 594 } +#line 594 } else { +#line 594 IF (nels > 0 && err != NC_ECHAR) +#line 594 error("wrong type: status = %d", err); +#line 594 } +#line 594 } +#line 594 } +#line 594 +#line 594 } +#line 594 err = nc_close(ncid); +#line 594 IF (err) +#line 594 error("nc_close: %s", nc_strerror(err)); +#line 594 print_nok(nok); +#line 594 } +#line 594 void +#line 595 test_nc_get_vars_int(void) +#line 595 { +#line 595 int ncid; +#line 595 int d; +#line 595 int i; +#line 595 int j; +#line 595 int k; +#line 595 int m; +#line 595 int err; +#line 595 int allInExtRange; /* all values within external range? */ +#line 595 int allInIntRange; /* all values within internal range? */ +#line 595 int nels; +#line 595 int nslabs; +#line 595 int nstarts; /* number of different starts */ +#line 595 int nok = 0; /* count of valid comparisons */ +#line 595 size_t start[MAX_RANK]; +#line 595 size_t edge[MAX_RANK]; +#line 595 size_t index[MAX_RANK]; +#line 595 size_t index2[MAX_RANK]; +#line 595 size_t mid[MAX_RANK]; +#line 595 size_t count[MAX_RANK]; +#line 595 size_t sstride[MAX_RANK]; +#line 595 ptrdiff_t stride[MAX_RANK]; +#line 595 int canConvert; /* Both text or both numeric */ +#line 595 int value[MAX_NELS]; +#line 595 double expect[MAX_NELS]; +#line 595 +#line 595 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 595 IF (err) +#line 595 error("nc_open: %s", nc_strerror(err)); +#line 595 for (i = 0; i < NVARS; i++) { +#line 595 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 595 assert(var_rank[i] <= MAX_RANK); +#line 595 assert(var_nels[i] <= MAX_NELS); +#line 595 for (j = 0; j < var_rank[i]; j++) { +#line 595 start[j] = 0; +#line 595 edge[j] = 1; +#line 595 stride[j] = 1; +#line 595 } +#line 595 err = nc_get_vars_int(BAD_ID, i, start, edge, stride, value); +#line 595 IF (err != NC_EBADID) +#line 595 error("bad ncid: status = %d", err); +#line 595 err = nc_get_vars_int(ncid, BAD_VARID, start, edge, stride, value); +#line 595 IF (err != NC_ENOTVAR) +#line 595 error("bad var id: status = %d", err); +#line 595 for (j = 0; j < var_rank[i]; j++) { +#line 595 start[j] = var_shape[i][j]; +#line 595 err = nc_get_vars_int(ncid, i, start, edge, stride, value); +#line 595 if(!canConvert) { +#line 595 IF (err != NC_ECHAR) +#line 595 error("conversion: status = %d", err); +#line 595 } else { +#line 595 IF (err != NC_EINVALCOORDS) +#line 595 error("bad index: status = %d", err); +#line 595 start[j] = 0; +#line 595 edge[j] = var_shape[i][j] + 1; +#line 595 err = nc_get_vars_int(ncid, i, start, edge, stride, value); +#line 595 IF (err != NC_EEDGE) +#line 595 error("bad edge: status = %d", err); +#line 595 edge[j] = 1; +#line 595 stride[j] = 0; +#line 595 err = nc_get_vars_int(ncid, i, start, edge, stride, value); +#line 595 IF (err != NC_ESTRIDE) +#line 595 error("bad stride: status = %d", err); +#line 595 stride[j] = 1; +#line 595 } +#line 595 } +#line 595 /* Choose a random point dividing each dim into 2 parts */ +#line 595 /* get 2^rank (nslabs) slabs so defined */ +#line 595 nslabs = 1; +#line 595 for (j = 0; j < var_rank[i]; j++) { +#line 595 mid[j] = roll( var_shape[i][j] ); +#line 595 nslabs *= 2; +#line 595 } +#line 595 /* bits of k determine whether to get lower or upper part of dim */ +#line 595 /* choose random stride from 1 to edge */ +#line 595 for (k = 0; k < nslabs; k++) { +#line 595 nstarts = 1; +#line 595 for (j = 0; j < var_rank[i]; j++) { +#line 595 if ((k >> j) & 1) { +#line 595 start[j] = 0; +#line 595 edge[j] = mid[j]; +#line 595 }else{ +#line 595 start[j] = mid[j]; +#line 595 edge[j] = var_shape[i][j] - mid[j]; +#line 595 } +#line 595 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 595 nstarts *= stride[j]; +#line 595 } +#line 595 for (m = 0; m < nstarts; m++) { +#line 595 err = toMixedBase(m, var_rank[i], sstride, index); +#line 595 IF (err) +#line 595 error("error in toMixedBase"); +#line 595 nels = 1; +#line 595 for (j = 0; j < var_rank[i]; j++) { +#line 595 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 595 nels *= count[j]; +#line 595 index[j] += start[j]; +#line 595 } +#line 595 /* Random choice of forward or backward */ +#line 595 /* TODO +#line 595 if ( roll(2) ) { +#line 595 for (j = 0; j < var_rank[i]; j++) { +#line 595 index[j] += (count[j] - 1) * stride[j]; +#line 595 stride[j] = -stride[j]; +#line 595 } +#line 595 } +#line 595 */ +#line 595 allInExtRange = allInIntRange = 1; +#line 595 for (j = 0; j < nels; j++) { +#line 595 err = toMixedBase(j, var_rank[i], count, index2); +#line 595 IF (err) +#line 595 error("error in toMixedBase 1"); +#line 595 for (d = 0; d < var_rank[i]; d++) +#line 595 index2[d] = index[d] + index2[d] * stride[d]; +#line 595 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 595 NCT_INT); +#line 595 if (inRange3(expect[j],var_type[i],NCT_INT)) { +#line 595 allInIntRange = allInIntRange && expect[j] >= int_min +#line 595 && expect[j] <= int_max; +#line 595 } else { +#line 595 allInExtRange = 0; +#line 595 } +#line 595 } +#line 595 if (var_rank[i] == 0 && i%2 ) +#line 595 err = nc_get_vars_int(ncid, i, NULL, NULL, NULL, value); +#line 595 else +#line 595 err = nc_get_vars_int(ncid, i, index, count, stride, value); +#line 595 if (canConvert) { +#line 595 if (allInExtRange) { +#line 595 if (allInIntRange) { +#line 595 IF (err) +#line 595 error("%s", nc_strerror(err)); +#line 595 } else { +#line 595 IF (err != NC_ERANGE) +#line 595 error("Range error: status = %d", err); +#line 595 } +#line 595 } else { +#line 595 IF (err != 0 && err != NC_ERANGE) +#line 595 error("OK or Range error: status = %d", err); +#line 595 } +#line 595 for (j = 0; j < nels; j++) { +#line 595 if (inRange3(expect[j],var_type[i],NCT_INT) +#line 595 && expect[j] >= int_min && expect[j] <= int_max) { +#line 595 IF (!equal(value[j],expect[j],var_type[i], NCT_INT)){ +#line 595 error("value read not that expected"); +#line 595 if (verbose) { +#line 595 error("\n"); +#line 595 error("varid: %d, ", i); +#line 595 error("var_name: %s, ", var_name[i]); +#line 595 error("element number: %d ", j); +#line 595 error("expect: %g, ", expect[j]); +#line 595 error("got: %g", (double) value[j]); +#line 595 } +#line 595 } else { +#line 595 nok++; +#line 595 } +#line 595 } +#line 595 } +#line 595 } else { +#line 595 IF (nels > 0 && err != NC_ECHAR) +#line 595 error("wrong type: status = %d", err); +#line 595 } +#line 595 } +#line 595 } +#line 595 +#line 595 } +#line 595 err = nc_close(ncid); +#line 595 IF (err) +#line 595 error("nc_close: %s", nc_strerror(err)); +#line 595 print_nok(nok); +#line 595 } +#line 595 void +#line 596 test_nc_get_vars_long(void) +#line 596 { +#line 596 int ncid; +#line 596 int d; +#line 596 int i; +#line 596 int j; +#line 596 int k; +#line 596 int m; +#line 596 int err; +#line 596 int allInExtRange; /* all values within external range? */ +#line 596 int allInIntRange; /* all values within internal range? */ +#line 596 int nels; +#line 596 int nslabs; +#line 596 int nstarts; /* number of different starts */ +#line 596 int nok = 0; /* count of valid comparisons */ +#line 596 size_t start[MAX_RANK]; +#line 596 size_t edge[MAX_RANK]; +#line 596 size_t index[MAX_RANK]; +#line 596 size_t index2[MAX_RANK]; +#line 596 size_t mid[MAX_RANK]; +#line 596 size_t count[MAX_RANK]; +#line 596 size_t sstride[MAX_RANK]; +#line 596 ptrdiff_t stride[MAX_RANK]; +#line 596 int canConvert; /* Both text or both numeric */ +#line 596 long value[MAX_NELS]; +#line 596 double expect[MAX_NELS]; +#line 596 +#line 596 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 596 IF (err) +#line 596 error("nc_open: %s", nc_strerror(err)); +#line 596 for (i = 0; i < NVARS; i++) { +#line 596 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 596 assert(var_rank[i] <= MAX_RANK); +#line 596 assert(var_nels[i] <= MAX_NELS); +#line 596 for (j = 0; j < var_rank[i]; j++) { +#line 596 start[j] = 0; +#line 596 edge[j] = 1; +#line 596 stride[j] = 1; +#line 596 } +#line 596 err = nc_get_vars_long(BAD_ID, i, start, edge, stride, value); +#line 596 IF (err != NC_EBADID) +#line 596 error("bad ncid: status = %d", err); +#line 596 err = nc_get_vars_long(ncid, BAD_VARID, start, edge, stride, value); +#line 596 IF (err != NC_ENOTVAR) +#line 596 error("bad var id: status = %d", err); +#line 596 for (j = 0; j < var_rank[i]; j++) { +#line 596 start[j] = var_shape[i][j]; +#line 596 err = nc_get_vars_long(ncid, i, start, edge, stride, value); +#line 596 if(!canConvert) { +#line 596 IF (err != NC_ECHAR) +#line 596 error("conversion: status = %d", err); +#line 596 } else { +#line 596 IF (err != NC_EINVALCOORDS) +#line 596 error("bad index: status = %d", err); +#line 596 start[j] = 0; +#line 596 edge[j] = var_shape[i][j] + 1; +#line 596 err = nc_get_vars_long(ncid, i, start, edge, stride, value); +#line 596 IF (err != NC_EEDGE) +#line 596 error("bad edge: status = %d", err); +#line 596 edge[j] = 1; +#line 596 stride[j] = 0; +#line 596 err = nc_get_vars_long(ncid, i, start, edge, stride, value); +#line 596 IF (err != NC_ESTRIDE) +#line 596 error("bad stride: status = %d", err); +#line 596 stride[j] = 1; +#line 596 } +#line 596 } +#line 596 /* Choose a random point dividing each dim into 2 parts */ +#line 596 /* get 2^rank (nslabs) slabs so defined */ +#line 596 nslabs = 1; +#line 596 for (j = 0; j < var_rank[i]; j++) { +#line 596 mid[j] = roll( var_shape[i][j] ); +#line 596 nslabs *= 2; +#line 596 } +#line 596 /* bits of k determine whether to get lower or upper part of dim */ +#line 596 /* choose random stride from 1 to edge */ +#line 596 for (k = 0; k < nslabs; k++) { +#line 596 nstarts = 1; +#line 596 for (j = 0; j < var_rank[i]; j++) { +#line 596 if ((k >> j) & 1) { +#line 596 start[j] = 0; +#line 596 edge[j] = mid[j]; +#line 596 }else{ +#line 596 start[j] = mid[j]; +#line 596 edge[j] = var_shape[i][j] - mid[j]; +#line 596 } +#line 596 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 596 nstarts *= stride[j]; +#line 596 } +#line 596 for (m = 0; m < nstarts; m++) { +#line 596 err = toMixedBase(m, var_rank[i], sstride, index); +#line 596 IF (err) +#line 596 error("error in toMixedBase"); +#line 596 nels = 1; +#line 596 for (j = 0; j < var_rank[i]; j++) { +#line 596 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 596 nels *= count[j]; +#line 596 index[j] += start[j]; +#line 596 } +#line 596 /* Random choice of forward or backward */ +#line 596 /* TODO +#line 596 if ( roll(2) ) { +#line 596 for (j = 0; j < var_rank[i]; j++) { +#line 596 index[j] += (count[j] - 1) * stride[j]; +#line 596 stride[j] = -stride[j]; +#line 596 } +#line 596 } +#line 596 */ +#line 596 allInExtRange = allInIntRange = 1; +#line 596 for (j = 0; j < nels; j++) { +#line 596 err = toMixedBase(j, var_rank[i], count, index2); +#line 596 IF (err) +#line 596 error("error in toMixedBase 1"); +#line 596 for (d = 0; d < var_rank[i]; d++) +#line 596 index2[d] = index[d] + index2[d] * stride[d]; +#line 596 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 596 NCT_LONG); +#line 596 if (inRange3(expect[j],var_type[i],NCT_LONG)) { +#line 596 allInIntRange = allInIntRange && expect[j] >= long_min +#line 596 && expect[j] <= long_max; +#line 596 } else { +#line 596 allInExtRange = 0; +#line 596 } +#line 596 } +#line 596 if (var_rank[i] == 0 && i%2 ) +#line 596 err = nc_get_vars_long(ncid, i, NULL, NULL, NULL, value); +#line 596 else +#line 596 err = nc_get_vars_long(ncid, i, index, count, stride, value); +#line 596 if (canConvert) { +#line 596 if (allInExtRange) { +#line 596 if (allInIntRange) { +#line 596 IF (err) +#line 596 error("%s", nc_strerror(err)); +#line 596 } else { +#line 596 IF (err != NC_ERANGE) +#line 596 error("Range error: status = %d", err); +#line 596 } +#line 596 } else { +#line 596 IF (err != 0 && err != NC_ERANGE) +#line 596 error("OK or Range error: status = %d", err); +#line 596 } +#line 596 for (j = 0; j < nels; j++) { +#line 596 if (inRange3(expect[j],var_type[i],NCT_LONG) +#line 596 && expect[j] >= long_min && expect[j] <= long_max) { +#line 596 IF (!equal(value[j],expect[j],var_type[i], NCT_LONG)){ +#line 596 error("value read not that expected"); +#line 596 if (verbose) { +#line 596 error("\n"); +#line 596 error("varid: %d, ", i); +#line 596 error("var_name: %s, ", var_name[i]); +#line 596 error("element number: %d ", j); +#line 596 error("expect: %g, ", expect[j]); +#line 596 error("got: %g", (double) value[j]); +#line 596 } +#line 596 } else { +#line 596 nok++; +#line 596 } +#line 596 } +#line 596 } +#line 596 } else { +#line 596 IF (nels > 0 && err != NC_ECHAR) +#line 596 error("wrong type: status = %d", err); +#line 596 } +#line 596 } +#line 596 } +#line 596 +#line 596 } +#line 596 err = nc_close(ncid); +#line 596 IF (err) +#line 596 error("nc_close: %s", nc_strerror(err)); +#line 596 print_nok(nok); +#line 596 } +#line 596 void +#line 597 test_nc_get_vars_float(void) +#line 597 { +#line 597 int ncid; +#line 597 int d; +#line 597 int i; +#line 597 int j; +#line 597 int k; +#line 597 int m; +#line 597 int err; +#line 597 int allInExtRange; /* all values within external range? */ +#line 597 int allInIntRange; /* all values within internal range? */ +#line 597 int nels; +#line 597 int nslabs; +#line 597 int nstarts; /* number of different starts */ +#line 597 int nok = 0; /* count of valid comparisons */ +#line 597 size_t start[MAX_RANK]; +#line 597 size_t edge[MAX_RANK]; +#line 597 size_t index[MAX_RANK]; +#line 597 size_t index2[MAX_RANK]; +#line 597 size_t mid[MAX_RANK]; +#line 597 size_t count[MAX_RANK]; +#line 597 size_t sstride[MAX_RANK]; +#line 597 ptrdiff_t stride[MAX_RANK]; +#line 597 int canConvert; /* Both text or both numeric */ +#line 597 float value[MAX_NELS]; +#line 597 double expect[MAX_NELS]; +#line 597 +#line 597 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 597 IF (err) +#line 597 error("nc_open: %s", nc_strerror(err)); +#line 597 for (i = 0; i < NVARS; i++) { +#line 597 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 597 assert(var_rank[i] <= MAX_RANK); +#line 597 assert(var_nels[i] <= MAX_NELS); +#line 597 for (j = 0; j < var_rank[i]; j++) { +#line 597 start[j] = 0; +#line 597 edge[j] = 1; +#line 597 stride[j] = 1; +#line 597 } +#line 597 err = nc_get_vars_float(BAD_ID, i, start, edge, stride, value); +#line 597 IF (err != NC_EBADID) +#line 597 error("bad ncid: status = %d", err); +#line 597 err = nc_get_vars_float(ncid, BAD_VARID, start, edge, stride, value); +#line 597 IF (err != NC_ENOTVAR) +#line 597 error("bad var id: status = %d", err); +#line 597 for (j = 0; j < var_rank[i]; j++) { +#line 597 start[j] = var_shape[i][j]; +#line 597 err = nc_get_vars_float(ncid, i, start, edge, stride, value); +#line 597 if(!canConvert) { +#line 597 IF (err != NC_ECHAR) +#line 597 error("conversion: status = %d", err); +#line 597 } else { +#line 597 IF (err != NC_EINVALCOORDS) +#line 597 error("bad index: status = %d", err); +#line 597 start[j] = 0; +#line 597 edge[j] = var_shape[i][j] + 1; +#line 597 err = nc_get_vars_float(ncid, i, start, edge, stride, value); +#line 597 IF (err != NC_EEDGE) +#line 597 error("bad edge: status = %d", err); +#line 597 edge[j] = 1; +#line 597 stride[j] = 0; +#line 597 err = nc_get_vars_float(ncid, i, start, edge, stride, value); +#line 597 IF (err != NC_ESTRIDE) +#line 597 error("bad stride: status = %d", err); +#line 597 stride[j] = 1; +#line 597 } +#line 597 } +#line 597 /* Choose a random point dividing each dim into 2 parts */ +#line 597 /* get 2^rank (nslabs) slabs so defined */ +#line 597 nslabs = 1; +#line 597 for (j = 0; j < var_rank[i]; j++) { +#line 597 mid[j] = roll( var_shape[i][j] ); +#line 597 nslabs *= 2; +#line 597 } +#line 597 /* bits of k determine whether to get lower or upper part of dim */ +#line 597 /* choose random stride from 1 to edge */ +#line 597 for (k = 0; k < nslabs; k++) { +#line 597 nstarts = 1; +#line 597 for (j = 0; j < var_rank[i]; j++) { +#line 597 if ((k >> j) & 1) { +#line 597 start[j] = 0; +#line 597 edge[j] = mid[j]; +#line 597 }else{ +#line 597 start[j] = mid[j]; +#line 597 edge[j] = var_shape[i][j] - mid[j]; +#line 597 } +#line 597 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 597 nstarts *= stride[j]; +#line 597 } +#line 597 for (m = 0; m < nstarts; m++) { +#line 597 err = toMixedBase(m, var_rank[i], sstride, index); +#line 597 IF (err) +#line 597 error("error in toMixedBase"); +#line 597 nels = 1; +#line 597 for (j = 0; j < var_rank[i]; j++) { +#line 597 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 597 nels *= count[j]; +#line 597 index[j] += start[j]; +#line 597 } +#line 597 /* Random choice of forward or backward */ +#line 597 /* TODO +#line 597 if ( roll(2) ) { +#line 597 for (j = 0; j < var_rank[i]; j++) { +#line 597 index[j] += (count[j] - 1) * stride[j]; +#line 597 stride[j] = -stride[j]; +#line 597 } +#line 597 } +#line 597 */ +#line 597 allInExtRange = allInIntRange = 1; +#line 597 for (j = 0; j < nels; j++) { +#line 597 err = toMixedBase(j, var_rank[i], count, index2); +#line 597 IF (err) +#line 597 error("error in toMixedBase 1"); +#line 597 for (d = 0; d < var_rank[i]; d++) +#line 597 index2[d] = index[d] + index2[d] * stride[d]; +#line 597 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 597 NCT_FLOAT); +#line 597 if (inRange3(expect[j],var_type[i],NCT_FLOAT)) { +#line 597 allInIntRange = allInIntRange && expect[j] >= float_min +#line 597 && expect[j] <= float_max; +#line 597 } else { +#line 597 allInExtRange = 0; +#line 597 } +#line 597 } +#line 597 if (var_rank[i] == 0 && i%2 ) +#line 597 err = nc_get_vars_float(ncid, i, NULL, NULL, NULL, value); +#line 597 else +#line 597 err = nc_get_vars_float(ncid, i, index, count, stride, value); +#line 597 if (canConvert) { +#line 597 if (allInExtRange) { +#line 597 if (allInIntRange) { +#line 597 IF (err) +#line 597 error("%s", nc_strerror(err)); +#line 597 } else { +#line 597 IF (err != NC_ERANGE) +#line 597 error("Range error: status = %d", err); +#line 597 } +#line 597 } else { +#line 597 IF (err != 0 && err != NC_ERANGE) +#line 597 error("OK or Range error: status = %d", err); +#line 597 } +#line 597 for (j = 0; j < nels; j++) { +#line 597 if (inRange3(expect[j],var_type[i],NCT_FLOAT) +#line 597 && expect[j] >= float_min && expect[j] <= float_max) { +#line 597 IF (!equal(value[j],expect[j],var_type[i], NCT_FLOAT)){ +#line 597 error("value read not that expected"); +#line 597 if (verbose) { +#line 597 error("\n"); +#line 597 error("varid: %d, ", i); +#line 597 error("var_name: %s, ", var_name[i]); +#line 597 error("element number: %d ", j); +#line 597 error("expect: %g, ", expect[j]); +#line 597 error("got: %g", (double) value[j]); +#line 597 } +#line 597 } else { +#line 597 nok++; +#line 597 } +#line 597 } +#line 597 } +#line 597 } else { +#line 597 IF (nels > 0 && err != NC_ECHAR) +#line 597 error("wrong type: status = %d", err); +#line 597 } +#line 597 } +#line 597 } +#line 597 +#line 597 } +#line 597 err = nc_close(ncid); +#line 597 IF (err) +#line 597 error("nc_close: %s", nc_strerror(err)); +#line 597 print_nok(nok); +#line 597 } +#line 597 void +#line 598 test_nc_get_vars_double(void) +#line 598 { +#line 598 int ncid; +#line 598 int d; +#line 598 int i; +#line 598 int j; +#line 598 int k; +#line 598 int m; +#line 598 int err; +#line 598 int allInExtRange; /* all values within external range? */ +#line 598 int allInIntRange; /* all values within internal range? */ +#line 598 int nels; +#line 598 int nslabs; +#line 598 int nstarts; /* number of different starts */ +#line 598 int nok = 0; /* count of valid comparisons */ +#line 598 size_t start[MAX_RANK]; +#line 598 size_t edge[MAX_RANK]; +#line 598 size_t index[MAX_RANK]; +#line 598 size_t index2[MAX_RANK]; +#line 598 size_t mid[MAX_RANK]; +#line 598 size_t count[MAX_RANK]; +#line 598 size_t sstride[MAX_RANK]; +#line 598 ptrdiff_t stride[MAX_RANK]; +#line 598 int canConvert; /* Both text or both numeric */ +#line 598 double value[MAX_NELS]; +#line 598 double expect[MAX_NELS]; +#line 598 +#line 598 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 598 IF (err) +#line 598 error("nc_open: %s", nc_strerror(err)); +#line 598 for (i = 0; i < NVARS; i++) { +#line 598 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 598 assert(var_rank[i] <= MAX_RANK); +#line 598 assert(var_nels[i] <= MAX_NELS); +#line 598 for (j = 0; j < var_rank[i]; j++) { +#line 598 start[j] = 0; +#line 598 edge[j] = 1; +#line 598 stride[j] = 1; +#line 598 } +#line 598 err = nc_get_vars_double(BAD_ID, i, start, edge, stride, value); +#line 598 IF (err != NC_EBADID) +#line 598 error("bad ncid: status = %d", err); +#line 598 err = nc_get_vars_double(ncid, BAD_VARID, start, edge, stride, value); +#line 598 IF (err != NC_ENOTVAR) +#line 598 error("bad var id: status = %d", err); +#line 598 for (j = 0; j < var_rank[i]; j++) { +#line 598 start[j] = var_shape[i][j]; +#line 598 err = nc_get_vars_double(ncid, i, start, edge, stride, value); +#line 598 if(!canConvert) { +#line 598 IF (err != NC_ECHAR) +#line 598 error("conversion: status = %d", err); +#line 598 } else { +#line 598 IF (err != NC_EINVALCOORDS) +#line 598 error("bad index: status = %d", err); +#line 598 start[j] = 0; +#line 598 edge[j] = var_shape[i][j] + 1; +#line 598 err = nc_get_vars_double(ncid, i, start, edge, stride, value); +#line 598 IF (err != NC_EEDGE) +#line 598 error("bad edge: status = %d", err); +#line 598 edge[j] = 1; +#line 598 stride[j] = 0; +#line 598 err = nc_get_vars_double(ncid, i, start, edge, stride, value); +#line 598 IF (err != NC_ESTRIDE) +#line 598 error("bad stride: status = %d", err); +#line 598 stride[j] = 1; +#line 598 } +#line 598 } +#line 598 /* Choose a random point dividing each dim into 2 parts */ +#line 598 /* get 2^rank (nslabs) slabs so defined */ +#line 598 nslabs = 1; +#line 598 for (j = 0; j < var_rank[i]; j++) { +#line 598 mid[j] = roll( var_shape[i][j] ); +#line 598 nslabs *= 2; +#line 598 } +#line 598 /* bits of k determine whether to get lower or upper part of dim */ +#line 598 /* choose random stride from 1 to edge */ +#line 598 for (k = 0; k < nslabs; k++) { +#line 598 nstarts = 1; +#line 598 for (j = 0; j < var_rank[i]; j++) { +#line 598 if ((k >> j) & 1) { +#line 598 start[j] = 0; +#line 598 edge[j] = mid[j]; +#line 598 }else{ +#line 598 start[j] = mid[j]; +#line 598 edge[j] = var_shape[i][j] - mid[j]; +#line 598 } +#line 598 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 598 nstarts *= stride[j]; +#line 598 } +#line 598 for (m = 0; m < nstarts; m++) { +#line 598 err = toMixedBase(m, var_rank[i], sstride, index); +#line 598 IF (err) +#line 598 error("error in toMixedBase"); +#line 598 nels = 1; +#line 598 for (j = 0; j < var_rank[i]; j++) { +#line 598 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 598 nels *= count[j]; +#line 598 index[j] += start[j]; +#line 598 } +#line 598 /* Random choice of forward or backward */ +#line 598 /* TODO +#line 598 if ( roll(2) ) { +#line 598 for (j = 0; j < var_rank[i]; j++) { +#line 598 index[j] += (count[j] - 1) * stride[j]; +#line 598 stride[j] = -stride[j]; +#line 598 } +#line 598 } +#line 598 */ +#line 598 allInExtRange = allInIntRange = 1; +#line 598 for (j = 0; j < nels; j++) { +#line 598 err = toMixedBase(j, var_rank[i], count, index2); +#line 598 IF (err) +#line 598 error("error in toMixedBase 1"); +#line 598 for (d = 0; d < var_rank[i]; d++) +#line 598 index2[d] = index[d] + index2[d] * stride[d]; +#line 598 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 598 NCT_DOUBLE); +#line 598 if (inRange3(expect[j],var_type[i],NCT_DOUBLE)) { +#line 598 allInIntRange = allInIntRange && expect[j] >= double_min +#line 598 && expect[j] <= double_max; +#line 598 } else { +#line 598 allInExtRange = 0; +#line 598 } +#line 598 } +#line 598 if (var_rank[i] == 0 && i%2 ) +#line 598 err = nc_get_vars_double(ncid, i, NULL, NULL, NULL, value); +#line 598 else +#line 598 err = nc_get_vars_double(ncid, i, index, count, stride, value); +#line 598 if (canConvert) { +#line 598 if (allInExtRange) { +#line 598 if (allInIntRange) { +#line 598 IF (err) +#line 598 error("%s", nc_strerror(err)); +#line 598 } else { +#line 598 IF (err != NC_ERANGE) +#line 598 error("Range error: status = %d", err); +#line 598 } +#line 598 } else { +#line 598 IF (err != 0 && err != NC_ERANGE) +#line 598 error("OK or Range error: status = %d", err); +#line 598 } +#line 598 for (j = 0; j < nels; j++) { +#line 598 if (inRange3(expect[j],var_type[i],NCT_DOUBLE) +#line 598 && expect[j] >= double_min && expect[j] <= double_max) { +#line 598 IF (!equal(value[j],expect[j],var_type[i], NCT_DOUBLE)){ +#line 598 error("value read not that expected"); +#line 598 if (verbose) { +#line 598 error("\n"); +#line 598 error("varid: %d, ", i); +#line 598 error("var_name: %s, ", var_name[i]); +#line 598 error("element number: %d ", j); +#line 598 error("expect: %g, ", expect[j]); +#line 598 error("got: %g", (double) value[j]); +#line 598 } +#line 598 } else { +#line 598 nok++; +#line 598 } +#line 598 } +#line 598 } +#line 598 } else { +#line 598 IF (nels > 0 && err != NC_ECHAR) +#line 598 error("wrong type: status = %d", err); +#line 598 } +#line 598 } +#line 598 } +#line 598 +#line 598 } +#line 598 err = nc_close(ncid); +#line 598 IF (err) +#line 598 error("nc_close: %s", nc_strerror(err)); +#line 598 print_nok(nok); +#line 598 } +#line 598 +#line 787 void +#line 788 test_nc_get_varm_text(void) +#line 788 { +#line 788 int ncid; +#line 788 int d; +#line 788 int i; +#line 788 int j; +#line 788 int k; +#line 788 int m; +#line 788 int err; +#line 788 int allInExtRange; /* all values within external range? */ +#line 788 int allInIntRange; /* all values within internal range? */ +#line 788 int nels; +#line 788 int nslabs; +#line 788 int nstarts; /* number of different starts */ +#line 788 int nok = 0; /* count of valid comparisons */ +#line 788 size_t start[MAX_RANK]; +#line 788 size_t edge[MAX_RANK]; +#line 788 size_t index[MAX_RANK]; +#line 788 size_t index2[MAX_RANK]; +#line 788 size_t mid[MAX_RANK]; +#line 788 size_t count[MAX_RANK]; +#line 788 size_t sstride[MAX_RANK]; +#line 788 ptrdiff_t stride[MAX_RANK]; +#line 788 ptrdiff_t imap[MAX_RANK]; +#line 788 int canConvert; /* Both text or both numeric */ +#line 788 text value[MAX_NELS]; +#line 788 double expect[MAX_NELS]; +#line 788 +#line 788 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 788 IF (err) +#line 788 error("nc_open: %s", nc_strerror(err)); +#line 788 for (i = 0; i < NVARS; i++) { +#line 788 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 788 assert(var_rank[i] <= MAX_RANK); +#line 788 assert(var_nels[i] <= MAX_NELS); +#line 788 for (j = 0; j < var_rank[i]; j++) { +#line 788 start[j] = 0; +#line 788 edge[j] = 1; +#line 788 stride[j] = 1; +#line 788 imap[j] = 1; +#line 788 } +#line 788 err = nc_get_varm_text(BAD_ID, i, start, edge, stride, imap, value); +#line 788 IF (err != NC_EBADID) +#line 788 error("bad ncid: status = %d", err); +#line 788 err = nc_get_varm_text(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 788 IF (err != NC_ENOTVAR) +#line 788 error("bad var id: status = %d", err); +#line 788 for (j = 0; j < var_rank[i]; j++) { +#line 788 start[j] = var_shape[i][j]; +#line 788 err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value); +#line 788 if(!canConvert) { +#line 788 IF (err != NC_ECHAR) +#line 788 error("conversion: status = %d", err); +#line 788 } else { +#line 788 IF (err != NC_EINVALCOORDS) +#line 788 error("bad index: status = %d", err); +#line 788 start[j] = 0; +#line 788 edge[j] = var_shape[i][j] + 1; +#line 788 err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value); +#line 788 IF (err != NC_EEDGE) +#line 788 error("bad edge: status = %d", err); +#line 788 edge[j] = 1; +#line 788 stride[j] = 0; +#line 788 err = nc_get_varm_text(ncid, i, start, edge, stride, imap, value); +#line 788 IF (err != NC_ESTRIDE) +#line 788 error("bad stride: status = %d", err); +#line 788 stride[j] = 1; +#line 788 } +#line 788 } +#line 788 /* Choose a random point dividing each dim into 2 parts */ +#line 788 /* get 2^rank (nslabs) slabs so defined */ +#line 788 nslabs = 1; +#line 788 for (j = 0; j < var_rank[i]; j++) { +#line 788 mid[j] = roll( var_shape[i][j] ); +#line 788 nslabs *= 2; +#line 788 } +#line 788 /* bits of k determine whether to get lower or upper part of dim */ +#line 788 /* choose random stride from 1 to edge */ +#line 788 for (k = 0; k < nslabs; k++) { +#line 788 nstarts = 1; +#line 788 for (j = 0; j < var_rank[i]; j++) { +#line 788 if ((k >> j) & 1) { +#line 788 start[j] = 0; +#line 788 edge[j] = mid[j]; +#line 788 }else{ +#line 788 start[j] = mid[j]; +#line 788 edge[j] = var_shape[i][j] - mid[j]; +#line 788 } +#line 788 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 788 nstarts *= stride[j]; +#line 788 } +#line 788 for (m = 0; m < nstarts; m++) { +#line 788 err = toMixedBase(m, var_rank[i], sstride, index); +#line 788 IF (err) +#line 788 error("error in toMixedBase"); +#line 788 nels = 1; +#line 788 for (j = 0; j < var_rank[i]; j++) { +#line 788 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 788 nels *= count[j]; +#line 788 index[j] += start[j]; +#line 788 } +#line 788 /* Random choice of forward or backward */ +#line 788 /* TODO +#line 788 if ( roll(2) ) { +#line 788 for (j = 0; j < var_rank[i]; j++) { +#line 788 index[j] += (count[j] - 1) * stride[j]; +#line 788 stride[j] = -stride[j]; +#line 788 } +#line 788 } +#line 788 */ +#line 788 if (var_rank[i] > 0) { +#line 788 j = var_rank[i] - 1; +#line 788 imap[j] = 1; +#line 788 for (; j > 0; j--) +#line 788 imap[j-1] = imap[j] * count[j]; +#line 788 } +#line 788 allInExtRange = allInIntRange = 1; +#line 788 for (j = 0; j < nels; j++) { +#line 788 err = toMixedBase(j, var_rank[i], count, index2); +#line 788 IF (err) +#line 788 error("error in toMixedBase 1"); +#line 788 for (d = 0; d < var_rank[i]; d++) +#line 788 index2[d] = index[d] + index2[d] * stride[d]; +#line 788 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 788 NCT_TEXT); +#line 788 if (inRange3(expect[j],var_type[i],NCT_TEXT)) { +#line 788 allInIntRange = allInIntRange && expect[j] >= text_min +#line 788 && expect[j] <= text_max; +#line 788 } else { +#line 788 allInExtRange = 0; +#line 788 } +#line 788 } +#line 788 if (var_rank[i] == 0 && i%2 ) +#line 788 err = nc_get_varm_text(ncid,i,NULL,NULL,NULL,NULL,value); +#line 788 else +#line 788 err = nc_get_varm_text(ncid,i,index,count,stride,imap,value); +#line 788 if (canConvert) { +#line 788 if (allInExtRange) { +#line 788 if (allInIntRange) { +#line 788 IF (err) +#line 788 error("%s", nc_strerror(err)); +#line 788 } else { +#line 788 IF (err != NC_ERANGE) +#line 788 error("Range error: status = %d", err); +#line 788 } +#line 788 } else { +#line 788 IF (err != 0 && err != NC_ERANGE) +#line 788 error("OK or Range error: status = %d", err); +#line 788 } +#line 788 for (j = 0; j < nels; j++) { +#line 788 if (inRange3(expect[j],var_type[i],NCT_TEXT) +#line 788 && expect[j] >= text_min +#line 788 && expect[j] <= text_max) { +#line 788 IF (!equal(value[j],expect[j],var_type[i], NCT_TEXT)){ +#line 788 error("value read not that expected"); +#line 788 if (verbose) { +#line 788 error("\n"); +#line 788 error("varid: %d, ", i); +#line 788 error("var_name: %s, ", var_name[i]); +#line 788 error("element number: %d ", j); +#line 788 error("expect: %g, ", expect[j]); +#line 788 error("got: %g", (double) value[j]); +#line 788 } +#line 788 } else { +#line 788 nok++; +#line 788 } +#line 788 } +#line 788 } +#line 788 } else { +#line 788 IF (nels > 0 && err != NC_ECHAR) +#line 788 error("wrong type: status = %d", err); +#line 788 } +#line 788 } +#line 788 } +#line 788 } +#line 788 err = nc_close(ncid); +#line 788 IF (err) +#line 788 error("nc_close: %s", nc_strerror(err)); +#line 788 print_nok(nok); +#line 788 } +#line 788 void +#line 789 test_nc_get_varm_uchar(void) +#line 789 { +#line 789 int ncid; +#line 789 int d; +#line 789 int i; +#line 789 int j; +#line 789 int k; +#line 789 int m; +#line 789 int err; +#line 789 int allInExtRange; /* all values within external range? */ +#line 789 int allInIntRange; /* all values within internal range? */ +#line 789 int nels; +#line 789 int nslabs; +#line 789 int nstarts; /* number of different starts */ +#line 789 int nok = 0; /* count of valid comparisons */ +#line 789 size_t start[MAX_RANK]; +#line 789 size_t edge[MAX_RANK]; +#line 789 size_t index[MAX_RANK]; +#line 789 size_t index2[MAX_RANK]; +#line 789 size_t mid[MAX_RANK]; +#line 789 size_t count[MAX_RANK]; +#line 789 size_t sstride[MAX_RANK]; +#line 789 ptrdiff_t stride[MAX_RANK]; +#line 789 ptrdiff_t imap[MAX_RANK]; +#line 789 int canConvert; /* Both text or both numeric */ +#line 789 uchar value[MAX_NELS]; +#line 789 double expect[MAX_NELS]; +#line 789 +#line 789 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 789 IF (err) +#line 789 error("nc_open: %s", nc_strerror(err)); +#line 789 for (i = 0; i < NVARS; i++) { +#line 789 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 789 assert(var_rank[i] <= MAX_RANK); +#line 789 assert(var_nels[i] <= MAX_NELS); +#line 789 for (j = 0; j < var_rank[i]; j++) { +#line 789 start[j] = 0; +#line 789 edge[j] = 1; +#line 789 stride[j] = 1; +#line 789 imap[j] = 1; +#line 789 } +#line 789 err = nc_get_varm_uchar(BAD_ID, i, start, edge, stride, imap, value); +#line 789 IF (err != NC_EBADID) +#line 789 error("bad ncid: status = %d", err); +#line 789 err = nc_get_varm_uchar(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 789 IF (err != NC_ENOTVAR) +#line 789 error("bad var id: status = %d", err); +#line 789 for (j = 0; j < var_rank[i]; j++) { +#line 789 start[j] = var_shape[i][j]; +#line 789 err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value); +#line 789 if(!canConvert) { +#line 789 IF (err != NC_ECHAR) +#line 789 error("conversion: status = %d", err); +#line 789 } else { +#line 789 IF (err != NC_EINVALCOORDS) +#line 789 error("bad index: status = %d", err); +#line 789 start[j] = 0; +#line 789 edge[j] = var_shape[i][j] + 1; +#line 789 err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value); +#line 789 IF (err != NC_EEDGE) +#line 789 error("bad edge: status = %d", err); +#line 789 edge[j] = 1; +#line 789 stride[j] = 0; +#line 789 err = nc_get_varm_uchar(ncid, i, start, edge, stride, imap, value); +#line 789 IF (err != NC_ESTRIDE) +#line 789 error("bad stride: status = %d", err); +#line 789 stride[j] = 1; +#line 789 } +#line 789 } +#line 789 /* Choose a random point dividing each dim into 2 parts */ +#line 789 /* get 2^rank (nslabs) slabs so defined */ +#line 789 nslabs = 1; +#line 789 for (j = 0; j < var_rank[i]; j++) { +#line 789 mid[j] = roll( var_shape[i][j] ); +#line 789 nslabs *= 2; +#line 789 } +#line 789 /* bits of k determine whether to get lower or upper part of dim */ +#line 789 /* choose random stride from 1 to edge */ +#line 789 for (k = 0; k < nslabs; k++) { +#line 789 nstarts = 1; +#line 789 for (j = 0; j < var_rank[i]; j++) { +#line 789 if ((k >> j) & 1) { +#line 789 start[j] = 0; +#line 789 edge[j] = mid[j]; +#line 789 }else{ +#line 789 start[j] = mid[j]; +#line 789 edge[j] = var_shape[i][j] - mid[j]; +#line 789 } +#line 789 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 789 nstarts *= stride[j]; +#line 789 } +#line 789 for (m = 0; m < nstarts; m++) { +#line 789 err = toMixedBase(m, var_rank[i], sstride, index); +#line 789 IF (err) +#line 789 error("error in toMixedBase"); +#line 789 nels = 1; +#line 789 for (j = 0; j < var_rank[i]; j++) { +#line 789 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 789 nels *= count[j]; +#line 789 index[j] += start[j]; +#line 789 } +#line 789 /* Random choice of forward or backward */ +#line 789 /* TODO +#line 789 if ( roll(2) ) { +#line 789 for (j = 0; j < var_rank[i]; j++) { +#line 789 index[j] += (count[j] - 1) * stride[j]; +#line 789 stride[j] = -stride[j]; +#line 789 } +#line 789 } +#line 789 */ +#line 789 if (var_rank[i] > 0) { +#line 789 j = var_rank[i] - 1; +#line 789 imap[j] = 1; +#line 789 for (; j > 0; j--) +#line 789 imap[j-1] = imap[j] * count[j]; +#line 789 } +#line 789 allInExtRange = allInIntRange = 1; +#line 789 for (j = 0; j < nels; j++) { +#line 789 err = toMixedBase(j, var_rank[i], count, index2); +#line 789 IF (err) +#line 789 error("error in toMixedBase 1"); +#line 789 for (d = 0; d < var_rank[i]; d++) +#line 789 index2[d] = index[d] + index2[d] * stride[d]; +#line 789 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 789 NCT_UCHAR); +#line 789 if (inRange3(expect[j],var_type[i],NCT_UCHAR)) { +#line 789 allInIntRange = allInIntRange && expect[j] >= uchar_min +#line 789 && expect[j] <= uchar_max; +#line 789 } else { +#line 789 allInExtRange = 0; +#line 789 } +#line 789 } +#line 789 if (var_rank[i] == 0 && i%2 ) +#line 789 err = nc_get_varm_uchar(ncid,i,NULL,NULL,NULL,NULL,value); +#line 789 else +#line 789 err = nc_get_varm_uchar(ncid,i,index,count,stride,imap,value); +#line 789 if (canConvert) { +#line 789 if (allInExtRange) { +#line 789 if (allInIntRange) { +#line 789 IF (err) +#line 789 error("%s", nc_strerror(err)); +#line 789 } else { +#line 789 IF (err != NC_ERANGE) +#line 789 error("Range error: status = %d", err); +#line 789 } +#line 789 } else { +#line 789 IF (err != 0 && err != NC_ERANGE) +#line 789 error("OK or Range error: status = %d", err); +#line 789 } +#line 789 for (j = 0; j < nels; j++) { +#line 789 if (inRange3(expect[j],var_type[i],NCT_UCHAR) +#line 789 && expect[j] >= uchar_min +#line 789 && expect[j] <= uchar_max) { +#line 789 IF (!equal(value[j],expect[j],var_type[i], NCT_UCHAR)){ +#line 789 error("value read not that expected"); +#line 789 if (verbose) { +#line 789 error("\n"); +#line 789 error("varid: %d, ", i); +#line 789 error("var_name: %s, ", var_name[i]); +#line 789 error("element number: %d ", j); +#line 789 error("expect: %g, ", expect[j]); +#line 789 error("got: %g", (double) value[j]); +#line 789 } +#line 789 } else { +#line 789 nok++; +#line 789 } +#line 789 } +#line 789 } +#line 789 } else { +#line 789 IF (nels > 0 && err != NC_ECHAR) +#line 789 error("wrong type: status = %d", err); +#line 789 } +#line 789 } +#line 789 } +#line 789 } +#line 789 err = nc_close(ncid); +#line 789 IF (err) +#line 789 error("nc_close: %s", nc_strerror(err)); +#line 789 print_nok(nok); +#line 789 } +#line 789 void +#line 790 test_nc_get_varm_schar(void) +#line 790 { +#line 790 int ncid; +#line 790 int d; +#line 790 int i; +#line 790 int j; +#line 790 int k; +#line 790 int m; +#line 790 int err; +#line 790 int allInExtRange; /* all values within external range? */ +#line 790 int allInIntRange; /* all values within internal range? */ +#line 790 int nels; +#line 790 int nslabs; +#line 790 int nstarts; /* number of different starts */ +#line 790 int nok = 0; /* count of valid comparisons */ +#line 790 size_t start[MAX_RANK]; +#line 790 size_t edge[MAX_RANK]; +#line 790 size_t index[MAX_RANK]; +#line 790 size_t index2[MAX_RANK]; +#line 790 size_t mid[MAX_RANK]; +#line 790 size_t count[MAX_RANK]; +#line 790 size_t sstride[MAX_RANK]; +#line 790 ptrdiff_t stride[MAX_RANK]; +#line 790 ptrdiff_t imap[MAX_RANK]; +#line 790 int canConvert; /* Both text or both numeric */ +#line 790 schar value[MAX_NELS]; +#line 790 double expect[MAX_NELS]; +#line 790 +#line 790 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 790 IF (err) +#line 790 error("nc_open: %s", nc_strerror(err)); +#line 790 for (i = 0; i < NVARS; i++) { +#line 790 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 790 assert(var_rank[i] <= MAX_RANK); +#line 790 assert(var_nels[i] <= MAX_NELS); +#line 790 for (j = 0; j < var_rank[i]; j++) { +#line 790 start[j] = 0; +#line 790 edge[j] = 1; +#line 790 stride[j] = 1; +#line 790 imap[j] = 1; +#line 790 } +#line 790 err = nc_get_varm_schar(BAD_ID, i, start, edge, stride, imap, value); +#line 790 IF (err != NC_EBADID) +#line 790 error("bad ncid: status = %d", err); +#line 790 err = nc_get_varm_schar(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 790 IF (err != NC_ENOTVAR) +#line 790 error("bad var id: status = %d", err); +#line 790 for (j = 0; j < var_rank[i]; j++) { +#line 790 start[j] = var_shape[i][j]; +#line 790 err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value); +#line 790 if(!canConvert) { +#line 790 IF (err != NC_ECHAR) +#line 790 error("conversion: status = %d", err); +#line 790 } else { +#line 790 IF (err != NC_EINVALCOORDS) +#line 790 error("bad index: status = %d", err); +#line 790 start[j] = 0; +#line 790 edge[j] = var_shape[i][j] + 1; +#line 790 err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value); +#line 790 IF (err != NC_EEDGE) +#line 790 error("bad edge: status = %d", err); +#line 790 edge[j] = 1; +#line 790 stride[j] = 0; +#line 790 err = nc_get_varm_schar(ncid, i, start, edge, stride, imap, value); +#line 790 IF (err != NC_ESTRIDE) +#line 790 error("bad stride: status = %d", err); +#line 790 stride[j] = 1; +#line 790 } +#line 790 } +#line 790 /* Choose a random point dividing each dim into 2 parts */ +#line 790 /* get 2^rank (nslabs) slabs so defined */ +#line 790 nslabs = 1; +#line 790 for (j = 0; j < var_rank[i]; j++) { +#line 790 mid[j] = roll( var_shape[i][j] ); +#line 790 nslabs *= 2; +#line 790 } +#line 790 /* bits of k determine whether to get lower or upper part of dim */ +#line 790 /* choose random stride from 1 to edge */ +#line 790 for (k = 0; k < nslabs; k++) { +#line 790 nstarts = 1; +#line 790 for (j = 0; j < var_rank[i]; j++) { +#line 790 if ((k >> j) & 1) { +#line 790 start[j] = 0; +#line 790 edge[j] = mid[j]; +#line 790 }else{ +#line 790 start[j] = mid[j]; +#line 790 edge[j] = var_shape[i][j] - mid[j]; +#line 790 } +#line 790 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 790 nstarts *= stride[j]; +#line 790 } +#line 790 for (m = 0; m < nstarts; m++) { +#line 790 err = toMixedBase(m, var_rank[i], sstride, index); +#line 790 IF (err) +#line 790 error("error in toMixedBase"); +#line 790 nels = 1; +#line 790 for (j = 0; j < var_rank[i]; j++) { +#line 790 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 790 nels *= count[j]; +#line 790 index[j] += start[j]; +#line 790 } +#line 790 /* Random choice of forward or backward */ +#line 790 /* TODO +#line 790 if ( roll(2) ) { +#line 790 for (j = 0; j < var_rank[i]; j++) { +#line 790 index[j] += (count[j] - 1) * stride[j]; +#line 790 stride[j] = -stride[j]; +#line 790 } +#line 790 } +#line 790 */ +#line 790 if (var_rank[i] > 0) { +#line 790 j = var_rank[i] - 1; +#line 790 imap[j] = 1; +#line 790 for (; j > 0; j--) +#line 790 imap[j-1] = imap[j] * count[j]; +#line 790 } +#line 790 allInExtRange = allInIntRange = 1; +#line 790 for (j = 0; j < nels; j++) { +#line 790 err = toMixedBase(j, var_rank[i], count, index2); +#line 790 IF (err) +#line 790 error("error in toMixedBase 1"); +#line 790 for (d = 0; d < var_rank[i]; d++) +#line 790 index2[d] = index[d] + index2[d] * stride[d]; +#line 790 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 790 NCT_SCHAR); +#line 790 if (inRange3(expect[j],var_type[i],NCT_SCHAR)) { +#line 790 allInIntRange = allInIntRange && expect[j] >= schar_min +#line 790 && expect[j] <= schar_max; +#line 790 } else { +#line 790 allInExtRange = 0; +#line 790 } +#line 790 } +#line 790 if (var_rank[i] == 0 && i%2 ) +#line 790 err = nc_get_varm_schar(ncid,i,NULL,NULL,NULL,NULL,value); +#line 790 else +#line 790 err = nc_get_varm_schar(ncid,i,index,count,stride,imap,value); +#line 790 if (canConvert) { +#line 790 if (allInExtRange) { +#line 790 if (allInIntRange) { +#line 790 IF (err) +#line 790 error("%s", nc_strerror(err)); +#line 790 } else { +#line 790 IF (err != NC_ERANGE) +#line 790 error("Range error: status = %d", err); +#line 790 } +#line 790 } else { +#line 790 IF (err != 0 && err != NC_ERANGE) +#line 790 error("OK or Range error: status = %d", err); +#line 790 } +#line 790 for (j = 0; j < nels; j++) { +#line 790 if (inRange3(expect[j],var_type[i],NCT_SCHAR) +#line 790 && expect[j] >= schar_min +#line 790 && expect[j] <= schar_max) { +#line 790 IF (!equal(value[j],expect[j],var_type[i], NCT_SCHAR)){ +#line 790 error("value read not that expected"); +#line 790 if (verbose) { +#line 790 error("\n"); +#line 790 error("varid: %d, ", i); +#line 790 error("var_name: %s, ", var_name[i]); +#line 790 error("element number: %d ", j); +#line 790 error("expect: %g, ", expect[j]); +#line 790 error("got: %g", (double) value[j]); +#line 790 } +#line 790 } else { +#line 790 nok++; +#line 790 } +#line 790 } +#line 790 } +#line 790 } else { +#line 790 IF (nels > 0 && err != NC_ECHAR) +#line 790 error("wrong type: status = %d", err); +#line 790 } +#line 790 } +#line 790 } +#line 790 } +#line 790 err = nc_close(ncid); +#line 790 IF (err) +#line 790 error("nc_close: %s", nc_strerror(err)); +#line 790 print_nok(nok); +#line 790 } +#line 790 void +#line 791 test_nc_get_varm_short(void) +#line 791 { +#line 791 int ncid; +#line 791 int d; +#line 791 int i; +#line 791 int j; +#line 791 int k; +#line 791 int m; +#line 791 int err; +#line 791 int allInExtRange; /* all values within external range? */ +#line 791 int allInIntRange; /* all values within internal range? */ +#line 791 int nels; +#line 791 int nslabs; +#line 791 int nstarts; /* number of different starts */ +#line 791 int nok = 0; /* count of valid comparisons */ +#line 791 size_t start[MAX_RANK]; +#line 791 size_t edge[MAX_RANK]; +#line 791 size_t index[MAX_RANK]; +#line 791 size_t index2[MAX_RANK]; +#line 791 size_t mid[MAX_RANK]; +#line 791 size_t count[MAX_RANK]; +#line 791 size_t sstride[MAX_RANK]; +#line 791 ptrdiff_t stride[MAX_RANK]; +#line 791 ptrdiff_t imap[MAX_RANK]; +#line 791 int canConvert; /* Both text or both numeric */ +#line 791 short value[MAX_NELS]; +#line 791 double expect[MAX_NELS]; +#line 791 +#line 791 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 791 IF (err) +#line 791 error("nc_open: %s", nc_strerror(err)); +#line 791 for (i = 0; i < NVARS; i++) { +#line 791 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 791 assert(var_rank[i] <= MAX_RANK); +#line 791 assert(var_nels[i] <= MAX_NELS); +#line 791 for (j = 0; j < var_rank[i]; j++) { +#line 791 start[j] = 0; +#line 791 edge[j] = 1; +#line 791 stride[j] = 1; +#line 791 imap[j] = 1; +#line 791 } +#line 791 err = nc_get_varm_short(BAD_ID, i, start, edge, stride, imap, value); +#line 791 IF (err != NC_EBADID) +#line 791 error("bad ncid: status = %d", err); +#line 791 err = nc_get_varm_short(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 791 IF (err != NC_ENOTVAR) +#line 791 error("bad var id: status = %d", err); +#line 791 for (j = 0; j < var_rank[i]; j++) { +#line 791 start[j] = var_shape[i][j]; +#line 791 err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value); +#line 791 if(!canConvert) { +#line 791 IF (err != NC_ECHAR) +#line 791 error("conversion: status = %d", err); +#line 791 } else { +#line 791 IF (err != NC_EINVALCOORDS) +#line 791 error("bad index: status = %d", err); +#line 791 start[j] = 0; +#line 791 edge[j] = var_shape[i][j] + 1; +#line 791 err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value); +#line 791 IF (err != NC_EEDGE) +#line 791 error("bad edge: status = %d", err); +#line 791 edge[j] = 1; +#line 791 stride[j] = 0; +#line 791 err = nc_get_varm_short(ncid, i, start, edge, stride, imap, value); +#line 791 IF (err != NC_ESTRIDE) +#line 791 error("bad stride: status = %d", err); +#line 791 stride[j] = 1; +#line 791 } +#line 791 } +#line 791 /* Choose a random point dividing each dim into 2 parts */ +#line 791 /* get 2^rank (nslabs) slabs so defined */ +#line 791 nslabs = 1; +#line 791 for (j = 0; j < var_rank[i]; j++) { +#line 791 mid[j] = roll( var_shape[i][j] ); +#line 791 nslabs *= 2; +#line 791 } +#line 791 /* bits of k determine whether to get lower or upper part of dim */ +#line 791 /* choose random stride from 1 to edge */ +#line 791 for (k = 0; k < nslabs; k++) { +#line 791 nstarts = 1; +#line 791 for (j = 0; j < var_rank[i]; j++) { +#line 791 if ((k >> j) & 1) { +#line 791 start[j] = 0; +#line 791 edge[j] = mid[j]; +#line 791 }else{ +#line 791 start[j] = mid[j]; +#line 791 edge[j] = var_shape[i][j] - mid[j]; +#line 791 } +#line 791 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 791 nstarts *= stride[j]; +#line 791 } +#line 791 for (m = 0; m < nstarts; m++) { +#line 791 err = toMixedBase(m, var_rank[i], sstride, index); +#line 791 IF (err) +#line 791 error("error in toMixedBase"); +#line 791 nels = 1; +#line 791 for (j = 0; j < var_rank[i]; j++) { +#line 791 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 791 nels *= count[j]; +#line 791 index[j] += start[j]; +#line 791 } +#line 791 /* Random choice of forward or backward */ +#line 791 /* TODO +#line 791 if ( roll(2) ) { +#line 791 for (j = 0; j < var_rank[i]; j++) { +#line 791 index[j] += (count[j] - 1) * stride[j]; +#line 791 stride[j] = -stride[j]; +#line 791 } +#line 791 } +#line 791 */ +#line 791 if (var_rank[i] > 0) { +#line 791 j = var_rank[i] - 1; +#line 791 imap[j] = 1; +#line 791 for (; j > 0; j--) +#line 791 imap[j-1] = imap[j] * count[j]; +#line 791 } +#line 791 allInExtRange = allInIntRange = 1; +#line 791 for (j = 0; j < nels; j++) { +#line 791 err = toMixedBase(j, var_rank[i], count, index2); +#line 791 IF (err) +#line 791 error("error in toMixedBase 1"); +#line 791 for (d = 0; d < var_rank[i]; d++) +#line 791 index2[d] = index[d] + index2[d] * stride[d]; +#line 791 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 791 NCT_SHORT); +#line 791 if (inRange3(expect[j],var_type[i],NCT_SHORT)) { +#line 791 allInIntRange = allInIntRange && expect[j] >= short_min +#line 791 && expect[j] <= short_max; +#line 791 } else { +#line 791 allInExtRange = 0; +#line 791 } +#line 791 } +#line 791 if (var_rank[i] == 0 && i%2 ) +#line 791 err = nc_get_varm_short(ncid,i,NULL,NULL,NULL,NULL,value); +#line 791 else +#line 791 err = nc_get_varm_short(ncid,i,index,count,stride,imap,value); +#line 791 if (canConvert) { +#line 791 if (allInExtRange) { +#line 791 if (allInIntRange) { +#line 791 IF (err) +#line 791 error("%s", nc_strerror(err)); +#line 791 } else { +#line 791 IF (err != NC_ERANGE) +#line 791 error("Range error: status = %d", err); +#line 791 } +#line 791 } else { +#line 791 IF (err != 0 && err != NC_ERANGE) +#line 791 error("OK or Range error: status = %d", err); +#line 791 } +#line 791 for (j = 0; j < nels; j++) { +#line 791 if (inRange3(expect[j],var_type[i],NCT_SHORT) +#line 791 && expect[j] >= short_min +#line 791 && expect[j] <= short_max) { +#line 791 IF (!equal(value[j],expect[j],var_type[i], NCT_SHORT)){ +#line 791 error("value read not that expected"); +#line 791 if (verbose) { +#line 791 error("\n"); +#line 791 error("varid: %d, ", i); +#line 791 error("var_name: %s, ", var_name[i]); +#line 791 error("element number: %d ", j); +#line 791 error("expect: %g, ", expect[j]); +#line 791 error("got: %g", (double) value[j]); +#line 791 } +#line 791 } else { +#line 791 nok++; +#line 791 } +#line 791 } +#line 791 } +#line 791 } else { +#line 791 IF (nels > 0 && err != NC_ECHAR) +#line 791 error("wrong type: status = %d", err); +#line 791 } +#line 791 } +#line 791 } +#line 791 } +#line 791 err = nc_close(ncid); +#line 791 IF (err) +#line 791 error("nc_close: %s", nc_strerror(err)); +#line 791 print_nok(nok); +#line 791 } +#line 791 void +#line 792 test_nc_get_varm_int(void) +#line 792 { +#line 792 int ncid; +#line 792 int d; +#line 792 int i; +#line 792 int j; +#line 792 int k; +#line 792 int m; +#line 792 int err; +#line 792 int allInExtRange; /* all values within external range? */ +#line 792 int allInIntRange; /* all values within internal range? */ +#line 792 int nels; +#line 792 int nslabs; +#line 792 int nstarts; /* number of different starts */ +#line 792 int nok = 0; /* count of valid comparisons */ +#line 792 size_t start[MAX_RANK]; +#line 792 size_t edge[MAX_RANK]; +#line 792 size_t index[MAX_RANK]; +#line 792 size_t index2[MAX_RANK]; +#line 792 size_t mid[MAX_RANK]; +#line 792 size_t count[MAX_RANK]; +#line 792 size_t sstride[MAX_RANK]; +#line 792 ptrdiff_t stride[MAX_RANK]; +#line 792 ptrdiff_t imap[MAX_RANK]; +#line 792 int canConvert; /* Both text or both numeric */ +#line 792 int value[MAX_NELS]; +#line 792 double expect[MAX_NELS]; +#line 792 +#line 792 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 792 IF (err) +#line 792 error("nc_open: %s", nc_strerror(err)); +#line 792 for (i = 0; i < NVARS; i++) { +#line 792 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 792 assert(var_rank[i] <= MAX_RANK); +#line 792 assert(var_nels[i] <= MAX_NELS); +#line 792 for (j = 0; j < var_rank[i]; j++) { +#line 792 start[j] = 0; +#line 792 edge[j] = 1; +#line 792 stride[j] = 1; +#line 792 imap[j] = 1; +#line 792 } +#line 792 err = nc_get_varm_int(BAD_ID, i, start, edge, stride, imap, value); +#line 792 IF (err != NC_EBADID) +#line 792 error("bad ncid: status = %d", err); +#line 792 err = nc_get_varm_int(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 792 IF (err != NC_ENOTVAR) +#line 792 error("bad var id: status = %d", err); +#line 792 for (j = 0; j < var_rank[i]; j++) { +#line 792 start[j] = var_shape[i][j]; +#line 792 err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value); +#line 792 if(!canConvert) { +#line 792 IF (err != NC_ECHAR) +#line 792 error("conversion: status = %d", err); +#line 792 } else { +#line 792 IF (err != NC_EINVALCOORDS) +#line 792 error("bad index: status = %d", err); +#line 792 start[j] = 0; +#line 792 edge[j] = var_shape[i][j] + 1; +#line 792 err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value); +#line 792 IF (err != NC_EEDGE) +#line 792 error("bad edge: status = %d", err); +#line 792 edge[j] = 1; +#line 792 stride[j] = 0; +#line 792 err = nc_get_varm_int(ncid, i, start, edge, stride, imap, value); +#line 792 IF (err != NC_ESTRIDE) +#line 792 error("bad stride: status = %d", err); +#line 792 stride[j] = 1; +#line 792 } +#line 792 } +#line 792 /* Choose a random point dividing each dim into 2 parts */ +#line 792 /* get 2^rank (nslabs) slabs so defined */ +#line 792 nslabs = 1; +#line 792 for (j = 0; j < var_rank[i]; j++) { +#line 792 mid[j] = roll( var_shape[i][j] ); +#line 792 nslabs *= 2; +#line 792 } +#line 792 /* bits of k determine whether to get lower or upper part of dim */ +#line 792 /* choose random stride from 1 to edge */ +#line 792 for (k = 0; k < nslabs; k++) { +#line 792 nstarts = 1; +#line 792 for (j = 0; j < var_rank[i]; j++) { +#line 792 if ((k >> j) & 1) { +#line 792 start[j] = 0; +#line 792 edge[j] = mid[j]; +#line 792 }else{ +#line 792 start[j] = mid[j]; +#line 792 edge[j] = var_shape[i][j] - mid[j]; +#line 792 } +#line 792 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 792 nstarts *= stride[j]; +#line 792 } +#line 792 for (m = 0; m < nstarts; m++) { +#line 792 err = toMixedBase(m, var_rank[i], sstride, index); +#line 792 IF (err) +#line 792 error("error in toMixedBase"); +#line 792 nels = 1; +#line 792 for (j = 0; j < var_rank[i]; j++) { +#line 792 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 792 nels *= count[j]; +#line 792 index[j] += start[j]; +#line 792 } +#line 792 /* Random choice of forward or backward */ +#line 792 /* TODO +#line 792 if ( roll(2) ) { +#line 792 for (j = 0; j < var_rank[i]; j++) { +#line 792 index[j] += (count[j] - 1) * stride[j]; +#line 792 stride[j] = -stride[j]; +#line 792 } +#line 792 } +#line 792 */ +#line 792 if (var_rank[i] > 0) { +#line 792 j = var_rank[i] - 1; +#line 792 imap[j] = 1; +#line 792 for (; j > 0; j--) +#line 792 imap[j-1] = imap[j] * count[j]; +#line 792 } +#line 792 allInExtRange = allInIntRange = 1; +#line 792 for (j = 0; j < nels; j++) { +#line 792 err = toMixedBase(j, var_rank[i], count, index2); +#line 792 IF (err) +#line 792 error("error in toMixedBase 1"); +#line 792 for (d = 0; d < var_rank[i]; d++) +#line 792 index2[d] = index[d] + index2[d] * stride[d]; +#line 792 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 792 NCT_INT); +#line 792 if (inRange3(expect[j],var_type[i],NCT_INT)) { +#line 792 allInIntRange = allInIntRange && expect[j] >= int_min +#line 792 && expect[j] <= int_max; +#line 792 } else { +#line 792 allInExtRange = 0; +#line 792 } +#line 792 } +#line 792 if (var_rank[i] == 0 && i%2 ) +#line 792 err = nc_get_varm_int(ncid,i,NULL,NULL,NULL,NULL,value); +#line 792 else +#line 792 err = nc_get_varm_int(ncid,i,index,count,stride,imap,value); +#line 792 if (canConvert) { +#line 792 if (allInExtRange) { +#line 792 if (allInIntRange) { +#line 792 IF (err) +#line 792 error("%s", nc_strerror(err)); +#line 792 } else { +#line 792 IF (err != NC_ERANGE) +#line 792 error("Range error: status = %d", err); +#line 792 } +#line 792 } else { +#line 792 IF (err != 0 && err != NC_ERANGE) +#line 792 error("OK or Range error: status = %d", err); +#line 792 } +#line 792 for (j = 0; j < nels; j++) { +#line 792 if (inRange3(expect[j],var_type[i],NCT_INT) +#line 792 && expect[j] >= int_min +#line 792 && expect[j] <= int_max) { +#line 792 IF (!equal(value[j],expect[j],var_type[i], NCT_INT)){ +#line 792 error("value read not that expected"); +#line 792 if (verbose) { +#line 792 error("\n"); +#line 792 error("varid: %d, ", i); +#line 792 error("var_name: %s, ", var_name[i]); +#line 792 error("element number: %d ", j); +#line 792 error("expect: %g, ", expect[j]); +#line 792 error("got: %g", (double) value[j]); +#line 792 } +#line 792 } else { +#line 792 nok++; +#line 792 } +#line 792 } +#line 792 } +#line 792 } else { +#line 792 IF (nels > 0 && err != NC_ECHAR) +#line 792 error("wrong type: status = %d", err); +#line 792 } +#line 792 } +#line 792 } +#line 792 } +#line 792 err = nc_close(ncid); +#line 792 IF (err) +#line 792 error("nc_close: %s", nc_strerror(err)); +#line 792 print_nok(nok); +#line 792 } +#line 792 void +#line 793 test_nc_get_varm_long(void) +#line 793 { +#line 793 int ncid; +#line 793 int d; +#line 793 int i; +#line 793 int j; +#line 793 int k; +#line 793 int m; +#line 793 int err; +#line 793 int allInExtRange; /* all values within external range? */ +#line 793 int allInIntRange; /* all values within internal range? */ +#line 793 int nels; +#line 793 int nslabs; +#line 793 int nstarts; /* number of different starts */ +#line 793 int nok = 0; /* count of valid comparisons */ +#line 793 size_t start[MAX_RANK]; +#line 793 size_t edge[MAX_RANK]; +#line 793 size_t index[MAX_RANK]; +#line 793 size_t index2[MAX_RANK]; +#line 793 size_t mid[MAX_RANK]; +#line 793 size_t count[MAX_RANK]; +#line 793 size_t sstride[MAX_RANK]; +#line 793 ptrdiff_t stride[MAX_RANK]; +#line 793 ptrdiff_t imap[MAX_RANK]; +#line 793 int canConvert; /* Both text or both numeric */ +#line 793 long value[MAX_NELS]; +#line 793 double expect[MAX_NELS]; +#line 793 +#line 793 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 793 IF (err) +#line 793 error("nc_open: %s", nc_strerror(err)); +#line 793 for (i = 0; i < NVARS; i++) { +#line 793 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 793 assert(var_rank[i] <= MAX_RANK); +#line 793 assert(var_nels[i] <= MAX_NELS); +#line 793 for (j = 0; j < var_rank[i]; j++) { +#line 793 start[j] = 0; +#line 793 edge[j] = 1; +#line 793 stride[j] = 1; +#line 793 imap[j] = 1; +#line 793 } +#line 793 err = nc_get_varm_long(BAD_ID, i, start, edge, stride, imap, value); +#line 793 IF (err != NC_EBADID) +#line 793 error("bad ncid: status = %d", err); +#line 793 err = nc_get_varm_long(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 793 IF (err != NC_ENOTVAR) +#line 793 error("bad var id: status = %d", err); +#line 793 for (j = 0; j < var_rank[i]; j++) { +#line 793 start[j] = var_shape[i][j]; +#line 793 err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value); +#line 793 if(!canConvert) { +#line 793 IF (err != NC_ECHAR) +#line 793 error("conversion: status = %d", err); +#line 793 } else { +#line 793 IF (err != NC_EINVALCOORDS) +#line 793 error("bad index: status = %d", err); +#line 793 start[j] = 0; +#line 793 edge[j] = var_shape[i][j] + 1; +#line 793 err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value); +#line 793 IF (err != NC_EEDGE) +#line 793 error("bad edge: status = %d", err); +#line 793 edge[j] = 1; +#line 793 stride[j] = 0; +#line 793 err = nc_get_varm_long(ncid, i, start, edge, stride, imap, value); +#line 793 IF (err != NC_ESTRIDE) +#line 793 error("bad stride: status = %d", err); +#line 793 stride[j] = 1; +#line 793 } +#line 793 } +#line 793 /* Choose a random point dividing each dim into 2 parts */ +#line 793 /* get 2^rank (nslabs) slabs so defined */ +#line 793 nslabs = 1; +#line 793 for (j = 0; j < var_rank[i]; j++) { +#line 793 mid[j] = roll( var_shape[i][j] ); +#line 793 nslabs *= 2; +#line 793 } +#line 793 /* bits of k determine whether to get lower or upper part of dim */ +#line 793 /* choose random stride from 1 to edge */ +#line 793 for (k = 0; k < nslabs; k++) { +#line 793 nstarts = 1; +#line 793 for (j = 0; j < var_rank[i]; j++) { +#line 793 if ((k >> j) & 1) { +#line 793 start[j] = 0; +#line 793 edge[j] = mid[j]; +#line 793 }else{ +#line 793 start[j] = mid[j]; +#line 793 edge[j] = var_shape[i][j] - mid[j]; +#line 793 } +#line 793 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 793 nstarts *= stride[j]; +#line 793 } +#line 793 for (m = 0; m < nstarts; m++) { +#line 793 err = toMixedBase(m, var_rank[i], sstride, index); +#line 793 IF (err) +#line 793 error("error in toMixedBase"); +#line 793 nels = 1; +#line 793 for (j = 0; j < var_rank[i]; j++) { +#line 793 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 793 nels *= count[j]; +#line 793 index[j] += start[j]; +#line 793 } +#line 793 /* Random choice of forward or backward */ +#line 793 /* TODO +#line 793 if ( roll(2) ) { +#line 793 for (j = 0; j < var_rank[i]; j++) { +#line 793 index[j] += (count[j] - 1) * stride[j]; +#line 793 stride[j] = -stride[j]; +#line 793 } +#line 793 } +#line 793 */ +#line 793 if (var_rank[i] > 0) { +#line 793 j = var_rank[i] - 1; +#line 793 imap[j] = 1; +#line 793 for (; j > 0; j--) +#line 793 imap[j-1] = imap[j] * count[j]; +#line 793 } +#line 793 allInExtRange = allInIntRange = 1; +#line 793 for (j = 0; j < nels; j++) { +#line 793 err = toMixedBase(j, var_rank[i], count, index2); +#line 793 IF (err) +#line 793 error("error in toMixedBase 1"); +#line 793 for (d = 0; d < var_rank[i]; d++) +#line 793 index2[d] = index[d] + index2[d] * stride[d]; +#line 793 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 793 NCT_LONG); +#line 793 if (inRange3(expect[j],var_type[i],NCT_LONG)) { +#line 793 allInIntRange = allInIntRange && expect[j] >= long_min +#line 793 && expect[j] <= long_max; +#line 793 } else { +#line 793 allInExtRange = 0; +#line 793 } +#line 793 } +#line 793 if (var_rank[i] == 0 && i%2 ) +#line 793 err = nc_get_varm_long(ncid,i,NULL,NULL,NULL,NULL,value); +#line 793 else +#line 793 err = nc_get_varm_long(ncid,i,index,count,stride,imap,value); +#line 793 if (canConvert) { +#line 793 if (allInExtRange) { +#line 793 if (allInIntRange) { +#line 793 IF (err) +#line 793 error("%s", nc_strerror(err)); +#line 793 } else { +#line 793 IF (err != NC_ERANGE) +#line 793 error("Range error: status = %d", err); +#line 793 } +#line 793 } else { +#line 793 IF (err != 0 && err != NC_ERANGE) +#line 793 error("OK or Range error: status = %d", err); +#line 793 } +#line 793 for (j = 0; j < nels; j++) { +#line 793 if (inRange3(expect[j],var_type[i],NCT_LONG) +#line 793 && expect[j] >= long_min +#line 793 && expect[j] <= long_max) { +#line 793 IF (!equal(value[j],expect[j],var_type[i], NCT_LONG)){ +#line 793 error("value read not that expected"); +#line 793 if (verbose) { +#line 793 error("\n"); +#line 793 error("varid: %d, ", i); +#line 793 error("var_name: %s, ", var_name[i]); +#line 793 error("element number: %d ", j); +#line 793 error("expect: %g, ", expect[j]); +#line 793 error("got: %g", (double) value[j]); +#line 793 } +#line 793 } else { +#line 793 nok++; +#line 793 } +#line 793 } +#line 793 } +#line 793 } else { +#line 793 IF (nels > 0 && err != NC_ECHAR) +#line 793 error("wrong type: status = %d", err); +#line 793 } +#line 793 } +#line 793 } +#line 793 } +#line 793 err = nc_close(ncid); +#line 793 IF (err) +#line 793 error("nc_close: %s", nc_strerror(err)); +#line 793 print_nok(nok); +#line 793 } +#line 793 void +#line 794 test_nc_get_varm_float(void) +#line 794 { +#line 794 int ncid; +#line 794 int d; +#line 794 int i; +#line 794 int j; +#line 794 int k; +#line 794 int m; +#line 794 int err; +#line 794 int allInExtRange; /* all values within external range? */ +#line 794 int allInIntRange; /* all values within internal range? */ +#line 794 int nels; +#line 794 int nslabs; +#line 794 int nstarts; /* number of different starts */ +#line 794 int nok = 0; /* count of valid comparisons */ +#line 794 size_t start[MAX_RANK]; +#line 794 size_t edge[MAX_RANK]; +#line 794 size_t index[MAX_RANK]; +#line 794 size_t index2[MAX_RANK]; +#line 794 size_t mid[MAX_RANK]; +#line 794 size_t count[MAX_RANK]; +#line 794 size_t sstride[MAX_RANK]; +#line 794 ptrdiff_t stride[MAX_RANK]; +#line 794 ptrdiff_t imap[MAX_RANK]; +#line 794 int canConvert; /* Both text or both numeric */ +#line 794 float value[MAX_NELS]; +#line 794 double expect[MAX_NELS]; +#line 794 +#line 794 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 794 IF (err) +#line 794 error("nc_open: %s", nc_strerror(err)); +#line 794 for (i = 0; i < NVARS; i++) { +#line 794 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 794 assert(var_rank[i] <= MAX_RANK); +#line 794 assert(var_nels[i] <= MAX_NELS); +#line 794 for (j = 0; j < var_rank[i]; j++) { +#line 794 start[j] = 0; +#line 794 edge[j] = 1; +#line 794 stride[j] = 1; +#line 794 imap[j] = 1; +#line 794 } +#line 794 err = nc_get_varm_float(BAD_ID, i, start, edge, stride, imap, value); +#line 794 IF (err != NC_EBADID) +#line 794 error("bad ncid: status = %d", err); +#line 794 err = nc_get_varm_float(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 794 IF (err != NC_ENOTVAR) +#line 794 error("bad var id: status = %d", err); +#line 794 for (j = 0; j < var_rank[i]; j++) { +#line 794 start[j] = var_shape[i][j]; +#line 794 err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value); +#line 794 if(!canConvert) { +#line 794 IF (err != NC_ECHAR) +#line 794 error("conversion: status = %d", err); +#line 794 } else { +#line 794 IF (err != NC_EINVALCOORDS) +#line 794 error("bad index: status = %d", err); +#line 794 start[j] = 0; +#line 794 edge[j] = var_shape[i][j] + 1; +#line 794 err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value); +#line 794 IF (err != NC_EEDGE) +#line 794 error("bad edge: status = %d", err); +#line 794 edge[j] = 1; +#line 794 stride[j] = 0; +#line 794 err = nc_get_varm_float(ncid, i, start, edge, stride, imap, value); +#line 794 IF (err != NC_ESTRIDE) +#line 794 error("bad stride: status = %d", err); +#line 794 stride[j] = 1; +#line 794 } +#line 794 } +#line 794 /* Choose a random point dividing each dim into 2 parts */ +#line 794 /* get 2^rank (nslabs) slabs so defined */ +#line 794 nslabs = 1; +#line 794 for (j = 0; j < var_rank[i]; j++) { +#line 794 mid[j] = roll( var_shape[i][j] ); +#line 794 nslabs *= 2; +#line 794 } +#line 794 /* bits of k determine whether to get lower or upper part of dim */ +#line 794 /* choose random stride from 1 to edge */ +#line 794 for (k = 0; k < nslabs; k++) { +#line 794 nstarts = 1; +#line 794 for (j = 0; j < var_rank[i]; j++) { +#line 794 if ((k >> j) & 1) { +#line 794 start[j] = 0; +#line 794 edge[j] = mid[j]; +#line 794 }else{ +#line 794 start[j] = mid[j]; +#line 794 edge[j] = var_shape[i][j] - mid[j]; +#line 794 } +#line 794 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 794 nstarts *= stride[j]; +#line 794 } +#line 794 for (m = 0; m < nstarts; m++) { +#line 794 err = toMixedBase(m, var_rank[i], sstride, index); +#line 794 IF (err) +#line 794 error("error in toMixedBase"); +#line 794 nels = 1; +#line 794 for (j = 0; j < var_rank[i]; j++) { +#line 794 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 794 nels *= count[j]; +#line 794 index[j] += start[j]; +#line 794 } +#line 794 /* Random choice of forward or backward */ +#line 794 /* TODO +#line 794 if ( roll(2) ) { +#line 794 for (j = 0; j < var_rank[i]; j++) { +#line 794 index[j] += (count[j] - 1) * stride[j]; +#line 794 stride[j] = -stride[j]; +#line 794 } +#line 794 } +#line 794 */ +#line 794 if (var_rank[i] > 0) { +#line 794 j = var_rank[i] - 1; +#line 794 imap[j] = 1; +#line 794 for (; j > 0; j--) +#line 794 imap[j-1] = imap[j] * count[j]; +#line 794 } +#line 794 allInExtRange = allInIntRange = 1; +#line 794 for (j = 0; j < nels; j++) { +#line 794 err = toMixedBase(j, var_rank[i], count, index2); +#line 794 IF (err) +#line 794 error("error in toMixedBase 1"); +#line 794 for (d = 0; d < var_rank[i]; d++) +#line 794 index2[d] = index[d] + index2[d] * stride[d]; +#line 794 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 794 NCT_FLOAT); +#line 794 if (inRange3(expect[j],var_type[i],NCT_FLOAT)) { +#line 794 allInIntRange = allInIntRange && expect[j] >= float_min +#line 794 && expect[j] <= float_max; +#line 794 } else { +#line 794 allInExtRange = 0; +#line 794 } +#line 794 } +#line 794 if (var_rank[i] == 0 && i%2 ) +#line 794 err = nc_get_varm_float(ncid,i,NULL,NULL,NULL,NULL,value); +#line 794 else +#line 794 err = nc_get_varm_float(ncid,i,index,count,stride,imap,value); +#line 794 if (canConvert) { +#line 794 if (allInExtRange) { +#line 794 if (allInIntRange) { +#line 794 IF (err) +#line 794 error("%s", nc_strerror(err)); +#line 794 } else { +#line 794 IF (err != NC_ERANGE) +#line 794 error("Range error: status = %d", err); +#line 794 } +#line 794 } else { +#line 794 IF (err != 0 && err != NC_ERANGE) +#line 794 error("OK or Range error: status = %d", err); +#line 794 } +#line 794 for (j = 0; j < nels; j++) { +#line 794 if (inRange3(expect[j],var_type[i],NCT_FLOAT) +#line 794 && expect[j] >= float_min +#line 794 && expect[j] <= float_max) { +#line 794 IF (!equal(value[j],expect[j],var_type[i], NCT_FLOAT)){ +#line 794 error("value read not that expected"); +#line 794 if (verbose) { +#line 794 error("\n"); +#line 794 error("varid: %d, ", i); +#line 794 error("var_name: %s, ", var_name[i]); +#line 794 error("element number: %d ", j); +#line 794 error("expect: %g, ", expect[j]); +#line 794 error("got: %g", (double) value[j]); +#line 794 } +#line 794 } else { +#line 794 nok++; +#line 794 } +#line 794 } +#line 794 } +#line 794 } else { +#line 794 IF (nels > 0 && err != NC_ECHAR) +#line 794 error("wrong type: status = %d", err); +#line 794 } +#line 794 } +#line 794 } +#line 794 } +#line 794 err = nc_close(ncid); +#line 794 IF (err) +#line 794 error("nc_close: %s", nc_strerror(err)); +#line 794 print_nok(nok); +#line 794 } +#line 794 void +#line 795 test_nc_get_varm_double(void) +#line 795 { +#line 795 int ncid; +#line 795 int d; +#line 795 int i; +#line 795 int j; +#line 795 int k; +#line 795 int m; +#line 795 int err; +#line 795 int allInExtRange; /* all values within external range? */ +#line 795 int allInIntRange; /* all values within internal range? */ +#line 795 int nels; +#line 795 int nslabs; +#line 795 int nstarts; /* number of different starts */ +#line 795 int nok = 0; /* count of valid comparisons */ +#line 795 size_t start[MAX_RANK]; +#line 795 size_t edge[MAX_RANK]; +#line 795 size_t index[MAX_RANK]; +#line 795 size_t index2[MAX_RANK]; +#line 795 size_t mid[MAX_RANK]; +#line 795 size_t count[MAX_RANK]; +#line 795 size_t sstride[MAX_RANK]; +#line 795 ptrdiff_t stride[MAX_RANK]; +#line 795 ptrdiff_t imap[MAX_RANK]; +#line 795 int canConvert; /* Both text or both numeric */ +#line 795 double value[MAX_NELS]; +#line 795 double expect[MAX_NELS]; +#line 795 +#line 795 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 795 IF (err) +#line 795 error("nc_open: %s", nc_strerror(err)); +#line 795 for (i = 0; i < NVARS; i++) { +#line 795 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 795 assert(var_rank[i] <= MAX_RANK); +#line 795 assert(var_nels[i] <= MAX_NELS); +#line 795 for (j = 0; j < var_rank[i]; j++) { +#line 795 start[j] = 0; +#line 795 edge[j] = 1; +#line 795 stride[j] = 1; +#line 795 imap[j] = 1; +#line 795 } +#line 795 err = nc_get_varm_double(BAD_ID, i, start, edge, stride, imap, value); +#line 795 IF (err != NC_EBADID) +#line 795 error("bad ncid: status = %d", err); +#line 795 err = nc_get_varm_double(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 795 IF (err != NC_ENOTVAR) +#line 795 error("bad var id: status = %d", err); +#line 795 for (j = 0; j < var_rank[i]; j++) { +#line 795 start[j] = var_shape[i][j]; +#line 795 err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value); +#line 795 if(!canConvert) { +#line 795 IF (err != NC_ECHAR) +#line 795 error("conversion: status = %d", err); +#line 795 } else { +#line 795 IF (err != NC_EINVALCOORDS) +#line 795 error("bad index: status = %d", err); +#line 795 start[j] = 0; +#line 795 edge[j] = var_shape[i][j] + 1; +#line 795 err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value); +#line 795 IF (err != NC_EEDGE) +#line 795 error("bad edge: status = %d", err); +#line 795 edge[j] = 1; +#line 795 stride[j] = 0; +#line 795 err = nc_get_varm_double(ncid, i, start, edge, stride, imap, value); +#line 795 IF (err != NC_ESTRIDE) +#line 795 error("bad stride: status = %d", err); +#line 795 stride[j] = 1; +#line 795 } +#line 795 } +#line 795 /* Choose a random point dividing each dim into 2 parts */ +#line 795 /* get 2^rank (nslabs) slabs so defined */ +#line 795 nslabs = 1; +#line 795 for (j = 0; j < var_rank[i]; j++) { +#line 795 mid[j] = roll( var_shape[i][j] ); +#line 795 nslabs *= 2; +#line 795 } +#line 795 /* bits of k determine whether to get lower or upper part of dim */ +#line 795 /* choose random stride from 1 to edge */ +#line 795 for (k = 0; k < nslabs; k++) { +#line 795 nstarts = 1; +#line 795 for (j = 0; j < var_rank[i]; j++) { +#line 795 if ((k >> j) & 1) { +#line 795 start[j] = 0; +#line 795 edge[j] = mid[j]; +#line 795 }else{ +#line 795 start[j] = mid[j]; +#line 795 edge[j] = var_shape[i][j] - mid[j]; +#line 795 } +#line 795 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 795 nstarts *= stride[j]; +#line 795 } +#line 795 for (m = 0; m < nstarts; m++) { +#line 795 err = toMixedBase(m, var_rank[i], sstride, index); +#line 795 IF (err) +#line 795 error("error in toMixedBase"); +#line 795 nels = 1; +#line 795 for (j = 0; j < var_rank[i]; j++) { +#line 795 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 795 nels *= count[j]; +#line 795 index[j] += start[j]; +#line 795 } +#line 795 /* Random choice of forward or backward */ +#line 795 /* TODO +#line 795 if ( roll(2) ) { +#line 795 for (j = 0; j < var_rank[i]; j++) { +#line 795 index[j] += (count[j] - 1) * stride[j]; +#line 795 stride[j] = -stride[j]; +#line 795 } +#line 795 } +#line 795 */ +#line 795 if (var_rank[i] > 0) { +#line 795 j = var_rank[i] - 1; +#line 795 imap[j] = 1; +#line 795 for (; j > 0; j--) +#line 795 imap[j-1] = imap[j] * count[j]; +#line 795 } +#line 795 allInExtRange = allInIntRange = 1; +#line 795 for (j = 0; j < nels; j++) { +#line 795 err = toMixedBase(j, var_rank[i], count, index2); +#line 795 IF (err) +#line 795 error("error in toMixedBase 1"); +#line 795 for (d = 0; d < var_rank[i]; d++) +#line 795 index2[d] = index[d] + index2[d] * stride[d]; +#line 795 expect[j] = hash4(var_type[i], var_rank[i], index2, +#line 795 NCT_DOUBLE); +#line 795 if (inRange3(expect[j],var_type[i],NCT_DOUBLE)) { +#line 795 allInIntRange = allInIntRange && expect[j] >= double_min +#line 795 && expect[j] <= double_max; +#line 795 } else { +#line 795 allInExtRange = 0; +#line 795 } +#line 795 } +#line 795 if (var_rank[i] == 0 && i%2 ) +#line 795 err = nc_get_varm_double(ncid,i,NULL,NULL,NULL,NULL,value); +#line 795 else +#line 795 err = nc_get_varm_double(ncid,i,index,count,stride,imap,value); +#line 795 if (canConvert) { +#line 795 if (allInExtRange) { +#line 795 if (allInIntRange) { +#line 795 IF (err) +#line 795 error("%s", nc_strerror(err)); +#line 795 } else { +#line 795 IF (err != NC_ERANGE) +#line 795 error("Range error: status = %d", err); +#line 795 } +#line 795 } else { +#line 795 IF (err != 0 && err != NC_ERANGE) +#line 795 error("OK or Range error: status = %d", err); +#line 795 } +#line 795 for (j = 0; j < nels; j++) { +#line 795 if (inRange3(expect[j],var_type[i],NCT_DOUBLE) +#line 795 && expect[j] >= double_min +#line 795 && expect[j] <= double_max) { +#line 795 IF (!equal(value[j],expect[j],var_type[i], NCT_DOUBLE)){ +#line 795 error("value read not that expected"); +#line 795 if (verbose) { +#line 795 error("\n"); +#line 795 error("varid: %d, ", i); +#line 795 error("var_name: %s, ", var_name[i]); +#line 795 error("element number: %d ", j); +#line 795 error("expect: %g, ", expect[j]); +#line 795 error("got: %g", (double) value[j]); +#line 795 } +#line 795 } else { +#line 795 nok++; +#line 795 } +#line 795 } +#line 795 } +#line 795 } else { +#line 795 IF (nels > 0 && err != NC_ECHAR) +#line 795 error("wrong type: status = %d", err); +#line 795 } +#line 795 } +#line 795 } +#line 795 } +#line 795 err = nc_close(ncid); +#line 795 IF (err) +#line 795 error("nc_close: %s", nc_strerror(err)); +#line 795 print_nok(nok); +#line 795 } +#line 795 +#line 888 void +#line 889 test_nc_get_att_text(void) +#line 889 { +#line 889 int ncid; +#line 889 int i; +#line 889 int j; +#line 889 size_t k; +#line 889 int err; +#line 889 int allInExtRange; +#line 889 int allInIntRange; +#line 889 int canConvert; /* Both text or both numeric */ +#line 889 text value[MAX_NELS]; +#line 889 double expect[MAX_NELS]; +#line 889 int nok = 0; /* count of valid comparisons */ +#line 889 +#line 889 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 889 IF (err) +#line 889 error("nc_open: %s", nc_strerror(err)); +#line 889 +#line 889 for (i = -1; i < NVARS; i++) { +#line 889 for (j = 0; j < NATTS(i); j++) { +#line 889 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 889 err = nc_get_att_text(BAD_ID, i, ATT_NAME(i,j), value); +#line 889 IF (err != NC_EBADID) +#line 889 error("bad ncid: status = %d", err); +#line 889 err = nc_get_att_text(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 889 IF (err != NC_ENOTVAR) +#line 889 error("bad var id: status = %d", err); +#line 889 err = nc_get_att_text(ncid, i, "noSuch", value); +#line 889 IF (err != NC_ENOTATT) +#line 889 error("Bad attribute name: status = %d", err); +#line 889 allInExtRange = allInIntRange = 1; +#line 889 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 889 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_TEXT); +#line 889 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_TEXT)) { +#line 889 allInIntRange = allInIntRange && expect[k] >= text_min +#line 889 && expect[k] <= text_max; +#line 889 } else { +#line 889 allInExtRange = 0; +#line 889 } +#line 889 } +#line 889 err = nc_get_att_text(ncid, i, ATT_NAME(i,j), value); +#line 889 if (canConvert || ATT_LEN(i,j) == 0) { +#line 889 if (allInExtRange) { +#line 889 if (allInIntRange) { +#line 889 IF (err) +#line 889 error("%s", nc_strerror(err)); +#line 889 } else { +#line 889 IF (err != NC_ERANGE) +#line 889 error("Range error: status = %d", err); +#line 889 } +#line 889 } else { +#line 889 IF (err != 0 && err != NC_ERANGE) +#line 889 error("OK or Range error: status = %d", err); +#line 889 } +#line 889 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 889 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_TEXT) +#line 889 && expect[k] >= text_min && expect[k] <= text_max) { +#line 889 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_TEXT)){ +#line 889 error("value read not that expected"); +#line 889 if (verbose) { +#line 889 error("\n"); +#line 889 error("varid: %d, ", i); +#line 889 error("att_name: %s, ", ATT_NAME(i,j)); +#line 889 error("element number: %d ", k); +#line 889 error("expect: %g", expect[k]); +#line 889 error("got: %g", (double) value[k]); +#line 889 } +#line 889 } else { +#line 889 nok++; +#line 889 } +#line 889 } +#line 889 } +#line 889 } else { +#line 889 IF (err != NC_ECHAR) +#line 889 error("wrong type: status = %d", err); +#line 889 } +#line 889 } +#line 889 } +#line 889 +#line 889 err = nc_close(ncid); +#line 889 IF (err) +#line 889 error("nc_close: %s", nc_strerror(err)); +#line 889 print_nok(nok); +#line 889 } +#line 889 void +#line 890 test_nc_get_att_uchar(void) +#line 890 { +#line 890 int ncid; +#line 890 int i; +#line 890 int j; +#line 890 size_t k; +#line 890 int err; +#line 890 int allInExtRange; +#line 890 int allInIntRange; +#line 890 int canConvert; /* Both text or both numeric */ +#line 890 uchar value[MAX_NELS]; +#line 890 double expect[MAX_NELS]; +#line 890 int nok = 0; /* count of valid comparisons */ +#line 890 +#line 890 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 890 IF (err) +#line 890 error("nc_open: %s", nc_strerror(err)); +#line 890 +#line 890 for (i = -1; i < NVARS; i++) { +#line 890 for (j = 0; j < NATTS(i); j++) { +#line 890 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 890 err = nc_get_att_uchar(BAD_ID, i, ATT_NAME(i,j), value); +#line 890 IF (err != NC_EBADID) +#line 890 error("bad ncid: status = %d", err); +#line 890 err = nc_get_att_uchar(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 890 IF (err != NC_ENOTVAR) +#line 890 error("bad var id: status = %d", err); +#line 890 err = nc_get_att_uchar(ncid, i, "noSuch", value); +#line 890 IF (err != NC_ENOTATT) +#line 890 error("Bad attribute name: status = %d", err); +#line 890 allInExtRange = allInIntRange = 1; +#line 890 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 890 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_UCHAR); +#line 890 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UCHAR)) { +#line 890 allInIntRange = allInIntRange && expect[k] >= uchar_min +#line 890 && expect[k] <= uchar_max; +#line 890 } else { +#line 890 allInExtRange = 0; +#line 890 } +#line 890 } +#line 890 err = nc_get_att_uchar(ncid, i, ATT_NAME(i,j), value); +#line 890 if (canConvert || ATT_LEN(i,j) == 0) { +#line 890 if (allInExtRange) { +#line 890 if (allInIntRange) { +#line 890 IF (err) +#line 890 error("%s", nc_strerror(err)); +#line 890 } else { +#line 890 IF (err != NC_ERANGE) +#line 890 error("Range error: status = %d", err); +#line 890 } +#line 890 } else { +#line 890 IF (err != 0 && err != NC_ERANGE) +#line 890 error("OK or Range error: status = %d", err); +#line 890 } +#line 890 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 890 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_UCHAR) +#line 890 && expect[k] >= uchar_min && expect[k] <= uchar_max) { +#line 890 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_UCHAR)){ +#line 890 error("value read not that expected"); +#line 890 if (verbose) { +#line 890 error("\n"); +#line 890 error("varid: %d, ", i); +#line 890 error("att_name: %s, ", ATT_NAME(i,j)); +#line 890 error("element number: %d ", k); +#line 890 error("expect: %g", expect[k]); +#line 890 error("got: %g", (double) value[k]); +#line 890 } +#line 890 } else { +#line 890 nok++; +#line 890 } +#line 890 } +#line 890 } +#line 890 } else { +#line 890 IF (err != NC_ECHAR) +#line 890 error("wrong type: status = %d", err); +#line 890 } +#line 890 } +#line 890 } +#line 890 +#line 890 err = nc_close(ncid); +#line 890 IF (err) +#line 890 error("nc_close: %s", nc_strerror(err)); +#line 890 print_nok(nok); +#line 890 } +#line 890 void +#line 891 test_nc_get_att_schar(void) +#line 891 { +#line 891 int ncid; +#line 891 int i; +#line 891 int j; +#line 891 size_t k; +#line 891 int err; +#line 891 int allInExtRange; +#line 891 int allInIntRange; +#line 891 int canConvert; /* Both text or both numeric */ +#line 891 schar value[MAX_NELS]; +#line 891 double expect[MAX_NELS]; +#line 891 int nok = 0; /* count of valid comparisons */ +#line 891 +#line 891 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 891 IF (err) +#line 891 error("nc_open: %s", nc_strerror(err)); +#line 891 +#line 891 for (i = -1; i < NVARS; i++) { +#line 891 for (j = 0; j < NATTS(i); j++) { +#line 891 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 891 err = nc_get_att_schar(BAD_ID, i, ATT_NAME(i,j), value); +#line 891 IF (err != NC_EBADID) +#line 891 error("bad ncid: status = %d", err); +#line 891 err = nc_get_att_schar(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 891 IF (err != NC_ENOTVAR) +#line 891 error("bad var id: status = %d", err); +#line 891 err = nc_get_att_schar(ncid, i, "noSuch", value); +#line 891 IF (err != NC_ENOTATT) +#line 891 error("Bad attribute name: status = %d", err); +#line 891 allInExtRange = allInIntRange = 1; +#line 891 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 891 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_SCHAR); +#line 891 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SCHAR)) { +#line 891 allInIntRange = allInIntRange && expect[k] >= schar_min +#line 891 && expect[k] <= schar_max; +#line 891 } else { +#line 891 allInExtRange = 0; +#line 891 } +#line 891 } +#line 891 err = nc_get_att_schar(ncid, i, ATT_NAME(i,j), value); +#line 891 if (canConvert || ATT_LEN(i,j) == 0) { +#line 891 if (allInExtRange) { +#line 891 if (allInIntRange) { +#line 891 IF (err) +#line 891 error("%s", nc_strerror(err)); +#line 891 } else { +#line 891 IF (err != NC_ERANGE) +#line 891 error("Range error: status = %d", err); +#line 891 } +#line 891 } else { +#line 891 IF (err != 0 && err != NC_ERANGE) +#line 891 error("OK or Range error: status = %d", err); +#line 891 } +#line 891 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 891 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SCHAR) +#line 891 && expect[k] >= schar_min && expect[k] <= schar_max) { +#line 891 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_SCHAR)){ +#line 891 error("value read not that expected"); +#line 891 if (verbose) { +#line 891 error("\n"); +#line 891 error("varid: %d, ", i); +#line 891 error("att_name: %s, ", ATT_NAME(i,j)); +#line 891 error("element number: %d ", k); +#line 891 error("expect: %g", expect[k]); +#line 891 error("got: %g", (double) value[k]); +#line 891 } +#line 891 } else { +#line 891 nok++; +#line 891 } +#line 891 } +#line 891 } +#line 891 } else { +#line 891 IF (err != NC_ECHAR) +#line 891 error("wrong type: status = %d", err); +#line 891 } +#line 891 } +#line 891 } +#line 891 +#line 891 err = nc_close(ncid); +#line 891 IF (err) +#line 891 error("nc_close: %s", nc_strerror(err)); +#line 891 print_nok(nok); +#line 891 } +#line 891 void +#line 892 test_nc_get_att_short(void) +#line 892 { +#line 892 int ncid; +#line 892 int i; +#line 892 int j; +#line 892 size_t k; +#line 892 int err; +#line 892 int allInExtRange; +#line 892 int allInIntRange; +#line 892 int canConvert; /* Both text or both numeric */ +#line 892 short value[MAX_NELS]; +#line 892 double expect[MAX_NELS]; +#line 892 int nok = 0; /* count of valid comparisons */ +#line 892 +#line 892 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 892 IF (err) +#line 892 error("nc_open: %s", nc_strerror(err)); +#line 892 +#line 892 for (i = -1; i < NVARS; i++) { +#line 892 for (j = 0; j < NATTS(i); j++) { +#line 892 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 892 err = nc_get_att_short(BAD_ID, i, ATT_NAME(i,j), value); +#line 892 IF (err != NC_EBADID) +#line 892 error("bad ncid: status = %d", err); +#line 892 err = nc_get_att_short(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 892 IF (err != NC_ENOTVAR) +#line 892 error("bad var id: status = %d", err); +#line 892 err = nc_get_att_short(ncid, i, "noSuch", value); +#line 892 IF (err != NC_ENOTATT) +#line 892 error("Bad attribute name: status = %d", err); +#line 892 allInExtRange = allInIntRange = 1; +#line 892 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 892 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_SHORT); +#line 892 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SHORT)) { +#line 892 allInIntRange = allInIntRange && expect[k] >= short_min +#line 892 && expect[k] <= short_max; +#line 892 } else { +#line 892 allInExtRange = 0; +#line 892 } +#line 892 } +#line 892 err = nc_get_att_short(ncid, i, ATT_NAME(i,j), value); +#line 892 if (canConvert || ATT_LEN(i,j) == 0) { +#line 892 if (allInExtRange) { +#line 892 if (allInIntRange) { +#line 892 IF (err) +#line 892 error("%s", nc_strerror(err)); +#line 892 } else { +#line 892 IF (err != NC_ERANGE) +#line 892 error("Range error: status = %d", err); +#line 892 } +#line 892 } else { +#line 892 IF (err != 0 && err != NC_ERANGE) +#line 892 error("OK or Range error: status = %d", err); +#line 892 } +#line 892 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 892 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_SHORT) +#line 892 && expect[k] >= short_min && expect[k] <= short_max) { +#line 892 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_SHORT)){ +#line 892 error("value read not that expected"); +#line 892 if (verbose) { +#line 892 error("\n"); +#line 892 error("varid: %d, ", i); +#line 892 error("att_name: %s, ", ATT_NAME(i,j)); +#line 892 error("element number: %d ", k); +#line 892 error("expect: %g", expect[k]); +#line 892 error("got: %g", (double) value[k]); +#line 892 } +#line 892 } else { +#line 892 nok++; +#line 892 } +#line 892 } +#line 892 } +#line 892 } else { +#line 892 IF (err != NC_ECHAR) +#line 892 error("wrong type: status = %d", err); +#line 892 } +#line 892 } +#line 892 } +#line 892 +#line 892 err = nc_close(ncid); +#line 892 IF (err) +#line 892 error("nc_close: %s", nc_strerror(err)); +#line 892 print_nok(nok); +#line 892 } +#line 892 void +#line 893 test_nc_get_att_int(void) +#line 893 { +#line 893 int ncid; +#line 893 int i; +#line 893 int j; +#line 893 size_t k; +#line 893 int err; +#line 893 int allInExtRange; +#line 893 int allInIntRange; +#line 893 int canConvert; /* Both text or both numeric */ +#line 893 int value[MAX_NELS]; +#line 893 double expect[MAX_NELS]; +#line 893 int nok = 0; /* count of valid comparisons */ +#line 893 +#line 893 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 893 IF (err) +#line 893 error("nc_open: %s", nc_strerror(err)); +#line 893 +#line 893 for (i = -1; i < NVARS; i++) { +#line 893 for (j = 0; j < NATTS(i); j++) { +#line 893 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 893 err = nc_get_att_int(BAD_ID, i, ATT_NAME(i,j), value); +#line 893 IF (err != NC_EBADID) +#line 893 error("bad ncid: status = %d", err); +#line 893 err = nc_get_att_int(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 893 IF (err != NC_ENOTVAR) +#line 893 error("bad var id: status = %d", err); +#line 893 err = nc_get_att_int(ncid, i, "noSuch", value); +#line 893 IF (err != NC_ENOTATT) +#line 893 error("Bad attribute name: status = %d", err); +#line 893 allInExtRange = allInIntRange = 1; +#line 893 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 893 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_INT); +#line 893 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_INT)) { +#line 893 allInIntRange = allInIntRange && expect[k] >= int_min +#line 893 && expect[k] <= int_max; +#line 893 } else { +#line 893 allInExtRange = 0; +#line 893 } +#line 893 } +#line 893 err = nc_get_att_int(ncid, i, ATT_NAME(i,j), value); +#line 893 if (canConvert || ATT_LEN(i,j) == 0) { +#line 893 if (allInExtRange) { +#line 893 if (allInIntRange) { +#line 893 IF (err) +#line 893 error("%s", nc_strerror(err)); +#line 893 } else { +#line 893 IF (err != NC_ERANGE) +#line 893 error("Range error: status = %d", err); +#line 893 } +#line 893 } else { +#line 893 IF (err != 0 && err != NC_ERANGE) +#line 893 error("OK or Range error: status = %d", err); +#line 893 } +#line 893 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 893 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_INT) +#line 893 && expect[k] >= int_min && expect[k] <= int_max) { +#line 893 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_INT)){ +#line 893 error("value read not that expected"); +#line 893 if (verbose) { +#line 893 error("\n"); +#line 893 error("varid: %d, ", i); +#line 893 error("att_name: %s, ", ATT_NAME(i,j)); +#line 893 error("element number: %d ", k); +#line 893 error("expect: %g", expect[k]); +#line 893 error("got: %g", (double) value[k]); +#line 893 } +#line 893 } else { +#line 893 nok++; +#line 893 } +#line 893 } +#line 893 } +#line 893 } else { +#line 893 IF (err != NC_ECHAR) +#line 893 error("wrong type: status = %d", err); +#line 893 } +#line 893 } +#line 893 } +#line 893 +#line 893 err = nc_close(ncid); +#line 893 IF (err) +#line 893 error("nc_close: %s", nc_strerror(err)); +#line 893 print_nok(nok); +#line 893 } +#line 893 void +#line 894 test_nc_get_att_long(void) +#line 894 { +#line 894 int ncid; +#line 894 int i; +#line 894 int j; +#line 894 size_t k; +#line 894 int err; +#line 894 int allInExtRange; +#line 894 int allInIntRange; +#line 894 int canConvert; /* Both text or both numeric */ +#line 894 long value[MAX_NELS]; +#line 894 double expect[MAX_NELS]; +#line 894 int nok = 0; /* count of valid comparisons */ +#line 894 +#line 894 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 894 IF (err) +#line 894 error("nc_open: %s", nc_strerror(err)); +#line 894 +#line 894 for (i = -1; i < NVARS; i++) { +#line 894 for (j = 0; j < NATTS(i); j++) { +#line 894 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 894 err = nc_get_att_long(BAD_ID, i, ATT_NAME(i,j), value); +#line 894 IF (err != NC_EBADID) +#line 894 error("bad ncid: status = %d", err); +#line 894 err = nc_get_att_long(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 894 IF (err != NC_ENOTVAR) +#line 894 error("bad var id: status = %d", err); +#line 894 err = nc_get_att_long(ncid, i, "noSuch", value); +#line 894 IF (err != NC_ENOTATT) +#line 894 error("Bad attribute name: status = %d", err); +#line 894 allInExtRange = allInIntRange = 1; +#line 894 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 894 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_LONG); +#line 894 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONG)) { +#line 894 allInIntRange = allInIntRange && expect[k] >= long_min +#line 894 && expect[k] <= long_max; +#line 894 } else { +#line 894 allInExtRange = 0; +#line 894 } +#line 894 } +#line 894 err = nc_get_att_long(ncid, i, ATT_NAME(i,j), value); +#line 894 if (canConvert || ATT_LEN(i,j) == 0) { +#line 894 if (allInExtRange) { +#line 894 if (allInIntRange) { +#line 894 IF (err) +#line 894 error("%s", nc_strerror(err)); +#line 894 } else { +#line 894 IF (err != NC_ERANGE) +#line 894 error("Range error: status = %d", err); +#line 894 } +#line 894 } else { +#line 894 IF (err != 0 && err != NC_ERANGE) +#line 894 error("OK or Range error: status = %d", err); +#line 894 } +#line 894 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 894 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_LONG) +#line 894 && expect[k] >= long_min && expect[k] <= long_max) { +#line 894 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_LONG)){ +#line 894 error("value read not that expected"); +#line 894 if (verbose) { +#line 894 error("\n"); +#line 894 error("varid: %d, ", i); +#line 894 error("att_name: %s, ", ATT_NAME(i,j)); +#line 894 error("element number: %d ", k); +#line 894 error("expect: %g", expect[k]); +#line 894 error("got: %g", (double) value[k]); +#line 894 } +#line 894 } else { +#line 894 nok++; +#line 894 } +#line 894 } +#line 894 } +#line 894 } else { +#line 894 IF (err != NC_ECHAR) +#line 894 error("wrong type: status = %d", err); +#line 894 } +#line 894 } +#line 894 } +#line 894 +#line 894 err = nc_close(ncid); +#line 894 IF (err) +#line 894 error("nc_close: %s", nc_strerror(err)); +#line 894 print_nok(nok); +#line 894 } +#line 894 void +#line 895 test_nc_get_att_float(void) +#line 895 { +#line 895 int ncid; +#line 895 int i; +#line 895 int j; +#line 895 size_t k; +#line 895 int err; +#line 895 int allInExtRange; +#line 895 int allInIntRange; +#line 895 int canConvert; /* Both text or both numeric */ +#line 895 float value[MAX_NELS]; +#line 895 double expect[MAX_NELS]; +#line 895 int nok = 0; /* count of valid comparisons */ +#line 895 +#line 895 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 895 IF (err) +#line 895 error("nc_open: %s", nc_strerror(err)); +#line 895 +#line 895 for (i = -1; i < NVARS; i++) { +#line 895 for (j = 0; j < NATTS(i); j++) { +#line 895 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 895 err = nc_get_att_float(BAD_ID, i, ATT_NAME(i,j), value); +#line 895 IF (err != NC_EBADID) +#line 895 error("bad ncid: status = %d", err); +#line 895 err = nc_get_att_float(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 895 IF (err != NC_ENOTVAR) +#line 895 error("bad var id: status = %d", err); +#line 895 err = nc_get_att_float(ncid, i, "noSuch", value); +#line 895 IF (err != NC_ENOTATT) +#line 895 error("Bad attribute name: status = %d", err); +#line 895 allInExtRange = allInIntRange = 1; +#line 895 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 895 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_FLOAT); +#line 895 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_FLOAT)) { +#line 895 allInIntRange = allInIntRange && expect[k] >= float_min +#line 895 && expect[k] <= float_max; +#line 895 } else { +#line 895 allInExtRange = 0; +#line 895 } +#line 895 } +#line 895 err = nc_get_att_float(ncid, i, ATT_NAME(i,j), value); +#line 895 if (canConvert || ATT_LEN(i,j) == 0) { +#line 895 if (allInExtRange) { +#line 895 if (allInIntRange) { +#line 895 IF (err) +#line 895 error("%s", nc_strerror(err)); +#line 895 } else { +#line 895 IF (err != NC_ERANGE) +#line 895 error("Range error: status = %d", err); +#line 895 } +#line 895 } else { +#line 895 IF (err != 0 && err != NC_ERANGE) +#line 895 error("OK or Range error: status = %d", err); +#line 895 } +#line 895 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 895 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_FLOAT) +#line 895 && expect[k] >= float_min && expect[k] <= float_max) { +#line 895 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_FLOAT)){ +#line 895 error("value read not that expected"); +#line 895 if (verbose) { +#line 895 error("\n"); +#line 895 error("varid: %d, ", i); +#line 895 error("att_name: %s, ", ATT_NAME(i,j)); +#line 895 error("element number: %d ", k); +#line 895 error("expect: %g", expect[k]); +#line 895 error("got: %g", (double) value[k]); +#line 895 } +#line 895 } else { +#line 895 nok++; +#line 895 } +#line 895 } +#line 895 } +#line 895 } else { +#line 895 IF (err != NC_ECHAR) +#line 895 error("wrong type: status = %d", err); +#line 895 } +#line 895 } +#line 895 } +#line 895 +#line 895 err = nc_close(ncid); +#line 895 IF (err) +#line 895 error("nc_close: %s", nc_strerror(err)); +#line 895 print_nok(nok); +#line 895 } +#line 895 void +#line 896 test_nc_get_att_double(void) +#line 896 { +#line 896 int ncid; +#line 896 int i; +#line 896 int j; +#line 896 size_t k; +#line 896 int err; +#line 896 int allInExtRange; +#line 896 int allInIntRange; +#line 896 int canConvert; /* Both text or both numeric */ +#line 896 double value[MAX_NELS]; +#line 896 double expect[MAX_NELS]; +#line 896 int nok = 0; /* count of valid comparisons */ +#line 896 +#line 896 err = nc_open(testfile, NC_NOWRITE, &ncid); +#line 896 IF (err) +#line 896 error("nc_open: %s", nc_strerror(err)); +#line 896 +#line 896 for (i = -1; i < NVARS; i++) { +#line 896 for (j = 0; j < NATTS(i); j++) { +#line 896 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 896 err = nc_get_att_double(BAD_ID, i, ATT_NAME(i,j), value); +#line 896 IF (err != NC_EBADID) +#line 896 error("bad ncid: status = %d", err); +#line 896 err = nc_get_att_double(ncid, BAD_VARID, ATT_NAME(i,j), value); +#line 896 IF (err != NC_ENOTVAR) +#line 896 error("bad var id: status = %d", err); +#line 896 err = nc_get_att_double(ncid, i, "noSuch", value); +#line 896 IF (err != NC_ENOTATT) +#line 896 error("Bad attribute name: status = %d", err); +#line 896 allInExtRange = allInIntRange = 1; +#line 896 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 896 expect[k] = hash4(ATT_TYPE(i,j), -1, &k, NCT_DOUBLE); +#line 896 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_DOUBLE)) { +#line 896 allInIntRange = allInIntRange && expect[k] >= double_min +#line 896 && expect[k] <= double_max; +#line 896 } else { +#line 896 allInExtRange = 0; +#line 896 } +#line 896 } +#line 896 err = nc_get_att_double(ncid, i, ATT_NAME(i,j), value); +#line 896 if (canConvert || ATT_LEN(i,j) == 0) { +#line 896 if (allInExtRange) { +#line 896 if (allInIntRange) { +#line 896 IF (err) +#line 896 error("%s", nc_strerror(err)); +#line 896 } else { +#line 896 IF (err != NC_ERANGE) +#line 896 error("Range error: status = %d", err); +#line 896 } +#line 896 } else { +#line 896 IF (err != 0 && err != NC_ERANGE) +#line 896 error("OK or Range error: status = %d", err); +#line 896 } +#line 896 for (k = 0; k < ATT_LEN(i,j); k++) { +#line 896 if (inRange3(expect[k],ATT_TYPE(i,j),NCT_DOUBLE) +#line 896 && expect[k] >= double_min && expect[k] <= double_max) { +#line 896 IF (!equal(value[k],expect[k],ATT_TYPE(i,j), NCT_DOUBLE)){ +#line 896 error("value read not that expected"); +#line 896 if (verbose) { +#line 896 error("\n"); +#line 896 error("varid: %d, ", i); +#line 896 error("att_name: %s, ", ATT_NAME(i,j)); +#line 896 error("element number: %d ", k); +#line 896 error("expect: %g", expect[k]); +#line 896 error("got: %g", (double) value[k]); +#line 896 } +#line 896 } else { +#line 896 nok++; +#line 896 } +#line 896 } +#line 896 } +#line 896 } else { +#line 896 IF (err != NC_ECHAR) +#line 896 error("wrong type: status = %d", err); +#line 896 } +#line 896 } +#line 896 } +#line 896 +#line 896 err = nc_close(ncid); +#line 896 IF (err) +#line 896 error("nc_close: %s", nc_strerror(err)); +#line 896 print_nok(nok); +#line 896 } +#line 896 diff --git a/nc_test/test_put.c b/nc_test/test_put.c index d24cc128d..39e5e2d1a 100644 --- a/nc_test/test_put.c +++ b/nc_test/test_put.c @@ -1,6858 +1,13629 @@ +#line 5 "test_put.m4" /* Do not edit this file. It is produced from the corresponding .m4 source */ +#line 7 /********************************************************************* * Copyright 1996, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. * $Id: test_put.m4,v 1.25 2005/03/08 03:04:19 ed Exp $ *********************************************************************/ +#line 31 #include "tests.h" +#line 55 /* +#line 56 * ensure hash value within range for internal TYPE +#line 56 */ +#line 56 static +#line 56 double +#line 56 hash_text( +#line 56 const nc_type type, +#line 56 const int rank, +#line 56 const size_t *index, +#line 56 const nct_itype itype) +#line 56 { +#line 56 const double min = text_min; +#line 56 const double max = text_max; +#line 56 +#line 56 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 56 } +#line 56 /* +#line 57 * ensure hash value within range for internal TYPE +#line 57 */ +#line 57 static +#line 57 double +#line 57 hash_uchar( +#line 57 const nc_type type, +#line 57 const int rank, +#line 57 const size_t *index, +#line 57 const nct_itype itype) +#line 57 { +#line 57 const double min = uchar_min; +#line 57 const double max = uchar_max; +#line 57 +#line 57 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 57 } +#line 57 /* +#line 58 * ensure hash value within range for internal TYPE +#line 58 */ +#line 58 static +#line 58 double +#line 58 hash_schar( +#line 58 const nc_type type, +#line 58 const int rank, +#line 58 const size_t *index, +#line 58 const nct_itype itype) +#line 58 { +#line 58 const double min = schar_min; +#line 58 const double max = schar_max; +#line 58 +#line 58 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 58 } +#line 58 /* +#line 59 * ensure hash value within range for internal TYPE +#line 59 */ +#line 59 static +#line 59 double +#line 59 hash_short( +#line 59 const nc_type type, +#line 59 const int rank, +#line 59 const size_t *index, +#line 59 const nct_itype itype) +#line 59 { +#line 59 const double min = short_min; +#line 59 const double max = short_max; +#line 59 +#line 59 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 59 } +#line 59 /* +#line 60 * ensure hash value within range for internal TYPE +#line 60 */ +#line 60 static +#line 60 double +#line 60 hash_int( +#line 60 const nc_type type, +#line 60 const int rank, +#line 60 const size_t *index, +#line 60 const nct_itype itype) +#line 60 { +#line 60 const double min = int_min; +#line 60 const double max = int_max; +#line 60 +#line 60 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 60 } +#line 60 /* +#line 61 * ensure hash value within range for internal TYPE +#line 61 */ +#line 61 static +#line 61 double +#line 61 hash_long( +#line 61 const nc_type type, +#line 61 const int rank, +#line 61 const size_t *index, +#line 61 const nct_itype itype) +#line 61 { +#line 61 const double min = long_min; +#line 61 const double max = long_max; +#line 61 +#line 61 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 61 } +#line 61 /* +#line 62 * ensure hash value within range for internal TYPE +#line 62 */ +#line 62 static +#line 62 double +#line 62 hash_float( +#line 62 const nc_type type, +#line 62 const int rank, +#line 62 const size_t *index, +#line 62 const nct_itype itype) +#line 62 { +#line 62 const double min = float_min; +#line 62 const double max = float_max; +#line 62 +#line 62 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 62 } +#line 62 /* +#line 63 * ensure hash value within range for internal TYPE +#line 63 */ +#line 63 static +#line 63 double +#line 63 hash_double( +#line 63 const nc_type type, +#line 63 const int rank, +#line 63 const size_t *index, +#line 63 const nct_itype itype) +#line 63 { +#line 63 const double min = double_min; +#line 63 const double max = double_max; +#line 63 +#line 63 return MAX(min, MIN(max, hash4( type, rank, index, itype))); +#line 63 } +#line 63 +#line 154 /* +#line 155 * check all vars in file which are (text/numeric) compatible with TYPE +#line 155 */ +#line 155 static +#line 155 void +#line 155 check_vars_text(const char *filename) +#line 155 { +#line 155 int ncid; /* netCDF id */ +#line 155 size_t index[MAX_RANK]; +#line 155 int err; /* status */ +#line 155 int d; +#line 155 int i; +#line 155 size_t j; +#line 155 text value; +#line 155 nc_type datatype; +#line 155 int ndims; +#line 155 int dimids[MAX_RANK]; +#line 155 double expect; +#line 155 char name[NC_MAX_NAME]; +#line 155 size_t length; +#line 155 int canConvert; /* Both text or both numeric */ +#line 155 int nok = 0; /* count of valid comparisons */ +#line 155 +#line 155 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 155 IF (err) +#line 155 error("nc_open: %s", nc_strerror(err)); +#line 155 +#line 155 for (i = 0; i < NVARS; i++) { +#line 155 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 155 if (canConvert) { +#line 155 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 155 IF (err) +#line 155 error("nc_inq_var: %s", nc_strerror(err)); +#line 155 IF (strcmp(name, var_name[i]) != 0) +#line 155 error("Unexpected var_name"); +#line 155 IF (datatype != var_type[i]) +#line 155 error("Unexpected type"); +#line 155 IF (ndims != var_rank[i]) +#line 155 error("Unexpected rank"); +#line 155 for (j = 0; j < ndims; j++) { +#line 155 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 155 IF (err) +#line 155 error("nc_inq_dim: %s", nc_strerror(err)); +#line 155 IF (length != var_shape[i][j]) +#line 155 error("Unexpected shape"); +#line 155 } +#line 155 for (j = 0; j < var_nels[i]; j++) { +#line 155 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 155 IF (err) +#line 155 error("error in toMixedBase 2"); +#line 155 expect = hash4( var_type[i], var_rank[i], index, NCT_TEXT); +#line 155 err = nc_get_var1_text(ncid, i, index, &value); +#line 155 if (inRange3(expect,datatype,NCT_TEXT)) { +#line 155 if (expect >= text_min && expect <= text_max) { +#line 155 IF (err) { +#line 155 error("nc_get_var1_text: %s", nc_strerror(err)); +#line 155 } else { +#line 155 IF (!equal(value,expect,var_type[i],NCT_TEXT)) { +#line 155 error("Var value read not that expected"); +#line 155 if (verbose) { +#line 155 error("\n"); +#line 155 error("varid: %d, ", i); +#line 155 error("var_name: %s, ", var_name[i]); +#line 155 error("index:"); +#line 155 for (d = 0; d < var_rank[i]; d++) +#line 155 error(" %d", index[d]); +#line 155 error(", expect: %g, ", expect); +#line 155 error("got: %g", (double) value); +#line 155 } +#line 155 } else { +#line 155 ++nok; +#line 155 } +#line 155 } +#line 155 } +#line 155 } +#line 155 } +#line 155 } +#line 155 } +#line 155 err = nc_close (ncid); +#line 155 IF (err) +#line 155 error("nc_close: %s", nc_strerror(err)); +#line 155 print_nok(nok); +#line 155 } +#line 155 /* +#line 156 * check all vars in file which are (text/numeric) compatible with TYPE +#line 156 */ +#line 156 static +#line 156 void +#line 156 check_vars_uchar(const char *filename) +#line 156 { +#line 156 int ncid; /* netCDF id */ +#line 156 size_t index[MAX_RANK]; +#line 156 int err; /* status */ +#line 156 int d; +#line 156 int i; +#line 156 size_t j; +#line 156 uchar value; +#line 156 nc_type datatype; +#line 156 int ndims; +#line 156 int dimids[MAX_RANK]; +#line 156 double expect; +#line 156 char name[NC_MAX_NAME]; +#line 156 size_t length; +#line 156 int canConvert; /* Both text or both numeric */ +#line 156 int nok = 0; /* count of valid comparisons */ +#line 156 +#line 156 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 156 IF (err) +#line 156 error("nc_open: %s", nc_strerror(err)); +#line 156 +#line 156 for (i = 0; i < NVARS; i++) { +#line 156 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 156 if (canConvert) { +#line 156 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 156 IF (err) +#line 156 error("nc_inq_var: %s", nc_strerror(err)); +#line 156 IF (strcmp(name, var_name[i]) != 0) +#line 156 error("Unexpected var_name"); +#line 156 IF (datatype != var_type[i]) +#line 156 error("Unexpected type"); +#line 156 IF (ndims != var_rank[i]) +#line 156 error("Unexpected rank"); +#line 156 for (j = 0; j < ndims; j++) { +#line 156 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 156 IF (err) +#line 156 error("nc_inq_dim: %s", nc_strerror(err)); +#line 156 IF (length != var_shape[i][j]) +#line 156 error("Unexpected shape"); +#line 156 } +#line 156 for (j = 0; j < var_nels[i]; j++) { +#line 156 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 156 IF (err) +#line 156 error("error in toMixedBase 2"); +#line 156 expect = hash4( var_type[i], var_rank[i], index, NCT_UCHAR); +#line 156 err = nc_get_var1_uchar(ncid, i, index, &value); +#line 156 if (inRange3(expect,datatype,NCT_UCHAR)) { +#line 156 if (expect >= uchar_min && expect <= uchar_max) { +#line 156 IF (err) { +#line 156 error("nc_get_var1_uchar: %s", nc_strerror(err)); +#line 156 } else { +#line 156 IF (!equal(value,expect,var_type[i],NCT_UCHAR)) { +#line 156 error("Var value read not that expected"); +#line 156 if (verbose) { +#line 156 error("\n"); +#line 156 error("varid: %d, ", i); +#line 156 error("var_name: %s, ", var_name[i]); +#line 156 error("index:"); +#line 156 for (d = 0; d < var_rank[i]; d++) +#line 156 error(" %d", index[d]); +#line 156 error(", expect: %g, ", expect); +#line 156 error("got: %g", (double) value); +#line 156 } +#line 156 } else { +#line 156 ++nok; +#line 156 } +#line 156 } +#line 156 } +#line 156 } +#line 156 } +#line 156 } +#line 156 } +#line 156 err = nc_close (ncid); +#line 156 IF (err) +#line 156 error("nc_close: %s", nc_strerror(err)); +#line 156 print_nok(nok); +#line 156 } +#line 156 /* +#line 157 * check all vars in file which are (text/numeric) compatible with TYPE +#line 157 */ +#line 157 static +#line 157 void +#line 157 check_vars_schar(const char *filename) +#line 157 { +#line 157 int ncid; /* netCDF id */ +#line 157 size_t index[MAX_RANK]; +#line 157 int err; /* status */ +#line 157 int d; +#line 157 int i; +#line 157 size_t j; +#line 157 schar value; +#line 157 nc_type datatype; +#line 157 int ndims; +#line 157 int dimids[MAX_RANK]; +#line 157 double expect; +#line 157 char name[NC_MAX_NAME]; +#line 157 size_t length; +#line 157 int canConvert; /* Both text or both numeric */ +#line 157 int nok = 0; /* count of valid comparisons */ +#line 157 +#line 157 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 157 IF (err) +#line 157 error("nc_open: %s", nc_strerror(err)); +#line 157 +#line 157 for (i = 0; i < NVARS; i++) { +#line 157 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 157 if (canConvert) { +#line 157 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 157 IF (err) +#line 157 error("nc_inq_var: %s", nc_strerror(err)); +#line 157 IF (strcmp(name, var_name[i]) != 0) +#line 157 error("Unexpected var_name"); +#line 157 IF (datatype != var_type[i]) +#line 157 error("Unexpected type"); +#line 157 IF (ndims != var_rank[i]) +#line 157 error("Unexpected rank"); +#line 157 for (j = 0; j < ndims; j++) { +#line 157 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 157 IF (err) +#line 157 error("nc_inq_dim: %s", nc_strerror(err)); +#line 157 IF (length != var_shape[i][j]) +#line 157 error("Unexpected shape"); +#line 157 } +#line 157 for (j = 0; j < var_nels[i]; j++) { +#line 157 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 157 IF (err) +#line 157 error("error in toMixedBase 2"); +#line 157 expect = hash4( var_type[i], var_rank[i], index, NCT_SCHAR); +#line 157 err = nc_get_var1_schar(ncid, i, index, &value); +#line 157 if (inRange3(expect,datatype,NCT_SCHAR)) { +#line 157 if (expect >= schar_min && expect <= schar_max) { +#line 157 IF (err) { +#line 157 error("nc_get_var1_schar: %s", nc_strerror(err)); +#line 157 } else { +#line 157 IF (!equal(value,expect,var_type[i],NCT_SCHAR)) { +#line 157 error("Var value read not that expected"); +#line 157 if (verbose) { +#line 157 error("\n"); +#line 157 error("varid: %d, ", i); +#line 157 error("var_name: %s, ", var_name[i]); +#line 157 error("index:"); +#line 157 for (d = 0; d < var_rank[i]; d++) +#line 157 error(" %d", index[d]); +#line 157 error(", expect: %g, ", expect); +#line 157 error("got: %g", (double) value); +#line 157 } +#line 157 } else { +#line 157 ++nok; +#line 157 } +#line 157 } +#line 157 } +#line 157 } +#line 157 } +#line 157 } +#line 157 } +#line 157 err = nc_close (ncid); +#line 157 IF (err) +#line 157 error("nc_close: %s", nc_strerror(err)); +#line 157 print_nok(nok); +#line 157 } +#line 157 /* +#line 158 * check all vars in file which are (text/numeric) compatible with TYPE +#line 158 */ +#line 158 static +#line 158 void +#line 158 check_vars_short(const char *filename) +#line 158 { +#line 158 int ncid; /* netCDF id */ +#line 158 size_t index[MAX_RANK]; +#line 158 int err; /* status */ +#line 158 int d; +#line 158 int i; +#line 158 size_t j; +#line 158 short value; +#line 158 nc_type datatype; +#line 158 int ndims; +#line 158 int dimids[MAX_RANK]; +#line 158 double expect; +#line 158 char name[NC_MAX_NAME]; +#line 158 size_t length; +#line 158 int canConvert; /* Both text or both numeric */ +#line 158 int nok = 0; /* count of valid comparisons */ +#line 158 +#line 158 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 158 IF (err) +#line 158 error("nc_open: %s", nc_strerror(err)); +#line 158 +#line 158 for (i = 0; i < NVARS; i++) { +#line 158 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 158 if (canConvert) { +#line 158 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 158 IF (err) +#line 158 error("nc_inq_var: %s", nc_strerror(err)); +#line 158 IF (strcmp(name, var_name[i]) != 0) +#line 158 error("Unexpected var_name"); +#line 158 IF (datatype != var_type[i]) +#line 158 error("Unexpected type"); +#line 158 IF (ndims != var_rank[i]) +#line 158 error("Unexpected rank"); +#line 158 for (j = 0; j < ndims; j++) { +#line 158 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 158 IF (err) +#line 158 error("nc_inq_dim: %s", nc_strerror(err)); +#line 158 IF (length != var_shape[i][j]) +#line 158 error("Unexpected shape"); +#line 158 } +#line 158 for (j = 0; j < var_nels[i]; j++) { +#line 158 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 158 IF (err) +#line 158 error("error in toMixedBase 2"); +#line 158 expect = hash4( var_type[i], var_rank[i], index, NCT_SHORT); +#line 158 err = nc_get_var1_short(ncid, i, index, &value); +#line 158 if (inRange3(expect,datatype,NCT_SHORT)) { +#line 158 if (expect >= short_min && expect <= short_max) { +#line 158 IF (err) { +#line 158 error("nc_get_var1_short: %s", nc_strerror(err)); +#line 158 } else { +#line 158 IF (!equal(value,expect,var_type[i],NCT_SHORT)) { +#line 158 error("Var value read not that expected"); +#line 158 if (verbose) { +#line 158 error("\n"); +#line 158 error("varid: %d, ", i); +#line 158 error("var_name: %s, ", var_name[i]); +#line 158 error("index:"); +#line 158 for (d = 0; d < var_rank[i]; d++) +#line 158 error(" %d", index[d]); +#line 158 error(", expect: %g, ", expect); +#line 158 error("got: %g", (double) value); +#line 158 } +#line 158 } else { +#line 158 ++nok; +#line 158 } +#line 158 } +#line 158 } +#line 158 } +#line 158 } +#line 158 } +#line 158 } +#line 158 err = nc_close (ncid); +#line 158 IF (err) +#line 158 error("nc_close: %s", nc_strerror(err)); +#line 158 print_nok(nok); +#line 158 } +#line 158 /* +#line 159 * check all vars in file which are (text/numeric) compatible with TYPE +#line 159 */ +#line 159 static +#line 159 void +#line 159 check_vars_int(const char *filename) +#line 159 { +#line 159 int ncid; /* netCDF id */ +#line 159 size_t index[MAX_RANK]; +#line 159 int err; /* status */ +#line 159 int d; +#line 159 int i; +#line 159 size_t j; +#line 159 int value; +#line 159 nc_type datatype; +#line 159 int ndims; +#line 159 int dimids[MAX_RANK]; +#line 159 double expect; +#line 159 char name[NC_MAX_NAME]; +#line 159 size_t length; +#line 159 int canConvert; /* Both text or both numeric */ +#line 159 int nok = 0; /* count of valid comparisons */ +#line 159 +#line 159 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 159 IF (err) +#line 159 error("nc_open: %s", nc_strerror(err)); +#line 159 +#line 159 for (i = 0; i < NVARS; i++) { +#line 159 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 159 if (canConvert) { +#line 159 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 159 IF (err) +#line 159 error("nc_inq_var: %s", nc_strerror(err)); +#line 159 IF (strcmp(name, var_name[i]) != 0) +#line 159 error("Unexpected var_name"); +#line 159 IF (datatype != var_type[i]) +#line 159 error("Unexpected type"); +#line 159 IF (ndims != var_rank[i]) +#line 159 error("Unexpected rank"); +#line 159 for (j = 0; j < ndims; j++) { +#line 159 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 159 IF (err) +#line 159 error("nc_inq_dim: %s", nc_strerror(err)); +#line 159 IF (length != var_shape[i][j]) +#line 159 error("Unexpected shape"); +#line 159 } +#line 159 for (j = 0; j < var_nels[i]; j++) { +#line 159 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 159 IF (err) +#line 159 error("error in toMixedBase 2"); +#line 159 expect = hash4( var_type[i], var_rank[i], index, NCT_INT); +#line 159 err = nc_get_var1_int(ncid, i, index, &value); +#line 159 if (inRange3(expect,datatype,NCT_INT)) { +#line 159 if (expect >= int_min && expect <= int_max) { +#line 159 IF (err) { +#line 159 error("nc_get_var1_int: %s", nc_strerror(err)); +#line 159 } else { +#line 159 IF (!equal(value,expect,var_type[i],NCT_INT)) { +#line 159 error("Var value read not that expected"); +#line 159 if (verbose) { +#line 159 error("\n"); +#line 159 error("varid: %d, ", i); +#line 159 error("var_name: %s, ", var_name[i]); +#line 159 error("index:"); +#line 159 for (d = 0; d < var_rank[i]; d++) +#line 159 error(" %d", index[d]); +#line 159 error(", expect: %g, ", expect); +#line 159 error("got: %g", (double) value); +#line 159 } +#line 159 } else { +#line 159 ++nok; +#line 159 } +#line 159 } +#line 159 } +#line 159 } +#line 159 } +#line 159 } +#line 159 } +#line 159 err = nc_close (ncid); +#line 159 IF (err) +#line 159 error("nc_close: %s", nc_strerror(err)); +#line 159 print_nok(nok); +#line 159 } +#line 159 /* +#line 160 * check all vars in file which are (text/numeric) compatible with TYPE +#line 160 */ +#line 160 static +#line 160 void +#line 160 check_vars_long(const char *filename) +#line 160 { +#line 160 int ncid; /* netCDF id */ +#line 160 size_t index[MAX_RANK]; +#line 160 int err; /* status */ +#line 160 int d; +#line 160 int i; +#line 160 size_t j; +#line 160 long value; +#line 160 nc_type datatype; +#line 160 int ndims; +#line 160 int dimids[MAX_RANK]; +#line 160 double expect; +#line 160 char name[NC_MAX_NAME]; +#line 160 size_t length; +#line 160 int canConvert; /* Both text or both numeric */ +#line 160 int nok = 0; /* count of valid comparisons */ +#line 160 +#line 160 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 160 IF (err) +#line 160 error("nc_open: %s", nc_strerror(err)); +#line 160 +#line 160 for (i = 0; i < NVARS; i++) { +#line 160 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 160 if (canConvert) { +#line 160 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 160 IF (err) +#line 160 error("nc_inq_var: %s", nc_strerror(err)); +#line 160 IF (strcmp(name, var_name[i]) != 0) +#line 160 error("Unexpected var_name"); +#line 160 IF (datatype != var_type[i]) +#line 160 error("Unexpected type"); +#line 160 IF (ndims != var_rank[i]) +#line 160 error("Unexpected rank"); +#line 160 for (j = 0; j < ndims; j++) { +#line 160 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 160 IF (err) +#line 160 error("nc_inq_dim: %s", nc_strerror(err)); +#line 160 IF (length != var_shape[i][j]) +#line 160 error("Unexpected shape"); +#line 160 } +#line 160 for (j = 0; j < var_nels[i]; j++) { +#line 160 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 160 IF (err) +#line 160 error("error in toMixedBase 2"); +#line 160 expect = hash4( var_type[i], var_rank[i], index, NCT_LONG); +#line 160 err = nc_get_var1_long(ncid, i, index, &value); +#line 160 if (inRange3(expect,datatype,NCT_LONG)) { +#line 160 if (expect >= long_min && expect <= long_max) { +#line 160 IF (err) { +#line 160 error("nc_get_var1_long: %s", nc_strerror(err)); +#line 160 } else { +#line 160 IF (!equal(value,expect,var_type[i],NCT_LONG)) { +#line 160 error("Var value read not that expected"); +#line 160 if (verbose) { +#line 160 error("\n"); +#line 160 error("varid: %d, ", i); +#line 160 error("var_name: %s, ", var_name[i]); +#line 160 error("index:"); +#line 160 for (d = 0; d < var_rank[i]; d++) +#line 160 error(" %d", index[d]); +#line 160 error(", expect: %g, ", expect); +#line 160 error("got: %g", (double) value); +#line 160 } +#line 160 } else { +#line 160 ++nok; +#line 160 } +#line 160 } +#line 160 } +#line 160 } +#line 160 } +#line 160 } +#line 160 } +#line 160 err = nc_close (ncid); +#line 160 IF (err) +#line 160 error("nc_close: %s", nc_strerror(err)); +#line 160 print_nok(nok); +#line 160 } +#line 160 /* +#line 161 * check all vars in file which are (text/numeric) compatible with TYPE +#line 161 */ +#line 161 static +#line 161 void +#line 161 check_vars_float(const char *filename) +#line 161 { +#line 161 int ncid; /* netCDF id */ +#line 161 size_t index[MAX_RANK]; +#line 161 int err; /* status */ +#line 161 int d; +#line 161 int i; +#line 161 size_t j; +#line 161 float value; +#line 161 nc_type datatype; +#line 161 int ndims; +#line 161 int dimids[MAX_RANK]; +#line 161 double expect; +#line 161 char name[NC_MAX_NAME]; +#line 161 size_t length; +#line 161 int canConvert; /* Both text or both numeric */ +#line 161 int nok = 0; /* count of valid comparisons */ +#line 161 +#line 161 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 161 IF (err) +#line 161 error("nc_open: %s", nc_strerror(err)); +#line 161 +#line 161 for (i = 0; i < NVARS; i++) { +#line 161 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 161 if (canConvert) { +#line 161 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 161 IF (err) +#line 161 error("nc_inq_var: %s", nc_strerror(err)); +#line 161 IF (strcmp(name, var_name[i]) != 0) +#line 161 error("Unexpected var_name"); +#line 161 IF (datatype != var_type[i]) +#line 161 error("Unexpected type"); +#line 161 IF (ndims != var_rank[i]) +#line 161 error("Unexpected rank"); +#line 161 for (j = 0; j < ndims; j++) { +#line 161 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 161 IF (err) +#line 161 error("nc_inq_dim: %s", nc_strerror(err)); +#line 161 IF (length != var_shape[i][j]) +#line 161 error("Unexpected shape"); +#line 161 } +#line 161 for (j = 0; j < var_nels[i]; j++) { +#line 161 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 161 IF (err) +#line 161 error("error in toMixedBase 2"); +#line 161 expect = hash4( var_type[i], var_rank[i], index, NCT_FLOAT); +#line 161 err = nc_get_var1_float(ncid, i, index, &value); +#line 161 if (inRange3(expect,datatype,NCT_FLOAT)) { +#line 161 if (expect >= float_min && expect <= float_max) { +#line 161 IF (err) { +#line 161 error("nc_get_var1_float: %s", nc_strerror(err)); +#line 161 } else { +#line 161 IF (!equal(value,expect,var_type[i],NCT_FLOAT)) { +#line 161 error("Var value read not that expected"); +#line 161 if (verbose) { +#line 161 error("\n"); +#line 161 error("varid: %d, ", i); +#line 161 error("var_name: %s, ", var_name[i]); +#line 161 error("index:"); +#line 161 for (d = 0; d < var_rank[i]; d++) +#line 161 error(" %d", index[d]); +#line 161 error(", expect: %g, ", expect); +#line 161 error("got: %g", (double) value); +#line 161 } +#line 161 } else { +#line 161 ++nok; +#line 161 } +#line 161 } +#line 161 } +#line 161 } +#line 161 } +#line 161 } +#line 161 } +#line 161 err = nc_close (ncid); +#line 161 IF (err) +#line 161 error("nc_close: %s", nc_strerror(err)); +#line 161 print_nok(nok); +#line 161 } +#line 161 /* +#line 162 * check all vars in file which are (text/numeric) compatible with TYPE +#line 162 */ +#line 162 static +#line 162 void +#line 162 check_vars_double(const char *filename) +#line 162 { +#line 162 int ncid; /* netCDF id */ +#line 162 size_t index[MAX_RANK]; +#line 162 int err; /* status */ +#line 162 int d; +#line 162 int i; +#line 162 size_t j; +#line 162 double value; +#line 162 nc_type datatype; +#line 162 int ndims; +#line 162 int dimids[MAX_RANK]; +#line 162 double expect; +#line 162 char name[NC_MAX_NAME]; +#line 162 size_t length; +#line 162 int canConvert; /* Both text or both numeric */ +#line 162 int nok = 0; /* count of valid comparisons */ +#line 162 +#line 162 err = nc_open(filename, NC_NOWRITE, &ncid); +#line 162 IF (err) +#line 162 error("nc_open: %s", nc_strerror(err)); +#line 162 +#line 162 for (i = 0; i < NVARS; i++) { +#line 162 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 162 if (canConvert) { +#line 162 err = nc_inq_var(ncid, i, name, &datatype, &ndims, dimids, NULL); +#line 162 IF (err) +#line 162 error("nc_inq_var: %s", nc_strerror(err)); +#line 162 IF (strcmp(name, var_name[i]) != 0) +#line 162 error("Unexpected var_name"); +#line 162 IF (datatype != var_type[i]) +#line 162 error("Unexpected type"); +#line 162 IF (ndims != var_rank[i]) +#line 162 error("Unexpected rank"); +#line 162 for (j = 0; j < ndims; j++) { +#line 162 err = nc_inq_dim(ncid, dimids[j], 0, &length); +#line 162 IF (err) +#line 162 error("nc_inq_dim: %s", nc_strerror(err)); +#line 162 IF (length != var_shape[i][j]) +#line 162 error("Unexpected shape"); +#line 162 } +#line 162 for (j = 0; j < var_nels[i]; j++) { +#line 162 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 162 IF (err) +#line 162 error("error in toMixedBase 2"); +#line 162 expect = hash4( var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 162 err = nc_get_var1_double(ncid, i, index, &value); +#line 162 if (inRange3(expect,datatype,NCT_DOUBLE)) { +#line 162 if (expect >= double_min && expect <= double_max) { +#line 162 IF (err) { +#line 162 error("nc_get_var1_double: %s", nc_strerror(err)); +#line 162 } else { +#line 162 IF (!equal(value,expect,var_type[i],NCT_DOUBLE)) { +#line 162 error("Var value read not that expected"); +#line 162 if (verbose) { +#line 162 error("\n"); +#line 162 error("varid: %d, ", i); +#line 162 error("var_name: %s, ", var_name[i]); +#line 162 error("index:"); +#line 162 for (d = 0; d < var_rank[i]; d++) +#line 162 error(" %d", index[d]); +#line 162 error(", expect: %g, ", expect); +#line 162 error("got: %g", (double) value); +#line 162 } +#line 162 } else { +#line 162 ++nok; +#line 162 } +#line 162 } +#line 162 } +#line 162 } +#line 162 } +#line 162 } +#line 162 } +#line 162 err = nc_close (ncid); +#line 162 IF (err) +#line 162 error("nc_close: %s", nc_strerror(err)); +#line 162 print_nok(nok); +#line 162 } +#line 162 +#line 244 /* +#line 245 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 245 * ignore any attributes containing values outside range of TYPE +#line 245 */ +#line 245 static +#line 245 void +#line 245 check_atts_text(int ncid) +#line 245 { +#line 245 int err; /* status */ +#line 245 int i; +#line 245 int j; +#line 245 size_t k; +#line 245 text value[MAX_NELS]; +#line 245 nc_type datatype; +#line 245 double expect[MAX_NELS]; +#line 245 size_t length; +#line 245 size_t nInExtRange; /* number values within external range */ +#line 245 size_t nInIntRange; /* number values within internal range */ +#line 245 int canConvert; /* Both text or both numeric */ +#line 245 int nok = 0; /* count of valid comparisons */ +#line 245 +#line 245 for (i = -1; i < NVARS; i++) { +#line 245 for (j = 0; j < NATTS(i); j++) { +#line 245 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 245 if (canConvert) { +#line 245 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 245 IF (err) +#line 245 error("nc_inq_att: %s", nc_strerror(err)); +#line 245 IF (datatype != ATT_TYPE(i,j)) +#line 245 error("nc_inq_att: unexpected type"); +#line 245 IF (length != ATT_LEN(i,j)) +#line 245 error("nc_inq_att: unexpected length"); +#line 245 assert(length <= MAX_NELS); +#line 245 nInIntRange = nInExtRange = 0; +#line 245 for (k = 0; k < length; k++) { +#line 245 expect[k] = hash4( datatype, -1, &k, NCT_TEXT); +#line 245 if (inRange3(expect[k], datatype, NCT_TEXT)) { +#line 245 ++nInExtRange; +#line 245 if (expect[k] >= text_min && expect[k] <= text_max) +#line 245 ++nInIntRange; +#line 245 } +#line 245 } +#line 245 err = nc_get_att_text(ncid, i, ATT_NAME(i,j), value); +#line 245 if (nInExtRange == length && nInIntRange == length) { +#line 245 IF (err) +#line 245 error("%s", nc_strerror(err)); +#line 245 } else { +#line 245 IF (err != 0 && err != NC_ERANGE) +#line 245 error("OK or Range error: status = %d", err); +#line 245 } +#line 245 for (k = 0; k < length; k++) { +#line 245 if (inRange3(expect[k],datatype,NCT_TEXT) +#line 245 && expect[k] >= text_min && expect[k] <= text_max) { +#line 245 IF (!equal(value[k],expect[k],datatype,NCT_TEXT)) { +#line 245 error("att. value read not that expected"); +#line 245 if (verbose) { +#line 245 error("\n"); +#line 245 error("varid: %d, ", i); +#line 245 error("att_name: %s, ", ATT_NAME(i,j)); +#line 245 error("element number: %d ", k); +#line 245 error("expect: %g, ", expect[k]); +#line 245 error("got: %g", (double) value[k]); +#line 245 } +#line 245 } else { +#line 245 nok++; +#line 245 } +#line 245 } +#line 245 } +#line 245 } +#line 245 } +#line 245 } +#line 245 +#line 245 print_nok(nok); +#line 245 } +#line 245 /* +#line 246 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 246 * ignore any attributes containing values outside range of TYPE +#line 246 */ +#line 246 static +#line 246 void +#line 246 check_atts_uchar(int ncid) +#line 246 { +#line 246 int err; /* status */ +#line 246 int i; +#line 246 int j; +#line 246 size_t k; +#line 246 uchar value[MAX_NELS]; +#line 246 nc_type datatype; +#line 246 double expect[MAX_NELS]; +#line 246 size_t length; +#line 246 size_t nInExtRange; /* number values within external range */ +#line 246 size_t nInIntRange; /* number values within internal range */ +#line 246 int canConvert; /* Both text or both numeric */ +#line 246 int nok = 0; /* count of valid comparisons */ +#line 246 +#line 246 for (i = -1; i < NVARS; i++) { +#line 246 for (j = 0; j < NATTS(i); j++) { +#line 246 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 246 if (canConvert) { +#line 246 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 246 IF (err) +#line 246 error("nc_inq_att: %s", nc_strerror(err)); +#line 246 IF (datatype != ATT_TYPE(i,j)) +#line 246 error("nc_inq_att: unexpected type"); +#line 246 IF (length != ATT_LEN(i,j)) +#line 246 error("nc_inq_att: unexpected length"); +#line 246 assert(length <= MAX_NELS); +#line 246 nInIntRange = nInExtRange = 0; +#line 246 for (k = 0; k < length; k++) { +#line 246 expect[k] = hash4( datatype, -1, &k, NCT_UCHAR); +#line 246 if (inRange3(expect[k], datatype, NCT_UCHAR)) { +#line 246 ++nInExtRange; +#line 246 if (expect[k] >= uchar_min && expect[k] <= uchar_max) +#line 246 ++nInIntRange; +#line 246 } +#line 246 } +#line 246 err = nc_get_att_uchar(ncid, i, ATT_NAME(i,j), value); +#line 246 if (nInExtRange == length && nInIntRange == length) { +#line 246 IF (err) +#line 246 error("%s", nc_strerror(err)); +#line 246 } else { +#line 246 IF (err != 0 && err != NC_ERANGE) +#line 246 error("OK or Range error: status = %d", err); +#line 246 } +#line 246 for (k = 0; k < length; k++) { +#line 246 if (inRange3(expect[k],datatype,NCT_UCHAR) +#line 246 && expect[k] >= uchar_min && expect[k] <= uchar_max) { +#line 246 IF (!equal(value[k],expect[k],datatype,NCT_UCHAR)) { +#line 246 error("att. value read not that expected"); +#line 246 if (verbose) { +#line 246 error("\n"); +#line 246 error("varid: %d, ", i); +#line 246 error("att_name: %s, ", ATT_NAME(i,j)); +#line 246 error("element number: %d ", k); +#line 246 error("expect: %g, ", expect[k]); +#line 246 error("got: %g", (double) value[k]); +#line 246 } +#line 246 } else { +#line 246 nok++; +#line 246 } +#line 246 } +#line 246 } +#line 246 } +#line 246 } +#line 246 } +#line 246 +#line 246 print_nok(nok); +#line 246 } +#line 246 /* +#line 247 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 247 * ignore any attributes containing values outside range of TYPE +#line 247 */ +#line 247 static +#line 247 void +#line 247 check_atts_schar(int ncid) +#line 247 { +#line 247 int err; /* status */ +#line 247 int i; +#line 247 int j; +#line 247 size_t k; +#line 247 schar value[MAX_NELS]; +#line 247 nc_type datatype; +#line 247 double expect[MAX_NELS]; +#line 247 size_t length; +#line 247 size_t nInExtRange; /* number values within external range */ +#line 247 size_t nInIntRange; /* number values within internal range */ +#line 247 int canConvert; /* Both text or both numeric */ +#line 247 int nok = 0; /* count of valid comparisons */ +#line 247 +#line 247 for (i = -1; i < NVARS; i++) { +#line 247 for (j = 0; j < NATTS(i); j++) { +#line 247 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 247 if (canConvert) { +#line 247 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 247 IF (err) +#line 247 error("nc_inq_att: %s", nc_strerror(err)); +#line 247 IF (datatype != ATT_TYPE(i,j)) +#line 247 error("nc_inq_att: unexpected type"); +#line 247 IF (length != ATT_LEN(i,j)) +#line 247 error("nc_inq_att: unexpected length"); +#line 247 assert(length <= MAX_NELS); +#line 247 nInIntRange = nInExtRange = 0; +#line 247 for (k = 0; k < length; k++) { +#line 247 expect[k] = hash4( datatype, -1, &k, NCT_SCHAR); +#line 247 if (inRange3(expect[k], datatype, NCT_SCHAR)) { +#line 247 ++nInExtRange; +#line 247 if (expect[k] >= schar_min && expect[k] <= schar_max) +#line 247 ++nInIntRange; +#line 247 } +#line 247 } +#line 247 err = nc_get_att_schar(ncid, i, ATT_NAME(i,j), value); +#line 247 if (nInExtRange == length && nInIntRange == length) { +#line 247 IF (err) +#line 247 error("%s", nc_strerror(err)); +#line 247 } else { +#line 247 IF (err != 0 && err != NC_ERANGE) +#line 247 error("OK or Range error: status = %d", err); +#line 247 } +#line 247 for (k = 0; k < length; k++) { +#line 247 if (inRange3(expect[k],datatype,NCT_SCHAR) +#line 247 && expect[k] >= schar_min && expect[k] <= schar_max) { +#line 247 IF (!equal(value[k],expect[k],datatype,NCT_SCHAR)) { +#line 247 error("att. value read not that expected"); +#line 247 if (verbose) { +#line 247 error("\n"); +#line 247 error("varid: %d, ", i); +#line 247 error("att_name: %s, ", ATT_NAME(i,j)); +#line 247 error("element number: %d ", k); +#line 247 error("expect: %g, ", expect[k]); +#line 247 error("got: %g", (double) value[k]); +#line 247 } +#line 247 } else { +#line 247 nok++; +#line 247 } +#line 247 } +#line 247 } +#line 247 } +#line 247 } +#line 247 } +#line 247 +#line 247 print_nok(nok); +#line 247 } +#line 247 /* +#line 248 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 248 * ignore any attributes containing values outside range of TYPE +#line 248 */ +#line 248 static +#line 248 void +#line 248 check_atts_short(int ncid) +#line 248 { +#line 248 int err; /* status */ +#line 248 int i; +#line 248 int j; +#line 248 size_t k; +#line 248 short value[MAX_NELS]; +#line 248 nc_type datatype; +#line 248 double expect[MAX_NELS]; +#line 248 size_t length; +#line 248 size_t nInExtRange; /* number values within external range */ +#line 248 size_t nInIntRange; /* number values within internal range */ +#line 248 int canConvert; /* Both text or both numeric */ +#line 248 int nok = 0; /* count of valid comparisons */ +#line 248 +#line 248 for (i = -1; i < NVARS; i++) { +#line 248 for (j = 0; j < NATTS(i); j++) { +#line 248 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 248 if (canConvert) { +#line 248 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 248 IF (err) +#line 248 error("nc_inq_att: %s", nc_strerror(err)); +#line 248 IF (datatype != ATT_TYPE(i,j)) +#line 248 error("nc_inq_att: unexpected type"); +#line 248 IF (length != ATT_LEN(i,j)) +#line 248 error("nc_inq_att: unexpected length"); +#line 248 assert(length <= MAX_NELS); +#line 248 nInIntRange = nInExtRange = 0; +#line 248 for (k = 0; k < length; k++) { +#line 248 expect[k] = hash4( datatype, -1, &k, NCT_SHORT); +#line 248 if (inRange3(expect[k], datatype, NCT_SHORT)) { +#line 248 ++nInExtRange; +#line 248 if (expect[k] >= short_min && expect[k] <= short_max) +#line 248 ++nInIntRange; +#line 248 } +#line 248 } +#line 248 err = nc_get_att_short(ncid, i, ATT_NAME(i,j), value); +#line 248 if (nInExtRange == length && nInIntRange == length) { +#line 248 IF (err) +#line 248 error("%s", nc_strerror(err)); +#line 248 } else { +#line 248 IF (err != 0 && err != NC_ERANGE) +#line 248 error("OK or Range error: status = %d", err); +#line 248 } +#line 248 for (k = 0; k < length; k++) { +#line 248 if (inRange3(expect[k],datatype,NCT_SHORT) +#line 248 && expect[k] >= short_min && expect[k] <= short_max) { +#line 248 IF (!equal(value[k],expect[k],datatype,NCT_SHORT)) { +#line 248 error("att. value read not that expected"); +#line 248 if (verbose) { +#line 248 error("\n"); +#line 248 error("varid: %d, ", i); +#line 248 error("att_name: %s, ", ATT_NAME(i,j)); +#line 248 error("element number: %d ", k); +#line 248 error("expect: %g, ", expect[k]); +#line 248 error("got: %g", (double) value[k]); +#line 248 } +#line 248 } else { +#line 248 nok++; +#line 248 } +#line 248 } +#line 248 } +#line 248 } +#line 248 } +#line 248 } +#line 248 +#line 248 print_nok(nok); +#line 248 } +#line 248 /* +#line 249 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 249 * ignore any attributes containing values outside range of TYPE +#line 249 */ +#line 249 static +#line 249 void +#line 249 check_atts_int(int ncid) +#line 249 { +#line 249 int err; /* status */ +#line 249 int i; +#line 249 int j; +#line 249 size_t k; +#line 249 int value[MAX_NELS]; +#line 249 nc_type datatype; +#line 249 double expect[MAX_NELS]; +#line 249 size_t length; +#line 249 size_t nInExtRange; /* number values within external range */ +#line 249 size_t nInIntRange; /* number values within internal range */ +#line 249 int canConvert; /* Both text or both numeric */ +#line 249 int nok = 0; /* count of valid comparisons */ +#line 249 +#line 249 for (i = -1; i < NVARS; i++) { +#line 249 for (j = 0; j < NATTS(i); j++) { +#line 249 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 249 if (canConvert) { +#line 249 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 249 IF (err) +#line 249 error("nc_inq_att: %s", nc_strerror(err)); +#line 249 IF (datatype != ATT_TYPE(i,j)) +#line 249 error("nc_inq_att: unexpected type"); +#line 249 IF (length != ATT_LEN(i,j)) +#line 249 error("nc_inq_att: unexpected length"); +#line 249 assert(length <= MAX_NELS); +#line 249 nInIntRange = nInExtRange = 0; +#line 249 for (k = 0; k < length; k++) { +#line 249 expect[k] = hash4( datatype, -1, &k, NCT_INT); +#line 249 if (inRange3(expect[k], datatype, NCT_INT)) { +#line 249 ++nInExtRange; +#line 249 if (expect[k] >= int_min && expect[k] <= int_max) +#line 249 ++nInIntRange; +#line 249 } +#line 249 } +#line 249 err = nc_get_att_int(ncid, i, ATT_NAME(i,j), value); +#line 249 if (nInExtRange == length && nInIntRange == length) { +#line 249 IF (err) +#line 249 error("%s", nc_strerror(err)); +#line 249 } else { +#line 249 IF (err != 0 && err != NC_ERANGE) +#line 249 error("OK or Range error: status = %d", err); +#line 249 } +#line 249 for (k = 0; k < length; k++) { +#line 249 if (inRange3(expect[k],datatype,NCT_INT) +#line 249 && expect[k] >= int_min && expect[k] <= int_max) { +#line 249 IF (!equal(value[k],expect[k],datatype,NCT_INT)) { +#line 249 error("att. value read not that expected"); +#line 249 if (verbose) { +#line 249 error("\n"); +#line 249 error("varid: %d, ", i); +#line 249 error("att_name: %s, ", ATT_NAME(i,j)); +#line 249 error("element number: %d ", k); +#line 249 error("expect: %g, ", expect[k]); +#line 249 error("got: %g", (double) value[k]); +#line 249 } +#line 249 } else { +#line 249 nok++; +#line 249 } +#line 249 } +#line 249 } +#line 249 } +#line 249 } +#line 249 } +#line 249 +#line 249 print_nok(nok); +#line 249 } +#line 249 /* +#line 250 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 250 * ignore any attributes containing values outside range of TYPE +#line 250 */ +#line 250 static +#line 250 void +#line 250 check_atts_long(int ncid) +#line 250 { +#line 250 int err; /* status */ +#line 250 int i; +#line 250 int j; +#line 250 size_t k; +#line 250 long value[MAX_NELS]; +#line 250 nc_type datatype; +#line 250 double expect[MAX_NELS]; +#line 250 size_t length; +#line 250 size_t nInExtRange; /* number values within external range */ +#line 250 size_t nInIntRange; /* number values within internal range */ +#line 250 int canConvert; /* Both text or both numeric */ +#line 250 int nok = 0; /* count of valid comparisons */ +#line 250 +#line 250 for (i = -1; i < NVARS; i++) { +#line 250 for (j = 0; j < NATTS(i); j++) { +#line 250 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 250 if (canConvert) { +#line 250 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 250 IF (err) +#line 250 error("nc_inq_att: %s", nc_strerror(err)); +#line 250 IF (datatype != ATT_TYPE(i,j)) +#line 250 error("nc_inq_att: unexpected type"); +#line 250 IF (length != ATT_LEN(i,j)) +#line 250 error("nc_inq_att: unexpected length"); +#line 250 assert(length <= MAX_NELS); +#line 250 nInIntRange = nInExtRange = 0; +#line 250 for (k = 0; k < length; k++) { +#line 250 expect[k] = hash4( datatype, -1, &k, NCT_LONG); +#line 250 if (inRange3(expect[k], datatype, NCT_LONG)) { +#line 250 ++nInExtRange; +#line 250 if (expect[k] >= long_min && expect[k] <= long_max) +#line 250 ++nInIntRange; +#line 250 } +#line 250 } +#line 250 err = nc_get_att_long(ncid, i, ATT_NAME(i,j), value); +#line 250 if (nInExtRange == length && nInIntRange == length) { +#line 250 IF (err) +#line 250 error("%s", nc_strerror(err)); +#line 250 } else { +#line 250 IF (err != 0 && err != NC_ERANGE) +#line 250 error("OK or Range error: status = %d", err); +#line 250 } +#line 250 for (k = 0; k < length; k++) { +#line 250 if (inRange3(expect[k],datatype,NCT_LONG) +#line 250 && expect[k] >= long_min && expect[k] <= long_max) { +#line 250 IF (!equal(value[k],expect[k],datatype,NCT_LONG)) { +#line 250 error("att. value read not that expected"); +#line 250 if (verbose) { +#line 250 error("\n"); +#line 250 error("varid: %d, ", i); +#line 250 error("att_name: %s, ", ATT_NAME(i,j)); +#line 250 error("element number: %d ", k); +#line 250 error("expect: %g, ", expect[k]); +#line 250 error("got: %g", (double) value[k]); +#line 250 } +#line 250 } else { +#line 250 nok++; +#line 250 } +#line 250 } +#line 250 } +#line 250 } +#line 250 } +#line 250 } +#line 250 +#line 250 print_nok(nok); +#line 250 } +#line 250 /* +#line 251 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 251 * ignore any attributes containing values outside range of TYPE +#line 251 */ +#line 251 static +#line 251 void +#line 251 check_atts_float(int ncid) +#line 251 { +#line 251 int err; /* status */ +#line 251 int i; +#line 251 int j; +#line 251 size_t k; +#line 251 float value[MAX_NELS]; +#line 251 nc_type datatype; +#line 251 double expect[MAX_NELS]; +#line 251 size_t length; +#line 251 size_t nInExtRange; /* number values within external range */ +#line 251 size_t nInIntRange; /* number values within internal range */ +#line 251 int canConvert; /* Both text or both numeric */ +#line 251 int nok = 0; /* count of valid comparisons */ +#line 251 +#line 251 for (i = -1; i < NVARS; i++) { +#line 251 for (j = 0; j < NATTS(i); j++) { +#line 251 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 251 if (canConvert) { +#line 251 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 251 IF (err) +#line 251 error("nc_inq_att: %s", nc_strerror(err)); +#line 251 IF (datatype != ATT_TYPE(i,j)) +#line 251 error("nc_inq_att: unexpected type"); +#line 251 IF (length != ATT_LEN(i,j)) +#line 251 error("nc_inq_att: unexpected length"); +#line 251 assert(length <= MAX_NELS); +#line 251 nInIntRange = nInExtRange = 0; +#line 251 for (k = 0; k < length; k++) { +#line 251 expect[k] = hash4( datatype, -1, &k, NCT_FLOAT); +#line 251 if (inRange3(expect[k], datatype, NCT_FLOAT)) { +#line 251 ++nInExtRange; +#line 251 if (expect[k] >= float_min && expect[k] <= float_max) +#line 251 ++nInIntRange; +#line 251 } +#line 251 } +#line 251 err = nc_get_att_float(ncid, i, ATT_NAME(i,j), value); +#line 251 if (nInExtRange == length && nInIntRange == length) { +#line 251 IF (err) +#line 251 error("%s", nc_strerror(err)); +#line 251 } else { +#line 251 IF (err != 0 && err != NC_ERANGE) +#line 251 error("OK or Range error: status = %d", err); +#line 251 } +#line 251 for (k = 0; k < length; k++) { +#line 251 if (inRange3(expect[k],datatype,NCT_FLOAT) +#line 251 && expect[k] >= float_min && expect[k] <= float_max) { +#line 251 IF (!equal(value[k],expect[k],datatype,NCT_FLOAT)) { +#line 251 error("att. value read not that expected"); +#line 251 if (verbose) { +#line 251 error("\n"); +#line 251 error("varid: %d, ", i); +#line 251 error("att_name: %s, ", ATT_NAME(i,j)); +#line 251 error("element number: %d ", k); +#line 251 error("expect: %g, ", expect[k]); +#line 251 error("got: %g", (double) value[k]); +#line 251 } +#line 251 } else { +#line 251 nok++; +#line 251 } +#line 251 } +#line 251 } +#line 251 } +#line 251 } +#line 251 } +#line 251 +#line 251 print_nok(nok); +#line 251 } +#line 251 /* +#line 252 * check all attributes in file which are (text/numeric) compatible with TYPE +#line 252 * ignore any attributes containing values outside range of TYPE +#line 252 */ +#line 252 static +#line 252 void +#line 252 check_atts_double(int ncid) +#line 252 { +#line 252 int err; /* status */ +#line 252 int i; +#line 252 int j; +#line 252 size_t k; +#line 252 double value[MAX_NELS]; +#line 252 nc_type datatype; +#line 252 double expect[MAX_NELS]; +#line 252 size_t length; +#line 252 size_t nInExtRange; /* number values within external range */ +#line 252 size_t nInIntRange; /* number values within internal range */ +#line 252 int canConvert; /* Both text or both numeric */ +#line 252 int nok = 0; /* count of valid comparisons */ +#line 252 +#line 252 for (i = -1; i < NVARS; i++) { +#line 252 for (j = 0; j < NATTS(i); j++) { +#line 252 canConvert = (ATT_TYPE(i,j) == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 252 if (canConvert) { +#line 252 err = nc_inq_att(ncid, i, ATT_NAME(i,j), &datatype, &length); +#line 252 IF (err) +#line 252 error("nc_inq_att: %s", nc_strerror(err)); +#line 252 IF (datatype != ATT_TYPE(i,j)) +#line 252 error("nc_inq_att: unexpected type"); +#line 252 IF (length != ATT_LEN(i,j)) +#line 252 error("nc_inq_att: unexpected length"); +#line 252 assert(length <= MAX_NELS); +#line 252 nInIntRange = nInExtRange = 0; +#line 252 for (k = 0; k < length; k++) { +#line 252 expect[k] = hash4( datatype, -1, &k, NCT_DOUBLE); +#line 252 if (inRange3(expect[k], datatype, NCT_DOUBLE)) { +#line 252 ++nInExtRange; +#line 252 if (expect[k] >= double_min && expect[k] <= double_max) +#line 252 ++nInIntRange; +#line 252 } +#line 252 } +#line 252 err = nc_get_att_double(ncid, i, ATT_NAME(i,j), value); +#line 252 if (nInExtRange == length && nInIntRange == length) { +#line 252 IF (err) +#line 252 error("%s", nc_strerror(err)); +#line 252 } else { +#line 252 IF (err != 0 && err != NC_ERANGE) +#line 252 error("OK or Range error: status = %d", err); +#line 252 } +#line 252 for (k = 0; k < length; k++) { +#line 252 if (inRange3(expect[k],datatype,NCT_DOUBLE) +#line 252 && expect[k] >= double_min && expect[k] <= double_max) { +#line 252 IF (!equal(value[k],expect[k],datatype,NCT_DOUBLE)) { +#line 252 error("att. value read not that expected"); +#line 252 if (verbose) { +#line 252 error("\n"); +#line 252 error("varid: %d, ", i); +#line 252 error("att_name: %s, ", ATT_NAME(i,j)); +#line 252 error("element number: %d ", k); +#line 252 error("expect: %g, ", expect[k]); +#line 252 error("got: %g", (double) value[k]); +#line 252 } +#line 252 } else { +#line 252 nok++; +#line 252 } +#line 252 } +#line 252 } +#line 252 } +#line 252 } +#line 252 } +#line 252 +#line 252 print_nok(nok); +#line 252 } +#line 252 +#line 339 void +#line 340 test_nc_put_var1_text(void) +#line 340 { +#line 340 int ncid; +#line 340 int i; +#line 340 int j; +#line 340 int err; +#line 340 size_t index[MAX_RANK]; +#line 340 int canConvert; /* Both text or both numeric */ +#line 340 text value = 5; /* any value would do - only for error cases */ +#line 340 +#line 340 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 340 IF (err) { +#line 340 error("nc_create: %s", nc_strerror(err)); +#line 340 return; +#line 340 } +#line 340 def_dims(ncid); +#line 340 def_vars(ncid); +#line 340 err = nc_enddef(ncid); +#line 340 IF (err) +#line 340 error("nc_enddef: %s", nc_strerror(err)); +#line 340 +#line 340 for (i = 0; i < NVARS; i++) { +#line 340 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 340 for (j = 0; j < var_rank[i]; j++) +#line 340 index[j] = 0; +#line 340 err = nc_put_var1_text(BAD_ID, i, index, &value); +#line 340 IF (err != NC_EBADID) +#line 340 error("bad ncid: status = %d", err); +#line 340 err = nc_put_var1_text(ncid, BAD_VARID, index, &value); +#line 340 IF (err != NC_ENOTVAR) +#line 340 error("bad var id: status = %d", err); +#line 340 for (j = 0; j < var_rank[i]; j++) { +#line 340 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 340 index[j] = var_shape[i][j]; +#line 340 err = nc_put_var1_text(ncid, i, index, &value); +#line 340 IF (canConvert && err != NC_EINVALCOORDS) +#line 340 error("bad index: status = %d", err); +#line 340 index[j] = 0; +#line 340 } +#line 340 } +#line 340 for (j = 0; j < var_nels[i]; j++) { +#line 340 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 340 IF (err) +#line 340 error("error in toMixedBase 1"); +#line 340 value = hash_text( var_type[i], var_rank[i], index, NCT_TEXT); +#line 340 if (var_rank[i] == 0 && i%2 == 0) +#line 340 err = nc_put_var1_text(ncid, i, NULL, &value); +#line 340 else +#line 340 err = nc_put_var1_text(ncid, i, index, &value); +#line 340 if (canConvert) { +#line 340 if (inRange3(value, var_type[i],NCT_TEXT)) { +#line 340 IF (err) +#line 340 error("%s", nc_strerror(err)); +#line 340 } else { +#line 340 IF (err != NC_ERANGE) { +#line 340 error("Range error: status = %d", err); +#line 340 error("\n\t\tfor type %s value %.17e %ld", +#line 340 s_nc_type(var_type[i]), +#line 340 (double)value, (long)value); +#line 340 } +#line 340 } +#line 340 } else { +#line 340 IF (err != NC_ECHAR) +#line 340 error("wrong type: status = %d", err); +#line 340 } +#line 340 } +#line 340 } +#line 340 +#line 340 err = nc_close(ncid); +#line 340 IF (err) +#line 340 error("nc_close: %s", nc_strerror(err)); +#line 340 +#line 340 check_vars_text(scratch); +#line 340 +#line 340 err = remove(scratch); +#line 340 IF (err) +#line 340 error("remove of %s failed", scratch); +#line 340 } +#line 340 void +#line 341 test_nc_put_var1_uchar(void) +#line 341 { +#line 341 int ncid; +#line 341 int i; +#line 341 int j; +#line 341 int err; +#line 341 size_t index[MAX_RANK]; +#line 341 int canConvert; /* Both text or both numeric */ +#line 341 uchar value = 5; /* any value would do - only for error cases */ +#line 341 +#line 341 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 341 IF (err) { +#line 341 error("nc_create: %s", nc_strerror(err)); +#line 341 return; +#line 341 } +#line 341 def_dims(ncid); +#line 341 def_vars(ncid); +#line 341 err = nc_enddef(ncid); +#line 341 IF (err) +#line 341 error("nc_enddef: %s", nc_strerror(err)); +#line 341 +#line 341 for (i = 0; i < NVARS; i++) { +#line 341 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 341 for (j = 0; j < var_rank[i]; j++) +#line 341 index[j] = 0; +#line 341 err = nc_put_var1_uchar(BAD_ID, i, index, &value); +#line 341 IF (err != NC_EBADID) +#line 341 error("bad ncid: status = %d", err); +#line 341 err = nc_put_var1_uchar(ncid, BAD_VARID, index, &value); +#line 341 IF (err != NC_ENOTVAR) +#line 341 error("bad var id: status = %d", err); +#line 341 for (j = 0; j < var_rank[i]; j++) { +#line 341 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 341 index[j] = var_shape[i][j]; +#line 341 err = nc_put_var1_uchar(ncid, i, index, &value); +#line 341 IF (canConvert && err != NC_EINVALCOORDS) +#line 341 error("bad index: status = %d", err); +#line 341 index[j] = 0; +#line 341 } +#line 341 } +#line 341 for (j = 0; j < var_nels[i]; j++) { +#line 341 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 341 IF (err) +#line 341 error("error in toMixedBase 1"); +#line 341 value = hash_uchar( var_type[i], var_rank[i], index, NCT_UCHAR); +#line 341 if (var_rank[i] == 0 && i%2 == 0) +#line 341 err = nc_put_var1_uchar(ncid, i, NULL, &value); +#line 341 else +#line 341 err = nc_put_var1_uchar(ncid, i, index, &value); +#line 341 if (canConvert) { +#line 341 if (inRange3(value, var_type[i],NCT_UCHAR)) { +#line 341 IF (err) +#line 341 error("%s", nc_strerror(err)); +#line 341 } else { +#line 341 IF (err != NC_ERANGE) { +#line 341 error("Range error: status = %d", err); +#line 341 error("\n\t\tfor type %s value %.17e %ld", +#line 341 s_nc_type(var_type[i]), +#line 341 (double)value, (long)value); +#line 341 } +#line 341 } +#line 341 } else { +#line 341 IF (err != NC_ECHAR) +#line 341 error("wrong type: status = %d", err); +#line 341 } +#line 341 } +#line 341 } +#line 341 +#line 341 err = nc_close(ncid); +#line 341 IF (err) +#line 341 error("nc_close: %s", nc_strerror(err)); +#line 341 +#line 341 check_vars_uchar(scratch); +#line 341 +#line 341 err = remove(scratch); +#line 341 IF (err) +#line 341 error("remove of %s failed", scratch); +#line 341 } +#line 341 void +#line 342 test_nc_put_var1_schar(void) +#line 342 { +#line 342 int ncid; +#line 342 int i; +#line 342 int j; +#line 342 int err; +#line 342 size_t index[MAX_RANK]; +#line 342 int canConvert; /* Both text or both numeric */ +#line 342 schar value = 5; /* any value would do - only for error cases */ +#line 342 +#line 342 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 342 IF (err) { +#line 342 error("nc_create: %s", nc_strerror(err)); +#line 342 return; +#line 342 } +#line 342 def_dims(ncid); +#line 342 def_vars(ncid); +#line 342 err = nc_enddef(ncid); +#line 342 IF (err) +#line 342 error("nc_enddef: %s", nc_strerror(err)); +#line 342 +#line 342 for (i = 0; i < NVARS; i++) { +#line 342 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 342 for (j = 0; j < var_rank[i]; j++) +#line 342 index[j] = 0; +#line 342 err = nc_put_var1_schar(BAD_ID, i, index, &value); +#line 342 IF (err != NC_EBADID) +#line 342 error("bad ncid: status = %d", err); +#line 342 err = nc_put_var1_schar(ncid, BAD_VARID, index, &value); +#line 342 IF (err != NC_ENOTVAR) +#line 342 error("bad var id: status = %d", err); +#line 342 for (j = 0; j < var_rank[i]; j++) { +#line 342 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 342 index[j] = var_shape[i][j]; +#line 342 err = nc_put_var1_schar(ncid, i, index, &value); +#line 342 IF (canConvert && err != NC_EINVALCOORDS) +#line 342 error("bad index: status = %d", err); +#line 342 index[j] = 0; +#line 342 } +#line 342 } +#line 342 for (j = 0; j < var_nels[i]; j++) { +#line 342 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 342 IF (err) +#line 342 error("error in toMixedBase 1"); +#line 342 value = hash_schar( var_type[i], var_rank[i], index, NCT_SCHAR); +#line 342 if (var_rank[i] == 0 && i%2 == 0) +#line 342 err = nc_put_var1_schar(ncid, i, NULL, &value); +#line 342 else +#line 342 err = nc_put_var1_schar(ncid, i, index, &value); +#line 342 if (canConvert) { +#line 342 if (inRange3(value, var_type[i],NCT_SCHAR)) { +#line 342 IF (err) +#line 342 error("%s", nc_strerror(err)); +#line 342 } else { +#line 342 IF (err != NC_ERANGE) { +#line 342 error("Range error: status = %d", err); +#line 342 error("\n\t\tfor type %s value %.17e %ld", +#line 342 s_nc_type(var_type[i]), +#line 342 (double)value, (long)value); +#line 342 } +#line 342 } +#line 342 } else { +#line 342 IF (err != NC_ECHAR) +#line 342 error("wrong type: status = %d", err); +#line 342 } +#line 342 } +#line 342 } +#line 342 +#line 342 err = nc_close(ncid); +#line 342 IF (err) +#line 342 error("nc_close: %s", nc_strerror(err)); +#line 342 +#line 342 check_vars_schar(scratch); +#line 342 +#line 342 err = remove(scratch); +#line 342 IF (err) +#line 342 error("remove of %s failed", scratch); +#line 342 } +#line 342 void +#line 343 test_nc_put_var1_short(void) +#line 343 { +#line 343 int ncid; +#line 343 int i; +#line 343 int j; +#line 343 int err; +#line 343 size_t index[MAX_RANK]; +#line 343 int canConvert; /* Both text or both numeric */ +#line 343 short value = 5; /* any value would do - only for error cases */ +#line 343 +#line 343 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 343 IF (err) { +#line 343 error("nc_create: %s", nc_strerror(err)); +#line 343 return; +#line 343 } +#line 343 def_dims(ncid); +#line 343 def_vars(ncid); +#line 343 err = nc_enddef(ncid); +#line 343 IF (err) +#line 343 error("nc_enddef: %s", nc_strerror(err)); +#line 343 +#line 343 for (i = 0; i < NVARS; i++) { +#line 343 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 343 for (j = 0; j < var_rank[i]; j++) +#line 343 index[j] = 0; +#line 343 err = nc_put_var1_short(BAD_ID, i, index, &value); +#line 343 IF (err != NC_EBADID) +#line 343 error("bad ncid: status = %d", err); +#line 343 err = nc_put_var1_short(ncid, BAD_VARID, index, &value); +#line 343 IF (err != NC_ENOTVAR) +#line 343 error("bad var id: status = %d", err); +#line 343 for (j = 0; j < var_rank[i]; j++) { +#line 343 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 343 index[j] = var_shape[i][j]; +#line 343 err = nc_put_var1_short(ncid, i, index, &value); +#line 343 IF (canConvert && err != NC_EINVALCOORDS) +#line 343 error("bad index: status = %d", err); +#line 343 index[j] = 0; +#line 343 } +#line 343 } +#line 343 for (j = 0; j < var_nels[i]; j++) { +#line 343 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 343 IF (err) +#line 343 error("error in toMixedBase 1"); +#line 343 value = hash_short( var_type[i], var_rank[i], index, NCT_SHORT); +#line 343 if (var_rank[i] == 0 && i%2 == 0) +#line 343 err = nc_put_var1_short(ncid, i, NULL, &value); +#line 343 else +#line 343 err = nc_put_var1_short(ncid, i, index, &value); +#line 343 if (canConvert) { +#line 343 if (inRange3(value, var_type[i],NCT_SHORT)) { +#line 343 IF (err) +#line 343 error("%s", nc_strerror(err)); +#line 343 } else { +#line 343 IF (err != NC_ERANGE) { +#line 343 error("Range error: status = %d", err); +#line 343 error("\n\t\tfor type %s value %.17e %ld", +#line 343 s_nc_type(var_type[i]), +#line 343 (double)value, (long)value); +#line 343 } +#line 343 } +#line 343 } else { +#line 343 IF (err != NC_ECHAR) +#line 343 error("wrong type: status = %d", err); +#line 343 } +#line 343 } +#line 343 } +#line 343 +#line 343 err = nc_close(ncid); +#line 343 IF (err) +#line 343 error("nc_close: %s", nc_strerror(err)); +#line 343 +#line 343 check_vars_short(scratch); +#line 343 +#line 343 err = remove(scratch); +#line 343 IF (err) +#line 343 error("remove of %s failed", scratch); +#line 343 } +#line 343 void +#line 344 test_nc_put_var1_int(void) +#line 344 { +#line 344 int ncid; +#line 344 int i; +#line 344 int j; +#line 344 int err; +#line 344 size_t index[MAX_RANK]; +#line 344 int canConvert; /* Both text or both numeric */ +#line 344 int value = 5; /* any value would do - only for error cases */ +#line 344 +#line 344 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 344 IF (err) { +#line 344 error("nc_create: %s", nc_strerror(err)); +#line 344 return; +#line 344 } +#line 344 def_dims(ncid); +#line 344 def_vars(ncid); +#line 344 err = nc_enddef(ncid); +#line 344 IF (err) +#line 344 error("nc_enddef: %s", nc_strerror(err)); +#line 344 +#line 344 for (i = 0; i < NVARS; i++) { +#line 344 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 344 for (j = 0; j < var_rank[i]; j++) +#line 344 index[j] = 0; +#line 344 err = nc_put_var1_int(BAD_ID, i, index, &value); +#line 344 IF (err != NC_EBADID) +#line 344 error("bad ncid: status = %d", err); +#line 344 err = nc_put_var1_int(ncid, BAD_VARID, index, &value); +#line 344 IF (err != NC_ENOTVAR) +#line 344 error("bad var id: status = %d", err); +#line 344 for (j = 0; j < var_rank[i]; j++) { +#line 344 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 344 index[j] = var_shape[i][j]; +#line 344 err = nc_put_var1_int(ncid, i, index, &value); +#line 344 IF (canConvert && err != NC_EINVALCOORDS) +#line 344 error("bad index: status = %d", err); +#line 344 index[j] = 0; +#line 344 } +#line 344 } +#line 344 for (j = 0; j < var_nels[i]; j++) { +#line 344 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 344 IF (err) +#line 344 error("error in toMixedBase 1"); +#line 344 value = hash_int( var_type[i], var_rank[i], index, NCT_INT); +#line 344 if (var_rank[i] == 0 && i%2 == 0) +#line 344 err = nc_put_var1_int(ncid, i, NULL, &value); +#line 344 else +#line 344 err = nc_put_var1_int(ncid, i, index, &value); +#line 344 if (canConvert) { +#line 344 if (inRange3(value, var_type[i],NCT_INT)) { +#line 344 IF (err) +#line 344 error("%s", nc_strerror(err)); +#line 344 } else { +#line 344 IF (err != NC_ERANGE) { +#line 344 error("Range error: status = %d", err); +#line 344 error("\n\t\tfor type %s value %.17e %ld", +#line 344 s_nc_type(var_type[i]), +#line 344 (double)value, (long)value); +#line 344 } +#line 344 } +#line 344 } else { +#line 344 IF (err != NC_ECHAR) +#line 344 error("wrong type: status = %d", err); +#line 344 } +#line 344 } +#line 344 } +#line 344 +#line 344 err = nc_close(ncid); +#line 344 IF (err) +#line 344 error("nc_close: %s", nc_strerror(err)); +#line 344 +#line 344 check_vars_int(scratch); +#line 344 +#line 344 err = remove(scratch); +#line 344 IF (err) +#line 344 error("remove of %s failed", scratch); +#line 344 } +#line 344 void +#line 345 test_nc_put_var1_long(void) +#line 345 { +#line 345 int ncid; +#line 345 int i; +#line 345 int j; +#line 345 int err; +#line 345 size_t index[MAX_RANK]; +#line 345 int canConvert; /* Both text or both numeric */ +#line 345 long value = 5; /* any value would do - only for error cases */ +#line 345 +#line 345 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 345 IF (err) { +#line 345 error("nc_create: %s", nc_strerror(err)); +#line 345 return; +#line 345 } +#line 345 def_dims(ncid); +#line 345 def_vars(ncid); +#line 345 err = nc_enddef(ncid); +#line 345 IF (err) +#line 345 error("nc_enddef: %s", nc_strerror(err)); +#line 345 +#line 345 for (i = 0; i < NVARS; i++) { +#line 345 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 345 for (j = 0; j < var_rank[i]; j++) +#line 345 index[j] = 0; +#line 345 err = nc_put_var1_long(BAD_ID, i, index, &value); +#line 345 IF (err != NC_EBADID) +#line 345 error("bad ncid: status = %d", err); +#line 345 err = nc_put_var1_long(ncid, BAD_VARID, index, &value); +#line 345 IF (err != NC_ENOTVAR) +#line 345 error("bad var id: status = %d", err); +#line 345 for (j = 0; j < var_rank[i]; j++) { +#line 345 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 345 index[j] = var_shape[i][j]; +#line 345 err = nc_put_var1_long(ncid, i, index, &value); +#line 345 IF (canConvert && err != NC_EINVALCOORDS) +#line 345 error("bad index: status = %d", err); +#line 345 index[j] = 0; +#line 345 } +#line 345 } +#line 345 for (j = 0; j < var_nels[i]; j++) { +#line 345 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 345 IF (err) +#line 345 error("error in toMixedBase 1"); +#line 345 value = hash_long( var_type[i], var_rank[i], index, NCT_LONG); +#line 345 if (var_rank[i] == 0 && i%2 == 0) +#line 345 err = nc_put_var1_long(ncid, i, NULL, &value); +#line 345 else +#line 345 err = nc_put_var1_long(ncid, i, index, &value); +#line 345 if (canConvert) { +#line 345 if (inRange3(value, var_type[i],NCT_LONG)) { +#line 345 IF (err) +#line 345 error("%s", nc_strerror(err)); +#line 345 } else { +#line 345 IF (err != NC_ERANGE) { +#line 345 error("Range error: status = %d", err); +#line 345 error("\n\t\tfor type %s value %.17e %ld", +#line 345 s_nc_type(var_type[i]), +#line 345 (double)value, (long)value); +#line 345 } +#line 345 } +#line 345 } else { +#line 345 IF (err != NC_ECHAR) +#line 345 error("wrong type: status = %d", err); +#line 345 } +#line 345 } +#line 345 } +#line 345 +#line 345 err = nc_close(ncid); +#line 345 IF (err) +#line 345 error("nc_close: %s", nc_strerror(err)); +#line 345 +#line 345 check_vars_long(scratch); +#line 345 +#line 345 err = remove(scratch); +#line 345 IF (err) +#line 345 error("remove of %s failed", scratch); +#line 345 } +#line 345 void +#line 346 test_nc_put_var1_float(void) +#line 346 { +#line 346 int ncid; +#line 346 int i; +#line 346 int j; +#line 346 int err; +#line 346 size_t index[MAX_RANK]; +#line 346 int canConvert; /* Both text or both numeric */ +#line 346 float value = 5; /* any value would do - only for error cases */ +#line 346 +#line 346 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 346 IF (err) { +#line 346 error("nc_create: %s", nc_strerror(err)); +#line 346 return; +#line 346 } +#line 346 def_dims(ncid); +#line 346 def_vars(ncid); +#line 346 err = nc_enddef(ncid); +#line 346 IF (err) +#line 346 error("nc_enddef: %s", nc_strerror(err)); +#line 346 +#line 346 for (i = 0; i < NVARS; i++) { +#line 346 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 346 for (j = 0; j < var_rank[i]; j++) +#line 346 index[j] = 0; +#line 346 err = nc_put_var1_float(BAD_ID, i, index, &value); +#line 346 IF (err != NC_EBADID) +#line 346 error("bad ncid: status = %d", err); +#line 346 err = nc_put_var1_float(ncid, BAD_VARID, index, &value); +#line 346 IF (err != NC_ENOTVAR) +#line 346 error("bad var id: status = %d", err); +#line 346 for (j = 0; j < var_rank[i]; j++) { +#line 346 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 346 index[j] = var_shape[i][j]; +#line 346 err = nc_put_var1_float(ncid, i, index, &value); +#line 346 IF (canConvert && err != NC_EINVALCOORDS) +#line 346 error("bad index: status = %d", err); +#line 346 index[j] = 0; +#line 346 } +#line 346 } +#line 346 for (j = 0; j < var_nels[i]; j++) { +#line 346 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 346 IF (err) +#line 346 error("error in toMixedBase 1"); +#line 346 value = hash_float( var_type[i], var_rank[i], index, NCT_FLOAT); +#line 346 if (var_rank[i] == 0 && i%2 == 0) +#line 346 err = nc_put_var1_float(ncid, i, NULL, &value); +#line 346 else +#line 346 err = nc_put_var1_float(ncid, i, index, &value); +#line 346 if (canConvert) { +#line 346 if (inRange3(value, var_type[i],NCT_FLOAT)) { +#line 346 IF (err) +#line 346 error("%s", nc_strerror(err)); +#line 346 } else { +#line 346 IF (err != NC_ERANGE) { +#line 346 error("Range error: status = %d", err); +#line 346 error("\n\t\tfor type %s value %.17e %ld", +#line 346 s_nc_type(var_type[i]), +#line 346 (double)value, (long)value); +#line 346 } +#line 346 } +#line 346 } else { +#line 346 IF (err != NC_ECHAR) +#line 346 error("wrong type: status = %d", err); +#line 346 } +#line 346 } +#line 346 } +#line 346 +#line 346 err = nc_close(ncid); +#line 346 IF (err) +#line 346 error("nc_close: %s", nc_strerror(err)); +#line 346 +#line 346 check_vars_float(scratch); +#line 346 +#line 346 err = remove(scratch); +#line 346 IF (err) +#line 346 error("remove of %s failed", scratch); +#line 346 } +#line 346 void +#line 347 test_nc_put_var1_double(void) +#line 347 { +#line 347 int ncid; +#line 347 int i; +#line 347 int j; +#line 347 int err; +#line 347 size_t index[MAX_RANK]; +#line 347 int canConvert; /* Both text or both numeric */ +#line 347 double value = 5; /* any value would do - only for error cases */ +#line 347 +#line 347 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 347 IF (err) { +#line 347 error("nc_create: %s", nc_strerror(err)); +#line 347 return; +#line 347 } +#line 347 def_dims(ncid); +#line 347 def_vars(ncid); +#line 347 err = nc_enddef(ncid); +#line 347 IF (err) +#line 347 error("nc_enddef: %s", nc_strerror(err)); +#line 347 +#line 347 for (i = 0; i < NVARS; i++) { +#line 347 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 347 for (j = 0; j < var_rank[i]; j++) +#line 347 index[j] = 0; +#line 347 err = nc_put_var1_double(BAD_ID, i, index, &value); +#line 347 IF (err != NC_EBADID) +#line 347 error("bad ncid: status = %d", err); +#line 347 err = nc_put_var1_double(ncid, BAD_VARID, index, &value); +#line 347 IF (err != NC_ENOTVAR) +#line 347 error("bad var id: status = %d", err); +#line 347 for (j = 0; j < var_rank[i]; j++) { +#line 347 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 347 index[j] = var_shape[i][j]; +#line 347 err = nc_put_var1_double(ncid, i, index, &value); +#line 347 IF (canConvert && err != NC_EINVALCOORDS) +#line 347 error("bad index: status = %d", err); +#line 347 index[j] = 0; +#line 347 } +#line 347 } +#line 347 for (j = 0; j < var_nels[i]; j++) { +#line 347 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 347 IF (err) +#line 347 error("error in toMixedBase 1"); +#line 347 value = hash_double( var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 347 if (var_rank[i] == 0 && i%2 == 0) +#line 347 err = nc_put_var1_double(ncid, i, NULL, &value); +#line 347 else +#line 347 err = nc_put_var1_double(ncid, i, index, &value); +#line 347 if (canConvert) { +#line 347 if (inRange3(value, var_type[i],NCT_DOUBLE)) { +#line 347 IF (err) +#line 347 error("%s", nc_strerror(err)); +#line 347 } else { +#line 347 IF (err != NC_ERANGE) { +#line 347 error("Range error: status = %d", err); +#line 347 error("\n\t\tfor type %s value %.17e %ld", +#line 347 s_nc_type(var_type[i]), +#line 347 (double)value, (long)value); +#line 347 } +#line 347 } +#line 347 } else { +#line 347 IF (err != NC_ECHAR) +#line 347 error("wrong type: status = %d", err); +#line 347 } +#line 347 } +#line 347 } +#line 347 +#line 347 err = nc_close(ncid); +#line 347 IF (err) +#line 347 error("nc_close: %s", nc_strerror(err)); +#line 347 +#line 347 check_vars_double(scratch); +#line 347 +#line 347 err = remove(scratch); +#line 347 IF (err) +#line 347 error("remove of %s failed", scratch); +#line 347 } +#line 347 +#line 477 void +#line 478 test_nc_put_var_text(void) +#line 478 { +#line 478 int ncid; +#line 478 int varid; +#line 478 int i; +#line 478 int j; +#line 478 int err; +#line 478 int nels; +#line 478 size_t index[MAX_RANK]; +#line 478 int canConvert; /* Both text or both numeric */ +#line 478 int allInExtRange; /* all values within external range? */ +#line 478 text value[MAX_NELS]; +#line 478 +#line 478 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 478 IF (err) { +#line 478 error("nc_create: %s", nc_strerror(err)); +#line 478 return; +#line 478 } +#line 478 def_dims(ncid); +#line 478 def_vars(ncid); +#line 478 err = nc_enddef(ncid); +#line 478 IF (err) +#line 478 error("nc_enddef: %s", nc_strerror(err)); +#line 478 +#line 478 for (i = 0; i < NVARS; i++) { +#line 478 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 478 assert(var_rank[i] <= MAX_RANK); +#line 478 assert(var_nels[i] <= MAX_NELS); +#line 478 err = nc_put_var_text(BAD_ID, i, value); +#line 478 IF (err != NC_EBADID) +#line 478 error("bad ncid: status = %d", err); +#line 478 err = nc_put_var_text(ncid, BAD_VARID, value); +#line 478 IF (err != NC_ENOTVAR) +#line 478 error("bad var id: status = %d", err); +#line 478 +#line 478 nels = 1; +#line 478 for (j = 0; j < var_rank[i]; j++) { +#line 478 nels *= var_shape[i][j]; +#line 478 } +#line 478 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 478 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 478 IF (err) +#line 478 error("error in toMixedBase 1"); +#line 478 value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT); +#line 478 allInExtRange = allInExtRange +#line 478 && inRange3(value[j], var_type[i], NCT_TEXT); +#line 478 } +#line 478 err = nc_put_var_text(ncid, i, value); +#line 478 if (canConvert) { +#line 478 if (allInExtRange) { +#line 478 IF (err) +#line 478 error("%s", nc_strerror(err)); +#line 478 } else { +#line 478 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 478 error("range error: status = %d", err); +#line 478 } +#line 478 } else { /* should flag wrong type even if nothing to write */ +#line 478 IF (nels > 0 && err != NC_ECHAR) +#line 478 error("wrong type: status = %d", err); +#line 478 } +#line 478 } +#line 478 +#line 478 /* Preceeding has written nothing for record variables, now try */ +#line 478 /* again with more than 0 records */ +#line 478 +#line 478 /* Write record number NRECS to force writing of preceding records */ +#line 478 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 478 err = nc_inq_varid(ncid, "cr", &varid); +#line 478 IF (err) +#line 478 error("nc_inq_varid: %s", nc_strerror(err)); +#line 478 index[0] = NRECS-1; +#line 478 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 478 IF (err) +#line 478 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 478 +#line 478 for (i = 0; i < NVARS; i++) { +#line 478 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 478 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 478 assert(var_rank[i] <= MAX_RANK); +#line 478 assert(var_nels[i] <= MAX_NELS); +#line 478 err = nc_put_var_text(BAD_ID, i, value); +#line 478 IF (err != NC_EBADID) +#line 478 error("bad ncid: status = %d", err); +#line 478 nels = 1; +#line 478 for (j = 0; j < var_rank[i]; j++) { +#line 478 nels *= var_shape[i][j]; +#line 478 } +#line 478 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 478 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 478 IF (err) +#line 478 error("error in toMixedBase 1"); +#line 478 value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT); +#line 478 allInExtRange = allInExtRange +#line 478 && inRange3(value[j], var_type[i], NCT_TEXT); +#line 478 } +#line 478 err = nc_put_var_text(ncid, i, value); +#line 478 if (canConvert) { +#line 478 if (allInExtRange) { +#line 478 IF (err) +#line 478 error("%s", nc_strerror(err)); +#line 478 } else { +#line 478 IF (err != NC_ERANGE) +#line 478 error("range error: status = %d", err); +#line 478 } +#line 478 } else { +#line 478 IF (nels > 0 && err != NC_ECHAR) +#line 478 error("wrong type: status = %d", err); +#line 478 } +#line 478 } +#line 478 } +#line 478 +#line 478 err = nc_close(ncid); +#line 478 IF (err) +#line 478 error("nc_close: %s", nc_strerror(err)); +#line 478 +#line 478 check_vars_text(scratch); +#line 478 +#line 478 err = remove(scratch); +#line 478 IF (err) +#line 478 error("remove of %s failed", scratch); +#line 478 } +#line 478 void +#line 479 test_nc_put_var_uchar(void) +#line 479 { +#line 479 int ncid; +#line 479 int varid; +#line 479 int i; +#line 479 int j; +#line 479 int err; +#line 479 int nels; +#line 479 size_t index[MAX_RANK]; +#line 479 int canConvert; /* Both text or both numeric */ +#line 479 int allInExtRange; /* all values within external range? */ +#line 479 uchar value[MAX_NELS]; +#line 479 +#line 479 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 479 IF (err) { +#line 479 error("nc_create: %s", nc_strerror(err)); +#line 479 return; +#line 479 } +#line 479 def_dims(ncid); +#line 479 def_vars(ncid); +#line 479 err = nc_enddef(ncid); +#line 479 IF (err) +#line 479 error("nc_enddef: %s", nc_strerror(err)); +#line 479 +#line 479 for (i = 0; i < NVARS; i++) { +#line 479 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 479 assert(var_rank[i] <= MAX_RANK); +#line 479 assert(var_nels[i] <= MAX_NELS); +#line 479 err = nc_put_var_uchar(BAD_ID, i, value); +#line 479 IF (err != NC_EBADID) +#line 479 error("bad ncid: status = %d", err); +#line 479 err = nc_put_var_uchar(ncid, BAD_VARID, value); +#line 479 IF (err != NC_ENOTVAR) +#line 479 error("bad var id: status = %d", err); +#line 479 +#line 479 nels = 1; +#line 479 for (j = 0; j < var_rank[i]; j++) { +#line 479 nels *= var_shape[i][j]; +#line 479 } +#line 479 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 479 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 479 IF (err) +#line 479 error("error in toMixedBase 1"); +#line 479 value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR); +#line 479 allInExtRange = allInExtRange +#line 479 && inRange3(value[j], var_type[i], NCT_UCHAR); +#line 479 } +#line 479 err = nc_put_var_uchar(ncid, i, value); +#line 479 if (canConvert) { +#line 479 if (allInExtRange) { +#line 479 IF (err) +#line 479 error("%s", nc_strerror(err)); +#line 479 } else { +#line 479 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 479 error("range error: status = %d", err); +#line 479 } +#line 479 } else { /* should flag wrong type even if nothing to write */ +#line 479 IF (nels > 0 && err != NC_ECHAR) +#line 479 error("wrong type: status = %d", err); +#line 479 } +#line 479 } +#line 479 +#line 479 /* Preceeding has written nothing for record variables, now try */ +#line 479 /* again with more than 0 records */ +#line 479 +#line 479 /* Write record number NRECS to force writing of preceding records */ +#line 479 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 479 err = nc_inq_varid(ncid, "cr", &varid); +#line 479 IF (err) +#line 479 error("nc_inq_varid: %s", nc_strerror(err)); +#line 479 index[0] = NRECS-1; +#line 479 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 479 IF (err) +#line 479 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 479 +#line 479 for (i = 0; i < NVARS; i++) { +#line 479 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 479 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 479 assert(var_rank[i] <= MAX_RANK); +#line 479 assert(var_nels[i] <= MAX_NELS); +#line 479 err = nc_put_var_uchar(BAD_ID, i, value); +#line 479 IF (err != NC_EBADID) +#line 479 error("bad ncid: status = %d", err); +#line 479 nels = 1; +#line 479 for (j = 0; j < var_rank[i]; j++) { +#line 479 nels *= var_shape[i][j]; +#line 479 } +#line 479 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 479 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 479 IF (err) +#line 479 error("error in toMixedBase 1"); +#line 479 value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR); +#line 479 allInExtRange = allInExtRange +#line 479 && inRange3(value[j], var_type[i], NCT_UCHAR); +#line 479 } +#line 479 err = nc_put_var_uchar(ncid, i, value); +#line 479 if (canConvert) { +#line 479 if (allInExtRange) { +#line 479 IF (err) +#line 479 error("%s", nc_strerror(err)); +#line 479 } else { +#line 479 IF (err != NC_ERANGE) +#line 479 error("range error: status = %d", err); +#line 479 } +#line 479 } else { +#line 479 IF (nels > 0 && err != NC_ECHAR) +#line 479 error("wrong type: status = %d", err); +#line 479 } +#line 479 } +#line 479 } +#line 479 +#line 479 err = nc_close(ncid); +#line 479 IF (err) +#line 479 error("nc_close: %s", nc_strerror(err)); +#line 479 +#line 479 check_vars_uchar(scratch); +#line 479 +#line 479 err = remove(scratch); +#line 479 IF (err) +#line 479 error("remove of %s failed", scratch); +#line 479 } +#line 479 void +#line 480 test_nc_put_var_schar(void) +#line 480 { +#line 480 int ncid; +#line 480 int varid; +#line 480 int i; +#line 480 int j; +#line 480 int err; +#line 480 int nels; +#line 480 size_t index[MAX_RANK]; +#line 480 int canConvert; /* Both text or both numeric */ +#line 480 int allInExtRange; /* all values within external range? */ +#line 480 schar value[MAX_NELS]; +#line 480 +#line 480 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 480 IF (err) { +#line 480 error("nc_create: %s", nc_strerror(err)); +#line 480 return; +#line 480 } +#line 480 def_dims(ncid); +#line 480 def_vars(ncid); +#line 480 err = nc_enddef(ncid); +#line 480 IF (err) +#line 480 error("nc_enddef: %s", nc_strerror(err)); +#line 480 +#line 480 for (i = 0; i < NVARS; i++) { +#line 480 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 480 assert(var_rank[i] <= MAX_RANK); +#line 480 assert(var_nels[i] <= MAX_NELS); +#line 480 err = nc_put_var_schar(BAD_ID, i, value); +#line 480 IF (err != NC_EBADID) +#line 480 error("bad ncid: status = %d", err); +#line 480 err = nc_put_var_schar(ncid, BAD_VARID, value); +#line 480 IF (err != NC_ENOTVAR) +#line 480 error("bad var id: status = %d", err); +#line 480 +#line 480 nels = 1; +#line 480 for (j = 0; j < var_rank[i]; j++) { +#line 480 nels *= var_shape[i][j]; +#line 480 } +#line 480 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 480 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 480 IF (err) +#line 480 error("error in toMixedBase 1"); +#line 480 value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR); +#line 480 allInExtRange = allInExtRange +#line 480 && inRange3(value[j], var_type[i], NCT_SCHAR); +#line 480 } +#line 480 err = nc_put_var_schar(ncid, i, value); +#line 480 if (canConvert) { +#line 480 if (allInExtRange) { +#line 480 IF (err) +#line 480 error("%s", nc_strerror(err)); +#line 480 } else { +#line 480 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 480 error("range error: status = %d", err); +#line 480 } +#line 480 } else { /* should flag wrong type even if nothing to write */ +#line 480 IF (nels > 0 && err != NC_ECHAR) +#line 480 error("wrong type: status = %d", err); +#line 480 } +#line 480 } +#line 480 +#line 480 /* Preceeding has written nothing for record variables, now try */ +#line 480 /* again with more than 0 records */ +#line 480 +#line 480 /* Write record number NRECS to force writing of preceding records */ +#line 480 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 480 err = nc_inq_varid(ncid, "cr", &varid); +#line 480 IF (err) +#line 480 error("nc_inq_varid: %s", nc_strerror(err)); +#line 480 index[0] = NRECS-1; +#line 480 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 480 IF (err) +#line 480 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 480 +#line 480 for (i = 0; i < NVARS; i++) { +#line 480 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 480 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 480 assert(var_rank[i] <= MAX_RANK); +#line 480 assert(var_nels[i] <= MAX_NELS); +#line 480 err = nc_put_var_schar(BAD_ID, i, value); +#line 480 IF (err != NC_EBADID) +#line 480 error("bad ncid: status = %d", err); +#line 480 nels = 1; +#line 480 for (j = 0; j < var_rank[i]; j++) { +#line 480 nels *= var_shape[i][j]; +#line 480 } +#line 480 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 480 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 480 IF (err) +#line 480 error("error in toMixedBase 1"); +#line 480 value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR); +#line 480 allInExtRange = allInExtRange +#line 480 && inRange3(value[j], var_type[i], NCT_SCHAR); +#line 480 } +#line 480 err = nc_put_var_schar(ncid, i, value); +#line 480 if (canConvert) { +#line 480 if (allInExtRange) { +#line 480 IF (err) +#line 480 error("%s", nc_strerror(err)); +#line 480 } else { +#line 480 IF (err != NC_ERANGE) +#line 480 error("range error: status = %d", err); +#line 480 } +#line 480 } else { +#line 480 IF (nels > 0 && err != NC_ECHAR) +#line 480 error("wrong type: status = %d", err); +#line 480 } +#line 480 } +#line 480 } +#line 480 +#line 480 err = nc_close(ncid); +#line 480 IF (err) +#line 480 error("nc_close: %s", nc_strerror(err)); +#line 480 +#line 480 check_vars_schar(scratch); +#line 480 +#line 480 err = remove(scratch); +#line 480 IF (err) +#line 480 error("remove of %s failed", scratch); +#line 480 } +#line 480 void +#line 481 test_nc_put_var_short(void) +#line 481 { +#line 481 int ncid; +#line 481 int varid; +#line 481 int i; +#line 481 int j; +#line 481 int err; +#line 481 int nels; +#line 481 size_t index[MAX_RANK]; +#line 481 int canConvert; /* Both text or both numeric */ +#line 481 int allInExtRange; /* all values within external range? */ +#line 481 short value[MAX_NELS]; +#line 481 +#line 481 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 481 IF (err) { +#line 481 error("nc_create: %s", nc_strerror(err)); +#line 481 return; +#line 481 } +#line 481 def_dims(ncid); +#line 481 def_vars(ncid); +#line 481 err = nc_enddef(ncid); +#line 481 IF (err) +#line 481 error("nc_enddef: %s", nc_strerror(err)); +#line 481 +#line 481 for (i = 0; i < NVARS; i++) { +#line 481 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 481 assert(var_rank[i] <= MAX_RANK); +#line 481 assert(var_nels[i] <= MAX_NELS); +#line 481 err = nc_put_var_short(BAD_ID, i, value); +#line 481 IF (err != NC_EBADID) +#line 481 error("bad ncid: status = %d", err); +#line 481 err = nc_put_var_short(ncid, BAD_VARID, value); +#line 481 IF (err != NC_ENOTVAR) +#line 481 error("bad var id: status = %d", err); +#line 481 +#line 481 nels = 1; +#line 481 for (j = 0; j < var_rank[i]; j++) { +#line 481 nels *= var_shape[i][j]; +#line 481 } +#line 481 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 481 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 481 IF (err) +#line 481 error("error in toMixedBase 1"); +#line 481 value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT); +#line 481 allInExtRange = allInExtRange +#line 481 && inRange3(value[j], var_type[i], NCT_SHORT); +#line 481 } +#line 481 err = nc_put_var_short(ncid, i, value); +#line 481 if (canConvert) { +#line 481 if (allInExtRange) { +#line 481 IF (err) +#line 481 error("%s", nc_strerror(err)); +#line 481 } else { +#line 481 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 481 error("range error: status = %d", err); +#line 481 } +#line 481 } else { /* should flag wrong type even if nothing to write */ +#line 481 IF (nels > 0 && err != NC_ECHAR) +#line 481 error("wrong type: status = %d", err); +#line 481 } +#line 481 } +#line 481 +#line 481 /* Preceeding has written nothing for record variables, now try */ +#line 481 /* again with more than 0 records */ +#line 481 +#line 481 /* Write record number NRECS to force writing of preceding records */ +#line 481 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 481 err = nc_inq_varid(ncid, "cr", &varid); +#line 481 IF (err) +#line 481 error("nc_inq_varid: %s", nc_strerror(err)); +#line 481 index[0] = NRECS-1; +#line 481 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 481 IF (err) +#line 481 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 481 +#line 481 for (i = 0; i < NVARS; i++) { +#line 481 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 481 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 481 assert(var_rank[i] <= MAX_RANK); +#line 481 assert(var_nels[i] <= MAX_NELS); +#line 481 err = nc_put_var_short(BAD_ID, i, value); +#line 481 IF (err != NC_EBADID) +#line 481 error("bad ncid: status = %d", err); +#line 481 nels = 1; +#line 481 for (j = 0; j < var_rank[i]; j++) { +#line 481 nels *= var_shape[i][j]; +#line 481 } +#line 481 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 481 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 481 IF (err) +#line 481 error("error in toMixedBase 1"); +#line 481 value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT); +#line 481 allInExtRange = allInExtRange +#line 481 && inRange3(value[j], var_type[i], NCT_SHORT); +#line 481 } +#line 481 err = nc_put_var_short(ncid, i, value); +#line 481 if (canConvert) { +#line 481 if (allInExtRange) { +#line 481 IF (err) +#line 481 error("%s", nc_strerror(err)); +#line 481 } else { +#line 481 IF (err != NC_ERANGE) +#line 481 error("range error: status = %d", err); +#line 481 } +#line 481 } else { +#line 481 IF (nels > 0 && err != NC_ECHAR) +#line 481 error("wrong type: status = %d", err); +#line 481 } +#line 481 } +#line 481 } +#line 481 +#line 481 err = nc_close(ncid); +#line 481 IF (err) +#line 481 error("nc_close: %s", nc_strerror(err)); +#line 481 +#line 481 check_vars_short(scratch); +#line 481 +#line 481 err = remove(scratch); +#line 481 IF (err) +#line 481 error("remove of %s failed", scratch); +#line 481 } +#line 481 void +#line 482 test_nc_put_var_int(void) +#line 482 { +#line 482 int ncid; +#line 482 int varid; +#line 482 int i; +#line 482 int j; +#line 482 int err; +#line 482 int nels; +#line 482 size_t index[MAX_RANK]; +#line 482 int canConvert; /* Both text or both numeric */ +#line 482 int allInExtRange; /* all values within external range? */ +#line 482 int value[MAX_NELS]; +#line 482 +#line 482 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 482 IF (err) { +#line 482 error("nc_create: %s", nc_strerror(err)); +#line 482 return; +#line 482 } +#line 482 def_dims(ncid); +#line 482 def_vars(ncid); +#line 482 err = nc_enddef(ncid); +#line 482 IF (err) +#line 482 error("nc_enddef: %s", nc_strerror(err)); +#line 482 +#line 482 for (i = 0; i < NVARS; i++) { +#line 482 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 482 assert(var_rank[i] <= MAX_RANK); +#line 482 assert(var_nels[i] <= MAX_NELS); +#line 482 err = nc_put_var_int(BAD_ID, i, value); +#line 482 IF (err != NC_EBADID) +#line 482 error("bad ncid: status = %d", err); +#line 482 err = nc_put_var_int(ncid, BAD_VARID, value); +#line 482 IF (err != NC_ENOTVAR) +#line 482 error("bad var id: status = %d", err); +#line 482 +#line 482 nels = 1; +#line 482 for (j = 0; j < var_rank[i]; j++) { +#line 482 nels *= var_shape[i][j]; +#line 482 } +#line 482 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 482 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 482 IF (err) +#line 482 error("error in toMixedBase 1"); +#line 482 value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT); +#line 482 allInExtRange = allInExtRange +#line 482 && inRange3(value[j], var_type[i], NCT_INT); +#line 482 } +#line 482 err = nc_put_var_int(ncid, i, value); +#line 482 if (canConvert) { +#line 482 if (allInExtRange) { +#line 482 IF (err) +#line 482 error("%s", nc_strerror(err)); +#line 482 } else { +#line 482 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 482 error("range error: status = %d", err); +#line 482 } +#line 482 } else { /* should flag wrong type even if nothing to write */ +#line 482 IF (nels > 0 && err != NC_ECHAR) +#line 482 error("wrong type: status = %d", err); +#line 482 } +#line 482 } +#line 482 +#line 482 /* Preceeding has written nothing for record variables, now try */ +#line 482 /* again with more than 0 records */ +#line 482 +#line 482 /* Write record number NRECS to force writing of preceding records */ +#line 482 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 482 err = nc_inq_varid(ncid, "cr", &varid); +#line 482 IF (err) +#line 482 error("nc_inq_varid: %s", nc_strerror(err)); +#line 482 index[0] = NRECS-1; +#line 482 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 482 IF (err) +#line 482 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 482 +#line 482 for (i = 0; i < NVARS; i++) { +#line 482 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 482 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 482 assert(var_rank[i] <= MAX_RANK); +#line 482 assert(var_nels[i] <= MAX_NELS); +#line 482 err = nc_put_var_int(BAD_ID, i, value); +#line 482 IF (err != NC_EBADID) +#line 482 error("bad ncid: status = %d", err); +#line 482 nels = 1; +#line 482 for (j = 0; j < var_rank[i]; j++) { +#line 482 nels *= var_shape[i][j]; +#line 482 } +#line 482 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 482 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 482 IF (err) +#line 482 error("error in toMixedBase 1"); +#line 482 value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT); +#line 482 allInExtRange = allInExtRange +#line 482 && inRange3(value[j], var_type[i], NCT_INT); +#line 482 } +#line 482 err = nc_put_var_int(ncid, i, value); +#line 482 if (canConvert) { +#line 482 if (allInExtRange) { +#line 482 IF (err) +#line 482 error("%s", nc_strerror(err)); +#line 482 } else { +#line 482 IF (err != NC_ERANGE) +#line 482 error("range error: status = %d", err); +#line 482 } +#line 482 } else { +#line 482 IF (nels > 0 && err != NC_ECHAR) +#line 482 error("wrong type: status = %d", err); +#line 482 } +#line 482 } +#line 482 } +#line 482 +#line 482 err = nc_close(ncid); +#line 482 IF (err) +#line 482 error("nc_close: %s", nc_strerror(err)); +#line 482 +#line 482 check_vars_int(scratch); +#line 482 +#line 482 err = remove(scratch); +#line 482 IF (err) +#line 482 error("remove of %s failed", scratch); +#line 482 } +#line 482 void +#line 483 test_nc_put_var_long(void) +#line 483 { +#line 483 int ncid; +#line 483 int varid; +#line 483 int i; +#line 483 int j; +#line 483 int err; +#line 483 int nels; +#line 483 size_t index[MAX_RANK]; +#line 483 int canConvert; /* Both text or both numeric */ +#line 483 int allInExtRange; /* all values within external range? */ +#line 483 long value[MAX_NELS]; +#line 483 +#line 483 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 483 IF (err) { +#line 483 error("nc_create: %s", nc_strerror(err)); +#line 483 return; +#line 483 } +#line 483 def_dims(ncid); +#line 483 def_vars(ncid); +#line 483 err = nc_enddef(ncid); +#line 483 IF (err) +#line 483 error("nc_enddef: %s", nc_strerror(err)); +#line 483 +#line 483 for (i = 0; i < NVARS; i++) { +#line 483 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 483 assert(var_rank[i] <= MAX_RANK); +#line 483 assert(var_nels[i] <= MAX_NELS); +#line 483 err = nc_put_var_long(BAD_ID, i, value); +#line 483 IF (err != NC_EBADID) +#line 483 error("bad ncid: status = %d", err); +#line 483 err = nc_put_var_long(ncid, BAD_VARID, value); +#line 483 IF (err != NC_ENOTVAR) +#line 483 error("bad var id: status = %d", err); +#line 483 +#line 483 nels = 1; +#line 483 for (j = 0; j < var_rank[i]; j++) { +#line 483 nels *= var_shape[i][j]; +#line 483 } +#line 483 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 483 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 483 IF (err) +#line 483 error("error in toMixedBase 1"); +#line 483 value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG); +#line 483 allInExtRange = allInExtRange +#line 483 && inRange3(value[j], var_type[i], NCT_LONG); +#line 483 } +#line 483 err = nc_put_var_long(ncid, i, value); +#line 483 if (canConvert) { +#line 483 if (allInExtRange) { +#line 483 IF (err) +#line 483 error("%s", nc_strerror(err)); +#line 483 } else { +#line 483 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 483 error("range error: status = %d", err); +#line 483 } +#line 483 } else { /* should flag wrong type even if nothing to write */ +#line 483 IF (nels > 0 && err != NC_ECHAR) +#line 483 error("wrong type: status = %d", err); +#line 483 } +#line 483 } +#line 483 +#line 483 /* Preceeding has written nothing for record variables, now try */ +#line 483 /* again with more than 0 records */ +#line 483 +#line 483 /* Write record number NRECS to force writing of preceding records */ +#line 483 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 483 err = nc_inq_varid(ncid, "cr", &varid); +#line 483 IF (err) +#line 483 error("nc_inq_varid: %s", nc_strerror(err)); +#line 483 index[0] = NRECS-1; +#line 483 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 483 IF (err) +#line 483 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 483 +#line 483 for (i = 0; i < NVARS; i++) { +#line 483 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 483 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 483 assert(var_rank[i] <= MAX_RANK); +#line 483 assert(var_nels[i] <= MAX_NELS); +#line 483 err = nc_put_var_long(BAD_ID, i, value); +#line 483 IF (err != NC_EBADID) +#line 483 error("bad ncid: status = %d", err); +#line 483 nels = 1; +#line 483 for (j = 0; j < var_rank[i]; j++) { +#line 483 nels *= var_shape[i][j]; +#line 483 } +#line 483 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 483 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 483 IF (err) +#line 483 error("error in toMixedBase 1"); +#line 483 value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG); +#line 483 allInExtRange = allInExtRange +#line 483 && inRange3(value[j], var_type[i], NCT_LONG); +#line 483 } +#line 483 err = nc_put_var_long(ncid, i, value); +#line 483 if (canConvert) { +#line 483 if (allInExtRange) { +#line 483 IF (err) +#line 483 error("%s", nc_strerror(err)); +#line 483 } else { +#line 483 IF (err != NC_ERANGE) +#line 483 error("range error: status = %d", err); +#line 483 } +#line 483 } else { +#line 483 IF (nels > 0 && err != NC_ECHAR) +#line 483 error("wrong type: status = %d", err); +#line 483 } +#line 483 } +#line 483 } +#line 483 +#line 483 err = nc_close(ncid); +#line 483 IF (err) +#line 483 error("nc_close: %s", nc_strerror(err)); +#line 483 +#line 483 check_vars_long(scratch); +#line 483 +#line 483 err = remove(scratch); +#line 483 IF (err) +#line 483 error("remove of %s failed", scratch); +#line 483 } +#line 483 void +#line 484 test_nc_put_var_float(void) +#line 484 { +#line 484 int ncid; +#line 484 int varid; +#line 484 int i; +#line 484 int j; +#line 484 int err; +#line 484 int nels; +#line 484 size_t index[MAX_RANK]; +#line 484 int canConvert; /* Both text or both numeric */ +#line 484 int allInExtRange; /* all values within external range? */ +#line 484 float value[MAX_NELS]; +#line 484 +#line 484 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 484 IF (err) { +#line 484 error("nc_create: %s", nc_strerror(err)); +#line 484 return; +#line 484 } +#line 484 def_dims(ncid); +#line 484 def_vars(ncid); +#line 484 err = nc_enddef(ncid); +#line 484 IF (err) +#line 484 error("nc_enddef: %s", nc_strerror(err)); +#line 484 +#line 484 for (i = 0; i < NVARS; i++) { +#line 484 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 484 assert(var_rank[i] <= MAX_RANK); +#line 484 assert(var_nels[i] <= MAX_NELS); +#line 484 err = nc_put_var_float(BAD_ID, i, value); +#line 484 IF (err != NC_EBADID) +#line 484 error("bad ncid: status = %d", err); +#line 484 err = nc_put_var_float(ncid, BAD_VARID, value); +#line 484 IF (err != NC_ENOTVAR) +#line 484 error("bad var id: status = %d", err); +#line 484 +#line 484 nels = 1; +#line 484 for (j = 0; j < var_rank[i]; j++) { +#line 484 nels *= var_shape[i][j]; +#line 484 } +#line 484 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 484 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 484 IF (err) +#line 484 error("error in toMixedBase 1"); +#line 484 value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT); +#line 484 allInExtRange = allInExtRange +#line 484 && inRange3(value[j], var_type[i], NCT_FLOAT); +#line 484 } +#line 484 err = nc_put_var_float(ncid, i, value); +#line 484 if (canConvert) { +#line 484 if (allInExtRange) { +#line 484 IF (err) +#line 484 error("%s", nc_strerror(err)); +#line 484 } else { +#line 484 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 484 error("range error: status = %d", err); +#line 484 } +#line 484 } else { /* should flag wrong type even if nothing to write */ +#line 484 IF (nels > 0 && err != NC_ECHAR) +#line 484 error("wrong type: status = %d", err); +#line 484 } +#line 484 } +#line 484 +#line 484 /* Preceeding has written nothing for record variables, now try */ +#line 484 /* again with more than 0 records */ +#line 484 +#line 484 /* Write record number NRECS to force writing of preceding records */ +#line 484 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 484 err = nc_inq_varid(ncid, "cr", &varid); +#line 484 IF (err) +#line 484 error("nc_inq_varid: %s", nc_strerror(err)); +#line 484 index[0] = NRECS-1; +#line 484 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 484 IF (err) +#line 484 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 484 +#line 484 for (i = 0; i < NVARS; i++) { +#line 484 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 484 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 484 assert(var_rank[i] <= MAX_RANK); +#line 484 assert(var_nels[i] <= MAX_NELS); +#line 484 err = nc_put_var_float(BAD_ID, i, value); +#line 484 IF (err != NC_EBADID) +#line 484 error("bad ncid: status = %d", err); +#line 484 nels = 1; +#line 484 for (j = 0; j < var_rank[i]; j++) { +#line 484 nels *= var_shape[i][j]; +#line 484 } +#line 484 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 484 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 484 IF (err) +#line 484 error("error in toMixedBase 1"); +#line 484 value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT); +#line 484 allInExtRange = allInExtRange +#line 484 && inRange3(value[j], var_type[i], NCT_FLOAT); +#line 484 } +#line 484 err = nc_put_var_float(ncid, i, value); +#line 484 if (canConvert) { +#line 484 if (allInExtRange) { +#line 484 IF (err) +#line 484 error("%s", nc_strerror(err)); +#line 484 } else { +#line 484 IF (err != NC_ERANGE) +#line 484 error("range error: status = %d", err); +#line 484 } +#line 484 } else { +#line 484 IF (nels > 0 && err != NC_ECHAR) +#line 484 error("wrong type: status = %d", err); +#line 484 } +#line 484 } +#line 484 } +#line 484 +#line 484 err = nc_close(ncid); +#line 484 IF (err) +#line 484 error("nc_close: %s", nc_strerror(err)); +#line 484 +#line 484 check_vars_float(scratch); +#line 484 +#line 484 err = remove(scratch); +#line 484 IF (err) +#line 484 error("remove of %s failed", scratch); +#line 484 } +#line 484 void +#line 485 test_nc_put_var_double(void) +#line 485 { +#line 485 int ncid; +#line 485 int varid; +#line 485 int i; +#line 485 int j; +#line 485 int err; +#line 485 int nels; +#line 485 size_t index[MAX_RANK]; +#line 485 int canConvert; /* Both text or both numeric */ +#line 485 int allInExtRange; /* all values within external range? */ +#line 485 double value[MAX_NELS]; +#line 485 +#line 485 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 485 IF (err) { +#line 485 error("nc_create: %s", nc_strerror(err)); +#line 485 return; +#line 485 } +#line 485 def_dims(ncid); +#line 485 def_vars(ncid); +#line 485 err = nc_enddef(ncid); +#line 485 IF (err) +#line 485 error("nc_enddef: %s", nc_strerror(err)); +#line 485 +#line 485 for (i = 0; i < NVARS; i++) { +#line 485 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 485 assert(var_rank[i] <= MAX_RANK); +#line 485 assert(var_nels[i] <= MAX_NELS); +#line 485 err = nc_put_var_double(BAD_ID, i, value); +#line 485 IF (err != NC_EBADID) +#line 485 error("bad ncid: status = %d", err); +#line 485 err = nc_put_var_double(ncid, BAD_VARID, value); +#line 485 IF (err != NC_ENOTVAR) +#line 485 error("bad var id: status = %d", err); +#line 485 +#line 485 nels = 1; +#line 485 for (j = 0; j < var_rank[i]; j++) { +#line 485 nels *= var_shape[i][j]; +#line 485 } +#line 485 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 485 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 485 IF (err) +#line 485 error("error in toMixedBase 1"); +#line 485 value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 485 allInExtRange = allInExtRange +#line 485 && inRange3(value[j], var_type[i], NCT_DOUBLE); +#line 485 } +#line 485 err = nc_put_var_double(ncid, i, value); +#line 485 if (canConvert) { +#line 485 if (allInExtRange) { +#line 485 IF (err) +#line 485 error("%s", nc_strerror(err)); +#line 485 } else { +#line 485 IF (err != NC_ERANGE && var_dimid[i][0] != RECDIM) +#line 485 error("range error: status = %d", err); +#line 485 } +#line 485 } else { /* should flag wrong type even if nothing to write */ +#line 485 IF (nels > 0 && err != NC_ECHAR) +#line 485 error("wrong type: status = %d", err); +#line 485 } +#line 485 } +#line 485 +#line 485 /* Preceeding has written nothing for record variables, now try */ +#line 485 /* again with more than 0 records */ +#line 485 +#line 485 /* Write record number NRECS to force writing of preceding records */ +#line 485 /* Assumes variable cr is char vector with UNLIMITED dimension */ +#line 485 err = nc_inq_varid(ncid, "cr", &varid); +#line 485 IF (err) +#line 485 error("nc_inq_varid: %s", nc_strerror(err)); +#line 485 index[0] = NRECS-1; +#line 485 err = nc_put_var1_text(ncid, varid, index, "x"); +#line 485 IF (err) +#line 485 error("nc_put_var1_text: %s", nc_strerror(err)); +#line 485 +#line 485 for (i = 0; i < NVARS; i++) { +#line 485 if (var_dimid[i][0] == RECDIM) { /* only test record variables here */ +#line 485 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 485 assert(var_rank[i] <= MAX_RANK); +#line 485 assert(var_nels[i] <= MAX_NELS); +#line 485 err = nc_put_var_double(BAD_ID, i, value); +#line 485 IF (err != NC_EBADID) +#line 485 error("bad ncid: status = %d", err); +#line 485 nels = 1; +#line 485 for (j = 0; j < var_rank[i]; j++) { +#line 485 nels *= var_shape[i][j]; +#line 485 } +#line 485 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 485 err = toMixedBase(j, var_rank[i], var_shape[i], index); +#line 485 IF (err) +#line 485 error("error in toMixedBase 1"); +#line 485 value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 485 allInExtRange = allInExtRange +#line 485 && inRange3(value[j], var_type[i], NCT_DOUBLE); +#line 485 } +#line 485 err = nc_put_var_double(ncid, i, value); +#line 485 if (canConvert) { +#line 485 if (allInExtRange) { +#line 485 IF (err) +#line 485 error("%s", nc_strerror(err)); +#line 485 } else { +#line 485 IF (err != NC_ERANGE) +#line 485 error("range error: status = %d", err); +#line 485 } +#line 485 } else { +#line 485 IF (nels > 0 && err != NC_ECHAR) +#line 485 error("wrong type: status = %d", err); +#line 485 } +#line 485 } +#line 485 } +#line 485 +#line 485 err = nc_close(ncid); +#line 485 IF (err) +#line 485 error("nc_close: %s", nc_strerror(err)); +#line 485 +#line 485 check_vars_double(scratch); +#line 485 +#line 485 err = remove(scratch); +#line 485 IF (err) +#line 485 error("remove of %s failed", scratch); +#line 485 } +#line 485 +#line 642 void +#line 643 test_nc_put_vara_text(void) +#line 643 { +#line 643 int ncid; +#line 643 int d; +#line 643 int i; +#line 643 int j; +#line 643 int k; +#line 643 int err; +#line 643 int nslabs; +#line 643 int nels; +#line 643 size_t start[MAX_RANK]; +#line 643 size_t edge[MAX_RANK]; +#line 643 size_t mid[MAX_RANK]; +#line 643 size_t index[MAX_RANK]; +#line 643 int canConvert; /* Both text or both numeric */ +#line 643 int allInExtRange; /* all values within external range? */ +#line 643 text value[MAX_NELS]; +#line 643 +#line 643 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 643 IF (err) { +#line 643 error("nc_create: %s", nc_strerror(err)); +#line 643 return; +#line 643 } +#line 643 def_dims(ncid); +#line 643 def_vars(ncid); +#line 643 err = nc_enddef(ncid); +#line 643 IF (err) +#line 643 error("nc_enddef: %s", nc_strerror(err)); +#line 643 +#line 643 value[0] = 0; +#line 643 for (i = 0; i < NVARS; i++) { +#line 643 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 643 assert(var_rank[i] <= MAX_RANK); +#line 643 assert(var_nels[i] <= MAX_NELS); +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 start[j] = 0; +#line 643 edge[j] = 1; +#line 643 } +#line 643 err = nc_put_vara_text(BAD_ID, i, start, edge, value); +#line 643 IF (err != NC_EBADID) +#line 643 error("bad ncid: status = %d", err); +#line 643 err = nc_put_vara_text(ncid, BAD_VARID, start, edge, value); +#line 643 IF (err != NC_ENOTVAR) +#line 643 error("bad var id: status = %d", err); +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 643 start[j] = var_shape[i][j]; +#line 643 err = nc_put_vara_text(ncid, i, start, edge, value); +#line 643 IF (canConvert && err != NC_EINVALCOORDS) +#line 643 error("bad start: status = %d", err); +#line 643 start[j] = 0; +#line 643 edge[j] = var_shape[i][j] + 1; +#line 643 err = nc_put_vara_text(ncid, i, start, edge, value); +#line 643 IF (canConvert && err != NC_EEDGE) +#line 643 error("bad edge: status = %d", err); +#line 643 edge[j] = 1; +#line 643 } +#line 643 } +#line 643 /* Check correct error returned even when nothing to put */ +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 edge[j] = 0; +#line 643 } +#line 643 err = nc_put_vara_text(BAD_ID, i, start, edge, value); +#line 643 IF (err != NC_EBADID) +#line 643 error("bad ncid: status = %d", err); +#line 643 err = nc_put_vara_text(ncid, BAD_VARID, start, edge, value); +#line 643 IF (err != NC_ENOTVAR) +#line 643 error("bad var id: status = %d", err); +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 643 start[j] = var_shape[i][j]; +#line 643 err = nc_put_vara_text(ncid, i, start, edge, value); +#line 643 IF (canConvert && err != NC_EINVALCOORDS) +#line 643 error("bad start: status = %d", err); +#line 643 start[j] = 0; +#line 643 } +#line 643 } +#line 643 err = nc_put_vara_text(ncid, i, start, edge, value); +#line 643 if (canConvert) { +#line 643 IF (err) +#line 643 error("%s", nc_strerror(err)); +#line 643 } else { +#line 643 IF (err != NC_ECHAR) +#line 643 error("wrong type: status = %d", err); +#line 643 } +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 edge[j] = 1; +#line 643 } +#line 643 +#line 643 /* Choose a random point dividing each dim into 2 parts */ +#line 643 /* Put 2^rank (nslabs) slabs so defined */ +#line 643 nslabs = 1; +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 mid[j] = roll( var_shape[i][j] ); +#line 643 nslabs *= 2; +#line 643 } +#line 643 /* bits of k determine whether to put lower or upper part of dim */ +#line 643 for (k = 0; k < nslabs; k++) { +#line 643 nels = 1; +#line 643 for (j = 0; j < var_rank[i]; j++) { +#line 643 if ((k >> j) & 1) { +#line 643 start[j] = 0; +#line 643 edge[j] = mid[j]; +#line 643 }else{ +#line 643 start[j] = mid[j]; +#line 643 edge[j] = var_shape[i][j] - mid[j]; +#line 643 } +#line 643 nels *= edge[j]; +#line 643 } +#line 643 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 643 err = toMixedBase(j, var_rank[i], edge, index); +#line 643 IF (err) +#line 643 error("error in toMixedBase 1"); +#line 643 for (d = 0; d < var_rank[i]; d++) +#line 643 index[d] += start[d]; +#line 643 value[j]= hash_text(var_type[i], var_rank[i], index, NCT_TEXT); +#line 643 allInExtRange = allInExtRange +#line 643 && inRange3(value[j], var_type[i], NCT_TEXT); +#line 643 } +#line 643 if (var_rank[i] == 0 && i%2 == 0) +#line 643 err = nc_put_vara_text(ncid, i, NULL, NULL, value); +#line 643 else +#line 643 err = nc_put_vara_text(ncid, i, start, edge, value); +#line 643 if (canConvert) { +#line 643 if (allInExtRange) { +#line 643 IF (err) +#line 643 error("%s", nc_strerror(err)); +#line 643 } else { +#line 643 IF (err != NC_ERANGE) +#line 643 error("range error: status = %d", err); +#line 643 } +#line 643 } else { +#line 643 IF (nels > 0 && err != NC_ECHAR) +#line 643 error("wrong type: status = %d", err); +#line 643 } +#line 643 } +#line 643 } +#line 643 +#line 643 err = nc_close(ncid); +#line 643 IF (err) +#line 643 error("nc_close: %s", nc_strerror(err)); +#line 643 +#line 643 check_vars_text(scratch); +#line 643 +#line 643 err = remove(scratch); +#line 643 IF (err) +#line 643 error("remove of %s failed", scratch); +#line 643 } +#line 643 void +#line 644 test_nc_put_vara_uchar(void) +#line 644 { +#line 644 int ncid; +#line 644 int d; +#line 644 int i; +#line 644 int j; +#line 644 int k; +#line 644 int err; +#line 644 int nslabs; +#line 644 int nels; +#line 644 size_t start[MAX_RANK]; +#line 644 size_t edge[MAX_RANK]; +#line 644 size_t mid[MAX_RANK]; +#line 644 size_t index[MAX_RANK]; +#line 644 int canConvert; /* Both text or both numeric */ +#line 644 int allInExtRange; /* all values within external range? */ +#line 644 uchar value[MAX_NELS]; +#line 644 +#line 644 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 644 IF (err) { +#line 644 error("nc_create: %s", nc_strerror(err)); +#line 644 return; +#line 644 } +#line 644 def_dims(ncid); +#line 644 def_vars(ncid); +#line 644 err = nc_enddef(ncid); +#line 644 IF (err) +#line 644 error("nc_enddef: %s", nc_strerror(err)); +#line 644 +#line 644 value[0] = 0; +#line 644 for (i = 0; i < NVARS; i++) { +#line 644 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 644 assert(var_rank[i] <= MAX_RANK); +#line 644 assert(var_nels[i] <= MAX_NELS); +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 start[j] = 0; +#line 644 edge[j] = 1; +#line 644 } +#line 644 err = nc_put_vara_uchar(BAD_ID, i, start, edge, value); +#line 644 IF (err != NC_EBADID) +#line 644 error("bad ncid: status = %d", err); +#line 644 err = nc_put_vara_uchar(ncid, BAD_VARID, start, edge, value); +#line 644 IF (err != NC_ENOTVAR) +#line 644 error("bad var id: status = %d", err); +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 644 start[j] = var_shape[i][j]; +#line 644 err = nc_put_vara_uchar(ncid, i, start, edge, value); +#line 644 IF (canConvert && err != NC_EINVALCOORDS) +#line 644 error("bad start: status = %d", err); +#line 644 start[j] = 0; +#line 644 edge[j] = var_shape[i][j] + 1; +#line 644 err = nc_put_vara_uchar(ncid, i, start, edge, value); +#line 644 IF (canConvert && err != NC_EEDGE) +#line 644 error("bad edge: status = %d", err); +#line 644 edge[j] = 1; +#line 644 } +#line 644 } +#line 644 /* Check correct error returned even when nothing to put */ +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 edge[j] = 0; +#line 644 } +#line 644 err = nc_put_vara_uchar(BAD_ID, i, start, edge, value); +#line 644 IF (err != NC_EBADID) +#line 644 error("bad ncid: status = %d", err); +#line 644 err = nc_put_vara_uchar(ncid, BAD_VARID, start, edge, value); +#line 644 IF (err != NC_ENOTVAR) +#line 644 error("bad var id: status = %d", err); +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 644 start[j] = var_shape[i][j]; +#line 644 err = nc_put_vara_uchar(ncid, i, start, edge, value); +#line 644 IF (canConvert && err != NC_EINVALCOORDS) +#line 644 error("bad start: status = %d", err); +#line 644 start[j] = 0; +#line 644 } +#line 644 } +#line 644 err = nc_put_vara_uchar(ncid, i, start, edge, value); +#line 644 if (canConvert) { +#line 644 IF (err) +#line 644 error("%s", nc_strerror(err)); +#line 644 } else { +#line 644 IF (err != NC_ECHAR) +#line 644 error("wrong type: status = %d", err); +#line 644 } +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 edge[j] = 1; +#line 644 } +#line 644 +#line 644 /* Choose a random point dividing each dim into 2 parts */ +#line 644 /* Put 2^rank (nslabs) slabs so defined */ +#line 644 nslabs = 1; +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 mid[j] = roll( var_shape[i][j] ); +#line 644 nslabs *= 2; +#line 644 } +#line 644 /* bits of k determine whether to put lower or upper part of dim */ +#line 644 for (k = 0; k < nslabs; k++) { +#line 644 nels = 1; +#line 644 for (j = 0; j < var_rank[i]; j++) { +#line 644 if ((k >> j) & 1) { +#line 644 start[j] = 0; +#line 644 edge[j] = mid[j]; +#line 644 }else{ +#line 644 start[j] = mid[j]; +#line 644 edge[j] = var_shape[i][j] - mid[j]; +#line 644 } +#line 644 nels *= edge[j]; +#line 644 } +#line 644 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 644 err = toMixedBase(j, var_rank[i], edge, index); +#line 644 IF (err) +#line 644 error("error in toMixedBase 1"); +#line 644 for (d = 0; d < var_rank[i]; d++) +#line 644 index[d] += start[d]; +#line 644 value[j]= hash_uchar(var_type[i], var_rank[i], index, NCT_UCHAR); +#line 644 allInExtRange = allInExtRange +#line 644 && inRange3(value[j], var_type[i], NCT_UCHAR); +#line 644 } +#line 644 if (var_rank[i] == 0 && i%2 == 0) +#line 644 err = nc_put_vara_uchar(ncid, i, NULL, NULL, value); +#line 644 else +#line 644 err = nc_put_vara_uchar(ncid, i, start, edge, value); +#line 644 if (canConvert) { +#line 644 if (allInExtRange) { +#line 644 IF (err) +#line 644 error("%s", nc_strerror(err)); +#line 644 } else { +#line 644 IF (err != NC_ERANGE) +#line 644 error("range error: status = %d", err); +#line 644 } +#line 644 } else { +#line 644 IF (nels > 0 && err != NC_ECHAR) +#line 644 error("wrong type: status = %d", err); +#line 644 } +#line 644 } +#line 644 } +#line 644 +#line 644 err = nc_close(ncid); +#line 644 IF (err) +#line 644 error("nc_close: %s", nc_strerror(err)); +#line 644 +#line 644 check_vars_uchar(scratch); +#line 644 +#line 644 err = remove(scratch); +#line 644 IF (err) +#line 644 error("remove of %s failed", scratch); +#line 644 } +#line 644 void +#line 645 test_nc_put_vara_schar(void) +#line 645 { +#line 645 int ncid; +#line 645 int d; +#line 645 int i; +#line 645 int j; +#line 645 int k; +#line 645 int err; +#line 645 int nslabs; +#line 645 int nels; +#line 645 size_t start[MAX_RANK]; +#line 645 size_t edge[MAX_RANK]; +#line 645 size_t mid[MAX_RANK]; +#line 645 size_t index[MAX_RANK]; +#line 645 int canConvert; /* Both text or both numeric */ +#line 645 int allInExtRange; /* all values within external range? */ +#line 645 schar value[MAX_NELS]; +#line 645 +#line 645 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 645 IF (err) { +#line 645 error("nc_create: %s", nc_strerror(err)); +#line 645 return; +#line 645 } +#line 645 def_dims(ncid); +#line 645 def_vars(ncid); +#line 645 err = nc_enddef(ncid); +#line 645 IF (err) +#line 645 error("nc_enddef: %s", nc_strerror(err)); +#line 645 +#line 645 value[0] = 0; +#line 645 for (i = 0; i < NVARS; i++) { +#line 645 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 645 assert(var_rank[i] <= MAX_RANK); +#line 645 assert(var_nels[i] <= MAX_NELS); +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 start[j] = 0; +#line 645 edge[j] = 1; +#line 645 } +#line 645 err = nc_put_vara_schar(BAD_ID, i, start, edge, value); +#line 645 IF (err != NC_EBADID) +#line 645 error("bad ncid: status = %d", err); +#line 645 err = nc_put_vara_schar(ncid, BAD_VARID, start, edge, value); +#line 645 IF (err != NC_ENOTVAR) +#line 645 error("bad var id: status = %d", err); +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 645 start[j] = var_shape[i][j]; +#line 645 err = nc_put_vara_schar(ncid, i, start, edge, value); +#line 645 IF (canConvert && err != NC_EINVALCOORDS) +#line 645 error("bad start: status = %d", err); +#line 645 start[j] = 0; +#line 645 edge[j] = var_shape[i][j] + 1; +#line 645 err = nc_put_vara_schar(ncid, i, start, edge, value); +#line 645 IF (canConvert && err != NC_EEDGE) +#line 645 error("bad edge: status = %d", err); +#line 645 edge[j] = 1; +#line 645 } +#line 645 } +#line 645 /* Check correct error returned even when nothing to put */ +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 edge[j] = 0; +#line 645 } +#line 645 err = nc_put_vara_schar(BAD_ID, i, start, edge, value); +#line 645 IF (err != NC_EBADID) +#line 645 error("bad ncid: status = %d", err); +#line 645 err = nc_put_vara_schar(ncid, BAD_VARID, start, edge, value); +#line 645 IF (err != NC_ENOTVAR) +#line 645 error("bad var id: status = %d", err); +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 645 start[j] = var_shape[i][j]; +#line 645 err = nc_put_vara_schar(ncid, i, start, edge, value); +#line 645 IF (canConvert && err != NC_EINVALCOORDS) +#line 645 error("bad start: status = %d", err); +#line 645 start[j] = 0; +#line 645 } +#line 645 } +#line 645 err = nc_put_vara_schar(ncid, i, start, edge, value); +#line 645 if (canConvert) { +#line 645 IF (err) +#line 645 error("%s", nc_strerror(err)); +#line 645 } else { +#line 645 IF (err != NC_ECHAR) +#line 645 error("wrong type: status = %d", err); +#line 645 } +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 edge[j] = 1; +#line 645 } +#line 645 +#line 645 /* Choose a random point dividing each dim into 2 parts */ +#line 645 /* Put 2^rank (nslabs) slabs so defined */ +#line 645 nslabs = 1; +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 mid[j] = roll( var_shape[i][j] ); +#line 645 nslabs *= 2; +#line 645 } +#line 645 /* bits of k determine whether to put lower or upper part of dim */ +#line 645 for (k = 0; k < nslabs; k++) { +#line 645 nels = 1; +#line 645 for (j = 0; j < var_rank[i]; j++) { +#line 645 if ((k >> j) & 1) { +#line 645 start[j] = 0; +#line 645 edge[j] = mid[j]; +#line 645 }else{ +#line 645 start[j] = mid[j]; +#line 645 edge[j] = var_shape[i][j] - mid[j]; +#line 645 } +#line 645 nels *= edge[j]; +#line 645 } +#line 645 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 645 err = toMixedBase(j, var_rank[i], edge, index); +#line 645 IF (err) +#line 645 error("error in toMixedBase 1"); +#line 645 for (d = 0; d < var_rank[i]; d++) +#line 645 index[d] += start[d]; +#line 645 value[j]= hash_schar(var_type[i], var_rank[i], index, NCT_SCHAR); +#line 645 allInExtRange = allInExtRange +#line 645 && inRange3(value[j], var_type[i], NCT_SCHAR); +#line 645 } +#line 645 if (var_rank[i] == 0 && i%2 == 0) +#line 645 err = nc_put_vara_schar(ncid, i, NULL, NULL, value); +#line 645 else +#line 645 err = nc_put_vara_schar(ncid, i, start, edge, value); +#line 645 if (canConvert) { +#line 645 if (allInExtRange) { +#line 645 IF (err) +#line 645 error("%s", nc_strerror(err)); +#line 645 } else { +#line 645 IF (err != NC_ERANGE) +#line 645 error("range error: status = %d", err); +#line 645 } +#line 645 } else { +#line 645 IF (nels > 0 && err != NC_ECHAR) +#line 645 error("wrong type: status = %d", err); +#line 645 } +#line 645 } +#line 645 } +#line 645 +#line 645 err = nc_close(ncid); +#line 645 IF (err) +#line 645 error("nc_close: %s", nc_strerror(err)); +#line 645 +#line 645 check_vars_schar(scratch); +#line 645 +#line 645 err = remove(scratch); +#line 645 IF (err) +#line 645 error("remove of %s failed", scratch); +#line 645 } +#line 645 void +#line 646 test_nc_put_vara_short(void) +#line 646 { +#line 646 int ncid; +#line 646 int d; +#line 646 int i; +#line 646 int j; +#line 646 int k; +#line 646 int err; +#line 646 int nslabs; +#line 646 int nels; +#line 646 size_t start[MAX_RANK]; +#line 646 size_t edge[MAX_RANK]; +#line 646 size_t mid[MAX_RANK]; +#line 646 size_t index[MAX_RANK]; +#line 646 int canConvert; /* Both text or both numeric */ +#line 646 int allInExtRange; /* all values within external range? */ +#line 646 short value[MAX_NELS]; +#line 646 +#line 646 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 646 IF (err) { +#line 646 error("nc_create: %s", nc_strerror(err)); +#line 646 return; +#line 646 } +#line 646 def_dims(ncid); +#line 646 def_vars(ncid); +#line 646 err = nc_enddef(ncid); +#line 646 IF (err) +#line 646 error("nc_enddef: %s", nc_strerror(err)); +#line 646 +#line 646 value[0] = 0; +#line 646 for (i = 0; i < NVARS; i++) { +#line 646 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 646 assert(var_rank[i] <= MAX_RANK); +#line 646 assert(var_nels[i] <= MAX_NELS); +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 start[j] = 0; +#line 646 edge[j] = 1; +#line 646 } +#line 646 err = nc_put_vara_short(BAD_ID, i, start, edge, value); +#line 646 IF (err != NC_EBADID) +#line 646 error("bad ncid: status = %d", err); +#line 646 err = nc_put_vara_short(ncid, BAD_VARID, start, edge, value); +#line 646 IF (err != NC_ENOTVAR) +#line 646 error("bad var id: status = %d", err); +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 646 start[j] = var_shape[i][j]; +#line 646 err = nc_put_vara_short(ncid, i, start, edge, value); +#line 646 IF (canConvert && err != NC_EINVALCOORDS) +#line 646 error("bad start: status = %d", err); +#line 646 start[j] = 0; +#line 646 edge[j] = var_shape[i][j] + 1; +#line 646 err = nc_put_vara_short(ncid, i, start, edge, value); +#line 646 IF (canConvert && err != NC_EEDGE) +#line 646 error("bad edge: status = %d", err); +#line 646 edge[j] = 1; +#line 646 } +#line 646 } +#line 646 /* Check correct error returned even when nothing to put */ +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 edge[j] = 0; +#line 646 } +#line 646 err = nc_put_vara_short(BAD_ID, i, start, edge, value); +#line 646 IF (err != NC_EBADID) +#line 646 error("bad ncid: status = %d", err); +#line 646 err = nc_put_vara_short(ncid, BAD_VARID, start, edge, value); +#line 646 IF (err != NC_ENOTVAR) +#line 646 error("bad var id: status = %d", err); +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 646 start[j] = var_shape[i][j]; +#line 646 err = nc_put_vara_short(ncid, i, start, edge, value); +#line 646 IF (canConvert && err != NC_EINVALCOORDS) +#line 646 error("bad start: status = %d", err); +#line 646 start[j] = 0; +#line 646 } +#line 646 } +#line 646 err = nc_put_vara_short(ncid, i, start, edge, value); +#line 646 if (canConvert) { +#line 646 IF (err) +#line 646 error("%s", nc_strerror(err)); +#line 646 } else { +#line 646 IF (err != NC_ECHAR) +#line 646 error("wrong type: status = %d", err); +#line 646 } +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 edge[j] = 1; +#line 646 } +#line 646 +#line 646 /* Choose a random point dividing each dim into 2 parts */ +#line 646 /* Put 2^rank (nslabs) slabs so defined */ +#line 646 nslabs = 1; +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 mid[j] = roll( var_shape[i][j] ); +#line 646 nslabs *= 2; +#line 646 } +#line 646 /* bits of k determine whether to put lower or upper part of dim */ +#line 646 for (k = 0; k < nslabs; k++) { +#line 646 nels = 1; +#line 646 for (j = 0; j < var_rank[i]; j++) { +#line 646 if ((k >> j) & 1) { +#line 646 start[j] = 0; +#line 646 edge[j] = mid[j]; +#line 646 }else{ +#line 646 start[j] = mid[j]; +#line 646 edge[j] = var_shape[i][j] - mid[j]; +#line 646 } +#line 646 nels *= edge[j]; +#line 646 } +#line 646 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 646 err = toMixedBase(j, var_rank[i], edge, index); +#line 646 IF (err) +#line 646 error("error in toMixedBase 1"); +#line 646 for (d = 0; d < var_rank[i]; d++) +#line 646 index[d] += start[d]; +#line 646 value[j]= hash_short(var_type[i], var_rank[i], index, NCT_SHORT); +#line 646 allInExtRange = allInExtRange +#line 646 && inRange3(value[j], var_type[i], NCT_SHORT); +#line 646 } +#line 646 if (var_rank[i] == 0 && i%2 == 0) +#line 646 err = nc_put_vara_short(ncid, i, NULL, NULL, value); +#line 646 else +#line 646 err = nc_put_vara_short(ncid, i, start, edge, value); +#line 646 if (canConvert) { +#line 646 if (allInExtRange) { +#line 646 IF (err) +#line 646 error("%s", nc_strerror(err)); +#line 646 } else { +#line 646 IF (err != NC_ERANGE) +#line 646 error("range error: status = %d", err); +#line 646 } +#line 646 } else { +#line 646 IF (nels > 0 && err != NC_ECHAR) +#line 646 error("wrong type: status = %d", err); +#line 646 } +#line 646 } +#line 646 } +#line 646 +#line 646 err = nc_close(ncid); +#line 646 IF (err) +#line 646 error("nc_close: %s", nc_strerror(err)); +#line 646 +#line 646 check_vars_short(scratch); +#line 646 +#line 646 err = remove(scratch); +#line 646 IF (err) +#line 646 error("remove of %s failed", scratch); +#line 646 } +#line 646 void +#line 647 test_nc_put_vara_int(void) +#line 647 { +#line 647 int ncid; +#line 647 int d; +#line 647 int i; +#line 647 int j; +#line 647 int k; +#line 647 int err; +#line 647 int nslabs; +#line 647 int nels; +#line 647 size_t start[MAX_RANK]; +#line 647 size_t edge[MAX_RANK]; +#line 647 size_t mid[MAX_RANK]; +#line 647 size_t index[MAX_RANK]; +#line 647 int canConvert; /* Both text or both numeric */ +#line 647 int allInExtRange; /* all values within external range? */ +#line 647 int value[MAX_NELS]; +#line 647 +#line 647 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 647 IF (err) { +#line 647 error("nc_create: %s", nc_strerror(err)); +#line 647 return; +#line 647 } +#line 647 def_dims(ncid); +#line 647 def_vars(ncid); +#line 647 err = nc_enddef(ncid); +#line 647 IF (err) +#line 647 error("nc_enddef: %s", nc_strerror(err)); +#line 647 +#line 647 value[0] = 0; +#line 647 for (i = 0; i < NVARS; i++) { +#line 647 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 647 assert(var_rank[i] <= MAX_RANK); +#line 647 assert(var_nels[i] <= MAX_NELS); +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 start[j] = 0; +#line 647 edge[j] = 1; +#line 647 } +#line 647 err = nc_put_vara_int(BAD_ID, i, start, edge, value); +#line 647 IF (err != NC_EBADID) +#line 647 error("bad ncid: status = %d", err); +#line 647 err = nc_put_vara_int(ncid, BAD_VARID, start, edge, value); +#line 647 IF (err != NC_ENOTVAR) +#line 647 error("bad var id: status = %d", err); +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 647 start[j] = var_shape[i][j]; +#line 647 err = nc_put_vara_int(ncid, i, start, edge, value); +#line 647 IF (canConvert && err != NC_EINVALCOORDS) +#line 647 error("bad start: status = %d", err); +#line 647 start[j] = 0; +#line 647 edge[j] = var_shape[i][j] + 1; +#line 647 err = nc_put_vara_int(ncid, i, start, edge, value); +#line 647 IF (canConvert && err != NC_EEDGE) +#line 647 error("bad edge: status = %d", err); +#line 647 edge[j] = 1; +#line 647 } +#line 647 } +#line 647 /* Check correct error returned even when nothing to put */ +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 edge[j] = 0; +#line 647 } +#line 647 err = nc_put_vara_int(BAD_ID, i, start, edge, value); +#line 647 IF (err != NC_EBADID) +#line 647 error("bad ncid: status = %d", err); +#line 647 err = nc_put_vara_int(ncid, BAD_VARID, start, edge, value); +#line 647 IF (err != NC_ENOTVAR) +#line 647 error("bad var id: status = %d", err); +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 647 start[j] = var_shape[i][j]; +#line 647 err = nc_put_vara_int(ncid, i, start, edge, value); +#line 647 IF (canConvert && err != NC_EINVALCOORDS) +#line 647 error("bad start: status = %d", err); +#line 647 start[j] = 0; +#line 647 } +#line 647 } +#line 647 err = nc_put_vara_int(ncid, i, start, edge, value); +#line 647 if (canConvert) { +#line 647 IF (err) +#line 647 error("%s", nc_strerror(err)); +#line 647 } else { +#line 647 IF (err != NC_ECHAR) +#line 647 error("wrong type: status = %d", err); +#line 647 } +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 edge[j] = 1; +#line 647 } +#line 647 +#line 647 /* Choose a random point dividing each dim into 2 parts */ +#line 647 /* Put 2^rank (nslabs) slabs so defined */ +#line 647 nslabs = 1; +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 mid[j] = roll( var_shape[i][j] ); +#line 647 nslabs *= 2; +#line 647 } +#line 647 /* bits of k determine whether to put lower or upper part of dim */ +#line 647 for (k = 0; k < nslabs; k++) { +#line 647 nels = 1; +#line 647 for (j = 0; j < var_rank[i]; j++) { +#line 647 if ((k >> j) & 1) { +#line 647 start[j] = 0; +#line 647 edge[j] = mid[j]; +#line 647 }else{ +#line 647 start[j] = mid[j]; +#line 647 edge[j] = var_shape[i][j] - mid[j]; +#line 647 } +#line 647 nels *= edge[j]; +#line 647 } +#line 647 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 647 err = toMixedBase(j, var_rank[i], edge, index); +#line 647 IF (err) +#line 647 error("error in toMixedBase 1"); +#line 647 for (d = 0; d < var_rank[i]; d++) +#line 647 index[d] += start[d]; +#line 647 value[j]= hash_int(var_type[i], var_rank[i], index, NCT_INT); +#line 647 allInExtRange = allInExtRange +#line 647 && inRange3(value[j], var_type[i], NCT_INT); +#line 647 } +#line 647 if (var_rank[i] == 0 && i%2 == 0) +#line 647 err = nc_put_vara_int(ncid, i, NULL, NULL, value); +#line 647 else +#line 647 err = nc_put_vara_int(ncid, i, start, edge, value); +#line 647 if (canConvert) { +#line 647 if (allInExtRange) { +#line 647 IF (err) +#line 647 error("%s", nc_strerror(err)); +#line 647 } else { +#line 647 IF (err != NC_ERANGE) +#line 647 error("range error: status = %d", err); +#line 647 } +#line 647 } else { +#line 647 IF (nels > 0 && err != NC_ECHAR) +#line 647 error("wrong type: status = %d", err); +#line 647 } +#line 647 } +#line 647 } +#line 647 +#line 647 err = nc_close(ncid); +#line 647 IF (err) +#line 647 error("nc_close: %s", nc_strerror(err)); +#line 647 +#line 647 check_vars_int(scratch); +#line 647 +#line 647 err = remove(scratch); +#line 647 IF (err) +#line 647 error("remove of %s failed", scratch); +#line 647 } +#line 647 void +#line 648 test_nc_put_vara_long(void) +#line 648 { +#line 648 int ncid; +#line 648 int d; +#line 648 int i; +#line 648 int j; +#line 648 int k; +#line 648 int err; +#line 648 int nslabs; +#line 648 int nels; +#line 648 size_t start[MAX_RANK]; +#line 648 size_t edge[MAX_RANK]; +#line 648 size_t mid[MAX_RANK]; +#line 648 size_t index[MAX_RANK]; +#line 648 int canConvert; /* Both text or both numeric */ +#line 648 int allInExtRange; /* all values within external range? */ +#line 648 long value[MAX_NELS]; +#line 648 +#line 648 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 648 IF (err) { +#line 648 error("nc_create: %s", nc_strerror(err)); +#line 648 return; +#line 648 } +#line 648 def_dims(ncid); +#line 648 def_vars(ncid); +#line 648 err = nc_enddef(ncid); +#line 648 IF (err) +#line 648 error("nc_enddef: %s", nc_strerror(err)); +#line 648 +#line 648 value[0] = 0; +#line 648 for (i = 0; i < NVARS; i++) { +#line 648 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 648 assert(var_rank[i] <= MAX_RANK); +#line 648 assert(var_nels[i] <= MAX_NELS); +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 start[j] = 0; +#line 648 edge[j] = 1; +#line 648 } +#line 648 err = nc_put_vara_long(BAD_ID, i, start, edge, value); +#line 648 IF (err != NC_EBADID) +#line 648 error("bad ncid: status = %d", err); +#line 648 err = nc_put_vara_long(ncid, BAD_VARID, start, edge, value); +#line 648 IF (err != NC_ENOTVAR) +#line 648 error("bad var id: status = %d", err); +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 648 start[j] = var_shape[i][j]; +#line 648 err = nc_put_vara_long(ncid, i, start, edge, value); +#line 648 IF (canConvert && err != NC_EINVALCOORDS) +#line 648 error("bad start: status = %d", err); +#line 648 start[j] = 0; +#line 648 edge[j] = var_shape[i][j] + 1; +#line 648 err = nc_put_vara_long(ncid, i, start, edge, value); +#line 648 IF (canConvert && err != NC_EEDGE) +#line 648 error("bad edge: status = %d", err); +#line 648 edge[j] = 1; +#line 648 } +#line 648 } +#line 648 /* Check correct error returned even when nothing to put */ +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 edge[j] = 0; +#line 648 } +#line 648 err = nc_put_vara_long(BAD_ID, i, start, edge, value); +#line 648 IF (err != NC_EBADID) +#line 648 error("bad ncid: status = %d", err); +#line 648 err = nc_put_vara_long(ncid, BAD_VARID, start, edge, value); +#line 648 IF (err != NC_ENOTVAR) +#line 648 error("bad var id: status = %d", err); +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 648 start[j] = var_shape[i][j]; +#line 648 err = nc_put_vara_long(ncid, i, start, edge, value); +#line 648 IF (canConvert && err != NC_EINVALCOORDS) +#line 648 error("bad start: status = %d", err); +#line 648 start[j] = 0; +#line 648 } +#line 648 } +#line 648 err = nc_put_vara_long(ncid, i, start, edge, value); +#line 648 if (canConvert) { +#line 648 IF (err) +#line 648 error("%s", nc_strerror(err)); +#line 648 } else { +#line 648 IF (err != NC_ECHAR) +#line 648 error("wrong type: status = %d", err); +#line 648 } +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 edge[j] = 1; +#line 648 } +#line 648 +#line 648 /* Choose a random point dividing each dim into 2 parts */ +#line 648 /* Put 2^rank (nslabs) slabs so defined */ +#line 648 nslabs = 1; +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 mid[j] = roll( var_shape[i][j] ); +#line 648 nslabs *= 2; +#line 648 } +#line 648 /* bits of k determine whether to put lower or upper part of dim */ +#line 648 for (k = 0; k < nslabs; k++) { +#line 648 nels = 1; +#line 648 for (j = 0; j < var_rank[i]; j++) { +#line 648 if ((k >> j) & 1) { +#line 648 start[j] = 0; +#line 648 edge[j] = mid[j]; +#line 648 }else{ +#line 648 start[j] = mid[j]; +#line 648 edge[j] = var_shape[i][j] - mid[j]; +#line 648 } +#line 648 nels *= edge[j]; +#line 648 } +#line 648 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 648 err = toMixedBase(j, var_rank[i], edge, index); +#line 648 IF (err) +#line 648 error("error in toMixedBase 1"); +#line 648 for (d = 0; d < var_rank[i]; d++) +#line 648 index[d] += start[d]; +#line 648 value[j]= hash_long(var_type[i], var_rank[i], index, NCT_LONG); +#line 648 allInExtRange = allInExtRange +#line 648 && inRange3(value[j], var_type[i], NCT_LONG); +#line 648 } +#line 648 if (var_rank[i] == 0 && i%2 == 0) +#line 648 err = nc_put_vara_long(ncid, i, NULL, NULL, value); +#line 648 else +#line 648 err = nc_put_vara_long(ncid, i, start, edge, value); +#line 648 if (canConvert) { +#line 648 if (allInExtRange) { +#line 648 IF (err) +#line 648 error("%s", nc_strerror(err)); +#line 648 } else { +#line 648 IF (err != NC_ERANGE) +#line 648 error("range error: status = %d", err); +#line 648 } +#line 648 } else { +#line 648 IF (nels > 0 && err != NC_ECHAR) +#line 648 error("wrong type: status = %d", err); +#line 648 } +#line 648 } +#line 648 } +#line 648 +#line 648 err = nc_close(ncid); +#line 648 IF (err) +#line 648 error("nc_close: %s", nc_strerror(err)); +#line 648 +#line 648 check_vars_long(scratch); +#line 648 +#line 648 err = remove(scratch); +#line 648 IF (err) +#line 648 error("remove of %s failed", scratch); +#line 648 } +#line 648 void +#line 649 test_nc_put_vara_float(void) +#line 649 { +#line 649 int ncid; +#line 649 int d; +#line 649 int i; +#line 649 int j; +#line 649 int k; +#line 649 int err; +#line 649 int nslabs; +#line 649 int nels; +#line 649 size_t start[MAX_RANK]; +#line 649 size_t edge[MAX_RANK]; +#line 649 size_t mid[MAX_RANK]; +#line 649 size_t index[MAX_RANK]; +#line 649 int canConvert; /* Both text or both numeric */ +#line 649 int allInExtRange; /* all values within external range? */ +#line 649 float value[MAX_NELS]; +#line 649 +#line 649 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 649 IF (err) { +#line 649 error("nc_create: %s", nc_strerror(err)); +#line 649 return; +#line 649 } +#line 649 def_dims(ncid); +#line 649 def_vars(ncid); +#line 649 err = nc_enddef(ncid); +#line 649 IF (err) +#line 649 error("nc_enddef: %s", nc_strerror(err)); +#line 649 +#line 649 value[0] = 0; +#line 649 for (i = 0; i < NVARS; i++) { +#line 649 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 649 assert(var_rank[i] <= MAX_RANK); +#line 649 assert(var_nels[i] <= MAX_NELS); +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 start[j] = 0; +#line 649 edge[j] = 1; +#line 649 } +#line 649 err = nc_put_vara_float(BAD_ID, i, start, edge, value); +#line 649 IF (err != NC_EBADID) +#line 649 error("bad ncid: status = %d", err); +#line 649 err = nc_put_vara_float(ncid, BAD_VARID, start, edge, value); +#line 649 IF (err != NC_ENOTVAR) +#line 649 error("bad var id: status = %d", err); +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 649 start[j] = var_shape[i][j]; +#line 649 err = nc_put_vara_float(ncid, i, start, edge, value); +#line 649 IF (canConvert && err != NC_EINVALCOORDS) +#line 649 error("bad start: status = %d", err); +#line 649 start[j] = 0; +#line 649 edge[j] = var_shape[i][j] + 1; +#line 649 err = nc_put_vara_float(ncid, i, start, edge, value); +#line 649 IF (canConvert && err != NC_EEDGE) +#line 649 error("bad edge: status = %d", err); +#line 649 edge[j] = 1; +#line 649 } +#line 649 } +#line 649 /* Check correct error returned even when nothing to put */ +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 edge[j] = 0; +#line 649 } +#line 649 err = nc_put_vara_float(BAD_ID, i, start, edge, value); +#line 649 IF (err != NC_EBADID) +#line 649 error("bad ncid: status = %d", err); +#line 649 err = nc_put_vara_float(ncid, BAD_VARID, start, edge, value); +#line 649 IF (err != NC_ENOTVAR) +#line 649 error("bad var id: status = %d", err); +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 649 start[j] = var_shape[i][j]; +#line 649 err = nc_put_vara_float(ncid, i, start, edge, value); +#line 649 IF (canConvert && err != NC_EINVALCOORDS) +#line 649 error("bad start: status = %d", err); +#line 649 start[j] = 0; +#line 649 } +#line 649 } +#line 649 err = nc_put_vara_float(ncid, i, start, edge, value); +#line 649 if (canConvert) { +#line 649 IF (err) +#line 649 error("%s", nc_strerror(err)); +#line 649 } else { +#line 649 IF (err != NC_ECHAR) +#line 649 error("wrong type: status = %d", err); +#line 649 } +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 edge[j] = 1; +#line 649 } +#line 649 +#line 649 /* Choose a random point dividing each dim into 2 parts */ +#line 649 /* Put 2^rank (nslabs) slabs so defined */ +#line 649 nslabs = 1; +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 mid[j] = roll( var_shape[i][j] ); +#line 649 nslabs *= 2; +#line 649 } +#line 649 /* bits of k determine whether to put lower or upper part of dim */ +#line 649 for (k = 0; k < nslabs; k++) { +#line 649 nels = 1; +#line 649 for (j = 0; j < var_rank[i]; j++) { +#line 649 if ((k >> j) & 1) { +#line 649 start[j] = 0; +#line 649 edge[j] = mid[j]; +#line 649 }else{ +#line 649 start[j] = mid[j]; +#line 649 edge[j] = var_shape[i][j] - mid[j]; +#line 649 } +#line 649 nels *= edge[j]; +#line 649 } +#line 649 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 649 err = toMixedBase(j, var_rank[i], edge, index); +#line 649 IF (err) +#line 649 error("error in toMixedBase 1"); +#line 649 for (d = 0; d < var_rank[i]; d++) +#line 649 index[d] += start[d]; +#line 649 value[j]= hash_float(var_type[i], var_rank[i], index, NCT_FLOAT); +#line 649 allInExtRange = allInExtRange +#line 649 && inRange3(value[j], var_type[i], NCT_FLOAT); +#line 649 } +#line 649 if (var_rank[i] == 0 && i%2 == 0) +#line 649 err = nc_put_vara_float(ncid, i, NULL, NULL, value); +#line 649 else +#line 649 err = nc_put_vara_float(ncid, i, start, edge, value); +#line 649 if (canConvert) { +#line 649 if (allInExtRange) { +#line 649 IF (err) +#line 649 error("%s", nc_strerror(err)); +#line 649 } else { +#line 649 IF (err != NC_ERANGE) +#line 649 error("range error: status = %d", err); +#line 649 } +#line 649 } else { +#line 649 IF (nels > 0 && err != NC_ECHAR) +#line 649 error("wrong type: status = %d", err); +#line 649 } +#line 649 } +#line 649 } +#line 649 +#line 649 err = nc_close(ncid); +#line 649 IF (err) +#line 649 error("nc_close: %s", nc_strerror(err)); +#line 649 +#line 649 check_vars_float(scratch); +#line 649 +#line 649 err = remove(scratch); +#line 649 IF (err) +#line 649 error("remove of %s failed", scratch); +#line 649 } +#line 649 void +#line 650 test_nc_put_vara_double(void) +#line 650 { +#line 650 int ncid; +#line 650 int d; +#line 650 int i; +#line 650 int j; +#line 650 int k; +#line 650 int err; +#line 650 int nslabs; +#line 650 int nels; +#line 650 size_t start[MAX_RANK]; +#line 650 size_t edge[MAX_RANK]; +#line 650 size_t mid[MAX_RANK]; +#line 650 size_t index[MAX_RANK]; +#line 650 int canConvert; /* Both text or both numeric */ +#line 650 int allInExtRange; /* all values within external range? */ +#line 650 double value[MAX_NELS]; +#line 650 +#line 650 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 650 IF (err) { +#line 650 error("nc_create: %s", nc_strerror(err)); +#line 650 return; +#line 650 } +#line 650 def_dims(ncid); +#line 650 def_vars(ncid); +#line 650 err = nc_enddef(ncid); +#line 650 IF (err) +#line 650 error("nc_enddef: %s", nc_strerror(err)); +#line 650 +#line 650 value[0] = 0; +#line 650 for (i = 0; i < NVARS; i++) { +#line 650 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 650 assert(var_rank[i] <= MAX_RANK); +#line 650 assert(var_nels[i] <= MAX_NELS); +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 start[j] = 0; +#line 650 edge[j] = 1; +#line 650 } +#line 650 err = nc_put_vara_double(BAD_ID, i, start, edge, value); +#line 650 IF (err != NC_EBADID) +#line 650 error("bad ncid: status = %d", err); +#line 650 err = nc_put_vara_double(ncid, BAD_VARID, start, edge, value); +#line 650 IF (err != NC_ENOTVAR) +#line 650 error("bad var id: status = %d", err); +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 650 start[j] = var_shape[i][j]; +#line 650 err = nc_put_vara_double(ncid, i, start, edge, value); +#line 650 IF (canConvert && err != NC_EINVALCOORDS) +#line 650 error("bad start: status = %d", err); +#line 650 start[j] = 0; +#line 650 edge[j] = var_shape[i][j] + 1; +#line 650 err = nc_put_vara_double(ncid, i, start, edge, value); +#line 650 IF (canConvert && err != NC_EEDGE) +#line 650 error("bad edge: status = %d", err); +#line 650 edge[j] = 1; +#line 650 } +#line 650 } +#line 650 /* Check correct error returned even when nothing to put */ +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 edge[j] = 0; +#line 650 } +#line 650 err = nc_put_vara_double(BAD_ID, i, start, edge, value); +#line 650 IF (err != NC_EBADID) +#line 650 error("bad ncid: status = %d", err); +#line 650 err = nc_put_vara_double(ncid, BAD_VARID, start, edge, value); +#line 650 IF (err != NC_ENOTVAR) +#line 650 error("bad var id: status = %d", err); +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 650 start[j] = var_shape[i][j]; +#line 650 err = nc_put_vara_double(ncid, i, start, edge, value); +#line 650 IF (canConvert && err != NC_EINVALCOORDS) +#line 650 error("bad start: status = %d", err); +#line 650 start[j] = 0; +#line 650 } +#line 650 } +#line 650 err = nc_put_vara_double(ncid, i, start, edge, value); +#line 650 if (canConvert) { +#line 650 IF (err) +#line 650 error("%s", nc_strerror(err)); +#line 650 } else { +#line 650 IF (err != NC_ECHAR) +#line 650 error("wrong type: status = %d", err); +#line 650 } +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 edge[j] = 1; +#line 650 } +#line 650 +#line 650 /* Choose a random point dividing each dim into 2 parts */ +#line 650 /* Put 2^rank (nslabs) slabs so defined */ +#line 650 nslabs = 1; +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 mid[j] = roll( var_shape[i][j] ); +#line 650 nslabs *= 2; +#line 650 } +#line 650 /* bits of k determine whether to put lower or upper part of dim */ +#line 650 for (k = 0; k < nslabs; k++) { +#line 650 nels = 1; +#line 650 for (j = 0; j < var_rank[i]; j++) { +#line 650 if ((k >> j) & 1) { +#line 650 start[j] = 0; +#line 650 edge[j] = mid[j]; +#line 650 }else{ +#line 650 start[j] = mid[j]; +#line 650 edge[j] = var_shape[i][j] - mid[j]; +#line 650 } +#line 650 nels *= edge[j]; +#line 650 } +#line 650 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 650 err = toMixedBase(j, var_rank[i], edge, index); +#line 650 IF (err) +#line 650 error("error in toMixedBase 1"); +#line 650 for (d = 0; d < var_rank[i]; d++) +#line 650 index[d] += start[d]; +#line 650 value[j]= hash_double(var_type[i], var_rank[i], index, NCT_DOUBLE); +#line 650 allInExtRange = allInExtRange +#line 650 && inRange3(value[j], var_type[i], NCT_DOUBLE); +#line 650 } +#line 650 if (var_rank[i] == 0 && i%2 == 0) +#line 650 err = nc_put_vara_double(ncid, i, NULL, NULL, value); +#line 650 else +#line 650 err = nc_put_vara_double(ncid, i, start, edge, value); +#line 650 if (canConvert) { +#line 650 if (allInExtRange) { +#line 650 IF (err) +#line 650 error("%s", nc_strerror(err)); +#line 650 } else { +#line 650 IF (err != NC_ERANGE) +#line 650 error("range error: status = %d", err); +#line 650 } +#line 650 } else { +#line 650 IF (nels > 0 && err != NC_ECHAR) +#line 650 error("wrong type: status = %d", err); +#line 650 } +#line 650 } +#line 650 } +#line 650 +#line 650 err = nc_close(ncid); +#line 650 IF (err) +#line 650 error("nc_close: %s", nc_strerror(err)); +#line 650 +#line 650 check_vars_double(scratch); +#line 650 +#line 650 err = remove(scratch); +#line 650 IF (err) +#line 650 error("remove of %s failed", scratch); +#line 650 } +#line 650 +#line 815 void +#line 816 test_nc_put_vars_text(void) +#line 816 { +#line 816 int ncid; +#line 816 int d; +#line 816 int i; +#line 816 int j; +#line 816 int k; +#line 816 int m; +#line 816 int err; +#line 816 int nels; +#line 816 int nslabs; +#line 816 int nstarts; /* number of different starts */ +#line 816 size_t start[MAX_RANK]; +#line 816 size_t edge[MAX_RANK]; +#line 816 size_t index[MAX_RANK]; +#line 816 size_t index2[MAX_RANK]; +#line 816 size_t mid[MAX_RANK]; +#line 816 size_t count[MAX_RANK]; +#line 816 size_t sstride[MAX_RANK]; +#line 816 ptrdiff_t stride[MAX_RANK]; +#line 816 int canConvert; /* Both text or both numeric */ +#line 816 int allInExtRange; /* all values within external range? */ +#line 816 text value[MAX_NELS]; +#line 816 +#line 816 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 816 IF (err) { +#line 816 error("nc_create: %s", nc_strerror(err)); +#line 816 return; +#line 816 } +#line 816 def_dims(ncid); +#line 816 def_vars(ncid); +#line 816 err = nc_enddef(ncid); +#line 816 IF (err) +#line 816 error("nc_enddef: %s", nc_strerror(err)); +#line 816 +#line 816 for (i = 0; i < NVARS; i++) { +#line 816 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 816 assert(var_rank[i] <= MAX_RANK); +#line 816 assert(var_nels[i] <= MAX_NELS); +#line 816 for (j = 0; j < var_rank[i]; j++) { +#line 816 start[j] = 0; +#line 816 edge[j] = 1; +#line 816 stride[j] = 1; +#line 816 } +#line 816 err = nc_put_vars_text(BAD_ID, i, start, edge, stride, value); +#line 816 IF (err != NC_EBADID) +#line 816 error("bad ncid: status = %d", err); +#line 816 err = nc_put_vars_text(ncid, BAD_VARID, start, edge, stride, value); +#line 816 IF (err != NC_ENOTVAR) +#line 816 error("bad var id: status = %d", err); +#line 816 for (j = 0; j < var_rank[i]; j++) { +#line 816 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 816 start[j] = var_shape[i][j] + 1; +#line 816 err = nc_put_vars_text(ncid, i, start, edge, stride, value); +#line 816 if(!canConvert) { +#line 816 IF(err != NC_ECHAR) +#line 816 error("conversion: status = %d", err); +#line 816 } else { +#line 816 IF(err != NC_EINVALCOORDS) +#line 816 error("bad start: status = %d", err); +#line 816 start[j] = 0; +#line 816 edge[j] = var_shape[i][j] + 1; +#line 816 err = nc_put_vars_text(ncid, i, start, edge, stride, value); +#line 816 IF (err != NC_EEDGE) +#line 816 error("bad edge: status = %d", err); +#line 816 edge[j] = 1; +#line 816 stride[j] = 0; +#line 816 err = nc_put_vars_text(ncid, i, start, edge, stride, value); +#line 816 IF (err != NC_ESTRIDE) +#line 816 error("bad stride: status = %d", err); +#line 816 stride[j] = 1; +#line 816 } +#line 816 } +#line 816 } +#line 816 /* Choose a random point dividing each dim into 2 parts */ +#line 816 /* Put 2^rank (nslabs) slabs so defined */ +#line 816 nslabs = 1; +#line 816 for (j = 0; j < var_rank[i]; j++) { +#line 816 mid[j] = roll( var_shape[i][j] ); +#line 816 nslabs *= 2; +#line 816 } +#line 816 /* bits of k determine whether to put lower or upper part of dim */ +#line 816 /* choose random stride from 1 to edge */ +#line 816 for (k = 0; k < nslabs; k++) { +#line 816 nstarts = 1; +#line 816 for (j = 0; j < var_rank[i]; j++) { +#line 816 if ((k >> j) & 1) { +#line 816 start[j] = 0; +#line 816 edge[j] = mid[j]; +#line 816 }else{ +#line 816 start[j] = mid[j]; +#line 816 edge[j] = var_shape[i][j] - mid[j]; +#line 816 } +#line 816 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 816 nstarts *= stride[j]; +#line 816 } +#line 816 for (m = 0; m < nstarts; m++) { +#line 816 err = toMixedBase(m, var_rank[i], sstride, index); +#line 816 IF (err) +#line 816 error("error in toMixedBase"); +#line 816 nels = 1; +#line 816 for (j = 0; j < var_rank[i]; j++) { +#line 816 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 816 nels *= count[j]; +#line 816 index[j] += start[j]; +#line 816 } +#line 816 /* Random choice of forward or backward */ +#line 816 /* TODO +#line 816 if ( roll(2) ) { +#line 816 for (j = 0; j < var_rank[i]; j++) { +#line 816 index[j] += (count[j] - 1) * stride[j]; +#line 816 stride[j] = -stride[j]; +#line 816 } +#line 816 } +#line 816 */ +#line 816 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 816 err = toMixedBase(j, var_rank[i], count, index2); +#line 816 IF (err) +#line 816 error("error in toMixedBase"); +#line 816 for (d = 0; d < var_rank[i]; d++) +#line 816 index2[d] = index[d] + index2[d] * stride[d]; +#line 816 value[j] = hash_text(var_type[i], var_rank[i], index2, +#line 816 NCT_TEXT); +#line 816 allInExtRange = allInExtRange +#line 816 && inRange3(value[j], var_type[i], NCT_TEXT); +#line 816 } +#line 816 if (var_rank[i] == 0 && i%2 == 0) +#line 816 err = nc_put_vars_text(ncid, i, NULL, NULL, stride, value); +#line 816 else +#line 816 err = nc_put_vars_text(ncid, i, index, count, stride, value); +#line 816 if (canConvert) { +#line 816 if (allInExtRange) { +#line 816 IF (err) +#line 816 error("%s", nc_strerror(err)); +#line 816 } else { +#line 816 IF (err != NC_ERANGE) +#line 816 error("range error: status = %d", err); +#line 816 } +#line 816 } else { +#line 816 IF (nels > 0 && err != NC_ECHAR) +#line 816 error("wrong type: status = %d", err); +#line 816 } +#line 816 } +#line 816 } +#line 816 } +#line 816 +#line 816 err = nc_close(ncid); +#line 816 IF (err) +#line 816 error("nc_close: %s", nc_strerror(err)); +#line 816 +#line 816 check_vars_text(scratch); +#line 816 +#line 816 err = remove(scratch); +#line 816 IF (err) +#line 816 error("remove of %s failed", scratch); +#line 816 } +#line 816 void +#line 817 test_nc_put_vars_uchar(void) +#line 817 { +#line 817 int ncid; +#line 817 int d; +#line 817 int i; +#line 817 int j; +#line 817 int k; +#line 817 int m; +#line 817 int err; +#line 817 int nels; +#line 817 int nslabs; +#line 817 int nstarts; /* number of different starts */ +#line 817 size_t start[MAX_RANK]; +#line 817 size_t edge[MAX_RANK]; +#line 817 size_t index[MAX_RANK]; +#line 817 size_t index2[MAX_RANK]; +#line 817 size_t mid[MAX_RANK]; +#line 817 size_t count[MAX_RANK]; +#line 817 size_t sstride[MAX_RANK]; +#line 817 ptrdiff_t stride[MAX_RANK]; +#line 817 int canConvert; /* Both text or both numeric */ +#line 817 int allInExtRange; /* all values within external range? */ +#line 817 uchar value[MAX_NELS]; +#line 817 +#line 817 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 817 IF (err) { +#line 817 error("nc_create: %s", nc_strerror(err)); +#line 817 return; +#line 817 } +#line 817 def_dims(ncid); +#line 817 def_vars(ncid); +#line 817 err = nc_enddef(ncid); +#line 817 IF (err) +#line 817 error("nc_enddef: %s", nc_strerror(err)); +#line 817 +#line 817 for (i = 0; i < NVARS; i++) { +#line 817 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 817 assert(var_rank[i] <= MAX_RANK); +#line 817 assert(var_nels[i] <= MAX_NELS); +#line 817 for (j = 0; j < var_rank[i]; j++) { +#line 817 start[j] = 0; +#line 817 edge[j] = 1; +#line 817 stride[j] = 1; +#line 817 } +#line 817 err = nc_put_vars_uchar(BAD_ID, i, start, edge, stride, value); +#line 817 IF (err != NC_EBADID) +#line 817 error("bad ncid: status = %d", err); +#line 817 err = nc_put_vars_uchar(ncid, BAD_VARID, start, edge, stride, value); +#line 817 IF (err != NC_ENOTVAR) +#line 817 error("bad var id: status = %d", err); +#line 817 for (j = 0; j < var_rank[i]; j++) { +#line 817 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 817 start[j] = var_shape[i][j] + 1; +#line 817 err = nc_put_vars_uchar(ncid, i, start, edge, stride, value); +#line 817 if(!canConvert) { +#line 817 IF(err != NC_ECHAR) +#line 817 error("conversion: status = %d", err); +#line 817 } else { +#line 817 IF(err != NC_EINVALCOORDS) +#line 817 error("bad start: status = %d", err); +#line 817 start[j] = 0; +#line 817 edge[j] = var_shape[i][j] + 1; +#line 817 err = nc_put_vars_uchar(ncid, i, start, edge, stride, value); +#line 817 IF (err != NC_EEDGE) +#line 817 error("bad edge: status = %d", err); +#line 817 edge[j] = 1; +#line 817 stride[j] = 0; +#line 817 err = nc_put_vars_uchar(ncid, i, start, edge, stride, value); +#line 817 IF (err != NC_ESTRIDE) +#line 817 error("bad stride: status = %d", err); +#line 817 stride[j] = 1; +#line 817 } +#line 817 } +#line 817 } +#line 817 /* Choose a random point dividing each dim into 2 parts */ +#line 817 /* Put 2^rank (nslabs) slabs so defined */ +#line 817 nslabs = 1; +#line 817 for (j = 0; j < var_rank[i]; j++) { +#line 817 mid[j] = roll( var_shape[i][j] ); +#line 817 nslabs *= 2; +#line 817 } +#line 817 /* bits of k determine whether to put lower or upper part of dim */ +#line 817 /* choose random stride from 1 to edge */ +#line 817 for (k = 0; k < nslabs; k++) { +#line 817 nstarts = 1; +#line 817 for (j = 0; j < var_rank[i]; j++) { +#line 817 if ((k >> j) & 1) { +#line 817 start[j] = 0; +#line 817 edge[j] = mid[j]; +#line 817 }else{ +#line 817 start[j] = mid[j]; +#line 817 edge[j] = var_shape[i][j] - mid[j]; +#line 817 } +#line 817 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 817 nstarts *= stride[j]; +#line 817 } +#line 817 for (m = 0; m < nstarts; m++) { +#line 817 err = toMixedBase(m, var_rank[i], sstride, index); +#line 817 IF (err) +#line 817 error("error in toMixedBase"); +#line 817 nels = 1; +#line 817 for (j = 0; j < var_rank[i]; j++) { +#line 817 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 817 nels *= count[j]; +#line 817 index[j] += start[j]; +#line 817 } +#line 817 /* Random choice of forward or backward */ +#line 817 /* TODO +#line 817 if ( roll(2) ) { +#line 817 for (j = 0; j < var_rank[i]; j++) { +#line 817 index[j] += (count[j] - 1) * stride[j]; +#line 817 stride[j] = -stride[j]; +#line 817 } +#line 817 } +#line 817 */ +#line 817 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 817 err = toMixedBase(j, var_rank[i], count, index2); +#line 817 IF (err) +#line 817 error("error in toMixedBase"); +#line 817 for (d = 0; d < var_rank[i]; d++) +#line 817 index2[d] = index[d] + index2[d] * stride[d]; +#line 817 value[j] = hash_uchar(var_type[i], var_rank[i], index2, +#line 817 NCT_UCHAR); +#line 817 allInExtRange = allInExtRange +#line 817 && inRange3(value[j], var_type[i], NCT_UCHAR); +#line 817 } +#line 817 if (var_rank[i] == 0 && i%2 == 0) +#line 817 err = nc_put_vars_uchar(ncid, i, NULL, NULL, stride, value); +#line 817 else +#line 817 err = nc_put_vars_uchar(ncid, i, index, count, stride, value); +#line 817 if (canConvert) { +#line 817 if (allInExtRange) { +#line 817 IF (err) +#line 817 error("%s", nc_strerror(err)); +#line 817 } else { +#line 817 IF (err != NC_ERANGE) +#line 817 error("range error: status = %d", err); +#line 817 } +#line 817 } else { +#line 817 IF (nels > 0 && err != NC_ECHAR) +#line 817 error("wrong type: status = %d", err); +#line 817 } +#line 817 } +#line 817 } +#line 817 } +#line 817 +#line 817 err = nc_close(ncid); +#line 817 IF (err) +#line 817 error("nc_close: %s", nc_strerror(err)); +#line 817 +#line 817 check_vars_uchar(scratch); +#line 817 +#line 817 err = remove(scratch); +#line 817 IF (err) +#line 817 error("remove of %s failed", scratch); +#line 817 } +#line 817 void +#line 818 test_nc_put_vars_schar(void) +#line 818 { +#line 818 int ncid; +#line 818 int d; +#line 818 int i; +#line 818 int j; +#line 818 int k; +#line 818 int m; +#line 818 int err; +#line 818 int nels; +#line 818 int nslabs; +#line 818 int nstarts; /* number of different starts */ +#line 818 size_t start[MAX_RANK]; +#line 818 size_t edge[MAX_RANK]; +#line 818 size_t index[MAX_RANK]; +#line 818 size_t index2[MAX_RANK]; +#line 818 size_t mid[MAX_RANK]; +#line 818 size_t count[MAX_RANK]; +#line 818 size_t sstride[MAX_RANK]; +#line 818 ptrdiff_t stride[MAX_RANK]; +#line 818 int canConvert; /* Both text or both numeric */ +#line 818 int allInExtRange; /* all values within external range? */ +#line 818 schar value[MAX_NELS]; +#line 818 +#line 818 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 818 IF (err) { +#line 818 error("nc_create: %s", nc_strerror(err)); +#line 818 return; +#line 818 } +#line 818 def_dims(ncid); +#line 818 def_vars(ncid); +#line 818 err = nc_enddef(ncid); +#line 818 IF (err) +#line 818 error("nc_enddef: %s", nc_strerror(err)); +#line 818 +#line 818 for (i = 0; i < NVARS; i++) { +#line 818 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 818 assert(var_rank[i] <= MAX_RANK); +#line 818 assert(var_nels[i] <= MAX_NELS); +#line 818 for (j = 0; j < var_rank[i]; j++) { +#line 818 start[j] = 0; +#line 818 edge[j] = 1; +#line 818 stride[j] = 1; +#line 818 } +#line 818 err = nc_put_vars_schar(BAD_ID, i, start, edge, stride, value); +#line 818 IF (err != NC_EBADID) +#line 818 error("bad ncid: status = %d", err); +#line 818 err = nc_put_vars_schar(ncid, BAD_VARID, start, edge, stride, value); +#line 818 IF (err != NC_ENOTVAR) +#line 818 error("bad var id: status = %d", err); +#line 818 for (j = 0; j < var_rank[i]; j++) { +#line 818 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 818 start[j] = var_shape[i][j] + 1; +#line 818 err = nc_put_vars_schar(ncid, i, start, edge, stride, value); +#line 818 if(!canConvert) { +#line 818 IF(err != NC_ECHAR) +#line 818 error("conversion: status = %d", err); +#line 818 } else { +#line 818 IF(err != NC_EINVALCOORDS) +#line 818 error("bad start: status = %d", err); +#line 818 start[j] = 0; +#line 818 edge[j] = var_shape[i][j] + 1; +#line 818 err = nc_put_vars_schar(ncid, i, start, edge, stride, value); +#line 818 IF (err != NC_EEDGE) +#line 818 error("bad edge: status = %d", err); +#line 818 edge[j] = 1; +#line 818 stride[j] = 0; +#line 818 err = nc_put_vars_schar(ncid, i, start, edge, stride, value); +#line 818 IF (err != NC_ESTRIDE) +#line 818 error("bad stride: status = %d", err); +#line 818 stride[j] = 1; +#line 818 } +#line 818 } +#line 818 } +#line 818 /* Choose a random point dividing each dim into 2 parts */ +#line 818 /* Put 2^rank (nslabs) slabs so defined */ +#line 818 nslabs = 1; +#line 818 for (j = 0; j < var_rank[i]; j++) { +#line 818 mid[j] = roll( var_shape[i][j] ); +#line 818 nslabs *= 2; +#line 818 } +#line 818 /* bits of k determine whether to put lower or upper part of dim */ +#line 818 /* choose random stride from 1 to edge */ +#line 818 for (k = 0; k < nslabs; k++) { +#line 818 nstarts = 1; +#line 818 for (j = 0; j < var_rank[i]; j++) { +#line 818 if ((k >> j) & 1) { +#line 818 start[j] = 0; +#line 818 edge[j] = mid[j]; +#line 818 }else{ +#line 818 start[j] = mid[j]; +#line 818 edge[j] = var_shape[i][j] - mid[j]; +#line 818 } +#line 818 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 818 nstarts *= stride[j]; +#line 818 } +#line 818 for (m = 0; m < nstarts; m++) { +#line 818 err = toMixedBase(m, var_rank[i], sstride, index); +#line 818 IF (err) +#line 818 error("error in toMixedBase"); +#line 818 nels = 1; +#line 818 for (j = 0; j < var_rank[i]; j++) { +#line 818 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 818 nels *= count[j]; +#line 818 index[j] += start[j]; +#line 818 } +#line 818 /* Random choice of forward or backward */ +#line 818 /* TODO +#line 818 if ( roll(2) ) { +#line 818 for (j = 0; j < var_rank[i]; j++) { +#line 818 index[j] += (count[j] - 1) * stride[j]; +#line 818 stride[j] = -stride[j]; +#line 818 } +#line 818 } +#line 818 */ +#line 818 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 818 err = toMixedBase(j, var_rank[i], count, index2); +#line 818 IF (err) +#line 818 error("error in toMixedBase"); +#line 818 for (d = 0; d < var_rank[i]; d++) +#line 818 index2[d] = index[d] + index2[d] * stride[d]; +#line 818 value[j] = hash_schar(var_type[i], var_rank[i], index2, +#line 818 NCT_SCHAR); +#line 818 allInExtRange = allInExtRange +#line 818 && inRange3(value[j], var_type[i], NCT_SCHAR); +#line 818 } +#line 818 if (var_rank[i] == 0 && i%2 == 0) +#line 818 err = nc_put_vars_schar(ncid, i, NULL, NULL, stride, value); +#line 818 else +#line 818 err = nc_put_vars_schar(ncid, i, index, count, stride, value); +#line 818 if (canConvert) { +#line 818 if (allInExtRange) { +#line 818 IF (err) +#line 818 error("%s", nc_strerror(err)); +#line 818 } else { +#line 818 IF (err != NC_ERANGE) +#line 818 error("range error: status = %d", err); +#line 818 } +#line 818 } else { +#line 818 IF (nels > 0 && err != NC_ECHAR) +#line 818 error("wrong type: status = %d", err); +#line 818 } +#line 818 } +#line 818 } +#line 818 } +#line 818 +#line 818 err = nc_close(ncid); +#line 818 IF (err) +#line 818 error("nc_close: %s", nc_strerror(err)); +#line 818 +#line 818 check_vars_schar(scratch); +#line 818 +#line 818 err = remove(scratch); +#line 818 IF (err) +#line 818 error("remove of %s failed", scratch); +#line 818 } +#line 818 void +#line 819 test_nc_put_vars_short(void) +#line 819 { +#line 819 int ncid; +#line 819 int d; +#line 819 int i; +#line 819 int j; +#line 819 int k; +#line 819 int m; +#line 819 int err; +#line 819 int nels; +#line 819 int nslabs; +#line 819 int nstarts; /* number of different starts */ +#line 819 size_t start[MAX_RANK]; +#line 819 size_t edge[MAX_RANK]; +#line 819 size_t index[MAX_RANK]; +#line 819 size_t index2[MAX_RANK]; +#line 819 size_t mid[MAX_RANK]; +#line 819 size_t count[MAX_RANK]; +#line 819 size_t sstride[MAX_RANK]; +#line 819 ptrdiff_t stride[MAX_RANK]; +#line 819 int canConvert; /* Both text or both numeric */ +#line 819 int allInExtRange; /* all values within external range? */ +#line 819 short value[MAX_NELS]; +#line 819 +#line 819 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 819 IF (err) { +#line 819 error("nc_create: %s", nc_strerror(err)); +#line 819 return; +#line 819 } +#line 819 def_dims(ncid); +#line 819 def_vars(ncid); +#line 819 err = nc_enddef(ncid); +#line 819 IF (err) +#line 819 error("nc_enddef: %s", nc_strerror(err)); +#line 819 +#line 819 for (i = 0; i < NVARS; i++) { +#line 819 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 819 assert(var_rank[i] <= MAX_RANK); +#line 819 assert(var_nels[i] <= MAX_NELS); +#line 819 for (j = 0; j < var_rank[i]; j++) { +#line 819 start[j] = 0; +#line 819 edge[j] = 1; +#line 819 stride[j] = 1; +#line 819 } +#line 819 err = nc_put_vars_short(BAD_ID, i, start, edge, stride, value); +#line 819 IF (err != NC_EBADID) +#line 819 error("bad ncid: status = %d", err); +#line 819 err = nc_put_vars_short(ncid, BAD_VARID, start, edge, stride, value); +#line 819 IF (err != NC_ENOTVAR) +#line 819 error("bad var id: status = %d", err); +#line 819 for (j = 0; j < var_rank[i]; j++) { +#line 819 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 819 start[j] = var_shape[i][j] + 1; +#line 819 err = nc_put_vars_short(ncid, i, start, edge, stride, value); +#line 819 if(!canConvert) { +#line 819 IF(err != NC_ECHAR) +#line 819 error("conversion: status = %d", err); +#line 819 } else { +#line 819 IF(err != NC_EINVALCOORDS) +#line 819 error("bad start: status = %d", err); +#line 819 start[j] = 0; +#line 819 edge[j] = var_shape[i][j] + 1; +#line 819 err = nc_put_vars_short(ncid, i, start, edge, stride, value); +#line 819 IF (err != NC_EEDGE) +#line 819 error("bad edge: status = %d", err); +#line 819 edge[j] = 1; +#line 819 stride[j] = 0; +#line 819 err = nc_put_vars_short(ncid, i, start, edge, stride, value); +#line 819 IF (err != NC_ESTRIDE) +#line 819 error("bad stride: status = %d", err); +#line 819 stride[j] = 1; +#line 819 } +#line 819 } +#line 819 } +#line 819 /* Choose a random point dividing each dim into 2 parts */ +#line 819 /* Put 2^rank (nslabs) slabs so defined */ +#line 819 nslabs = 1; +#line 819 for (j = 0; j < var_rank[i]; j++) { +#line 819 mid[j] = roll( var_shape[i][j] ); +#line 819 nslabs *= 2; +#line 819 } +#line 819 /* bits of k determine whether to put lower or upper part of dim */ +#line 819 /* choose random stride from 1 to edge */ +#line 819 for (k = 0; k < nslabs; k++) { +#line 819 nstarts = 1; +#line 819 for (j = 0; j < var_rank[i]; j++) { +#line 819 if ((k >> j) & 1) { +#line 819 start[j] = 0; +#line 819 edge[j] = mid[j]; +#line 819 }else{ +#line 819 start[j] = mid[j]; +#line 819 edge[j] = var_shape[i][j] - mid[j]; +#line 819 } +#line 819 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 819 nstarts *= stride[j]; +#line 819 } +#line 819 for (m = 0; m < nstarts; m++) { +#line 819 err = toMixedBase(m, var_rank[i], sstride, index); +#line 819 IF (err) +#line 819 error("error in toMixedBase"); +#line 819 nels = 1; +#line 819 for (j = 0; j < var_rank[i]; j++) { +#line 819 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 819 nels *= count[j]; +#line 819 index[j] += start[j]; +#line 819 } +#line 819 /* Random choice of forward or backward */ +#line 819 /* TODO +#line 819 if ( roll(2) ) { +#line 819 for (j = 0; j < var_rank[i]; j++) { +#line 819 index[j] += (count[j] - 1) * stride[j]; +#line 819 stride[j] = -stride[j]; +#line 819 } +#line 819 } +#line 819 */ +#line 819 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 819 err = toMixedBase(j, var_rank[i], count, index2); +#line 819 IF (err) +#line 819 error("error in toMixedBase"); +#line 819 for (d = 0; d < var_rank[i]; d++) +#line 819 index2[d] = index[d] + index2[d] * stride[d]; +#line 819 value[j] = hash_short(var_type[i], var_rank[i], index2, +#line 819 NCT_SHORT); +#line 819 allInExtRange = allInExtRange +#line 819 && inRange3(value[j], var_type[i], NCT_SHORT); +#line 819 } +#line 819 if (var_rank[i] == 0 && i%2 == 0) +#line 819 err = nc_put_vars_short(ncid, i, NULL, NULL, stride, value); +#line 819 else +#line 819 err = nc_put_vars_short(ncid, i, index, count, stride, value); +#line 819 if (canConvert) { +#line 819 if (allInExtRange) { +#line 819 IF (err) +#line 819 error("%s", nc_strerror(err)); +#line 819 } else { +#line 819 IF (err != NC_ERANGE) +#line 819 error("range error: status = %d", err); +#line 819 } +#line 819 } else { +#line 819 IF (nels > 0 && err != NC_ECHAR) +#line 819 error("wrong type: status = %d", err); +#line 819 } +#line 819 } +#line 819 } +#line 819 } +#line 819 +#line 819 err = nc_close(ncid); +#line 819 IF (err) +#line 819 error("nc_close: %s", nc_strerror(err)); +#line 819 +#line 819 check_vars_short(scratch); +#line 819 +#line 819 err = remove(scratch); +#line 819 IF (err) +#line 819 error("remove of %s failed", scratch); +#line 819 } +#line 819 void +#line 820 test_nc_put_vars_int(void) +#line 820 { +#line 820 int ncid; +#line 820 int d; +#line 820 int i; +#line 820 int j; +#line 820 int k; +#line 820 int m; +#line 820 int err; +#line 820 int nels; +#line 820 int nslabs; +#line 820 int nstarts; /* number of different starts */ +#line 820 size_t start[MAX_RANK]; +#line 820 size_t edge[MAX_RANK]; +#line 820 size_t index[MAX_RANK]; +#line 820 size_t index2[MAX_RANK]; +#line 820 size_t mid[MAX_RANK]; +#line 820 size_t count[MAX_RANK]; +#line 820 size_t sstride[MAX_RANK]; +#line 820 ptrdiff_t stride[MAX_RANK]; +#line 820 int canConvert; /* Both text or both numeric */ +#line 820 int allInExtRange; /* all values within external range? */ +#line 820 int value[MAX_NELS]; +#line 820 +#line 820 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 820 IF (err) { +#line 820 error("nc_create: %s", nc_strerror(err)); +#line 820 return; +#line 820 } +#line 820 def_dims(ncid); +#line 820 def_vars(ncid); +#line 820 err = nc_enddef(ncid); +#line 820 IF (err) +#line 820 error("nc_enddef: %s", nc_strerror(err)); +#line 820 +#line 820 for (i = 0; i < NVARS; i++) { +#line 820 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 820 assert(var_rank[i] <= MAX_RANK); +#line 820 assert(var_nels[i] <= MAX_NELS); +#line 820 for (j = 0; j < var_rank[i]; j++) { +#line 820 start[j] = 0; +#line 820 edge[j] = 1; +#line 820 stride[j] = 1; +#line 820 } +#line 820 err = nc_put_vars_int(BAD_ID, i, start, edge, stride, value); +#line 820 IF (err != NC_EBADID) +#line 820 error("bad ncid: status = %d", err); +#line 820 err = nc_put_vars_int(ncid, BAD_VARID, start, edge, stride, value); +#line 820 IF (err != NC_ENOTVAR) +#line 820 error("bad var id: status = %d", err); +#line 820 for (j = 0; j < var_rank[i]; j++) { +#line 820 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 820 start[j] = var_shape[i][j] + 1; +#line 820 err = nc_put_vars_int(ncid, i, start, edge, stride, value); +#line 820 if(!canConvert) { +#line 820 IF(err != NC_ECHAR) +#line 820 error("conversion: status = %d", err); +#line 820 } else { +#line 820 IF(err != NC_EINVALCOORDS) +#line 820 error("bad start: status = %d", err); +#line 820 start[j] = 0; +#line 820 edge[j] = var_shape[i][j] + 1; +#line 820 err = nc_put_vars_int(ncid, i, start, edge, stride, value); +#line 820 IF (err != NC_EEDGE) +#line 820 error("bad edge: status = %d", err); +#line 820 edge[j] = 1; +#line 820 stride[j] = 0; +#line 820 err = nc_put_vars_int(ncid, i, start, edge, stride, value); +#line 820 IF (err != NC_ESTRIDE) +#line 820 error("bad stride: status = %d", err); +#line 820 stride[j] = 1; +#line 820 } +#line 820 } +#line 820 } +#line 820 /* Choose a random point dividing each dim into 2 parts */ +#line 820 /* Put 2^rank (nslabs) slabs so defined */ +#line 820 nslabs = 1; +#line 820 for (j = 0; j < var_rank[i]; j++) { +#line 820 mid[j] = roll( var_shape[i][j] ); +#line 820 nslabs *= 2; +#line 820 } +#line 820 /* bits of k determine whether to put lower or upper part of dim */ +#line 820 /* choose random stride from 1 to edge */ +#line 820 for (k = 0; k < nslabs; k++) { +#line 820 nstarts = 1; +#line 820 for (j = 0; j < var_rank[i]; j++) { +#line 820 if ((k >> j) & 1) { +#line 820 start[j] = 0; +#line 820 edge[j] = mid[j]; +#line 820 }else{ +#line 820 start[j] = mid[j]; +#line 820 edge[j] = var_shape[i][j] - mid[j]; +#line 820 } +#line 820 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 820 nstarts *= stride[j]; +#line 820 } +#line 820 for (m = 0; m < nstarts; m++) { +#line 820 err = toMixedBase(m, var_rank[i], sstride, index); +#line 820 IF (err) +#line 820 error("error in toMixedBase"); +#line 820 nels = 1; +#line 820 for (j = 0; j < var_rank[i]; j++) { +#line 820 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 820 nels *= count[j]; +#line 820 index[j] += start[j]; +#line 820 } +#line 820 /* Random choice of forward or backward */ +#line 820 /* TODO +#line 820 if ( roll(2) ) { +#line 820 for (j = 0; j < var_rank[i]; j++) { +#line 820 index[j] += (count[j] - 1) * stride[j]; +#line 820 stride[j] = -stride[j]; +#line 820 } +#line 820 } +#line 820 */ +#line 820 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 820 err = toMixedBase(j, var_rank[i], count, index2); +#line 820 IF (err) +#line 820 error("error in toMixedBase"); +#line 820 for (d = 0; d < var_rank[i]; d++) +#line 820 index2[d] = index[d] + index2[d] * stride[d]; +#line 820 value[j] = hash_int(var_type[i], var_rank[i], index2, +#line 820 NCT_INT); +#line 820 allInExtRange = allInExtRange +#line 820 && inRange3(value[j], var_type[i], NCT_INT); +#line 820 } +#line 820 if (var_rank[i] == 0 && i%2 == 0) +#line 820 err = nc_put_vars_int(ncid, i, NULL, NULL, stride, value); +#line 820 else +#line 820 err = nc_put_vars_int(ncid, i, index, count, stride, value); +#line 820 if (canConvert) { +#line 820 if (allInExtRange) { +#line 820 IF (err) +#line 820 error("%s", nc_strerror(err)); +#line 820 } else { +#line 820 IF (err != NC_ERANGE) +#line 820 error("range error: status = %d", err); +#line 820 } +#line 820 } else { +#line 820 IF (nels > 0 && err != NC_ECHAR) +#line 820 error("wrong type: status = %d", err); +#line 820 } +#line 820 } +#line 820 } +#line 820 } +#line 820 +#line 820 err = nc_close(ncid); +#line 820 IF (err) +#line 820 error("nc_close: %s", nc_strerror(err)); +#line 820 +#line 820 check_vars_int(scratch); +#line 820 +#line 820 err = remove(scratch); +#line 820 IF (err) +#line 820 error("remove of %s failed", scratch); +#line 820 } +#line 820 void +#line 821 test_nc_put_vars_long(void) +#line 821 { +#line 821 int ncid; +#line 821 int d; +#line 821 int i; +#line 821 int j; +#line 821 int k; +#line 821 int m; +#line 821 int err; +#line 821 int nels; +#line 821 int nslabs; +#line 821 int nstarts; /* number of different starts */ +#line 821 size_t start[MAX_RANK]; +#line 821 size_t edge[MAX_RANK]; +#line 821 size_t index[MAX_RANK]; +#line 821 size_t index2[MAX_RANK]; +#line 821 size_t mid[MAX_RANK]; +#line 821 size_t count[MAX_RANK]; +#line 821 size_t sstride[MAX_RANK]; +#line 821 ptrdiff_t stride[MAX_RANK]; +#line 821 int canConvert; /* Both text or both numeric */ +#line 821 int allInExtRange; /* all values within external range? */ +#line 821 long value[MAX_NELS]; +#line 821 +#line 821 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 821 IF (err) { +#line 821 error("nc_create: %s", nc_strerror(err)); +#line 821 return; +#line 821 } +#line 821 def_dims(ncid); +#line 821 def_vars(ncid); +#line 821 err = nc_enddef(ncid); +#line 821 IF (err) +#line 821 error("nc_enddef: %s", nc_strerror(err)); +#line 821 +#line 821 for (i = 0; i < NVARS; i++) { +#line 821 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 821 assert(var_rank[i] <= MAX_RANK); +#line 821 assert(var_nels[i] <= MAX_NELS); +#line 821 for (j = 0; j < var_rank[i]; j++) { +#line 821 start[j] = 0; +#line 821 edge[j] = 1; +#line 821 stride[j] = 1; +#line 821 } +#line 821 err = nc_put_vars_long(BAD_ID, i, start, edge, stride, value); +#line 821 IF (err != NC_EBADID) +#line 821 error("bad ncid: status = %d", err); +#line 821 err = nc_put_vars_long(ncid, BAD_VARID, start, edge, stride, value); +#line 821 IF (err != NC_ENOTVAR) +#line 821 error("bad var id: status = %d", err); +#line 821 for (j = 0; j < var_rank[i]; j++) { +#line 821 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 821 start[j] = var_shape[i][j] + 1; +#line 821 err = nc_put_vars_long(ncid, i, start, edge, stride, value); +#line 821 if(!canConvert) { +#line 821 IF(err != NC_ECHAR) +#line 821 error("conversion: status = %d", err); +#line 821 } else { +#line 821 IF(err != NC_EINVALCOORDS) +#line 821 error("bad start: status = %d", err); +#line 821 start[j] = 0; +#line 821 edge[j] = var_shape[i][j] + 1; +#line 821 err = nc_put_vars_long(ncid, i, start, edge, stride, value); +#line 821 IF (err != NC_EEDGE) +#line 821 error("bad edge: status = %d", err); +#line 821 edge[j] = 1; +#line 821 stride[j] = 0; +#line 821 err = nc_put_vars_long(ncid, i, start, edge, stride, value); +#line 821 IF (err != NC_ESTRIDE) +#line 821 error("bad stride: status = %d", err); +#line 821 stride[j] = 1; +#line 821 } +#line 821 } +#line 821 } +#line 821 /* Choose a random point dividing each dim into 2 parts */ +#line 821 /* Put 2^rank (nslabs) slabs so defined */ +#line 821 nslabs = 1; +#line 821 for (j = 0; j < var_rank[i]; j++) { +#line 821 mid[j] = roll( var_shape[i][j] ); +#line 821 nslabs *= 2; +#line 821 } +#line 821 /* bits of k determine whether to put lower or upper part of dim */ +#line 821 /* choose random stride from 1 to edge */ +#line 821 for (k = 0; k < nslabs; k++) { +#line 821 nstarts = 1; +#line 821 for (j = 0; j < var_rank[i]; j++) { +#line 821 if ((k >> j) & 1) { +#line 821 start[j] = 0; +#line 821 edge[j] = mid[j]; +#line 821 }else{ +#line 821 start[j] = mid[j]; +#line 821 edge[j] = var_shape[i][j] - mid[j]; +#line 821 } +#line 821 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 821 nstarts *= stride[j]; +#line 821 } +#line 821 for (m = 0; m < nstarts; m++) { +#line 821 err = toMixedBase(m, var_rank[i], sstride, index); +#line 821 IF (err) +#line 821 error("error in toMixedBase"); +#line 821 nels = 1; +#line 821 for (j = 0; j < var_rank[i]; j++) { +#line 821 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 821 nels *= count[j]; +#line 821 index[j] += start[j]; +#line 821 } +#line 821 /* Random choice of forward or backward */ +#line 821 /* TODO +#line 821 if ( roll(2) ) { +#line 821 for (j = 0; j < var_rank[i]; j++) { +#line 821 index[j] += (count[j] - 1) * stride[j]; +#line 821 stride[j] = -stride[j]; +#line 821 } +#line 821 } +#line 821 */ +#line 821 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 821 err = toMixedBase(j, var_rank[i], count, index2); +#line 821 IF (err) +#line 821 error("error in toMixedBase"); +#line 821 for (d = 0; d < var_rank[i]; d++) +#line 821 index2[d] = index[d] + index2[d] * stride[d]; +#line 821 value[j] = hash_long(var_type[i], var_rank[i], index2, +#line 821 NCT_LONG); +#line 821 allInExtRange = allInExtRange +#line 821 && inRange3(value[j], var_type[i], NCT_LONG); +#line 821 } +#line 821 if (var_rank[i] == 0 && i%2 == 0) +#line 821 err = nc_put_vars_long(ncid, i, NULL, NULL, stride, value); +#line 821 else +#line 821 err = nc_put_vars_long(ncid, i, index, count, stride, value); +#line 821 if (canConvert) { +#line 821 if (allInExtRange) { +#line 821 IF (err) +#line 821 error("%s", nc_strerror(err)); +#line 821 } else { +#line 821 IF (err != NC_ERANGE) +#line 821 error("range error: status = %d", err); +#line 821 } +#line 821 } else { +#line 821 IF (nels > 0 && err != NC_ECHAR) +#line 821 error("wrong type: status = %d", err); +#line 821 } +#line 821 } +#line 821 } +#line 821 } +#line 821 +#line 821 err = nc_close(ncid); +#line 821 IF (err) +#line 821 error("nc_close: %s", nc_strerror(err)); +#line 821 +#line 821 check_vars_long(scratch); +#line 821 +#line 821 err = remove(scratch); +#line 821 IF (err) +#line 821 error("remove of %s failed", scratch); +#line 821 } +#line 821 void +#line 822 test_nc_put_vars_float(void) +#line 822 { +#line 822 int ncid; +#line 822 int d; +#line 822 int i; +#line 822 int j; +#line 822 int k; +#line 822 int m; +#line 822 int err; +#line 822 int nels; +#line 822 int nslabs; +#line 822 int nstarts; /* number of different starts */ +#line 822 size_t start[MAX_RANK]; +#line 822 size_t edge[MAX_RANK]; +#line 822 size_t index[MAX_RANK]; +#line 822 size_t index2[MAX_RANK]; +#line 822 size_t mid[MAX_RANK]; +#line 822 size_t count[MAX_RANK]; +#line 822 size_t sstride[MAX_RANK]; +#line 822 ptrdiff_t stride[MAX_RANK]; +#line 822 int canConvert; /* Both text or both numeric */ +#line 822 int allInExtRange; /* all values within external range? */ +#line 822 float value[MAX_NELS]; +#line 822 +#line 822 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 822 IF (err) { +#line 822 error("nc_create: %s", nc_strerror(err)); +#line 822 return; +#line 822 } +#line 822 def_dims(ncid); +#line 822 def_vars(ncid); +#line 822 err = nc_enddef(ncid); +#line 822 IF (err) +#line 822 error("nc_enddef: %s", nc_strerror(err)); +#line 822 +#line 822 for (i = 0; i < NVARS; i++) { +#line 822 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 822 assert(var_rank[i] <= MAX_RANK); +#line 822 assert(var_nels[i] <= MAX_NELS); +#line 822 for (j = 0; j < var_rank[i]; j++) { +#line 822 start[j] = 0; +#line 822 edge[j] = 1; +#line 822 stride[j] = 1; +#line 822 } +#line 822 err = nc_put_vars_float(BAD_ID, i, start, edge, stride, value); +#line 822 IF (err != NC_EBADID) +#line 822 error("bad ncid: status = %d", err); +#line 822 err = nc_put_vars_float(ncid, BAD_VARID, start, edge, stride, value); +#line 822 IF (err != NC_ENOTVAR) +#line 822 error("bad var id: status = %d", err); +#line 822 for (j = 0; j < var_rank[i]; j++) { +#line 822 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 822 start[j] = var_shape[i][j] + 1; +#line 822 err = nc_put_vars_float(ncid, i, start, edge, stride, value); +#line 822 if(!canConvert) { +#line 822 IF(err != NC_ECHAR) +#line 822 error("conversion: status = %d", err); +#line 822 } else { +#line 822 IF(err != NC_EINVALCOORDS) +#line 822 error("bad start: status = %d", err); +#line 822 start[j] = 0; +#line 822 edge[j] = var_shape[i][j] + 1; +#line 822 err = nc_put_vars_float(ncid, i, start, edge, stride, value); +#line 822 IF (err != NC_EEDGE) +#line 822 error("bad edge: status = %d", err); +#line 822 edge[j] = 1; +#line 822 stride[j] = 0; +#line 822 err = nc_put_vars_float(ncid, i, start, edge, stride, value); +#line 822 IF (err != NC_ESTRIDE) +#line 822 error("bad stride: status = %d", err); +#line 822 stride[j] = 1; +#line 822 } +#line 822 } +#line 822 } +#line 822 /* Choose a random point dividing each dim into 2 parts */ +#line 822 /* Put 2^rank (nslabs) slabs so defined */ +#line 822 nslabs = 1; +#line 822 for (j = 0; j < var_rank[i]; j++) { +#line 822 mid[j] = roll( var_shape[i][j] ); +#line 822 nslabs *= 2; +#line 822 } +#line 822 /* bits of k determine whether to put lower or upper part of dim */ +#line 822 /* choose random stride from 1 to edge */ +#line 822 for (k = 0; k < nslabs; k++) { +#line 822 nstarts = 1; +#line 822 for (j = 0; j < var_rank[i]; j++) { +#line 822 if ((k >> j) & 1) { +#line 822 start[j] = 0; +#line 822 edge[j] = mid[j]; +#line 822 }else{ +#line 822 start[j] = mid[j]; +#line 822 edge[j] = var_shape[i][j] - mid[j]; +#line 822 } +#line 822 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 822 nstarts *= stride[j]; +#line 822 } +#line 822 for (m = 0; m < nstarts; m++) { +#line 822 err = toMixedBase(m, var_rank[i], sstride, index); +#line 822 IF (err) +#line 822 error("error in toMixedBase"); +#line 822 nels = 1; +#line 822 for (j = 0; j < var_rank[i]; j++) { +#line 822 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 822 nels *= count[j]; +#line 822 index[j] += start[j]; +#line 822 } +#line 822 /* Random choice of forward or backward */ +#line 822 /* TODO +#line 822 if ( roll(2) ) { +#line 822 for (j = 0; j < var_rank[i]; j++) { +#line 822 index[j] += (count[j] - 1) * stride[j]; +#line 822 stride[j] = -stride[j]; +#line 822 } +#line 822 } +#line 822 */ +#line 822 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 822 err = toMixedBase(j, var_rank[i], count, index2); +#line 822 IF (err) +#line 822 error("error in toMixedBase"); +#line 822 for (d = 0; d < var_rank[i]; d++) +#line 822 index2[d] = index[d] + index2[d] * stride[d]; +#line 822 value[j] = hash_float(var_type[i], var_rank[i], index2, +#line 822 NCT_FLOAT); +#line 822 allInExtRange = allInExtRange +#line 822 && inRange3(value[j], var_type[i], NCT_FLOAT); +#line 822 } +#line 822 if (var_rank[i] == 0 && i%2 == 0) +#line 822 err = nc_put_vars_float(ncid, i, NULL, NULL, stride, value); +#line 822 else +#line 822 err = nc_put_vars_float(ncid, i, index, count, stride, value); +#line 822 if (canConvert) { +#line 822 if (allInExtRange) { +#line 822 IF (err) +#line 822 error("%s", nc_strerror(err)); +#line 822 } else { +#line 822 IF (err != NC_ERANGE) +#line 822 error("range error: status = %d", err); +#line 822 } +#line 822 } else { +#line 822 IF (nels > 0 && err != NC_ECHAR) +#line 822 error("wrong type: status = %d", err); +#line 822 } +#line 822 } +#line 822 } +#line 822 } +#line 822 +#line 822 err = nc_close(ncid); +#line 822 IF (err) +#line 822 error("nc_close: %s", nc_strerror(err)); +#line 822 +#line 822 check_vars_float(scratch); +#line 822 +#line 822 err = remove(scratch); +#line 822 IF (err) +#line 822 error("remove of %s failed", scratch); +#line 822 } +#line 822 void +#line 823 test_nc_put_vars_double(void) +#line 823 { +#line 823 int ncid; +#line 823 int d; +#line 823 int i; +#line 823 int j; +#line 823 int k; +#line 823 int m; +#line 823 int err; +#line 823 int nels; +#line 823 int nslabs; +#line 823 int nstarts; /* number of different starts */ +#line 823 size_t start[MAX_RANK]; +#line 823 size_t edge[MAX_RANK]; +#line 823 size_t index[MAX_RANK]; +#line 823 size_t index2[MAX_RANK]; +#line 823 size_t mid[MAX_RANK]; +#line 823 size_t count[MAX_RANK]; +#line 823 size_t sstride[MAX_RANK]; +#line 823 ptrdiff_t stride[MAX_RANK]; +#line 823 int canConvert; /* Both text or both numeric */ +#line 823 int allInExtRange; /* all values within external range? */ +#line 823 double value[MAX_NELS]; +#line 823 +#line 823 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 823 IF (err) { +#line 823 error("nc_create: %s", nc_strerror(err)); +#line 823 return; +#line 823 } +#line 823 def_dims(ncid); +#line 823 def_vars(ncid); +#line 823 err = nc_enddef(ncid); +#line 823 IF (err) +#line 823 error("nc_enddef: %s", nc_strerror(err)); +#line 823 +#line 823 for (i = 0; i < NVARS; i++) { +#line 823 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 823 assert(var_rank[i] <= MAX_RANK); +#line 823 assert(var_nels[i] <= MAX_NELS); +#line 823 for (j = 0; j < var_rank[i]; j++) { +#line 823 start[j] = 0; +#line 823 edge[j] = 1; +#line 823 stride[j] = 1; +#line 823 } +#line 823 err = nc_put_vars_double(BAD_ID, i, start, edge, stride, value); +#line 823 IF (err != NC_EBADID) +#line 823 error("bad ncid: status = %d", err); +#line 823 err = nc_put_vars_double(ncid, BAD_VARID, start, edge, stride, value); +#line 823 IF (err != NC_ENOTVAR) +#line 823 error("bad var id: status = %d", err); +#line 823 for (j = 0; j < var_rank[i]; j++) { +#line 823 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 823 start[j] = var_shape[i][j] + 1; +#line 823 err = nc_put_vars_double(ncid, i, start, edge, stride, value); +#line 823 if(!canConvert) { +#line 823 IF(err != NC_ECHAR) +#line 823 error("conversion: status = %d", err); +#line 823 } else { +#line 823 IF(err != NC_EINVALCOORDS) +#line 823 error("bad start: status = %d", err); +#line 823 start[j] = 0; +#line 823 edge[j] = var_shape[i][j] + 1; +#line 823 err = nc_put_vars_double(ncid, i, start, edge, stride, value); +#line 823 IF (err != NC_EEDGE) +#line 823 error("bad edge: status = %d", err); +#line 823 edge[j] = 1; +#line 823 stride[j] = 0; +#line 823 err = nc_put_vars_double(ncid, i, start, edge, stride, value); +#line 823 IF (err != NC_ESTRIDE) +#line 823 error("bad stride: status = %d", err); +#line 823 stride[j] = 1; +#line 823 } +#line 823 } +#line 823 } +#line 823 /* Choose a random point dividing each dim into 2 parts */ +#line 823 /* Put 2^rank (nslabs) slabs so defined */ +#line 823 nslabs = 1; +#line 823 for (j = 0; j < var_rank[i]; j++) { +#line 823 mid[j] = roll( var_shape[i][j] ); +#line 823 nslabs *= 2; +#line 823 } +#line 823 /* bits of k determine whether to put lower or upper part of dim */ +#line 823 /* choose random stride from 1 to edge */ +#line 823 for (k = 0; k < nslabs; k++) { +#line 823 nstarts = 1; +#line 823 for (j = 0; j < var_rank[i]; j++) { +#line 823 if ((k >> j) & 1) { +#line 823 start[j] = 0; +#line 823 edge[j] = mid[j]; +#line 823 }else{ +#line 823 start[j] = mid[j]; +#line 823 edge[j] = var_shape[i][j] - mid[j]; +#line 823 } +#line 823 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 823 nstarts *= stride[j]; +#line 823 } +#line 823 for (m = 0; m < nstarts; m++) { +#line 823 err = toMixedBase(m, var_rank[i], sstride, index); +#line 823 IF (err) +#line 823 error("error in toMixedBase"); +#line 823 nels = 1; +#line 823 for (j = 0; j < var_rank[i]; j++) { +#line 823 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 823 nels *= count[j]; +#line 823 index[j] += start[j]; +#line 823 } +#line 823 /* Random choice of forward or backward */ +#line 823 /* TODO +#line 823 if ( roll(2) ) { +#line 823 for (j = 0; j < var_rank[i]; j++) { +#line 823 index[j] += (count[j] - 1) * stride[j]; +#line 823 stride[j] = -stride[j]; +#line 823 } +#line 823 } +#line 823 */ +#line 823 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 823 err = toMixedBase(j, var_rank[i], count, index2); +#line 823 IF (err) +#line 823 error("error in toMixedBase"); +#line 823 for (d = 0; d < var_rank[i]; d++) +#line 823 index2[d] = index[d] + index2[d] * stride[d]; +#line 823 value[j] = hash_double(var_type[i], var_rank[i], index2, +#line 823 NCT_DOUBLE); +#line 823 allInExtRange = allInExtRange +#line 823 && inRange3(value[j], var_type[i], NCT_DOUBLE); +#line 823 } +#line 823 if (var_rank[i] == 0 && i%2 == 0) +#line 823 err = nc_put_vars_double(ncid, i, NULL, NULL, stride, value); +#line 823 else +#line 823 err = nc_put_vars_double(ncid, i, index, count, stride, value); +#line 823 if (canConvert) { +#line 823 if (allInExtRange) { +#line 823 IF (err) +#line 823 error("%s", nc_strerror(err)); +#line 823 } else { +#line 823 IF (err != NC_ERANGE) +#line 823 error("range error: status = %d", err); +#line 823 } +#line 823 } else { +#line 823 IF (nels > 0 && err != NC_ECHAR) +#line 823 error("wrong type: status = %d", err); +#line 823 } +#line 823 } +#line 823 } +#line 823 } +#line 823 +#line 823 err = nc_close(ncid); +#line 823 IF (err) +#line 823 error("nc_close: %s", nc_strerror(err)); +#line 823 +#line 823 check_vars_double(scratch); +#line 823 +#line 823 err = remove(scratch); +#line 823 IF (err) +#line 823 error("remove of %s failed", scratch); +#line 823 } +#line 823 +#line 996 void +#line 997 test_nc_put_varm_text(void) +#line 997 { +#line 997 int ncid; +#line 997 int d; +#line 997 int i; +#line 997 int j; +#line 997 int k; +#line 997 int m; +#line 997 int err; +#line 997 int nels; +#line 997 int nslabs; +#line 997 int nstarts; /* number of different starts */ +#line 997 size_t start[MAX_RANK]; +#line 997 size_t edge[MAX_RANK]; +#line 997 size_t index[MAX_RANK]; +#line 997 size_t index2[MAX_RANK]; +#line 997 size_t mid[MAX_RANK]; +#line 997 size_t count[MAX_RANK]; +#line 997 size_t sstride[MAX_RANK]; +#line 997 ptrdiff_t stride[MAX_RANK]; +#line 997 ptrdiff_t imap[MAX_RANK]; +#line 997 int canConvert; /* Both text or both numeric */ +#line 997 int allInExtRange; /* all values within external range? */ +#line 997 text value[MAX_NELS]; +#line 997 +#line 997 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 997 IF (err) { +#line 997 error("nc_create: %s", nc_strerror(err)); +#line 997 return; +#line 997 } +#line 997 def_dims(ncid); +#line 997 def_vars(ncid); +#line 997 err = nc_enddef(ncid); +#line 997 IF (err) +#line 997 error("nc_enddef: %s", nc_strerror(err)); +#line 997 +#line 997 for (i = 0; i < NVARS; i++) { +#line 997 canConvert = (var_type[i] == NC_CHAR) == (NCT_TEXT == NCT_TEXT); +#line 997 assert(var_rank[i] <= MAX_RANK); +#line 997 assert(var_nels[i] <= MAX_NELS); +#line 997 for (j = 0; j < var_rank[i]; j++) { +#line 997 start[j] = 0; +#line 997 edge[j] = 1; +#line 997 stride[j] = 1; +#line 997 imap[j] = 1; +#line 997 } +#line 997 err = nc_put_varm_text(BAD_ID, i, start, edge, stride, imap, value); +#line 997 IF (err != NC_EBADID) +#line 997 error("bad ncid: status = %d", err); +#line 997 err = nc_put_varm_text(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 997 IF (err != NC_ENOTVAR) +#line 997 error("bad var id: status = %d", err); +#line 997 for (j = 0; j < var_rank[i]; j++) { +#line 997 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 997 start[j] = var_shape[i][j] + 1; +#line 997 err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value); +#line 997 if (!canConvert) { +#line 997 IF(err != NC_ECHAR) +#line 997 error("conversion: status = %d", err); +#line 997 } else { +#line 997 IF (err != NC_EINVALCOORDS) +#line 997 error("bad start: status = %d", err); +#line 997 start[j] = 0; +#line 997 edge[j] = var_shape[i][j] + 1; +#line 997 err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value); +#line 997 IF (err != NC_EEDGE) +#line 997 error("bad edge: status = %d", err); +#line 997 edge[j] = 1; +#line 997 stride[j] = 0; +#line 997 err = nc_put_varm_text(ncid, i, start, edge, stride, imap, value); +#line 997 IF (err != NC_ESTRIDE) +#line 997 error("bad stride: status = %d", err); +#line 997 stride[j] = 1; +#line 997 } +#line 997 } +#line 997 } +#line 997 /* Choose a random point dividing each dim into 2 parts */ +#line 997 /* Put 2^rank (nslabs) slabs so defined */ +#line 997 nslabs = 1; +#line 997 for (j = 0; j < var_rank[i]; j++) { +#line 997 mid[j] = roll( var_shape[i][j] ); +#line 997 nslabs *= 2; +#line 997 } +#line 997 /* bits of k determine whether to put lower or upper part of dim */ +#line 997 /* choose random stride from 1 to edge */ +#line 997 for (k = 0; k < nslabs; k++) { +#line 997 nstarts = 1; +#line 997 for (j = 0; j < var_rank[i]; j++) { +#line 997 if ((k >> j) & 1) { +#line 997 start[j] = 0; +#line 997 edge[j] = mid[j]; +#line 997 }else{ +#line 997 start[j] = mid[j]; +#line 997 edge[j] = var_shape[i][j] - mid[j]; +#line 997 } +#line 997 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 997 nstarts *= stride[j]; +#line 997 } +#line 997 for (m = 0; m < nstarts; m++) { +#line 997 err = toMixedBase(m, var_rank[i], sstride, index); +#line 997 IF (err) +#line 997 error("error in toMixedBase"); +#line 997 nels = 1; +#line 997 for (j = 0; j < var_rank[i]; j++) { +#line 997 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 997 nels *= count[j]; +#line 997 index[j] += start[j]; +#line 997 } +#line 997 /* Random choice of forward or backward */ +#line 997 /* TODO +#line 997 if ( roll(2) ) { +#line 997 for (j = 0; j < var_rank[i]; j++) { +#line 997 index[j] += (count[j] - 1) * stride[j]; +#line 997 stride[j] = -stride[j]; +#line 997 } +#line 997 } +#line 997 */ +#line 997 if (var_rank[i] > 0) { +#line 997 j = var_rank[i] - 1; +#line 997 imap[j] = 1; +#line 997 for (; j > 0; j--) +#line 997 imap[j-1] = imap[j] * count[j]; +#line 997 } +#line 997 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 997 err = toMixedBase(j, var_rank[i], count, index2); +#line 997 IF (err) +#line 997 error("error in toMixedBase"); +#line 997 for (d = 0; d < var_rank[i]; d++) +#line 997 index2[d] = index[d] + index2[d] * stride[d]; +#line 997 value[j] = hash_text(var_type[i], var_rank[i], index2, +#line 997 NCT_TEXT); +#line 997 allInExtRange = allInExtRange +#line 997 && inRange3(value[j], var_type[i], NCT_TEXT); +#line 997 } +#line 997 if (var_rank[i] == 0 && i%2 == 0) +#line 997 err = nc_put_varm_text(ncid,i,NULL,NULL,NULL,NULL,value); +#line 997 else +#line 997 err = nc_put_varm_text(ncid,i,index,count,stride,imap,value); +#line 997 if (canConvert) { +#line 997 if (allInExtRange) { +#line 997 IF (err) +#line 997 error("%s", nc_strerror(err)); +#line 997 } else { +#line 997 IF (err != NC_ERANGE) +#line 997 error("range error: status = %d", err); +#line 997 } +#line 997 } else { +#line 997 IF (nels > 0 && err != NC_ECHAR) +#line 997 error("wrong type: status = %d", err); +#line 997 } +#line 997 } +#line 997 } +#line 997 } +#line 997 +#line 997 err = nc_close(ncid); +#line 997 IF (err) +#line 997 error("nc_close: %s", nc_strerror(err)); +#line 997 +#line 997 check_vars_text(scratch); +#line 997 +#line 997 err = remove(scratch); +#line 997 IF (err) +#line 997 error("remove of %s failed", scratch); +#line 997 } +#line 997 void +#line 998 test_nc_put_varm_uchar(void) +#line 998 { +#line 998 int ncid; +#line 998 int d; +#line 998 int i; +#line 998 int j; +#line 998 int k; +#line 998 int m; +#line 998 int err; +#line 998 int nels; +#line 998 int nslabs; +#line 998 int nstarts; /* number of different starts */ +#line 998 size_t start[MAX_RANK]; +#line 998 size_t edge[MAX_RANK]; +#line 998 size_t index[MAX_RANK]; +#line 998 size_t index2[MAX_RANK]; +#line 998 size_t mid[MAX_RANK]; +#line 998 size_t count[MAX_RANK]; +#line 998 size_t sstride[MAX_RANK]; +#line 998 ptrdiff_t stride[MAX_RANK]; +#line 998 ptrdiff_t imap[MAX_RANK]; +#line 998 int canConvert; /* Both text or both numeric */ +#line 998 int allInExtRange; /* all values within external range? */ +#line 998 uchar value[MAX_NELS]; +#line 998 +#line 998 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 998 IF (err) { +#line 998 error("nc_create: %s", nc_strerror(err)); +#line 998 return; +#line 998 } +#line 998 def_dims(ncid); +#line 998 def_vars(ncid); +#line 998 err = nc_enddef(ncid); +#line 998 IF (err) +#line 998 error("nc_enddef: %s", nc_strerror(err)); +#line 998 +#line 998 for (i = 0; i < NVARS; i++) { +#line 998 canConvert = (var_type[i] == NC_CHAR) == (NCT_UCHAR == NCT_TEXT); +#line 998 assert(var_rank[i] <= MAX_RANK); +#line 998 assert(var_nels[i] <= MAX_NELS); +#line 998 for (j = 0; j < var_rank[i]; j++) { +#line 998 start[j] = 0; +#line 998 edge[j] = 1; +#line 998 stride[j] = 1; +#line 998 imap[j] = 1; +#line 998 } +#line 998 err = nc_put_varm_uchar(BAD_ID, i, start, edge, stride, imap, value); +#line 998 IF (err != NC_EBADID) +#line 998 error("bad ncid: status = %d", err); +#line 998 err = nc_put_varm_uchar(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 998 IF (err != NC_ENOTVAR) +#line 998 error("bad var id: status = %d", err); +#line 998 for (j = 0; j < var_rank[i]; j++) { +#line 998 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 998 start[j] = var_shape[i][j] + 1; +#line 998 err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value); +#line 998 if (!canConvert) { +#line 998 IF(err != NC_ECHAR) +#line 998 error("conversion: status = %d", err); +#line 998 } else { +#line 998 IF (err != NC_EINVALCOORDS) +#line 998 error("bad start: status = %d", err); +#line 998 start[j] = 0; +#line 998 edge[j] = var_shape[i][j] + 1; +#line 998 err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value); +#line 998 IF (err != NC_EEDGE) +#line 998 error("bad edge: status = %d", err); +#line 998 edge[j] = 1; +#line 998 stride[j] = 0; +#line 998 err = nc_put_varm_uchar(ncid, i, start, edge, stride, imap, value); +#line 998 IF (err != NC_ESTRIDE) +#line 998 error("bad stride: status = %d", err); +#line 998 stride[j] = 1; +#line 998 } +#line 998 } +#line 998 } +#line 998 /* Choose a random point dividing each dim into 2 parts */ +#line 998 /* Put 2^rank (nslabs) slabs so defined */ +#line 998 nslabs = 1; +#line 998 for (j = 0; j < var_rank[i]; j++) { +#line 998 mid[j] = roll( var_shape[i][j] ); +#line 998 nslabs *= 2; +#line 998 } +#line 998 /* bits of k determine whether to put lower or upper part of dim */ +#line 998 /* choose random stride from 1 to edge */ +#line 998 for (k = 0; k < nslabs; k++) { +#line 998 nstarts = 1; +#line 998 for (j = 0; j < var_rank[i]; j++) { +#line 998 if ((k >> j) & 1) { +#line 998 start[j] = 0; +#line 998 edge[j] = mid[j]; +#line 998 }else{ +#line 998 start[j] = mid[j]; +#line 998 edge[j] = var_shape[i][j] - mid[j]; +#line 998 } +#line 998 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 998 nstarts *= stride[j]; +#line 998 } +#line 998 for (m = 0; m < nstarts; m++) { +#line 998 err = toMixedBase(m, var_rank[i], sstride, index); +#line 998 IF (err) +#line 998 error("error in toMixedBase"); +#line 998 nels = 1; +#line 998 for (j = 0; j < var_rank[i]; j++) { +#line 998 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 998 nels *= count[j]; +#line 998 index[j] += start[j]; +#line 998 } +#line 998 /* Random choice of forward or backward */ +#line 998 /* TODO +#line 998 if ( roll(2) ) { +#line 998 for (j = 0; j < var_rank[i]; j++) { +#line 998 index[j] += (count[j] - 1) * stride[j]; +#line 998 stride[j] = -stride[j]; +#line 998 } +#line 998 } +#line 998 */ +#line 998 if (var_rank[i] > 0) { +#line 998 j = var_rank[i] - 1; +#line 998 imap[j] = 1; +#line 998 for (; j > 0; j--) +#line 998 imap[j-1] = imap[j] * count[j]; +#line 998 } +#line 998 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 998 err = toMixedBase(j, var_rank[i], count, index2); +#line 998 IF (err) +#line 998 error("error in toMixedBase"); +#line 998 for (d = 0; d < var_rank[i]; d++) +#line 998 index2[d] = index[d] + index2[d] * stride[d]; +#line 998 value[j] = hash_uchar(var_type[i], var_rank[i], index2, +#line 998 NCT_UCHAR); +#line 998 allInExtRange = allInExtRange +#line 998 && inRange3(value[j], var_type[i], NCT_UCHAR); +#line 998 } +#line 998 if (var_rank[i] == 0 && i%2 == 0) +#line 998 err = nc_put_varm_uchar(ncid,i,NULL,NULL,NULL,NULL,value); +#line 998 else +#line 998 err = nc_put_varm_uchar(ncid,i,index,count,stride,imap,value); +#line 998 if (canConvert) { +#line 998 if (allInExtRange) { +#line 998 IF (err) +#line 998 error("%s", nc_strerror(err)); +#line 998 } else { +#line 998 IF (err != NC_ERANGE) +#line 998 error("range error: status = %d", err); +#line 998 } +#line 998 } else { +#line 998 IF (nels > 0 && err != NC_ECHAR) +#line 998 error("wrong type: status = %d", err); +#line 998 } +#line 998 } +#line 998 } +#line 998 } +#line 998 +#line 998 err = nc_close(ncid); +#line 998 IF (err) +#line 998 error("nc_close: %s", nc_strerror(err)); +#line 998 +#line 998 check_vars_uchar(scratch); +#line 998 +#line 998 err = remove(scratch); +#line 998 IF (err) +#line 998 error("remove of %s failed", scratch); +#line 998 } +#line 998 void +#line 999 test_nc_put_varm_schar(void) +#line 999 { +#line 999 int ncid; +#line 999 int d; +#line 999 int i; +#line 999 int j; +#line 999 int k; +#line 999 int m; +#line 999 int err; +#line 999 int nels; +#line 999 int nslabs; +#line 999 int nstarts; /* number of different starts */ +#line 999 size_t start[MAX_RANK]; +#line 999 size_t edge[MAX_RANK]; +#line 999 size_t index[MAX_RANK]; +#line 999 size_t index2[MAX_RANK]; +#line 999 size_t mid[MAX_RANK]; +#line 999 size_t count[MAX_RANK]; +#line 999 size_t sstride[MAX_RANK]; +#line 999 ptrdiff_t stride[MAX_RANK]; +#line 999 ptrdiff_t imap[MAX_RANK]; +#line 999 int canConvert; /* Both text or both numeric */ +#line 999 int allInExtRange; /* all values within external range? */ +#line 999 schar value[MAX_NELS]; +#line 999 +#line 999 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 999 IF (err) { +#line 999 error("nc_create: %s", nc_strerror(err)); +#line 999 return; +#line 999 } +#line 999 def_dims(ncid); +#line 999 def_vars(ncid); +#line 999 err = nc_enddef(ncid); +#line 999 IF (err) +#line 999 error("nc_enddef: %s", nc_strerror(err)); +#line 999 +#line 999 for (i = 0; i < NVARS; i++) { +#line 999 canConvert = (var_type[i] == NC_CHAR) == (NCT_SCHAR == NCT_TEXT); +#line 999 assert(var_rank[i] <= MAX_RANK); +#line 999 assert(var_nels[i] <= MAX_NELS); +#line 999 for (j = 0; j < var_rank[i]; j++) { +#line 999 start[j] = 0; +#line 999 edge[j] = 1; +#line 999 stride[j] = 1; +#line 999 imap[j] = 1; +#line 999 } +#line 999 err = nc_put_varm_schar(BAD_ID, i, start, edge, stride, imap, value); +#line 999 IF (err != NC_EBADID) +#line 999 error("bad ncid: status = %d", err); +#line 999 err = nc_put_varm_schar(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 999 IF (err != NC_ENOTVAR) +#line 999 error("bad var id: status = %d", err); +#line 999 for (j = 0; j < var_rank[i]; j++) { +#line 999 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 999 start[j] = var_shape[i][j] + 1; +#line 999 err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value); +#line 999 if (!canConvert) { +#line 999 IF(err != NC_ECHAR) +#line 999 error("conversion: status = %d", err); +#line 999 } else { +#line 999 IF (err != NC_EINVALCOORDS) +#line 999 error("bad start: status = %d", err); +#line 999 start[j] = 0; +#line 999 edge[j] = var_shape[i][j] + 1; +#line 999 err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value); +#line 999 IF (err != NC_EEDGE) +#line 999 error("bad edge: status = %d", err); +#line 999 edge[j] = 1; +#line 999 stride[j] = 0; +#line 999 err = nc_put_varm_schar(ncid, i, start, edge, stride, imap, value); +#line 999 IF (err != NC_ESTRIDE) +#line 999 error("bad stride: status = %d", err); +#line 999 stride[j] = 1; +#line 999 } +#line 999 } +#line 999 } +#line 999 /* Choose a random point dividing each dim into 2 parts */ +#line 999 /* Put 2^rank (nslabs) slabs so defined */ +#line 999 nslabs = 1; +#line 999 for (j = 0; j < var_rank[i]; j++) { +#line 999 mid[j] = roll( var_shape[i][j] ); +#line 999 nslabs *= 2; +#line 999 } +#line 999 /* bits of k determine whether to put lower or upper part of dim */ +#line 999 /* choose random stride from 1 to edge */ +#line 999 for (k = 0; k < nslabs; k++) { +#line 999 nstarts = 1; +#line 999 for (j = 0; j < var_rank[i]; j++) { +#line 999 if ((k >> j) & 1) { +#line 999 start[j] = 0; +#line 999 edge[j] = mid[j]; +#line 999 }else{ +#line 999 start[j] = mid[j]; +#line 999 edge[j] = var_shape[i][j] - mid[j]; +#line 999 } +#line 999 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 999 nstarts *= stride[j]; +#line 999 } +#line 999 for (m = 0; m < nstarts; m++) { +#line 999 err = toMixedBase(m, var_rank[i], sstride, index); +#line 999 IF (err) +#line 999 error("error in toMixedBase"); +#line 999 nels = 1; +#line 999 for (j = 0; j < var_rank[i]; j++) { +#line 999 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 999 nels *= count[j]; +#line 999 index[j] += start[j]; +#line 999 } +#line 999 /* Random choice of forward or backward */ +#line 999 /* TODO +#line 999 if ( roll(2) ) { +#line 999 for (j = 0; j < var_rank[i]; j++) { +#line 999 index[j] += (count[j] - 1) * stride[j]; +#line 999 stride[j] = -stride[j]; +#line 999 } +#line 999 } +#line 999 */ +#line 999 if (var_rank[i] > 0) { +#line 999 j = var_rank[i] - 1; +#line 999 imap[j] = 1; +#line 999 for (; j > 0; j--) +#line 999 imap[j-1] = imap[j] * count[j]; +#line 999 } +#line 999 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 999 err = toMixedBase(j, var_rank[i], count, index2); +#line 999 IF (err) +#line 999 error("error in toMixedBase"); +#line 999 for (d = 0; d < var_rank[i]; d++) +#line 999 index2[d] = index[d] + index2[d] * stride[d]; +#line 999 value[j] = hash_schar(var_type[i], var_rank[i], index2, +#line 999 NCT_SCHAR); +#line 999 allInExtRange = allInExtRange +#line 999 && inRange3(value[j], var_type[i], NCT_SCHAR); +#line 999 } +#line 999 if (var_rank[i] == 0 && i%2 == 0) +#line 999 err = nc_put_varm_schar(ncid,i,NULL,NULL,NULL,NULL,value); +#line 999 else +#line 999 err = nc_put_varm_schar(ncid,i,index,count,stride,imap,value); +#line 999 if (canConvert) { +#line 999 if (allInExtRange) { +#line 999 IF (err) +#line 999 error("%s", nc_strerror(err)); +#line 999 } else { +#line 999 IF (err != NC_ERANGE) +#line 999 error("range error: status = %d", err); +#line 999 } +#line 999 } else { +#line 999 IF (nels > 0 && err != NC_ECHAR) +#line 999 error("wrong type: status = %d", err); +#line 999 } +#line 999 } +#line 999 } +#line 999 } +#line 999 +#line 999 err = nc_close(ncid); +#line 999 IF (err) +#line 999 error("nc_close: %s", nc_strerror(err)); +#line 999 +#line 999 check_vars_schar(scratch); +#line 999 +#line 999 err = remove(scratch); +#line 999 IF (err) +#line 999 error("remove of %s failed", scratch); +#line 999 } +#line 999 void +#line 1000 test_nc_put_varm_short(void) +#line 1000 { +#line 1000 int ncid; +#line 1000 int d; +#line 1000 int i; +#line 1000 int j; +#line 1000 int k; +#line 1000 int m; +#line 1000 int err; +#line 1000 int nels; +#line 1000 int nslabs; +#line 1000 int nstarts; /* number of different starts */ +#line 1000 size_t start[MAX_RANK]; +#line 1000 size_t edge[MAX_RANK]; +#line 1000 size_t index[MAX_RANK]; +#line 1000 size_t index2[MAX_RANK]; +#line 1000 size_t mid[MAX_RANK]; +#line 1000 size_t count[MAX_RANK]; +#line 1000 size_t sstride[MAX_RANK]; +#line 1000 ptrdiff_t stride[MAX_RANK]; +#line 1000 ptrdiff_t imap[MAX_RANK]; +#line 1000 int canConvert; /* Both text or both numeric */ +#line 1000 int allInExtRange; /* all values within external range? */ +#line 1000 short value[MAX_NELS]; +#line 1000 +#line 1000 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 1000 IF (err) { +#line 1000 error("nc_create: %s", nc_strerror(err)); +#line 1000 return; +#line 1000 } +#line 1000 def_dims(ncid); +#line 1000 def_vars(ncid); +#line 1000 err = nc_enddef(ncid); +#line 1000 IF (err) +#line 1000 error("nc_enddef: %s", nc_strerror(err)); +#line 1000 +#line 1000 for (i = 0; i < NVARS; i++) { +#line 1000 canConvert = (var_type[i] == NC_CHAR) == (NCT_SHORT == NCT_TEXT); +#line 1000 assert(var_rank[i] <= MAX_RANK); +#line 1000 assert(var_nels[i] <= MAX_NELS); +#line 1000 for (j = 0; j < var_rank[i]; j++) { +#line 1000 start[j] = 0; +#line 1000 edge[j] = 1; +#line 1000 stride[j] = 1; +#line 1000 imap[j] = 1; +#line 1000 } +#line 1000 err = nc_put_varm_short(BAD_ID, i, start, edge, stride, imap, value); +#line 1000 IF (err != NC_EBADID) +#line 1000 error("bad ncid: status = %d", err); +#line 1000 err = nc_put_varm_short(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 1000 IF (err != NC_ENOTVAR) +#line 1000 error("bad var id: status = %d", err); +#line 1000 for (j = 0; j < var_rank[i]; j++) { +#line 1000 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 1000 start[j] = var_shape[i][j] + 1; +#line 1000 err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value); +#line 1000 if (!canConvert) { +#line 1000 IF(err != NC_ECHAR) +#line 1000 error("conversion: status = %d", err); +#line 1000 } else { +#line 1000 IF (err != NC_EINVALCOORDS) +#line 1000 error("bad start: status = %d", err); +#line 1000 start[j] = 0; +#line 1000 edge[j] = var_shape[i][j] + 1; +#line 1000 err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value); +#line 1000 IF (err != NC_EEDGE) +#line 1000 error("bad edge: status = %d", err); +#line 1000 edge[j] = 1; +#line 1000 stride[j] = 0; +#line 1000 err = nc_put_varm_short(ncid, i, start, edge, stride, imap, value); +#line 1000 IF (err != NC_ESTRIDE) +#line 1000 error("bad stride: status = %d", err); +#line 1000 stride[j] = 1; +#line 1000 } +#line 1000 } +#line 1000 } +#line 1000 /* Choose a random point dividing each dim into 2 parts */ +#line 1000 /* Put 2^rank (nslabs) slabs so defined */ +#line 1000 nslabs = 1; +#line 1000 for (j = 0; j < var_rank[i]; j++) { +#line 1000 mid[j] = roll( var_shape[i][j] ); +#line 1000 nslabs *= 2; +#line 1000 } +#line 1000 /* bits of k determine whether to put lower or upper part of dim */ +#line 1000 /* choose random stride from 1 to edge */ +#line 1000 for (k = 0; k < nslabs; k++) { +#line 1000 nstarts = 1; +#line 1000 for (j = 0; j < var_rank[i]; j++) { +#line 1000 if ((k >> j) & 1) { +#line 1000 start[j] = 0; +#line 1000 edge[j] = mid[j]; +#line 1000 }else{ +#line 1000 start[j] = mid[j]; +#line 1000 edge[j] = var_shape[i][j] - mid[j]; +#line 1000 } +#line 1000 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 1000 nstarts *= stride[j]; +#line 1000 } +#line 1000 for (m = 0; m < nstarts; m++) { +#line 1000 err = toMixedBase(m, var_rank[i], sstride, index); +#line 1000 IF (err) +#line 1000 error("error in toMixedBase"); +#line 1000 nels = 1; +#line 1000 for (j = 0; j < var_rank[i]; j++) { +#line 1000 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 1000 nels *= count[j]; +#line 1000 index[j] += start[j]; +#line 1000 } +#line 1000 /* Random choice of forward or backward */ +#line 1000 /* TODO +#line 1000 if ( roll(2) ) { +#line 1000 for (j = 0; j < var_rank[i]; j++) { +#line 1000 index[j] += (count[j] - 1) * stride[j]; +#line 1000 stride[j] = -stride[j]; +#line 1000 } +#line 1000 } +#line 1000 */ +#line 1000 if (var_rank[i] > 0) { +#line 1000 j = var_rank[i] - 1; +#line 1000 imap[j] = 1; +#line 1000 for (; j > 0; j--) +#line 1000 imap[j-1] = imap[j] * count[j]; +#line 1000 } +#line 1000 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 1000 err = toMixedBase(j, var_rank[i], count, index2); +#line 1000 IF (err) +#line 1000 error("error in toMixedBase"); +#line 1000 for (d = 0; d < var_rank[i]; d++) +#line 1000 index2[d] = index[d] + index2[d] * stride[d]; +#line 1000 value[j] = hash_short(var_type[i], var_rank[i], index2, +#line 1000 NCT_SHORT); +#line 1000 allInExtRange = allInExtRange +#line 1000 && inRange3(value[j], var_type[i], NCT_SHORT); +#line 1000 } +#line 1000 if (var_rank[i] == 0 && i%2 == 0) +#line 1000 err = nc_put_varm_short(ncid,i,NULL,NULL,NULL,NULL,value); +#line 1000 else +#line 1000 err = nc_put_varm_short(ncid,i,index,count,stride,imap,value); +#line 1000 if (canConvert) { +#line 1000 if (allInExtRange) { +#line 1000 IF (err) +#line 1000 error("%s", nc_strerror(err)); +#line 1000 } else { +#line 1000 IF (err != NC_ERANGE) +#line 1000 error("range error: status = %d", err); +#line 1000 } +#line 1000 } else { +#line 1000 IF (nels > 0 && err != NC_ECHAR) +#line 1000 error("wrong type: status = %d", err); +#line 1000 } +#line 1000 } +#line 1000 } +#line 1000 } +#line 1000 +#line 1000 err = nc_close(ncid); +#line 1000 IF (err) +#line 1000 error("nc_close: %s", nc_strerror(err)); +#line 1000 +#line 1000 check_vars_short(scratch); +#line 1000 +#line 1000 err = remove(scratch); +#line 1000 IF (err) +#line 1000 error("remove of %s failed", scratch); +#line 1000 } +#line 1000 void +#line 1001 test_nc_put_varm_int(void) +#line 1001 { +#line 1001 int ncid; +#line 1001 int d; +#line 1001 int i; +#line 1001 int j; +#line 1001 int k; +#line 1001 int m; +#line 1001 int err; +#line 1001 int nels; +#line 1001 int nslabs; +#line 1001 int nstarts; /* number of different starts */ +#line 1001 size_t start[MAX_RANK]; +#line 1001 size_t edge[MAX_RANK]; +#line 1001 size_t index[MAX_RANK]; +#line 1001 size_t index2[MAX_RANK]; +#line 1001 size_t mid[MAX_RANK]; +#line 1001 size_t count[MAX_RANK]; +#line 1001 size_t sstride[MAX_RANK]; +#line 1001 ptrdiff_t stride[MAX_RANK]; +#line 1001 ptrdiff_t imap[MAX_RANK]; +#line 1001 int canConvert; /* Both text or both numeric */ +#line 1001 int allInExtRange; /* all values within external range? */ +#line 1001 int value[MAX_NELS]; +#line 1001 +#line 1001 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 1001 IF (err) { +#line 1001 error("nc_create: %s", nc_strerror(err)); +#line 1001 return; +#line 1001 } +#line 1001 def_dims(ncid); +#line 1001 def_vars(ncid); +#line 1001 err = nc_enddef(ncid); +#line 1001 IF (err) +#line 1001 error("nc_enddef: %s", nc_strerror(err)); +#line 1001 +#line 1001 for (i = 0; i < NVARS; i++) { +#line 1001 canConvert = (var_type[i] == NC_CHAR) == (NCT_INT == NCT_TEXT); +#line 1001 assert(var_rank[i] <= MAX_RANK); +#line 1001 assert(var_nels[i] <= MAX_NELS); +#line 1001 for (j = 0; j < var_rank[i]; j++) { +#line 1001 start[j] = 0; +#line 1001 edge[j] = 1; +#line 1001 stride[j] = 1; +#line 1001 imap[j] = 1; +#line 1001 } +#line 1001 err = nc_put_varm_int(BAD_ID, i, start, edge, stride, imap, value); +#line 1001 IF (err != NC_EBADID) +#line 1001 error("bad ncid: status = %d", err); +#line 1001 err = nc_put_varm_int(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 1001 IF (err != NC_ENOTVAR) +#line 1001 error("bad var id: status = %d", err); +#line 1001 for (j = 0; j < var_rank[i]; j++) { +#line 1001 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 1001 start[j] = var_shape[i][j] + 1; +#line 1001 err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value); +#line 1001 if (!canConvert) { +#line 1001 IF(err != NC_ECHAR) +#line 1001 error("conversion: status = %d", err); +#line 1001 } else { +#line 1001 IF (err != NC_EINVALCOORDS) +#line 1001 error("bad start: status = %d", err); +#line 1001 start[j] = 0; +#line 1001 edge[j] = var_shape[i][j] + 1; +#line 1001 err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value); +#line 1001 IF (err != NC_EEDGE) +#line 1001 error("bad edge: status = %d", err); +#line 1001 edge[j] = 1; +#line 1001 stride[j] = 0; +#line 1001 err = nc_put_varm_int(ncid, i, start, edge, stride, imap, value); +#line 1001 IF (err != NC_ESTRIDE) +#line 1001 error("bad stride: status = %d", err); +#line 1001 stride[j] = 1; +#line 1001 } +#line 1001 } +#line 1001 } +#line 1001 /* Choose a random point dividing each dim into 2 parts */ +#line 1001 /* Put 2^rank (nslabs) slabs so defined */ +#line 1001 nslabs = 1; +#line 1001 for (j = 0; j < var_rank[i]; j++) { +#line 1001 mid[j] = roll( var_shape[i][j] ); +#line 1001 nslabs *= 2; +#line 1001 } +#line 1001 /* bits of k determine whether to put lower or upper part of dim */ +#line 1001 /* choose random stride from 1 to edge */ +#line 1001 for (k = 0; k < nslabs; k++) { +#line 1001 nstarts = 1; +#line 1001 for (j = 0; j < var_rank[i]; j++) { +#line 1001 if ((k >> j) & 1) { +#line 1001 start[j] = 0; +#line 1001 edge[j] = mid[j]; +#line 1001 }else{ +#line 1001 start[j] = mid[j]; +#line 1001 edge[j] = var_shape[i][j] - mid[j]; +#line 1001 } +#line 1001 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 1001 nstarts *= stride[j]; +#line 1001 } +#line 1001 for (m = 0; m < nstarts; m++) { +#line 1001 err = toMixedBase(m, var_rank[i], sstride, index); +#line 1001 IF (err) +#line 1001 error("error in toMixedBase"); +#line 1001 nels = 1; +#line 1001 for (j = 0; j < var_rank[i]; j++) { +#line 1001 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 1001 nels *= count[j]; +#line 1001 index[j] += start[j]; +#line 1001 } +#line 1001 /* Random choice of forward or backward */ +#line 1001 /* TODO +#line 1001 if ( roll(2) ) { +#line 1001 for (j = 0; j < var_rank[i]; j++) { +#line 1001 index[j] += (count[j] - 1) * stride[j]; +#line 1001 stride[j] = -stride[j]; +#line 1001 } +#line 1001 } +#line 1001 */ +#line 1001 if (var_rank[i] > 0) { +#line 1001 j = var_rank[i] - 1; +#line 1001 imap[j] = 1; +#line 1001 for (; j > 0; j--) +#line 1001 imap[j-1] = imap[j] * count[j]; +#line 1001 } +#line 1001 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 1001 err = toMixedBase(j, var_rank[i], count, index2); +#line 1001 IF (err) +#line 1001 error("error in toMixedBase"); +#line 1001 for (d = 0; d < var_rank[i]; d++) +#line 1001 index2[d] = index[d] + index2[d] * stride[d]; +#line 1001 value[j] = hash_int(var_type[i], var_rank[i], index2, +#line 1001 NCT_INT); +#line 1001 allInExtRange = allInExtRange +#line 1001 && inRange3(value[j], var_type[i], NCT_INT); +#line 1001 } +#line 1001 if (var_rank[i] == 0 && i%2 == 0) +#line 1001 err = nc_put_varm_int(ncid,i,NULL,NULL,NULL,NULL,value); +#line 1001 else +#line 1001 err = nc_put_varm_int(ncid,i,index,count,stride,imap,value); +#line 1001 if (canConvert) { +#line 1001 if (allInExtRange) { +#line 1001 IF (err) +#line 1001 error("%s", nc_strerror(err)); +#line 1001 } else { +#line 1001 IF (err != NC_ERANGE) +#line 1001 error("range error: status = %d", err); +#line 1001 } +#line 1001 } else { +#line 1001 IF (nels > 0 && err != NC_ECHAR) +#line 1001 error("wrong type: status = %d", err); +#line 1001 } +#line 1001 } +#line 1001 } +#line 1001 } +#line 1001 +#line 1001 err = nc_close(ncid); +#line 1001 IF (err) +#line 1001 error("nc_close: %s", nc_strerror(err)); +#line 1001 +#line 1001 check_vars_int(scratch); +#line 1001 +#line 1001 err = remove(scratch); +#line 1001 IF (err) +#line 1001 error("remove of %s failed", scratch); +#line 1001 } +#line 1001 void +#line 1002 test_nc_put_varm_long(void) +#line 1002 { +#line 1002 int ncid; +#line 1002 int d; +#line 1002 int i; +#line 1002 int j; +#line 1002 int k; +#line 1002 int m; +#line 1002 int err; +#line 1002 int nels; +#line 1002 int nslabs; +#line 1002 int nstarts; /* number of different starts */ +#line 1002 size_t start[MAX_RANK]; +#line 1002 size_t edge[MAX_RANK]; +#line 1002 size_t index[MAX_RANK]; +#line 1002 size_t index2[MAX_RANK]; +#line 1002 size_t mid[MAX_RANK]; +#line 1002 size_t count[MAX_RANK]; +#line 1002 size_t sstride[MAX_RANK]; +#line 1002 ptrdiff_t stride[MAX_RANK]; +#line 1002 ptrdiff_t imap[MAX_RANK]; +#line 1002 int canConvert; /* Both text or both numeric */ +#line 1002 int allInExtRange; /* all values within external range? */ +#line 1002 long value[MAX_NELS]; +#line 1002 +#line 1002 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 1002 IF (err) { +#line 1002 error("nc_create: %s", nc_strerror(err)); +#line 1002 return; +#line 1002 } +#line 1002 def_dims(ncid); +#line 1002 def_vars(ncid); +#line 1002 err = nc_enddef(ncid); +#line 1002 IF (err) +#line 1002 error("nc_enddef: %s", nc_strerror(err)); +#line 1002 +#line 1002 for (i = 0; i < NVARS; i++) { +#line 1002 canConvert = (var_type[i] == NC_CHAR) == (NCT_LONG == NCT_TEXT); +#line 1002 assert(var_rank[i] <= MAX_RANK); +#line 1002 assert(var_nels[i] <= MAX_NELS); +#line 1002 for (j = 0; j < var_rank[i]; j++) { +#line 1002 start[j] = 0; +#line 1002 edge[j] = 1; +#line 1002 stride[j] = 1; +#line 1002 imap[j] = 1; +#line 1002 } +#line 1002 err = nc_put_varm_long(BAD_ID, i, start, edge, stride, imap, value); +#line 1002 IF (err != NC_EBADID) +#line 1002 error("bad ncid: status = %d", err); +#line 1002 err = nc_put_varm_long(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 1002 IF (err != NC_ENOTVAR) +#line 1002 error("bad var id: status = %d", err); +#line 1002 for (j = 0; j < var_rank[i]; j++) { +#line 1002 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 1002 start[j] = var_shape[i][j] + 1; +#line 1002 err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value); +#line 1002 if (!canConvert) { +#line 1002 IF(err != NC_ECHAR) +#line 1002 error("conversion: status = %d", err); +#line 1002 } else { +#line 1002 IF (err != NC_EINVALCOORDS) +#line 1002 error("bad start: status = %d", err); +#line 1002 start[j] = 0; +#line 1002 edge[j] = var_shape[i][j] + 1; +#line 1002 err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value); +#line 1002 IF (err != NC_EEDGE) +#line 1002 error("bad edge: status = %d", err); +#line 1002 edge[j] = 1; +#line 1002 stride[j] = 0; +#line 1002 err = nc_put_varm_long(ncid, i, start, edge, stride, imap, value); +#line 1002 IF (err != NC_ESTRIDE) +#line 1002 error("bad stride: status = %d", err); +#line 1002 stride[j] = 1; +#line 1002 } +#line 1002 } +#line 1002 } +#line 1002 /* Choose a random point dividing each dim into 2 parts */ +#line 1002 /* Put 2^rank (nslabs) slabs so defined */ +#line 1002 nslabs = 1; +#line 1002 for (j = 0; j < var_rank[i]; j++) { +#line 1002 mid[j] = roll( var_shape[i][j] ); +#line 1002 nslabs *= 2; +#line 1002 } +#line 1002 /* bits of k determine whether to put lower or upper part of dim */ +#line 1002 /* choose random stride from 1 to edge */ +#line 1002 for (k = 0; k < nslabs; k++) { +#line 1002 nstarts = 1; +#line 1002 for (j = 0; j < var_rank[i]; j++) { +#line 1002 if ((k >> j) & 1) { +#line 1002 start[j] = 0; +#line 1002 edge[j] = mid[j]; +#line 1002 }else{ +#line 1002 start[j] = mid[j]; +#line 1002 edge[j] = var_shape[i][j] - mid[j]; +#line 1002 } +#line 1002 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 1002 nstarts *= stride[j]; +#line 1002 } +#line 1002 for (m = 0; m < nstarts; m++) { +#line 1002 err = toMixedBase(m, var_rank[i], sstride, index); +#line 1002 IF (err) +#line 1002 error("error in toMixedBase"); +#line 1002 nels = 1; +#line 1002 for (j = 0; j < var_rank[i]; j++) { +#line 1002 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 1002 nels *= count[j]; +#line 1002 index[j] += start[j]; +#line 1002 } +#line 1002 /* Random choice of forward or backward */ +#line 1002 /* TODO +#line 1002 if ( roll(2) ) { +#line 1002 for (j = 0; j < var_rank[i]; j++) { +#line 1002 index[j] += (count[j] - 1) * stride[j]; +#line 1002 stride[j] = -stride[j]; +#line 1002 } +#line 1002 } +#line 1002 */ +#line 1002 if (var_rank[i] > 0) { +#line 1002 j = var_rank[i] - 1; +#line 1002 imap[j] = 1; +#line 1002 for (; j > 0; j--) +#line 1002 imap[j-1] = imap[j] * count[j]; +#line 1002 } +#line 1002 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 1002 err = toMixedBase(j, var_rank[i], count, index2); +#line 1002 IF (err) +#line 1002 error("error in toMixedBase"); +#line 1002 for (d = 0; d < var_rank[i]; d++) +#line 1002 index2[d] = index[d] + index2[d] * stride[d]; +#line 1002 value[j] = hash_long(var_type[i], var_rank[i], index2, +#line 1002 NCT_LONG); +#line 1002 allInExtRange = allInExtRange +#line 1002 && inRange3(value[j], var_type[i], NCT_LONG); +#line 1002 } +#line 1002 if (var_rank[i] == 0 && i%2 == 0) +#line 1002 err = nc_put_varm_long(ncid,i,NULL,NULL,NULL,NULL,value); +#line 1002 else +#line 1002 err = nc_put_varm_long(ncid,i,index,count,stride,imap,value); +#line 1002 if (canConvert) { +#line 1002 if (allInExtRange) { +#line 1002 IF (err) +#line 1002 error("%s", nc_strerror(err)); +#line 1002 } else { +#line 1002 IF (err != NC_ERANGE) +#line 1002 error("range error: status = %d", err); +#line 1002 } +#line 1002 } else { +#line 1002 IF (nels > 0 && err != NC_ECHAR) +#line 1002 error("wrong type: status = %d", err); +#line 1002 } +#line 1002 } +#line 1002 } +#line 1002 } +#line 1002 +#line 1002 err = nc_close(ncid); +#line 1002 IF (err) +#line 1002 error("nc_close: %s", nc_strerror(err)); +#line 1002 +#line 1002 check_vars_long(scratch); +#line 1002 +#line 1002 err = remove(scratch); +#line 1002 IF (err) +#line 1002 error("remove of %s failed", scratch); +#line 1002 } +#line 1002 void +#line 1003 test_nc_put_varm_float(void) +#line 1003 { +#line 1003 int ncid; +#line 1003 int d; +#line 1003 int i; +#line 1003 int j; +#line 1003 int k; +#line 1003 int m; +#line 1003 int err; +#line 1003 int nels; +#line 1003 int nslabs; +#line 1003 int nstarts; /* number of different starts */ +#line 1003 size_t start[MAX_RANK]; +#line 1003 size_t edge[MAX_RANK]; +#line 1003 size_t index[MAX_RANK]; +#line 1003 size_t index2[MAX_RANK]; +#line 1003 size_t mid[MAX_RANK]; +#line 1003 size_t count[MAX_RANK]; +#line 1003 size_t sstride[MAX_RANK]; +#line 1003 ptrdiff_t stride[MAX_RANK]; +#line 1003 ptrdiff_t imap[MAX_RANK]; +#line 1003 int canConvert; /* Both text or both numeric */ +#line 1003 int allInExtRange; /* all values within external range? */ +#line 1003 float value[MAX_NELS]; +#line 1003 +#line 1003 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 1003 IF (err) { +#line 1003 error("nc_create: %s", nc_strerror(err)); +#line 1003 return; +#line 1003 } +#line 1003 def_dims(ncid); +#line 1003 def_vars(ncid); +#line 1003 err = nc_enddef(ncid); +#line 1003 IF (err) +#line 1003 error("nc_enddef: %s", nc_strerror(err)); +#line 1003 +#line 1003 for (i = 0; i < NVARS; i++) { +#line 1003 canConvert = (var_type[i] == NC_CHAR) == (NCT_FLOAT == NCT_TEXT); +#line 1003 assert(var_rank[i] <= MAX_RANK); +#line 1003 assert(var_nels[i] <= MAX_NELS); +#line 1003 for (j = 0; j < var_rank[i]; j++) { +#line 1003 start[j] = 0; +#line 1003 edge[j] = 1; +#line 1003 stride[j] = 1; +#line 1003 imap[j] = 1; +#line 1003 } +#line 1003 err = nc_put_varm_float(BAD_ID, i, start, edge, stride, imap, value); +#line 1003 IF (err != NC_EBADID) +#line 1003 error("bad ncid: status = %d", err); +#line 1003 err = nc_put_varm_float(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 1003 IF (err != NC_ENOTVAR) +#line 1003 error("bad var id: status = %d", err); +#line 1003 for (j = 0; j < var_rank[i]; j++) { +#line 1003 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 1003 start[j] = var_shape[i][j] + 1; +#line 1003 err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value); +#line 1003 if (!canConvert) { +#line 1003 IF(err != NC_ECHAR) +#line 1003 error("conversion: status = %d", err); +#line 1003 } else { +#line 1003 IF (err != NC_EINVALCOORDS) +#line 1003 error("bad start: status = %d", err); +#line 1003 start[j] = 0; +#line 1003 edge[j] = var_shape[i][j] + 1; +#line 1003 err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value); +#line 1003 IF (err != NC_EEDGE) +#line 1003 error("bad edge: status = %d", err); +#line 1003 edge[j] = 1; +#line 1003 stride[j] = 0; +#line 1003 err = nc_put_varm_float(ncid, i, start, edge, stride, imap, value); +#line 1003 IF (err != NC_ESTRIDE) +#line 1003 error("bad stride: status = %d", err); +#line 1003 stride[j] = 1; +#line 1003 } +#line 1003 } +#line 1003 } +#line 1003 /* Choose a random point dividing each dim into 2 parts */ +#line 1003 /* Put 2^rank (nslabs) slabs so defined */ +#line 1003 nslabs = 1; +#line 1003 for (j = 0; j < var_rank[i]; j++) { +#line 1003 mid[j] = roll( var_shape[i][j] ); +#line 1003 nslabs *= 2; +#line 1003 } +#line 1003 /* bits of k determine whether to put lower or upper part of dim */ +#line 1003 /* choose random stride from 1 to edge */ +#line 1003 for (k = 0; k < nslabs; k++) { +#line 1003 nstarts = 1; +#line 1003 for (j = 0; j < var_rank[i]; j++) { +#line 1003 if ((k >> j) & 1) { +#line 1003 start[j] = 0; +#line 1003 edge[j] = mid[j]; +#line 1003 }else{ +#line 1003 start[j] = mid[j]; +#line 1003 edge[j] = var_shape[i][j] - mid[j]; +#line 1003 } +#line 1003 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 1003 nstarts *= stride[j]; +#line 1003 } +#line 1003 for (m = 0; m < nstarts; m++) { +#line 1003 err = toMixedBase(m, var_rank[i], sstride, index); +#line 1003 IF (err) +#line 1003 error("error in toMixedBase"); +#line 1003 nels = 1; +#line 1003 for (j = 0; j < var_rank[i]; j++) { +#line 1003 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 1003 nels *= count[j]; +#line 1003 index[j] += start[j]; +#line 1003 } +#line 1003 /* Random choice of forward or backward */ +#line 1003 /* TODO +#line 1003 if ( roll(2) ) { +#line 1003 for (j = 0; j < var_rank[i]; j++) { +#line 1003 index[j] += (count[j] - 1) * stride[j]; +#line 1003 stride[j] = -stride[j]; +#line 1003 } +#line 1003 } +#line 1003 */ +#line 1003 if (var_rank[i] > 0) { +#line 1003 j = var_rank[i] - 1; +#line 1003 imap[j] = 1; +#line 1003 for (; j > 0; j--) +#line 1003 imap[j-1] = imap[j] * count[j]; +#line 1003 } +#line 1003 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 1003 err = toMixedBase(j, var_rank[i], count, index2); +#line 1003 IF (err) +#line 1003 error("error in toMixedBase"); +#line 1003 for (d = 0; d < var_rank[i]; d++) +#line 1003 index2[d] = index[d] + index2[d] * stride[d]; +#line 1003 value[j] = hash_float(var_type[i], var_rank[i], index2, +#line 1003 NCT_FLOAT); +#line 1003 allInExtRange = allInExtRange +#line 1003 && inRange3(value[j], var_type[i], NCT_FLOAT); +#line 1003 } +#line 1003 if (var_rank[i] == 0 && i%2 == 0) +#line 1003 err = nc_put_varm_float(ncid,i,NULL,NULL,NULL,NULL,value); +#line 1003 else +#line 1003 err = nc_put_varm_float(ncid,i,index,count,stride,imap,value); +#line 1003 if (canConvert) { +#line 1003 if (allInExtRange) { +#line 1003 IF (err) +#line 1003 error("%s", nc_strerror(err)); +#line 1003 } else { +#line 1003 IF (err != NC_ERANGE) +#line 1003 error("range error: status = %d", err); +#line 1003 } +#line 1003 } else { +#line 1003 IF (nels > 0 && err != NC_ECHAR) +#line 1003 error("wrong type: status = %d", err); +#line 1003 } +#line 1003 } +#line 1003 } +#line 1003 } +#line 1003 +#line 1003 err = nc_close(ncid); +#line 1003 IF (err) +#line 1003 error("nc_close: %s", nc_strerror(err)); +#line 1003 +#line 1003 check_vars_float(scratch); +#line 1003 +#line 1003 err = remove(scratch); +#line 1003 IF (err) +#line 1003 error("remove of %s failed", scratch); +#line 1003 } +#line 1003 void +#line 1004 test_nc_put_varm_double(void) +#line 1004 { +#line 1004 int ncid; +#line 1004 int d; +#line 1004 int i; +#line 1004 int j; +#line 1004 int k; +#line 1004 int m; +#line 1004 int err; +#line 1004 int nels; +#line 1004 int nslabs; +#line 1004 int nstarts; /* number of different starts */ +#line 1004 size_t start[MAX_RANK]; +#line 1004 size_t edge[MAX_RANK]; +#line 1004 size_t index[MAX_RANK]; +#line 1004 size_t index2[MAX_RANK]; +#line 1004 size_t mid[MAX_RANK]; +#line 1004 size_t count[MAX_RANK]; +#line 1004 size_t sstride[MAX_RANK]; +#line 1004 ptrdiff_t stride[MAX_RANK]; +#line 1004 ptrdiff_t imap[MAX_RANK]; +#line 1004 int canConvert; /* Both text or both numeric */ +#line 1004 int allInExtRange; /* all values within external range? */ +#line 1004 double value[MAX_NELS]; +#line 1004 +#line 1004 err = nc_create(scratch, NC_CLOBBER, &ncid); +#line 1004 IF (err) { +#line 1004 error("nc_create: %s", nc_strerror(err)); +#line 1004 return; +#line 1004 } +#line 1004 def_dims(ncid); +#line 1004 def_vars(ncid); +#line 1004 err = nc_enddef(ncid); +#line 1004 IF (err) +#line 1004 error("nc_enddef: %s", nc_strerror(err)); +#line 1004 +#line 1004 for (i = 0; i < NVARS; i++) { +#line 1004 canConvert = (var_type[i] == NC_CHAR) == (NCT_DOUBLE == NCT_TEXT); +#line 1004 assert(var_rank[i] <= MAX_RANK); +#line 1004 assert(var_nels[i] <= MAX_NELS); +#line 1004 for (j = 0; j < var_rank[i]; j++) { +#line 1004 start[j] = 0; +#line 1004 edge[j] = 1; +#line 1004 stride[j] = 1; +#line 1004 imap[j] = 1; +#line 1004 } +#line 1004 err = nc_put_varm_double(BAD_ID, i, start, edge, stride, imap, value); +#line 1004 IF (err != NC_EBADID) +#line 1004 error("bad ncid: status = %d", err); +#line 1004 err = nc_put_varm_double(ncid, BAD_VARID, start, edge, stride, imap, value); +#line 1004 IF (err != NC_ENOTVAR) +#line 1004 error("bad var id: status = %d", err); +#line 1004 for (j = 0; j < var_rank[i]; j++) { +#line 1004 if (var_dimid[i][j] > 0) { /* skip record dim */ +#line 1004 start[j] = var_shape[i][j] + 1; +#line 1004 err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value); +#line 1004 if (!canConvert) { +#line 1004 IF(err != NC_ECHAR) +#line 1004 error("conversion: status = %d", err); +#line 1004 } else { +#line 1004 IF (err != NC_EINVALCOORDS) +#line 1004 error("bad start: status = %d", err); +#line 1004 start[j] = 0; +#line 1004 edge[j] = var_shape[i][j] + 1; +#line 1004 err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value); +#line 1004 IF (err != NC_EEDGE) +#line 1004 error("bad edge: status = %d", err); +#line 1004 edge[j] = 1; +#line 1004 stride[j] = 0; +#line 1004 err = nc_put_varm_double(ncid, i, start, edge, stride, imap, value); +#line 1004 IF (err != NC_ESTRIDE) +#line 1004 error("bad stride: status = %d", err); +#line 1004 stride[j] = 1; +#line 1004 } +#line 1004 } +#line 1004 } +#line 1004 /* Choose a random point dividing each dim into 2 parts */ +#line 1004 /* Put 2^rank (nslabs) slabs so defined */ +#line 1004 nslabs = 1; +#line 1004 for (j = 0; j < var_rank[i]; j++) { +#line 1004 mid[j] = roll( var_shape[i][j] ); +#line 1004 nslabs *= 2; +#line 1004 } +#line 1004 /* bits of k determine whether to put lower or upper part of dim */ +#line 1004 /* choose random stride from 1 to edge */ +#line 1004 for (k = 0; k < nslabs; k++) { +#line 1004 nstarts = 1; +#line 1004 for (j = 0; j < var_rank[i]; j++) { +#line 1004 if ((k >> j) & 1) { +#line 1004 start[j] = 0; +#line 1004 edge[j] = mid[j]; +#line 1004 }else{ +#line 1004 start[j] = mid[j]; +#line 1004 edge[j] = var_shape[i][j] - mid[j]; +#line 1004 } +#line 1004 sstride[j] = stride[j] = edge[j] > 0 ? 1+roll(edge[j]) : 1; +#line 1004 nstarts *= stride[j]; +#line 1004 } +#line 1004 for (m = 0; m < nstarts; m++) { +#line 1004 err = toMixedBase(m, var_rank[i], sstride, index); +#line 1004 IF (err) +#line 1004 error("error in toMixedBase"); +#line 1004 nels = 1; +#line 1004 for (j = 0; j < var_rank[i]; j++) { +#line 1004 count[j] = 1 + (edge[j] - index[j] - 1) / stride[j]; +#line 1004 nels *= count[j]; +#line 1004 index[j] += start[j]; +#line 1004 } +#line 1004 /* Random choice of forward or backward */ +#line 1004 /* TODO +#line 1004 if ( roll(2) ) { +#line 1004 for (j = 0; j < var_rank[i]; j++) { +#line 1004 index[j] += (count[j] - 1) * stride[j]; +#line 1004 stride[j] = -stride[j]; +#line 1004 } +#line 1004 } +#line 1004 */ +#line 1004 if (var_rank[i] > 0) { +#line 1004 j = var_rank[i] - 1; +#line 1004 imap[j] = 1; +#line 1004 for (; j > 0; j--) +#line 1004 imap[j-1] = imap[j] * count[j]; +#line 1004 } +#line 1004 for (allInExtRange = 1, j = 0; j < nels; j++) { +#line 1004 err = toMixedBase(j, var_rank[i], count, index2); +#line 1004 IF (err) +#line 1004 error("error in toMixedBase"); +#line 1004 for (d = 0; d < var_rank[i]; d++) +#line 1004 index2[d] = index[d] + index2[d] * stride[d]; +#line 1004 value[j] = hash_double(var_type[i], var_rank[i], index2, +#line 1004 NCT_DOUBLE); +#line 1004 allInExtRange = allInExtRange +#line 1004 && inRange3(value[j], var_type[i], NCT_DOUBLE); +#line 1004 } +#line 1004 if (var_rank[i] == 0 && i%2 == 0) +#line 1004 err = nc_put_varm_double(ncid,i,NULL,NULL,NULL,NULL,value); +#line 1004 else +#line 1004 err = nc_put_varm_double(ncid,i,index,count,stride,imap,value); +#line 1004 if (canConvert) { +#line 1004 if (allInExtRange) { +#line 1004 IF (err) +#line 1004 error("%s", nc_strerror(err)); +#line 1004 } else { +#line 1004 IF (err != NC_ERANGE) +#line 1004 error("range error: status = %d", err); +#line 1004 } +#line 1004 } else { +#line 1004 IF (nels > 0 && err != NC_ECHAR) +#line 1004 error("wrong type: status = %d", err); +#line 1004 } +#line 1004 } +#line 1004 } +#line 1004 } +#line 1004 +#line 1004 err = nc_close(ncid); +#line 1004 IF (err) +#line 1004 error("nc_close: %s", nc_strerror(err)); +#line 1004 +#line 1004 check_vars_double(scratch); +#line 1004 +#line 1004 err = remove(scratch); +#line 1004 IF (err) +#line 1004 error("remove of %s failed", scratch); +#line 1004 } +#line 1004 @@ -6917,446 +13688,881 @@ test_nc_put_att_text(void) } +#line 1135 void +#line 1136 test_nc_put_att_uchar(void) +#line 1136 { +#line 1136 int ncid; +#line 1136 int i; +#line 1136 int j; +#line 1136 size_t k; +#line 1136 int err; +#line 1136 uchar value[MAX_NELS]; +#line 1136 int allInExtRange; /* all values within external range? */ +#line 1136 +#line 1136 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1136 IF (err) { +#line 1136 error("nc_create: %s", nc_strerror(err)); +#line 1136 return; +#line 1136 } +#line 1136 def_dims(ncid); +#line 1136 def_vars(ncid); +#line 1136 +#line 1136 for (i = -1; i < NVARS; i++) { +#line 1136 for (j = 0; j < NATTS(i); j++) { +#line 1136 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1136 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1136 err = nc_put_att_uchar(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1136 ATT_LEN(i,j), value); +#line 1136 IF (err != NC_EBADID) +#line 1136 error("bad ncid: status = %d", err); +#line 1136 err = nc_put_att_uchar(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1136 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1136 IF (err != NC_ENOTVAR) +#line 1136 error("bad var id: status = %d", err); +#line 1136 err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1136 ATT_LEN(i,j), value); +#line 1136 IF (err != NC_EBADTYPE) +#line 1136 error("bad type: status = %d", err); +#line 1136 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1136 value[k] = hash_uchar(ATT_TYPE(i,j), -1, &k, NCT_UCHAR); +#line 1136 allInExtRange = allInExtRange +#line 1136 && inRange3(value[k], ATT_TYPE(i,j), NCT_UCHAR); +#line 1136 } +#line 1136 err = nc_put_att_uchar(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1136 ATT_LEN(i,j), value); +#line 1136 if (allInExtRange) { +#line 1136 IF (err) +#line 1136 error("%s", nc_strerror(err)); +#line 1136 } else { +#line 1136 IF (err != NC_ERANGE) +#line 1136 error("range error: status = %d", err); +#line 1136 } +#line 1136 } +#line 1136 } +#line 1136 } +#line 1136 +#line 1136 check_atts_uchar(ncid); +#line 1136 err = nc_close(ncid); +#line 1136 IF (err) +#line 1136 error("nc_close: %s", nc_strerror(err)); +#line 1136 +#line 1136 err = remove(scratch); +#line 1136 IF (err) +#line 1136 error("remove of %s failed", scratch); +#line 1136 } +#line 1136 void +#line 1137 test_nc_put_att_schar(void) +#line 1137 { +#line 1137 int ncid; +#line 1137 int i; +#line 1137 int j; +#line 1137 size_t k; +#line 1137 int err; +#line 1137 schar value[MAX_NELS]; +#line 1137 int allInExtRange; /* all values within external range? */ +#line 1137 +#line 1137 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1137 IF (err) { +#line 1137 error("nc_create: %s", nc_strerror(err)); +#line 1137 return; +#line 1137 } +#line 1137 def_dims(ncid); +#line 1137 def_vars(ncid); +#line 1137 +#line 1137 for (i = -1; i < NVARS; i++) { +#line 1137 for (j = 0; j < NATTS(i); j++) { +#line 1137 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1137 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1137 err = nc_put_att_schar(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1137 ATT_LEN(i,j), value); +#line 1137 IF (err != NC_EBADID) +#line 1137 error("bad ncid: status = %d", err); +#line 1137 err = nc_put_att_schar(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1137 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1137 IF (err != NC_ENOTVAR) +#line 1137 error("bad var id: status = %d", err); +#line 1137 err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1137 ATT_LEN(i,j), value); +#line 1137 IF (err != NC_EBADTYPE) +#line 1137 error("bad type: status = %d", err); +#line 1137 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1137 value[k] = hash_schar(ATT_TYPE(i,j), -1, &k, NCT_SCHAR); +#line 1137 allInExtRange = allInExtRange +#line 1137 && inRange3(value[k], ATT_TYPE(i,j), NCT_SCHAR); +#line 1137 } +#line 1137 err = nc_put_att_schar(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1137 ATT_LEN(i,j), value); +#line 1137 if (allInExtRange) { +#line 1137 IF (err) +#line 1137 error("%s", nc_strerror(err)); +#line 1137 } else { +#line 1137 IF (err != NC_ERANGE) +#line 1137 error("range error: status = %d", err); +#line 1137 } +#line 1137 } +#line 1137 } +#line 1137 } +#line 1137 +#line 1137 check_atts_schar(ncid); +#line 1137 err = nc_close(ncid); +#line 1137 IF (err) +#line 1137 error("nc_close: %s", nc_strerror(err)); +#line 1137 +#line 1137 err = remove(scratch); +#line 1137 IF (err) +#line 1137 error("remove of %s failed", scratch); +#line 1137 } +#line 1137 void +#line 1138 test_nc_put_att_short(void) +#line 1138 { +#line 1138 int ncid; +#line 1138 int i; +#line 1138 int j; +#line 1138 size_t k; +#line 1138 int err; +#line 1138 short value[MAX_NELS]; +#line 1138 int allInExtRange; /* all values within external range? */ +#line 1138 +#line 1138 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1138 IF (err) { +#line 1138 error("nc_create: %s", nc_strerror(err)); +#line 1138 return; +#line 1138 } +#line 1138 def_dims(ncid); +#line 1138 def_vars(ncid); +#line 1138 +#line 1138 for (i = -1; i < NVARS; i++) { +#line 1138 for (j = 0; j < NATTS(i); j++) { +#line 1138 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1138 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1138 err = nc_put_att_short(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1138 ATT_LEN(i,j), value); +#line 1138 IF (err != NC_EBADID) +#line 1138 error("bad ncid: status = %d", err); +#line 1138 err = nc_put_att_short(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1138 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1138 IF (err != NC_ENOTVAR) +#line 1138 error("bad var id: status = %d", err); +#line 1138 err = nc_put_att_short(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1138 ATT_LEN(i,j), value); +#line 1138 IF (err != NC_EBADTYPE) +#line 1138 error("bad type: status = %d", err); +#line 1138 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1138 value[k] = hash_short(ATT_TYPE(i,j), -1, &k, NCT_SHORT); +#line 1138 allInExtRange = allInExtRange +#line 1138 && inRange3(value[k], ATT_TYPE(i,j), NCT_SHORT); +#line 1138 } +#line 1138 err = nc_put_att_short(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1138 ATT_LEN(i,j), value); +#line 1138 if (allInExtRange) { +#line 1138 IF (err) +#line 1138 error("%s", nc_strerror(err)); +#line 1138 } else { +#line 1138 IF (err != NC_ERANGE) +#line 1138 error("range error: status = %d", err); +#line 1138 } +#line 1138 } +#line 1138 } +#line 1138 } +#line 1138 +#line 1138 check_atts_short(ncid); +#line 1138 err = nc_close(ncid); +#line 1138 IF (err) +#line 1138 error("nc_close: %s", nc_strerror(err)); +#line 1138 +#line 1138 err = remove(scratch); +#line 1138 IF (err) +#line 1138 error("remove of %s failed", scratch); +#line 1138 } +#line 1138 void +#line 1139 test_nc_put_att_int(void) +#line 1139 { +#line 1139 int ncid; +#line 1139 int i; +#line 1139 int j; +#line 1139 size_t k; +#line 1139 int err; +#line 1139 int value[MAX_NELS]; +#line 1139 int allInExtRange; /* all values within external range? */ +#line 1139 +#line 1139 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1139 IF (err) { +#line 1139 error("nc_create: %s", nc_strerror(err)); +#line 1139 return; +#line 1139 } +#line 1139 def_dims(ncid); +#line 1139 def_vars(ncid); +#line 1139 +#line 1139 for (i = -1; i < NVARS; i++) { +#line 1139 for (j = 0; j < NATTS(i); j++) { +#line 1139 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1139 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1139 err = nc_put_att_int(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1139 ATT_LEN(i,j), value); +#line 1139 IF (err != NC_EBADID) +#line 1139 error("bad ncid: status = %d", err); +#line 1139 err = nc_put_att_int(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1139 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1139 IF (err != NC_ENOTVAR) +#line 1139 error("bad var id: status = %d", err); +#line 1139 err = nc_put_att_int(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1139 ATT_LEN(i,j), value); +#line 1139 IF (err != NC_EBADTYPE) +#line 1139 error("bad type: status = %d", err); +#line 1139 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1139 value[k] = hash_int(ATT_TYPE(i,j), -1, &k, NCT_INT); +#line 1139 allInExtRange = allInExtRange +#line 1139 && inRange3(value[k], ATT_TYPE(i,j), NCT_INT); +#line 1139 } +#line 1139 err = nc_put_att_int(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1139 ATT_LEN(i,j), value); +#line 1139 if (allInExtRange) { +#line 1139 IF (err) +#line 1139 error("%s", nc_strerror(err)); +#line 1139 } else { +#line 1139 IF (err != NC_ERANGE) +#line 1139 error("range error: status = %d", err); +#line 1139 } +#line 1139 } +#line 1139 } +#line 1139 } +#line 1139 +#line 1139 check_atts_int(ncid); +#line 1139 err = nc_close(ncid); +#line 1139 IF (err) +#line 1139 error("nc_close: %s", nc_strerror(err)); +#line 1139 +#line 1139 err = remove(scratch); +#line 1139 IF (err) +#line 1139 error("remove of %s failed", scratch); +#line 1139 } +#line 1139 void +#line 1140 test_nc_put_att_long(void) +#line 1140 { +#line 1140 int ncid; +#line 1140 int i; +#line 1140 int j; +#line 1140 size_t k; +#line 1140 int err; +#line 1140 long value[MAX_NELS]; +#line 1140 int allInExtRange; /* all values within external range? */ +#line 1140 +#line 1140 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1140 IF (err) { +#line 1140 error("nc_create: %s", nc_strerror(err)); +#line 1140 return; +#line 1140 } +#line 1140 def_dims(ncid); +#line 1140 def_vars(ncid); +#line 1140 +#line 1140 for (i = -1; i < NVARS; i++) { +#line 1140 for (j = 0; j < NATTS(i); j++) { +#line 1140 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1140 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1140 err = nc_put_att_long(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1140 ATT_LEN(i,j), value); +#line 1140 IF (err != NC_EBADID) +#line 1140 error("bad ncid: status = %d", err); +#line 1140 err = nc_put_att_long(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1140 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1140 IF (err != NC_ENOTVAR) +#line 1140 error("bad var id: status = %d", err); +#line 1140 err = nc_put_att_long(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1140 ATT_LEN(i,j), value); +#line 1140 IF (err != NC_EBADTYPE) +#line 1140 error("bad type: status = %d", err); +#line 1140 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1140 value[k] = hash_long(ATT_TYPE(i,j), -1, &k, NCT_LONG); +#line 1140 allInExtRange = allInExtRange +#line 1140 && inRange3(value[k], ATT_TYPE(i,j), NCT_LONG); +#line 1140 } +#line 1140 err = nc_put_att_long(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1140 ATT_LEN(i,j), value); +#line 1140 if (allInExtRange) { +#line 1140 IF (err) +#line 1140 error("%s", nc_strerror(err)); +#line 1140 } else { +#line 1140 IF (err != NC_ERANGE) +#line 1140 error("range error: status = %d", err); +#line 1140 } +#line 1140 } +#line 1140 } +#line 1140 } +#line 1140 +#line 1140 check_atts_long(ncid); +#line 1140 err = nc_close(ncid); +#line 1140 IF (err) +#line 1140 error("nc_close: %s", nc_strerror(err)); +#line 1140 +#line 1140 err = remove(scratch); +#line 1140 IF (err) +#line 1140 error("remove of %s failed", scratch); +#line 1140 } +#line 1140 void +#line 1141 test_nc_put_att_float(void) +#line 1141 { +#line 1141 int ncid; +#line 1141 int i; +#line 1141 int j; +#line 1141 size_t k; +#line 1141 int err; +#line 1141 float value[MAX_NELS]; +#line 1141 int allInExtRange; /* all values within external range? */ +#line 1141 +#line 1141 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1141 IF (err) { +#line 1141 error("nc_create: %s", nc_strerror(err)); +#line 1141 return; +#line 1141 } +#line 1141 def_dims(ncid); +#line 1141 def_vars(ncid); +#line 1141 +#line 1141 for (i = -1; i < NVARS; i++) { +#line 1141 for (j = 0; j < NATTS(i); j++) { +#line 1141 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1141 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1141 err = nc_put_att_float(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1141 ATT_LEN(i,j), value); +#line 1141 IF (err != NC_EBADID) +#line 1141 error("bad ncid: status = %d", err); +#line 1141 err = nc_put_att_float(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1141 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1141 IF (err != NC_ENOTVAR) +#line 1141 error("bad var id: status = %d", err); +#line 1141 err = nc_put_att_float(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1141 ATT_LEN(i,j), value); +#line 1141 IF (err != NC_EBADTYPE) +#line 1141 error("bad type: status = %d", err); +#line 1141 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1141 value[k] = hash_float(ATT_TYPE(i,j), -1, &k, NCT_FLOAT); +#line 1141 allInExtRange = allInExtRange +#line 1141 && inRange3(value[k], ATT_TYPE(i,j), NCT_FLOAT); +#line 1141 } +#line 1141 err = nc_put_att_float(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1141 ATT_LEN(i,j), value); +#line 1141 if (allInExtRange) { +#line 1141 IF (err) +#line 1141 error("%s", nc_strerror(err)); +#line 1141 } else { +#line 1141 IF (err != NC_ERANGE) +#line 1141 error("range error: status = %d", err); +#line 1141 } +#line 1141 } +#line 1141 } +#line 1141 } +#line 1141 +#line 1141 check_atts_float(ncid); +#line 1141 err = nc_close(ncid); +#line 1141 IF (err) +#line 1141 error("nc_close: %s", nc_strerror(err)); +#line 1141 +#line 1141 err = remove(scratch); +#line 1141 IF (err) +#line 1141 error("remove of %s failed", scratch); +#line 1141 } +#line 1141 void +#line 1142 test_nc_put_att_double(void) +#line 1142 { +#line 1142 int ncid; +#line 1142 int i; +#line 1142 int j; +#line 1142 size_t k; +#line 1142 int err; +#line 1142 double value[MAX_NELS]; +#line 1142 int allInExtRange; /* all values within external range? */ +#line 1142 +#line 1142 err = nc_create(scratch, NC_NOCLOBBER, &ncid); +#line 1142 IF (err) { +#line 1142 error("nc_create: %s", nc_strerror(err)); +#line 1142 return; +#line 1142 } +#line 1142 def_dims(ncid); +#line 1142 def_vars(ncid); +#line 1142 +#line 1142 for (i = -1; i < NVARS; i++) { +#line 1142 for (j = 0; j < NATTS(i); j++) { +#line 1142 if (!(ATT_TYPE(i,j) == NC_CHAR)) { +#line 1142 assert(ATT_LEN(i,j) <= MAX_NELS); +#line 1142 err = nc_put_att_double(BAD_ID, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1142 ATT_LEN(i,j), value); +#line 1142 IF (err != NC_EBADID) +#line 1142 error("bad ncid: status = %d", err); +#line 1142 err = nc_put_att_double(ncid, BAD_VARID, ATT_NAME(i,j), +#line 1142 ATT_TYPE(i,j), ATT_LEN(i,j), value); +#line 1142 IF (err != NC_ENOTVAR) +#line 1142 error("bad var id: status = %d", err); +#line 1142 err = nc_put_att_double(ncid, i, ATT_NAME(i,j), BAD_TYPE, +#line 1142 ATT_LEN(i,j), value); +#line 1142 IF (err != NC_EBADTYPE) +#line 1142 error("bad type: status = %d", err); +#line 1142 for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) { +#line 1142 value[k] = hash_double(ATT_TYPE(i,j), -1, &k, NCT_DOUBLE); +#line 1142 allInExtRange = allInExtRange +#line 1142 && inRange3(value[k], ATT_TYPE(i,j), NCT_DOUBLE); +#line 1142 } +#line 1142 err = nc_put_att_double(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), +#line 1142 ATT_LEN(i,j), value); +#line 1142 if (allInExtRange) { +#line 1142 IF (err) +#line 1142 error("%s", nc_strerror(err)); +#line 1142 } else { +#line 1142 IF (err != NC_ERANGE) +#line 1142 error("range error: status = %d", err); +#line 1142 } +#line 1142 } +#line 1142 } +#line 1142 } +#line 1142 +#line 1142 check_atts_double(ncid); +#line 1142 err = nc_close(ncid); +#line 1142 IF (err) +#line 1142 error("nc_close: %s", nc_strerror(err)); +#line 1142 +#line 1142 err = remove(scratch); +#line 1142 IF (err) +#line 1142 error("remove of %s failed", scratch); +#line 1142 } +#line 1142 diff --git a/ncgen/ncgentab.c b/ncgen/ncgentab.c index fed41d056..6622e1804 100644 --- a/ncgen/ncgentab.c +++ b/ncgen/ncgentab.c @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,19 +58,23 @@ /* Pull parsers. */ #define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse ncgparse #define yylex ncglex #define yyerror ncgerror +#define yylval ncglval +#define yychar ncgchar #define yydebug ncgdebug #define yynerrs ncgnerrs -#define yylval ncglval -#define yychar ncgchar /* Copy the first part of user declarations. */ -#line 11 "ncgen.y" /* yacc.c:339 */ + +/* Line 268 of yacc.c */ +#line 11 "ncgen.y" /* static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $"; @@ -188,15 +192,14 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl; extern int lex_init(void); -#line 192 "ncgentab.c" /* yacc.c:339 */ -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif +/* Line 268 of yacc.c */ +#line 198 "ncgentab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -206,80 +209,77 @@ extern int lex_init(void); # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "ncgentab.h". */ -#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED -# define YY_NCG_NCGEN_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int ncgdebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif -/* Token type. */ + +/* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - enum yytokentype - { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - IDENT = 270, - TERMSTRING = 271, - CHAR_CONST = 272, - BYTE_CONST = 273, - SHORT_CONST = 274, - INT_CONST = 275, - INT64_CONST = 276, - UBYTE_CONST = 277, - USHORT_CONST = 278, - UINT_CONST = 279, - UINT64_CONST = 280, - FLOAT_CONST = 281, - DOUBLE_CONST = 282, - DIMENSIONS = 283, - VARIABLES = 284, - NETCDF = 285, - DATA = 286, - TYPES = 287, - COMPOUND = 288, - ENUM = 289, - OPAQUE = 290, - OPAQUESTRING = 291, - GROUP = 292, - PATH = 293, - FILLMARKER = 294, - NIL = 295, - _FILLVALUE = 296, - _FORMAT = 297, - _STORAGE = 298, - _CHUNKSIZES = 299, - _DEFLATELEVEL = 300, - _SHUFFLE = 301, - _ENDIANNESS = 302, - _NOFILL = 303, - _FLETCHER32 = 304, - DATASETID = 305 - }; + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NC_UNLIMITED_K = 258, + CHAR_K = 259, + BYTE_K = 260, + SHORT_K = 261, + INT_K = 262, + FLOAT_K = 263, + DOUBLE_K = 264, + UBYTE_K = 265, + USHORT_K = 266, + UINT_K = 267, + INT64_K = 268, + UINT64_K = 269, + IDENT = 270, + TERMSTRING = 271, + CHAR_CONST = 272, + BYTE_CONST = 273, + SHORT_CONST = 274, + INT_CONST = 275, + INT64_CONST = 276, + UBYTE_CONST = 277, + USHORT_CONST = 278, + UINT_CONST = 279, + UINT64_CONST = 280, + FLOAT_CONST = 281, + DOUBLE_CONST = 282, + DIMENSIONS = 283, + VARIABLES = 284, + NETCDF = 285, + DATA = 286, + TYPES = 287, + COMPOUND = 288, + ENUM = 289, + OPAQUE = 290, + OPAQUESTRING = 291, + GROUP = 292, + PATH = 293, + FILLMARKER = 294, + NIL = 295, + _FILLVALUE = 296, + _FORMAT = 297, + _STORAGE = 298, + _CHUNKSIZES = 299, + _DEFLATELEVEL = 300, + _SHUFFLE = 301, + _ENDIANNESS = 302, + _NOFILL = 303, + _FLETCHER32 = 304, + DATASETID = 305 + }; #endif -/* Value type. */ + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE +typedef union YYSTYPE { -#line 131 "ncgen.y" /* yacc.c:355 */ + +/* Line 293 of yacc.c */ +#line 131 "ncgen.y" Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ @@ -288,22 +288,22 @@ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant constant; -#line 292 "ncgentab.c" /* yacc.c:355 */ -}; + + +/* Line 293 of yacc.c */ +#line 295 "ncgentab.c" +} YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -extern YYSTYPE ncglval; - -int ncgparse (void); - -#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */ - /* Copy the second part of user declarations. */ -#line 307 "ncgentab.c" /* yacc.c:358 */ + +/* Line 343 of yacc.c */ +#line 307 "ncgentab.c" #ifdef short # undef short @@ -317,8 +317,11 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#else +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -338,7 +341,8 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -352,48 +356,38 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) #else -# define YY_INITIAL_VALUE(Value) Value +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; #endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END +{ + return yyi; +} #endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - #if ! defined yyoverflow || YYERROR_VERBOSE @@ -412,9 +406,9 @@ typedef short int yytype_int16; # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -424,8 +418,8 @@ typedef short int yytype_int16; # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -441,7 +435,7 @@ typedef short int yytype_int16; # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -449,13 +443,15 @@ typedef short int yytype_int16; # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -465,7 +461,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -490,35 +486,35 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do +/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -534,19 +530,17 @@ union yyalloc #define YYNNTS 67 /* YYNRULES -- Number of rules. */ #define YYNRULES 150 -/* YYNSTATES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 251 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 305 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -583,7 +577,79 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 7, 9, 14, 20, 21, 24, 25, + 26, 36, 37, 39, 42, 44, 47, 49, 51, 54, + 57, 60, 63, 66, 67, 69, 76, 78, 82, 86, + 92, 98, 104, 107, 111, 114, 116, 118, 120, 122, + 124, 126, 128, 130, 132, 134, 136, 137, 139, 142, + 145, 149, 151, 153, 155, 159, 163, 167, 171, 175, + 177, 178, 180, 183, 186, 190, 192, 194, 197, 199, + 203, 206, 207, 211, 213, 217, 219, 221, 225, 228, + 229, 233, 235, 239, 241, 243, 245, 247, 249, 251, + 252, 256, 261, 268, 274, 280, 287, 293, 299, 305, + 311, 317, 323, 329, 334, 336, 338, 339, 341, 344, + 347, 351, 355, 357, 359, 360, 362, 366, 368, 372, + 374, 376, 378, 380, 382, 384, 386, 391, 393, 397, + 399, 401, 403, 405, 407, 409, 411, 413, 415, 417, + 419, 421, 423, 427, 429, 431, 433, 435, 437, 439, + 441 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 61, 0, -1, 30, 62, 63, -1, 50, -1, 51, + 64, 65, 52, -1, 107, 69, 84, 90, 110, -1, + -1, 65, 66, -1, -1, -1, 37, 126, 51, 67, + 64, 65, 68, 52, 107, -1, -1, 32, -1, 32, + 70, -1, 72, -1, 70, 72, -1, 126, -1, 73, + -1, 108, 53, -1, 75, 74, -1, 80, 74, -1, + 79, 74, -1, 78, 74, -1, -1, 53, -1, 83, + 34, 71, 51, 76, 52, -1, 77, -1, 76, 54, + 77, -1, 126, 55, 123, -1, 35, 56, 20, 57, + 71, -1, 105, 56, 58, 57, 71, -1, 33, 71, + 51, 81, 52, -1, 82, 53, -1, 81, 82, 53, + -1, 105, 99, -1, 4, -1, 5, -1, 6, -1, + 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, + 12, -1, 13, -1, 14, -1, -1, 28, -1, 28, + 85, -1, 86, 53, -1, 85, 86, 53, -1, 87, + -1, 108, -1, 88, -1, 87, 54, 88, -1, 89, + 55, 24, -1, 89, 55, 20, -1, 89, 55, 27, + -1, 89, 55, 3, -1, 126, -1, -1, 29, -1, + 29, 91, -1, 92, 53, -1, 91, 92, 53, -1, + 93, -1, 108, -1, 105, 94, -1, 95, -1, 94, + 54, 95, -1, 126, 96, -1, -1, 56, 97, 57, + -1, 98, -1, 97, 54, 98, -1, 109, -1, 100, + -1, 99, 54, 100, -1, 126, 101, -1, -1, 56, + 102, 57, -1, 103, -1, 102, 54, 103, -1, 24, + -1, 20, -1, 106, -1, 106, -1, 109, -1, 83, + -1, -1, 108, 53, 107, -1, 59, 126, 55, 113, + -1, 105, 106, 59, 126, 55, 113, -1, 106, 59, + 126, 55, 113, -1, 106, 59, 41, 55, 113, -1, + 105, 106, 59, 41, 55, 113, -1, 106, 59, 43, + 55, 124, -1, 106, 59, 44, 55, 122, -1, 106, + 59, 49, 55, 125, -1, 106, 59, 45, 55, 123, + -1, 106, 59, 46, 55, 125, -1, 106, 59, 47, + 55, 124, -1, 106, 59, 48, 55, 125, -1, 59, + 42, 55, 124, -1, 126, -1, 38, -1, -1, 31, + -1, 31, 111, -1, 112, 53, -1, 111, 112, 53, + -1, 104, 55, 113, -1, 114, -1, 115, -1, -1, + 116, -1, 113, 54, 116, -1, 117, -1, 51, 113, + 52, -1, 121, -1, 36, -1, 39, -1, 40, -1, + 118, -1, 119, -1, 109, -1, 126, 56, 120, 57, + -1, 121, -1, 120, 54, 121, -1, 17, -1, 18, + -1, 19, -1, 20, -1, 21, -1, 22, -1, 23, + -1, 24, -1, 25, -1, 26, -1, 27, -1, 16, + -1, 123, -1, 122, 54, 123, -1, 20, -1, 24, + -1, 21, -1, 25, -1, 16, -1, 124, -1, 123, + -1, 15, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 208, 208, 214, 216, 223, 230, 230, 233, 242, @@ -605,7 +671,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -632,13 +698,13 @@ static const char *const yytname[] = "attrdecllist", "attrdecl", "path", "datasection", "datadecls", "datadecl", "datalist", "datalist0", "datalist1", "dataitem", "constdata", "econstref", "function", "arglist", "simpleconstant", - "intlist", "constint", "conststring", "constbool", "ident", YY_NULL + "intlist", "constint", "conststring", "constbool", "ident", 0 }; #endif # ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -650,51 +716,51 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -124 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-124))) - -#define YYTABLE_NINF -105 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = { - -17, -16, 44, -124, 3, -124, 213, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -6, -124, -124, 329, -4, 36, 25, -124, -124, - 27, 50, 0, 31, 15, 157, 63, 213, 83, 281, - 92, -124, -124, -3, 53, 54, 56, 61, 62, 65, - 66, 67, 69, 92, 59, 157, -124, -124, 70, 70, - 70, 70, 84, 225, 72, 213, 97, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, 281, -124, 74, -124, -124, - -124, -124, -124, -124, -124, 73, 81, 79, 85, 281, - 83, 68, 68, 60, 83, 60, 60, 281, 87, -124, - 116, -124, -124, -124, -124, -124, -124, 92, 86, -124, - 213, 93, 91, -124, 94, -124, 99, 213, 108, -26, - 281, 330, -124, 281, 281, 74, -124, -124, -124, -124, - -124, 98, -124, -124, -124, -124, -124, -124, -124, -124, - 74, 329, 90, 104, 100, 95, -124, 92, 19, 213, - 120, -124, 329, -124, 329, -124, -124, -124, -39, -124, - 213, 74, 74, 68, 278, 122, 92, -124, 92, 92, - 92, -124, -124, -124, -124, -124, -124, -124, 123, -124, - 124, -124, 13, 125, -124, 329, 126, 330, -124, -124, - -124, -124, 128, -124, 129, -124, 121, -124, 52, -124, - 130, -124, -124, 92, 2, -124, 281, 133, -124, -124, - 150, -124, 92, 5, -124, -124, 92, 68, -124, 132, - -22, -124, -124, 74, -124, 137, -124, -124, -124, 29, - -124, -124, -124, 2, -124, 213, 5, -124, -124, -124, - -124 + 0, 60, 61, 62, 63, 64, 65, 65, 67, 68, + 66, 69, 69, 69, 70, 70, 71, 72, 72, 73, + 73, 73, 73, 74, 74, 75, 76, 76, 77, 78, + 79, 80, 81, 81, 82, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 84, 84, 84, 85, + 85, 86, 86, 87, 87, 88, 88, 88, 88, 89, + 90, 90, 90, 91, 91, 92, 92, 93, 94, 94, + 95, 96, 96, 97, 97, 98, 99, 99, 100, 101, + 101, 102, 102, 103, 103, 104, 105, 106, 106, 107, + 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 109, 109, 110, 110, 110, 111, + 111, 112, 113, 113, 114, 115, 115, 116, 116, 117, + 117, 117, 117, 117, 117, 118, 119, 120, 120, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 122, 122, 123, 123, 123, 123, 124, 125, 125, + 126 }; - /* 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. */ +/* 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, 3, 3, 1, + 0, 1, 2, 2, 3, 1, 1, 2, 1, 3, + 2, 0, 3, 1, 3, 1, 1, 3, 2, 0, + 3, 1, 3, 1, 1, 1, 1, 1, 1, 0, + 3, 4, 6, 5, 5, 6, 5, 5, 5, 5, + 5, 5, 5, 4, 1, 1, 0, 1, 2, 2, + 3, 3, 1, 1, 0, 1, 3, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 0, 0, 3, 0, 1, 89, 2, 35, 36, @@ -725,19 +791,7 @@ static const yytype_uint8 yydefact[] = 82 }; - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -124, -124, -124, -124, 21, -5, -124, -124, -124, -124, - -124, -107, 142, -124, 35, -124, -124, -28, -124, -124, - -124, -124, 26, -14, -124, -124, 89, -124, 42, -124, - -124, -124, 45, -124, -124, -12, -124, -124, -40, -124, - -15, -124, -124, -41, -124, -24, -21, -37, -8, -32, - -124, -124, 17, -83, -124, -124, 80, -124, -124, -124, - -124, -123, -124, -96, -34, -57, -20 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 2, 4, 7, 22, 32, 42, 170, 235, 36, @@ -749,9 +803,55 @@ static const yytype_int16 yydefgoto[] = 168, 94, 141, 144, 145, 146, 29 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -124 +static const yytype_int16 yypact[] = +{ + -17, -16, 44, -124, 3, -124, 213, -124, -124, -124, + -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, + -124, -6, -124, -124, 329, -4, 36, 25, -124, -124, + 27, 50, 0, 31, 15, 157, 63, 213, 83, 281, + 92, -124, -124, -3, 53, 54, 56, 61, 62, 65, + 66, 67, 69, 92, 59, 157, -124, -124, 70, 70, + 70, 70, 84, 225, 72, 213, 97, -124, -124, -124, + -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, + -124, -124, -124, -124, -124, 281, -124, 74, -124, -124, + -124, -124, -124, -124, -124, 73, 81, 79, 85, 281, + 83, 68, 68, 60, 83, 60, 60, 281, 87, -124, + 116, -124, -124, -124, -124, -124, -124, 92, 86, -124, + 213, 93, 91, -124, 94, -124, 99, 213, 108, -26, + 281, 330, -124, 281, 281, 74, -124, -124, -124, -124, + -124, 98, -124, -124, -124, -124, -124, -124, -124, -124, + 74, 329, 90, 104, 100, 95, -124, 92, 19, 213, + 120, -124, 329, -124, 329, -124, -124, -124, -39, -124, + 213, 74, 74, 68, 278, 122, 92, -124, 92, 92, + 92, -124, -124, -124, -124, -124, -124, -124, 123, -124, + 124, -124, 13, 125, -124, 329, 126, 330, -124, -124, + -124, -124, 128, -124, 129, -124, 121, -124, 52, -124, + 130, -124, -124, 92, 2, -124, 281, 133, -124, -124, + 150, -124, 92, 5, -124, -124, 92, 68, -124, 132, + -22, -124, -124, 74, -124, 137, -124, -124, -124, 29, + -124, -124, -124, 2, -124, 213, 5, -124, -124, -124, + -124 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -124, -124, -124, -124, 21, -5, -124, -124, -124, -124, + -124, -107, 142, -124, 35, -124, -124, -28, -124, -124, + -124, -124, 26, -14, -124, -124, 89, -124, 42, -124, + -124, -124, 45, -124, -124, -12, -124, -124, -40, -124, + -15, -124, -124, -41, -124, -24, -21, -37, -8, -32, + -124, -124, 17, -83, -124, -124, 80, -124, -124, -124, + -124, -123, -124, -96, -34, -57, -20 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -105 static const yytype_int16 yytable[] = { 67, 31, 129, 33, 69, 142, 143, 86, 169, 19, @@ -793,6 +893,12 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 20 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-124)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int16 yycheck[] = { 37, 21, 85, 24, 38, 101, 102, 39, 131, 15, @@ -834,8 +940,8 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, 38 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 30, 61, 50, 62, 0, 51, 63, 4, 5, @@ -866,83 +972,94 @@ static const yytype_uint8 yystos[] = 103 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 60, 61, 62, 63, 64, 65, 65, 67, 68, - 66, 69, 69, 69, 70, 70, 71, 72, 72, 73, - 73, 73, 73, 74, 74, 75, 76, 76, 77, 78, - 79, 80, 81, 81, 82, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 84, 84, 84, 85, - 85, 86, 86, 87, 87, 88, 88, 88, 88, 89, - 90, 90, 90, 91, 91, 92, 92, 93, 94, 94, - 95, 96, 96, 97, 97, 98, 99, 99, 100, 101, - 101, 102, 102, 103, 103, 104, 105, 106, 106, 107, - 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 109, 109, 110, 110, 110, 111, - 111, 112, 113, 113, 114, 115, 115, 116, 116, 117, - 117, 117, 117, 117, 117, 118, 119, 120, 120, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 122, 122, 123, 123, 123, 123, 124, 125, 125, - 126 -}; +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 3, 1, 4, 5, 0, 2, 0, 0, - 9, 0, 1, 2, 1, 2, 1, 1, 2, 2, - 2, 2, 2, 0, 1, 6, 1, 3, 3, 5, - 5, 5, 2, 3, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, 2, 2, - 3, 1, 1, 1, 3, 3, 3, 3, 3, 1, - 0, 1, 2, 2, 3, 1, 1, 2, 1, 3, - 2, 0, 3, 1, 3, 1, 1, 3, 2, 0, - 3, 1, 3, 1, 1, 1, 1, 1, 1, 0, - 3, 4, 6, 5, 5, 6, 5, 5, 5, 5, - 5, 5, 5, 4, 1, 1, 0, 1, 2, 2, - 3, 3, 1, 1, 0, 1, 3, 1, 3, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1 -}; +#define 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 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 + 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 + + +/* This macro is provided for backward compatibility. */ + +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -952,46 +1069,54 @@ while (0) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); # endif - YYUSE (yytype); + switch (yytype) + { + default: + break; + } } @@ -999,11 +1124,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue | Print this symbol on YYOUTPUT. | `--------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -1014,8 +1150,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1026,42 +1170,49 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif { - unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; + unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1075,7 +1226,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1098,8 +1249,15 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1115,8 +1273,16 @@ yystrlen (const char *yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1146,27 +1312,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1189,11 +1355,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1201,6 +1368,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1249,13 +1420,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; } } } @@ -1275,12 +1444,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; if (*yymsg_alloc < yysize) { @@ -1317,20 +1484,48 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif { YYUSE (yyvaluep); + if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END + switch (yytype) + { + + default: + break; + } } +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ @@ -1338,6 +1533,7 @@ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; + /* Number of syntax errors so far. */ int yynerrs; @@ -1346,18 +1542,37 @@ int yynerrs; | yyparse. | `----------*/ +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) +#else +int +yyparse () + +#endif +#endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. + `yyss': related to states. + `yyvs': related to semantic values. - Refer to the stacks through separate pointers, to allow yyoverflow + Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1375,7 +1590,7 @@ yyparse (void) int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1393,8 +1608,9 @@ yyparse (void) Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1403,6 +1619,14 @@ yyparse (void) yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + goto yysetstate; /*------------------------------------------------------------. @@ -1423,23 +1647,23 @@ yyparse (void) #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1447,22 +1671,22 @@ yyparse (void) # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1471,10 +1695,10 @@ yyparse (void) yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1503,7 +1727,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); + yychar = YYLEX; } if (yychar <= YYEOF) @@ -1543,9 +1767,7 @@ yybackup: yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1568,7 +1790,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. + `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1582,84 +1804,95 @@ yyreduce: switch (yyn) { case 2: -#line 211 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 211 "ncgen.y" {if (error_count > 0) YYABORT;} -#line 1588 "ncgentab.c" /* yacc.c:1646 */ break; case 3: -#line 214 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 214 "ncgen.y" {createrootgroup(datasetname);} -#line 1594 "ncgentab.c" /* yacc.c:1646 */ break; case 8: -#line 233 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 233 "ncgen.y" { - Symbol* id = (yyvsp[-1].sym); + Symbol* id = (yyvsp[(2) - (3)].sym); markcdf4("Group specification"); if(creategroup(id) == NULL) yyerror("duplicate group declaration within parent group for %s", id->name); } -#line 1606 "ncgentab.c" /* yacc.c:1646 */ break; case 9: -#line 242 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 242 "ncgen.y" {listpop(groupstack);} -#line 1612 "ncgentab.c" /* yacc.c:1646 */ break; case 12: -#line 248 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 248 "ncgen.y" {} -#line 1618 "ncgentab.c" /* yacc.c:1646 */ break; case 13: -#line 250 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 250 "ncgen.y" {markcdf4("Type specification");} -#line 1624 "ncgentab.c" /* yacc.c:1646 */ break; case 16: -#line 256 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 256 "ncgen.y" { /* Use when defining a type */ - (yyvsp[0].sym)->objectclass = NC_TYPE; - if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym))) + (yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE; + if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym))) yyerror("duplicate type declaration for %s", - (yyvsp[0].sym)->name); - listpush(typdefs,(void*)(yyvsp[0].sym)); + (yyvsp[(1) - (1)].sym)->name); + listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym)); } -#line 1636 "ncgentab.c" /* yacc.c:1646 */ break; case 17: -#line 265 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 265 "ncgen.y" {} -#line 1642 "ncgentab.c" /* yacc.c:1646 */ break; case 18: -#line 265 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 265 "ncgen.y" {} -#line 1648 "ncgentab.c" /* yacc.c:1646 */ break; case 25: -#line 279 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 279 "ncgen.y" { int i; - addtogroup((yyvsp[-3].sym)); /* sets prefix*/ - (yyvsp[-3].sym)->objectclass=NC_TYPE; - (yyvsp[-3].sym)->subclass=NC_ENUM; - (yyvsp[-3].sym)->typ.basetype=(yyvsp[-5].sym); - (yyvsp[-3].sym)->typ.size = (yyvsp[-5].sym)->typ.size; - (yyvsp[-3].sym)->typ.alignment = (yyvsp[-5].sym)->typ.alignment; - stackbase=(yyvsp[-1].mark); + addtogroup((yyvsp[(3) - (6)].sym)); /* sets prefix*/ + (yyvsp[(3) - (6)].sym)->objectclass=NC_TYPE; + (yyvsp[(3) - (6)].sym)->subclass=NC_ENUM; + (yyvsp[(3) - (6)].sym)->typ.basetype=(yyvsp[(1) - (6)].sym); + (yyvsp[(3) - (6)].sym)->typ.size = (yyvsp[(1) - (6)].sym)->typ.size; + (yyvsp[(3) - (6)].sym)->typ.alignment = (yyvsp[(1) - (6)].sym)->typ.alignment; + stackbase=(yyvsp[(5) - (6)].mark); stacklen=listlength(stack); - (yyvsp[-3].sym)->subnodes = listnew(); + (yyvsp[(3) - (6)].sym)->subnodes = listnew(); /* Variety of field fixups*/ /* 1. add in the enum values*/ /* 2. make this type be their container*/ @@ -1669,89 +1902,95 @@ yyreduce: Symbol* eid = (Symbol*)listget(stack,i); assert(eid->subclass == NC_ECONST); addtogroup(eid); - listpush((yyvsp[-3].sym)->subnodes,(void*)eid); - eid->container = (yyvsp[-3].sym); - eid->typ.basetype = (yyvsp[-3].sym)->typ.basetype; + listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid); + eid->container = (yyvsp[(3) - (6)].sym); + eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype; } listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 1679 "ncgentab.c" /* yacc.c:1646 */ break; case 26: -#line 308 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 1685 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 308 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));} break; case 27: -#line 310 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 310 "ncgen.y" { int i; - (yyval.mark)=(yyvsp[-2].mark); + (yyval.mark)=(yyvsp[(1) - (3)].mark); /* check for duplicates*/ - stackbase=(yyvsp[-2].mark); + stackbase=(yyvsp[(1) - (3)].mark); stacklen=listlength(stack); for(i=stackbase;iname,elem->name)==0) + if(strcmp((yyvsp[(3) - (3)].sym)->name,elem->name)==0) yyerror("duplicate enum declaration for %s", elem->name); } - listpush(stack,(void*)(yyvsp[0].sym)); + listpush(stack,(void*)(yyvsp[(3) - (3)].sym)); } -#line 1704 "ncgentab.c" /* yacc.c:1646 */ break; case 28: -#line 327 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 327 "ncgen.y" { - (yyvsp[-2].sym)->objectclass=NC_TYPE; - (yyvsp[-2].sym)->subclass=NC_ECONST; - (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant); - (yyval.sym)=(yyvsp[-2].sym); + (yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE; + (yyvsp[(1) - (3)].sym)->subclass=NC_ECONST; + (yyvsp[(1) - (3)].sym)->typ.econst=(yyvsp[(3) - (3)].constant); + (yyval.sym)=(yyvsp[(1) - (3)].sym); } -#line 1715 "ncgentab.c" /* yacc.c:1646 */ break; case 29: -#line 336 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 336 "ncgen.y" { vercheck(NC_OPAQUE); - addtogroup((yyvsp[0].sym)); /*sets prefix*/ - (yyvsp[0].sym)->objectclass=NC_TYPE; - (yyvsp[0].sym)->subclass=NC_OPAQUE; - (yyvsp[0].sym)->typ.typecode=NC_OPAQUE; - (yyvsp[0].sym)->typ.size=int32_val; - (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_OPAQUE); + addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/ + (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE; + (yyvsp[(5) - (5)].sym)->subclass=NC_OPAQUE; + (yyvsp[(5) - (5)].sym)->typ.typecode=NC_OPAQUE; + (yyvsp[(5) - (5)].sym)->typ.size=int32_val; + (yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_OPAQUE); } -#line 1729 "ncgentab.c" /* yacc.c:1646 */ break; case 30: -#line 348 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 348 "ncgen.y" { - Symbol* basetype = (yyvsp[-4].sym); + Symbol* basetype = (yyvsp[(1) - (5)].sym); vercheck(NC_VLEN); - addtogroup((yyvsp[0].sym)); /*sets prefix*/ - (yyvsp[0].sym)->objectclass=NC_TYPE; - (yyvsp[0].sym)->subclass=NC_VLEN; - (yyvsp[0].sym)->typ.basetype=basetype; - (yyvsp[0].sym)->typ.typecode=NC_VLEN; - (yyvsp[0].sym)->typ.size=VLENSIZE; - (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_VLEN); + addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/ + (yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE; + (yyvsp[(5) - (5)].sym)->subclass=NC_VLEN; + (yyvsp[(5) - (5)].sym)->typ.basetype=basetype; + (yyvsp[(5) - (5)].sym)->typ.typecode=NC_VLEN; + (yyvsp[(5) - (5)].sym)->typ.size=VLENSIZE; + (yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_VLEN); } -#line 1745 "ncgentab.c" /* yacc.c:1646 */ break; case 31: -#line 362 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 362 "ncgen.y" { int i,j; vercheck(NC_COMPOUND); - addtogroup((yyvsp[-3].sym)); + addtogroup((yyvsp[(2) - (5)].sym)); /* check for duplicate field names*/ - stackbase=(yyvsp[-1].mark); + stackbase=(yyvsp[(4) - (5)].mark); stacklen=listlength(stack); for(i=stackbase;iobjectclass=NC_TYPE; - (yyvsp[-3].sym)->subclass=NC_COMPOUND; - (yyvsp[-3].sym)->typ.basetype=NULL; - (yyvsp[-3].sym)->typ.typecode=NC_COMPOUND; - (yyvsp[-3].sym)->subnodes = listnew(); + (yyvsp[(2) - (5)].sym)->objectclass=NC_TYPE; + (yyvsp[(2) - (5)].sym)->subclass=NC_COMPOUND; + (yyvsp[(2) - (5)].sym)->typ.basetype=NULL; + (yyvsp[(2) - (5)].sym)->typ.typecode=NC_COMPOUND; + (yyvsp[(2) - (5)].sym)->subnodes = listnew(); /* Add in the fields*/ for(i=stackbase;icontainer = (yyvsp[-3].sym); - listpush((yyvsp[-3].sym)->subnodes,(void*)fsym); + fsym->container = (yyvsp[(2) - (5)].sym); + listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym); } listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 1779 "ncgentab.c" /* yacc.c:1646 */ break; case 32: -#line 394 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 1785 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 394 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (2)].mark);} break; case 33: -#line 395 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark);} -#line 1791 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 395 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark);} break; case 34: -#line 399 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 399 "ncgen.y" { int i; - (yyval.mark)=(yyvsp[0].mark); - stackbase=(yyvsp[0].mark); + (yyval.mark)=(yyvsp[(2) - (2)].mark); + stackbase=(yyvsp[(2) - (2)].mark); stacklen=listlength(stack); /* process each field in the fieldlist*/ for(i=stackbase;ityp.basetype = (yyvsp[-1].sym); + f->typ.basetype = (yyvsp[(1) - (2)].sym); } } -#line 1807 "ncgentab.c" /* yacc.c:1646 */ break; case 35: -#line 412 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 412 "ncgen.y" { (yyval.sym) = primsymbols[NC_CHAR]; } -#line 1813 "ncgentab.c" /* yacc.c:1646 */ break; case 36: -#line 413 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 413 "ncgen.y" { (yyval.sym) = primsymbols[NC_BYTE]; } -#line 1819 "ncgentab.c" /* yacc.c:1646 */ break; case 37: -#line 414 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 414 "ncgen.y" { (yyval.sym) = primsymbols[NC_SHORT]; } -#line 1825 "ncgentab.c" /* yacc.c:1646 */ break; case 38: -#line 415 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 415 "ncgen.y" { (yyval.sym) = primsymbols[NC_INT]; } -#line 1831 "ncgentab.c" /* yacc.c:1646 */ break; case 39: -#line 416 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 416 "ncgen.y" { (yyval.sym) = primsymbols[NC_FLOAT]; } -#line 1837 "ncgentab.c" /* yacc.c:1646 */ break; case 40: -#line 417 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 417 "ncgen.y" { (yyval.sym) = primsymbols[NC_DOUBLE]; } -#line 1843 "ncgentab.c" /* yacc.c:1646 */ break; case 41: -#line 418 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 418 "ncgen.y" { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } -#line 1849 "ncgentab.c" /* yacc.c:1646 */ break; case 42: -#line 419 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 419 "ncgen.y" { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } -#line 1855 "ncgentab.c" /* yacc.c:1646 */ break; case 43: -#line 420 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 420 "ncgen.y" { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } -#line 1861 "ncgentab.c" /* yacc.c:1646 */ break; case 44: -#line 421 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 421 "ncgen.y" { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } -#line 1867 "ncgentab.c" /* yacc.c:1646 */ break; case 45: -#line 422 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 422 "ncgen.y" { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } -#line 1873 "ncgentab.c" /* yacc.c:1646 */ break; case 47: -#line 426 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 426 "ncgen.y" {} -#line 1879 "ncgentab.c" /* yacc.c:1646 */ break; case 48: -#line 427 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 427 "ncgen.y" {} -#line 1885 "ncgentab.c" /* yacc.c:1646 */ break; case 51: -#line 434 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 434 "ncgen.y" {} -#line 1891 "ncgentab.c" /* yacc.c:1646 */ break; case 52: -#line 434 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 434 "ncgen.y" {} -#line 1897 "ncgentab.c" /* yacc.c:1646 */ break; case 55: -#line 442 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 442 "ncgen.y" { - (yyvsp[-2].sym)->dim.declsize = (size_t)uint32_val; + (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)uint32_val; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize); +fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long)(yyvsp[(1) - (3)].sym)->dim.declsize); #endif } -#line 1908 "ncgentab.c" /* yacc.c:1646 */ break; case 56: -#line 449 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 449 "ncgen.y" { if(int32_val <= 0) { derror("dimension size must be positive"); YYABORT; } - (yyvsp[-2].sym)->dim.declsize = (size_t)int32_val; + (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)int32_val; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize); +fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long)(yyvsp[(1) - (3)].sym)->dim.declsize); #endif } -#line 1923 "ncgentab.c" /* yacc.c:1646 */ break; case 57: -#line 460 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 460 "ncgen.y" { /* for rare case where 2^31 < dimsize < 2^32 */ if (double_val <= 0) yyerror("dimension length must be positive"); @@ -1931,69 +2191,76 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyv yyerror("dimension too large"); if (double_val - (size_t) double_val > 0) yyerror("dimension length must be an integer"); - (yyvsp[-2].sym)->dim.declsize = (size_t)double_val; + (yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)double_val; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize); +fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long)(yyvsp[(1) - (3)].sym)->dim.declsize); #endif } -#line 1940 "ncgentab.c" /* yacc.c:1646 */ break; case 58: -#line 473 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 473 "ncgen.y" { - (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED; - (yyvsp[-2].sym)->dim.isunlimited = 1; + (yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED; + (yyvsp[(1) - (3)].sym)->dim.isunlimited = 1; #ifdef GENDEBUG1 -fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); +fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name); #endif } -#line 1952 "ncgentab.c" /* yacc.c:1646 */ break; case 59: -#line 483 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 483 "ncgen.y" { - (yyvsp[0].sym)->objectclass=NC_DIM; - if(dupobjectcheck(NC_DIM,(yyvsp[0].sym))) + (yyvsp[(1) - (1)].sym)->objectclass=NC_DIM; + if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym))) yyerror( "Duplicate dimension declaration for %s", - (yyvsp[0].sym)->name); - addtogroup((yyvsp[0].sym)); - (yyval.sym)=(yyvsp[0].sym); - listpush(dimdefs,(void*)(yyvsp[0].sym)); + (yyvsp[(1) - (1)].sym)->name); + addtogroup((yyvsp[(1) - (1)].sym)); + (yyval.sym)=(yyvsp[(1) - (1)].sym); + listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym)); } -#line 1966 "ncgentab.c" /* yacc.c:1646 */ break; case 61: -#line 495 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 495 "ncgen.y" {} -#line 1972 "ncgentab.c" /* yacc.c:1646 */ break; case 62: -#line 496 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 496 "ncgen.y" {} -#line 1978 "ncgentab.c" /* yacc.c:1646 */ break; case 65: -#line 503 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 503 "ncgen.y" {} -#line 1984 "ncgentab.c" /* yacc.c:1646 */ break; case 66: -#line 503 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 503 "ncgen.y" {} -#line 1990 "ncgentab.c" /* yacc.c:1646 */ break; case 67: -#line 506 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 506 "ncgen.y" { int i; - stackbase=(yyvsp[0].mark); + stackbase=(yyvsp[(2) - (2)].mark); stacklen=listlength(stack); /* process each variable in the varlist*/ for(i=stackbase;iname); yyerror("Duplicate variable declaration for %s", sym->name); } else { - sym->typ.basetype = (yyvsp[-1].sym); + sym->typ.basetype = (yyvsp[(1) - (2)].sym); addtogroup(sym); listpush(vardefs,(void*)sym); } } listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 2014 "ncgentab.c" /* yacc.c:1646 */ break; case 68: -#line 528 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 528 "ncgen.y" {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[0].sym)); + listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); } -#line 2022 "ncgentab.c" /* yacc.c:1646 */ break; case 69: -#line 532 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2028 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 532 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 70: -#line 536 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 536 "ncgen.y" { int i; Dimset dimset; stacklen=listlength(stack); - stackbase=(yyvsp[0].mark); + stackbase=(yyvsp[(2) - (2)].mark); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2047,78 +2317,86 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); Symbol* dsym = (Symbol*)listget(stack,stackbase+i); dimset.dimsyms[i] = dsym; } - (yyvsp[-1].sym)->typ.dimset = dimset; + (yyvsp[(1) - (2)].sym)->typ.dimset = dimset; } - (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/ - (yyvsp[-1].sym)->objectclass=NC_VAR; + (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/ + (yyvsp[(1) - (2)].sym)->objectclass=NC_VAR; listsetlength(stack,stackbase);/* remove stack nodes*/ } -#line 2057 "ncgentab.c" /* yacc.c:1646 */ break; case 71: -#line 562 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 562 "ncgen.y" {(yyval.mark)=listlength(stack);} -#line 2063 "ncgentab.c" /* yacc.c:1646 */ break; case 72: -#line 563 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 2069 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 563 "ncgen.y" + {(yyval.mark)=(yyvsp[(2) - (3)].mark);} break; case 73: -#line 566 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2075 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 566 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));} break; case 74: -#line 568 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2081 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 568 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 75: -#line 572 "ncgen.y" /* yacc.c:1646 */ - {Symbol* dimsym = (yyvsp[0].sym); + +/* Line 1806 of yacc.c */ +#line 572 "ncgen.y" + {Symbol* dimsym = (yyvsp[(1) - (1)].sym); dimsym->objectclass = NC_DIM; /* Find the actual dimension*/ dimsym = locate(dimsym); if(dimsym == NULL) { - derror("Undefined or forward referenced dimension: %s",(yyvsp[0].sym)->name); + derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name); YYABORT; } (yyval.sym)=dimsym; } -#line 2096 "ncgentab.c" /* yacc.c:1646 */ break; case 76: -#line 586 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 586 "ncgen.y" {(yyval.mark)=listlength(stack); - listpush(stack,(void*)(yyvsp[0].sym)); + listpush(stack,(void*)(yyvsp[(1) - (1)].sym)); } -#line 2104 "ncgentab.c" /* yacc.c:1646 */ break; case 77: -#line 590 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2110 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 590 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 78: -#line 595 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 595 "ncgen.y" { int i; Dimset dimset; - stackbase=(yyvsp[0].mark); + stackbase=(yyvsp[(2) - (2)].mark); stacklen=listlength(stack); count = stacklen - stackbase; if(count >= NC_MAX_VAR_DIMS) { - yyerror("%s has too many dimensions",(yyvsp[-1].sym)->name); + yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name); count = NC_MAX_VAR_DIMS - 1; stacklen = stackbase + count; } @@ -2129,43 +2407,48 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); Symbol* dsym = (Symbol*)listget(stack,stackbase+i); dimset.dimsyms[i] = dsym; } - (yyvsp[-1].sym)->typ.dimset = dimset; + (yyvsp[(1) - (2)].sym)->typ.dimset = dimset; } - (yyvsp[-1].sym)->typ.basetype = NULL; /* not yet known*/ - (yyvsp[-1].sym)->objectclass=NC_TYPE; - (yyvsp[-1].sym)->subclass=NC_FIELD; + (yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/ + (yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE; + (yyvsp[(1) - (2)].sym)->subclass=NC_FIELD; listsetlength(stack,stackbase);/* remove stack nodes*/ - (yyval.sym) = (yyvsp[-1].sym); + (yyval.sym) = (yyvsp[(1) - (2)].sym); } -#line 2141 "ncgentab.c" /* yacc.c:1646 */ break; case 79: -#line 623 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 623 "ncgen.y" {(yyval.mark)=listlength(stack);} -#line 2147 "ncgentab.c" /* yacc.c:1646 */ break; case 80: -#line 624 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-1].mark);} -#line 2153 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 624 "ncgen.y" + {(yyval.mark)=(yyvsp[(2) - (3)].mark);} break; case 81: -#line 628 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2159 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 628 "ncgen.y" + {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));} break; case 82: -#line 630 "ncgen.y" /* yacc.c:1646 */ - {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} -#line 2165 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 630 "ncgen.y" + {(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));} break; case 83: -#line 635 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 635 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2175,11 +2458,12 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = uint32_val; } -#line 2179 "ncgentab.c" /* yacc.c:1646 */ break; case 84: -#line 645 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 645 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2193,36 +2477,39 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); (yyval.sym)->dim.isconstant = 1; (yyval.sym)->dim.declsize = int32_val; } -#line 2197 "ncgentab.c" /* yacc.c:1646 */ break; case 85: -#line 665 "ncgen.y" /* yacc.c:1646 */ - {Symbol* vsym = (yyvsp[0].sym); + +/* Line 1806 of yacc.c */ +#line 665 "ncgen.y" + {Symbol* vsym = (yyvsp[(1) - (1)].sym); if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); YYABORT; } (yyval.sym)=vsym; } -#line 2209 "ncgentab.c" /* yacc.c:1646 */ break; case 86: -#line 676 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tsym = (yyvsp[0].sym); + +/* Line 1806 of yacc.c */ +#line 676 "ncgen.y" + {Symbol* tsym = (yyvsp[(1) - (1)].sym); if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); YYABORT; } (yyval.sym)=tsym; } -#line 2221 "ncgentab.c" /* yacc.c:1646 */ break; case 87: -#line 687 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; + +/* Line 1806 of yacc.c */ +#line 687 "ncgen.y" + {Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym; /* disambiguate*/ tvsym->objectclass = NC_VAR; sym = locate(tvsym); @@ -2230,401 +2517,461 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); tvsym->objectclass = NC_TYPE; sym = locate(tvsym); if(tvsym == NULL) { - derror("Undefined or forward referenced name: %s",(yyvsp[0].sym)->name); + derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name); YYABORT; } else tvsym = sym; } else tvsym = sym; if(tvsym == NULL) { - derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name); + derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name); YYABORT; } (yyval.sym)=tvsym; } -#line 2244 "ncgentab.c" /* yacc.c:1646 */ break; case 88: -#line 705 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2250 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 705 "ncgen.y" + {(yyval.sym)=(yyvsp[(1) - (1)].sym);} break; case 89: -#line 712 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 712 "ncgen.y" {} -#line 2256 "ncgentab.c" /* yacc.c:1646 */ break; case 90: -#line 712 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 712 "ncgen.y" {} -#line 2262 "ncgentab.c" /* yacc.c:1646 */ break; case 91: -#line 716 "ncgen.y" /* yacc.c:1646 */ - { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} -#line 2268 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 716 "ncgen.y" + { (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);} break; case 92: -#line 718 "ncgen.y" /* yacc.c:1646 */ - {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); + +/* Line 1806 of yacc.c */ +#line 718 "ncgen.y" + {Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym); if(vsym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR); } else { derror("Doubly typed attribute: %s",asym->name); YYABORT; } } -#line 2281 "ncgentab.c" /* yacc.c:1646 */ break; case 93: -#line 727 "ncgen.y" /* yacc.c:1646 */ - {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); + +/* Line 1806 of yacc.c */ +#line 727 "ncgen.y" + {Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym); if(sym->objectclass == NC_VAR) { - (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR); + (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR); } else if(sym->objectclass == NC_TYPE) { - (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[0].datalist),ATTRGLOBAL); + (yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL); } else { derror("Attribute prefix not a variable or type: %s",asym->name); YYABORT; } } -#line 2296 "ncgentab.c" /* yacc.c:1646 */ break; case 94: -#line 738 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);} -#line 2302 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 738 "ncgen.y" + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);} break; case 95: -#line 740 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);} -#line 2308 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 740 "ncgen.y" + {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),0);} break; case 96: -#line 742 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} -#line 2314 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 742 "ncgen.y" + {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 97: -#line 744 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);} -#line 2320 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 744 "ncgen.y" + {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);} break; case 98: -#line 746 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} -#line 2326 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 746 "ncgen.y" + {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 99: -#line 748 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} -#line 2332 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 748 "ncgen.y" + {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 100: -#line 750 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} -#line 2338 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 750 "ncgen.y" + {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 101: -#line 752 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} -#line 2344 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 752 "ncgen.y" + {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 102: -#line 754 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);} -#line 2350 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 754 "ncgen.y" + {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);} break; case 103: -#line 756 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);} -#line 2356 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 756 "ncgen.y" + {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),1);} break; case 104: -#line 761 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 761 "ncgen.y" { - (yyval.sym)=(yyvsp[0].sym); - (yyvsp[0].sym)->ref.is_ref=1; - (yyvsp[0].sym)->is_prefixed=0; - setpathcurrent((yyvsp[0].sym)); + (yyval.sym)=(yyvsp[(1) - (1)].sym); + (yyvsp[(1) - (1)].sym)->ref.is_ref=1; + (yyvsp[(1) - (1)].sym)->is_prefixed=0; + setpathcurrent((yyvsp[(1) - (1)].sym)); } -#line 2367 "ncgentab.c" /* yacc.c:1646 */ break; case 105: -#line 768 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 768 "ncgen.y" { - (yyval.sym)=(yyvsp[0].sym); - (yyvsp[0].sym)->ref.is_ref=1; - (yyvsp[0].sym)->is_prefixed=1; + (yyval.sym)=(yyvsp[(1) - (1)].sym); + (yyvsp[(1) - (1)].sym)->ref.is_ref=1; + (yyvsp[(1) - (1)].sym)->is_prefixed=1; /* path is set in ncgen.l*/ } -#line 2378 "ncgentab.c" /* yacc.c:1646 */ break; case 107: -#line 777 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 777 "ncgen.y" {} -#line 2384 "ncgentab.c" /* yacc.c:1646 */ break; case 108: -#line 778 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 778 "ncgen.y" {} -#line 2390 "ncgentab.c" /* yacc.c:1646 */ break; case 111: -#line 786 "ncgen.y" /* yacc.c:1646 */ - {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} -#line 2396 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 786 "ncgen.y" + {(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);} break; case 112: -#line 789 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = (yyvsp[0].datalist);} -#line 2402 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 789 "ncgen.y" + {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);} break; case 113: -#line 790 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = (yyvsp[0].datalist);} -#line 2408 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 790 "ncgen.y" + {(yyval.datalist) = (yyvsp[(1) - (1)].datalist);} break; case 114: -#line 794 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 794 "ncgen.y" {(yyval.datalist) = builddatalist(0);} -#line 2414 "ncgentab.c" /* yacc.c:1646 */ break; case 115: -#line 798 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));} -#line 2420 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 798 "ncgen.y" + {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));} break; case 116: -#line 800 "ncgen.y" /* yacc.c:1646 */ - {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} -#line 2426 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 800 "ncgen.y" + {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);} break; case 117: -#line 804 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2432 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 804 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 118: -#line 805 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} -#line 2438 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 805 "ncgen.y" + {(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));} break; case 119: -#line 809 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2444 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 809 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 120: -#line 810 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 810 "ncgen.y" {(yyval.constant)=makeconstdata(NC_OPAQUE);} -#line 2450 "ncgentab.c" /* yacc.c:1646 */ break; case 121: -#line 811 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 811 "ncgen.y" {(yyval.constant)=makeconstdata(NC_FILLVALUE);} -#line 2456 "ncgentab.c" /* yacc.c:1646 */ break; case 122: -#line 812 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 812 "ncgen.y" {(yyval.constant)=makeconstdata(NC_NIL);} -#line 2462 "ncgentab.c" /* yacc.c:1646 */ break; case 123: -#line 813 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2468 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 813 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 125: -#line 818 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} -#line 2474 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 818 "ncgen.y" + {(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));} break; case 126: -#line 822 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} -#line 2480 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 822 "ncgen.y" + {(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));} break; case 127: -#line 827 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));} -#line 2486 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 827 "ncgen.y" + {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));} break; case 128: -#line 829 "ncgen.y" /* yacc.c:1646 */ - {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} -#line 2492 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 829 "ncgen.y" + {datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);} break; case 129: -#line 833 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 833 "ncgen.y" {(yyval.constant)=makeconstdata(NC_CHAR);} -#line 2498 "ncgentab.c" /* yacc.c:1646 */ break; case 130: -#line 834 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 834 "ncgen.y" {(yyval.constant)=makeconstdata(NC_BYTE);} -#line 2504 "ncgentab.c" /* yacc.c:1646 */ break; case 131: -#line 835 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 835 "ncgen.y" {(yyval.constant)=makeconstdata(NC_SHORT);} -#line 2510 "ncgentab.c" /* yacc.c:1646 */ break; case 132: -#line 836 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 836 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT);} -#line 2516 "ncgentab.c" /* yacc.c:1646 */ break; case 133: -#line 837 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 837 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT64);} -#line 2522 "ncgentab.c" /* yacc.c:1646 */ break; case 134: -#line 838 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 838 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UBYTE);} -#line 2528 "ncgentab.c" /* yacc.c:1646 */ break; case 135: -#line 839 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 839 "ncgen.y" {(yyval.constant)=makeconstdata(NC_USHORT);} -#line 2534 "ncgentab.c" /* yacc.c:1646 */ break; case 136: -#line 840 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 840 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT);} -#line 2540 "ncgentab.c" /* yacc.c:1646 */ break; case 137: -#line 841 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 841 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT64);} -#line 2546 "ncgentab.c" /* yacc.c:1646 */ break; case 138: -#line 842 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 842 "ncgen.y" {(yyval.constant)=makeconstdata(NC_FLOAT);} -#line 2552 "ncgentab.c" /* yacc.c:1646 */ break; case 139: -#line 843 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 843 "ncgen.y" {(yyval.constant)=makeconstdata(NC_DOUBLE);} -#line 2558 "ncgentab.c" /* yacc.c:1646 */ break; case 140: -#line 844 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 844 "ncgen.y" {(yyval.constant)=makeconstdata(NC_STRING);} -#line 2564 "ncgentab.c" /* yacc.c:1646 */ break; case 141: -#line 848 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));} -#line 2570 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 848 "ncgen.y" + {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));} break; case 142: -#line 849 "ncgen.y" /* yacc.c:1646 */ - {(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));} -#line 2576 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 849 "ncgen.y" + {(yyval.datalist)=(yyvsp[(1) - (3)].datalist); datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant)));} break; case 143: -#line 854 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 854 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT);} -#line 2582 "ncgentab.c" /* yacc.c:1646 */ break; case 144: -#line 856 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 856 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT);} -#line 2588 "ncgentab.c" /* yacc.c:1646 */ break; case 145: -#line 858 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 858 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT64);} -#line 2594 "ncgentab.c" /* yacc.c:1646 */ break; case 146: -#line 860 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 860 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT64);} -#line 2600 "ncgentab.c" /* yacc.c:1646 */ break; case 147: -#line 864 "ncgen.y" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 864 "ncgen.y" {(yyval.constant)=makeconstdata(NC_STRING);} -#line 2606 "ncgentab.c" /* yacc.c:1646 */ break; case 148: -#line 868 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2612 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 868 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 149: -#line 869 "ncgen.y" /* yacc.c:1646 */ - {(yyval.constant)=(yyvsp[0].constant);} -#line 2618 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 869 "ncgen.y" + {(yyval.constant)=(yyvsp[(1) - (1)].constant);} break; case 150: -#line 875 "ncgen.y" /* yacc.c:1646 */ - {(yyval.sym)=(yyvsp[0].sym);} -#line 2624 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 875 "ncgen.y" + {(yyval.sym)=(yyvsp[(1) - (1)].sym);} break; -#line 2628 "ncgentab.c" /* yacc.c:1646 */ + +/* Line 1806 of yacc.c */ +#line 2975 "ncgentab.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2646,7 +2993,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); *++yyvsp = yyval; - /* Now 'shift' the result of the reduction. Determine what state + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2661,9 +3008,9 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); goto yynewstate; -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -2714,20 +3061,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -2746,7 +3093,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule whose action triggered + /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2759,37 +3106,35 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2813,7 +3158,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2832,14 +3177,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } - /* Do not reclaim the symbols of the rule whose action triggered + /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2850,9 +3195,14 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - return yyresult; + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 878 "ncgen.y" /* yacc.c:1906 */ + + + +/* Line 2067 of yacc.c */ +#line 878 "ncgen.y" #ifndef NO_STDARG @@ -3256,19 +3606,19 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) } attr = makeattribute(install("_FillValue"),vsym,tsym,list,ATTRVAR); } else switch (tag) { - // These will be output as attributes later - case _STORAGE_FLAG: - if(!sdata) - derror("_Storage: illegal NULL value"); - else if(strcmp(sdata,"contiguous") == 0) - special->_Storage = NC_CONTIGUOUS; - else if(strcmp(sdata,"chunked") == 0) - special->_Storage = NC_CHUNKED; - else - derror("_Storage: illegal value: %s",sdata); - special->flags |= _STORAGE_FLAG; - break; - case _FLETCHER32_FLAG: + // These will be output as attributes later + case _STORAGE_FLAG: + if(!sdata) + derror("_Storage: illegal NULL value"); + else if(strcmp(sdata,"contiguous") == 0) + special->_Storage = NC_CONTIGUOUS; + else if(strcmp(sdata,"chunked") == 0) + special->_Storage = NC_CHUNKED; + else + derror("_Storage: illegal value: %s",sdata); + special->flags |= _STORAGE_FLAG; + break; + case _FLETCHER32_FLAG: special->_Fletcher32 = tf; special->flags |= _FLETCHER32_FLAG; break; @@ -3282,7 +3632,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst) break; case _ENDIAN_FLAG: if(!sdata) - derror("_Endianness: NULL value."); + derror("_Endianness: illegal NULL value"); else if(strcmp(sdata,"little") == 0) special->_Endianness = 1; else if(strcmp(sdata,"big") == 0) @@ -3462,3 +3812,4 @@ evaluate(Symbol* fcn, Datalist* arglist) done: return result; } + diff --git a/ncgen/ncgentab.h b/ncgen/ncgentab.h index 0b93cdc3e..09bc5fa3e 100644 --- a/ncgen/ncgentab.h +++ b/ncgen/ncgentab.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,82 +26,76 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED -# define YY_NCG_NCGEN_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int ncgdebug; -#endif -/* Token type. */ +/* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - enum yytokentype - { - NC_UNLIMITED_K = 258, - CHAR_K = 259, - BYTE_K = 260, - SHORT_K = 261, - INT_K = 262, - FLOAT_K = 263, - DOUBLE_K = 264, - UBYTE_K = 265, - USHORT_K = 266, - UINT_K = 267, - INT64_K = 268, - UINT64_K = 269, - IDENT = 270, - TERMSTRING = 271, - CHAR_CONST = 272, - BYTE_CONST = 273, - SHORT_CONST = 274, - INT_CONST = 275, - INT64_CONST = 276, - UBYTE_CONST = 277, - USHORT_CONST = 278, - UINT_CONST = 279, - UINT64_CONST = 280, - FLOAT_CONST = 281, - DOUBLE_CONST = 282, - DIMENSIONS = 283, - VARIABLES = 284, - NETCDF = 285, - DATA = 286, - TYPES = 287, - COMPOUND = 288, - ENUM = 289, - OPAQUE = 290, - OPAQUESTRING = 291, - GROUP = 292, - PATH = 293, - FILLMARKER = 294, - NIL = 295, - _FILLVALUE = 296, - _FORMAT = 297, - _STORAGE = 298, - _CHUNKSIZES = 299, - _DEFLATELEVEL = 300, - _SHUFFLE = 301, - _ENDIANNESS = 302, - _NOFILL = 303, - _FLETCHER32 = 304, - DATASETID = 305 - }; + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NC_UNLIMITED_K = 258, + CHAR_K = 259, + BYTE_K = 260, + SHORT_K = 261, + INT_K = 262, + FLOAT_K = 263, + DOUBLE_K = 264, + UBYTE_K = 265, + USHORT_K = 266, + UINT_K = 267, + INT64_K = 268, + UINT64_K = 269, + IDENT = 270, + TERMSTRING = 271, + CHAR_CONST = 272, + BYTE_CONST = 273, + SHORT_CONST = 274, + INT_CONST = 275, + INT64_CONST = 276, + UBYTE_CONST = 277, + USHORT_CONST = 278, + UINT_CONST = 279, + UINT64_CONST = 280, + FLOAT_CONST = 281, + DOUBLE_CONST = 282, + DIMENSIONS = 283, + VARIABLES = 284, + NETCDF = 285, + DATA = 286, + TYPES = 287, + COMPOUND = 288, + ENUM = 289, + OPAQUE = 290, + OPAQUESTRING = 291, + GROUP = 292, + PATH = 293, + FILLMARKER = 294, + NIL = 295, + _FILLVALUE = 296, + _FORMAT = 297, + _STORAGE = 298, + _CHUNKSIZES = 299, + _DEFLATELEVEL = 300, + _SHUFFLE = 301, + _ENDIANNESS = 302, + _NOFILL = 303, + _FLETCHER32 = 304, + DATASETID = 305 + }; #endif -/* Value type. */ + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE +typedef union YYSTYPE { -#line 131 "ncgen.y" /* yacc.c:1909 */ + +/* Line 2068 of yacc.c */ +#line 131 "ncgen.y" Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ @@ -110,15 +104,16 @@ int nctype; /* for tracking attribute list type*/ Datalist* datalist; NCConstant constant; -#line 114 "ncgentab.h" /* yacc.c:1909 */ -}; + + +/* Line 2068 of yacc.c */ +#line 111 "ncgentab.h" +} YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif - extern YYSTYPE ncglval; -int ncgparse (void); -#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */