/* convert all names in selections to be fully qualified */ static NCerror qualifyselectionnames3(DCEselection* sel) { NCerror ncstat = NC_NOERR; int i; NClist* segments = NULL; NClist* fullpath = nclistnew(); ASSERT(sel->lhs->discrim == CES_VAR); collectnodepath3((CDFnode*)sel->lhs->var->annotation,fullpath,!WITHDATASET); #ifdef DEBUG fprintf(stderr,"qualify.sel: %s -> ", dumpselection(sel)); #endif /* Now add path nodes to create full path */ completesegments3(fullpath,sel->lhs->var->segments); for(i=0;i<nclistlength(sel->rhs);i++) { DCEvalue* value = (DCEvalue*)nclistget(sel->rhs,i); if(value->discrim != CES_VAR) continue; nclistclear(fullpath); collectnodepath3((CDFnode*)value->var->annotation,fullpath,!WITHDATASET); completesegments3(fullpath,value->var->segments); } nclistfree(segments); nclistfree(fullpath); return THROW(ncstat); }
char* dumpselections(NClist* selections) { int i; NCbytes* buf = ncbytesnew(); char* sstring; if(nclistlength(selections) == 0) return nulldup(""); for(i=0;i<nclistlength(selections);i++) { NCselection* sel = (NCselection*)nclistget(selections,i); ncbytescat(buf,dumpselection(sel)); } sstring = ncbytesdup(buf); ncbytesfree(buf); return sstring; }