fix error handling.
This commit is contained in:
parent
f065e9359b
commit
5b537ef7e2
10
C/arith1.c
10
C/arith1.c
@ -757,11 +757,15 @@ p_unary_is(void)
|
|||||||
if (top == 0L)
|
if (top == 0L)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (IsIntTerm(t)) {
|
if (IsIntTerm(t)) {
|
||||||
return Yap_unify_constant(ARG1,eval1(IntOfTerm(t), top));
|
Term tout = eval1(IntegerOfTerm(t), top);
|
||||||
|
if (!tout)
|
||||||
|
return FALSE;
|
||||||
|
return Yap_unify_constant(ARG1,tout);
|
||||||
}
|
}
|
||||||
if (IsAtomTerm(t)) {
|
if (IsAtomTerm(t)) {
|
||||||
Atom name = AtomOfTerm(t);
|
Atom name = AtomOfTerm(t);
|
||||||
ExpEntry *p;
|
ExpEntry *p;
|
||||||
|
Term out;
|
||||||
|
|
||||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 1)))) {
|
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 1)))) {
|
||||||
Term ti[2];
|
Term ti[2];
|
||||||
@ -776,7 +780,9 @@ p_unary_is(void)
|
|||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
return Yap_unify_constant(ARG1,eval1(p->FOfEE, top));
|
if (!(out=eval1(p->FOfEE, top)))
|
||||||
|
return FALSE;
|
||||||
|
return Yap_unify_constant(ARG1,out);
|
||||||
}
|
}
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
14
C/arith2.c
14
C/arith2.c
@ -636,6 +636,8 @@ p_exp(Term t1, Term t2)
|
|||||||
if (i2 < 0) {
|
if (i2 < 0) {
|
||||||
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2,
|
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2,
|
||||||
"%d ^ %d", i1, i2);
|
"%d ^ %d", i1, i2);
|
||||||
|
P = (yamop *)FAILCODE;
|
||||||
|
RERROR();
|
||||||
}
|
}
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
/* two integers */
|
/* two integers */
|
||||||
@ -1227,11 +1229,15 @@ p_binary_is(void)
|
|||||||
if (t2 == 0L)
|
if (t2 == 0L)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (IsIntTerm(t)) {
|
if (IsIntTerm(t)) {
|
||||||
return Yap_unify_constant(ARG1,eval2(IntegerOfTerm(t), t1, t2));
|
Term tout = eval2(IntegerOfTerm(t), t1, t2);
|
||||||
|
if (!tout)
|
||||||
|
return FALSE;
|
||||||
|
return Yap_unify_constant(ARG1,tout);
|
||||||
}
|
}
|
||||||
if (IsAtomTerm(t)) {
|
if (IsAtomTerm(t)) {
|
||||||
Atom name = AtomOfTerm(t);
|
Atom name = AtomOfTerm(t);
|
||||||
ExpEntry *p;
|
ExpEntry *p;
|
||||||
|
Term out;
|
||||||
|
|
||||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 2)))) {
|
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 2)))) {
|
||||||
Term ti[2];
|
Term ti[2];
|
||||||
@ -1246,9 +1252,11 @@ p_binary_is(void)
|
|||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
return Yap_unify_constant(ARG1,eval2(p->FOfEE, t1, t2));
|
if (!(out=eval2(p->FOfEE, t1, t2)))
|
||||||
|
return FALSE;
|
||||||
|
return Yap_unify_constant(ARG1,out);
|
||||||
}
|
}
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
|
Reference in New Issue
Block a user