mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-05 16:20:10 +08:00
merged upstream/master
This commit is contained in:
commit
86cb431cfb
@ -52,21 +52,35 @@ typedef struct NCURI {
|
||||
#endif
|
||||
} NCURI;
|
||||
|
||||
/* Declaration modifiers for DLL support (MSC et al) */
|
||||
#if defined(DLL_NETCDF) /* define when library is a DLL */
|
||||
# if defined(DLL_EXPORT) /* define when building the library */
|
||||
# define MSC_EXTRA __declspec(dllexport)
|
||||
# else
|
||||
# define MSC_EXTRA __declspec(dllimport)
|
||||
# endif
|
||||
# include <io.h>
|
||||
#else
|
||||
#define MSC_EXTRA /**< Needed for DLL build. */
|
||||
#endif /* defined(DLL_NETCDF) */
|
||||
|
||||
#define EXTERNL MSC_EXTRA extern /**< Needed for DLL build. */
|
||||
|
||||
#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__) || defined(__CPLUSPLUS)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int ncuriparse(const char* s, NCURI** ncuri);
|
||||
EXTERNL int ncuriparse(const char* s, NCURI** ncuri);
|
||||
extern void ncurifree(NCURI* ncuri);
|
||||
|
||||
/* Replace the protocol */
|
||||
extern int ncurisetprotocol(NCURI*,const char* newprotocol);
|
||||
|
||||
/* Replace the constraints */
|
||||
extern int ncurisetquery(NCURI*,const char* query);
|
||||
EXTERNL int ncurisetquery(NCURI*,const char* query);
|
||||
|
||||
/* Construct a complete NC URI; caller frees returned string */
|
||||
extern char* ncuribuild(NCURI*,const char* prefix, const char* suffix, int flags);
|
||||
EXTERNL char* ncuribuild(NCURI*,const char* prefix, const char* suffix, int flags);
|
||||
|
||||
/*! Search the fragment for a given parameter
|
||||
Null result => entry not found; !NULL=>found;
|
||||
|
@ -16,11 +16,17 @@ ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(ncdump ${ncdump_FILES})
|
||||
ADD_EXECUTABLE(nccopy ${nccopy_FILES})
|
||||
ADD_EXECUTABLE(ocprint ${ocprint_FILES})
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
ADD_EXECUTABLE(ocprint ${ocprint_FILES})
|
||||
ENDIF(ENABLE_DAP)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ncdump netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(nccopy netcdf ${ALL_TLL_LIBS})
|
||||
TARGET_LINK_LIBRARIES(ocprint netcdf ${ALL_TLL_LIBS})
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
TARGET_LINK_LIBRARIES(ocprint netcdf ${ALL_TLL_LIBS})
|
||||
ENDIF(ENABLE_DAP)
|
||||
|
||||
####
|
||||
# We have to do a little tweaking
|
||||
@ -43,12 +49,15 @@ IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
SET_TARGET_PROPERTIES(ocprint PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(ocprint PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(ocprint PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(ocprint PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
SET_TARGET_PROPERTIES(ocprint PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
ENDIF(ENABLE_DAP)
|
||||
|
||||
ENDIF()
|
||||
|
||||
|
||||
@ -248,16 +257,19 @@ IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(nccopy
|
||||
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
)
|
||||
SET_TARGET_PROPERTIES(ocprint
|
||||
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
)
|
||||
|
||||
IF(ENABLE_DAP)
|
||||
SET_TARGET_PROPERTIES(ocprint
|
||||
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
||||
)
|
||||
ENDIF(ENABLE_DAP)
|
||||
|
||||
ENDIF()
|
||||
|
||||
|
||||
INSTALL(TARGETS ncdump RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
INSTALL(TARGETS nccopy RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
INSTALL(TARGETS ocprint RUNTIME DESTINATION bin COMPONENT utilities)
|
||||
|
||||
SET(MAN_FILES nccopy.1 ncdump.1)
|
||||
|
||||
# Note, the L512.bin file is file containing exactly 512 bytes each of value 0.
|
||||
|
@ -11,7 +11,7 @@
|
||||
# Put together AM_CPPFLAGS and AM_LDFLAGS.
|
||||
include $(top_srcdir)/lib_flags.am
|
||||
LDADD = ${top_builddir}/liblib/libnetcdf.la
|
||||
|
||||
noinst_PROGRAMS=
|
||||
# Note which tests depend on other tests. Necessary for make -j check.
|
||||
TEST_EXTENSIONS = .sh
|
||||
XFAIL_TESTS=""
|
||||
@ -30,13 +30,13 @@ utils.h utils.c dimmap.h dimmap.c list.c list.h
|
||||
|
||||
# A simple netcdf-4 metadata -> xml printer. Do not install.
|
||||
if USE_NETCDF4
|
||||
noinst_PROGRAMS = nc4print
|
||||
noinst_PROGRAMS += nc4print
|
||||
nc4print_SOURCES = nc4print.c
|
||||
endif
|
||||
|
||||
# Conditionally build the ocprint program, but do not install
|
||||
if ENABLE_DAP
|
||||
bin_PROGRAMS += ocprint
|
||||
noinst_PROGRAMS += ocprint
|
||||
ocprint_SOURCES = ocprint.c
|
||||
endif
|
||||
|
||||
|
@ -15,7 +15,9 @@
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "oc.h"
|
||||
#include "ocx.h"
|
||||
@ -32,6 +34,12 @@
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include "XGetopt.h"
|
||||
int opterr;
|
||||
int optind;
|
||||
#endif
|
||||
|
||||
#ifndef nulldup
|
||||
#define nulldup(s) (s==NULL?NULL:strdup(s))
|
||||
#endif
|
||||
@ -52,7 +60,7 @@
|
||||
/*Mnemonic*/
|
||||
#define TOPLEVEL 1
|
||||
|
||||
extern int ocdebug;
|
||||
int ocdebug;
|
||||
|
||||
static OCerror ocstat;
|
||||
static OClink glink;
|
||||
@ -181,7 +189,7 @@ main(int argc, char **argv)
|
||||
#ifdef OCDEBUG
|
||||
{ int i;
|
||||
fprintf(stderr,"argv =");
|
||||
for(i=0;i<argc;i++)
|
||||
for(i=0;i<argc;i++)
|
||||
fprintf(stderr," %s",argv[i]);
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
@ -240,11 +248,11 @@ main(int argc, char **argv)
|
||||
ocopt.output = fopen(optarg,"w");
|
||||
if(ocopt.output == NULL)
|
||||
usage("-o file not writeable");
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'u': case 'f':
|
||||
ocopt.surl = optarg;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if(strcasecmp(optarg,"das")==0) ocopt.optdas=1;
|
||||
@ -328,7 +336,7 @@ main(int argc, char **argv)
|
||||
ncurisetquery(ocopt.url,ocopt.constraint);
|
||||
nullfree(ocopt.constraint);
|
||||
ocopt.constraint = NULL;
|
||||
}
|
||||
}
|
||||
/* Rebuild the url string */
|
||||
if(ocopt.surl != NULL) free(ocopt.surl);
|
||||
ocopt.surl = ncuribuild(ocopt.url,NULL,NULL,NCURIALL);
|
||||
@ -529,7 +537,7 @@ printdata_container(OClink link, OCdatanode datanode, NCbytes* buffer, int istop
|
||||
OCtype octype;
|
||||
size_t nsubnodes;
|
||||
|
||||
/* Obtain some information about the node */
|
||||
/* Obtain some information about the node */
|
||||
FAIL(oc_data_ddsnode(link,datanode,&node));
|
||||
FAIL(oc_dds_nsubnodes(link,node,&nsubnodes));
|
||||
FAIL(oc_data_octype(link,datanode,&octype));
|
||||
@ -565,7 +573,7 @@ printdata_indices(OClink link, OCdatanode datanode, NCbytes* buffer, int istople
|
||||
size_t dimsizes[OC_MAX_DIMENSIONS];
|
||||
size_t indices[OC_MAX_DIMENSIONS];
|
||||
|
||||
/* Obtain some information about the node */
|
||||
/* Obtain some information about the node */
|
||||
FAIL(oc_data_ddsnode(link,datanode,&node));
|
||||
FAIL(oc_dds_octype(link,node,&octype));
|
||||
FAIL(oc_dds_rank(link,node,&rank));
|
||||
@ -581,14 +589,14 @@ printdata_indices(OClink link, OCdatanode datanode, NCbytes* buffer, int istople
|
||||
if(octype == OC_Structure) {
|
||||
/* Get dimension sizes */
|
||||
FAIL(oc_dds_dimensionsizes(link,node,dimsizes));
|
||||
|
||||
|
||||
/* init odometer and get cross-product */
|
||||
odom_init(rank,indices,dimsizes);
|
||||
while(odom_more(rank,indices,dimsizes)) {
|
||||
OCdatanode element;
|
||||
FAIL(oc_data_ithelement(link,datanode,indices,&element));
|
||||
pushstack(element);
|
||||
/* walk the container */
|
||||
/* walk the container */
|
||||
printdata_container(link,element,buffer,!TOPLEVEL);
|
||||
popstack();
|
||||
oc_data_free(link,element);
|
||||
@ -631,7 +639,7 @@ printdata_leaf(OClink link, OCdatanode datanode, NCbytes* buffer, int istoplevel
|
||||
char* memory;
|
||||
size_t count,rank;
|
||||
|
||||
/* Obtain some information about the node */
|
||||
/* Obtain some information about the node */
|
||||
FAIL(oc_data_ddsnode(link,datanode,&node));
|
||||
FAIL(oc_dds_octype(link,node,&octype));
|
||||
FAIL(oc_dds_atomictype(link,node,&atomtype));
|
||||
@ -645,7 +653,7 @@ printdata_leaf(OClink link, OCdatanode datanode, NCbytes* buffer, int istoplevel
|
||||
*/
|
||||
|
||||
elemsize = oc_typesize(atomtype);
|
||||
|
||||
|
||||
if(rank == 0) {/* Scalar case */
|
||||
memory = calloc(elemsize,1); /* reading only one value */
|
||||
/* read the scalar */
|
||||
@ -655,7 +663,7 @@ printdata_leaf(OClink link, OCdatanode datanode, NCbytes* buffer, int istoplevel
|
||||
FAIL(oc_data_read(link,datanode,NULL,NULL,elemsize,memory));
|
||||
}
|
||||
count = 1;
|
||||
} else {
|
||||
} else {
|
||||
size_t dimsizes[OC_MAX_DIMENSIONS];
|
||||
size_t indices[OC_MAX_DIMENSIONS];
|
||||
FAIL(oc_dds_dimensionsizes(link,node,dimsizes));
|
||||
@ -663,7 +671,7 @@ printdata_leaf(OClink link, OCdatanode datanode, NCbytes* buffer, int istoplevel
|
||||
count = odom_init(rank,indices,dimsizes);
|
||||
memsize = elemsize*count;
|
||||
memory = calloc(memsize,1);
|
||||
|
||||
|
||||
#ifdef ALLATONCE /* read all at once */
|
||||
/* indices should be all zeros at this point */
|
||||
if(istoplevel) {
|
||||
@ -674,10 +682,10 @@ printdata_leaf(OClink link, OCdatanode datanode, NCbytes* buffer, int istoplevel
|
||||
#else /* BYITEM */
|
||||
{
|
||||
size_t offset;
|
||||
size_t one[OC_MAX_DIMENSIONS];
|
||||
/* Initialize the read-by-one counts */
|
||||
for(i=0;i<rank;i++) one[i]=0;
|
||||
one[rank-1] = 1;
|
||||
size_t one[OC_MAX_DIMENSIONS];
|
||||
/* Initialize the read-by-one counts */
|
||||
for(i=0;i<rank;i++) one[i]=0;
|
||||
one[rank-1] = 1;
|
||||
/* Read whole atomic array item by item using an odometer */
|
||||
for(offset=0,i=0;i<count;i++,offset+=elemsize) {
|
||||
if(!odom_more(rank,indices,dimsizes))
|
||||
@ -976,7 +984,7 @@ needsescapes(const char* s)
|
||||
if(strchr(valuechars,c) != NULL)
|
||||
return 1; /* needs to be escaped */
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1085,35 +1093,35 @@ dumpdatanode(OClink link, OCdatanode datanode, size_t count, void* memory, NCbyt
|
||||
}
|
||||
|
||||
static off_t
|
||||
odom_init(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
{
|
||||
int i;
|
||||
odom_init(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
{
|
||||
int i;
|
||||
off_t count;
|
||||
for(count=1,i=0;i<rank;i++) {
|
||||
indices[i] = 0;
|
||||
count *= dimsizes[i];
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
odom_next(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
{
|
||||
int i;
|
||||
for(i=rank-1;i>=0;i--) {
|
||||
indices[i]++;
|
||||
if(indices[i] < dimsizes[i]) break;
|
||||
if(i > 0) indices[i] = 0;
|
||||
}
|
||||
odom_next(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
{
|
||||
int i;
|
||||
for(i=rank-1;i>=0;i--) {
|
||||
indices[i]++;
|
||||
if(indices[i] < dimsizes[i]) break;
|
||||
if(i > 0) indices[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return 0 if we have exhausted the indices, 1 otherwise */
|
||||
static int
|
||||
odom_more(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
odom_more(size_t rank, size_t* indices, size_t* dimsizes)
|
||||
{
|
||||
if(indices[0] >= dimsizes[0]) return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute total # of elements if dimensioned */
|
||||
static size_t
|
||||
@ -1172,7 +1180,7 @@ static void printstack(char* msg)
|
||||
FAIL(oc_dds_dimensionsizes(glink,entry->node,edges));
|
||||
FAIL(oc_dds_name(glink,node,&name));
|
||||
fprintf(stderr," [%d] (%s)",(int)i,name)
|
||||
for(j=0;j<rank;j++)
|
||||
for(j=0;j<rank;j++)
|
||||
fprintf(stderr,"[%u]",(unsigned int)edges[j]);
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
|
170
oc2/oc.h
170
oc2/oc.h
@ -197,34 +197,46 @@ typedef OCobject OClink;
|
||||
/**@}*/
|
||||
|
||||
/**************************************************/
|
||||
/* External API */
|
||||
/* extern API */
|
||||
/* Declaration modifiers for DLL support (MSC et al) */
|
||||
#if defined(DLL_NETCDF) /* define when library is a DLL */
|
||||
# if defined(DLL_EXPORT) /* define when building the library */
|
||||
# define MSC_EXTRA __declspec(dllexport)
|
||||
# else
|
||||
# define MSC_EXTRA __declspec(dllimport)
|
||||
# endif
|
||||
# include <io.h>
|
||||
#else
|
||||
#define MSC_EXTRA /**< Needed for DLL build. */
|
||||
#endif /* defined(DLL_NETCDF) */
|
||||
|
||||
#define EXTERNL MSC_EXTRA extern /**< Needed for DLL build. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
external "C" {
|
||||
#endif
|
||||
|
||||
/**************************************************/
|
||||
/* Link management */
|
||||
|
||||
extern OCerror oc_open(const char* url, OClink*);
|
||||
extern OCerror oc_close(OClink);
|
||||
EXTERNL OCerror oc_open(const char* url, OClink*);
|
||||
EXTERNL OCerror oc_close(OClink);
|
||||
|
||||
/**************************************************/
|
||||
/* Tree Management */
|
||||
|
||||
extern OCerror oc_fetch(OClink,
|
||||
EXTERNL OCerror oc_fetch(OClink,
|
||||
const char* constraint,
|
||||
OCdxd,
|
||||
OCflags,
|
||||
OCddsnode*);
|
||||
|
||||
extern OCerror oc_root_free(OClink, OCddsnode root);
|
||||
extern const char* oc_tree_text(OClink, OCddsnode root);
|
||||
EXTERNL OCerror oc_root_free(OClink, OCddsnode root);
|
||||
EXTERNL const char* oc_tree_text(OClink, OCddsnode root);
|
||||
|
||||
/**************************************************/
|
||||
/* Node Management */
|
||||
|
||||
extern OCerror oc_dds_properties(OClink, OCddsnode,
|
||||
EXTERNL OCerror oc_dds_properties(OClink, OCddsnode,
|
||||
char** namep,
|
||||
OCtype* typep,
|
||||
OCtype* atomictypep, /* if octype == OC_Atomic */
|
||||
@ -235,14 +247,14 @@ extern OCerror oc_dds_properties(OClink, OCddsnode,
|
||||
|
||||
/* Define some individual accessors for convenience */
|
||||
|
||||
extern OCerror oc_dds_name(OClink,OCddsnode,char**);
|
||||
extern OCerror oc_dds_class(OClink,OCddsnode,OCtype*);
|
||||
extern OCerror oc_dds_atomictype(OClink,OCddsnode,OCtype*);
|
||||
extern OCerror oc_dds_nsubnodes(OClink,OCddsnode,size_t*);
|
||||
extern OCerror oc_dds_rank(OClink,OCddsnode,size_t*);
|
||||
extern OCerror oc_dds_attr_count(OClink,OCddsnode,size_t*);
|
||||
extern OCerror oc_dds_root(OClink,OCddsnode,OCddsnode*);
|
||||
extern OCerror oc_dds_container(OClink,OCddsnode,OCddsnode*);
|
||||
EXTERNL OCerror oc_dds_name(OClink,OCddsnode,char**);
|
||||
EXTERNL OCerror oc_dds_class(OClink,OCddsnode,OCtype*);
|
||||
EXTERNL OCerror oc_dds_atomictype(OClink,OCddsnode,OCtype*);
|
||||
EXTERNL OCerror oc_dds_nsubnodes(OClink,OCddsnode,size_t*);
|
||||
EXTERNL OCerror oc_dds_rank(OClink,OCddsnode,size_t*);
|
||||
EXTERNL OCerror oc_dds_attr_count(OClink,OCddsnode,size_t*);
|
||||
EXTERNL OCerror oc_dds_root(OClink,OCddsnode,OCddsnode*);
|
||||
EXTERNL OCerror oc_dds_container(OClink,OCddsnode,OCddsnode*);
|
||||
|
||||
/* Aliases */
|
||||
#define oc_dds_octype oc_dds_class
|
||||
@ -252,44 +264,44 @@ extern OCerror oc_dds_container(OClink,OCddsnode,OCddsnode*);
|
||||
if there is no such node; return OC_EBADTYPE if node is not
|
||||
a container
|
||||
*/
|
||||
extern OCerror oc_dds_ithfield(OClink, OCddsnode, size_t index, OCddsnode* ithfieldp);
|
||||
EXTERNL OCerror oc_dds_ithfield(OClink, OCddsnode, size_t index, OCddsnode* ithfieldp);
|
||||
|
||||
/* Alias for oc_dds_ithfield */
|
||||
extern OCerror oc_dds_ithsubnode(OClink, OCddsnode, size_t, OCddsnode*);
|
||||
EXTERNL OCerror oc_dds_ithsubnode(OClink, OCddsnode, size_t, OCddsnode*);
|
||||
|
||||
/* Convenience functions that are just combinations of ithfield with other functions */
|
||||
|
||||
/* Return the grid array dds node from the specified grid node*/
|
||||
extern OCerror oc_dds_gridarray(OClink, OCddsnode grid, OCddsnode* arrayp);
|
||||
EXTERNL OCerror oc_dds_gridarray(OClink, OCddsnode grid, OCddsnode* arrayp);
|
||||
|
||||
/* Return the i'th grid map dds node from the specified grid dds node.
|
||||
NOTE: Map indices start at ZERO.
|
||||
*/
|
||||
extern OCerror oc_dds_gridmap(OClink, OCddsnode grid, size_t index, OCddsnode* mapp);
|
||||
EXTERNL OCerror oc_dds_gridmap(OClink, OCddsnode grid, size_t index, OCddsnode* mapp);
|
||||
|
||||
/* Retrieve a dds node by name from a dds structure or dataset node.
|
||||
return OC_EBADTYPE if node is not a container,
|
||||
return OC_EINDEX if no field by the given name is found.
|
||||
*/
|
||||
extern OCerror oc_dds_fieldbyname(OClink, OCddsnode, const char* name, OCddsnode* fieldp);
|
||||
EXTERNL OCerror oc_dds_fieldbyname(OClink, OCddsnode, const char* name, OCddsnode* fieldp);
|
||||
|
||||
|
||||
/* Return the dimension nodes, if any, associated with a given DDS node */
|
||||
/* Caller must allocate and free the vector for dimids */
|
||||
/* If the node is scalar, then return OC_ESCALAR. */
|
||||
extern OCerror oc_dds_dimensions(OClink, OCddsnode, OCddsnode* dimids);
|
||||
EXTERNL OCerror oc_dds_dimensions(OClink, OCddsnode, OCddsnode* dimids);
|
||||
|
||||
/* Return the i'th dimension node, if any, associated with a given object */
|
||||
/* If there is no such dimension, then return OC_EINVAL */
|
||||
extern OCerror oc_dds_ithdimension(OClink,OCddsnode, size_t, OCddsnode*);
|
||||
EXTERNL OCerror oc_dds_ithdimension(OClink,OCddsnode, size_t, OCddsnode*);
|
||||
|
||||
/* Return the size and name associated with a given dimension object
|
||||
as defined in the DDS
|
||||
*/
|
||||
extern OCerror oc_dimension_properties(OClink,OCddsnode,size_t*,char**);
|
||||
EXTERNL OCerror oc_dimension_properties(OClink,OCddsnode,size_t*,char**);
|
||||
|
||||
/* For convenience, return only the dimension sizes */
|
||||
extern OCerror oc_dds_dimensionsizes(OClink,OCddsnode,size_t* dimsizes);
|
||||
EXTERNL OCerror oc_dds_dimensionsizes(OClink,OCddsnode,size_t* dimsizes);
|
||||
|
||||
/* Attribute Management */
|
||||
|
||||
@ -299,13 +311,13 @@ extern OCerror oc_dds_dimensionsizes(OClink,OCddsnode,size_t* dimsizes);
|
||||
must do any required conversion based on the octype.
|
||||
The strings vector must be allocated and freed by caller,
|
||||
The contents of the strings vector must also be reclaimed
|
||||
using oc_attr_reclaim(see below).
|
||||
using oc_attr_reclaim(see below).
|
||||
Standard practice is to call twice, once with the strings
|
||||
argument == NULL so we get the number of values,
|
||||
then the second time with an allocated char** vector.
|
||||
|
||||
*/
|
||||
extern OCerror oc_dds_attr(OClink,OCddsnode, size_t i,
|
||||
EXTERNL OCerror oc_dds_attr(OClink,OCddsnode, size_t i,
|
||||
char** name, OCtype* octype,
|
||||
size_t* nvalues, char** strings);
|
||||
|
||||
@ -318,19 +330,19 @@ extern OCerror oc_dds_attr(OClink,OCddsnode, size_t i,
|
||||
Caller must free returned string.
|
||||
*/
|
||||
|
||||
extern OCerror oc_das_attr_count(OClink, OCddsnode, size_t* countp);
|
||||
EXTERNL OCerror oc_das_attr_count(OClink, OCddsnode, size_t* countp);
|
||||
|
||||
extern OCerror oc_das_attr(OClink,OCddsnode, size_t, OCtype*, char**);
|
||||
EXTERNL OCerror oc_das_attr(OClink,OCddsnode, size_t, OCtype*, char**);
|
||||
|
||||
/**************************************************/
|
||||
/* Free up a ddsnode that is no longer being used */
|
||||
extern OCerror oc_dds_free(OClink, OCddsnode);
|
||||
EXTERNL OCerror oc_dds_free(OClink, OCddsnode);
|
||||
|
||||
/**************************************************/
|
||||
/* Data Procedures */
|
||||
|
||||
/* Given the DDS tree root, get the root data of datadds */
|
||||
extern OCerror oc_dds_getdataroot(OClink, OCddsnode treeroot, OCdatanode* rootp);
|
||||
EXTERNL OCerror oc_dds_getdataroot(OClink, OCddsnode treeroot, OCdatanode* rootp);
|
||||
|
||||
/* Alias for oc_dds_getdataroot */
|
||||
#define oc_data_getroot oc_dds_getdataroot
|
||||
@ -339,13 +351,13 @@ extern OCerror oc_dds_getdataroot(OClink, OCddsnode treeroot, OCdatanode* rootp)
|
||||
If it does not exist, then return NULL.
|
||||
In effect this procedure allows one to walk up the datatree one level.
|
||||
*/
|
||||
extern OCerror oc_data_container(OClink, OCdatanode data, OCdatanode* containerp);
|
||||
EXTERNL OCerror oc_data_container(OClink, OCdatanode data, OCdatanode* containerp);
|
||||
|
||||
/* Return the root node of the data tree that contains the specified data node.
|
||||
In effect this procedure allows one to walk to the root of the datatree
|
||||
containing the specified datanode.
|
||||
*/
|
||||
extern OCerror oc_data_root(OClink, OCdatanode data, OCdatanode* rootp);
|
||||
EXTERNL OCerror oc_data_root(OClink, OCdatanode data, OCdatanode* rootp);
|
||||
|
||||
/*
|
||||
There are multiple ways to walk down a level in a data tree
|
||||
@ -373,33 +385,33 @@ or oc_data_readscalar.
|
||||
*/
|
||||
|
||||
/* Return the data node for the i'th field of the specified container data */
|
||||
extern OCerror oc_data_ithfield(OClink, OCdatanode container, size_t index,
|
||||
EXTERNL OCerror oc_data_ithfield(OClink, OCdatanode container, size_t index,
|
||||
OCdatanode* fieldp);
|
||||
|
||||
/* Retrieve the data node by name from a container data node */
|
||||
extern OCerror oc_dat_fieldbyname(OClink, OCdatanode, const char* name, OCdatanode* fieldp);
|
||||
EXTERNL OCerror oc_dat_fieldbyname(OClink, OCdatanode, const char* name, OCdatanode* fieldp);
|
||||
|
||||
/* Return the grid array data for the specified grid data */
|
||||
extern OCerror oc_data_gridarray(OClink, OCdatanode grid, OCdatanode* arrayp);
|
||||
EXTERNL OCerror oc_data_gridarray(OClink, OCdatanode grid, OCdatanode* arrayp);
|
||||
|
||||
/* Return the i'th grid map data for the specified grid data.
|
||||
NOTE: Map indices start at ZERO.
|
||||
*/
|
||||
extern OCerror oc_data_gridmap(OClink, OCdatanode grid, size_t index, OCdatanode* mapp);
|
||||
EXTERNL OCerror oc_data_gridmap(OClink, OCdatanode grid, size_t index, OCdatanode* mapp);
|
||||
|
||||
/* Return the data of a dimensioned Structure corresponding
|
||||
to the element specified by the indices.
|
||||
*/
|
||||
extern OCerror oc_data_ithelement(OClink, OCdatanode data, size_t* indices, OCdatanode* elementp);
|
||||
EXTERNL OCerror oc_data_ithelement(OClink, OCdatanode data, size_t* indices, OCdatanode* elementp);
|
||||
|
||||
/* Return the i'th record data of a Sequence data. */
|
||||
extern OCerror oc_data_ithrecord(OClink, OCdatanode data, size_t index, OCdatanode* recordp);
|
||||
EXTERNL OCerror oc_data_ithrecord(OClink, OCdatanode data, size_t index, OCdatanode* recordp);
|
||||
|
||||
/* Free up an data that is no longer being used */
|
||||
extern OCerror oc_data_free(OClink, OCdatanode data);
|
||||
EXTERNL OCerror oc_data_free(OClink, OCdatanode data);
|
||||
|
||||
/* Count the records associated with a sequence */
|
||||
extern OCerror oc_data_recordcount(OClink, OCdatanode, size_t*);
|
||||
EXTERNL OCerror oc_data_recordcount(OClink, OCdatanode, size_t*);
|
||||
|
||||
/* Return the actual data values associated with the specified leaf data.
|
||||
The OCdatanode is assumed to be referencing a leaf node that is
|
||||
@ -409,14 +421,14 @@ extern OCerror oc_data_recordcount(OClink, OCdatanode, size_t*);
|
||||
and free'ing it.
|
||||
See also oc_dds_read().
|
||||
*/
|
||||
extern OCerror oc_data_read(OClink, OCdatanode, size_t*, size_t*, size_t, void*);
|
||||
EXTERNL OCerror oc_data_read(OClink, OCdatanode, size_t*, size_t*, size_t, void*);
|
||||
|
||||
/* Like oc_data_read, but for reading a scalar.
|
||||
Caller is responsible for allocating memory(of proper size)
|
||||
and free'ing it.
|
||||
See also oc_dds_readscalar().
|
||||
*/
|
||||
extern OCerror oc_data_readscalar(OClink, OCdatanode, size_t, void*);
|
||||
EXTERNL OCerror oc_data_readscalar(OClink, OCdatanode, size_t, void*);
|
||||
|
||||
/* Like oc_data_read, but caller provides a starting set of indices
|
||||
and count of the number of elements to read.
|
||||
@ -424,81 +436,81 @@ extern OCerror oc_data_readscalar(OClink, OCdatanode, size_t, void*);
|
||||
and free'ing it.
|
||||
See also oc_dds_readn().
|
||||
*/
|
||||
extern OCerror oc_data_readn(OClink, OCdatanode, size_t*, size_t, size_t, void*);
|
||||
EXTERNL OCerror oc_data_readn(OClink, OCdatanode, size_t*, size_t, size_t, void*);
|
||||
|
||||
/* Return the indices for this datas; Assumes the data
|
||||
was obtained using oc_data_ithelement or oc_data_ithrecord;
|
||||
if not, then an error is returned.
|
||||
*/
|
||||
extern OCerror oc_data_position(OClink, OCdatanode data, size_t* indices);
|
||||
EXTERNL OCerror oc_data_position(OClink, OCdatanode data, size_t* indices);
|
||||
|
||||
/* Return the pattern dds node for an data */
|
||||
extern OCerror oc_data_ddsnode(OClink, OCdatanode data, OCddsnode*);
|
||||
EXTERNL OCerror oc_data_ddsnode(OClink, OCdatanode data, OCddsnode*);
|
||||
|
||||
/* Return the octype of the data (convenience) */
|
||||
extern OCerror oc_data_octype(OClink, OCdatanode data, OCtype*);
|
||||
EXTERNL OCerror oc_data_octype(OClink, OCdatanode data, OCtype*);
|
||||
|
||||
/* Return 1 if the specified data has a valid index, 0 otherwise.
|
||||
Valid index means it was created using
|
||||
oc_data_ithelement or oc_data_ithrecord.
|
||||
*/
|
||||
extern int oc_data_indexed(OClink link, OCdatanode datanode);
|
||||
EXTERNL int oc_data_indexed(OClink link, OCdatanode datanode);
|
||||
|
||||
/* Return 1 if the specified data has a valid index, 0 otherwise.
|
||||
Valid index means it was created using
|
||||
oc_data_ithelement or oc_data_ithrecord.
|
||||
*/
|
||||
extern int oc_data_indexed(OClink, OCdatanode);
|
||||
EXTERNL int oc_data_indexed(OClink, OCdatanode);
|
||||
|
||||
/* Return 1 if the specified data can be indexed
|
||||
Indexable means the data is pointing to
|
||||
an indexed structure or to a sequence.
|
||||
*/
|
||||
extern int oc_data_indexable(OClink, OCdatanode);
|
||||
EXTERNL int oc_data_indexable(OClink, OCdatanode);
|
||||
|
||||
/**************************************************/
|
||||
/*
|
||||
/*
|
||||
For top-level, atomic variables, it is possible to directly
|
||||
read the associated data without having to use the oc_data_XXX
|
||||
procedures. Provide special procedures to support this.
|
||||
*/
|
||||
|
||||
/* See oc_data_read for semantics */
|
||||
extern OCerror oc_dds_read(OClink, OCddsnode, size_t*, size_t*, size_t, void*);
|
||||
EXTERNL OCerror oc_dds_read(OClink, OCddsnode, size_t*, size_t*, size_t, void*);
|
||||
|
||||
/* See oc_data_readscalar for semantics */
|
||||
extern OCerror oc_dds_readscalar(OClink, OCddsnode, size_t, void*);
|
||||
EXTERNL OCerror oc_dds_readscalar(OClink, OCddsnode, size_t, void*);
|
||||
|
||||
/* See oc_data_readn for semantics */
|
||||
extern OCerror oc_dds_readn(OClink, OCddsnode, size_t*, size_t, size_t, void*);
|
||||
EXTERNL OCerror oc_dds_readn(OClink, OCddsnode, size_t*, size_t, size_t, void*);
|
||||
|
||||
/**************************************************/
|
||||
/* Misc. OCtype-related functions */
|
||||
|
||||
/* Return size of the given type(Atomic only) */
|
||||
extern size_t oc_typesize(OCtype);
|
||||
EXTERNL size_t oc_typesize(OCtype);
|
||||
|
||||
/* Return a canonical printable string describing a given type:
|
||||
e.g. Byte, Int16, etc.
|
||||
*/
|
||||
extern const char* oc_typetostring(OCtype);
|
||||
EXTERNL const char* oc_typetostring(OCtype);
|
||||
|
||||
/* Given a value of a atomic OC type, provide a canonical
|
||||
string representing that value; mostly for debugging.
|
||||
*/
|
||||
extern OCerror oc_typeprint(OCtype, void* value, size_t bufsize, char* buf);
|
||||
EXTERNL OCerror oc_typeprint(OCtype, void* value, size_t bufsize, char* buf);
|
||||
|
||||
/**************************************************/
|
||||
/* Logging */
|
||||
|
||||
extern void oc_loginit(void);
|
||||
extern int oc_setlogging(int onoff); /* 1=>start logging 0=>stop */
|
||||
extern int oc_logopen(const char* logfilename);
|
||||
extern void oc_logclose(void);
|
||||
EXTERNL void oc_loginit(void);
|
||||
EXTERNL int oc_setlogging(int onoff); /* 1=>start logging 0=>stop */
|
||||
EXTERNL int oc_logopen(const char* logfilename);
|
||||
EXTERNL void oc_logclose(void);
|
||||
|
||||
extern void oc_log(int tag, const char* fmt, ...);
|
||||
EXTERNL void oc_log(int tag, const char* fmt, ...);
|
||||
|
||||
extern void oc_logtext(int tag, const char* text);
|
||||
EXTERNL void oc_logtext(int tag, const char* text);
|
||||
|
||||
/**************************************************/
|
||||
/* Miscellaneous */
|
||||
@ -509,41 +521,41 @@ extern void oc_logtext(int tag, const char* text);
|
||||
Note that only the strings are reclaimed, the string vector
|
||||
is not reclaimed because it was presumably allocated by the client.
|
||||
*/
|
||||
extern void oc_reclaim_strings(size_t n, char** svec);
|
||||
EXTERNL void oc_reclaim_strings(size_t n, char** svec);
|
||||
|
||||
/* Convert an OCerror to a human readable string */
|
||||
extern const char* oc_errstring(OCerror err);
|
||||
EXTERNL const char* oc_errstring(OCerror err);
|
||||
|
||||
/* Get client parameters from the URL
|
||||
DO NOT free the result
|
||||
*/
|
||||
extern const char* oc_clientparam_get(OClink, const char* param);
|
||||
EXTERNL const char* oc_clientparam_get(OClink, const char* param);
|
||||
|
||||
/**************************************************/
|
||||
/* Merging operations */
|
||||
|
||||
/* Merge a specified DAS into a specified DDS or DATADDS */
|
||||
extern OCerror oc_merge_das(OClink, OCddsnode dasroot, OCddsnode ddsroot);
|
||||
EXTERNL OCerror oc_merge_das(OClink, OCddsnode dasroot, OCddsnode ddsroot);
|
||||
|
||||
/**************************************************/
|
||||
/* Debugging */
|
||||
|
||||
/* When a server error is detected, then it is possible
|
||||
to get DODS supplied server error info using this procedure */
|
||||
extern OCerror oc_svcerrordata(OClink link, char** codep,
|
||||
EXTERNL OCerror oc_svcerrordata(OClink link, char** codep,
|
||||
char** msgp, long* httpp);
|
||||
|
||||
/* Get the HTTP return code from the last call;
|
||||
note that this may or may not be the same as returned
|
||||
by oc_svcerrordata.
|
||||
*/
|
||||
extern int oc_httpcode(OClink);
|
||||
EXTERNL int oc_httpcode(OClink);
|
||||
|
||||
/*
|
||||
(Re-)initialize the oc library as if nothing had been called.
|
||||
This is primarily for debugging of rc files.
|
||||
*/
|
||||
extern OCerror oc_initialize(void);
|
||||
EXTERNL OCerror oc_initialize(void);
|
||||
|
||||
/**************************************************/
|
||||
/* Curl options */
|
||||
@ -552,37 +564,37 @@ extern OCerror oc_initialize(void);
|
||||
*/
|
||||
|
||||
/*Cause the curl library to be verbose and save error messages*/
|
||||
extern OCerror oc_trace_curl(OClink link);
|
||||
EXTERNL OCerror oc_trace_curl(OClink link);
|
||||
|
||||
/* Allow specification of the rc file */
|
||||
extern OCerror oc_set_rcfile(const char* filepath);
|
||||
EXTERNL OCerror oc_set_rcfile(const char* filepath);
|
||||
|
||||
/* Allow specification of the netrc file */
|
||||
extern OCerror oc_set_netrc(OClink*, const char* filepath);
|
||||
EXTERNL OCerror oc_set_netrc(OClink*, const char* filepath);
|
||||
|
||||
/* Set arbitrary curl option */
|
||||
extern OCerror oc_set_curlopt(OClink link, const char* option, void* value);
|
||||
EXTERNL OCerror oc_set_curlopt(OClink link, const char* option, void* value);
|
||||
|
||||
/**************************************************/
|
||||
/* Experimental/Undocumented */
|
||||
|
||||
/* Given an arbitrary OCnode, return the connection of which it is a part */
|
||||
extern OCerror oc_get_connection(OCobject ocnode, OCobject* linkp);
|
||||
EXTERNL OCerror oc_get_connection(OCobject ocnode, OCobject* linkp);
|
||||
|
||||
/* Resend a url as a head request to check the Last-Modified time */
|
||||
extern OCerror oc_update_lastmodified_data(OClink);
|
||||
EXTERNL OCerror oc_update_lastmodified_data(OClink);
|
||||
|
||||
/* Get last known modification time; -1 => data unknown */
|
||||
extern long oc_get_lastmodified_data(OClink);
|
||||
EXTERNL long oc_get_lastmodified_data(OClink);
|
||||
|
||||
/* Test if a given url responds to a DAP protocol request */
|
||||
extern OCerror oc_ping(const char* url);
|
||||
EXTERNL OCerror oc_ping(const char* url);
|
||||
|
||||
/* Return the size of the in-memory or on-disk
|
||||
data chunk returned by the server for a given tree.
|
||||
Zero implies it is not defined.
|
||||
*/
|
||||
extern OCerror oc_raw_xdrsize(OClink,OCddsnode,off_t*);
|
||||
EXTERNL OCerror oc_raw_xdrsize(OClink,OCddsnode,off_t*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ about how IO is getting along.
|
||||
*/
|
||||
#undef OCPROGRESS
|
||||
|
||||
extern int ocdebug;
|
||||
extern int cedebug;
|
||||
EXTERNL int ocdebug;
|
||||
EXTERNL int cedebug;
|
||||
|
||||
/*extern char* dent2(int n);*/
|
||||
/*/extern char* dent(int n);*/
|
||||
@ -103,4 +103,3 @@ extern CURLcode ocreportcurlerror(struct OCstate* state, CURLcode cstat);
|
||||
#define OCTHROWCHK(e) OCCATCHCHK(e)
|
||||
|
||||
#endif /*OCOCDBG_H*/
|
||||
|
||||
|
23
oc2/ocx.h
23
oc2/ocx.h
@ -9,6 +9,20 @@ Internal library debugging interface
|
||||
#ifndef OCX_H
|
||||
#define OCX_H
|
||||
|
||||
/* Declaration modifiers for DLL support (MSC et al) */
|
||||
#if defined(DLL_NETCDF) /* define when library is a DLL */
|
||||
# if defined(DLL_EXPORT) /* define when building the library */
|
||||
# define MSC_EXTRA __declspec(dllexport)
|
||||
# else
|
||||
# define MSC_EXTRA __declspec(dllimport)
|
||||
# endif
|
||||
# include <io.h>
|
||||
#else
|
||||
#define MSC_EXTRA /**< Needed for DLL build. */
|
||||
#endif /* defined(DLL_NETCDF) */
|
||||
|
||||
#define EXTERNL MSC_EXTRA extern /**< Needed for DLL build. */
|
||||
|
||||
/**************************************************/
|
||||
/* Flags defining the structure of an OCdata object */
|
||||
|
||||
@ -24,10 +38,9 @@ typedef unsigned int OCDT;
|
||||
/* Return mode for this data */
|
||||
extern OCerror oc_data_mode(OClink, OCdatanode, OCDT* modep);
|
||||
|
||||
extern OCerror oc_dds_dd(OClink, OCddsnode, int);
|
||||
extern OCerror oc_dds_ddnode(OClink, OCddsnode);
|
||||
extern OCerror oc_data_ddpath(OClink, OCdatanode, char**);
|
||||
extern OCerror oc_data_ddtree(OClink, OCdatanode root);
|
||||
EXTERNL OCerror oc_dds_dd(OClink, OCddsnode, int);
|
||||
EXTERNL OCerror oc_dds_ddnode(OClink, OCddsnode);
|
||||
EXTERNL OCerror oc_data_ddpath(OClink, OCdatanode, char**);
|
||||
EXTERNL OCerror oc_data_ddtree(OClink, OCdatanode root);
|
||||
|
||||
#endif /*OCX_H*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user