mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
update nchashmap; move some old stuff in libdap2; fix new debug code
This commit is contained in:
parent
4d6f11288b
commit
2a0d68c530
@ -6,8 +6,8 @@
|
||||
|
||||
typedef struct NCbytes {
|
||||
int nonextendible; /* 1 => fail if an attempt is made to extend this buffer*/
|
||||
unsigned int alloc;
|
||||
unsigned int length;
|
||||
unsigned long alloc;
|
||||
unsigned long length;
|
||||
char* content;
|
||||
} NCbytes;
|
||||
|
||||
@ -19,8 +19,8 @@ typedef struct NCbytes {
|
||||
|
||||
EXTERNC NCbytes* ncbytesnew(void);
|
||||
EXTERNC void ncbytesfree(NCbytes*);
|
||||
EXTERNC int ncbytessetalloc(NCbytes*,unsigned int);
|
||||
EXTERNC int ncbytessetlength(NCbytes*,unsigned int);
|
||||
EXTERNC int ncbytessetalloc(NCbytes*,unsigned long);
|
||||
EXTERNC int ncbytessetlength(NCbytes*,unsigned long);
|
||||
EXTERNC int ncbytesfill(NCbytes*, char fill);
|
||||
|
||||
/* Produce a duplicate of the contents*/
|
||||
@ -29,14 +29,14 @@ EXTERNC char* ncbytesdup(NCbytes*);
|
||||
EXTERNC char* ncbytesextract(NCbytes*);
|
||||
|
||||
/* Return the ith byte; -1 if no such index */
|
||||
EXTERNC int ncbytesget(NCbytes*,unsigned int);
|
||||
EXTERNC int ncbytesget(NCbytes*,unsigned long);
|
||||
/* Set the ith byte */
|
||||
EXTERNC int ncbytesset(NCbytes*,unsigned int,char);
|
||||
EXTERNC int ncbytesset(NCbytes*,unsigned long,char);
|
||||
|
||||
/* Append one byte */
|
||||
EXTERNC int ncbytesappend(NCbytes*,char); /* Add at Tail */
|
||||
/* Append n bytes */
|
||||
EXTERNC int ncbytesappendn(NCbytes*,const void*,unsigned int); /* Add at Tail */
|
||||
EXTERNC int ncbytesappendn(NCbytes*,const void*,unsigned long); /* Add at Tail */
|
||||
|
||||
/* Null terminate the byte string without extending its length (for debugging) */
|
||||
EXTERNC int ncbytesnull(NCbytes*);
|
||||
@ -45,14 +45,14 @@ EXTERNC int ncbytesnull(NCbytes*);
|
||||
EXTERNC int ncbytescat(NCbytes*,const char*);
|
||||
|
||||
/* Set the contents of the buffer; mark the buffer as non-extendible */
|
||||
EXTERNC int ncbytessetcontents(NCbytes*, char*, unsigned int);
|
||||
EXTERNC int ncbytessetcontents(NCbytes*, char*, unsigned long);
|
||||
|
||||
/* Following are always "in-lined"*/
|
||||
#define ncbyteslength(bb) ((bb)!=NULL?(bb)->length:0U)
|
||||
#define ncbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0U)
|
||||
#define ncbyteslength(bb) ((bb)!=NULL?(bb)->length:0)
|
||||
#define ncbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0)
|
||||
#define ncbytescontents(bb) (((bb)!=NULL && (bb)->content!=NULL)?(bb)->content:(char*)"")
|
||||
#define ncbytesextend(bb,len) ncbytessetalloc((bb),(len)+(bb->alloc))
|
||||
#define ncbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0U)
|
||||
#define ncbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0U)
|
||||
#define ncbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0)
|
||||
#define ncbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0)
|
||||
|
||||
#endif /*NCBYTES_H*/
|
||||
|
@ -1,24 +1,23 @@
|
||||
/*********************************************************************
|
||||
* Copyright 1993, UCAR/Unidata
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
* $Header: /upc/share/CVS/netcdf-3/libncdap3/nchashmap.h,v 1.4 2009/09/23 22:26:08 dmh Exp $
|
||||
* $Header$
|
||||
*********************************************************************/
|
||||
#ifndef NCHASHMAP_H
|
||||
#define NCHASHMAP_H 1
|
||||
|
||||
#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__)
|
||||
#define externC extern "C"
|
||||
#else
|
||||
#define externC extern
|
||||
#endif
|
||||
|
||||
#include "nclist.h"
|
||||
|
||||
/* Define the type of the elements in the hashmap*/
|
||||
|
||||
#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__)
|
||||
#define EXTERNC extern "C"
|
||||
#else
|
||||
#define EXTERNC extern
|
||||
#endif
|
||||
|
||||
typedef unsigned long nchashid;
|
||||
|
||||
EXTERNC int nchashnull(ncelem);
|
||||
externC int nchashnull(void*);
|
||||
|
||||
typedef struct NChashmap {
|
||||
int alloc;
|
||||
@ -26,32 +25,32 @@ typedef struct NChashmap {
|
||||
NClist** table;
|
||||
} NChashmap;
|
||||
|
||||
EXTERNC NChashmap* nchashnew(void);
|
||||
EXTERNC NChashmap* nchashnew0(int);
|
||||
EXTERNC int nchashfree(NChashmap*);
|
||||
externC NChashmap* nchashnew(void);
|
||||
externC NChashmap* nchashnew0(int);
|
||||
externC int nchashfree(NChashmap*);
|
||||
|
||||
/* Insert a (ncnchashid,ncelem) pair into the table*/
|
||||
/* Insert a (ncnchashid,void*) pair into the table*/
|
||||
/* Fail if already there*/
|
||||
EXTERNC int nchashinsert(NChashmap*, nchashid nchash, ncelem value);
|
||||
externC int nchashinsert(NChashmap*, nchashid nchash, void* value);
|
||||
|
||||
/* Insert a (nchashid,ncelem) pair into the table*/
|
||||
/* Insert a (nchashid,void*) pair into the table*/
|
||||
/* Overwrite if already there*/
|
||||
EXTERNC int nchashreplace(NChashmap*, nchashid nchash, ncelem value);
|
||||
externC int nchashreplace(NChashmap*, nchashid nchash, void* value);
|
||||
|
||||
/* lookup a nchashid and return found/notfound*/
|
||||
EXTERNC int nchashlookup(NChashmap*, nchashid nchash, ncelem* valuep);
|
||||
externC int nchashlookup(NChashmap*, nchashid nchash, void** valuep);
|
||||
|
||||
/* lookup a nchashid and return 0 or the value*/
|
||||
EXTERNC ncelem nchashget(NChashmap*, nchashid nchash);
|
||||
externC void* nchashget(NChashmap*, nchashid nchash);
|
||||
|
||||
/* remove a nchashid*/
|
||||
EXTERNC int nchashremove(NChashmap*, nchashid nchash);
|
||||
externC int nchashremove(NChashmap*, nchashid nchash);
|
||||
|
||||
/* Return the ith pair; order is completely arbitrary*/
|
||||
/* Can be expensive*/
|
||||
EXTERNC int nchashith(NChashmap*, int i, nchashid*, ncelem*);
|
||||
externC int nchashith(NChashmap*, int i, nchashid*, void**);
|
||||
|
||||
EXTERNC int nchashkeys(NChashmap* hm, nchashid** keylist);
|
||||
externC int nchashkeys(NChashmap* hm, nchashid** keylist);
|
||||
|
||||
/* return the # of pairs in table*/
|
||||
#define nchashsize(hm) ((hm)?(hm)->size:0)
|
||||
|
@ -11,43 +11,41 @@
|
||||
#define EXTERNC extern
|
||||
#endif
|
||||
|
||||
typedef void* ncelem;
|
||||
|
||||
EXTERNC int nclistnull(ncelem);
|
||||
EXTERNC int nclistnull(void*);
|
||||
|
||||
typedef struct NClist {
|
||||
unsigned int alloc;
|
||||
unsigned int length;
|
||||
ncelem* content;
|
||||
unsigned long alloc;
|
||||
unsigned long length;
|
||||
void** content;
|
||||
} NClist;
|
||||
|
||||
EXTERNC NClist* nclistnew(void);
|
||||
EXTERNC int nclistfree(NClist*);
|
||||
EXTERNC int nclistsetalloc(NClist*,unsigned int);
|
||||
EXTERNC int nclistsetlength(NClist*,unsigned int);
|
||||
EXTERNC int nclistsetalloc(NClist*,unsigned long);
|
||||
EXTERNC int nclistsetlength(NClist*,unsigned long);
|
||||
|
||||
/* Set the ith element */
|
||||
EXTERNC int nclistset(NClist*,unsigned int,ncelem);
|
||||
EXTERNC int nclistset(NClist*,unsigned long,void*);
|
||||
/* Get value at position i */
|
||||
EXTERNC ncelem nclistget(NClist*,unsigned int);/* Return the ith element of l */
|
||||
EXTERNC void* nclistget(NClist*,unsigned long);/* Return the ith element of l */
|
||||
/* Insert at position i; will push up elements i..|seq|. */
|
||||
EXTERNC int nclistinsert(NClist*,unsigned int,ncelem);
|
||||
EXTERNC int nclistinsert(NClist*,unsigned long,void*);
|
||||
/* Remove element at position i; will move higher elements down */
|
||||
EXTERNC ncelem nclistremove(NClist* l, unsigned int i);
|
||||
EXTERNC void* nclistremove(NClist* l, unsigned long i);
|
||||
|
||||
/* Tail operations */
|
||||
EXTERNC int nclistpush(NClist*,ncelem); /* Add at Tail */
|
||||
EXTERNC ncelem nclistpop(NClist*);
|
||||
EXTERNC ncelem nclisttop(NClist*);
|
||||
EXTERNC int nclistpush(NClist*,void*); /* Add at Tail */
|
||||
EXTERNC void* nclistpop(NClist*);
|
||||
EXTERNC void* nclisttop(NClist*);
|
||||
|
||||
/* Duplicate and return the content (null terminate) */
|
||||
EXTERNC ncelem* nclistdup(NClist*);
|
||||
EXTERNC void** nclistdup(NClist*);
|
||||
|
||||
/* Look for value match */
|
||||
EXTERNC int nclistcontains(NClist*, ncelem);
|
||||
EXTERNC int nclistcontains(NClist*, void*);
|
||||
|
||||
/* Remove element by value; only removes first encountered */
|
||||
EXTERNC int nclistelemremove(NClist* l, ncelem elem);
|
||||
EXTERNC int nclistelemremove(NClist* l, void* elem);
|
||||
|
||||
/* remove duplicates */
|
||||
EXTERNC int nclistunique(NClist*);
|
||||
@ -56,9 +54,9 @@ EXTERNC int nclistunique(NClist*);
|
||||
EXTERNC NClist* nclistclone(NClist*);
|
||||
|
||||
/* Following are always "in-lined"*/
|
||||
#define nclistclear(l) nclistsetlength((l),0U)
|
||||
#define nclistclear(l) nclistsetlength((l),0)
|
||||
#define nclistextend(l,len) nclistsetalloc((l),(len)+(l->alloc))
|
||||
#define nclistcontents(l) ((l)==NULL?NULL:(l)->content)
|
||||
#define nclistlength(l) ((l)==NULL?0U:(l)->length)
|
||||
#define nclistlength(l) ((l)==NULL?0:(l)->length)
|
||||
|
||||
#endif /*NCLIST_H*/
|
||||
|
@ -60,7 +60,7 @@ iscached(NCDAPCOMMON* nccomm, CDFnode* target, NCcachenode** cachenodep)
|
||||
if(nclistlength(cache->nodes) > 1) {
|
||||
/* Manage the cache nodes as LRU */
|
||||
nclistremove(cache->nodes,index);
|
||||
nclistpush(cache->nodes,(ncelem)cachenode);
|
||||
nclistpush(cache->nodes,(void*)cachenode);
|
||||
}
|
||||
if(cachenodep) *cachenodep = cachenode;
|
||||
}
|
||||
@ -117,7 +117,7 @@ prefetchdata3(NCDAPCOMMON* nccomm)
|
||||
/* Do not attempt to prefetch any variables in the
|
||||
nc_open url's projection list
|
||||
*/
|
||||
if(nclistcontains(nccomm->cdf.projectedvars,(ncelem)var))
|
||||
if(nclistcontains(nccomm->cdf.projectedvars,(void*)var))
|
||||
continue;
|
||||
|
||||
if(!isnc4) {
|
||||
@ -134,7 +134,7 @@ if(SHOWFETCH) {
|
||||
nclog(NCLOGDBG,"prefetch: %s=%lu",var->ncfullname,(unsigned long)nelems);
|
||||
}
|
||||
if(nelems <= nccomm->cdf.smallsizelimit) {
|
||||
nclistpush(vars,(ncelem)var);
|
||||
nclistpush(vars,(void*)var);
|
||||
if(SHOWFETCH) {
|
||||
nclog(NCLOGDBG,"prefetch: %s",var->ncfullname);
|
||||
}
|
||||
@ -162,7 +162,7 @@ nclog(NCLOGDBG,"prefetch: %s",var->ncfullname);
|
||||
/* convert var to a projection */
|
||||
ncstat = dapvar2projection(var,&varprojection);
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
nclistpush(newconstraint->projections,(ncelem)varprojection);
|
||||
nclistpush(newconstraint->projections,(void*)varprojection);
|
||||
}
|
||||
if(SHOWFETCH) {
|
||||
char* s = dumpprojections(newconstraint->projections);
|
||||
@ -284,7 +284,7 @@ fprintf(stderr,"buildcachenode: count purge cache node: %s\n",
|
||||
cache->cachesize -= node->xdrsize;
|
||||
freenccachenode(nccomm,node);
|
||||
}
|
||||
nclistpush(nccomm->cdf.cache->nodes,(ncelem)cachenode);
|
||||
nclistpush(nccomm->cdf.cache->nodes,(void*)cachenode);
|
||||
cache->cachesize += cachenode->xdrsize;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,10 @@ computecdfnodesets3(NCDAPCOMMON* nccomm)
|
||||
if(!node->visible) continue;
|
||||
switch (node->nctype) {
|
||||
case NC_Sequence:
|
||||
nclistpush(nccomm->cdf.seqnodes,(ncelem)node);
|
||||
nclistpush(nccomm->cdf.seqnodes,(void*)node);
|
||||
break;
|
||||
case NC_Grid:
|
||||
nclistpush(nccomm->cdf.gridnodes,(ncelem)node);
|
||||
nclistpush(nccomm->cdf.gridnodes,(void*)node);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@ -69,7 +69,7 @@ computevarnodes3(NCDAPCOMMON* nccomm, NClist* allnodes, NClist* varnodes)
|
||||
}
|
||||
if(!node->visible) continue;
|
||||
if(node->nctype == NC_Atomic)
|
||||
nclistpush(allvarnodes,(ncelem)node);
|
||||
nclistpush(allvarnodes,(void*)node);
|
||||
}
|
||||
/* Further process the variable nodes to get the final set */
|
||||
/* Use toplevel vars first */
|
||||
@ -78,8 +78,8 @@ computevarnodes3(NCDAPCOMMON* nccomm, NClist* allnodes, NClist* varnodes)
|
||||
CDFnode* node = (CDFnode*)nclistget(allvarnodes,i);
|
||||
if(node == NULL) continue;
|
||||
if(daptoplevel(node)) {
|
||||
nclistpush(varnodes,(ncelem)node);
|
||||
nclistset(allvarnodes,i,(ncelem)NULL);
|
||||
nclistpush(varnodes,(void*)node);
|
||||
nclistset(allvarnodes,i,(void*)NULL);
|
||||
}
|
||||
}
|
||||
/*... then grid arrays and maps.
|
||||
@ -90,19 +90,19 @@ computevarnodes3(NCDAPCOMMON* nccomm, NClist* allnodes, NClist* varnodes)
|
||||
CDFnode* node = (CDFnode*)nclistget(allvarnodes,i);
|
||||
if(node == NULL) continue;
|
||||
if(dapgridarray(node)) {
|
||||
nclistpush(varnodes,(ncelem)node);
|
||||
nclistset(allvarnodes,i,(ncelem)NULL);
|
||||
nclistpush(varnodes,(void*)node);
|
||||
nclistset(allvarnodes,i,(void*)NULL);
|
||||
} else if(dapgridmap(node)) {
|
||||
if(!FLAGSET(nccomm->controls,NCF_NCDAP))
|
||||
nclistpush(varnodes,(ncelem)node);
|
||||
nclistset(allvarnodes,i,(ncelem)NULL);
|
||||
nclistpush(varnodes,(void*)node);
|
||||
nclistset(allvarnodes,i,(void*)NULL);
|
||||
}
|
||||
}
|
||||
/*... then all others */
|
||||
for(i=0;i<len;i++) {
|
||||
CDFnode* node = (CDFnode*)nclistget(allvarnodes,i);
|
||||
if(node == NULL) continue;
|
||||
nclistpush(varnodes,(ncelem)node);
|
||||
nclistpush(varnodes,(void*)node);
|
||||
}
|
||||
nclistfree(allvarnodes);
|
||||
#ifdef DEBUG2
|
||||
@ -250,7 +250,7 @@ sequencecheck3r(CDFnode* node, NClist* vars, CDFnode* topseq)
|
||||
node->usesequence = 0;
|
||||
err = NC_EINVAL;
|
||||
}
|
||||
} else if(nclistcontains(vars,(ncelem)node)) {
|
||||
} else if(nclistcontains(vars,(void*)node)) {
|
||||
/* If we reach a leaf, then topseq is usable, so save it */
|
||||
node->array.sequence = topseq;
|
||||
} else { /* Some kind of non-sequence container node with no dimensions */
|
||||
@ -407,9 +407,9 @@ structwrap3(CDFnode* node, CDFnode* parent, int parentindex,
|
||||
/* replace the node with the new structure
|
||||
in the parent's list of children*/
|
||||
nclistremove(parent->subnodes,parentindex);
|
||||
nclistinsert(parent->subnodes,parentindex,(ncelem)newstruct);
|
||||
nclistinsert(parent->subnodes,parentindex,(void*)newstruct);
|
||||
/* Update the list of all nodes in the tree */
|
||||
nclistpush(node->root->tree->nodes,(ncelem)newstruct);
|
||||
nclistpush(node->root->tree->nodes,(void*)newstruct);
|
||||
|
||||
done:
|
||||
return ncstat;
|
||||
@ -434,7 +434,7 @@ makenewstruct3(CDFnode* node, CDFnode* templatenode)
|
||||
newstruct->container = node->container;
|
||||
newstruct->template = templatenode;
|
||||
node->container = newstruct;
|
||||
nclistpush(newstruct->subnodes,(ncelem)node);
|
||||
nclistpush(newstruct->subnodes,(void*)node);
|
||||
return newstruct;
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ clonedim(NCDAPCOMMON* nccomm, CDFnode* dim, CDFnode* var)
|
||||
clone = makecdfnode34(nccomm,dim->ocname,OC_Dimension,
|
||||
NULL,dim->container);
|
||||
/* Record its existence */
|
||||
nclistpush(dim->container->root->tree->nodes,(ncelem)clone);
|
||||
nclistpush(dim->container->root->tree->nodes,(void*)clone);
|
||||
clone->dim = dim->dim; /* copy most everything */
|
||||
clone->dim.dimflags |= CDFDIMCLONE;
|
||||
clone->dim.array = var;
|
||||
@ -584,7 +584,7 @@ clonedimset3(NCDAPCOMMON* nccomm, NClist* dimset, CDFnode* var)
|
||||
int i;
|
||||
for(i=0;i<nclistlength(dimset);i++) {
|
||||
CDFnode* dim = (CDFnode*)nclistget(dimset,i);
|
||||
nclistpush(result,(ncelem)clonedim(nccomm,dim,var));
|
||||
nclistpush(result,(void*)clonedim(nccomm,dim,var));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -606,11 +606,11 @@ definedimsetplus3(NCDAPCOMMON* nccomm, CDFnode* node)
|
||||
/* Insert the sequence or string dims */
|
||||
if(node->array.stringdim != NULL) {
|
||||
clone = node->array.stringdim;
|
||||
nclistpush(dimset,(ncelem)clone);
|
||||
nclistpush(dimset,(void*)clone);
|
||||
}
|
||||
if(node->array.seqdim != NULL) {
|
||||
clone = node->array.seqdim;
|
||||
nclistpush(dimset,(ncelem)clone);
|
||||
nclistpush(dimset,(void*)clone);
|
||||
}
|
||||
node->array.dimsetplus = dimset;
|
||||
return ncstat;
|
||||
@ -644,7 +644,7 @@ fprintf(stderr,"dimsetall: recurse to container%s\n",node->container->ocname);
|
||||
// concat parentall and dimset;
|
||||
for(i=0;i<nclistlength(node->array.dimsetplus);i++) {
|
||||
CDFnode* clone = (CDFnode*)nclistget(node->array.dimsetplus,i);
|
||||
nclistpush(dimsetall,(ncelem)clone);
|
||||
nclistpush(dimsetall,(void*)clone);
|
||||
}
|
||||
node->array.dimsetall = dimsetall;
|
||||
#ifdef DEBUG1
|
||||
|
@ -152,7 +152,7 @@ replacedims(NClist* dims)
|
||||
CDFnode* dim = (CDFnode*)nclistget(dims,i);
|
||||
CDFnode* basedim = dim->dim.basedim;
|
||||
if(basedim == NULL) continue;
|
||||
nclistset(dims,i,(ncelem)basedim);
|
||||
nclistset(dims,i,(void*)basedim);
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ fprintf(stderr,"conflict: %s[%lu] %s[%lu]\n",
|
||||
basedim->ncfullname,(unsigned long)basedim->dim.declsize,
|
||||
dim->ncfullname,(unsigned long)dim->dim.declsize);
|
||||
#endif
|
||||
nclistpush(conflicts,(ncelem)dim);
|
||||
nclistpush(conflicts,(void*)dim);
|
||||
}
|
||||
/* Give all the conflicting dimensions an index */
|
||||
for(j=0;j<nclistlength(conflicts);j++) {
|
||||
@ -273,8 +273,8 @@ fprintf(stderr,"conflict: %s[%lu] %s[%lu]\n",
|
||||
for(i=0;i<nclistlength(alldims);i++) {
|
||||
CDFnode* dim = (CDFnode*)nclistget(alldims,i);
|
||||
if(dim->dim.basedim == NULL) {
|
||||
if(!nclistcontains(basedims,(ncelem)dim)) {
|
||||
nclistpush(basedims,(ncelem)dim);
|
||||
if(!nclistcontains(basedims,(void*)dim)) {
|
||||
nclistpush(basedims,(void*)dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -452,7 +452,7 @@ buildcdftree34r(NCDAPCOMMON* nccomm, OCddsnode ocnode, CDFnode* container,
|
||||
case OC_Structure:
|
||||
case OC_Sequence:
|
||||
cdfnode = makecdfnode34(nccomm,ocname,octype,ocnode,container);
|
||||
nclistpush(tree->nodes,(ncelem)cdfnode);
|
||||
nclistpush(tree->nodes,(void*)cdfnode);
|
||||
if(tree->root == NULL) {
|
||||
tree->root = cdfnode;
|
||||
cdfnode->tree = tree;
|
||||
@ -461,7 +461,7 @@ buildcdftree34r(NCDAPCOMMON* nccomm, OCddsnode ocnode, CDFnode* container,
|
||||
|
||||
case OC_Atomic:
|
||||
cdfnode = makecdfnode34(nccomm,ocname,octype,ocnode,container);
|
||||
nclistpush(tree->nodes,(ncelem)cdfnode);
|
||||
nclistpush(tree->nodes,(void*)cdfnode);
|
||||
if(tree->root == NULL) {
|
||||
tree->root = cdfnode;
|
||||
cdfnode->tree = tree;
|
||||
@ -482,7 +482,7 @@ buildcdftree34r(NCDAPCOMMON* nccomm, OCddsnode ocnode, CDFnode* container,
|
||||
oc_dds_ithfield(nccomm->oc.conn,ocnode,i,&ocsubnode);
|
||||
ncerr = buildcdftree34r(nccomm,ocsubnode,cdfnode,tree,&subnode);
|
||||
if(ncerr) return ncerr;
|
||||
nclistpush(cdfnode->subnodes,(ncelem)subnode);
|
||||
nclistpush(cdfnode->subnodes,(void*)subnode);
|
||||
}
|
||||
nullfree(ocname);
|
||||
if(cdfnodep) *cdfnodep = cdfnode;
|
||||
@ -508,13 +508,13 @@ defdimensions(OCddsnode ocnode, CDFnode* cdfnode, NCDAPCOMMON* nccomm, CDFtree*
|
||||
cdfdim = makecdfnode34(nccomm,ocname,OC_Dimension,
|
||||
ocdim,cdfnode->container);
|
||||
nullfree(ocname);
|
||||
nclistpush(tree->nodes,(ncelem)cdfdim);
|
||||
nclistpush(tree->nodes,(void*)cdfdim);
|
||||
/* Initially, constrained and unconstrained are same */
|
||||
cdfdim->dim.declsize = declsize;
|
||||
cdfdim->dim.array = cdfnode;
|
||||
if(cdfnode->array.dimset0 == NULL)
|
||||
cdfnode->array.dimset0 = nclistnew();
|
||||
nclistpush(cdfnode->array.dimset0,(ncelem)cdfdim);
|
||||
nclistpush(cdfnode->array.dimset0,(void*)cdfdim);
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,12 +905,12 @@ getalldims34a(NClist* dimset, NClist* alldims)
|
||||
int i;
|
||||
for(i=0;i<nclistlength(dimset);i++) {
|
||||
CDFnode* dim = (CDFnode*)nclistget(dimset,i);
|
||||
if(!nclistcontains(alldims,(ncelem)dim)) {
|
||||
if(!nclistcontains(alldims,(void*)dim)) {
|
||||
#ifdef DEBUG3
|
||||
fprintf(stderr,"getalldims: %s[%lu]\n",
|
||||
dim->ncfullname,(unsigned long)dim->dim.declsize);
|
||||
#endif
|
||||
nclistpush(alldims,(ncelem)dim);
|
||||
nclistpush(alldims,(void*)dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ completesegments3(NClist* fullpath, NClist* segments)
|
||||
seg->name = nulldup(node->ocname);
|
||||
seg->annotation = (void*)node;
|
||||
seg->rank = nclistlength(node->array.dimset0);
|
||||
nclistinsert(segments,i,(ncelem)seg);
|
||||
nclistinsert(segments,i,(void*)seg);
|
||||
}
|
||||
/* Now modify the segments to point to the appropriate node
|
||||
and fill in the slices.
|
||||
@ -257,7 +257,7 @@ matchpartialname3(NClist* nodes, NClist* segments, CDFnode** nodep)
|
||||
&& node->nctype != NC_Atomic
|
||||
)
|
||||
continue;
|
||||
nclistpush(namematches,(ncelem)node);
|
||||
nclistpush(namematches,(void*)node);
|
||||
}
|
||||
if(nclistlength(namematches)==0) {
|
||||
nclog(NCLOGERR,"No match for projection name: %s",lastseg->name);
|
||||
@ -272,7 +272,7 @@ matchpartialname3(NClist* nodes, NClist* segments, CDFnode** nodep)
|
||||
collectnodepath3(matchnode,matchpath,0);
|
||||
/* Do a suffix match */
|
||||
if(matchsuffix3(matchpath,segments)) {
|
||||
nclistpush(matches,(ncelem)matchnode);
|
||||
nclistpush(matches,(void*)matchnode);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"matchpartialname: pathmatch: %s :: %s\n",
|
||||
matchnode->ncfullname,dumpsegments(segments));
|
||||
@ -585,7 +585,7 @@ fprintf(stderr,"fixprojection: list = %s\n",dumpprojections(list));
|
||||
nclog(NCLOGWARN,"Malformed projection: same variable with different slicing");
|
||||
}
|
||||
/* remove p32 */
|
||||
nclistset(list,j,(ncelem)NULL);
|
||||
nclistset(list,j,(void*)NULL);
|
||||
dcefree((DCEnode*)p2);
|
||||
}
|
||||
}
|
||||
@ -606,7 +606,7 @@ fprintf(stderr,"fixprojection: list = %s\n",dumpprojections(list));
|
||||
for(k=0;k<nclistlength(tmp);k++) {
|
||||
void* candidate = (void*)nclistget(tmp,k);
|
||||
if(candidate == p1->var->annotation) {
|
||||
nclistset(list,i,(ncelem)NULL);
|
||||
nclistset(list,i,(void*)NULL);
|
||||
dcefree((DCEnode*)p1);
|
||||
goto next;
|
||||
}
|
||||
@ -627,9 +627,9 @@ next: continue;
|
||||
leaf = (CDFnode*)target->var->annotation;
|
||||
ASSERT(leaf != NULL);
|
||||
if(iscontainer(leaf)) {/* capture container */
|
||||
if(!nclistcontains(tmp,(ncelem)target))
|
||||
nclistpush(tmp,(ncelem)target);
|
||||
nclistset(list,i,(ncelem)NULL);
|
||||
if(!nclistcontains(tmp,(void*)target))
|
||||
nclistpush(tmp,(void*)target);
|
||||
nclistset(list,i,(void*)NULL);
|
||||
}
|
||||
}
|
||||
if(nclistlength(tmp) == 0) break; /*done*/
|
||||
@ -641,7 +641,7 @@ next: continue;
|
||||
CDFnode* field = (CDFnode*)nclistget(leaf->subnodes,j);
|
||||
/* Convert field node to a proper constraint */
|
||||
DCEprojection* proj = projectify(field,container);
|
||||
nclistpush(list,(ncelem)proj);
|
||||
nclistpush(list,(void*)proj);
|
||||
}
|
||||
/* reclaim the container */
|
||||
dcefree((DCEnode*)container);
|
||||
@ -684,7 +684,7 @@ projectify(CDFnode* field, DCEprojection* container)
|
||||
/* Dup the segment list */
|
||||
var->segments = dceclonelist(container->var->segments);
|
||||
seg->rank = 0;
|
||||
nclistpush(var->segments,(ncelem)seg);
|
||||
nclistpush(var->segments,(void*)seg);
|
||||
return proj;
|
||||
}
|
||||
|
||||
@ -753,7 +753,7 @@ dapvar2projection(CDFnode* var, DCEprojection** projectionp)
|
||||
segment->slicesdefined = 1;
|
||||
segment->slicesdeclized = 1;
|
||||
dimindex += localrank;
|
||||
nclistpush(segments,(ncelem)segment);
|
||||
nclistpush(segments,(void*)segment);
|
||||
}
|
||||
|
||||
projection = (DCEprojection*)dcecreate(CES_PROJECT);
|
||||
@ -890,8 +890,8 @@ computeprojectedvars(NCDAPCOMMON* dapcomm, DCEconstraint* constraint)
|
||||
DCEprojection* proj = (DCEprojection*)nclistget(constraint->projections,i);
|
||||
if(proj->discrim == CES_FCN) continue; /* ignore these */
|
||||
node = (CDFnode*)proj->var->annotation;
|
||||
if(!nclistcontains(vars,(ncelem)node)) {
|
||||
nclistpush(vars,(ncelem)node);
|
||||
if(!nclistcontains(vars,(void*)node)) {
|
||||
nclistpush(vars,(void*)node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ dapmerge3(NCDAPCOMMON* nccomm, CDFnode* ddsroot, OCddsnode dasroot)
|
||||
if(ncstat != NC_NOERR) goto done;
|
||||
if(node->attributes == NULL)
|
||||
node->attributes = nclistnew();
|
||||
nclistpush(node->attributes,(ncelem)att);
|
||||
nclistpush(node->attributes,(void*)att);
|
||||
if(strncmp(ocname,"DODS",strlen("DODS"))==0) {
|
||||
att->invisible = 1;
|
||||
/* Define extra semantics associated with
|
||||
@ -126,7 +126,7 @@ buildattribute(char* name, nc_type ptype,
|
||||
|
||||
att->values = nclistnew();
|
||||
for(i=0;i<nvalues;i++)
|
||||
nclistpush(att->values,(ncelem)nulldup(values[i]));
|
||||
nclistpush(att->values,(void*)nulldup(values[i]));
|
||||
|
||||
if(attp) *attp = att;
|
||||
|
||||
@ -204,12 +204,12 @@ dapmerge3(NCDAPCOMMON* nccomm, CDFnode* ddsroot, OCddsnode dasroot)
|
||||
|
||||
/* catch DODS_EXTRA */
|
||||
if(isglobal && ocname != NULL && strcmp(ocname,"DODS_EXTRA")==0) {
|
||||
nclistpush(dodsextra,(ncelem)das);
|
||||
nclistpush(dodsextra,(void*)das);
|
||||
nullfree(ocname);
|
||||
continue;
|
||||
}
|
||||
if(ocname == NULL || isglobal) {
|
||||
nclistpush(dasglobals,(ncelem)das);
|
||||
nclistpush(dasglobals,(void*)das);
|
||||
nullfree(ocname);
|
||||
continue;
|
||||
}
|
||||
@ -227,7 +227,7 @@ dapmerge3(NCDAPCOMMON* nccomm, CDFnode* ddsroot, OCddsnode dasroot)
|
||||
loop:
|
||||
nullfree(ocname2);
|
||||
}
|
||||
nclistpush(dasnodes,(ncelem)das);
|
||||
nclistpush(dasnodes,(void*)das);
|
||||
}
|
||||
nullfree(ocname);
|
||||
}
|
||||
@ -266,7 +266,7 @@ loop:
|
||||
|| strcmp(ocbasename,dds->ocname)==0) {
|
||||
mergedas1(nccomm,conn,dds,das);
|
||||
/* remove from dasnodes list*/
|
||||
nclistset(dasnodes,i,(ncelem)NULL);
|
||||
nclistset(dasnodes,i,(void*)NULL);
|
||||
}
|
||||
nullfree(ddsfullname);
|
||||
}
|
||||
@ -329,14 +329,14 @@ mergedas1(NCDAPCOMMON* nccomm, OClink conn, CDFnode* dds, OCddsnode das)
|
||||
for(j=0;j<ocnvalues;j++) {
|
||||
char* stringval;
|
||||
OCCHECK(oc_inq_dasattr(conn,attnode,j,&ocetype,&stringval));
|
||||
nclistpush(stringvalues,(ncelem)stringval);
|
||||
nclistpush(stringvalues,(void*)stringval);
|
||||
}
|
||||
ncstat = buildattribute(ocname,
|
||||
octypetonc(ocetype),
|
||||
stringvalues,
|
||||
&att);
|
||||
if(ncstat) goto done;
|
||||
nclistpush(dds->attributes,(ncelem)att);
|
||||
nclistpush(dds->attributes,(void*)att);
|
||||
} else if(octype == OC_Attributeset
|
||||
&& (strcmp(ocname,"DODS")==0
|
||||
|| strcmp(ocname,"DODS_EXTRA")==0)) {
|
||||
@ -358,7 +358,7 @@ mergedas1(NCDAPCOMMON* nccomm, OClink conn, CDFnode* dds, OCddsnode das)
|
||||
for(k=0;k<ocnvalues;k++) {
|
||||
char* stringval;
|
||||
OCCHECK(oc_inq_dasattr(conn,attnode,k,&ocetype,&stringval));
|
||||
nclistpush(stringvalues,(ncelem)stringval);
|
||||
nclistpush(stringvalues,(void*)stringval);
|
||||
}
|
||||
OCCHECK(oc_inq_name(conn,attnode,&dodsname));
|
||||
/* Compute new special name */
|
||||
@ -370,7 +370,7 @@ mergedas1(NCDAPCOMMON* nccomm, OClink conn, CDFnode* dds, OCddsnode das)
|
||||
&att);
|
||||
if(ncstat) goto done;
|
||||
att->invisible = 1;
|
||||
nclistpush(dds->attributes,(ncelem)att);
|
||||
nclistpush(dds->attributes,(void*)att);
|
||||
|
||||
/* Define extra semantics associated with DODS and DODS_EXTRA attribute */
|
||||
if(strcmp(dodsname,"strlen")==0) {
|
||||
@ -434,7 +434,7 @@ collect_alldasnodes(OClink link, OCddsnode dasnode, NClist* alldasnodes)
|
||||
{
|
||||
size_t nsubnodes,i;
|
||||
OCerror ocstat = OC_NOERR;
|
||||
nclistpush(alldasnodes,(ncelem)dasnode);
|
||||
nclistpush(alldasnodes,(void*)dasnode);
|
||||
ocstat = oc_dds_nsubnodes(link,dasnode,&nsubnodes);
|
||||
if(ocstat != OC_NOERR) goto done;
|
||||
for(i=0;i<nsubnodes;i++) {
|
||||
@ -458,7 +458,7 @@ collect_leaves(OClink link, OCddsnode ddsnode, NClist* leaves)
|
||||
ocstat = oc_dds_octype(link,ddsnode,&octype);
|
||||
if(ocstat != OC_NOERR) goto done;
|
||||
if(octype == OC_Atomic) {
|
||||
nclistpush(leaves,(ncelem)ddsnode);
|
||||
nclistpush(leaves,(void*)ddsnode);
|
||||
} else {
|
||||
ocstat = oc_dds_nsubnodes(link,ddsnode,&nsubnodes);
|
||||
if(ocstat != OC_NOERR) goto done;
|
||||
@ -486,7 +486,7 @@ collect_subnodes(OClink link, OCddsnode ddsnode, NClist* subnodes)
|
||||
OCddsnode subnode;
|
||||
ocstat = oc_dds_ithsubnode(link,ddsnode,i,&subnode);
|
||||
if(ocstat != OC_NOERR) goto done;
|
||||
nclistpush(subnodes,(ncelem)subnode);
|
||||
nclistpush(subnodes,(void*)subnode);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -440,7 +440,7 @@ dumpnode(CDFnode* node)
|
||||
ncbytescat(buf,tmp);
|
||||
snprintf(tmp,sizeof(tmp),"ncfullname=%s\n",node->ncfullname);
|
||||
ncbytescat(buf,tmp);
|
||||
snprintf(tmp,sizeof(tmp),"|subnodes|=%d\n",nclistlength(node->subnodes));
|
||||
snprintf(tmp,sizeof(tmp),"|subnodes|=%ld\n",nclistlength(node->subnodes));
|
||||
ncbytescat(buf,tmp);
|
||||
snprintf(tmp,sizeof(tmp),"externaltype=%d\n",node->externaltype);
|
||||
ncbytescat(buf,tmp);
|
||||
@ -459,7 +459,7 @@ dumpnode(CDFnode* node)
|
||||
snprintf(tmp,sizeof(tmp),"attachment=%s\n",
|
||||
(node->attachment?node->attachment->ocname:"null"));
|
||||
ncbytescat(buf,tmp);
|
||||
snprintf(tmp,sizeof(tmp),"rank=%u\n",nclistlength(node->array.dimset0));
|
||||
snprintf(tmp,sizeof(tmp),"rank=%lu\n",nclistlength(node->array.dimset0));
|
||||
ncbytescat(buf,tmp);
|
||||
for(i=0;i<nclistlength(node->array.dimset0);i++) {
|
||||
CDFnode* dim = (CDFnode*)nclistget(node->array.dimset0,i);
|
||||
|
@ -309,14 +309,14 @@ nclistminus(NClist* l1, NClist* l2)
|
||||
}
|
||||
|
||||
int
|
||||
nclistdeleteall(NClist* l, ncelem elem)
|
||||
nclistdeleteall(NClist* l, void* elem)
|
||||
{
|
||||
int i; /* do not make unsigned */
|
||||
unsigned int len,found;
|
||||
found = 0;
|
||||
len = nclistlength(l);
|
||||
for(i=len-1;i>=0;i--) {
|
||||
ncelem test = nclistget(l,i);
|
||||
void* test = nclistget(l,i);
|
||||
if(test==elem) {
|
||||
nclistremove(l,i);
|
||||
found=1;
|
||||
@ -330,11 +330,11 @@ void
|
||||
collectnodepath3(CDFnode* node, NClist* path, int withdataset)
|
||||
{
|
||||
if(node == NULL) return;
|
||||
nclistpush(path,(ncelem)node);
|
||||
nclistpush(path,(void*)node);
|
||||
while(node->container != NULL) {
|
||||
node = node->container;
|
||||
if(!withdataset && node->nctype == NC_Dataset) break;
|
||||
nclistinsert(path,0,(ncelem)node);
|
||||
nclistinsert(path,0,(void*)node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ collectocpath(OClink conn, OCddsnode node, NClist* path)
|
||||
oc_dds_container(conn,node,&container);
|
||||
if(container != NULL)
|
||||
collectocpath(conn,container,path);
|
||||
nclistpush(path,(ncelem)node);
|
||||
nclistpush(path,(void*)node);
|
||||
}
|
||||
|
||||
char*
|
||||
@ -457,7 +457,7 @@ clonenodenamepath3(CDFnode* node, NClist* path, int withdataset)
|
||||
if(node->nctype != NC_Dataset)
|
||||
clonenodenamepath3(node->container,path,withdataset);
|
||||
if(node->nctype != NC_Dataset || withdataset)
|
||||
nclistpush(path,(ncelem)nulldup(node->ncbasename));
|
||||
nclistpush(path,(void*)nulldup(node->ncbasename));
|
||||
}
|
||||
|
||||
char*
|
||||
|
@ -44,7 +44,7 @@ extern int paramcheck34(struct NCDAPCOMMON* drno, const char* param, const char*
|
||||
|
||||
extern int nclistconcat(NClist* l1, NClist* l2);
|
||||
extern int nclistminus(NClist* l1, NClist* l2);
|
||||
extern int nclistdeleteall(NClist* l1, ncelem);
|
||||
extern int nclistdeleteall(NClist* l1, void*);
|
||||
|
||||
extern char* getvaraprint(void* gv);
|
||||
|
||||
|
@ -180,11 +180,11 @@ fprintf(stderr,"dapmergeprojection: src = %s\n",dcetostring((DCEnode*)src));
|
||||
nclistsetalloc(cat,nclistlength(dst)+nclistlength(src));
|
||||
for(i=0;i<nclistlength(dst);i++) {
|
||||
DCEprojection* p = (DCEprojection*)nclistget(dst,i);
|
||||
nclistpush(cat,(ncelem)p);
|
||||
nclistpush(cat,(void*)p);
|
||||
}
|
||||
for(i=0;i<nclistlength(src);i++) {
|
||||
DCEprojection* p = (DCEprojection*)nclistget(src,i);
|
||||
nclistpush(cat,(ncelem)dceclone((DCEnode*)p));
|
||||
nclistpush(cat,(void*)dceclone((DCEnode*)p));
|
||||
}
|
||||
|
||||
nclistclear(dst);
|
||||
@ -206,11 +206,11 @@ fprintf(stderr,"dapmergeprojection: src = %s\n",dcetostring((DCEnode*)src));
|
||||
/* This entry matches our current target; merge */
|
||||
ncstat = dcemergeprojections(target,p2);
|
||||
/* null out this merged entry and release it */
|
||||
nclistset(cat,i,(ncelem)NULL);
|
||||
nclistset(cat,i,(void*)NULL);
|
||||
dcefree((DCEnode*)p2);
|
||||
}
|
||||
/* Capture the clone */
|
||||
nclistpush(dst,(ncelem)target);
|
||||
nclistpush(dst,(void*)target);
|
||||
}
|
||||
nclistfree(cat);
|
||||
return ncstat;
|
||||
@ -388,7 +388,7 @@ dceclonelist(NClist* list)
|
||||
for(i=0;i<nclistlength(list);i++) {
|
||||
DCEnode* node = (DCEnode*)nclistget(list,i);
|
||||
DCEnode* newnode = dceclone((DCEnode*)node);
|
||||
nclistpush(clone,(ncelem)newnode);
|
||||
nclistpush(clone,(void*)newnode);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
@ -715,9 +715,9 @@ ceallnodesr(DCEnode* node, NClist* allnodes, CEsort which)
|
||||
{
|
||||
int i;
|
||||
if(node == NULL) return;
|
||||
if(nclistcontains(allnodes,(ncelem)node)) return;
|
||||
if(nclistcontains(allnodes,(void*)node)) return;
|
||||
if(which == CES_NIL || node->sort == which)
|
||||
nclistpush(allnodes,(ncelem)node);
|
||||
nclistpush(allnodes,(void*)node);
|
||||
switch(node->sort) {
|
||||
case CES_FCN: {
|
||||
DCEfcn* fcn = (DCEfcn*)node;
|
||||
|
@ -147,7 +147,7 @@ dcelex(YYSTYPE* lvalp, DCEparsestate* state)
|
||||
*lvalp = NULL;
|
||||
else {
|
||||
*lvalp = ncbytesdup(lexstate->yytext);
|
||||
nclistpush(lexstate->reclaim,(ncelem)*lvalp);
|
||||
nclistpush(lexstate->reclaim,(void*)*lvalp);
|
||||
}
|
||||
|
||||
return token;
|
||||
|
@ -83,7 +83,7 @@ segmentlist(DCEparsestate* state, Object var0, Object decl)
|
||||
if(v==NULL) v = (DCEvar*)dcecreate(CES_VAR);
|
||||
list = v->segments;
|
||||
if(list == NULL) list = nclistnew();
|
||||
nclistpush(list,(ncelem)decl);
|
||||
nclistpush(list,(void*)decl);
|
||||
v->segments = list;
|
||||
return v;
|
||||
}
|
||||
@ -180,7 +180,7 @@ sel_clause(DCEparsestate* state, int selcase,
|
||||
sel->lhs = (DCEvalue*)lhs;
|
||||
if(selcase == 2) {/*singleton value*/
|
||||
sel->rhs = nclistnew();
|
||||
nclistpush(sel->rhs,(ncelem)values);
|
||||
nclistpush(sel->rhs,(void*)values);
|
||||
} else
|
||||
sel->rhs = (NClist*)values;
|
||||
return sel;
|
||||
@ -210,7 +210,7 @@ array_indices(DCEparsestate* state, Object list0, Object indexno)
|
||||
slice->count = 1;
|
||||
slice->length = 1;
|
||||
slice->stop = start+1;
|
||||
nclistpush(list,(ncelem)slice);
|
||||
nclistpush(list,(void*)slice);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ collectlist(Object list0, Object decl)
|
||||
{
|
||||
NClist* list = (NClist*)list0;
|
||||
if(list == NULL) list = nclistnew();
|
||||
nclistpush(list,(ncelem)decl);
|
||||
nclistpush(list,(void*)decl);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ fprintf(stderr,"getvarx: walkprojection: |%s|\n",dumpprojection(walkprojection))
|
||||
|
||||
/* define the var list of interest */
|
||||
vars = nclistnew();
|
||||
nclistpush(vars,(ncelem)varainfo->target);
|
||||
nclistpush(vars,(void*)varainfo->target);
|
||||
|
||||
switch (state) {
|
||||
|
||||
@ -316,7 +316,7 @@ fprintf(stderr,"getvarx: FETCHVAR: fetchprojection: |%s|\n",dumpprojection(fetch
|
||||
fetchconstraint->selections = dceclonelist(dapcomm->oc.dapconstraint->selections);
|
||||
/* and the created fetch projection */
|
||||
fetchconstraint->projections = nclistnew();
|
||||
nclistpush(fetchconstraint->projections,(ncelem)fetchprojection);
|
||||
nclistpush(fetchconstraint->projections,(void*)fetchprojection);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"getvarx: FETCHVAR: fetchconstraint: %s\n",dumpconstraint(fetchconstraint));
|
||||
#endif
|
||||
@ -352,7 +352,7 @@ fprintf(stderr,"getvarx: FETCHPART: fetchprojection: |%s|\n",dumpprojection(fetc
|
||||
fetchconstraint->selections = dceclonelist(dapcomm->oc.dapconstraint->selections);
|
||||
/* and the created fetch projection */
|
||||
fetchconstraint->projections = nclistnew();
|
||||
nclistpush(fetchconstraint->projections,(ncelem)fetchprojection);
|
||||
nclistpush(fetchconstraint->projections,(void*)fetchprojection);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"getvarx: FETCHPART: fetchconstraint: %s\n",dumpconstraint(fetchconstraint));
|
||||
#endif
|
||||
@ -1106,7 +1106,7 @@ extractstring(
|
||||
char* value = NULL;
|
||||
ocstat = oc_data_readscalar(conn,currentcontent,sizeof(value),&value);
|
||||
if(ocstat != OC_NOERR) goto done;
|
||||
nclistpush(strings,(ncelem)value);
|
||||
nclistpush(strings,(void*)value);
|
||||
} else {
|
||||
/* Use the odometer to walk to the appropriate fields*/
|
||||
odom = dapodom_fromsegment(segment,0,rank0);
|
||||
@ -1114,7 +1114,7 @@ extractstring(
|
||||
char* value = NULL;
|
||||
ocstat = oc_data_readn(conn,currentcontent,odom->index,1,sizeof(value),&value);
|
||||
if(ocstat != OC_NOERR) goto done;
|
||||
nclistpush(strings,(ncelem)value);
|
||||
nclistpush(strings,(void*)value);
|
||||
dapodom_next(odom);
|
||||
}
|
||||
dapodom_free(odom);
|
||||
|
@ -421,8 +421,8 @@ builddims(NCDAPCOMMON* dapcomm)
|
||||
CDFnode* dim1 = (CDFnode*)nclistget(dimset,i);
|
||||
CDFnode* dim2 = (CDFnode*)nclistget(dimset,i+1);
|
||||
if(strcmp(dim1->ncfullname,dim2->ncfullname) > 0) {
|
||||
nclistset(dimset,i,(ncelem)dim2);
|
||||
nclistset(dimset,i+1,(ncelem)dim1);
|
||||
nclistset(dimset,i,(void*)dim2);
|
||||
nclistset(dimset,i+1,(void*)dim1);
|
||||
swap = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ addstringdims(NCDAPCOMMON* dapcomm)
|
||||
(unsigned long)dapcomm->cdf.defaultstringlength);
|
||||
globalsdim = makecdfnode34(dapcomm, dimname, OC_Dimension, NULL,
|
||||
dapcomm->cdf.ddsroot);
|
||||
nclistpush(dapcomm->cdf.ddsroot->tree->nodes,(ncelem)globalsdim);
|
||||
nclistpush(dapcomm->cdf.ddsroot->tree->nodes,(void*)globalsdim);
|
||||
DIMFLAGSET(globalsdim,CDFDIMSTRING);
|
||||
globalsdim->dim.declsize = dapcomm->cdf.defaultstringlength;
|
||||
globalsdim->dim.declsize0 = globalsdim->dim.declsize;
|
||||
@ -117,7 +117,7 @@ addstringdims(NCDAPCOMMON* dapcomm)
|
||||
sdim = makecdfnode34(dapcomm, dimname, OC_Dimension, NULL,
|
||||
dapcomm->cdf.ddsroot);
|
||||
if(sdim == NULL) return THROW(NC_ENOMEM);
|
||||
nclistpush(dapcomm->cdf.ddsroot->tree->nodes,(ncelem)sdim);
|
||||
nclistpush(dapcomm->cdf.ddsroot->tree->nodes,(void*)sdim);
|
||||
DIMFLAGSET(sdim,CDFDIMSTRING);
|
||||
sdim->dim.declsize = dimsize;
|
||||
sdim->dim.declsize0 = dimsize;
|
||||
@ -283,7 +283,7 @@ makeseqdim(NCDAPCOMMON* dapcomm, CDFnode* seq, size_t count, CDFnode** sqdimp)
|
||||
/* build the dimension with given size; keep the dimension anonymous */
|
||||
sqdim = makecdfnode34(dapcomm,seq->ocname,OC_Dimension,NULL,root);
|
||||
if(sqdim == NULL) return THROW(NC_ENOMEM);
|
||||
nclistpush(tree->nodes,(ncelem)sqdim);
|
||||
nclistpush(tree->nodes,(void*)sqdim);
|
||||
/* Assign a name to the sequence node */
|
||||
sqdim->ncbasename = cdflegalname3(seq->ocname);
|
||||
sqdim->ncfullname = nulldup(sqdim->ncbasename);
|
||||
|
@ -42,7 +42,7 @@ ncbytesnew(void)
|
||||
}
|
||||
|
||||
int
|
||||
ncbytessetalloc(NCbytes* bb, unsigned int sz)
|
||||
ncbytessetalloc(NCbytes* bb, unsigned long sz)
|
||||
{
|
||||
char* newcontent;
|
||||
if(bb == NULL) return ncbytesfail();
|
||||
@ -69,7 +69,7 @@ ncbytesfree(NCbytes* bb)
|
||||
}
|
||||
|
||||
int
|
||||
ncbytessetlength(NCbytes* bb, unsigned int sz)
|
||||
ncbytessetlength(NCbytes* bb, unsigned long sz)
|
||||
{
|
||||
if(bb == NULL) return ncbytesfail();
|
||||
if(sz > bb->alloc) {if(!ncbytessetalloc(bb,sz)) return ncbytesfail();}
|
||||
@ -80,14 +80,14 @@ ncbytessetlength(NCbytes* bb, unsigned int sz)
|
||||
int
|
||||
ncbytesfill(NCbytes* bb, char fill)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned long i;
|
||||
if(bb == NULL) return ncbytesfail();
|
||||
for(i=0;i<bb->length;i++) bb->content[i] = fill;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
ncbytesget(NCbytes* bb, unsigned int index)
|
||||
ncbytesget(NCbytes* bb, unsigned long index)
|
||||
{
|
||||
if(bb == NULL) return -1;
|
||||
if(index >= bb->length) return -1;
|
||||
@ -95,7 +95,7 @@ ncbytesget(NCbytes* bb, unsigned int index)
|
||||
}
|
||||
|
||||
int
|
||||
ncbytesset(NCbytes* bb, unsigned int index, char elem)
|
||||
ncbytesset(NCbytes* bb, unsigned long index, char elem)
|
||||
{
|
||||
if(bb == NULL) return ncbytesfail();
|
||||
if(index >= bb->length) return ncbytesfail();
|
||||
@ -129,7 +129,7 @@ ncbytescat(NCbytes* bb, const char* s)
|
||||
}
|
||||
|
||||
int
|
||||
ncbytesappendn(NCbytes* bb, const void* elem, unsigned int n)
|
||||
ncbytesappendn(NCbytes* bb, const void* elem, unsigned long n)
|
||||
{
|
||||
if(bb == NULL || elem == NULL) return ncbytesfail();
|
||||
if(n == 0) {n = strlen((char*)elem);}
|
||||
@ -175,7 +175,7 @@ ncbytesextract(NCbytes* bb)
|
||||
}
|
||||
|
||||
int
|
||||
ncbytessetcontents(NCbytes* bb, char* contents, unsigned int alloc)
|
||||
ncbytessetcontents(NCbytes* bb, char* contents, unsigned long alloc)
|
||||
{
|
||||
if(bb == NULL) return ncbytesfail();
|
||||
ncbytesclear(bb);
|
||||
|
@ -1,16 +1,19 @@
|
||||
/*********************************************************************
|
||||
* Copyright 1993, UCAR/Unidata
|
||||
* Copyright 2010, UCAR/Unidata
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
* $Header: /upc/share/CVS/netcdf-3/libncdap3/nchashmap.c,v 1.4 2009/09/23 22:26:08 dmh Exp $
|
||||
* $Header$
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nchashmap.h"
|
||||
|
||||
static ncelem ncDATANULL = (ncelem)0;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
@ -25,6 +28,10 @@ NChashmap* nchashnew(void) {return nchashnew0(DEFAULTALLOC);}
|
||||
NChashmap* nchashnew0(int alloc)
|
||||
{
|
||||
NChashmap* hm;
|
||||
if(sizeof(nchashid) != sizeof(void*)){
|
||||
fprintf(stderr,"nchashmap: sizeof(nchashid) != sizeof(void*)");
|
||||
abort();
|
||||
}
|
||||
hm = (NChashmap*)malloc(sizeof(NChashmap));
|
||||
if(!hm) return NULL;
|
||||
hm->alloc = alloc;
|
||||
@ -48,14 +55,14 @@ nchashfree(NChashmap* hm)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Insert a <nchashid,ncelem> pair into the table*/
|
||||
/* Insert a <nchashid,void*> pair into the table*/
|
||||
/* Fail if already there*/
|
||||
int
|
||||
nchashinsert(NChashmap* hm, nchashid hash, ncelem value)
|
||||
nchashinsert(NChashmap* hm, nchashid hash, void* value)
|
||||
{
|
||||
int i,offset,len;
|
||||
NClist* seq;
|
||||
ncelem* list;
|
||||
void** list;
|
||||
|
||||
offset = (hash % hm->alloc);
|
||||
seq = hm->table[offset];
|
||||
@ -63,22 +70,22 @@ nchashinsert(NChashmap* hm, nchashid hash, ncelem value)
|
||||
len = nclistlength(seq);
|
||||
list = nclistcontents(seq);
|
||||
for(i=0;i<len;i+=2,list+=2) {
|
||||
if(*list == hash) return FALSE;
|
||||
if(hash==(nchashid)(*list)) return FALSE;
|
||||
}
|
||||
nclistpush(seq,(ncelem)hash);
|
||||
nclistpush(seq,(void*)hash);
|
||||
nclistpush(seq,value);
|
||||
hm->size++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Insert a <nchashid,ncelem> pair into the table*/
|
||||
/* Insert a <nchashid,void*> pair into the table*/
|
||||
/* Overwrite if already there*/
|
||||
int
|
||||
nchashreplace(NChashmap* hm, nchashid hash, ncelem value)
|
||||
nchashreplace(NChashmap* hm, nchashid hash, void* value)
|
||||
{
|
||||
int i,offset,len;
|
||||
NClist* seq;
|
||||
ncelem* list;
|
||||
void** list;
|
||||
|
||||
offset = (hash % hm->alloc);
|
||||
seq = hm->table[offset];
|
||||
@ -86,9 +93,9 @@ nchashreplace(NChashmap* hm, nchashid hash, ncelem value)
|
||||
len = nclistlength(seq);
|
||||
list = nclistcontents(seq);
|
||||
for(i=0;i<len;i+=2,list+=2) {
|
||||
if(*list == hash) {list[1] = value; return TRUE;}
|
||||
if(hash==(nchashid)(*list)) {list[1] = value; return TRUE;}
|
||||
}
|
||||
nclistpush(seq,(ncelem)hash);
|
||||
nclistpush(seq,(void*)hash);
|
||||
nclistpush(seq,value);
|
||||
hm->size++;
|
||||
return TRUE;
|
||||
@ -101,7 +108,7 @@ nchashremove(NChashmap* hm, nchashid hash)
|
||||
{
|
||||
int i,offset,len;
|
||||
NClist* seq;
|
||||
ncelem* list;
|
||||
void** list;
|
||||
|
||||
offset = (hash % hm->alloc);
|
||||
seq = hm->table[offset];
|
||||
@ -109,7 +116,7 @@ nchashremove(NChashmap* hm, nchashid hash)
|
||||
len = nclistlength(seq);
|
||||
list = nclistcontents(seq);
|
||||
for(i=0;i<len;i+=2,list+=2) {
|
||||
if(*list == hash) {
|
||||
if(hash==(nchashid)(*list)) {
|
||||
nclistremove(seq,i+1);
|
||||
nclistremove(seq,i);
|
||||
hm->size--;
|
||||
@ -122,20 +129,20 @@ nchashremove(NChashmap* hm, nchashid hash)
|
||||
|
||||
/* lookup a nchashid; return DATANULL if not found*/
|
||||
/* (use hashlookup if the possible values include 0)*/
|
||||
ncelem
|
||||
void*
|
||||
nchashget(NChashmap* hm, nchashid hash)
|
||||
{
|
||||
ncelem value;
|
||||
if(!nchashlookup(hm,hash,&value)) return ncDATANULL;
|
||||
void* value;
|
||||
if(!nchashlookup(hm,hash,&value)) return NULL;
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
nchashlookup(NChashmap* hm, nchashid hash, ncelem* valuep)
|
||||
nchashlookup(NChashmap* hm, nchashid hash, void** valuep)
|
||||
{
|
||||
int i,offset,len;
|
||||
NClist* seq;
|
||||
ncelem* list;
|
||||
void** list;
|
||||
|
||||
offset = (hash % hm->alloc);
|
||||
seq = hm->table[offset];
|
||||
@ -143,7 +150,7 @@ nchashlookup(NChashmap* hm, nchashid hash, ncelem* valuep)
|
||||
len = nclistlength(seq);
|
||||
list = nclistcontents(seq);
|
||||
for(i=0;i<len;i+=2,list+=2) {
|
||||
if(*list == hash) {if(valuep) {*valuep = list[1]; return TRUE;}}
|
||||
if(hash==(nchashid)(*list)) {if(valuep) {*valuep = list[1]; return TRUE;}}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -151,7 +158,7 @@ nchashlookup(NChashmap* hm, nchashid hash, ncelem* valuep)
|
||||
/* Return the ith pair; order is completely arbitrary*/
|
||||
/* Can be expensive*/
|
||||
int
|
||||
nchashith(NChashmap* hm, int index, nchashid* hashp, ncelem* elemp)
|
||||
nchashith(NChashmap* hm, int index, nchashid* hashp, void** elemp)
|
||||
{
|
||||
int i;
|
||||
if(hm == NULL) return FALSE;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "nclist.h"
|
||||
|
||||
int nclistnull(ncelem e) {return e == NULL;}
|
||||
int nclistnull(void* e) {return e == NULL;}
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
@ -23,7 +23,7 @@ NClist* nclistnew(void)
|
||||
NClist* l;
|
||||
/*
|
||||
if(!ncinitialized) {
|
||||
memset((void*)&ncDATANULL,0,sizeof(ncelem));
|
||||
memset((void*)&ncDATANULL,0,sizeof(void*));
|
||||
ncinitialized = 1;
|
||||
}
|
||||
*/
|
||||
@ -48,15 +48,15 @@ nclistfree(NClist* l)
|
||||
}
|
||||
|
||||
int
|
||||
nclistsetalloc(NClist* l, unsigned int sz)
|
||||
nclistsetalloc(NClist* l, unsigned long sz)
|
||||
{
|
||||
ncelem* newcontent;
|
||||
void** newcontent;
|
||||
if(l == NULL) return FALSE;
|
||||
if(sz <= 0) {sz = (l->length?2*l->length:DEFAULTALLOC);}
|
||||
if(l->alloc >= sz) {return TRUE;}
|
||||
newcontent=(ncelem*)calloc(sz,sizeof(ncelem));
|
||||
newcontent=(void**)calloc(sz,sizeof(void*));
|
||||
if(l->alloc > 0 && l->length > 0 && l->content != NULL) {
|
||||
memcpy((void*)newcontent,(void*)l->content,sizeof(ncelem)*l->length);
|
||||
memcpy((void*)newcontent,(void*)l->content,sizeof(void*)*l->length);
|
||||
}
|
||||
if(l->content != NULL) free(l->content);
|
||||
l->content=newcontent;
|
||||
@ -65,7 +65,7 @@ nclistsetalloc(NClist* l, unsigned int sz)
|
||||
}
|
||||
|
||||
int
|
||||
nclistsetlength(NClist* l, unsigned int sz)
|
||||
nclistsetlength(NClist* l, unsigned long sz)
|
||||
{
|
||||
if(l == NULL) return FALSE;
|
||||
if(sz > l->alloc && !nclistsetalloc(l,sz)) return FALSE;
|
||||
@ -73,8 +73,8 @@ nclistsetlength(NClist* l, unsigned int sz)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ncelem
|
||||
nclistget(NClist* l, unsigned int index)
|
||||
void*
|
||||
nclistget(NClist* l, unsigned long index)
|
||||
{
|
||||
if(l == NULL || l->length == 0) return NULL;
|
||||
if(index >= l->length) return NULL;
|
||||
@ -82,7 +82,7 @@ nclistget(NClist* l, unsigned int index)
|
||||
}
|
||||
|
||||
int
|
||||
nclistset(NClist* l, unsigned int index, ncelem elem)
|
||||
nclistset(NClist* l, unsigned long index, void* elem)
|
||||
{
|
||||
if(l == NULL) return FALSE;
|
||||
if(index >= l->length) return FALSE;
|
||||
@ -92,7 +92,7 @@ nclistset(NClist* l, unsigned int index, ncelem elem)
|
||||
|
||||
/* Insert at position i of l; will push up elements i..|seq|. */
|
||||
int
|
||||
nclistinsert(NClist* l, unsigned int index, ncelem elem)
|
||||
nclistinsert(NClist* l, unsigned long index, void* elem)
|
||||
{
|
||||
int i; /* do not make unsigned */
|
||||
if(l == NULL) return FALSE;
|
||||
@ -105,7 +105,7 @@ nclistinsert(NClist* l, unsigned int index, ncelem elem)
|
||||
}
|
||||
|
||||
int
|
||||
nclistpush(NClist* l, ncelem elem)
|
||||
nclistpush(NClist* l, void* elem)
|
||||
{
|
||||
if(l == NULL) return FALSE;
|
||||
if(l->length >= l->alloc) nclistsetalloc(l,0);
|
||||
@ -114,7 +114,7 @@ nclistpush(NClist* l, ncelem elem)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ncelem
|
||||
void*
|
||||
nclistpop(NClist* l)
|
||||
{
|
||||
if(l == NULL || l->length == 0) return NULL;
|
||||
@ -122,18 +122,18 @@ nclistpop(NClist* l)
|
||||
return l->content[l->length];
|
||||
}
|
||||
|
||||
ncelem
|
||||
void*
|
||||
nclisttop(NClist* l)
|
||||
{
|
||||
if(l == NULL || l->length == 0) return NULL;
|
||||
return l->content[l->length - 1];
|
||||
}
|
||||
|
||||
ncelem
|
||||
nclistremove(NClist* l, unsigned int i)
|
||||
void*
|
||||
nclistremove(NClist* l, unsigned long i)
|
||||
{
|
||||
unsigned int len;
|
||||
ncelem elem;
|
||||
unsigned long len;
|
||||
void* elem;
|
||||
if(l == NULL || (len=l->length) == 0) return NULL;
|
||||
if(i >= len) return NULL;
|
||||
elem = l->content[i];
|
||||
@ -143,19 +143,19 @@ nclistremove(NClist* l, unsigned int i)
|
||||
}
|
||||
|
||||
/* Duplicate and return the content (null terminate) */
|
||||
ncelem*
|
||||
void**
|
||||
nclistdup(NClist* l)
|
||||
{
|
||||
ncelem* result = (ncelem*)malloc(sizeof(ncelem)*(l->length+1));
|
||||
memcpy((void*)result,(void*)l->content,sizeof(ncelem)*l->length);
|
||||
result[l->length] = (ncelem)0;
|
||||
void** result = (void**)malloc(sizeof(void*)*(l->length+1));
|
||||
memcpy((void*)result,(void*)l->content,sizeof(void*)*l->length);
|
||||
result[l->length] = (void*)0;
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
nclistcontains(NClist* list, ncelem elem)
|
||||
nclistcontains(NClist* list, void* elem)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned long i;
|
||||
for(i=0;i<nclistlength(list);i++) {
|
||||
if(elem == nclistget(list,i)) return 1;
|
||||
}
|
||||
@ -164,14 +164,14 @@ nclistcontains(NClist* list, ncelem elem)
|
||||
|
||||
/* Remove element by value; only removes first encountered */
|
||||
int
|
||||
nclistelemremove(NClist* l, ncelem elem)
|
||||
nclistelemremove(NClist* l, void* elem)
|
||||
{
|
||||
unsigned int len;
|
||||
unsigned int i;
|
||||
unsigned long len;
|
||||
unsigned long i;
|
||||
int found = 0;
|
||||
if(l == NULL || (len=l->length) == 0) return 0;
|
||||
for(i=0;i<nclistlength(l);i++) {
|
||||
ncelem candidate = l->content[i];
|
||||
void* candidate = l->content[i];
|
||||
if(elem == candidate) {
|
||||
for(i+=1;i<len;i++) l->content[i-1] = l->content[i];
|
||||
l->length--;
|
||||
@ -193,8 +193,8 @@ nclistelemremove(NClist* l, ncelem elem)
|
||||
int
|
||||
nclistunique(NClist* list)
|
||||
{
|
||||
unsigned int i,j,k,len;
|
||||
ncelem* content;
|
||||
unsigned long i,j,k,len;
|
||||
void** content;
|
||||
if(list == NULL || list->length == 0) return 1;
|
||||
len = list->length;
|
||||
content = list->content;
|
||||
|
10
oc2/daplex.c
10
oc2/daplex.c
@ -109,6 +109,7 @@ daplex(YYSTYPE* lvalp, DAPparsestate* state)
|
||||
unsigned int i;
|
||||
char* p;
|
||||
char* tmp;
|
||||
YYSTYPE lval = NULL;
|
||||
|
||||
token = 0;
|
||||
ocbytesclear(lexstate->yytext);
|
||||
@ -234,11 +235,12 @@ daplex(YYSTYPE* lvalp, DAPparsestate* state)
|
||||
/*Put return value onto Bison stack*/
|
||||
|
||||
if(ocbyteslength(lexstate->yytext) == 0)
|
||||
*lvalp = NULL;
|
||||
lval = NULL;
|
||||
else {
|
||||
*lvalp = ocbytesdup(lexstate->yytext);
|
||||
oclistpush(lexstate->reclaim,(ocelem)*lvalp);
|
||||
lval = ocbytesdup(lexstate->yytext);
|
||||
oclistpush(lexstate->reclaim,(void*)lval);
|
||||
}
|
||||
if(lvalp) *lvalp = lval;
|
||||
return token; /* Return the type of the token. */
|
||||
}
|
||||
|
||||
@ -345,6 +347,6 @@ dapdecode(DAPlexstate* lexstate, char* name)
|
||||
#else
|
||||
decoded = ocuridecodeonly(name,decodelist);
|
||||
#endif
|
||||
oclistpush(lexstate->reclaim,(ocelem)decoded);
|
||||
oclistpush(lexstate->reclaim,(void*)decoded);
|
||||
return decoded;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ dap_declarations(DAPparsestate* state, Object decls, Object decl)
|
||||
if(alist == NULL)
|
||||
alist = oclistnew();
|
||||
else
|
||||
oclistpush(alist,(ocelem)decl);
|
||||
oclistpush(alist,(void*)decl);
|
||||
return alist;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ dap_arraydecls(DAPparsestate* state, Object arraydecls, Object arraydecl)
|
||||
if(alist == NULL)
|
||||
alist = oclistnew();
|
||||
else
|
||||
oclistpush(alist,(ocelem)arraydecl);
|
||||
oclistpush(alist,(void*)arraydecl);
|
||||
return alist;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ dap_attrlist(DAPparsestate* state, Object attrlist, Object attrtuple)
|
||||
else {
|
||||
char* dupname;
|
||||
if(attrtuple != NULL) {/* NULL=>alias encountered, ignore */
|
||||
oclistpush(alist,(ocelem)attrtuple);
|
||||
oclistpush(alist,(void*)attrtuple);
|
||||
if((dupname=scopeduplicates(alist))!=NULL) {
|
||||
dap_parse_error(state,"Duplicate attribute names in same scope: %s",dupname);
|
||||
/* Remove this attribute */
|
||||
@ -153,7 +153,7 @@ dap_attrvalue(DAPparsestate* state, Object valuelist, Object value, Object etype
|
||||
if(alist == NULL) alist = oclistnew();
|
||||
/* Watch out for null values */
|
||||
if(value == NULL) value = "";
|
||||
oclistpush(alist,(ocelem)strdup(value));
|
||||
oclistpush(alist,(void*)strdup(value));
|
||||
return alist;
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ dap_makegrid(DAPparsestate* state, Object name, Object arraydecl, Object mapdecl
|
||||
}
|
||||
node = newocnode(name,OC_Grid,state);
|
||||
node->subnodes = (OClist*)mapdecls;
|
||||
oclistinsert(node->subnodes,0,(ocelem)arraydecl);
|
||||
oclistinsert(node->subnodes,0,(void*)arraydecl);
|
||||
addedges(node);
|
||||
return node;
|
||||
}
|
||||
@ -352,7 +352,7 @@ static OCnode*
|
||||
newocnode(char* name, OCtype octype, DAPparsestate* state)
|
||||
{
|
||||
OCnode* node = ocnode_new(name,octype,state->root);
|
||||
oclistpush(state->ocnodes,(ocelem)node);
|
||||
oclistpush(state->ocnodes,(void*)node);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ ocbytesnew(void)
|
||||
}
|
||||
|
||||
int
|
||||
ocbytessetalloc(OCbytes* bb, unsigned int sz)
|
||||
ocbytessetalloc(OCbytes* bb, unsigned long sz)
|
||||
{
|
||||
char* newcontent;
|
||||
if(bb == NULL) return ocbytesfail();
|
||||
@ -69,7 +69,7 @@ ocbytesfree(OCbytes* bb)
|
||||
}
|
||||
|
||||
int
|
||||
ocbytessetlength(OCbytes* bb, unsigned int sz)
|
||||
ocbytessetlength(OCbytes* bb, unsigned long sz)
|
||||
{
|
||||
if(bb == NULL) return ocbytesfail();
|
||||
if(sz > bb->alloc) {if(!ocbytessetalloc(bb,sz)) return ocbytesfail();}
|
||||
@ -80,14 +80,14 @@ ocbytessetlength(OCbytes* bb, unsigned int sz)
|
||||
int
|
||||
ocbytesfill(OCbytes* bb, char fill)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned long i;
|
||||
if(bb == NULL) return ocbytesfail();
|
||||
for(i=0;i<bb->length;i++) bb->content[i] = fill;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
ocbytesget(OCbytes* bb, unsigned int index)
|
||||
ocbytesget(OCbytes* bb, unsigned long index)
|
||||
{
|
||||
if(bb == NULL) return -1;
|
||||
if(index >= bb->length) return -1;
|
||||
@ -95,7 +95,7 @@ ocbytesget(OCbytes* bb, unsigned int index)
|
||||
}
|
||||
|
||||
int
|
||||
ocbytesset(OCbytes* bb, unsigned int index, char elem)
|
||||
ocbytesset(OCbytes* bb, unsigned long index, char elem)
|
||||
{
|
||||
if(bb == NULL) return ocbytesfail();
|
||||
if(index >= bb->length) return ocbytesfail();
|
||||
@ -129,7 +129,7 @@ ocbytescat(OCbytes* bb, const char* s)
|
||||
}
|
||||
|
||||
int
|
||||
ocbytesappendn(OCbytes* bb, const void* elem, unsigned int n)
|
||||
ocbytesappendn(OCbytes* bb, const void* elem, unsigned long n)
|
||||
{
|
||||
if(bb == NULL || elem == NULL) return ocbytesfail();
|
||||
if(n == 0) {n = strlen((char*)elem);}
|
||||
@ -175,7 +175,7 @@ ocbytesextract(OCbytes* bb)
|
||||
}
|
||||
|
||||
int
|
||||
ocbytessetcontents(OCbytes* bb, char* contents, unsigned int alloc)
|
||||
ocbytessetcontents(OCbytes* bb, char* contents, unsigned long alloc)
|
||||
{
|
||||
if(bb == NULL) return ocbytesfail();
|
||||
ocbytesclear(bb);
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
typedef struct OCbytes {
|
||||
int nonextendible; /* 1 => fail if an attempt is made to extend this buffer*/
|
||||
unsigned int alloc;
|
||||
unsigned int length;
|
||||
unsigned long alloc;
|
||||
unsigned long length;
|
||||
char* content;
|
||||
} OCbytes;
|
||||
|
||||
@ -19,8 +19,8 @@ typedef struct OCbytes {
|
||||
|
||||
EXTERNC OCbytes* ocbytesnew(void);
|
||||
EXTERNC void ocbytesfree(OCbytes*);
|
||||
EXTERNC int ocbytessetalloc(OCbytes*,unsigned int);
|
||||
EXTERNC int ocbytessetlength(OCbytes*,unsigned int);
|
||||
EXTERNC int ocbytessetalloc(OCbytes*,unsigned long);
|
||||
EXTERNC int ocbytessetlength(OCbytes*,unsigned long);
|
||||
EXTERNC int ocbytesfill(OCbytes*, char fill);
|
||||
|
||||
/* Produce a duplicate of the contents*/
|
||||
@ -29,14 +29,14 @@ EXTERNC char* ocbytesdup(OCbytes*);
|
||||
EXTERNC char* ocbytesextract(OCbytes*);
|
||||
|
||||
/* Return the ith byte; -1 if no such index */
|
||||
EXTERNC int ocbytesget(OCbytes*,unsigned int);
|
||||
EXTERNC int ocbytesget(OCbytes*,unsigned long);
|
||||
/* Set the ith byte */
|
||||
EXTERNC int ocbytesset(OCbytes*,unsigned int,char);
|
||||
EXTERNC int ocbytesset(OCbytes*,unsigned long,char);
|
||||
|
||||
/* Append one byte */
|
||||
EXTERNC int ocbytesappend(OCbytes*,char); /* Add at Tail */
|
||||
/* Append n bytes */
|
||||
EXTERNC int ocbytesappendn(OCbytes*,const void*,unsigned int); /* Add at Tail */
|
||||
EXTERNC int ocbytesappendn(OCbytes*,const void*,unsigned long); /* Add at Tail */
|
||||
|
||||
/* Null terminate the byte string without extending its length (for debugging) */
|
||||
EXTERNC int ocbytesnull(OCbytes*);
|
||||
@ -45,14 +45,14 @@ EXTERNC int ocbytesnull(OCbytes*);
|
||||
EXTERNC int ocbytescat(OCbytes*,const char*);
|
||||
|
||||
/* Set the contents of the buffer; mark the buffer as non-extendible */
|
||||
EXTERNC int ocbytessetcontents(OCbytes*, char*, unsigned int);
|
||||
EXTERNC int ocbytessetcontents(OCbytes*, char*, unsigned long);
|
||||
|
||||
/* Following are always "in-lined"*/
|
||||
#define ocbyteslength(bb) ((bb)!=NULL?(bb)->length:0U)
|
||||
#define ocbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0U)
|
||||
#define ocbyteslength(bb) ((bb)!=NULL?(bb)->length:0)
|
||||
#define ocbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0)
|
||||
#define ocbytescontents(bb) (((bb)!=NULL && (bb)->content!=NULL)?(bb)->content:(char*)"")
|
||||
#define ocbytesextend(bb,len) ocbytessetalloc((bb),(len)+(bb->alloc))
|
||||
#define ocbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0U)
|
||||
#define ocbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0U)
|
||||
#define ocbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0)
|
||||
#define ocbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0)
|
||||
|
||||
#endif /*OCBYTES_H*/
|
||||
|
@ -146,7 +146,7 @@ occompile1(OCstate* state, OCnode* xnode, XXDR* xxdrs, OCdata** datap)
|
||||
/* Capture the back link */
|
||||
record->container = data;
|
||||
record->index = nelements;
|
||||
oclistpush(records,(ocelem)record);
|
||||
oclistpush(records,(void*)record);
|
||||
record = NULL;
|
||||
} else if(tmp[0] == EndOfSequence) {
|
||||
break; /* we are done with the this sequence instance*/
|
||||
|
@ -297,7 +297,7 @@ ocfetch(OCstate* state, const char* constraint, OCdxd kind, OCflags flags,
|
||||
}
|
||||
|
||||
/* Put root into the state->trees list */
|
||||
oclistpush(state->trees,(ocelem)root);
|
||||
oclistpush(state->trees,(void*)root);
|
||||
|
||||
if(rootp) *rootp = root;
|
||||
return stat;
|
||||
@ -414,7 +414,7 @@ fprintf(stderr,"ocextractddsinmemory:\n");
|
||||
ddslen = tree->data.datasize;
|
||||
#ifdef OCDEBUG
|
||||
fprintf(stderr,"missing bod: bod=%lu ddslen=%lu\n",
|
||||
(unsigned long)*ddslen,(unsigned long)*bod);
|
||||
(unsigned long)ddslen,(unsigned long)bod);
|
||||
#endif
|
||||
}
|
||||
tree->data.bod = bod;
|
||||
@ -469,7 +469,7 @@ fprintf(stderr,"ocextractddsinfile:\n");
|
||||
ddslen = tree->data.datasize;
|
||||
#ifdef OCDEBUG
|
||||
fprintf(stderr,"missing bod: bod=%lu ddslen=%lu\n",
|
||||
(unsigned long)*ddslen,(unsigned long)*bod);
|
||||
(unsigned long)ddslen,(unsigned long)bod);
|
||||
#endif
|
||||
}
|
||||
tree->data.bod = bod;
|
||||
|
60
oc2/oclist.c
60
oc2/oclist.c
@ -6,7 +6,7 @@
|
||||
|
||||
#include "oclist.h"
|
||||
|
||||
int oclistnull(ocelem e) {return e == NULL;}
|
||||
int oclistnull(void* e) {return e == NULL;}
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
@ -23,7 +23,7 @@ OClist* oclistnew(void)
|
||||
OClist* l;
|
||||
/*
|
||||
if(!ocinitialized) {
|
||||
memset((void*)&ocDATANULL,0,sizeof(ocelem));
|
||||
memset((void*)&ocDATANULL,0,sizeof(void*));
|
||||
ocinitialized = 1;
|
||||
}
|
||||
*/
|
||||
@ -48,15 +48,15 @@ oclistfree(OClist* l)
|
||||
}
|
||||
|
||||
int
|
||||
oclistsetalloc(OClist* l, unsigned int sz)
|
||||
oclistsetalloc(OClist* l, unsigned long sz)
|
||||
{
|
||||
ocelem* newcontent;
|
||||
void** newcontent;
|
||||
if(l == NULL) return FALSE;
|
||||
if(sz <= 0) {sz = (l->length?2*l->length:DEFAULTALLOC);}
|
||||
if(l->alloc >= sz) {return TRUE;}
|
||||
newcontent=(ocelem*)calloc(sz,sizeof(ocelem));
|
||||
newcontent=(void**)calloc(sz,sizeof(void*));
|
||||
if(l->alloc > 0 && l->length > 0 && l->content != NULL) {
|
||||
memcpy((void*)newcontent,(void*)l->content,sizeof(ocelem)*l->length);
|
||||
memcpy((void*)newcontent,(void*)l->content,sizeof(void*)*l->length);
|
||||
}
|
||||
if(l->content != NULL) free(l->content);
|
||||
l->content=newcontent;
|
||||
@ -65,7 +65,7 @@ oclistsetalloc(OClist* l, unsigned int sz)
|
||||
}
|
||||
|
||||
int
|
||||
oclistsetlength(OClist* l, unsigned int sz)
|
||||
oclistsetlength(OClist* l, unsigned long sz)
|
||||
{
|
||||
if(l == NULL) return FALSE;
|
||||
if(sz > l->alloc && !oclistsetalloc(l,sz)) return FALSE;
|
||||
@ -73,8 +73,8 @@ oclistsetlength(OClist* l, unsigned int sz)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ocelem
|
||||
oclistget(OClist* l, unsigned int index)
|
||||
void*
|
||||
oclistget(OClist* l, unsigned long index)
|
||||
{
|
||||
if(l == NULL || l->length == 0) return NULL;
|
||||
if(index >= l->length) return NULL;
|
||||
@ -82,7 +82,7 @@ oclistget(OClist* l, unsigned int index)
|
||||
}
|
||||
|
||||
int
|
||||
oclistset(OClist* l, unsigned int index, ocelem elem)
|
||||
oclistset(OClist* l, unsigned long index, void* elem)
|
||||
{
|
||||
if(l == NULL) return FALSE;
|
||||
if(index >= l->length) return FALSE;
|
||||
@ -92,7 +92,7 @@ oclistset(OClist* l, unsigned int index, ocelem elem)
|
||||
|
||||
/* Insert at position i of l; will push up elements i..|seq|. */
|
||||
int
|
||||
oclistinsert(OClist* l, unsigned int index, ocelem elem)
|
||||
oclistinsert(OClist* l, unsigned long index, void* elem)
|
||||
{
|
||||
int i; /* do not make unsigned */
|
||||
if(l == NULL) return FALSE;
|
||||
@ -105,7 +105,7 @@ oclistinsert(OClist* l, unsigned int index, ocelem elem)
|
||||
}
|
||||
|
||||
int
|
||||
oclistpush(OClist* l, ocelem elem)
|
||||
oclistpush(OClist* l, void* elem)
|
||||
{
|
||||
if(l == NULL) return FALSE;
|
||||
if(l->length >= l->alloc) oclistsetalloc(l,0);
|
||||
@ -114,7 +114,7 @@ oclistpush(OClist* l, ocelem elem)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ocelem
|
||||
void*
|
||||
oclistpop(OClist* l)
|
||||
{
|
||||
if(l == NULL || l->length == 0) return NULL;
|
||||
@ -122,18 +122,18 @@ oclistpop(OClist* l)
|
||||
return l->content[l->length];
|
||||
}
|
||||
|
||||
ocelem
|
||||
void*
|
||||
oclisttop(OClist* l)
|
||||
{
|
||||
if(l == NULL || l->length == 0) return NULL;
|
||||
return l->content[l->length - 1];
|
||||
}
|
||||
|
||||
ocelem
|
||||
oclistremove(OClist* l, unsigned int i)
|
||||
void*
|
||||
oclistremove(OClist* l, unsigned long i)
|
||||
{
|
||||
unsigned int len;
|
||||
ocelem elem;
|
||||
unsigned long len;
|
||||
void* elem;
|
||||
if(l == NULL || (len=l->length) == 0) return NULL;
|
||||
if(i >= len) return NULL;
|
||||
elem = l->content[i];
|
||||
@ -143,19 +143,19 @@ oclistremove(OClist* l, unsigned int i)
|
||||
}
|
||||
|
||||
/* Duplicate and return the content (null terminate) */
|
||||
ocelem*
|
||||
void**
|
||||
oclistdup(OClist* l)
|
||||
{
|
||||
ocelem* result = (ocelem*)malloc(sizeof(ocelem)*(l->length+1));
|
||||
memcpy((void*)result,(void*)l->content,sizeof(ocelem)*l->length);
|
||||
result[l->length] = (ocelem)0;
|
||||
void** result = (void**)malloc(sizeof(void*)*(l->length+1));
|
||||
memcpy((void*)result,(void*)l->content,sizeof(void*)*l->length);
|
||||
result[l->length] = (void*)0;
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
oclistcontains(OClist* list, ocelem elem)
|
||||
oclistcontains(OClist* list, void* elem)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned long i;
|
||||
for(i=0;i<oclistlength(list);i++) {
|
||||
if(elem == oclistget(list,i)) return 1;
|
||||
}
|
||||
@ -164,14 +164,14 @@ oclistcontains(OClist* list, ocelem elem)
|
||||
|
||||
/* Remove element by value; only removes first encountered */
|
||||
int
|
||||
oclistelemremove(OClist* l, ocelem elem)
|
||||
oclistelemremove(OClist* l, void* elem)
|
||||
{
|
||||
unsigned int len;
|
||||
unsigned int i;
|
||||
unsigned long len;
|
||||
unsigned long i;
|
||||
int found = 0;
|
||||
if(l == NULL || (len=l->length) == 0) return 0;
|
||||
for(i=0;i<oclistlength(l);i++) {
|
||||
ocelem candidate = l->content[i];
|
||||
void* candidate = l->content[i];
|
||||
if(elem == candidate) {
|
||||
for(i+=1;i<len;i++) l->content[i-1] = l->content[i];
|
||||
l->length--;
|
||||
@ -193,8 +193,8 @@ oclistelemremove(OClist* l, ocelem elem)
|
||||
int
|
||||
oclistunique(OClist* list)
|
||||
{
|
||||
unsigned int i,j,k,len;
|
||||
ocelem* content;
|
||||
unsigned long i,j,k,len;
|
||||
void** content;
|
||||
if(list == NULL || list->length == 0) return 1;
|
||||
len = list->length;
|
||||
content = list->content;
|
||||
|
38
oc2/oclist.h
38
oc2/oclist.h
@ -11,43 +11,41 @@
|
||||
#define EXTERNC extern
|
||||
#endif
|
||||
|
||||
typedef void* ocelem;
|
||||
|
||||
EXTERNC int oclistnull(ocelem);
|
||||
EXTERNC int oclistnull(void*);
|
||||
|
||||
typedef struct OClist {
|
||||
unsigned int alloc;
|
||||
unsigned int length;
|
||||
ocelem* content;
|
||||
unsigned long alloc;
|
||||
unsigned long length;
|
||||
void** content;
|
||||
} OClist;
|
||||
|
||||
EXTERNC OClist* oclistnew(void);
|
||||
EXTERNC int oclistfree(OClist*);
|
||||
EXTERNC int oclistsetalloc(OClist*,unsigned int);
|
||||
EXTERNC int oclistsetlength(OClist*,unsigned int);
|
||||
EXTERNC int oclistsetalloc(OClist*,unsigned long);
|
||||
EXTERNC int oclistsetlength(OClist*,unsigned long);
|
||||
|
||||
/* Set the ith element */
|
||||
EXTERNC int oclistset(OClist*,unsigned int,ocelem);
|
||||
EXTERNC int oclistset(OClist*,unsigned long,void*);
|
||||
/* Get value at position i */
|
||||
EXTERNC ocelem oclistget(OClist*,unsigned int);/* Return the ith element of l */
|
||||
EXTERNC void* oclistget(OClist*,unsigned long);/* Return the ith element of l */
|
||||
/* Insert at position i; will push up elements i..|seq|. */
|
||||
EXTERNC int oclistinsert(OClist*,unsigned int,ocelem);
|
||||
EXTERNC int oclistinsert(OClist*,unsigned long,void*);
|
||||
/* Remove element at position i; will move higher elements down */
|
||||
EXTERNC ocelem oclistremove(OClist* l, unsigned int i);
|
||||
EXTERNC void* oclistremove(OClist* l, unsigned long i);
|
||||
|
||||
/* Tail operations */
|
||||
EXTERNC int oclistpush(OClist*,ocelem); /* Add at Tail */
|
||||
EXTERNC ocelem oclistpop(OClist*);
|
||||
EXTERNC ocelem oclisttop(OClist*);
|
||||
EXTERNC int oclistpush(OClist*,void*); /* Add at Tail */
|
||||
EXTERNC void* oclistpop(OClist*);
|
||||
EXTERNC void* oclisttop(OClist*);
|
||||
|
||||
/* Duplicate and return the content (null terminate) */
|
||||
EXTERNC ocelem* oclistdup(OClist*);
|
||||
EXTERNC void** oclistdup(OClist*);
|
||||
|
||||
/* Look for value match */
|
||||
EXTERNC int oclistcontains(OClist*, ocelem);
|
||||
EXTERNC int oclistcontains(OClist*, void*);
|
||||
|
||||
/* Remove element by value; only removes first encountered */
|
||||
EXTERNC int oclistelemremove(OClist* l, ocelem elem);
|
||||
EXTERNC int oclistelemremove(OClist* l, void* elem);
|
||||
|
||||
/* remove duplicates */
|
||||
EXTERNC int oclistunique(OClist*);
|
||||
@ -56,9 +54,9 @@ EXTERNC int oclistunique(OClist*);
|
||||
EXTERNC OClist* oclistclone(OClist*);
|
||||
|
||||
/* Following are always "in-lined"*/
|
||||
#define oclistclear(l) oclistsetlength((l),0U)
|
||||
#define oclistclear(l) oclistsetlength((l),0)
|
||||
#define oclistextend(l,len) oclistsetalloc((l),(len)+(l->alloc))
|
||||
#define oclistcontents(l) ((l)==NULL?NULL:(l)->content)
|
||||
#define oclistlength(l) ((l)==NULL?0U:(l)->length)
|
||||
#define oclistlength(l) ((l)==NULL?0:(l)->length)
|
||||
|
||||
#endif /*OCLIST_H*/
|
||||
|
20
oc2/ocnode.c
20
oc2/ocnode.c
@ -104,7 +104,7 @@ occollectpathtonode(OCnode* node, OClist* path)
|
||||
{
|
||||
if(node == NULL) return;
|
||||
occollectpathtonode(node->container,path);
|
||||
oclistpush(path,(ocelem)node);
|
||||
oclistpush(path,(void*)node);
|
||||
}
|
||||
|
||||
OCnode*
|
||||
@ -271,11 +271,11 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
|
||||
int hasattributes = 0;
|
||||
if(das->octype == OC_Attribute) continue; /* ignore these for now*/
|
||||
if(das->name == NULL || das->att.isglobal) {
|
||||
oclistpush(dasglobals,(ocelem)das);
|
||||
oclistpush(dasglobals,(void*)das);
|
||||
continue;
|
||||
}
|
||||
if(das->att.isdods) {
|
||||
oclistpush(dodsglobals,(ocelem)das);
|
||||
oclistpush(dodsglobals,(void*)das);
|
||||
continue;
|
||||
}
|
||||
for(j=0;j<oclistlength(das->subnodes);j++) {
|
||||
@ -291,14 +291,14 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
|
||||
oclog(OCLOGWARN,"oc_mergedas: potentially ambiguous DAS name: %s",das->name);
|
||||
}
|
||||
}
|
||||
oclistpush(dasnodes,(ocelem)das);
|
||||
oclistpush(dasnodes,(void*)das);
|
||||
}
|
||||
}
|
||||
|
||||
/* 2. collect all the leaf DDS nodes (of type OC_Atomic)*/
|
||||
for(i=0;i<oclistlength(ddsnodes);i++) {
|
||||
OCnode* dds = (OCnode*)oclistget(ddsnodes,i);
|
||||
if(dds->octype == OC_Atomic) oclistpush(varnodes,(ocelem)dds);
|
||||
if(dds->octype == OC_Atomic) oclistpush(varnodes,(void*)dds);
|
||||
}
|
||||
|
||||
/* 3. For each das node, locate matching DDS node(s) and attach
|
||||
@ -317,7 +317,7 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
|
||||
|| strcmp(das->name,dds->name)==0) {
|
||||
mergedas1(dds,das);
|
||||
/* remove from dasnodes list*/
|
||||
oclistset(dasnodes,i,(ocelem)NULL);
|
||||
oclistset(dasnodes,i,(void*)NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,7 +362,7 @@ mergedas1(OCnode* dds, OCnode* das)
|
||||
OCattribute* att = makeattribute(attnode->name,
|
||||
attnode->etype,
|
||||
attnode->att.values);
|
||||
oclistpush(dds->attributes,(ocelem)att);
|
||||
oclistpush(dds->attributes,(void*)att);
|
||||
}
|
||||
}
|
||||
return OCTHROW(stat);
|
||||
@ -399,7 +399,7 @@ mergedods1(OCnode* dds, OCnode* dods)
|
||||
attnode->etype,
|
||||
attnode->att.values);
|
||||
free(newname);
|
||||
oclistpush(dds->attributes,(ocelem)att);
|
||||
oclistpush(dds->attributes,(void*)att);
|
||||
}
|
||||
}
|
||||
return OCTHROW(stat);
|
||||
@ -425,7 +425,7 @@ ocddsdasmerge(OCstate* state, OCnode* ddsroot, OCnode* dasroot)
|
||||
Attribute* att = makeattribute(attnode->name,
|
||||
attnode->etype,
|
||||
attnode->att.values);
|
||||
oclistpush(globals,(ocelem)att);
|
||||
oclistpush(globals,(void*)att);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -466,7 +466,7 @@ mergedas1(OCnode* dds, OCnode* das)
|
||||
Attribute* att = makeattribute(attnode->name,
|
||||
attnode->etype,
|
||||
attnode->att.values);
|
||||
oclistpush(dds->attributes,(ocelem)att);
|
||||
oclistpush(dds->attributes,(void*)att);
|
||||
}
|
||||
}
|
||||
/* Try to merge any enclosed sets with subnodes of dds*/
|
||||
|
@ -56,7 +56,7 @@ makedimlist(OClist* path, OClist* dims)
|
||||
unsigned int rank = node->array.rank;
|
||||
for(j=0;j<rank;j++) {
|
||||
OCnode* dim = (OCnode*)oclistget(node->array.dimensions,j);
|
||||
oclistpush(dims,(ocelem)dim);
|
||||
oclistpush(dims,(void*)dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user