do some more checking and document.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@719 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-12-10 00:32:22 +00:00
parent 01d2448b34
commit 8bccb86a43
2 changed files with 18 additions and 9 deletions

View File

@ -2054,8 +2054,8 @@ copy_attachments(CELL *ts)
}
#endif
static Term
GetDBKey(DBRef DBSP)
static int
UnifyDBKey(DBRef DBSP, PropFlags flags, Term t)
{
DBProp p = DBSP->Parent;
Term t1, tf;
@ -2067,16 +2067,18 @@ GetDBKey(DBRef DBSP)
} else {
t1 = Yap_MkNewApplTerm(p->FunctorOfDB,p->ArityOfDB);
}
if (p->KindOfPE & MkCode) {
if (p->KindOfPE & CodeDBBit && (flags & CodeDBBit)) {
Term t[2];
t[1] = Yap_LookupModule(p->ModuleOfDB);
t[2] = t1;
tf = Yap_MkApplTerm(FunctorModule, 2, t);
} else {
} else if (!(flags & CodeDBBit)) {
tf = t1;
} else {
return FALSE;
}
READ_UNLOCK(p->DBRWLock);
return(tf);
return(Yap_unify(tf,t));
}
@ -2946,7 +2948,7 @@ in_rded(void)
if (ref == NULL
|| DEAD_REF(ref)
|| !Yap_unify(ARG2,GetDBTerm(ref))
|| !Yap_unify(ARG1,GetDBKey(ref))) {
|| !UnifyDBKey(ref,0,ARG1)) {
UNLOCK(ref->lock);
cut_fail();
} else {
@ -2998,7 +3000,7 @@ in_rdedp(void)
if (ref == NULL
|| DEAD_REF(ref)
|| !Yap_unify(ARG2,GetDBTerm(ref))
|| !Yap_unify(ARG1,GetDBKey(ref))) {
|| !UnifyDBKey(ref,CodeDBBit,ARG1)) {
UNLOCK(ref->lock);
cut_fail();
} else {
@ -3041,7 +3043,7 @@ p_somercdedp(void)
if (ref == NULL
|| DEAD_REF(ref)
|| !Yap_unify(ARG2,GetDBTerm(ref))
|| !Yap_unify(ARG1,GetDBKey(ref))) {
|| !UnifyDBKey(ref,CodeDBBit,ARG1)) {
UNLOCK(ref->lock);
cut_fail();
} else {

View File

@ -4968,7 +4968,14 @@ If a term equal to @var{T} up to variable renaming is stored under key
@saindex recorded/3
@cyindex recorded/3
Searches in the internal database under the key @var{K}, a term that
unifies with @var{T} and whose reference matches @var{R}.
unifies with @var{T} and whose reference matches @var{R}. This
built-in may be used in one of two ways:
@itemize @bullet
@item @var{K} may be given, in this case the built-in will return all
elements of the internal data-base that match the key.
@item @var{R} may be given, if so returning the key and element that
match the reference.
@end itemize
@item erase(+@var{R})
@findex erase/1