fix #37: give resource error if trying to create a functor with bignum arity

also, allow meta-call to create large functors > Int.
This commit is contained in:
Vitor Santos Costa 2009-05-29 22:34:50 -05:00
parent 0cd72ad258
commit e84ecf2eaf
2 changed files with 27 additions and 7 deletions

View File

@ -12272,7 +12272,11 @@ Yap_absmi(int inp)
d1 = IntegerOfTerm(d1);
else {
saveregs();
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
if (IsBigIntTerm(d1)) {
Yap_Error(RESOURCE_ERROR_STACK, d1, "functor/3");
} else {
Yap_Error(TYPE_ERROR_INTEGER, d1, "functor/3");
}
setregs();
FAIL();
}
@ -12392,7 +12396,11 @@ Yap_absmi(int inp)
d1 = IntegerOfTerm(d1);
else {
saveregs();
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
if (IsBigIntTerm(d1)) {
Yap_Error(RESOURCE_ERROR_STACK, d1, "functor/3");
} else {
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
}
setregs();
FAIL();
}
@ -12598,7 +12606,11 @@ Yap_absmi(int inp)
d1 = IntegerOfTerm(d1);
else {
saveregs();
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
if (IsBigIntTerm(d1)) {
Yap_Error(RESOURCE_ERROR_STACK, d1, "functor/3");
} else {
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
}
setregs();
FAIL();
}
@ -12736,7 +12748,11 @@ Yap_absmi(int inp)
d1 = IntegerOfTerm(d1);
} else {
saveregs();
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
if (IsBigIntTerm(d1)) {
Yap_Error(RESOURCE_ERROR_STACK, d1, "functor/3");
} else {
Yap_Error(TYPE_ERROR_INTEGER,d1,"functor/3");
}
setregs();
FAIL();
}
@ -13321,7 +13337,7 @@ Yap_absmi(int inp)
} else {
setregs();
}
goto restart_functor;
goto restart_functor; /* */
}
while ((Int)d1--) {
RESET_VARIABLE(pt1);

View File

@ -678,10 +678,14 @@ p_functor(void) /* functor(?,?,?) */
deref_head(d1, func_var_3unk);
func_var_3nvar:
/* Uuuff, the second and third argument are bound */
if (IsIntTerm(d1))
if (IsIntegerTerm(d1))
d1 = IntOfTerm(d1);
else {
Yap_Error(TYPE_ERROR_INTEGER,ARG3,"functor/3");
if (IsBigIntTerm(d1)) {
Yap_Error(RESOURCE_ERROR_STACK, ARG3, "functor/3");
} else {
Yap_Error(TYPE_ERROR_INTEGER,ARG3,"functor/3");
}
return(FALSE);
}
if (!IsAtomicTerm(d0)) {