format('~N~n~n'))),!, %stack_dump, stream_property(S2,file_no(2)), with_output_to(S2, (format('~N~n~n',[]), write_src(G), format('~N~n~n'))),!. :- meta_predicate(rrtrace(0)). rrtrace(X):- rrtrace(etrace,X). stack_dump:- ignore(catch(bt,_,true)). %,ignore(catch(dumpST,_,true)),ignore(catch(bts,_,true)). ugtrace(error(Why),G):- !, notrace,write_src_uo(Why),stack_dump,write_src_uo(Why),rtrace(G). ugtrace(Why,G):- tracing,!,notrace,write_src(Why),rtrace(G). ugtrace(Why,_):- is_testing, !, ignore(give_up(Why,5)),throw('$aborted'). ugtrace(_Why,G):- ggtrace(G),throw('$aborted'). %ugtrace(Why,G):- ggtrace(G). give_up(Why,_):- is_testing,!,write_src_uo(Why),!, throw(give_up(Why)). give_up(Why,N):- is_testing,!,write_src_uo(Why),!, halt(N). give_up(Why,_):- write_src_uo(Why),throw('$aborted'). is_guitracer:- getenv('DISPLAY',_), current_prolog_flag(gui_tracer,true). :- meta_predicate(rrtrace(1,0)). rrtrace(P1,X):- never_rrtrace,!,nop((u_dmsg(cant_rrtrace(P1,X)))),!,fail. rrtrace(P1,G):- is_cgi,!, u_dmsg(arc_html(rrtrace(P1,G))),call(P1,G). rrtrace(P1,X):- notrace, \+ is_guitracer,!,nortrace, /*arcST, sleep(0.5), trace,*/ (notrace(\+ current_prolog_flag(gui_tracer,true)) -> call(P1,X); (itrace,call(P1,X))). %rrtrace(_,X):- is_guitracer,!,notrace,nortrace,ncatch(call(call,ugtrace),_,true),atrace,call(X). rrtrace(P1,X):- itrace,!, call(P1,X). :- meta_predicate(arc_wote(0)). arc_wote(G):- with_pp(ansi,wote(G)). arcST:- itrace,arc_wote(bts),itrace. atrace:- arc_wote(bts). %atrace:- ignore((stream_property(X,file_no(2)), with_output_to(X,dumpST))),!. :- meta_predicate(odd_failure(0)). odd_failure(G):- never_rrtrace,!,call(G). odd_failure(G):- wno_must(G)*->true;fail_odd_failure(G). :- meta_predicate(fail_odd_failure(0)). fail_odd_failure(G):- u_dmsg(odd_failure(G)),rtrace(G), fail. %fail_odd_failure(G):- call(G)*->true;(u_dmsg(odd_failure(G)),fail,rrtrace(G)). bts:- ensure_loaded(library(prolog_stack)), prolog_stack:export(prolog_stack:get_prolog_backtrace_lc/3), use_module(library(prolog_stack),[print_prolog_backtrace/2,get_prolog_backtrace_lc/3]), /*notrace*/(prolog_stack:call(call,get_prolog_backtrace_lc,8000, Stack, [goal_depth(600)])), stream_property(S,file_no(1)), prolog_stack:print_prolog_backtrace(S, Stack), ignore((fail, current_output(Out), \+ stream_property(Out,file_no(1)), print_prolog_backtrace(Out, Stack))),!. my_assertion(G):- my_assertion(call(G),G). my_assertion(_,G):- call(G),!. my_assertion(Why,G):- u_dmsg(my_assertion(Why,G)),writeq(Why=goal(G)),nl,!,ibreak. must_be_free(Free):- plain_var(Free),!. must_be_free(Free):- \+ nonvar_or_ci(Free),!. must_be_free(Nonfree):- arcST,u_dmsg(must_be_free(Nonfree)), ignore((attvar(Nonfree),get_attrs(Nonfree,ATTS),pp(ATTS))),ibreak,fail. must_be_nonvar(Nonvar):- nonvar_or_ci(Nonvar),!. must_be_nonvar(IsVar):- arcST,u_dmsg(must_be_nonvar(IsVar)),ibreak,fail.