This commit is contained in:
Vitor Santos Costa 2018-11-02 12:14:04 +00:00
parent 004bbef62b
commit a6090a61ab
5 changed files with 45 additions and 64 deletions

View File

@ -50,30 +50,7 @@ private(_).
(not)/1,
repeat/0,
throw/1,
true/0], ['$$compile'/4,
'$call'/4,
'$catch'/3,
'$check_callable'/2,
'$check_head_and_body'/4,
'$check_if_reconsulted'/2,
'$clear_reconsulting'/0,
'$command'/4,
'$cut_by'/1,
'$disable_debugging'/0,
'$do_live'/0,
'$'/0,
'$find_goal_definition'/4,
'$head_and_body'/3,
'$inform_as_reconsulted'/2,
'$init_system'/0,
'$init_win_graphics'/0,
'$loop'/2,
'$meta_call'/2,
'$prompt_alternatives_on'/1,
'$run_at_thread_start'/0,
'$system_catch'/4,
'$undefp'/1,
'$version'/0]).
true/0], []).
:- use_system_module( '$_absf', ['$system_library_directories'/2]).
@ -110,6 +87,11 @@ private(_).
% be careful here not to generate an undefined exception..
'$setup_call_catcher_cleanup'(Setup, Goal, Catcher, Cleanup) :-
'$setup_call_catcher_cleanup'('$h'(Setup)),
'$gated_call'( false , '$h'(Goal), Catcher, '$h'(Cleanup)) .
print_message(L,E) :-
'$number_of_clauses'(print_message(L,E), prolog_complete, 1),
!,

View File

@ -40,21 +40,7 @@
source_file/2,
source_file_property/2,
use_module/3],
['$add_multifile'/3,
'$csult'/2,
'$do_startup_reconsult'/1,
'$elif'/2,
'$else'/1,
'$endif'/1,
'$if'/2,
'$include'/2,
'$initialization'/1,
'$initialization'/2,
'$lf_opt'/3,
'$load_files'/3,
'$require'/2,
'$set_encoding'/1,
'$use_module'/3]).
['$initialization'/2]).
:- use_system_module( '$_absf', ['$full_filename'/2]).
@ -1650,12 +1636,12 @@ End of conditional compilation.
nb_setval('$if_skip_mode',OldMode).
'$if_call'(G) :-
catch('$eval_if'(G), E, (print_message(error, E), fail)).
'$if_call'(Goal) :-
'$expand_term'(Goal,TrueGoal),
catch(once(TrueGoal), E, (print_message(error, E), fail)).
'$eval_if'(Goal) :-
'$expand_term'(Goal,TrueGoal),
once(TrueGoal).
once(TrueGoal).
'$if_directive'((:- if(_))).
'$if_directive'((:- else)).

View File

@ -471,14 +471,13 @@ b_getval(GlobalVariable, Val) :-
it saves the importante data about current streams and
debugger state */
'$debug_state'(state(Trace, Debug, State, SPY_GN, GList, GDList)) :-
'$debug_state'(state(Trace, Debug, State, SPY_GN, GList)) :-
'$init_debugger',
nb_getval('$trace',Trace),
nb_getval('$debug_state',State),
current_prolog_flag(debug, Debug),
nb_getval('$spy_gn',SPY_GN),
b_getval('$spy_glist',GList),
b_getval('$spy_depth',GDList).
b_getval('$spy_glist',GList).
'$debug_stop' :-
@ -486,17 +485,15 @@ b_getval(GlobalVariable, Val) :-
b_setval('$trace',off),
set_prolog_flag(debug, false),
b_setval('$spy_glist',[]),
b_setval('$spy_gdlist',[]),
'$disable_debugging'.
b_setval('$spy_gdlist',[]).
'$debug_restart'(state(Trace, Debug, State, SPY_GN, GList, GDList)) :-
'$debug_restart'(state(Trace, Debug, State, SPY_GN, GList)) :-
b_setval('$spy_glist',GList),
b_setval('$spy_gdlist',GDList),
b_setval('$spy_gn',SPY_GN),
set_prolog_flag(debug, Debug),
nb_setval('$debug_state',State),
b_setval('$trace',Trace),
'$enable_debugging'.
nb_setval('$debug_state',State),
b_setval('$trace',Trace).
/** @pred break
@ -515,20 +512,34 @@ debugging.
*/
break :-
'$e_setup_call_cleanup'(
prolog:'$enter_break'(Dstate,StdStreams,BL,NBL),
prolog:'$do_break'(NBL),
prolog:'$leave_break'(Dstate,StdStreams,BL)
).
'$enter_break'(DState,streams(InpStream,OutStream,ErrStream),BL,NBL),
'$debug_state'(DState),
'$debug_start',
'$break'( true ),
current_output(OutStream), current_input(InpStream),
yap_flag( user_input, InpStream ),
yap_flag( user_output, OutStream ),
yap_flag( user_error, ErrStream ),
current_prolog_flag(break_level, BL ),
NBL is BL+1,
set_prolog_flag(break_level, NBL ),
format(user_error, '% Break (level ~w)~n', [NBL]),
set_prolog_flag(break_level, NBL ).
'$do_break'(NBL) :-
format(user_error, '% Break (level ~w)~n', [NBL]),
'$do_live',
!,
!.
'$leave_break'(DState,streams(InpStream,OutStream,ErrStream),BL) :-
set_value('$live','$true'),
'$debug_restore'(DState),
set_input(InpStream),
set_output(OutStream),
yap_flag( user_input, InpStream ),
yap_flag( user_output, OutStream ),
yap_flag( user_error, ErrStream ),
set_prolog_flag(break_level, BL ),
'$break'( false ).

View File

@ -780,7 +780,7 @@ be lost.
skip( debugger_input, 10),
break,
fail.
'$action'('A',_,_,_,_,_) :- !, % 'b break
'$action'('A',_,_,_,_,_) :- !, % A ancestors
skip( debugger_input, 10),
'$stack_dump',
fail.

View File

@ -125,11 +125,13 @@
'$exec_directive'(multifile(D), _, M, _, _) :-
'$system_catch'('$multifile'(D, M), M,
catch(multifile(M:D),
Error,
user:'$LoopError'(Error, top)).
loop_Error(Error, top)).
'$exec_directive'(discontiguous(D), _, M, _, _) :-
'$discontiguous'(D,M).
catch(discontiguous(M:D),
Error,
loop_Error(Error, top)).
/** @pred initialization