/* Collect the set of nodes ending in "node"*/ void collectpathtonode(OCnode* node, OClist* path) { if(node == NULL) return; collectpathtonode(node->container,path); oclistpush(path,(ocelem)node); }
static void computefullname(OCnode* node) { char* tmp; char* fullname; OClist* path; OCASSERT((node->name != NULL)); path = oclistnew(); collectpathtonode(node,path); tmp = pathtostring(path,PATHSEPARATOR,1); if(tmp == NULL) { fullname = strdup(node->name); } else { fullname = tmp; } node->fullname = fullname; oclistfree(path); }
void ocdumpclause(OCprojectionclause* ref) { unsigned int i; OClist* path = oclistnew(); collectpathtonode(ref->node,path); for(i=0;i<oclistlength(path);i++) { OClist* sliceset; OCnode* node = (OCnode*)oclistget(path,i); if(node->tree != NULL) continue; /* leave off the root node*/ fprintf(stderr,"%s%s",(i>0?PATHSEPARATOR:""),node->name); sliceset = (OClist*)oclistget(ref->indexsets,i); if(sliceset != NULL) { unsigned int j; for(j=0;j<oclistlength(sliceset);j++) { OCslice* slice = (OCslice*)oclistget(sliceset,j); ocdumpslice(slice); } } } }