doc changes

This commit is contained in:
Vítor Santos Costa 2014-11-02 12:10:32 +00:00
parent dce3e7a1bc
commit c440ab239b
6 changed files with 245 additions and 168 deletions

View File

@ -367,7 +367,7 @@ SUBGROUPING = YES
# SEPARATE_MEMBER_PAGES.
# The default value is: NO.
INLINE_GROUPED_CLASSES = NO
INLINE_GROUPED_CLASSES = YES
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
# with only public data fields or simple typedef fields will be shown inline in
@ -551,7 +551,7 @@ SORT_MEMBER_DOCS = YES
# this will also influence the order of the classes in the class list.
# The default value is: NO.
SORT_BRIEF_DOCS = NO
SORT_BRIEF_DOCS = YES
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
# (brief and detailed) documentation of class members so that constructors and
@ -563,7 +563,7 @@ SORT_BRIEF_DOCS = NO
# detailed member documentation.
# The default value is: NO.
SORT_MEMBERS_CTORS_1ST = NO
SORT_MEMBERS_CTORS_1ST = yes
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
@ -655,7 +655,7 @@ SHOW_FILES = YES
# Folder Tree View (if specified).
# The default value is: YES.
SHOW_NAMESPACES = NO
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
@ -770,7 +770,6 @@ WARN_LOGFILE =
#INPUT = /Users/vsc/git/yap-6.3/packages/R/R.pl
INPUT = foreigns.yap docs/yap.md pl swi C H include os packages library CXX OPTYap
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -1602,7 +1601,7 @@ MAKEINDEX_CMD_NAME = makeindex
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
COMPACT_LATEX = NO
COMPACT_LATEX = YES
# The PAPER_TYPE tag can be used to set the paper type that is used by the
# printer.
@ -1723,7 +1722,9 @@ GENERATE_RTF = NO
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: rtf.
# This tag requires that the tag GENERATE_RTF is set to YES.
# This tag requires that the tag GENERATE_RTb
F is set to YES.
RTF_OUTPUT = rtf

View File

