mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-24 18:30:51 +08:00
ckp
This commit is contained in:
parent
a8ff523677
commit
764a1c40a3
@ -320,6 +320,7 @@ typedef struct NCcommon {
|
||||
extern size_t NC_atomictypelen(nc_type xtype);
|
||||
extern char* NC_atomictypename(nc_type xtype);
|
||||
|
||||
#ifdef OBSOLETE
|
||||
/* Provide a dispatch table overlay facility */
|
||||
extern int NC_dispatch_overlay(const NC_Dispatch* overlay,
|
||||
const NC_Dispatch* base,
|
||||
@ -328,6 +329,7 @@ extern int NC_dispatch_overlay(const NC_Dispatch* overlay,
|
||||
/* Get/set the override dispatch table */
|
||||
extern NC_Dispatch* NC_get_dispatch_override(void);
|
||||
extern void NC_set_dispatch_override(NC_Dispatch*);
|
||||
#endif
|
||||
|
||||
/* Does the path look like a url? */
|
||||
extern int NC_testurl(const char* path);
|
||||
@ -367,6 +369,15 @@ extern int NC_inq_recvar(int ncid, int varid, int* nrecdims, int* is_recdim);
|
||||
|
||||
#define nullstring(s) (s==NULL?"(null)":s)
|
||||
|
||||
|
||||
#undef TRACECALLS
|
||||
#ifdef TRACECALLS
|
||||
#include <stdio.h>
|
||||
#define TRACE(fname) fprintf(stderr,"call: %s\n",#fname)
|
||||
#else
|
||||
#define TRACE(fname)
|
||||
#endif
|
||||
|
||||
extern size_t NC_coord_zero[NC_MAX_VAR_DIMS];
|
||||
extern size_t NC_coord_one[NC_MAX_VAR_DIMS];
|
||||
|
||||
@ -376,12 +387,22 @@ extern int NC_initialized;
|
||||
|
||||
NCD_EXTERNL int nc_initialize();
|
||||
|
||||
|
||||
/**
|
||||
Certain functions are in the dispatch table,
|
||||
but not in the netcdf.h API. These need to
|
||||
be exposed for use in delegation such as
|
||||
in libdap2.
|
||||
*/
|
||||
extern int
|
||||
NC_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
NCDISPATCH_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
int *ndimsp, int *dimidsp, int *nattsp,
|
||||
int *shufflep, int *deflatep, int *deflate_levelp,
|
||||
int *fletcher32p, int *contiguousp, size_t *chunksizesp,
|
||||
int *no_fill, void *fill_valuep, int *endiannessp,
|
||||
int *options_maskp, int *pixels_per_blockp);
|
||||
|
||||
extern int
|
||||
NCDISPATCH_get_att(int ncid, int varid, const char* name, void* value, nc_type t);
|
||||
|
||||
#endif /* _DISPATCH_H */
|
||||
|
@ -26,12 +26,12 @@
|
||||
#endif
|
||||
|
||||
#undef PARSEDEBUG
|
||||
/* Warning: setting CATCHERROR has significant performance impact */
|
||||
#define CATCHERROR
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* Warning: setting CATCHERROR has significant performance impact */
|
||||
#define CATCHERROR
|
||||
#ifdef DAPDEBUG
|
||||
#undef CATCHERROR
|
||||
#define CATCHERROR
|
||||
|
@ -341,7 +341,7 @@ extern int nc__opendap(void);
|
||||
#define NCD2_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data))
|
||||
|
||||
#define getncid(drno) (((NC*)drno)->ext_ncid)
|
||||
#define getdap(drno) ((NCDAPCOMMON*)((NC*)drno)->dispatch)
|
||||
#define getdap(drno) ((NCDAPCOMMON*)((NC*)drno)->dispatchdata)
|
||||
#define getnc3id(drno) (getdap(drno)->nc3id)
|
||||
|
||||
#endif /*NCCOMMON_H*/
|
||||
|
@ -300,6 +300,7 @@ NCD2_open(const char * path, int mode,
|
||||
OCerror ocstat = OC_NOERR;
|
||||
NCDAPCOMMON* dapcomm = NULL;
|
||||
const char* value;
|
||||
int nc3id = -1;
|
||||
|
||||
if(path == NULL)
|
||||
return NC_EDAPURL;
|
||||
@ -366,7 +367,7 @@ NCD2_open(const char * path, int mode,
|
||||
}
|
||||
}
|
||||
|
||||
/* Use libsrc code for storing metadata */
|
||||
/* Use libsrc code (netcdf-3) for storing metadata */
|
||||
{
|
||||
char tmpname[32];
|
||||
|
||||
@ -376,12 +377,13 @@ NCD2_open(const char * path, int mode,
|
||||
snprintf(tmpname,sizeof(tmpname),"%d",drno->int_ncid);
|
||||
|
||||
/* Now, use the file to create the netcdf file; force classic. */
|
||||
ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&getnc3id(drno));
|
||||
ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&nc3id);
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
}
|
||||
dapcomm->nc3id = nc3id;
|
||||
/* Avoid fill */
|
||||
nc_set_fill(nc3id,NC_NOFILL,NULL);
|
||||
|
||||
/* Avoid fill */
|
||||
nc_set_fill(getnc3id(drno),NC_NOFILL,NULL);
|
||||
}
|
||||
|
||||
dapcomm->oc.dapconstraint = (DCEconstraint*)dcecreate(CES_CONSTRAINT);
|
||||
dapcomm->oc.dapconstraint->projections = nclistnew();
|
||||
@ -512,7 +514,7 @@ fprintf(stderr,"constrained dds: %s\n",dumptree(dapcomm->cdf.ddsroot));
|
||||
if(ncstat) goto done;
|
||||
|
||||
/* Process the constraints to map to the constrained CDF tree */
|
||||
/* (must follow fixgrids3 */
|
||||
/* (must follow fixgrids3) */
|
||||
ncstat = dapmapconstraints(dapcomm->oc.dapconstraint,dapcomm->cdf.ddsroot);
|
||||
if(ncstat != NC_NOERR) goto done;
|
||||
|
||||
@ -554,31 +556,27 @@ fprintf(stderr,"ncdap3: final constraint: %s\n",dapcomm->oc.url->constraint);
|
||||
about variables that are too large.
|
||||
*/
|
||||
#if 0
|
||||
ncstat = nc_endef(getnc3id(drno),NC_NOFILL,NULL);
|
||||
ncstat = nc_endef(nc3id,NC_NOFILL,NULL);
|
||||
if(ncstat != NC_NOERR && ncstat != NC_EVARSIZE)
|
||||
{THROWCHK(ncstat); goto done;}
|
||||
#endif
|
||||
|
||||
{
|
||||
NC* ncsub;
|
||||
NC* drno = dapcomm->controller;
|
||||
CDFnode* unlimited = dapcomm->cdf.recorddim;
|
||||
/* (for now) break abstractions*/
|
||||
NC3_INFO* nc3i;
|
||||
|
||||
/* get the id for the substrate */
|
||||
ncstat = NC_check_id(getnc3id(drno),&ncsub);
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
nc3i = (NC3_INFO*)ncsub->dispatchdata;
|
||||
|
||||
if(unlimited != NULL) {
|
||||
/* Set the effective size of UNLIMITED */
|
||||
NC_set_numrecs(nc3i,unlimited->dim.declsize);
|
||||
}
|
||||
|
||||
/* Pretend the substrate is read-only */
|
||||
NC_set_readonly(nc3i);
|
||||
|
||||
{ /* (for now) break abstractions*/
|
||||
NC* ncsub;
|
||||
NC3_INFO* nc3i;
|
||||
CDFnode* unlimited = dapcomm->cdf.recorddim;
|
||||
/* get the dispatch data for the substrate */
|
||||
ncstat = NC_check_id(nc3id,&ncsub);
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
nc3i = (NC3_INFO*)ncsub->dispatchdata;
|
||||
/* This must be checked after all dds and data processing
|
||||
so we can figure out the value of numrecs.
|
||||
*/
|
||||
if(unlimited != NULL) { /* Set the effective size of UNLIMITED */
|
||||
NC_set_numrecs(nc3i,unlimited->dim.declsize);
|
||||
}
|
||||
/* Pretend the substrate is read-only */
|
||||
NC_set_readonly(nc3i);
|
||||
}
|
||||
|
||||
/* Do any necessary data prefetch */
|
||||
@ -630,9 +628,6 @@ buildncstructures(NCDAPCOMMON* dapcomm)
|
||||
CDFnode* dds = dapcomm->cdf.ddsroot;
|
||||
NC* ncsub;
|
||||
|
||||
ncstat = NC_check_id(getnc3id(dapcomm->controller),&ncsub);
|
||||
if(ncstat != NC_NOERR) goto done;
|
||||
|
||||
ncstat = buildglobalattrs(dapcomm,dds);
|
||||
if(ncstat != NC_NOERR) goto done;
|
||||
|
||||
@ -681,7 +676,7 @@ builddims(NCDAPCOMMON* dapcomm)
|
||||
if(dapcomm->cdf.recorddim != NULL) {
|
||||
CDFnode* unlimited = dapcomm->cdf.recorddim;
|
||||
definename = getdefinename(unlimited);
|
||||
ncstat = nc_def_dim(getnc3id(drno),
|
||||
ncstat = nc_def_dim(dapcomm->nc3id,
|
||||
definename,
|
||||
NC_UNLIMITED,
|
||||
&unlimited->ncid);
|
||||
@ -689,7 +684,7 @@ builddims(NCDAPCOMMON* dapcomm)
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
|
||||
/* get the id for the substrate */
|
||||
ncstat = NC_check_id(getnc3id(drno),&ncsub);
|
||||
ncstat = NC_check_id(dapcomm->nc3id,&ncsub);
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
#if 0
|
||||
nc3sub = (NC3_INFO*)&ncsub->dispatchdata;
|
||||
@ -708,7 +703,7 @@ builddims(NCDAPCOMMON* dapcomm)
|
||||
fprintf(stderr,"define: dim: %s=%ld\n",dim->ncfullname,(long)dim->dim.declsize);
|
||||
#endif
|
||||
definename = getdefinename(dim);
|
||||
ncstat = nc_def_dim(getnc3id(drno),definename,dim->dim.declsize,&dimid);
|
||||
ncstat = nc_def_dim(dapcomm->nc3id,definename,dim->dim.declsize,&dimid);
|
||||
if(ncstat != NC_NOERR) {
|
||||
THROWCHK(ncstat); nullfree(definename); goto done;
|
||||
}
|
||||
@ -780,7 +775,7 @@ fprintf(stderr,"[%ld]",dim->dim.declsize);
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
ncstat = nc_def_var(getnc3id(drno),
|
||||
ncstat = nc_def_var(dapcomm->nc3id,
|
||||
definename,
|
||||
var->externaltype,
|
||||
ncrank,
|
||||
@ -841,7 +836,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
|
||||
}
|
||||
}
|
||||
if(ncbyteslength(buf) > 0) {
|
||||
ncstat = nc_put_att_text(getnc3id(drno),NC_GLOBAL,"_sequence_dimensions",
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_sequence_dimensions",
|
||||
ncbyteslength(buf),ncbytescontents(buf));
|
||||
}
|
||||
}
|
||||
@ -852,12 +847,12 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
|
||||
|
||||
if(dapparamcheck(dapcomm,"show","translate")) {
|
||||
/* Add a global attribute to show the translation */
|
||||
ncstat = nc_put_att_text(getnc3id(drno),NC_GLOBAL,"_translate",
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_translate",
|
||||
strlen("netcdf-3"),"netcdf-3");
|
||||
}
|
||||
if(dapparamcheck(dapcomm,"show","url")) {
|
||||
if(dapcomm->oc.rawurltext != NULL)
|
||||
ncstat = nc_put_att_text(getnc3id(drno),NC_GLOBAL,"_url",
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_url",
|
||||
strlen(dapcomm->oc.rawurltext),dapcomm->oc.rawurltext);
|
||||
}
|
||||
if(dapparamcheck(dapcomm,"show","dds")) {
|
||||
@ -868,7 +863,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
|
||||
/* replace newlines with spaces*/
|
||||
nltxt = nulldup(txt);
|
||||
for(p=nltxt;*p;p++) {if(*p == '\n' || *p == '\r' || *p == '\t') {*p = ' ';}};
|
||||
ncstat = nc_put_att_text(getnc3id(drno),NC_GLOBAL,"_dds",strlen(nltxt),nltxt);
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_dds",strlen(nltxt),nltxt);
|
||||
nullfree(nltxt);
|
||||
}
|
||||
}
|
||||
@ -879,7 +874,7 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
|
||||
if(txt != NULL) {
|
||||
nltxt = nulldup(txt);
|
||||
for(p=nltxt;*p;p++) {if(*p == '\n' || *p == '\r' || *p == '\t') {*p = ' ';}};
|
||||
ncstat = nc_put_att_text(getnc3id(drno),NC_GLOBAL,"_das",strlen(nltxt),nltxt);
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,NC_GLOBAL,"_das",strlen(nltxt),nltxt);
|
||||
nullfree(nltxt);
|
||||
}
|
||||
}
|
||||
@ -921,9 +916,9 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
|
||||
}
|
||||
dapexpandescapes(newstring);
|
||||
if(newstring[0]=='\0')
|
||||
ncstat = nc_put_att_text(getnc3id(drno),varid,att->name,1,newstring);
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,varid,att->name,1,newstring);
|
||||
else
|
||||
ncstat = nc_put_att_text(getnc3id(drno),varid,att->name,strlen(newstring),newstring);
|
||||
ncstat = nc_put_att_text(dapcomm->nc3id,varid,att->name,strlen(newstring),newstring);
|
||||
free(newstring);
|
||||
if(ncstat) goto done;
|
||||
} else {
|
||||
@ -953,7 +948,7 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
|
||||
_ASSERTE(_CrtCheckMemory());
|
||||
#endif
|
||||
if(ncstat) {nullfree(mem); goto done;}
|
||||
ncstat = nc_put_att(getnc3id(drno),varid,att->name,atype,nvalues,mem);
|
||||
ncstat = nc_put_att(dapcomm->nc3id,varid,att->name,atype,nvalues,mem);
|
||||
#ifdef _MSC_VER
|
||||
_ASSERTE(_CrtCheckMemory());
|
||||
#endif
|
||||
@ -2372,12 +2367,12 @@ NCD2_get_att(int ncid, int varid, const char* name, void* value, nc_type t)
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_get_att(getnc3id(drno), varid, name, value);
|
||||
ret = NCDISPATCH_get_att(getnc3id(drno), varid, name, value, t);
|
||||
return THROW(ret);
|
||||
}
|
||||
|
||||
int
|
||||
NCD2_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
NCD2_inq_var_all(int ncid, int varid, char *name, nc_type* xtypep,
|
||||
int* ndimsp, int* dimidsp, int* nattsp,
|
||||
int* shufflep, int* deflatep, int* deflate_levelp,
|
||||
int* fletcher32p, int* contiguousp, size_t* chunksizesp,
|
||||
@ -2387,7 +2382,7 @@ NCD2_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = NC_inq_var_all(getnc3id(drno), varid, name, xtypep,
|
||||
ret = NCDISPATCH_inq_var_all(getnc3id(drno), varid, name, xtypep,
|
||||
ndimsp, dimidsp, nattsp,
|
||||
shufflep, deflatep, deflate_levelp,
|
||||
fletcher32p, contiguousp, chunksizesp,
|
||||
@ -2534,12 +2529,12 @@ NCD2_inq_user_type(int ncid, nc_type t, char* p3, size_t* p4, nc_type* p5,
|
||||
}
|
||||
|
||||
int
|
||||
NCD2_inq_typeid(int ncid, const char* name, nc_type* tp)
|
||||
NCD2_inq_typeid(int ncid, const char* name, nc_type* t)
|
||||
{
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_inq_typeid(getnc3id(drno), name, tp);
|
||||
ret = nc_inq_typeid(getnc3id(drno), name, t);
|
||||
return THROW(ret);
|
||||
}
|
||||
|
||||
@ -2564,12 +2559,12 @@ NCD2_rename_grp(int ncid, const char* p)
|
||||
}
|
||||
|
||||
int
|
||||
NCD2_def_compound(int ncid, size_t p2, const char* p3, nc_type* p4)
|
||||
NCD2_def_compound(int ncid, size_t p2, const char* p3, nc_type* t)
|
||||
{
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_def_compound(getnc3id(drno), p2, p3, p4);
|
||||
ret = nc_def_compound(getnc3id(drno), p2, p3, t);
|
||||
return THROW(ret);
|
||||
}
|
||||
|
||||
@ -2596,7 +2591,7 @@ NCD2_insert_array_compound(int ncid, nc_type t1, const char* p3, size_t p4,
|
||||
|
||||
int
|
||||
NCD2_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name,
|
||||
size_t *offsetp, nc_type *field_typeidp, int *ndimsp,
|
||||
size_t *offsetp, nc_type* field_typeidp, int *ndimsp,
|
||||
int *dim_sizesp)
|
||||
{
|
||||
NC* drno;
|
||||
@ -2618,12 +2613,12 @@ NCD2_inq_compound_fieldindex(int ncid, nc_type xtype, const char *name,
|
||||
}
|
||||
|
||||
int
|
||||
NCD2_def_vlen(int ncid, const char* p2, nc_type base_typeid, nc_type* p4)
|
||||
NCD2_def_vlen(int ncid, const char* p2, nc_type base_typeid, nc_type* t)
|
||||
{
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_def_vlen(getnc3id(drno), p2, base_typeid, p4);
|
||||
ret = nc_def_vlen(getnc3id(drno), p2, base_typeid, t);
|
||||
return THROW(ret);
|
||||
}
|
||||
|
||||
@ -2648,12 +2643,12 @@ NCD2_get_vlen_element(int ncid, int p2, const void* p3, size_t* p4, void* p5)
|
||||
}
|
||||
|
||||
int
|
||||
NCD2_def_enum(int ncid, nc_type t1, const char* p3, nc_type* p4)
|
||||
NCD2_def_enum(int ncid, nc_type t1, const char* p3, nc_type* t)
|
||||
{
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_def_enum(getnc3id(drno), t1, p3, p4);
|
||||
ret = nc_def_enum(getnc3id(drno), t1, p3, t);
|
||||
return THROW(ret);
|
||||
}
|
||||
|
||||
@ -2688,12 +2683,12 @@ NCD2_inq_enum_ident(int ncid, nc_type t1, long long p3, char* p4)
|
||||
}
|
||||
|
||||
int
|
||||
NCD2_def_opaque(int ncid, size_t p2, const char* p3, nc_type* p4)
|
||||
NCD2_def_opaque(int ncid, size_t p2, const char* p3, nc_type* t)
|
||||
{
|
||||
NC* drno;
|
||||
int ret;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_def_opaque(getnc3id(drno), p2, p3, p4);
|
||||
ret = nc_def_opaque(getnc3id(drno), p2, p3, t);
|
||||
return THROW(ret);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ libdispatch_la_CPPFLAGS = ${AM_CPPFLAGS}
|
||||
# The source files.
|
||||
libdispatch_la_SOURCES = dparallel.c dcopy.c dfile.c ddim.c datt.c \
|
||||
dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c \
|
||||
dvarinq.c ddispatch.c \
|
||||
dvarinq.c dinternal.c ddispatch.c \
|
||||
nclog.c dstring.c dutf8proc.c utf8proc_data.h \
|
||||
ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c \
|
||||
nc.c nclistmgr.c
|
||||
|
@ -109,6 +109,7 @@ nc_rename_att(int ncid, int varid, const char *name, const char *newname)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_rename_att);
|
||||
return ncp->dispatch->rename_att(ncid, varid, name, newname);
|
||||
}
|
||||
|
||||
@ -159,6 +160,7 @@ nc_del_att(int ncid, int varid, const char *name)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_del_att);
|
||||
return ncp->dispatch->del_att(ncid, varid, name);
|
||||
}
|
||||
/*! \} */ /* End of named group ...*/
|
||||
|
@ -54,6 +54,7 @@ nc_get_att(int ncid, int varid, const char *name, void *value)
|
||||
if ((stat = nc_inq_atttype(ncid, varid, name, &xtype)))
|
||||
return stat;
|
||||
|
||||
TRACE(nc_get_att);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, value, xtype);
|
||||
}
|
||||
/*! \} */
|
||||
@ -138,6 +139,7 @@ nc_get_att_text(int ncid, int varid, const char *name, char *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_text);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_CHAR);
|
||||
}
|
||||
|
||||
@ -147,6 +149,7 @@ nc_get_att_schar(int ncid, int varid, const char *name, signed char *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_schar);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_BYTE);
|
||||
}
|
||||
|
||||
@ -156,6 +159,7 @@ nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_uchar);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
|
||||
}
|
||||
|
||||
@ -165,6 +169,7 @@ nc_get_att_short(int ncid, int varid, const char *name, short *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_short);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_SHORT);
|
||||
}
|
||||
|
||||
@ -174,6 +179,7 @@ nc_get_att_int(int ncid, int varid, const char *name, int *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_int);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT);
|
||||
}
|
||||
|
||||
@ -183,6 +189,7 @@ nc_get_att_long(int ncid, int varid, const char *name, long *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_long);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, longtype);
|
||||
}
|
||||
|
||||
@ -192,6 +199,7 @@ nc_get_att_float(int ncid, int varid, const char *name, float *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_float);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_FLOAT);
|
||||
}
|
||||
|
||||
@ -201,6 +209,7 @@ nc_get_att_double(int ncid, int varid, const char *name, double *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_double);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_DOUBLE);
|
||||
}
|
||||
|
||||
@ -210,6 +219,7 @@ nc_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_ubyte);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UBYTE);
|
||||
}
|
||||
|
||||
@ -219,6 +229,7 @@ nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_ushort);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_USHORT);
|
||||
}
|
||||
|
||||
@ -228,6 +239,7 @@ nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_uint);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT);
|
||||
}
|
||||
|
||||
@ -237,6 +249,7 @@ nc_get_att_longlong(int ncid, int varid, const char *name, long long *value)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_longlong);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_INT64);
|
||||
}
|
||||
|
||||
@ -246,6 +259,7 @@ nc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *
|
||||
NC *ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_ulonglong);
|
||||
return ncp->dispatch->get_att(ncid, varid, name, (void *)value, NC_UINT64);
|
||||
}
|
||||
/*! \} */
|
||||
@ -325,11 +339,11 @@ int main(int argc, char ** argv) {
|
||||
|
||||
int
|
||||
nc_get_att_string(int ncid, int varid, const char *name, char **value)
|
||||
|
||||
{
|
||||
NC *ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_get_att_string);
|
||||
return ncp->dispatch->get_att(ncid,varid,name,(void*)value, NC_STRING);
|
||||
}
|
||||
/*! \} */
|
||||
|
@ -120,11 +120,13 @@ named foo.nc:
|
||||
\endcode
|
||||
|
||||
*/
|
||||
int nc_def_dim(int ncid, const char *name, size_t len, int *idp)
|
||||
int
|
||||
nc_def_dim(int ncid, const char *name, size_t len, int *idp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_def_dim);
|
||||
return ncp->dispatch->def_dim(ncid, name, len, idp);
|
||||
}
|
||||
|
||||
@ -154,6 +156,7 @@ nc_inq_dimid(int ncid, const char *name, int *idp)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_dimid);
|
||||
return ncp->dispatch->inq_dimid(ncid,name,idp);
|
||||
}
|
||||
|
||||
@ -217,6 +220,7 @@ nc_inq_dim(int ncid, int dimid, char *name, size_t *lenp)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_dim);
|
||||
return ncp->dispatch->inq_dim(ncid,dimid,name,lenp);
|
||||
}
|
||||
|
||||
@ -278,6 +282,7 @@ nc_rename_dim(int ncid, int dimid, const char *name)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_rename_dim);
|
||||
return ncp->dispatch->rename_dim(ncid,dimid,name);
|
||||
}
|
||||
|
||||
@ -309,6 +314,7 @@ nc_inq_ndims(int ncid, int *ndimsp)
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(ndimsp == NULL) return NC_NOERR;
|
||||
TRACE(nc_inq_ndims);
|
||||
return ncp->dispatch->inq(ncid,ndimsp,NULL,NULL,NULL);
|
||||
}
|
||||
|
||||
@ -338,6 +344,7 @@ nc_inq_unlimdim(int ncid, int *unlimdimidp)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_unlimdim);
|
||||
return ncp->dispatch->inq_unlimdim(ncid,unlimdimidp);
|
||||
}
|
||||
|
||||
@ -397,6 +404,7 @@ nc_inq_dimname(int ncid, int dimid, char *name)
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(name == NULL) return NC_NOERR;
|
||||
TRACE(nc_inq_dimname);
|
||||
return ncp->dispatch->inq_dim(ncid,dimid,name,NULL);
|
||||
}
|
||||
|
||||
@ -453,6 +461,7 @@ nc_inq_dimlen(int ncid, int dimid, size_t *lenp)
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(lenp == NULL) return NC_NOERR;
|
||||
TRACE(nc_inq_dimlen);
|
||||
return ncp->dispatch->inq_dim(ncid,dimid,NULL,lenp);
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,7 @@ NC_urlmodel(const char* path)
|
||||
return model;
|
||||
}
|
||||
|
||||
#ifdef OBSOLETE
|
||||
/* Override dispatch table management */
|
||||
static NC_Dispatch* NC_dispatch_override = NULL;
|
||||
|
||||
@ -166,8 +167,10 @@ void NC_set_dispatch_override(NC_Dispatch* d)
|
||||
{
|
||||
NC_dispatch_override = d;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Overlay by treating the tables as arrays of void*.
|
||||
/* OBSOLETE
|
||||
Overlay by treating the tables as arrays of void*.
|
||||
Overlay rules are:
|
||||
overlay base merge
|
||||
------- ---- -----
|
||||
@ -177,6 +180,7 @@ void NC_set_dispatch_override(NC_Dispatch* d)
|
||||
x y x
|
||||
*/
|
||||
|
||||
#ifdef OBSOLETE
|
||||
int
|
||||
NC_dispatch_overlay(const NC_Dispatch* overlay, const NC_Dispatch* base, NC_Dispatch* merge)
|
||||
{
|
||||
@ -196,3 +200,4 @@ NC_dispatch_overlay(const NC_Dispatch* overlay, const NC_Dispatch* base, NC_Disp
|
||||
merge->model = overlay->model;
|
||||
return NC_NOERR;
|
||||
}
|
||||
#endif
|
||||
|
@ -1658,6 +1658,7 @@ NC_create(const char *path, int cmode, size_t initialsz,
|
||||
int isurl = 0; /* dap or cdmremote or neither */
|
||||
int xcmode = 0; /* for implied cmode flags */
|
||||
|
||||
TRACE(nc_create);
|
||||
/* Initialize the dispatch table. The function pointers in the
|
||||
* dispatch table will depend on how netCDF was built
|
||||
* (with/without netCDF-4, DAP, CDMREMOTE). */
|
||||
@ -1733,7 +1734,10 @@ NC_create(const char *path, int cmode, size_t initialsz,
|
||||
if((cmode & NC_MPIIO) && (cmode & NC_MPIPOSIX))
|
||||
return NC_EINVAL;
|
||||
|
||||
if (!(dispatcher = NC_get_dispatch_override()))
|
||||
#ifdef OBSOLETE
|
||||
dispatcher = NC_get_dispatch_override();
|
||||
#endif
|
||||
if (dispatcher == NULL)
|
||||
{
|
||||
|
||||
/* Figure out what dispatcher to use */
|
||||
@ -1807,6 +1811,7 @@ NC_open(const char *path, int cmode,
|
||||
int version = 0;
|
||||
int flags = 0;
|
||||
|
||||
TRACE(nc_open);
|
||||
if(!NC_initialized) {
|
||||
stat = nc_initialize();
|
||||
if(stat) return stat;
|
||||
@ -1877,7 +1882,9 @@ NC_open(const char *path, int cmode,
|
||||
return NC_EINVAL;
|
||||
|
||||
/* override any other table choice */
|
||||
#ifdef OBSOLETE
|
||||
dispatcher = NC_get_dispatch_override();
|
||||
#endif
|
||||
if(dispatcher != NULL) goto havetable;
|
||||
|
||||
/* Figure out what dispatcher to use */
|
||||
|
@ -212,6 +212,7 @@ nc_def_var(int ncid, const char *name, nc_type xtype,
|
||||
|
||||
if ((stat = NC_check_id(ncid, &ncp)))
|
||||
return stat;
|
||||
TRACE(nc_def_var);
|
||||
return ncp->dispatch->def_var(ncid, name, xtype, ndims,
|
||||
dimidsp, varidp);
|
||||
}
|
||||
@ -282,6 +283,7 @@ nc_rename_var(int ncid, int varid, const char *name)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_rename_var);
|
||||
return ncp->dispatch->rename_var(ncid, varid, name);
|
||||
}
|
||||
/*! \} */
|
||||
|
@ -119,6 +119,7 @@ nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep,
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var);
|
||||
return ncp->dispatch->inq_var_all(ncid, varid, name, xtypep, ndimsp,
|
||||
dimidsp, nattsp, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -276,6 +277,7 @@ nc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep,
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var_deflate);
|
||||
return ncp->dispatch->inq_var_all(
|
||||
ncid, varid,
|
||||
NULL, /*name*/
|
||||
@ -330,6 +332,7 @@ nc_inq_var_szip(int ncid, int varid, int *options_maskp, int *pixels_per_blockp)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var_szip);
|
||||
return ncp->dispatch->inq_var_all(
|
||||
ncid, varid,
|
||||
NULL, /*name*/
|
||||
@ -377,6 +380,7 @@ nc_inq_var_fletcher32(int ncid, int varid, int *fletcher32p)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var_fletcher32);
|
||||
return ncp->dispatch->inq_var_all(
|
||||
ncid, varid,
|
||||
NULL, /*name*/
|
||||
@ -426,6 +430,7 @@ nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp)
|
||||
NC *ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var_chunking);
|
||||
return ncp->dispatch->inq_var_all(ncid, varid, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, storagep,
|
||||
chunksizesp, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -460,6 +465,7 @@ nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var_fill);
|
||||
return ncp->dispatch->inq_var_all(
|
||||
ncid, varid,
|
||||
NULL, /*name*/
|
||||
@ -508,6 +514,7 @@ nc_inq_var_endian(int ncid, int varid, int *endianp)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_var_endian);
|
||||
return ncp->dispatch->inq_var_all(
|
||||
ncid, varid,
|
||||
NULL, /*name*/
|
||||
@ -557,6 +564,7 @@ nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
TRACE(nc_inq_unlimdims);
|
||||
return ncp->dispatch->inq_unlimdims(ncid, nunlimdimsp,
|
||||
unlimdimidsp);
|
||||
}
|
||||
|
@ -2022,9 +2022,9 @@ attach_dimscales(NC_GRP_INFO_T *grp)
|
||||
{
|
||||
if (!var->dimscale_attached[d])
|
||||
{
|
||||
hid_t dim_datasetid; /* Dataset ID for dimension */
|
||||
dim1 = var->dim[d];
|
||||
assert(dim1 && dim1->dimid == var->dimids[d]);
|
||||
hid_t dim_datasetid; /* Dataset ID for dimension */
|
||||
|
||||
LOG((2, "%s: attaching scale for dimid %d to var %s",
|
||||
__func__, var->dimids[d], var->name));
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
quiet=0
|
||||
@ -249,6 +249,7 @@ rm -f ./.dodsrc ./.ocrc ./.daprc
|
||||
cd ${RESULTSDIR}
|
||||
|
||||
for t in ${TESTSET} ; do
|
||||
|
||||
# see if we are using constraints
|
||||
#index=`expr index "${t}" ";"`
|
||||
|
||||
@ -302,6 +303,7 @@ for t in ${TESTSET} ; do
|
||||
|
||||
status=0
|
||||
|
||||
echo "command = ${TIMECMD} ${VALGRIND} ${NCDUMP} ${url} \> ${name}.dmp"
|
||||
if ${TIMECMD} ${VALGRIND} ${NCDUMP} "${url}" > ${name}.dmp ; then status=$status; else status=1; fi
|
||||
# compare with expected
|
||||
if diff -w ${EXPECTED}/${name}.dmp ${name}.dmp
|
||||
|
Loading…
x
Reference in New Issue
Block a user