debug && docs

This commit is contained in:
Vitor Santos Costa 2017-10-27 13:50:40 +01:00
parent a83d97f998
commit e3ade13cfe
30 changed files with 394 additions and 337 deletions

View File

@ -1,4 +1,4 @@
p/*************************************************************************
/*************************************************************************
* *
* YAP Prolog *
* *
@ -19,9 +19,10 @@ p/*************************************************************************
@file attributes.yap
@defgroup New_Style_Attribute_Declarations SWI Compatible attributes
@{
@ingroup attributes
@{
*/
:- system_module( attributes, [delayed_goals/4,

View File

@ -20,7 +20,7 @@
@brief YAP bootstrap
@defgroup YAPControl Control Predicates
@ingroup builtins
@{
@ -523,8 +523,7 @@ initialize_prolog :-
'$read_toplevel'(Command,Varnames),
nb_setval('$spy_gn',1),
% stop at spy-points if debugging is on.
nb_setval('$debug_run',off),
nb_setval('$debug_jump',off),
nb_setval('$debug_state', state(creep,0,stop)),
'$command'(Command,Varnames,_Pos,top),
current_prolog_flag(break_level, BreakLevel),
(
@ -1120,6 +1119,7 @@ incore(G) :- '$execute'(G).
'$enable_debugging':-
current_prolog_flag(debug, false), !.
'$enable_debugging' :-
'__NB_setval__'('$debug_status', state(creep, 0, stop)),
'$trace_on', !,
'$creep'.
'$enable_debugging'.

View File

@ -1,3 +1,10 @@
/**
@file bootutils.c
@short utilities
@addtogroup Internal_Database
*/
/** @pred recordaifnot(+ _K_, _T_,- _R_)

View File

@ -17,7 +17,11 @@
%% @{
/** @defgroup Profiling Profiling Prolog Programs
/**
@file callcount.yap
@short support call counting.
@defgroup Profiling Profiling Prolog Programs
@ingroup extensions
YAP includes two profilers. The count profiler keeps information on the

View File

@ -546,29 +546,30 @@ b_getval(GlobalVariable, Val) :-
it saves the importante data about current streams and
debugger state */
'$debug_state'(state(Trace, Debug, Jump, Run, SPY_GN, GList)) :-
'$debug_state'(state(Trace, Debug, State, SPY_GN, GList, GDList)) :-
'$init_debugger',
nb_getval('$trace',Trace),
nb_getval('$debug_jump',Jump),
nb_getval('$debug_run',Run),
nb_getval('$debug_state',State),
current_prolog_flag(debug, Debug),
nb_getval('$spy_gn',SPY_GN),
b_getval('$spy_glist',GList).
b_getval('$spy_glist',GList),
b_getval('$spy_depth',GDList).
'$debug_stop'( State ) :-
'$debug_state'( State ),
'$debug_stop' :-
nb_setval('$debug_state', state(creep,0,stop)),
b_setval('$trace',off),
% set_prolog_flag(debug, false),
set_prolog_flag(debug, false),
b_setval('$spy_glist',[]),
b_setval('$spy_gdlist',[]),
'$disable_debugging'.
'$debug_restart'(state(Trace, Debug, Jump, Run, SPY_GN, GList)) :-
'$debug_restart'(state(Trace, Debug, State, SPY_GN, GList, GDList)) :-
b_setval('$spy_glist',GList),
b_setval('$spy_gdlist',GDList),
b_setval('$spy_gn',SPY_GN),
set_prolog_flag(debug, Debug),
b_setval('$debug_jump',Jump),
b_setval('$debug_run',Run),
nb_setval('$debug_state',State),
b_setval('$trace',Trace),
'$enable_debugging'.
@ -589,17 +590,9 @@ debugging.
*/
break :-
'$init_debugger',
nb_getval('$trace',Trace),
nb_setval('$trace',off),
nb_getval('$debug_jump',Jump),
nb_getval('$debug_run',Run),
current_prolog_flag(debug, Debug),
set_prolog_flag(debug, false),
'$debug_state'(DState),
'$debug_start',
'$break'( true ),
nb_getval('$spy_gn',SPY_GN),
b_getval('$spy_glist',GList),
b_setval('$spy_glist',[]),
current_output(OutStream), current_input(InpStream),
current_prolog_flag(break_level, BL ),
NBL is BL+1,
@ -608,14 +601,9 @@ break :-
'$do_live',
!,
set_value('$live','$true'),
b_setval('$spy_glist',GList),
nb_setval('$spy_gn',SPY_GN),
'$debug_restore'(DState),
set_input(InpStream),
set_output(OutStream),
set_prolog_flag(debug, Debug),
nb_setval('$debug_jump',Jump),
nb_setval('$debug_run',Run),
nb_setval('$trace',Trace),
set_prolog_flag(break_level, BL ),
'$break'( false ).

View File

@ -29,6 +29,7 @@
%%
% @defgroup YAPBigLoad Loading Large Tables
% @ingroup YAPConsulting
%
% @brief Fast and Exo Loading
%

View File

@ -1,3 +1,17 @@
/**
* @file dialect.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 10:50:33 2017
*
* @brief support Prolog dialects
*
* @defgroup Dialects
* @ingroup builtins
*
*/
:- module(dialect,
[
exists_source/1,
@ -6,6 +20,9 @@
:- use_system_module( '$_errors', ['$do_error'/2]).
%
%%
% @pred expects_dialect(+Dialect)
%
% True if YAP can enable support for a different Prolog dialect.

View File

@ -15,6 +15,19 @@
* *
*************************************************************************/
/**
* @file directives.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 11:47:38 2017
*
* @brief Control File Loading
%
% @defgroup Directives
@ @ingroup consult
*
*
*/
:- system_module( '$_directives', [user_defined_directive/2], ['$all_directives'/1,
'$exec_directives'/5]).

View File

@ -16,6 +16,18 @@
* *
*************************************************************************/
/**
* @file eam.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 11:50:05 2017
*
* @brief Extended Abstract Machine
* @defgroup EAM Extended Abstract Machine
* @ingroup extensions
*
*
*/
:- system_module( '$_eam', [eamconsult/1,
eamtrans/2], []).

View File

@ -16,9 +16,9 @@
*************************************************************************/
/** @defgroup YAPError Error Handling
/** @defgroup YAPErrorHandler Error Handling
@ingroup YAPControl
@ingroup YAPErrors
The error handler is called when there is an execution error or a
warning needs to be displayed. The handlers include a number of hooks

View File

@ -15,6 +15,18 @@
* *
*************************************************************************/
/**
* @file eval.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 11:52:48 2017
*
* @brief compiling expressions
*
* @defgroup CompiledExpressions
* @ingroup drectives
*
*
*/
:- system_module( '$_eval', [], ['$full_clause_optimisation'/4]).
:- use_system_module( terms, [new_variables_in_term/3,

View File

@ -15,6 +15,17 @@
* *
*************************************************************************/
/**
* @file ground.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:01:27 2017
*
* @brief term operations
*
* @addtogroup YAPTypes
*
*
*/
/*
% grounds all free variables
% as terms of the form '$VAR'(N)

View File

@ -16,6 +16,17 @@
* *
*************************************************************************/
/**
* @file hacks.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:02:56 2017
*
* @brief Low-level access
*
* @defgroup Hacks Low-level access
* @ingroup builtins
*
*/
%% @file pl/hacks.yap
@ -207,10 +218,6 @@ beautify_hidden_goal('$continue_with_command'(top,V,P,G,_),prolog) -->
['Query'(G,V,P)].
beautify_hidden_goal('$continue_with_command'(Command,V,P,G,Source),prolog) -->
['TopLevel'(Command,G,V,P,Source)].
beautify_hidden_goal('$spycall'(G,M,InControl,Redo),prolog) -->
['DebuggerCall'(M:G, InControl, Redo)].
beautify_hidden_goal('$spycall'(Goal, Mod, _CP, Expanded),prolog) -->
['DebuggerCall'(Mod:Goal, Expanded)].
beautify_hidden_goal('$system_catch'(G,Mod,Exc,Handler),prolog) -->
[catch(Mod:G, Exc, Handler)].
beautify_hidden_goal('$catch'(G,Exc,Handler),prolog) -->

View File

@ -15,6 +15,18 @@
* *
*************************************************************************/
/**
* @file listing.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:05:19 2017
*
* @brief list predicates in a module
*
* @defgroup Listing list predicates in a module
* @ingroup builtins
*
*/
:- system_module( '$_listing', [listing/0,
listing/1,
portray_clause/1,

View File

@ -212,15 +212,17 @@ compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !,
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
[ '~a ~a in module ~a, ~d msec ~d bytes' -
[What, AbsoluteFileName,Mod,Time,Space] ].
compose_message(trace_command(-1), _Leve) -->
[ 'EOF is not a valid debugger command.' ].
compose_message(trace_command(C), _Leve) -->
[ '~c is not a valid debugger command.' - [C] ].
!,
[ '~a is not a valid debugger command.' - [C] ].
compose_message(trace_help, _Leve) -->
!,
[ ' Please enter a valid debugger command (h for help).' ].
compose_message(version(Version), _Leve) -->
!,
[ '~a' - [Version] ].
compose_message(myddas_version(Version), _Leve) -->
!,
[ 'MYDDAS version ~a' - [Version] ].
compose_message(yes, _Level) --> !,
[ 'yes'- [] ].

View File

@ -366,8 +366,9 @@ o:p(B) :- n:g, X is 2+3, call(B).
'$yap_strip_module'( BM:G0, M0N, G0N),
'$user_expansion'(M0N:G0N, M1:G1),
'$import_expansion'(M1:G1, M2:G2),
'$meta_expansion'(M2:G2, M1, HVars, M2:B1F),
'$end_goal_expansion'(B1F, G1F, GOF, HM, SM, M2, H).
'$meta_expansion'(M2:G2, M1, HVars, M2B1F),
'$yap_strip_module'(M2B1F, M3, B1F),
'$end_goal_expansion'(B1F, G1F, GOF, HM, SM, M3, H).
'$end_goal_expansion'(G, G1F, GOF, HM, SM, BM, H) :-
'$match_mod'(G, HM, SM, BM, G1F),
@ -390,7 +391,7 @@ o:p(B) :- n:g, X is 2+3, call(B).
(
% \+ '$is_multifile'(G1,M),
%->
'$is_system_predicate'(G,prolog)
'$is_system_predicate'(G,M)
->
O = G
;

View File

@ -21,6 +21,7 @@
@defgroup ModuleBuiltins Module Support
@ingroup YAPModules
@{
**/
@ -82,8 +83,8 @@
%
/**
\pred use_module( +Files ) is directive
@load a module file
@pred use_module( +Files ) is directive
@brief load a module file
This predicate loads the file specified by _Files_, importing all
their public predicates into the current type-in module. It is
@ -193,7 +194,7 @@ X = 2 ? ;
ERROR!!
EXISTENCE ERROR- procedure c/1 is undefined, called from context prolog:$user_call/2
Goal was c:c(_131290)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vv~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The state of the module system after this error is undefined.
@ -322,10 +323,9 @@ system_module(Mod) :-
'$is_system_module'(Mod).
'$trace_module'(X) :-
telling(F),
tell('P0:debug'),
write(X),nl,
tell(F), fail.
open('P0:debug', append, S),
fornat(S, '~w~n', [X]),
close(S).
'$trace_module'(_).
'$trace_module'(X,Y) :- X==Y, !.
@ -338,7 +338,12 @@ system_module(Mod) :-
tell(F),fail.
'$trace_module'(_,_).
/**
*
* @pred '$continue_imported'(+ModIn, +ModOut, +PredIn ,+PredOut)
*
* @return
*/
'$continue_imported'(Mod,Mod,Pred,Pred) :-
'$pred_exists'(Pred, Mod),
!.
@ -350,7 +355,6 @@ system_module(Mod) :-
'$continue_imported'(FM, IM, FPred, Pred).
% be careful here not to generate an undefined exception.
'$imported_predicate'(G, _ImportingMod, G, prolog) :-
nonvar(G), '$is_system_predicate'(G, prolog), !.
@ -359,19 +363,22 @@ system_module(Mod) :-
var(ImportingMod) -> true ;
'$undefined'(G, ImportingMod)
),
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod),
ExportingMod \= ImportingMod,
!.
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod),
ExportingMod \= ImportingMod.
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod) :-
recorded('$import','$import'(ExportingModI,ImportingMod,G0I,G,_,_),_),
'$continue_imported'(ExportingMod, ExportingModI, G0, G0I),
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod),
!.
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
recorded('$import','$import'(ExportingModI,ImportingMod,G0I,G,_,_),_),
'$continue_imported'(ExportingMod, ExportingModI, G0, G0I).
% SWI builtin
'$get_undefined_pred'(G, _ImportingMod, G, user) :-
'$get_undefined_predicates'(G, _ImportingMod, G, user) :-
nonvar(G),
'$pred_exists'(G, user), !.
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod) :-
'$pred_exists'(G, user).
% autoload
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
recorded('$dialect',swi,_),
prolog_flag(autoload, true),
prolog_flag(unknown, OldUnk, fail),
@ -384,10 +391,8 @@ system_module(Mod) :-
fail
),
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
% autoload
% parent module mechanism
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod) :-
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
'$parent_module'(ImportingMod,ExportingModI),
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
@ -428,7 +433,7 @@ be associated to a new file.
\param[in] _Module_ is the name of the module to declare
\param[in] _MSuper_ is the name of the context module. Use `prolog`or `system`
if you do not need a context.
\param[in] _File_ is the canonical name of the file from which the module is loaded
\param[in] _File_ is the canonical name of the file from which the modulvvvvve is loaded
\param[in] Line is the line-number of the :- module/2 directive.
\param[in] If _Redefine_ `true`, allow associating the module to a new file
*/
@ -437,7 +442,7 @@ be associated to a new file.
add_import_module(Name, Context, start).
/**
\pred abolish_module( + Mod) is det
@pred abolish_module( + Mod) is det
get rid of a module and of all predicates included in the module.
*/
abolish_module(Mod) :-
@ -579,8 +584,9 @@ export_list(Module, List) :-
/**
@pred set_base_module( +ExportingModule ) is det
All exported predicates from _ExportingModule_ are automatically available to the
current source module.
@brief All
predicates exported from _ExportingModule_ are automatically available to the
other source modules.
This built-in was introduced by SWI-Prolog. In YAP, by default, modules only
inherit from `prolog`. This extension allows predicates in the current

View File

@ -1,4 +1,9 @@
/**
@file newmod.yap
@short support for creating a new module.
@ingroup ModuleBuiltins
@pred module(+M) is det
set the type-in module

71
pl/pl
View File

@ -1,71 +0,0 @@
/Users/vsc/git/yap-6.3/pl:
total used in directory 1768 available 23068011
-rw-r--r-- 1 vsc staff 13038 Apr 26 05:19 ##a##
-rw-r--r-- 1 vsc staff 6533 Apr 26 05:02 #a#
-rw-r--r-- 1 vsc staff 10769 Dec 22 00:56 #arith.yap#
-rw-r--r-- 1 vsc staff 38238 Nov 30 2014 #threads.yap#
drwxr-xr-x@ 69 vsc staff 2346 Jun 20 02:56 .
lrwxr-xr-x 1 vsc staff 36 Apr 26 05:15 .##a# -> vsc@VITORs-MacBook-Pro-2.local.13727
lrwxr-xr-x 1 vsc staff 36 Apr 26 04:54 .#a -> vsc@VITORs-MacBook-Pro-2.local.11698
drwxr-xr-x@ 130 vsc staff 4420 Jun 20 22:22 ..
-rw-r--r-- 1 vsc staff 1205 Jun 20 22:22 CMakeLists.txt
-rw-r--r-- 1 vsc staff 1183 Dec 10 2014 CMakeLists.txt~
-rw-r--r-- 1 vsc staff 6262 Apr 19 09:31 Makefile
-rw-r--r-- 1 vsc staff 6534 Apr 26 04:54 a
-rwxr-xr-x 1 vsc staff 23142 Jun 20 22:22 absf.yap
-rw-r--r-- 1 vsc staff 10776 Jan 4 23:42 arith.yap
-rw-r--r-- 1 vsc staff 3455 Jan 4 23:42 arithpreds.yap
-rw-r--r-- 1 vsc staff 2791 Jun 20 22:22 arrays.yap
-rw-r--r-- 1 vsc staff 6414 Apr 21 19:02 atoms.yap
-rw-r--r-- 1 vsc staff 16735 Jun 20 22:22 attributes.yap
-rw-r--r-- 1 vsc staff 34460 May 27 2014 b.yap~
-rw-r--r-- 1 vsc staff 38891 Jun 20 02:56 boot.yap
-rw-r--r-- 1 vsc staff 4347 Jan 4 23:42 callcount.yap
-rw-r--r-- 1 vsc staff 6778 Jan 4 23:42 checker.yap
-rw-r--r-- 1 vsc staff 3874 Jan 4 23:42 chtypes.yap
-rw-r--r--@ 1 vsc staff 51193 Jun 20 22:22 consult.yap
-rw-r--r-- 1 vsc staff 18465 May 3 18:46 control.yap
-rw-r--r-- 1 vsc staff 18089 Jan 4 23:42 corout.yap
-rw-r--r-- 1 vsc staff 4322 Jan 4 23:42 dbload.yap
-rw-r--r-- 1 vsc staff 38783 Jun 8 15:38 debug.yap
-rw-r--r-- 1 vsc staff 966 Jun 20 22:22 depth_bound.yap
-rw-r--r-- 1 vsc staff 2458 Jun 20 22:22 dialect.yap
-rw-r--r--@ 1 vsc staff 7586 Jun 20 22:22 directives.yap
-rwxr--r-- 1 vsc staff 2326 Jan 4 23:42 eam.yap
-rw-r--r-- 1 vsc staff 11527 Jun 6 08:02 errors.yap
-rw-r--r-- 1 vsc staff 4055 May 18 23:28 eval.yap
-rw-r--r-- 1 vsc staff 2885 Jun 5 07:42 flags.yap
-rw-r--r-- 1 vsc staff 6596 Jan 4 23:42 grammar.yap
-rw-r--r-- 1 vsc staff 1573 Jan 4 23:42 ground.yap
-rw-r--r-- 1 vsc staff 7876 Feb 20 08:18 hacks.yap
-rw-r--r--@ 1 vsc staff 8559 Jan 4 23:42 history.pl
-rw-r--r-- 1 vsc staff 8403 Jun 20 19:28 init.yap
-rw-r--r-- 1 vsc staff 8684 May 26 09:04 listing.yap
-rw-r--r-- 1 vsc staff 2206 May 15 01:12 lists.yap
-rw-r--r-- 1 vsc staff 7261 May 3 18:50 load_foreign.yap
-rw-r--r-- 1 vsc staff 26328 Jun 6 08:31 messages.yap
-rw-r--r--@ 1 vsc staff 55621 Jun 20 22:22 modules.yap
-rw-r--r-- 1 vsc staff 5028 Jan 7 02:21 os.yap
-rw-r--r-- 1 vsc staff 8061 May 26 08:43 preddecls.yap
-rw-r--r-- 1 vsc staff 13022 May 26 08:52 preddyns.yap
-rw-r--r-- 1 vsc staff 6687 May 26 08:37 preddyns.yap~
-rw-r--r-- 1 vsc staff 23891 Jun 20 22:22 preds.yap
-rw-r--r-- 1 vsc staff 7701 Jan 4 23:42 profile.yap
-rwxr-xr-x@ 1 vsc staff 2178 Jun 20 02:26 protect.yap
-rwxr-xr-x 1 vsc staff 25169 Jun 10 20:43 qly.yap
-rw-r--r-- 1 vsc staff 405 Jun 9 2014 rev
-rw-r--r-- 1 vsc staff 2050 Jan 4 23:42 save.yap
-rw-r--r-- 1 vsc staff 7368 Apr 5 22:22 setof.yap
-rw-r--r-- 1 vsc staff 10717 Jan 4 23:42 signals.yap
-rw-r--r-- 1 vsc staff 4761 Apr 5 22:22 sort.yap
-rw-r--r-- 1 vsc staff 12452 Jan 4 23:42 statistics.yap
-rw-r--r-- 1 vsc staff 6781 May 15 00:52 strict_iso.yap
-rw-r--r-- 1 vsc staff 2612 Jan 4 23:42 swi.yap
-rw-r--r-- 1 vsc staff 18915 May 18 23:28 tabling.yap
-rw-r--r-- 1 vsc staff 44648 May 18 23:28 threads.yap
-rw-r--r-- 1 vsc staff 748 Jan 4 23:42 udi.yap
-rw-r--r--@ 1 vsc staff 3753 Jun 8 19:56 undefined.yap
-rw-r--r-- 1 vsc staff 9281 Jan 4 23:42 utils.yap
-rw-r--r-- 1 vsc staff 804 Dec 2 2014 x~
-rw-r--r-- 1 vsc staff 7555 Jan 4 23:42 yapor.yap
-rw-r--r-- 1 vsc staff 9996 Jun 8 08:48 yio.yap

View File

@ -4,7 +4,7 @@
/** @file preddyns.yap */
/**
* @ingroup Database
* @addtogroup Database
* @{
Next follow the main operations on dynamic predicates.

View File

@ -19,7 +19,7 @@
/**
* @file protect.yap
* @addgroup ProtectCore Freeze System Configuration
* @ingroup CoreUtilities
* @ingroup YAPControl
*
* This protects current code from further changes
* and also makes it impossible for some predicates to be seen

View File

@ -15,6 +15,17 @@
* *
*************************************************************************/
/**
* @file save.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:10:47 2017
*
* @brief Old Style save
*
* @addtòxgroup QLY
*
*/
:- system_module( '$_save', [], []).
%%% Saving and restoring a computation

View File

@ -25,7 +25,7 @@
:- use_system_module( '$_boot', ['$meta_call'/2]).
:- use_system_module( '$_debug', ['$spycall'/4]).
:- use_system_module( '$_debug', ['$trace'/1]).
:- use_system_module( '$_threads', ['$thread_gfetch'/1]).
@ -177,52 +177,8 @@ order of dispatch.
'$continue_signals',
debug,
'$execute'(M:G).
'$do_signal'(sig_break, [M|G]) :-
'$continue_signals',
break,
'$execute0'(G,M).
'$do_signal'(sig_statistics, [M|G]) :-
'$continue_signals',
statistics,
'$execute0'(G,M).
% the next one should never be called...
'$do_signal'(fail, [_|_]) :-
fail.
'$do_signal'(sig_stack_dump, [M|G]) :-
'$continue_signals',
'$hacks':'$stack_dump',
'$execute0'(G,M).
'$do_signal'(sig_fpe,G) :-
'$signal_handler'(sig_fpe, G).
'$do_signal'(sig_alarm, G) :-
'$signal_handler'(sig_alarm, G).
'$do_signal'(sig_vtalarm, G) :-
'$signal_handler'(sig_vtalarm, G).
'$do_signal'(sig_hup, G) :-
'$signal_handler'(sig_hup, G).
'$do_signal'(sig_usr1, G) :-
'$signal_handler'(sig_usr1, G).
'$do_signal'(sig_usr2, G) :-
'$signal_handler'(sig_usr2, G).
'$do_signal'(sig_pipe, G) :-
'$signal_handler'(sig_pipe, G).
'$signal_handler'(Sig, [M|G]) :-
'$signal_do'(Sig, Goal),
% if more signals alive, set creep flag
'$continue_signals',
'$current_module'(M0),
'$execute0'((Goal,M:G),M0).
% we may be creeping outside and coming back to system mode.
'$start_creep'([_M|G], _) :-
nonvar(G),
G = '$$cut_by'(CP),
!,
'$$cut_by'(CP).
'$start_creep'([Mod|G], _WhereFrom) :-
CP is '$last_choice_pt',
'$spycall'(G, Mod, CP, not_expanded).
'$trace'([Mod|G]).
'$no_creep_call'('$execute_clause'(G,Mod,Ref,CP),_) :- !,
'$enable_debugging',
@ -251,16 +207,16 @@ nonvar(G),
'$signal_do'(Sig, Goal) :-
'$signal_def'(Sig, Goal).
% reconsult init files.
% reconsult init files. %
'$signal_def'(sig_hup, (( exists('~/.yaprc') -> [-'~/.yaprc'] ; true ),
( exists('~/.prologrc') -> [-'~/.prologrc'] ; true ),
( exists('~/prolog.ini') -> [-'~/prolog.ini'] ; true ))).
% die on signal default.
% die on signal default. %
'$signal_def'(sig_usr1, throw(error(signal(usr1,[]),true))).
'$signal_def'(sig_usr2, throw(error(signal(usr2,[]),true))).
'$signal_def'(sig_pipe, throw(error(signal(pipe,[]),true))).
'$signal_def'(sig_fpe, throw(error(signal(fpe,[]),true))).
% ignore sig_alarm by default
% ignore sig_alarm by default %
'$signal_def'(sig_alarm, true).
@ -289,10 +245,10 @@ on_signal(Signal,OldAction,Action) :-
Goal = OldAction.
on_signal(Signal,OldAction,Action) :-
'$reset_signal'(Signal, OldAction),
% 13211-2 speaks only about callable
% 13211-2 speaks only about callable %
( Action = M:Goal -> true ; throw(error(type_error(callable,Action),on_signal/3)) ),
% the following disagrees with 13211-2:6.7.1.4 which disagrees with 13211-1:7.12.2a
% but the following agrees with 13211-1:7.12.2a
% the following disagrees with 13211-2:6.7.1.4 which disagrees with 13211-1:7.12.2a %
% but the following agrees with 13211-1:7.12.2a %
( nonvar(M) -> true ; throw(error(instantiation_error,on_signal/3)) ),
( atom(M) -> true ; throw(error(type_error(callable,Action),on_signal/3)) ),
( nonvar(Goal) -> true ; throw(error(instantiation_error,on_signal/3)) ),
@ -336,8 +292,8 @@ read_sig :-
fail.
read_sig.
%
% make thes predicates non-traceable.
% %
% make thes predicates non-traceable. %
:- '$set_no_trace'(current_choicepoint(_DCP), yap_hacks).
:- '$set_no_trace'('$current_choice_point'(_DCP), _).

View File

@ -67,8 +67,7 @@ mode and the existing spy-points, when the debugger is on.
'__NB_setval__'('$if_skip_mode',no_skip),
'__NB_setval__'('$spy_glist',[]),
'__NB_setval__'('$spy_gn',1),
'__NB_setval__'('$debug_run',off),
'__NB_setval__'('$debug_jump',false).
'__NB_setval__'('$debug_state', state(creep,0,stop)).
% First part : setting and reseting spy points
@ -92,17 +91,9 @@ mode and the existing spy-points, when the debugger is on.
'$suspy_predicates_by_name'(A,S,M) :-
% just check one such predicate exists
(
current_predicate(A,M:_)
->
M = EM,
A = NA
;
recorded('$import','$import'(EM,M,GA,_,A,_),_),
functor(GA,NA,_)
),
current_predicate(A,M:_),
!,
'$do_suspy_predicates_by_name'(NA,S,EM).
'$do_suspy_predicates_by_name'(A,S,M).
'$suspy_predicates_by_name'(A,spy,M) :- !,
print_message(warning,no_match(spy(M:A))).
'$suspy_predicates_by_name'(A,nospy,M) :-
@ -111,10 +102,9 @@ mode and the existing spy-points, when the debugger is on.
'$do_suspy_predicates_by_name'(A,S,M) :-
current_predicate(A,M:T),
functor(T,A,N),
'$do_suspy'(S, A, N, T, M).
'$do_suspy_predicates_by_name'(A, S, M) :-
recorded('$import','$import'(EM,M,_,T,A,N),_),
'$do_suspy'(S, A, N, T, EM).
'$do_suspy'(S, A, N, T, M),
fail.
'$do_suspy_predicates_by_name'(_A, _S, _M).
%
@ -229,8 +219,7 @@ debug :-
;
set_prolog_flag(debug, false)
),
'__NB_setval__'('$debug_run',off),
'__NB_setval__'('$debug_jump',false).
'__NB_setval__'('$debug_state',state(creep,0,stop) ).
nodebug :-
'$init_debugger',

View File

@ -14,6 +14,20 @@
* comments: statistics on Prolog status *
* *
*************************************************************************/
/**
* @file statistics.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:13:51 2017
*
* @brief System Status
*
* @defgroup Statistics System Status
* @ingroup builtins
*
*
*/
:- system_module( '$_statistics', [key_statistics/3,
statistics/0,
statistics/2,

View File

@ -1,3 +1,14 @@
/**
* @file strict_iso.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:15:33 2017
*
* @brief StrictISO Mode
*
* @addtogroup YAPCompilerSettings
*
*
*/
:- system_module( '$_strict_iso', [], ['$check_iso_strict_clause'/1,
'$iso_check_goal'/2]).

View File

@ -1,3 +1,14 @@
/**
* @file swi.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:18:05 2017
*
* @brief SWI Emulation support
*
* @ingroup dialects
*
*
*/
:- module('$swi',
[]).

View File

@ -14,6 +14,18 @@
* comments: support user defined indexing *
* *
*************************************************************************/
/**
* @file udi.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:19:04 2017
*
* @brief User Defined Extensions
*
* @addgroup UDI User Defined Extensions
* @ingroup extensions
*
*
*/
:- system_module( '$_udi', [udi/1], []).

View File

@ -15,6 +15,19 @@
* *
*************************************************************************/
/**
* @file utils.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:21:01 2017
*
* @brief Utilities
*
* @defgroup MixBag Diverse Utilities
* @ingroup builtin
*
*
*/
:- system_module( '$_utils', [callable/1,
current_op/3,
nb_current/2,

View File

@ -1,3 +1,15 @@
/**
* @file yapor.yap
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
* @date Thu Oct 19 12:23:00 2017
*
* @brief Or-Parallelism
*
* @defgroup YapOR Or-Parallelism
@ @ingroup extensions
*
*
*/
:- system_module( '$_utils', [callable/1,
current_op/3,
nb_current/2,