docs
This commit is contained in:
parent
3cb343479e
commit
83b137f117
@ -35,7 +35,6 @@ modules.yap
|
||||
newmod.yap
|
||||
os.yap
|
||||
pathconf.yap
|
||||
pl
|
||||
preddecls.yap
|
||||
preddyns.yap
|
||||
preds.yap
|
||||
@ -59,6 +58,8 @@ yapor.yap
|
||||
yio.yap
|
||||
)
|
||||
|
||||
add_to_group( pl_boot_library PL_SOURCES )
|
||||
|
||||
add_custom_target (${YAP_STARTUP} ALL SOURCES ${PL_SOURCES} ${YAPOS_PL_SOURCES} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
||||
|
||||
if ( NOT CMAKE_CROSSCOMPILING )
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*************************************************************************
|
||||
pattr/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
@ -18,16 +18,13 @@
|
||||
/**
|
||||
@file attributes.yap
|
||||
|
||||
|
||||
@defgroup New_Style_Attribute_Declarations SWI Compatible attributes
|
||||
@{
|
||||
@ingroup attributes
|
||||
|
||||
*/
|
||||
|
||||
:- module('$attributes', [
|
||||
delayed_goals/4
|
||||
], []).
|
||||
:- module('attributes', [delayed_goals/4]).
|
||||
|
||||
:- use_system_module( '$_boot', ['$undefp'/1]).
|
||||
|
||||
@ -348,37 +345,29 @@ printing and other special purpose operations.
|
||||
User-defined procedure, called to convert the attributes in _Var_ to
|
||||
a _Goal_. Should fail when no interpretation is available.
|
||||
*/
|
||||
attvar_residuals([], _) --> [].
|
||||
|
||||
attvar_residuals(att(Module,Value,As), V) -->
|
||||
( { nonvar(V) }
|
||||
-> % a previous projection predicate could have instantiated
|
||||
% this variable, for example, to avoid redundant goals
|
||||
[]
|
||||
; { attributes:module_has_attributes(Module) } ->
|
||||
% SICStus like run, put attributes back first
|
||||
{ Value =.. [Name,_|Vs],
|
||||
NValue =.. [Name,_|Vs],
|
||||
attributes:put_module_atts(V,NValue)
|
||||
},
|
||||
attvar_residuals(As, V),
|
||||
( { '$undefined'(attribute_goal(V, Goal), Module) }
|
||||
->
|
||||
[]
|
||||
;
|
||||
{ call(Module:attribute_goal(V, Goal)) },
|
||||
dot_list(Goal)
|
||||
)
|
||||
; ( { current_predicate(Module:attribute_goals/3) }
|
||||
-> { call(Module:attribute_goals(V, Goals, [])) },
|
||||
list(Goals)
|
||||
; { current_predicate(Module:attribute_goal/2) }
|
||||
-> { call(Module:attribute_goal(V, Goal)) },
|
||||
dot_list(Goal)
|
||||
; [put_attr(V, Module, Value)]
|
||||
),
|
||||
attvar_residuals(As, V)
|
||||
).
|
||||
; generate_goals( V, As, Value, Module)
|
||||
).
|
||||
|
||||
generate_goals( V, _, Value, Module) -->
|
||||
{ attributes:module_has_attributes(Module) },
|
||||
% like run, put attributes back first
|
||||
{ Value =.. [Name,_|Vs],
|
||||
NValue =.. [Name,_|Vs],
|
||||
attributes:put_module_atts(V,NValue)
|
||||
},
|
||||
{ current_predicate(Module:attribute_goal/2) },
|
||||
{ call(Module:attribute_goal(V, Goal)) },
|
||||
dot_list(Goal),
|
||||
[put_attr(V, Module, Value)].
|
||||
generate_goals( V, _, _Value , Module) -->
|
||||
{ '$pred_exists'(attribute_goals(_,_,_), Module) },
|
||||
call(Module:attribute_goals(V) ).
|
||||
|
||||
|
||||
attributes:module_has_attributes(Mod) :-
|
||||
attributes:attributed_module(Mod, _, _), !.
|
||||
@ -451,7 +440,7 @@ call_residue(Goal,Module,Residue) :-
|
||||
),
|
||||
copy_term(Goal, Goal, Residue).
|
||||
|
||||
delayed_goals(G, Vs, NVs, Gs) :-
|
||||
attributes:delayed_goals(G, Vs, NVs, Gs) :-
|
||||
project_delayed_goals(G),
|
||||
% term_factorized([G|Vs], [_|NVs], Gs).
|
||||
copy_term([G|Vs], [_|NVs], Gs).
|
||||
@ -481,10 +470,11 @@ att_vars([_|LGs], AttVars) :-
|
||||
% make sure we set the suspended goal list to its previous state!
|
||||
% make sure we have installed a SICStus like constraint solver.
|
||||
|
||||
/** @pred _Module_:project_attributes( _+QueryVars_, _+AttrVars_)
|
||||
/** @pred _Module_:project_attributes(+AttrVars, +Goal)
|
||||
|
||||
|
||||
Given a list of variables _QueryVars_ and list of attributed
|
||||
|
||||
Given a goal _Goa]l_ with variables _QueryVars_ and list of attributed
|
||||
variables _AttrVars_, project all attributes in _AttrVars_ to
|
||||
_QueryVars_. Although projection is constraint system dependent,
|
||||
typically this will involve expressing all constraints in terms of
|
||||
@ -495,7 +485,7 @@ Projection interacts with attribute_goal/2 at the Prolog top
|
||||
level. When the query succeeds, the system first calls
|
||||
project_attributes/2. The system then calls
|
||||
attribute_goal/2 to get a user-level representation of the
|
||||
constraints. Typically, attribute_goal/2 will convert from the
|
||||
constraints. Typically, project_attributes/2 will convert from the
|
||||
original constraints into a set of new constraints on the projection,
|
||||
and these constraints are the ones that will have an
|
||||
attribute_goal/2 handler.
|
||||
@ -523,5 +513,3 @@ project_module([_|LMods], LIV, LAV) :-
|
||||
project_module(LMods,LIV,LAV).
|
||||
|
||||
%% @}
|
||||
|
||||
|
||||
|
10
pl/boot.yap
10
pl/boot.yap
@ -1,4 +1,3 @@
|
||||
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
@ -18,11 +17,10 @@
|
||||
|
||||
/**
|
||||
@file boot.yap
|
||||
|
||||
@addtogroup builtins Core YAP Builtins
|
||||
@brief YAP bootstrap
|
||||
|
||||
@defgroup YAPControl Control Predicates
|
||||
@ingroup builtins
|
||||
|
||||
|
||||
@{
|
||||
|
||||
@ -291,7 +289,7 @@ private(_).
|
||||
source_location(F0, L),
|
||||
format('~a:~d:0: error in bootstrap:~n ~w~n', [F0,L,Error]),
|
||||
fail.
|
||||
'$bootstrap_predicate'(delayed_goals(_, _, _ ), _M, _) :- !,
|
||||
'$bootstrap_predicate'(delayed_goals(_, _, _ , _), _M, _) :- !,
|
||||
fail.
|
||||
'$bootstrap_predicate'(sort(L, S), _M, _) :- !,
|
||||
'$sort'(L, S).
|
||||
@ -807,7 +805,7 @@ number of steps.
|
||||
(
|
||||
CP is '$last_choice_pt',
|
||||
'$current_choice_point'(NCP1),
|
||||
'$attributes':delayed_goals(G, V, NV, LGs),
|
||||
attributes:delayed_goals(G, V, NV, LGs),
|
||||
'$current_choice_point'(NCP2),
|
||||
'$clean_ifcp'(CP),
|
||||
NCP is NCP2-NCP1
|
||||
|
@ -941,18 +941,6 @@ source_file(Mod:Pred, FileName) :-
|
||||
|
||||
SWI-compatible predicate. True if the predicate specified by _ModuleAndPred_ was loaded from file _File_, where _File_ is an absolute path name (see `absolute_file_name/2`).
|
||||
|
||||
*/
|
||||
|
||||
%% @}
|
||||
|
||||
%% @{
|
||||
|
||||
/** @addtogroup YAPLibraries Library Predicates
|
||||
|
||||
Library files reside in the library_directory path (set by the
|
||||
`LIBDIR` variable in the Makefile for YAP). Currently,
|
||||
most files in the library are from the Edinburgh Prolog library.
|
||||
|
||||
*/
|
||||
prolog_load_context(directory, DirName) :-
|
||||
( source_location(F, _)
|
||||
@ -1183,9 +1171,11 @@ unload_file( F0 ) :-
|
||||
|
||||
/**
|
||||
|
||||
@{
|
||||
@defgroup ModPreds Module Interface Predicates
|
||||
@ingroup YAPModules
|
||||
|
||||
@addtogroup YAPModules
|
||||
|
||||
@{
|
||||
|
||||
**/
|
||||
|
||||
@ -1294,11 +1284,12 @@ account the following observations:
|
||||
@}
|
||||
**/
|
||||
|
||||
%% @{
|
||||
|
||||
/** @defgroup YAPCompilerSettings Directing and Configuring the Compiler
|
||||
@ingroup YAPProgramming
|
||||
|
||||
@{
|
||||
|
||||
The YAP system also includes a number of primitives designed to set
|
||||
compiler parameters and to track the state of the compiler. One
|
||||
important example is the number of directivees that allow setting up
|
||||
|
@ -20,16 +20,8 @@
|
||||
* @file corout.yap
|
||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||
* @date Mon Nov 16 22:47:27 2015
|
||||
*
|
||||
* @addtogroup extensions Extensions to Core Prolog
|
||||
*
|
||||
* @{
|
||||
* @ addtogroup attributes Attributed Variables and Co-Routining
|
||||
* @{
|
||||
* @brief Support for co-routining
|
||||
*
|
||||
*
|
||||
*/
|
||||
* *
|
||||
*/
|
||||
|
||||
|
||||
:- module('$coroutining',[
|
||||
@ -43,15 +35,21 @@
|
||||
|
||||
:- use_system_module( '$_boot', ['$$compile'/4]).
|
||||
|
||||
|
||||
|
||||
:- use_system_module( attributes, [get_module_atts/2,
|
||||
put_module_atts/2]).
|
||||
|
||||
|
||||
%%@{
|
||||
/**
|
||||
* @defgroup corout Implementing Attributed Variables and Co-Routining
|
||||
*
|
||||
* @ingroup attributes
|
||||
* @{
|
||||
* @brief Support for co-routining
|
||||
*
|
||||
*
|
||||
”” */
|
||||
|
||||
%% @aaddtogroup CohYroutining
|
||||
%% @ingroup attributes
|
||||
|
||||
/** @pred attr_unify_hook(+ _AttValue_,+ _VarValue_)
|
||||
|
||||
@ -580,5 +578,4 @@ check_first_attvar([_|Vs], V0) :-
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
|
@ -1,6 +1,3 @@
|
||||
%%% @{
|
||||
|
||||
%%% @addtogroup YAPModules
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
@ -28,6 +25,15 @@
|
||||
:- use_system_module( attributes, [get_module_atts/2,
|
||||
put_module_atts/2]).
|
||||
|
||||
%%% @file dbload.yap
|
||||
|
||||
%%% @defgroup YAPBigLoad
|
||||
%%% @brief Fast and Exo Loading
|
||||
|
||||
/*!
|
||||
* @pred load_mega_clause( +Stream ) is detail
|
||||
* Load a single predicare composed of facts with the same size.
|
||||
*/
|
||||
load_mega_clause( Stream ) :-
|
||||
% line_spec( Stream, Line),
|
||||
repeat,
|
||||
@ -38,6 +44,10 @@ load_mega_clause( Stream ) :-
|
||||
'$process_lines'(R, Lines, _Type ),
|
||||
close(R).
|
||||
|
||||
/*!
|
||||
* @pred load_db( +Files ) is det
|
||||
* Load files each one containing as single predicare composed of facts with the same size.
|
||||
*/
|
||||
prolog:load_db(Fs) :-
|
||||
'$current_module'(M0),
|
||||
prolog_flag(agc_margin,Old,0),
|
||||
|
@ -15,18 +15,6 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
@defgroup YAPProgramming Programming in YAP
|
||||
|
||||
+ @ref Syntax
|
||||
|
||||
+ @ref YAPCompilerSettings
|
||||
|
||||
+ @ref Indexing
|
||||
|
||||
+ @ref Deb_Interaction
|
||||
|
||||
*/
|
||||
|
||||
:- system_module( '$_directives', [user_defined_directive/2], ['$all_directives'/1,
|
||||
'$exec_directives'/5]).
|
||||
|
17
pl/init.yap
17
pl/init.yap
@ -25,12 +25,12 @@
|
||||
@}
|
||||
|
||||
@addtogroup YAPControl
|
||||
|
||||
@ingroup builtins
|
||||
@{
|
||||
*/
|
||||
:- system_module( '$_init', [!/0,
|
||||
(:-)/1,
|
||||
(?-)/1,
|
||||
':-'/1,
|
||||
'?-'/1,
|
||||
[]/0,
|
||||
extensions_to_present_answer/1,
|
||||
fail/0,
|
||||
@ -40,7 +40,7 @@
|
||||
otherwise/0,
|
||||
term_expansion/2,
|
||||
version/2,
|
||||
'$do_log_upd_clause'/6,
|
||||
'$do_log_upd_clause'/6,
|
||||
'$do_log_upd_clause0'/6,
|
||||
'$do_log_upd_clause_erase'/6,
|
||||
'$do_static_clause'/5], [
|
||||
@ -381,13 +381,4 @@ clause_to_indicator(T, M:Name/Arity) :- ,
|
||||
strip_module(T, M, T1),
|
||||
pred_arity( T1, Name, Arity ).
|
||||
:- endif.
|
||||
*/
|
||||
|
||||
/**
|
||||
@}
|
||||
|
||||
@defgroup packages YAP Packages
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
|
||||
@{
|
||||
|
||||
@defgroup YAPMetaPredicates Using Meta-Calls with Modules
|
||||
@ingroup YAPModules
|
||||
@{
|
||||
|
||||
@pred meta_predicate(_G1_,...., _Gn) is directive
|
||||
|
||||
@ -405,7 +405,7 @@ o:p(B) :- n:g, X is 2+3, call(B).
|
||||
'$build_up'(HM, NH, SM, B1, (NH :- B1), BO, ( NH :- BO)) :- HM == SM, !.
|
||||
'$build_up'(HM, NH, _SM, B1, (NH :- B1), BO, ( HM:NH :- BO)) :- !.
|
||||
|
||||
'$expand_clause_body'(V, _NH1, _HM1, _SM, M, call(M:V), call(M:V) ) :-
|
||||
'$expand_clause_body'(V, _NH1, _HM1, _SM, M, call(M:V), call(M:V) ) :-
|
||||
var(V), !.
|
||||
'$expand_clause_body'(true, _NH1, _HM1, _SM, _M, true, true ) :- !.
|
||||
'$expand_clause_body'(B, H, HM, SM, M, B1, BO ) :-
|
||||
|
@ -20,6 +20,7 @@
|
||||
/**
|
||||
@defgroup QLY Creating and Using a saved state
|
||||
@ingroup YAPConsulting
|
||||
@{
|
||||
*/
|
||||
|
||||
:- system_module( '$_qly', [qload_module/1,
|
||||
@ -49,7 +50,7 @@
|
||||
|
||||
:- use_system_module( '$_yio', ['$extend_file_search_path'/1]).
|
||||
|
||||
|
||||
/**
|
||||
YAP can save and read images of its current state to files, known as
|
||||
saved states. It is possible to save the entire state or just a module
|
||||
or a file. Notice that saved states in YAP depend on the architecture
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*************************************************************************
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
|
Reference in New Issue
Block a user