fix current_predicate
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@587 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
e801069a19
commit
2fff206939
18
C/stdpreds.c
18
C/stdpreds.c
@ -111,8 +111,14 @@ static Int
|
||||
p_value(void)
|
||||
{ /* '$get_value'(+Atom,?Val) */
|
||||
Term t1 = Deref(ARG1);
|
||||
if (!IsAtomTerm(t1))
|
||||
if (IsVarTerm(t1)) {
|
||||
Error(INSTANTIATION_ERROR,t1,"get_value/2");
|
||||
return (FALSE);
|
||||
}
|
||||
if (!IsAtomTerm(t1)) {
|
||||
Error(TYPE_ERROR_ATOM,t1,"get_value/2");
|
||||
return (FALSE);
|
||||
}
|
||||
return (unify_constant(ARG2, GetValue(AtomOfTerm(t1))));
|
||||
}
|
||||
|
||||
@ -122,8 +128,14 @@ p_values(void)
|
||||
{ /* '$values'(Atom,Old,New) */
|
||||
Term t1 = Deref(ARG1), t3 = Deref(ARG3);
|
||||
|
||||
if (!IsAtomTerm(t1))
|
||||
if (IsVarTerm(t1)) {
|
||||
Error(INSTANTIATION_ERROR,t1,"set_value/2");
|
||||
return (FALSE);
|
||||
}
|
||||
if (!IsAtomTerm(t1)) {
|
||||
Error(TYPE_ERROR_ATOM,t1,"set_value/2");
|
||||
return (FALSE);
|
||||
}
|
||||
if (!unify_constant(ARG2, GetValue(AtomOfTerm(t1))))
|
||||
return (FALSE);
|
||||
if (!IsVarTerm(t3)) {
|
||||
@ -1399,10 +1411,8 @@ static Int
|
||||
init_current_predicate(void)
|
||||
{
|
||||
Term t1 = Deref(ARG1);
|
||||
Term t2 = Deref(ARG2);
|
||||
|
||||
if (IsVarTerm(t1) || !IsAtomTerm(t1)) cut_fail();
|
||||
if (IsVarTerm(t2) || !IsAtomTerm(t2)) cut_fail();
|
||||
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)ModulePred[LookupModule(t1)]);
|
||||
return (cont_current_predicate());
|
||||
}
|
||||
|
@ -702,6 +702,15 @@ p_softfunctor()
|
||||
|
||||
#endif /* SFUNC */
|
||||
|
||||
#include <math.h>
|
||||
*
|
||||
static Int
|
||||
p_matching_distances(void)
|
||||
{
|
||||
return(fabs(FloatOfTerm(Deref(ARG1))-FloatOfTerm(Deref(ARG2))) <= FloatOfTerm(Deref(ARG3)));
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
InitUserCPreds(void)
|
||||
{
|
||||
@ -722,12 +731,14 @@ InitUserCPreds(void)
|
||||
#ifdef SFUNC
|
||||
InitCPred("sparse_functor", 2, p_softfunctor, SafePredFlag);
|
||||
#endif /* SFUNC */
|
||||
/* InitCPred("match_distances", 3, p_matching_distances, SafePredFlag); */
|
||||
/* InitCPred("unify",2,p_unify,SafePredFlag); */
|
||||
/* InitCPred("occurs_check",2,p_occurs_check,SafePredFlag); */
|
||||
/* InitCPred("counter",3,p_counter,SafePredFlag); */
|
||||
/* InitCPred("iconcat",3,p_iconcat,SafePredFlag); */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InitUserBacks(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user