error handling
This commit is contained in:
parent
da65d7bd3c
commit
cc7c0ebac8
20
C/compiler.c
20
C/compiler.c
@ -1081,7 +1081,8 @@ static void c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal,
|
||||
char s[32];
|
||||
|
||||
Yap_bip_name(Op, s);
|
||||
Yap_ThrowError( TYPE_ERROR_NUMBER, t2, "compiling %s/2 with output bound", s);
|
||||
Yap_ThrowError(TYPE_ERROR_NUMBER, t2, 1,
|
||||
"compiling %s/2 with output bound", s);
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
}
|
||||
@ -1093,7 +1094,7 @@ static void c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal,
|
||||
char s[32];
|
||||
|
||||
Yap_bip_name(Op, s);
|
||||
Yap_ThrowError(INSTANTIATION_ERROR , t2, "compiling %s/3", s);
|
||||
Yap_ThrowError(INSTANTIATION_ERROR, t2, 1, "compiling %s/3", s);
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
}
|
||||
@ -1103,14 +1104,15 @@ static void c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal,
|
||||
Int i2;
|
||||
|
||||
if (!IsIntegerTerm(t2)) {
|
||||
Yap_Error( TYPE_ERROR_INTEGER, t2, "compiling functor/3");
|
||||
Yap_ThrowError(TYPE_ERROR_INTEGER, t2, 1, "compiling functor/3");
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
}
|
||||
i2 = IntegerOfTerm(t2);
|
||||
if (i2 < 0) {
|
||||
|
||||
Yap_ThrowError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO , t2,4, "compiling functor/3");
|
||||
Yap_ThrowError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2, 4,
|
||||
"compiling functor/3");
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
}
|
||||
@ -1121,9 +1123,8 @@ static void c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal,
|
||||
} else if (!IsAtomTerm(t1)) {
|
||||
char s[32];
|
||||
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_ATOM;
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(LOCAL_ErrorMessage, "compiling functor/3");
|
||||
Yap_ThrowError(TYPE_ERROR_ATOM, t2, 4, "compiling functor/3");
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
}
|
||||
@ -1177,9 +1178,8 @@ static void c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal,
|
||||
else {
|
||||
char s[32];
|
||||
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_INTEGER;
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(LOCAL_ErrorMessage, "compiling %s/2", s);
|
||||
Yap_ThrowError(TYPE_ERROR_INTEGER, t1, 1, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
}
|
||||
@ -1189,6 +1189,8 @@ static void c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal,
|
||||
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_COMPOUND;
|
||||
Yap_bip_name(Op, s);
|
||||
Yap_ThrowError(TYPE_ERROR_COMPOUND, t2, 1, "compiling %s/2", 1, s);
|
||||
|
||||
save_machine_regs();
|
||||
siglongjmp(cglobs->cint.CompilerBotch, 1);
|
||||
} else if (IsApplTerm(t2)) {
|
||||
@ -1475,7 +1477,7 @@ static void c_goal(Term Goal, Term mod, compiler_struct *cglobs) {
|
||||
PredEntry *p;
|
||||
Prop p0;
|
||||
|
||||
Goal = Yap_YapStripModule( Goal, &mod);
|
||||
Goal = Yap_YapStripModule(Goal, &mod);
|
||||
if (IsVarTerm(Goal)) {
|
||||
Goal = Yap_MkApplTerm(FunctorCall, 1, &Goal);
|
||||
} else if (IsNumTerm(Goal)) {
|
||||
|
Reference in New Issue
Block a user