errors
This commit is contained in:
parent
3d8ef251a5
commit
bc3555dfbf
@ -484,7 +484,7 @@ static char tmpbuf[YAP_BUF_SIZE];
|
||||
#define E2(A, B, C, D) \
|
||||
case A: \
|
||||
{ \
|
||||
Term ft[2], nt[3]; \
|
||||
Term ft[2], nt[3]; \
|
||||
nt[0] = MkAtomTerm(Yap_LookupAtom(C)); \
|
||||
nt[1] = MkAtomTerm(Yap_LookupAtom(D)); \
|
||||
nt[2] = MkVarTerm(); \
|
||||
@ -789,7 +789,6 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
||||
return P;
|
||||
}
|
||||
//reset_error_description();
|
||||
fprintf(stderr,"HR before jmp=%p\n", HR);
|
||||
// if (!throw) {
|
||||
Yap_JumpToEnv();
|
||||
// }
|
||||
@ -990,7 +989,7 @@ const char *Yap_errorClassName(yap_error_class_number e) {
|
||||
static Int read_exception(USES_REGS1) {
|
||||
yap_error_descriptor_t *t = AddressOfTerm(Deref(ARG1));
|
||||
Term rc = mkerrort(t->errorNo, Yap_BufferToTerm(t->culprit, TermNil), err2list(t));
|
||||
Yap_DebugPlWriteln(rc);
|
||||
// Yap_DebugPlWriteln(rc);
|
||||
return Yap_unify(ARG2, rc);
|
||||
}
|
||||
|
||||
@ -1004,7 +1003,7 @@ const char *Yap_errorClassName(yap_error_class_number e) {
|
||||
query = StringOfTerm(t);
|
||||
yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2));
|
||||
Term rc = queryErr(query, y);
|
||||
Yap_DebugPlWriteln(rc);
|
||||
// Yap_DebugPlWriteln(rc);
|
||||
return Yap_unify(ARG3, rc);
|
||||
}
|
||||
|
||||
|
1
C/eval.c
1
C/eval.c
@ -93,7 +93,6 @@ static Term get_matrix_element(Term t1, Term t2 USES_REGS) {
|
||||
static Term Eval(Term t USES_REGS) {
|
||||
|
||||
if (IsVarTerm(t)) {
|
||||
fprintf(stderr,"HR before jmp=%p v=%p\n", HR, VarOfTerm(t));
|
||||
Yap_ArithError(INSTANTIATION_ERROR, t, "in arithmetic");
|
||||
} else if (IsNumTerm(t)) {
|
||||
return t;
|
||||
|
12
C/exec.c
12
C/exec.c
@ -917,7 +917,6 @@ static Int setup_call_catcher_cleanup(USES_REGS1) {
|
||||
Int oENV = LCL0 - ENV;
|
||||
Int oYENV = LCL0 - YENV;
|
||||
bool rc;
|
||||
fprintf(stderr, "HR before catch=%p--%p\n", HR, B );
|
||||
Yap_DisableInterrupts(worker_id);
|
||||
rc = Yap_RunTopGoal(Setup, false);
|
||||
Yap_EnableInterrupts(worker_id);
|
||||
@ -1469,7 +1468,6 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
||||
}
|
||||
YENV = ASP;
|
||||
YENV[E_CB] = Unsigned(B);
|
||||
fprintf(stderr, "HR before absmi(%d)=%p--%p\n", lval, HR, B);
|
||||
out = Yap_absmi(0);
|
||||
/* make sure we don't leave a FAIL signal hanging around */
|
||||
Yap_get_signal(YAP_FAIL_SIGNAL);
|
||||
@ -1528,8 +1526,6 @@ static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) {
|
||||
choiceptr saved_b = B;
|
||||
bool out;
|
||||
|
||||
fprintf(stderr,"B before PrepGoal=%p\n", B);
|
||||
|
||||
Yap_PrepGoal(arity, pt, saved_b PASS_REGS);
|
||||
CACHE_A1();
|
||||
P = (yamop *)CodeAdr;
|
||||
@ -2031,11 +2027,11 @@ bool is_cleanup_cp(choiceptr cp_b) {
|
||||
// DBTerm *dbt = Yap_RefToException();
|
||||
while (handler
|
||||
&& Yap_PredForChoicePt(handler, NULL) != PredDollarCatch
|
||||
//&& LOCAL_CBorder < LCL0 - (CELL *)handler && handler->cp_ap != NOCODE
|
||||
//&& handler->cp_b != NULL
|
||||
&& LOCAL_CBorder < LCL0 - (CELL *)handler && handler->cp_ap != NOCODE
|
||||
&& handler->cp_b != NULL
|
||||
) {
|
||||
if (handler->cp_ap != NOCODE)
|
||||
handler->cp_ap = TRUSTFAILCODE;
|
||||
//if (handler->cp_ap != NOCODE)
|
||||
// handler->cp_ap = TRUSTFAILCODE;
|
||||
handler = handler->cp_b;
|
||||
}
|
||||
pop_text_stack(1);
|
||||
|
@ -1673,9 +1673,6 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
++ pt0;
|
||||
ptd0 = pt0;
|
||||
d0 = *ptd0;
|
||||
printf("%p--%p -> %lx\n", ptd0, pt0_end, d0);
|
||||
//Yap_DebugPlWriteln(d0);
|
||||
|
||||
deref_head(d0, attvars_in_term_unk);
|
||||
attvars_in_term_nvar:
|
||||
{
|
||||
@ -1733,7 +1730,6 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
}
|
||||
#endif
|
||||
arity_t a = ArityOfFunctor(f);
|
||||
printf("%p %d %p\n", f, a, ap2);
|
||||
pt0 = ap2;
|
||||
pt0_end = ap2 + a;
|
||||
}
|
||||
@ -1790,7 +1786,7 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
to_visit --;
|
||||
pt0 = to_visit->beg;
|
||||
pt0_end = to_visit->end;
|
||||
*pt0 = (CELL)to_visit[2];
|
||||
*pt0 = to_visit->oval;
|
||||
#else
|
||||
to_visit -= 2;
|
||||
pt0 = to_visit[0];
|
||||
@ -1817,9 +1813,9 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
trail_overflow:
|
||||
#ifdef RATIONAL_TREES
|
||||
while (to_visit > to_visit0) {
|
||||
to_visit -= 3;
|
||||
pt0 = to_visit[0];
|
||||
*pt0 = (CELL)to_visit[2];
|
||||
to_visit --;
|
||||
pt0 = to_visit->beg;
|
||||
*pt0 = to_visit->oval;
|
||||
}
|
||||
#endif
|
||||
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
|
||||
@ -1843,9 +1839,9 @@ goto restart;
|
||||
global_overflow:
|
||||
#ifdef RATIONAL_TREES
|
||||
while (to_visit > to_visit0) {
|
||||
to_visit -= 3;
|
||||
pt0 = to_visit[0];
|
||||
*pt0 = (CELL)to_visit[2];
|
||||
to_visit --;
|
||||
pt0 = to_visit->beg;
|
||||
*pt0 = to_visit->oval;
|
||||
}
|
||||
#endif
|
||||
clean_tr(TR0 PASS_REGS);
|
||||
|
@ -405,7 +405,8 @@ Term Yap_InnerEval__(Term USES_REGS);
|
||||
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
||||
|
||||
#define Yap_ArithError(id, t, ...) \
|
||||
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
||||
{ Yap_Error__(false,__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__); return 0L; }
|
||||
|
||||
#define Yap_BinError(id) \
|
||||
Yap_Error__(false, __FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
||||
#define Yap_AbsmiError(id) \
|
||||
@ -435,7 +436,9 @@ inline static void Yap_ClearExs(void) {}
|
||||
#endif
|
||||
|
||||
inline static yap_error_number Yap_FoundArithError__(USES_REGS1) {
|
||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR)
|
||||
if (LOCAL_PrologMode & InErrorMode)
|
||||
return YAP_NO_ERROR;
|
||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR )
|
||||
return LOCAL_Error_TYPE;
|
||||
if (trueGlobalPrologFlag(
|
||||
ARITHMETIC_EXCEPTIONS_FLAG)) // test support for exception
|
||||
|
@ -610,8 +610,7 @@ be lost.
|
||||
( Skip == creep -> true; '$id_goal'(GoalNumber) ; GoalNumber =< Border),
|
||||
!,
|
||||
'__NB_setval__'('$debug_status', state(creep, 0, stop)),
|
||||
'$trace_port_'(Port, GoalNumber, G, Module, Info),
|
||||
writeln(Port:G).
|
||||
'$trace_port_'(Port, GoalNumber, G, Module, Info).
|
||||
'$trace_port'(_Port, _GoalNumber, _G, _Module, _CalledFromDebugger, _Info).
|
||||
|
||||
'$trace_port_'(call, GoalNumber, G, Module, Info) :-
|
||||
|
@ -251,15 +251,16 @@ location(error(style_check(style_check(_,LN,FileName,_ ) ),_), _ , _) -->
|
||||
[ '~a:~d:0 ' - [FileName,LN] ] .
|
||||
location( error(_,Desc), Level, LC ) -->
|
||||
{ source_location(F0, L),
|
||||
stream_property(_Stream, alias(loop_stream)) }, !,
|
||||
'$query_exception'(prologPredModule, Desc, M),
|
||||
'$query_exception'(prologPredName, Desc, Na),
|
||||
'$query_exception'(prologPredArity, Desc, Ar),
|
||||
display_consulting( F0, Level, LC )
|
||||
stream_property(_Stream, alias(loop_stream)),
|
||||
!,
|
||||
'$query_exception'(prologPredModule, Desc, M),
|
||||
'$query_exception'(prologPredName, Desc, Na),
|
||||
'$query_exception'(prologPredArity, Desc, Ar),
|
||||
display_consulting( F0, Level, LC )
|
||||
},
|
||||
[ '~a:~d:0 ~a in ~a:~q/~d:'-[F0, L,Level,M,Na,Ar] ].
|
||||
location( error(_,Desc), Level, LC ) -->
|
||||
'$query_exception'(prologPredFile, Desc, File),
|
||||
{ '$query_exception'(prologPredFile, Desc, File),
|
||||
display_consulting( File, Level, LC ),
|
||||
'$query_exception'(prologPredLine, Desc, FilePos),
|
||||
'$query_exception'(prologPredModule, Desc, M),
|
||||
@ -607,7 +608,7 @@ domain_error(Domain, Opt) -->
|
||||
extra_info( error(_,Extra), _ ) -->
|
||||
{
|
||||
'$query_exception'(prologPredFile, Extra, Msg),
|
||||
Msg != []
|
||||
Msg \= []
|
||||
},
|
||||
!,
|
||||
['~*|user provided data is: ~q' - [10,Msg]],
|
||||
|
@ -936,7 +936,6 @@ catch(G, C, A) :-
|
||||
'$catch'(M:G,C,A).
|
||||
|
||||
'$catch'(MG,_,_) :-
|
||||
writeln(MG),
|
||||
'$$save_by'(CP0),
|
||||
'$execute'(MG),
|
||||
'$$save_by'(CP1),
|
||||
|
Reference in New Issue
Block a user