fix error handling.
This commit is contained in:
parent
6dbc6f09fa
commit
abe4744fe7
23
C/cmppreds.c
23
C/cmppreds.c
@ -643,8 +643,11 @@ p_acomp(void)
|
|||||||
{ /* $a_compare(?R,+X,+Y) */
|
{ /* $a_compare(?R,+X,+Y) */
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
Term t2 = Deref(ARG2);
|
Term t2 = Deref(ARG2);
|
||||||
|
Int out;
|
||||||
|
|
||||||
return a_cmp(t1, t2);
|
out = a_cmp(t1, t2);
|
||||||
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
@ -675,42 +678,48 @@ a_eq(Term t1, Term t2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
out = a_cmp(t1,t2);
|
out = a_cmp(t1,t2);
|
||||||
return !ArithError && (out == 0);
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
a_dif(Term t1, Term t2)
|
a_dif(Term t1, Term t2)
|
||||||
{
|
{
|
||||||
Int out = a_cmp(Deref(t1),Deref(t2));
|
Int out = a_cmp(Deref(t1),Deref(t2));
|
||||||
return !ArithError && out != 0;
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
a_gt(Term t1, Term t2)
|
a_gt(Term t1, Term t2)
|
||||||
{ /* A > B */
|
{ /* A > B */
|
||||||
Int out = a_cmp(Deref(t1),Deref(t2));
|
Int out = a_cmp(Deref(t1),Deref(t2));
|
||||||
return !ArithError && out > 0;
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
a_ge(Term t1, Term t2)
|
a_ge(Term t1, Term t2)
|
||||||
{ /* A >= B */
|
{ /* A >= B */
|
||||||
Int out = a_cmp(Deref(t1),Deref(t2));
|
Int out = a_cmp(Deref(t1),Deref(t2));
|
||||||
return !ArithError && out >= 0;
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
a_lt(Term t1, Term t2)
|
a_lt(Term t1, Term t2)
|
||||||
{ /* A < B */
|
{ /* A < B */
|
||||||
Int out = a_cmp(Deref(t1),Deref(t2));
|
Int out = a_cmp(Deref(t1),Deref(t2));
|
||||||
return !ArithError && out < 0;
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
a_le(Term t1, Term t2)
|
a_le(Term t1, Term t2)
|
||||||
{ /* A <= B */
|
{ /* A <= B */
|
||||||
Int out = a_cmp(Deref(t1),Deref(t2));
|
Int out = a_cmp(Deref(t1),Deref(t2));
|
||||||
return !ArithError && out <= 0;
|
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||||
|
return out <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user