// Function to convert it into its fully separated path. string Id::path( const string& separator) const { string ret = Neutral::path( eref() ); // Trim off trailing [] assert( ret.length() > 0 ); // the 'back' operation is not supported by pre 2011 compilers while ( ret[ ret.length() - 1 ] == ']' ) { size_t pos = ret.find_last_of( '[' ); if ( pos != string::npos && pos > 0 ) { ret = ret.substr( 0, pos ); } } return ret; }
/////////////////////////////////// // storage entry point to database // void DbIntlog::Add(Clause *c, int first, DbIntlog *owner) { Term h = c->get_head(); ASSERT(!h.type(f_NOTERM)); #ifdef _DEBUG CCP tstring = h.get_funct(); #endif e_DbList *edbl = new e_DbList(c); // retrieve or create the entry kstring funct = h.get_funct(); int arity = h.get_arity(); DbEntry e(funct, arity), *dbe = isin(e); // verify location on create if (dbe == 0 && owner && owner != this) dbe = owner->isin(e); if (!dbe) { dbe = new DbEntry(funct, arity); insert(dbe); } if (dbe->arity == -1) dbe->arity = arity; DbIntlog *dbwork = this; if (dbe->vProp == DbEntry::dynamic) { if (!owner) owner = this; dbe = owner->isin(dbe); ASSERT(dbe); c->set_db(dbwork = owner); } else if (owner && owner != this) { edbl->type = e_DbList::tLocData; c->set_db(owner); } if (first) dbe->entries.insert(edbl, 0); else { DbListSeek eref(e_DbList::tExtRef); DbListSeek vtbl(e_DbList::tVTable); unsigned iref = dbe->entries.seek(&eref); unsigned itbl = dbe->entries.seek(&vtbl); if (iref != SLIST_INVPOS) dbe->entries.insert(edbl, iref); else if (itbl != SLIST_INVPOS) dbe->entries.insert(edbl, itbl); else dbe->entries.append(edbl); } // close inheritance chainings dbwork->check_inherited_entries(dbe); }