char* dumpprojection1(NCprojection* p) { int i; NCbytes* buf; char* pstring; if(p == NULL) return nulldup(""); buf = ncbytesnew(); for(i=0;i<nclistlength(p->segments);i++) { NCsegment* segment = (NCsegment*)nclistget(p->segments,i); char tmp[1024]; snprintf(tmp,sizeof(tmp),"%s%s/%lu", (i > 0?".":""), (segment->segment?segment->segment:"<unknown>"), (unsigned long)segment->slicerank); ncbytescat(buf,tmp); if(segment->slicesdefined) ncbytescat(buf,dumpslices(segment->slices,segment->slicerank)); else ncbytescat(buf,"[-]"); } if(iswholeprojection(p)) ncbytescat(buf,"*"); ncbytescat(buf,"("); if(p->leaf != NULL) ncbytescat(buf,p->leaf->name); ncbytescat(buf,")"); pstring = ncbytesdup(buf); ncbytesfree(buf); return pstring; }
int iswholeconstraint(DCEconstraint* con) { int i; if(con == NULL) return 1; if(con->projections != NULL) { for(i=0;i<nclistlength(con->projections);i++) { if(!iswholeprojection((DCEprojection*)nclistget(con->projections,i))) return 0; } } if(con->selections != NULL) return 0; return 1; }