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:
parent
01d2448b34
commit
8bccb86a43
18
C/dbase.c
18
C/dbase.c
@ -2054,8 +2054,8 @@ copy_attachments(CELL *ts)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Term
|
static int
|
||||||
GetDBKey(DBRef DBSP)
|
UnifyDBKey(DBRef DBSP, PropFlags flags, Term t)
|
||||||
{
|
{
|
||||||
DBProp p = DBSP->Parent;
|
DBProp p = DBSP->Parent;
|
||||||
Term t1, tf;
|
Term t1, tf;
|
||||||
@ -2067,16 +2067,18 @@ GetDBKey(DBRef DBSP)
|
|||||||
} else {
|
} else {
|
||||||
t1 = Yap_MkNewApplTerm(p->FunctorOfDB,p->ArityOfDB);
|
t1 = Yap_MkNewApplTerm(p->FunctorOfDB,p->ArityOfDB);
|
||||||
}
|
}
|
||||||
if (p->KindOfPE & MkCode) {
|
if (p->KindOfPE & CodeDBBit && (flags & CodeDBBit)) {
|
||||||
Term t[2];
|
Term t[2];
|
||||||
t[1] = Yap_LookupModule(p->ModuleOfDB);
|
t[1] = Yap_LookupModule(p->ModuleOfDB);
|
||||||
t[2] = t1;
|
t[2] = t1;
|
||||||
tf = Yap_MkApplTerm(FunctorModule, 2, t);
|
tf = Yap_MkApplTerm(FunctorModule, 2, t);
|
||||||
} else {
|
} else if (!(flags & CodeDBBit)) {
|
||||||
tf = t1;
|
tf = t1;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
READ_UNLOCK(p->DBRWLock);
|
READ_UNLOCK(p->DBRWLock);
|
||||||
return(tf);
|
return(Yap_unify(tf,t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2946,7 +2948,7 @@ in_rded(void)
|
|||||||
if (ref == NULL
|
if (ref == NULL
|
||||||
|| DEAD_REF(ref)
|
|| DEAD_REF(ref)
|
||||||
|| !Yap_unify(ARG2,GetDBTerm(ref))
|
|| !Yap_unify(ARG2,GetDBTerm(ref))
|
||||||
|| !Yap_unify(ARG1,GetDBKey(ref))) {
|
|| !UnifyDBKey(ref,0,ARG1)) {
|
||||||
UNLOCK(ref->lock);
|
UNLOCK(ref->lock);
|
||||||
cut_fail();
|
cut_fail();
|
||||||
} else {
|
} else {
|
||||||
@ -2998,7 +3000,7 @@ in_rdedp(void)
|
|||||||
if (ref == NULL
|
if (ref == NULL
|
||||||
|| DEAD_REF(ref)
|
|| DEAD_REF(ref)
|
||||||
|| !Yap_unify(ARG2,GetDBTerm(ref))
|
|| !Yap_unify(ARG2,GetDBTerm(ref))
|
||||||
|| !Yap_unify(ARG1,GetDBKey(ref))) {
|
|| !UnifyDBKey(ref,CodeDBBit,ARG1)) {
|
||||||
UNLOCK(ref->lock);
|
UNLOCK(ref->lock);
|
||||||
cut_fail();
|
cut_fail();
|
||||||
} else {
|
} else {
|
||||||
@ -3041,7 +3043,7 @@ p_somercdedp(void)
|
|||||||
if (ref == NULL
|
if (ref == NULL
|
||||||
|| DEAD_REF(ref)
|
|| DEAD_REF(ref)
|
||||||
|| !Yap_unify(ARG2,GetDBTerm(ref))
|
|| !Yap_unify(ARG2,GetDBTerm(ref))
|
||||||
|| !Yap_unify(ARG1,GetDBKey(ref))) {
|
|| !UnifyDBKey(ref,CodeDBBit,ARG1)) {
|
||||||
UNLOCK(ref->lock);
|
UNLOCK(ref->lock);
|
||||||
cut_fail();
|
cut_fail();
|
||||||
} else {
|
} else {
|
||||||
|
@ -4968,7 +4968,14 @@ If a term equal to @var{T} up to variable renaming is stored under key
|
|||||||
@saindex recorded/3
|
@saindex recorded/3
|
||||||
@cyindex recorded/3
|
@cyindex recorded/3
|
||||||
Searches in the internal database under the key @var{K}, a term that
|
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})
|
@item erase(+@var{R})
|
||||||
@findex erase/1
|
@findex erase/1
|
||||||
|
Reference in New Issue
Block a user