fix nb_current/2

This commit is contained in:
Vitor Santos Costa 2010-03-01 21:48:39 +00:00
parent 46f0a0644c
commit 51982bee42
2 changed files with 9 additions and 6 deletions

View File

@ -2613,10 +2613,16 @@ init_current_nb(void)
{ /* current_atom(?Atom) */
Term t1 = Deref(ARG1);
if (!IsVarTerm(t1)) {
if (IsAtomTerm(t1))
cut_succeed();
else
if (IsAtomTerm(t1)) {
if (!FindGlobalEntry(AtomOfTerm(t1))) {
cut_fail();
} else {
cut_succeed();
}
} else {
Yap_Error(TYPE_ERROR_ATOM,t1,"nb_current");
cut_fail();
}
}
READ_LOCK(HashChain[0].AERWLock);
EXTRA_CBACK_ARG(1,1) = MkIntegerTerm((Int)GlobalVariables);

View File

@ -577,9 +577,6 @@ nth_instance(Key,Index,T,Ref) :-
instance(Ref,T).
nb_current(GlobalVariable, Val) :-
var(GlobalVariable), !,
'$nb_current'(GlobalVariable),
nb_getval(GlobalVariable, Val).
nb_current(GlobalVariable, Val) :-
nb_getval(GlobalVariable, Val).