This commit is contained in:
Vitor Santos Costa 2019-03-20 10:52:38 +00:00
parent e626847e93
commit 9980dd49a7
13 changed files with 68 additions and 2566 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -83,9 +83,9 @@ python_query( Caller, String, Bindings ) :-
Caller.q.port := Status, Caller.q.port := Status,
output(Caller, Bindings). output(Caller, Bindings).
output( _, Bindings ) :- %% output( _, Bindings ) :-
write_query_answer( Bindings ), %% write_query_answer( Bindings ),
fail. %% fail.
output( Caller, Bindings) :- output( Caller, Bindings) :-
maplist(into_dict(Caller),Bindings). maplist(into_dict(Caller),Bindings).
@ -96,21 +96,3 @@ bv(V,I,I1) :-
into_dict(D,V0=T) :- into_dict(D,V0=T) :-
D.q.answer[V0] := T. D.q.answer[V0] := T.
/**
*
*/
ground_dict(_Dict,var([_V]), I, I) :-
!.
ground_dict(_Dict,var([V,V]), I, I) :-
!.
ground_dict(Dict, nonvar([V0|Vs],T),I0, [V0=T| I0]) :-
!,
ground_dict(Dict, var([V0|Vs]),I0, I0).
ground_dict(Dict, var([V0,V1|Vs]), I, I) :-
!,
Dict[V1] := V0,
ground_dict(Dict, var([V0|Vs]), I, I).

View File

@ -411,8 +411,13 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kerne
) )
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/yap.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/codemirror/prolog.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/yap.js DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/codemirror/prolog.js
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/meta.js
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/misc/editors/codemirror/meta.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/meta.js
DEPENDS ${CMAKE_SOURCE_DIR}/misc/editors/codemirror/meta.js
) )

View File

@ -25,7 +25,7 @@ output for a aline such as:
fs.ensureDirSync('node_modules/codemirror/mode/prolog'); fs.ensureDirSync('node_modules/codemirror/mode/prolog');
fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/prolog.js'), 'node_modules/codemirror/mode/prolog/prolog.js'); fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/prolog.js'), 'node_modules/codemirror/mode/prolog/prolog.js');
fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/meta.js'), 'node_modules/codemirror/mode/meta.js'); fs.copySync(path.join(path.resolve(jlab.buildDir),'../../../kernels/yap_kernel/meta.js'), 'node_modules/codemirror/mode/meta.js');
~~~~~~~~ ..~~~~~~~~
These lines should copy YAP's prolog.js and a new version of the mode directory, meta.js. whenever you rebuild jlab, eg, if you add a new plugin. These lines should copy YAP's prolog.js and a new version of the mode directory, meta.js. whenever you rebuild jlab, eg, if you add a new plugin.
Next, please check the lines in context. Next, please check the lines in context.

View File

@ -299,11 +299,7 @@ be lost.
* @return `call(Goal)` * @return `call(Goal)`
*/ */
'$trace'(Mod:G) :- '$trace'(Mod:G) :-
'$stop_creeping'(_), '$trace_is_off'(Mod:G,_GN0),
( prolog_flag(debug, false) ;
'__NB_getval__'('$debug_status',state(zip,_Border,Spy),fail),
( Spy == ignore ; \+ '$pred_being_spied'(G, Mod) )
),
!, !,
'$execute_nonstop'(G,Mod). '$execute_nonstop'(G,Mod).
'$trace'(Mod:G) :- '$trace'(Mod:G) :-
@ -464,14 +460,7 @@ be lost.
%% Actuallb sy debugs a %% Actuallb sy debugs a
%% goal! %% goal!
'$trace_goal'(G, M, GoalNumber, _H) :- '$trace_goal'(G, M, GoalNumber, _H) :-
( '$trace_is_off'(M:G,GoalNumber),
current_prolog_flag(debug, false)
;
'__NB_getval__'('$debug_status',state(zip,Border,Spy), fail),
Border < GoalNumber,
( Spy == ignore ; \+ '$pred_being_spied'(G, M) )
),
%writeln(go:G:M),
!, !,
'$execute_nonstop'(G,M). '$execute_nonstop'(G,M).
'$trace_goal'(G, M, GoalNumber, H) :- '$trace_goal'(G, M, GoalNumber, H) :-

View File

@ -391,6 +391,48 @@ notrace(G) :-
fail fail
). ).
'$disable_debugging_on_port'(retry) :-
!,
'$enable_debugging'.
'$disable_debugging_on_port'(_Port) :-
'$disable_debugging'.
% enable creeping
'$enable_debugging':-
current_prolog_flag(debug, false), !.
'$enable_debugging' :-
nb_setval('$debug_status', state(creep, 0, stop)),
'$trace_on', !,
'$creep'.
'$enable_debugging'.
'$trace_on' :-
'__NB_getval__'('$debug_status', state(_Creep, GN, Spy), fail),
nb_setval('$debug_status', state(zip, GN, Spy)).
'$trace_off' :-
'__NB_getval__'('$debug_status', state(_Creep, GN, Spy), fail),
nb_setval('$debug_status', state(zip, GN, Spy)).
'$trace_is_off'(_,_) :-
current_prolog_flag(debug, false), !.
'$trace_is_off'(Module:G, GN0) :-
'__NB_getval__'('$debug_status',state(zip, GN, Spy), fail),
(
'$pred_being_spied'(G,Module)
->
Spy == ignore
;
var(GN0)
->
true
;
GN > G0
).
/* /*

View File

@ -82,6 +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)
'$command'(Command,Varnames,Pos,top), '$command'(Command,Varnames,Pos,top),
current_prolog_flag(break_level, BreakLevel), current_prolog_flag(break_level, BreakLevel),
( (
@ -590,31 +591,6 @@ write_query_answer( Bindings ) :-
'$disable_debugging_on_port'(Port) '$disable_debugging_on_port'(Port)
). ).
'$disable_debugging_on_port'(retry) :-
!,
'$enable_debugging'.
'$disable_debugging_on_port'(_Port) :-
'$disable_debugging'.
% enable creeping
'$enable_debugging':-
current_prolog_flag(debug, false), !.
'$enable_debugging' :-
nb_setval('$debug_status', state(false,creep, 0, stop)),
'$trace_on', !,
'$creep'.
'$enable_debugging'.
'$trace_on' :-
'__NB_getval__'('$debug_status', state(_,Creep, GN, Spy), fail),
nb_setval('$debug_status', state(true,Creep, GN, Spy)).
'$trace_off' :-
'__NB_getval__'('$debug_status', state(_,Creep, GN, Spy), fail),
nb_setval('$debug_status', state(false,Creep, GN, Spy)).
'$cut_by'(CP) :- '$$cut_by'(CP). '$cut_by'(CP) :- '$$cut_by'(CP).
% %
@ -727,21 +703,21 @@ write_query_answer( Bindings ) :-
'$execute0'(G, CurMod). '$execute0'(G, CurMod).
'$loop'(Stream,exo) :- '$loop'(Stream,exo) :-
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, exo), '$db_load', Error, '$system_catch'(dbload_from_stream(Stream, OldModule, exo), '$db_load', Error,
user:'$LoopError'(Error, top)), user:'$LoopError'(Error, top)),
prolog_flag(agc_margin,_,Old), prolog_flag(agc_margin,_,Old),
!. !.
'$loop'(Stream,db) :- '$loop'(Stream,db) :-
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,
prolog_flag(agc_margin,_,Old), prolog_flag(agc_margin,_,Old),
!. !.
'$loop'(Stream,Status) :- '$loop'(Stream,Status) :-
repeat, repeat,