@ -252,7 +252,7 @@ You can also use the CUDD interface package in YAP. You will need to
2. If a Mac user, there is a ports package.
3 Otherwise, you can obtain the version at . This version compiles under WIN32.
3. Otherwise, you can obtain the version at . This version compiles under WIN32.
Last, when you configure YAP you need to add the options --with-cidd --enable-bddlib. Binary distributed versions already have the interface.
@ -291,8 +291,10 @@ Instead of probabilities every fact has a t( ) prefix. The t stands for tunable
~~~~
t(0.5)::heads(_).
~~~~
*/
### ProbLog Predicates
/** @defgroup ProbLogPredicates ProbLog Predicates
@ingroup ProbLog1
This chapter describes the predicates defined by ProbLog for evaluating the probability of queries.
@ -347,8 +349,12 @@ This predicate returns the lower and upper bound of the probability of achieving
This predicate returns the lower bound of the probability of achieving the goal G obtained by cutting the sld tree at the given probability for each branch.
*/
%% @}
/**
### ProbLog Parameter Learning Predicates
@defgroup ProbLogParameterLearning ProbLog Parameter Learning Predicates
@ingroup ProbLog1
@{
*/
/**
@ -371,7 +377,7 @@ Test examples are ignored during learning but are used afterwards to check the p
* @pred do_learning(+N).
*
Starts the learning algorithm with N iterations.
paragraph{}
*/
/**
@ -381,7 +387,15 @@ The output is created in the output subfolder of the current folder where YAP wa
Starts the learning algorithm. The learning will stop after N iterations or if the difference of the Mean Squared Error (MSE) between two iterations gets smaller than Epsilon - depending on what happens first.
### Miscelaneous
*/
%% @}
/** @defgroup ProbLogMiscellaneous ProbLog Miscellaneous Predicates
@ingroup ProbLog1
@{
Both the learning and the inference module have various parameters, or flags, that can be adjusted by the user.
The following predicates are defined by ProbLog to access and set these flags.
@ -395,11 +409,9 @@ This predicate lists all the flags name, value, domain and description.
*/
/**
* @pred problog_flag(+Name, -Value)
*
This predicate gives the value of the flag with the specified name. The supported flags are:
/** @pred problog_flag(+Name, -Value)
This predicate gives the value of the flag with the specified name. The supported flags are:
+ use_db_trie
@ -461,7 +473,7 @@ The possible values for this flag are true or false.
Flag that sets the representation of the ancestor list.
The possible values for this flag are list or integer
+ max\cccccccccccc_depth
+ max_depth
Sets the maximum proof depth.
The possible values for this flag are any integer.
@ -478,8 +490,7 @@ The possible values for this flag are any integer greater than zero.
+ min_mc_samples
Flag related to Monte Carlo Sampling that sets the minimum number of samples before convergence.
The possible values for this flag are any integer greater than or equal to zero.
Flag related to Monte Carlo Sampling that sets the minimum number of samples before convergence. The possible values for this flag are any integer greater than or equal to zero.
+ max_mc_samples
@ -591,6 +602,8 @@ The possible values for this flag are true or false.
Flag telling the location of the output files directory.
The possible values for this flag are any valid directory name.
*/
/** @pred set_problog_flag(+Name, +Value)
the predicate sets the value of the given flag. The supported flags are the ones listed in above
@ -601,7 +614,7 @@ the predicate sets the value of the given flag. The supported flags are the ones
the predicate sets the value of the given flag. The supported flags are the ones listed in above
*/
/** @pred learning_flag(+Name, -Value)}
/** @pred learning_flag(+Name, -Value)
This predicate gives the value of the learning flag with the specified name. The supported flags are:

View File

@ -146,10 +146,11 @@ statistics from the MYDDAS system;
This option is only available in MySQL. It enables the option to interact with the MySQL server in
two different ways. As if we were on the MySQL Client Shell, and as if
we were using Datalog.
@}
*/
%% @}
/** @defgroup MYDDAS_Architecture MYDDAS Architecture
@ingroup MYDDAS
@{
@ -202,15 +203,18 @@ FROM 'phonebook' A
WHERE A.Name = 'John Doe';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@}
*/
%% @}
/** @defgroup View_Level_Interface View Level Interface
@ingroup MYDDAS
@{
*/
/**
@pred db view(+,+,+).
@ -302,16 +306,17 @@ FROM Edge A WHERE A.attr1 = 10;
To know how to use db `view/3`, please refer to Draxler's Prolog to
SQL Compiler Manual.
@}
*/
%% @}
/** @defgroup Accessing_Tables_in_Data_Sources_Using_SQL Accessing Tables in Data Sources Using SQL
@ingroup MYDDAS
@{
@pred db_sql(+,+,?).
*/
/** @pred db_sql(+,+,?).
@ -336,12 +341,17 @@ Example:
LA = ['D','John Doe',123456789] ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@section Insertion_of_Rows Insertion of Rows
*/
@pred db_assert(+,+).
%% @}
/** @defgroup Insertion_of_Rows Insertion of Rows
@ingroup MYDDAS
@{
*/
/** @pred db_assert(+,+).
@pred db_assert(+).
@ -385,10 +395,9 @@ yes
Would insert the row: `A,null value,31` into the relation
`Hello World`, assuming that the second row allows null values.
@pred db insert(+,+,+).
*/
/** @pred db insert(+,+,+).
@pred db insert(+,+).
@ -412,15 +421,17 @@ yes
yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@}
*/
%% @}
/** @defgroup Types_of_Attributes Types of AttributesL
@ingroup MYDDAS
@{
@pred db_get_attributes_types(+,+,?).
*/
/** @pred db_get_attributes_types(+,+,?).
@ -448,20 +459,18 @@ yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
where <tt>Hello World</tt> is the name of the relation and <tt>myddas</tt> is the
connection identifier.
@}
*/
%% @}
/** @defgroup Number_of_Fields Number of Fields
@ingroup MYDDAS
@{
@pred db_number_of_fields(+,?).
*/
/** @pred db_number_of_fields(+,?).
@pred db_number_of_fields(+,+,?).
@ -486,18 +495,18 @@ where `Hello World` is the name of the
relation and `myddas` is the connection identifier.
@}
*/
%% @}
/** @defgroup Describing_a_Relation Describing a Relation
@ingroup MYDDAS
@{
@pred db_datalog_describe(+,+).
*/
/** @pred db_datalog_describe(+,+).
@pred db_datalog_describe(+).
@ -518,7 +527,9 @@ command, the same way as `DESCRIBE` in the MySQL prompt would.
yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@pred db_describe(+,+).
*/
/** @pred db_describe(+,+).
@ -538,15 +549,17 @@ no
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@}
*/
%% @}
/** @defgroup Enumerating_Relations Enumeration Relations Describing_a_Relation Describing a Relation
@ingroup MYDDAS
@{
@pred db_datalog_show_tables(+).
*/
/** @pred db_datalog_show_tables(+).
@pred db_datalog_show_tables
@ -565,7 +578,9 @@ it does not returns any value, but instead prints to the screen the result of th
yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@pred db_show_tables(+, ?).
*/
/** @pred db_show_tables(+, ?).
@ -584,19 +599,19 @@ Table = table('Hello World') ? ;
no
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@}
*/
%%@}
/** @defgroup The_MYDDAS_MySQL_Top_Level The MYDDAS MySQL Top Level
@ingroup MYDDAS
@{
*/
/**
@pred db_top_level(+,+,+,+,+).
@pred db_top_level(+,+,+,+).
@ -644,18 +659,19 @@ Bye
yes
?-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@}
*/
%%@}
/** @defgroup Other_MYDDAS_Properties Other MYDDAS Properties
@ingroup MYDDAS
@{
*/
@pred db_verbose(+).
@pred db_top_level(+,+,+,+).
/**
@pred db_verbose(+).
When we ask a question to YAP, using a predicate asserted by
@ -670,8 +686,16 @@ yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we want to
disable this feature, we must call the `db_verbose/1` predicate with the value 0.
\
*/
@pred db_module(?).
/**
@pred db_top_level(+,+,+,+).
*/
/** @pred db_module(?).
@ -707,11 +731,9 @@ yes
?-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@pred db_my_result_set(?).
*/
/** @pred db_my_result_set(?).
The MySQL C API permits two modes for transferring the data generated by
a query to the client, in our case YAP. The first mode, and the default
@ -736,7 +758,9 @@ After this command, all
of the database predicates will use use result by default. We can change
this by doing again `db_my_result_set(store_result)`.
@pred db_my_sql_mode(+Conn,?SQL_Mode).
*/
/** @pred db_my_sql_mode(+Conn,?SQL_Mode).
@ -758,6 +782,8 @@ You can see the available SQL Modes at the MySQL homepage at
*/
%% @}
#ifdef MYDDAS_TOP_LEVEL
:- use_module(myddas_top_level,[
db_top_level/4,

View File

@ -15,7 +15,7 @@
* *
*************************************************************************/
/**
/**
@defgroup YAPControl Control Predicates
@ingroup YAPBuiltins
@ -24,25 +24,8 @@
*/
/** @pred :_P_ , :_Q_ is iso
Conjunction of goals (and).
Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p(X) :- q(X), r(X).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
should be read as "p( _X_) if q( _X_) and r( _X_)".
*/
/** @pred :_P_ ; :_Q_ is iso
/** @pred :_P_ ; :_Q_ is iso
Disjunction of goals (or).
Example:
@ -52,11 +35,11 @@ Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
should be read as "p( _X_) if q( _X_) or r( _X_)".
*/
/** @pred \+ :_P_ is iso
/** @pred \+ :_P_ is iso
Negation by failure.
Goal _P_ is not provable. The execution of this predicate fails if
and only if the goal _P_ finitely succeeds. It is not a true logical
@ -65,17 +48,24 @@ negation, which is impossible in standard Prolog, but
This predicate might be defined as:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~
\+(P) :- P, !, fail.
\+(_).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~
if _P_ did not include "cuts".
If _P_ includes cuts, the cuts are defined to be scoped by _P_: they canno cut over the calling prredicate.
~~~~~~~~~~~~
go(P).
:- \+ P, !, fail.
\+(_).
~~~~~~~~~~~~
*/
/** @pred not :_P_
/** @pred not :_P_
Goal _P_ is not provable. The same as `\+ _P_`.
@ -84,12 +74,12 @@ This predicate is kept for compatibility with C-Prolog and previous
versions of YAP. Uses of not/1 should be replaced by
`\+`/1, as YAP does not implement true negation.
*/
/** @pred :_P_ -> :_Q_ is iso
/** @pred :_Condition__ -> :_Action_ is iso
Read as "if-then-else" or "commit". This operator is similar to the
@ -134,26 +124,31 @@ Note also that you can use chains of commit operators like:
Note that `(->)/2` does not affect the scope of cuts in its
arguments.
*/
/** @pred :_Condition_ *-> :_Action_
/** @pred :_Condition_ *-> :_Action_ is iso
This construct implements the so-called <em>soft-cut</em>. The control is
defined as follows: If _Condition_ succeeds at least once, the
semantics is the same as ( _Condition_, _Action_). If
defined as follows:
+ If _Condition_ succeeds at least once, the
semantics is the same as ( _Condition_, _Action_).
+ If
_Condition_ does not succeed, the semantics is that of (\\+
_Condition_, _Else_). In other words, If _Condition_
_Condition_, _Else_).
In other words, if _Condition_
succeeds at least once, simply behave as the conjunction of
_Condition_ and _Action_, otherwise execute _Else_.
The construct _A *-> B_, i.e. without an _Else_ branch, is
translated as the normal conjunction _A_, _B_.
*/
/** @pred ! is iso
/** @pred ! is iso
Read as "cut". Cuts any choices taken in the current procedure.
@ -184,7 +179,7 @@ definition:
member(X,[_|L]) :- member(X,L).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the same query would return only the first element of the
the same query would return only the first element of the
list, since backtracking could not "pass through" the cut.
*/
@ -219,11 +214,7 @@ private(_).
%
% boootstrap predicates.
%
:- system_module( '$_boot', [(*->)/2,
(',')/2,
(->)/2,
(;)/2,
(\+)/1,
:- system_module( '$_boot', [
bootstrap/1,
call/1,
catch/3,
@ -234,8 +225,7 @@ private(_).
(not)/1,
repeat/0,
throw/1,
true/0,
('|')/2], ['$$compile'/4,
true/0], ['$$compile'/4,
'$call'/4,
'$catch'/3,
'$check_callable'/2,
@ -299,12 +289,13 @@ private(_).
%
%
%
/** @pred true is iso
/** @pred true is iso
Succeed.
Succeeds once.
*/
true :- true.
@ -385,7 +376,7 @@ true :- true.
'$init_globals' :-
% '$swi_set_prolog_flag'(break_level, 0),
% '$set_read_error_handler'(error), let the user do that
% '$set_read_error_handler'(error), let the user do that
nb_setval('$chr_toplevel_show_store',false).
'$init_consult' :-
@ -458,15 +449,15 @@ true :- true.
'$system_catch'('$raw_read'(user_input, Line), prolog, E,
(print_message(error, E),
'$handle_toplevel_error'(Line, E))),
(
(
'$pred_exists'(rl_add_history(_), user)
->
->
format(atom(CompleteLine), '~W~W',
[ Line, [partial(true)],
'.', [partial(true)]
]),
user:rl_add_history(CompleteLine)
;
;
true
),
'$system_catch'(
@ -524,15 +515,15 @@ true :- true.
( BreakLevel \= 0 -> true ; '$pred_exists'(halt(_), user) -> halt(0) ; '$halt'(0) ).
'$erase_sets' :-
'$erase_sets' :-
eraseall('$'),
eraseall('$$set'),
eraseall('$$one'),
eraseall('$$one'),
eraseall('$reconsulted'), fail.
'$erase_sets' :- \+ recorded('$path',_,_), recorda('$path',"",_).
'$erase_sets'.
'$version' :-
'$version' :-
get_value('$version_name',VersionName),
print_message(help, version(VersionName)),
get_value('$myddas_version_name',MYDDASVersionName),
@ -545,7 +536,7 @@ true :- true.
fail.
'$version'.
/** @pred repeat is iso
/** @pred repeat is iso
Succeeds repeatedly.
In the next example, `repeat` is used as an efficient way to implement
@ -567,7 +558,7 @@ The built-in `repeat/0` could be defined in Prolog by:
The predicate between/3 can be used to iterate for a pre-defined
number of steps.
*/
repeat :- '$repeat'.
@ -582,7 +573,7 @@ number of steps.
'$repeat'.
'$repeat' :- '$repeat'.
'$start_corouts' :-
'$start_corouts' :-
eraseall('$corout'),
eraseall('$result'),
eraseall('$actual'),
@ -595,7 +586,7 @@ number of steps.
'$access_yap_flags'(9,1), !,
'$execute_command'(C,VL,Pos,Con,C).
'$command'(C,VL,Pos,Con) :-
( (Con = top ; var(C) ; C = [_|_]) ->
( (Con = top ; var(C) ; C = [_|_]) ->
'$execute_command'(C,VL,Pos,Con,C), ! ;
% do term expansion
expand_term(C, EC),
@ -614,7 +605,7 @@ number of steps.
'$execute_commands'([C|Cs],VL,Pos,Con,Source) :- !,
(
'$system_catch'('$execute_command'(C,VL,Pos,Con,C),prolog,Error,user:'$LoopError'(Error, Con)),
fail
fail
;
'$execute_commands'(Cs,VL,Pos,Con,Source)
).
@ -637,7 +628,7 @@ number of steps.
\+ '$if_directive'(Command),
!.
'$execute_command'((:-G),VL,Pos,Option,_) :-
% !,
% !,
Option \= top, !,
'$current_module'(M),
% allow user expansion
@ -661,7 +652,7 @@ number of steps.
% ISO only wants directives in files
% SICStus accepts everything in files
% YAP accepts everything everywhere
%
%
'$process_directive'(G, top, M, VL, Pos) :-
'$access_yap_flags'(8, 0), !, % YAP mode, go in and do it,
'$process_directive'(G, consult, M, VL, Pos).
@ -723,13 +714,13 @@ number of steps.
'$go_compile_clause'(G,Vs,Pos,N,Source) :-
'$current_module'(Mod),
'$go_compile_clause'(G,Vs,Pos,N,Mod,Mod,Mod,Source).
'$go_compile_clause'(G,_Vs,_Pos,_N,_HM,_BM,_SM,Source) :-
var(G), !,
'$do_error'(instantiation_error,assert(Source)).
'$do_error'(instantiation_error,assert(Source)).
'$go_compile_clause'((G:-_),_Vs,_Pos,_N,_HM,_BM,_SM,Source) :-
var(G), !,
'$do_error'(instantiation_error,assert(Source)).
'$do_error'(instantiation_error,assert(Source)).
'$go_compile_clause'(M:G,Vs,Pos,N,_,_,SourceMod,Source) :- !,
'$go_compile_clause'(G,Vs,Pos,N,M,M,M,Source).
'$go_compile_clause'((M:H :- B),Vs,Pos,N,_,BodyMod,SourceMod,Source) :- !,
@ -773,13 +764,13 @@ number of steps.
'$not_imported'(_, _).
'$check_if_reconsulted'(N,A) :-
once(recorded('$reconsulted',N/A,_)),
recorded('$reconsulted',X,_),
( X = N/A , !;
X = '$', !, fail;
fail
).
'$check_if_reconsulted'(N,A) :-
once(recorded('$reconsulted',N/A,_)),
recorded('$reconsulted',X,_),
( X = N/A , !;
X = '$', !, fail;
fail
).
'$inform_as_reconsulted'(N,A) :-
recorda('$reconsulted',N/A,_).
@ -810,7 +801,7 @@ number of steps.
'$write_answer'(NV, LGs, Written),
'$write_query_answer_true'(Written),
(
'$prompt_alternatives_on'(determinism), CP == NCP, DCP = 0
'$prompt_alternatives_on'(determinism), CP == NCP, DCP = 0
->
format(user_error, '.~n', []),
!
@ -818,7 +809,7 @@ number of steps.
'$another',
!
),
fail
fail
;
'$out_neg_answer'
).
@ -851,14 +842,14 @@ number of steps.
'$clean_ifcp'(CP),
NCP is NCP2-NCP1
;
copy_term_nat(V, NV),
LGs = [],
copy_term_nat(V, NV),
LGs = [],
% term_factorized(V, NV, LGs),
NCP = 0
).
'$out_neg_answer' :-
( '$undefined'(print_message(_,_),prolog) ->
( '$undefined'(print_message(_,_),prolog) ->
'$present_answer'(user_error,'false.~n')
;
print_message(help,false)
@ -905,15 +896,15 @@ number of steps.
fail
;
C== 10 -> '$add_nl_outside_console',
( '$undefined'(print_message(_,_),prolog) ->
( '$undefined'(print_message(_,_),prolog) ->
format(user_error,'yes~n', [])
;
print_message(help,yes)
)
;
C== 13 ->
C== 13 ->
get0(user_input,NC),
'$do_another'(NC)
'$do_another'(NC)
;
C== -1 -> halt
;
@ -940,7 +931,7 @@ number of steps.
'$write_vars_and_goals'(NLAnsw, first, FLAnsw).
'$purge_dontcares'([],[]).
'$purge_dontcares'([Name=_|Vs],NVs) :-
'$purge_dontcares'([Name=_|Vs],NVs) :-
atom_codes(Name, [C|_]), C is "_", !,
'$purge_dontcares'(Vs,NVs).
'$purge_dontcares'([V|Vs],[V|NVs]) :-
@ -948,7 +939,7 @@ number of steps.
'$prep_answer_var_by_var'([], L, L).
'$prep_answer_var_by_var'([Name=Value|L], LF, L0) :-
'$prep_answer_var_by_var'([Name=Value|L], LF, L0) :-
'$delete_identical_answers'(L, Value, NL, Names),
'$prep_answer_var'([Name|Names], Value, LF, LI),
'$prep_answer_var_by_var'(NL, LI, L0).
@ -1083,10 +1074,10 @@ is converted to:
a(X) :- call(X).
~~~~~
*/
/** @pred call(+ _P_) is iso
/** @pred call(+ _P_) is iso
Meta-call predicate.
If _P_ is instantiated to an atom or a compound term, the goal `call(
@ -1094,16 +1085,16 @@ _P_)` is executed as if the clause was originally written as _P_
instead as call( _P_ ), except that any "cut" occurring in _P_ only
cuts alternatives in the execution of _P_.
*/
call(G) :- '$execute'(G).
/** @pred incore(+ _P_)
/** @pred incore(+ _P_)
The same as call/1.
*/
incore(G) :- '$execute'(G).
@ -1137,6 +1128,19 @@ incore(G) :- '$execute'(G).
'$stop_creeping'.
/** @pred :_P_ , :_Q_ is iso, meta
Conjunction of goals (and).
The conjunction is a fundamental construct of Prolog. Example:
~~~~~~~
p(X) :- q(X), r(X).
~~~~~~~
should be read as `p( _X_) if q( _X_) and r( _X_).
*/
','(X,Y) :-
yap_hacks:env_choice_point(CP),
'$current_module'(M),
@ -1346,7 +1350,7 @@ bootstrap(F) :-
close(Stream).
'$loop'(Stream,exo) :-
prolog_flag(agc_margin,Old,0),
prolog_flag(agc_margin,Old,0),
prompt1('| '), prompt(_,'| '),
'$current_module'(OldModule),
repeat,
@ -1355,7 +1359,7 @@ bootstrap(F) :-
prolog_flag(agc_margin,_,Old),
!.
'$loop'(Stream,db) :-
prolog_flag(agc_margin,Old,0),
prolog_flag(agc_margin,Old,0),
prompt1('| '), prompt(_,'| '),
'$current_module'(OldModule),
repeat,
@ -1406,9 +1410,9 @@ bootstrap(F) :-
% Expanded is the final expanded term.
%
'$precompile_term'(Term, Expanded0, Expanded, HeadMod, BodyMod, SourceMod) :-
%format('[ ~w~n',[Term]),
%format('[ ~w~n',[Term]),
'$module_expansion'(Term, Expanded0, ExpandedI, HeadMod, BodyMod, SourceMod), !,
%format(' -> ~w~n',[Expanded0]),
%format(' -> ~w~n',[Expanded0]),
(
'$access_yap_flags'(9,1) /* strict_iso on */
->
@ -1418,9 +1422,9 @@ bootstrap(F) :-
'$expand_array_accesses_in_term'(ExpandedI,Expanded)
).
'$precompile_term'(Term, Term, Term, _, _, _).
/** @pred expand_term( _T_,- _X_)
/** @pred expand_term( _T_,- _X_)
@ -1432,7 +1436,7 @@ rules: first try term_expansion/2 in the current module, and then try to use th
for DCG rules is applied, together with the arithmetic optimizer
whenever the compilation of arithmetic expressions is in progress.
*/
expand_term(Term,Expanded) :-
( '$do_term_expansion'(Term,Expanded)
@ -1463,8 +1467,8 @@ expand_term(Term,Expanded) :-
% at each catch point I need to know:
% what is ball;
% where was the previous catch
/** @pred catch( : _Goal_,+ _Exception_,+ _Action_) is iso
% where was the previous catch
/** @pred catch( : _Goal_,+ _Exception_,+ _Action_) is iso
The goal `catch( _Goal_, _Exception_, _Action_)` tries to
@ -1477,7 +1481,7 @@ again throws the exception.
The top-level of YAP maintains a default exception handler that
is responsible to capture uncaught exceptions.
*/
catch(G, C, A) :-
'$catch'(C,A,_),
@ -1506,7 +1510,7 @@ catch(G, C, A) :-
%
% throw has to be *exactly* after system catch!
%
/** @pred throw(+ _Ball_) is iso
/** @pred throw(+ _Ball_) is iso
The goal `throw( _Ball_)` throws an exception. Execution is
@ -1514,7 +1518,7 @@ stopped, and the exception is sent to the ancestor goals until reaching
a matching catch/3, or until reaching top-level.
@}
*/
throw(_Ball) :-
% use existing ball
@ -1522,7 +1526,7 @@ throw(_Ball) :-
!,
'$jump_env_and_store_ball'(Ball).
throw(Ball) :-
( var(Ball) ->
( var(Ball) ->
'$do_error'(instantiation_error,throw(Ball))
;
% get current jump point
@ -1558,7 +1562,7 @@ catch_ball(C, C).
'$run_toplevel_hooks' :-
'$swi_current_prolog_flag'(break_level, 0 ),
recorded('$toplevel_hooks',H,_),
recorded('$toplevel_hooks',H,_),
H \= fail, !,
( call(user:H1) -> true ; true).
'$run_toplevel_hooks'.
@ -1576,4 +1580,3 @@ log_event( String, Args ) :-
/**
@}
*/

View File

@ -1506,6 +1506,17 @@ import_module(Mod, ImportModule) :-
import_module(Mod, EM) :-
'$do_error'(type_error(atom,Mod),import_module(Mod, EM)).
/** add_import_module( + _Module_, + _ImportModule_ , +_Pos_) is det
Add all exports in _ImportModule_ as available to _Module_.
All exported predicates from _ExportModule_ are made available to the
source module _ImportModule_. If _Position_ is bound to `start` the
module _ImportModule_ is tried first, if _Position_ is bound to `end`,
the module is consulted last.
*/
add_import_module(Mod, ImportModule, Pos) :-
var(Mod),
'$do_error'(instantiation_error,add_import_module(Mod, ImportModule, Pos)).
@ -1526,6 +1537,14 @@ add_import_module(Mod, ImportModule, Pos) :-
add_import_module(Mod, ImportModule, Pos) :-
'$do_error'(domain_error(start_end,Pos),add_import_module(Mod, ImportModule, Pos)).
/** delete_import_module( + _ExportModule_, + _ImportModule_ ) is det
Exports in _ImportModule_ are no longer available to _Module_.
All exported predicates from _ExportModule_ are discarded from the
ones used vy the source module _ImportModule_.
*/
delete_import_module(Mod, ImportModule) :-
var(Mod),
'$do_error'(instantiation_error,delete_import_module(Mod, ImportModule)).
@ -1548,6 +1567,21 @@ delete_import_module(Mod, ImportModule) :-
'$set_source_module'(Source0, SourceF) :-
current_module(Source0, SourceF).
/** module_property( + _Module_, ? _Property_ ) is nondet
Enumerate non-deterministically the main properties of _Module_ .
Reports the following properties of _Module_:
+ `class`( ?_Class_ ): whether it is a `system`, `library`, or `user` module.
+ `line_count`(?_Ls_): number of lines in source file.
+ `file`(?_F_): source file for _Module_.
+ `exports`(-Es): list of all predicate symbols and
operator symbols exported or re-exported by this module.
*/
module_property(Mod, class(L)) :-
'$module_class'(Mod, L).
module_property(Mod, line_count(L)) :-