static void completesegments3(NClist* fullpath, NClist* segments) { int i,delta; /* add path nodes to segments to create full path */ delta = (nclistlength(fullpath) - nclistlength(segments)); ASSERT((delta >= 0)); for(i=0;i<delta;i++) { DCEsegment* seg = (DCEsegment*)dcecreate(CES_SEGMENT); CDFnode* node = (CDFnode*)nclistget(fullpath,i); seg->name = nulldup(node->ocname); seg->annotation = (void*)node; seg->rank = nclistlength(node->array.dimset0); #ifdef IGNORE for(j=0;j<seg->rank;j++) { CDFnode* dim = (CDFnode*)nclistget(node->array.dimset0,j); dcemakewholeslice(seg->slices+j,dim->dim.declsize); } #endif nclistinsert(segments,i,(ncelem)seg); } /* Now modify the segments to point to the appropriate node and fill in the slices. */ for(i=delta;i<nclistlength(segments);i++) { DCEsegment* seg = (DCEsegment*)nclistget(segments,i); CDFnode* node = (CDFnode*)nclistget(fullpath,i); seg->annotation = (void*)node; #ifdef IGNORE if(!seg->slicesdefined) { makewholesegment3(seg,node); } #endif } }
/* Collect the set of container nodes ending in "container"*/ void collectnodepath(CDFnode* node, NClist* path, int withdataset) { if(node == NULL) return; nclistpush(path,(void*)node); while(node->container != NULL) { node = node->container; if(!withdataset && node->nctype == NC_Dataset) break; nclistinsert(path,0,(void*)node); } }
/* Collect the set of parent group nodes of node */ void crcollectnodepath(CRnode* node, NClist* path) { Group* group; if(node == NULL) return; nclistpush(path,(ncelem)node); group = node->group; while(group != NULL) { nclistinsert(path,0,(ncelem)group); group = ((CRnode*)group)->group; } }
/* Replace new client param (name,value); return value = 1 => replacement performed 0 => insertion performed */ static int nc_urlparamreplace(NClist* params, const char* clientparam, const char* value) { int i; if(params == NULL || clientparam == NULL) return 0; for(i=0;i<nclistlength(params);i+=2) { char* name = (char*)nclistget(params,i); if(strcmp(clientparam,name)==0) { nclistinsert(params,i+1,(ncelem)nulldup(value)); return 1; } } nc_urlparaminsert(params,clientparam,value); return 0; }
static void completesegments(NClist* fullpath, NClist* segments) { int i,delta; /* add path nodes to segments to create full path */ delta = (nclistlength(fullpath) - nclistlength(segments)); ASSERT((delta >= 0)); for(i=0;i<delta;i++) { DCEsegment* seg = (DCEsegment*)dcecreate(CES_SEGMENT); CDFnode* node = (CDFnode*)nclistget(fullpath,i); seg->name = nulldup(node->ocname); seg->annotation = (void*)node; seg->rank = nclistlength(node->array.dimset0); nclistinsert(segments,i,(void*)seg); } /* Now modify the segments to point to the appropriate node and fill in the slices. */ for(i=delta;i<nclistlength(segments);i++) { DCEsegment* seg = (DCEsegment*)nclistget(segments,i); CDFnode* node = (CDFnode*)nclistget(fullpath,i); seg->annotation = (void*)node; } }