This commit is contained in:
Vitor Santos Costa 2019-03-21 09:02:43 +00:00
parent 9980dd49a7
commit 25afc1477c
6 changed files with 18 additions and 10 deletions

View File

@ -1851,9 +1851,15 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool
{ {
Term t1 = Deref(ARG1); Term t1 = Deref(ARG1);
int l = push_text_stack(); int l = push_text_stack();
Term cm = CurrentModule;
if (IsApplTerm(t1)) {
Term tmod = LOCAL_SourceModule;
t1 = Yap_YapStripModule(t1, &tmod);
CurrentModule = tmod;
}
const unsigned char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS); const unsigned char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
Int rc = Yap_UBufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil))); Int rc = Yap_UBufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
CurrentModule = cm;
pop_text_stack(l); pop_text_stack(l);
return rc; return rc;
} }

View File

@ -28,7 +28,7 @@
:- python_import(json). :- python_import(json).
%:- python_import(gc). %:- python_import(gc).
:- meta_predicate( yapi_query(:,+) ). :- meta_predicate yapi_query(:,+), python_query(+,:), python_query(+,:,-) .
%:- start_low_level_trace. %:- start_low_level_trace.

View File

@ -37,6 +37,7 @@ u
:- python_import(sys). :- python_import(sys).
:- meta_predicate jupyter_query(+,:,+,-), jupyter_query(+,:,+).
jupyter_query(Caller, Cell, Line, Bindings ) :- jupyter_query(Caller, Cell, Line, Bindings ) :-
gated_call( gated_call(

View File

@ -463,7 +463,7 @@ be lost.
'$trace_is_off'(M:G,GoalNumber), '$trace_is_off'(M:G,GoalNumber),
!, !,
'$execute_nonstop'(G,M). '$execute_nonstop'(G,M).
'$trace_goal'(G, M, GoalNumber, H) :- '$trace_goal'(G, M, _GoalNumber, _H) :-
'$undefined'(G, M), '$undefined'(G, M),
!, !,
'$undefp'([M|G], _ ). '$undefp'([M|G], _ ).
@ -848,7 +848,7 @@ be lost.
'$action'(s,P,CallNumber,_,_,_) :- !, % 's skip '$action'(s,P,CallNumber,_,_,_) :- !, % 's skip
'$scan_number'(ScanNumber), '$scan_number'(ScanNumber),
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ), ( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
( (P=call; P=redo) -> ( (P==call; P==redo) ->
'__NB_setval__'('$debug_status', state(leap, Goal, ignore) ) ; '__NB_setval__'('$debug_status', state(leap, Goal, ignore) ) ;
'$ilgl'(s) % ' '$ilgl'(s) % '
). ).

View File

@ -430,7 +430,7 @@ notrace(G) :-
-> ->
true true
; ;
GN > G0 GN > GN0
). ).

View File

@ -82,7 +82,7 @@ live :-
% stop at spy-points if debugging is on. % stop at spy-points if debugging is on.
nb_setval('$debug_run',off), nb_setval('$debug_run',off),
nb_setval('$debug_jump',off), nb_setval('$debug_jump',off),
nb_setval('$debug_status', state(zip, 0, stop), fail) nb_setval('$debug_status', state(zip, 0, stop), fail),
'$command'(Command,Varnames,Pos,top), '$command'(Command,Varnames,Pos,top),
current_prolog_flag(break_level, BreakLevel), current_prolog_flag(break_level, BreakLevel),
( (
@ -715,9 +715,10 @@ write_query_answer( Bindings ) :-
prolog_flag(agc_margin,Old,0), prolog_flag(agc_margin,Old,0),
prompt1(': '), prompt(_,' '), prompt1(': '), prompt(_,' '),
'$current_module'(OldModule), '$current_module'(OldModule),
repeat, repeat,
'$system_catch'(dbload_from_stream(Stream, OldModule, db), '$db_load', Error, '$system_catch'(dbload_from_stream(Stream, OldModule, db), '$db_load', Error, user:'$LoopError'(Error, db)
prolog_flag(agc_margin,_,Old), ),
prolog_flag(agc_margin,_,Old),
!. !.
'$loop'(Stream,Status) :- '$loop'(Stream,Status) :-
repeat, repeat,