mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-06 18:00:24 +08:00
Merge remote-tracking branch 'origin/gh1233.dmh' into pr-aggregation.wif
This commit is contained in:
commit
c62d7eb541
@ -1,5 +1,6 @@
|
||||
This directory contains various scripts for debugging by Dennis
|
||||
Heimbigner @ Unidata.
|
||||
DO NOT DELETE.
|
||||
USE AT YOUR OWN PERIL.
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ NCLIB="${NCLIB}/build/liblib"
|
||||
#G="-GUnix Makefiles"
|
||||
#T="--trace-expand"
|
||||
cmake "${G}" $FLAGS ..
|
||||
if test "x$NOBUILD" == x ; then
|
||||
if test "x$NOBUILD" = x ; then
|
||||
make all
|
||||
make test
|
||||
fi
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Copyright 2018-2018 University Corporation for Atmospheric
|
||||
Research/Unidata. */
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @internal Contains information for creating provenance
|
||||
|
@ -16,7 +16,7 @@ CREATE3=tst_inmemory3_create
|
||||
FILE4=tst_inmemory4
|
||||
CREATE4=tst_inmemory4_create
|
||||
|
||||
# For tst_open_mem
|
||||
# For tst_open_mem NETCDF4 only
|
||||
OMEMFILE=f03tst_open_mem.nc
|
||||
|
||||
echo ""
|
||||
@ -26,8 +26,9 @@ HASHDF5=`${top_builddir}/nc-config --has-hdf5`
|
||||
|
||||
# Execute the core of the inmemory tests
|
||||
${execdir}/tst_inmemory
|
||||
exit
|
||||
if test "x$HASNC4" = xyes ; then
|
||||
${execdir}/tst_open_mem ${srcdir}/${OMEMFILE}
|
||||
fi
|
||||
|
||||
echo "**** Test ncdump of the resulting inmemory data"
|
||||
${NCDUMP} -n "${FILE3}" ${FILE3}.nc > ${FILE3}.cdl
|
||||
@ -36,8 +37,9 @@ diff -wb ${FILE3}.cdl ${CREATE3}.cdl
|
||||
|
||||
if test "x$HASHDF5" = "xyes" ; then
|
||||
${NCDUMP} ${FILE4}.nc > ${FILE4}.cdl
|
||||
${NCDUMP} ${CREATE4}.nc > ${CREATE4}.cdl
|
||||
${NCDUMP} -n ${FILE4} ${CREATE4}.nc > ${CREATE4}.cdl
|
||||
diff -wb ${FILE4}.cdl ${CREATE4}.cdl
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
rm -f ${FILE3}.nc ${FILE4}.nc ${CREATE3}.nc ${CREATE4}.nc
|
||||
|
@ -61,8 +61,8 @@ extern int H5Eprint1(FILE * stream);
|
||||
|
||||
#define NVARS0 3 /* # variables in define_metadata */
|
||||
#define VAR0_NAME "nightlife"
|
||||
#define VAR1_NAME "time"
|
||||
#define VAR2_NAME "taxi_distance"
|
||||
#define VAR1_NAME "taxi_distance"
|
||||
#define VAR2_NAME "time"
|
||||
|
||||
/* Variable added by modify_file */
|
||||
#define VAR3_NAME "miles"
|
||||
@ -270,19 +270,19 @@ define_metadata(int ncid)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
int dimid[MAXDIMS], varid0, varid1, varid2;
|
||||
short short_data[DIM1_LEN];
|
||||
size_t start[1] = {0};
|
||||
size_t count[1] = {DIM1_LEN};
|
||||
int dimprod = (DIM0_LEN*DIM1_LEN);
|
||||
int i;
|
||||
float float_data;
|
||||
int nightdata[DIM0_LEN*DIM1_LEN] ;
|
||||
short taxi_distance[DIM1_LEN] ;
|
||||
|
||||
/* Create data to write */
|
||||
float_data = FLOATVAL;
|
||||
|
||||
for (i = 0; i < DIM1_LEN; i++)
|
||||
short_data[i] = i;
|
||||
taxi_distance[i] = i;
|
||||
|
||||
for (i = 0; i < dimprod; i++)
|
||||
nightdata[i] = (100*i);
|
||||
@ -294,13 +294,13 @@ define_metadata(int ncid)
|
||||
CHECK(nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimid[1]));
|
||||
|
||||
CHECK(nc_def_var(ncid, VAR0_NAME, NC_INT, 2, dimid, &varid0));
|
||||
CHECK(nc_def_var(ncid, VAR1_NAME, NC_FLOAT, 0, NULL, &varid1));
|
||||
CHECK(nc_def_var(ncid, VAR2_NAME, NC_SHORT, 1, &dimid[1], &varid2));
|
||||
CHECK(nc_def_var(ncid, VAR1_NAME, NC_SHORT, 1, &dimid[1], &varid1));
|
||||
CHECK(nc_def_var(ncid, VAR2_NAME, NC_FLOAT, 0, NULL, &varid2));
|
||||
|
||||
CHECK(nc_enddef(ncid));
|
||||
|
||||
CHECK(nc_put_vara_float(ncid, varid1, NULL, NULL, &float_data));
|
||||
CHECK(nc_put_vara_short(ncid, varid2, start, count, short_data));
|
||||
CHECK(nc_put_vara_short(ncid, varid1, start, count, taxi_distance));
|
||||
CHECK(nc_put_var_float(ncid, varid2, &float_data));
|
||||
|
||||
{
|
||||
size_t start[2] = {0,0};
|
||||
@ -407,6 +407,7 @@ verify_file(int ncid, int modified, int extra)
|
||||
float float_data_in;
|
||||
int milesdata_in[MAXDIMLEN];
|
||||
int expenses_in[MAXDIMLEN];
|
||||
short taxi_distance_in[MAXDIMLEN];
|
||||
int dimprod = DIM0_LEN * DIM1_LEN;
|
||||
#ifdef USE_HDF5
|
||||
int tmp;
|
||||
@ -456,18 +457,23 @@ verify_file(int ncid, int modified, int extra)
|
||||
if (strcmp(name_in, VAR0_NAME) || type_in != NC_INT || ndims_in != NDIMS0 ||
|
||||
dimid_in[0] != 0 || dimid_in[1] != 1 || natts_in != 0) CHECK(NC_EINVAL);
|
||||
CHECK(nc_inq_var(ncid, varid[1], name_in, &type_in, &ndims_in, dimid_in, &natts_in));
|
||||
if (strcmp(name_in, VAR1_NAME) || type_in != NC_FLOAT || ndims_in != 0 ||
|
||||
natts_in != 0) CHECK(NC_EINVAL);
|
||||
if (strcmp(name_in, VAR1_NAME) || type_in != NC_SHORT || ndims_in != 1 || dimid_in[0] != 1 || natts_in != 0)
|
||||
CHECK(NC_EINVAL);
|
||||
CHECK(nc_inq_var(ncid, varid[2], name_in, &type_in, &ndims_in, dimid_in, &natts_in));
|
||||
if (strcmp(name_in, VAR2_NAME) || type_in != NC_SHORT || ndims_in != 1 ||
|
||||
dimid_in[0] != 1 || natts_in != 0) CHECK(NC_EINVAL);
|
||||
if (strcmp(name_in, VAR2_NAME) || type_in != NC_FLOAT || ndims_in != 0 || natts_in != 0)
|
||||
CHECK(NC_EINVAL);
|
||||
|
||||
CHECK(nc_get_var_int(ncid, varid[0], nightdata_in));
|
||||
for(i=0;i<dimprod;i++) {
|
||||
if(nightdata_in[i] != (100*i)) CHECK(NC_EINVAL);
|
||||
}
|
||||
|
||||
CHECK(nc_get_vara_float(ncid, varid[1], NULL, NULL, &float_data_in));
|
||||
CHECK(nc_get_var_short(ncid, varid[1], taxi_distance_in));
|
||||
for(i=0;i<DIM1_LEN;i++) {
|
||||
if(taxi_distance_in[i] != (i)) CHECK(NC_EINVAL);
|
||||
}
|
||||
|
||||
CHECK(nc_get_var_float(ncid, varid[2], &float_data_in));
|
||||
if (float_data_in != FLOATVAL) CHECK(NC_EINVAL);
|
||||
|
||||
if(modified) {
|
||||
|
@ -42,8 +42,12 @@ readfile(const char* path, NC_memio* memio)
|
||||
#else
|
||||
f = fopen(path,"r");
|
||||
#endif
|
||||
if(f == NULL)
|
||||
{status = errno; goto done;}
|
||||
if(f == NULL) {
|
||||
fprintf(stderr,"cannot open file: %s\n",path);
|
||||
fflush(stderr);
|
||||
status = errno;
|
||||
goto done;
|
||||
}
|
||||
/* get current filesize */
|
||||
if(fseek(f,0,SEEK_END) < 0)
|
||||
{status = errno; goto done;}
|
||||
@ -67,6 +71,7 @@ readfile(const char* path, NC_memio* memio)
|
||||
if(memio) {
|
||||
memio->size = (size_t)filesize;
|
||||
memio->memory = memory;
|
||||
memory = NULL;
|
||||
}
|
||||
done:
|
||||
if(status != NC_NOERR && memory != NULL)
|
||||
@ -93,6 +98,8 @@ main(int argc, char** argv)
|
||||
goto exit;
|
||||
if((retval = nc_close(ncid)))
|
||||
goto exit;
|
||||
if(mem.memory)
|
||||
free(mem.memory);
|
||||
return 0;
|
||||
exit:
|
||||
fprintf(stderr,"retval=%d\n",retval);
|
||||
|
@ -431,13 +431,15 @@ Internal equivalent of ncaux_reclaim_data.
|
||||
/* It is helpful to have a structure that contains memory and an offset */
|
||||
typedef struct Reclaim {char* memory; ptrdiff_t offset;} Reclaim;
|
||||
|
||||
static ptrdiff_t read_alignment(ptrdiff_t offset, unsigned long alignment);
|
||||
static int bin_reclaim_datar(Symbol* tsym, Reclaim* reclaim);
|
||||
#ifdef USE_NETCDF4
|
||||
static ptrdiff_t read_alignment(ptrdiff_t offset, unsigned long alignment);
|
||||
static int bin_reclaim_usertype(Symbol* tsym, Reclaim* reclaim);
|
||||
static int bin_reclaim_compound(Symbol* tsym, Reclaim* reclaim);
|
||||
static int bin_reclaim_vlen(Symbol* tsym, Reclaim* reclaim);
|
||||
static int bin_reclaim_enum(Symbol* tsym, Reclaim* reclaim);
|
||||
static int bin_reclaim_opaque(Symbol* tsym, Reclaim* reclaim);
|
||||
#endif
|
||||
|
||||
int
|
||||
binary_reclaim_data(Symbol* tsym, void* memory, size_t count)
|
||||
@ -493,6 +495,7 @@ bin_reclaim_datar(Symbol* tsym, Reclaim* reclaimer)
|
||||
return stat;
|
||||
}
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
static int
|
||||
bin_reclaim_usertype(Symbol* tsym, Reclaim* reclaimer)
|
||||
{
|
||||
@ -587,6 +590,7 @@ bin_reclaim_compound(Symbol* tsym, Reclaim* reclaimer)
|
||||
done:
|
||||
return stat;
|
||||
}
|
||||
#endif /*USE_NETCDF4*/
|
||||
|
||||
#endif /*ENABLE_BINARY*/
|
||||
|
||||
|
868
ncgen/ncgenl.c
868
ncgen/ncgenl.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user