This commit is contained in:
Vítor Santos Costa 2016-01-31 10:45:00 +00:00
parent bd337494f1
commit 1f7608a735

View File

@ -7,7 +7,7 @@
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 *
* * * *
************************************************************************** **************************************************************************
* * * Ptv *
* File: boot.yap * * File: boot.yap *
* Last rev: 8/2/88 * * Last rev: 8/2/88 *
* mods: * * mods: *
@ -16,7 +16,7 @@
*************************************************************************/ *************************************************************************/
/** /**
@file boot.yap
@defgroup YAPControl Control Predicates @defgroup YAPControl Control Predicates
@ingroup builtins @ingroup builtins
@ -55,31 +55,17 @@ This predicate might be defined as:
~~~~~~~~~~~~ ~~~~~~~~~~~~
if _P_ did not include "cuts". 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. If _P_ includes cuts, the cuts are defined to be scoped by _P_: they cannot cut over the calling prredicate.
~~~~~~~~~~~~ ~~~~~~~~~~~~
go(P). go(P).
:- \+ P, !, fail.
:- \+ P, !, fail.
\+(_). \+(_).
~~~~~~~~~~~~ ~~~~~~~~~~~~
*/ */
/** @pred not :_P_
Goal _P_ is not provable. The same as `\+ _P_`.
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 :_Condition__ -> :_Action_ is iso /** @pred :_Condition__ -> :_Action_ is iso
@ -185,8 +171,8 @@ list, since backtracking could not "pass through" the cut.
*/ */
system_module(Mod, _SysExps, _Decls) :- !, system_module(Mod, _SysExps, _Decls) :- ! .
new_system_module(Mod). % new_system_module(Mod).
use_system_module(_init, _SysExps) :- !. use_system_module(_init, _SysExps) :- !.
@ -308,7 +294,7 @@ private(_).
arg(1, AOB, A), arg(1, AOB, A),
arg(2, AOB, B), arg(2, AOB, B),
!, !,
'$binary_op_as_integer'(Op,IOp). '$inbrary_op_as_integer'(Op,IOp).
'$prepare_goals'((A,B),(A,B),_Any). '$prepare_goals'((A,B),(A,B),_Any).
'$prepare_clause'((H :- B), (H:-NB)) :- '$prepare_clause'((H :- B), (H:-NB)) :-
@ -519,13 +505,13 @@ true :- true.
). ).
'$erase_sets' :- '$erase_sets' :-
eraseall('$'), eraseall('$'),
eraseall('$$set'), eraseall('$$set'),
eraseall('$$one'), eraseall('$$one'),
eraseall('$reconsulted'), fail. eraseall('$reconsulted'), fail.
'$erase_sets' :- \+ recorded('$path',_,_), recorda('$path',"",_). '$erase_sets' :- \+ recorded('$path',_,_), recorda('$path',"",_).
'$erase_sets'. '$erase_sets'.
'$version' :- '$version' :-
current_prolog_flag(version_git,VersionGit), current_prolog_flag(version_git,VersionGit),
@ -719,15 +705,18 @@ number of steps.
'$continue_with_command'(top,V,_,G,_) :- '$continue_with_command'(top,V,_,G,_) :-
'$query'(G,V). '$query'(G,V).
%%
% @pred '$go_compile_clause'(G,Vs,Pos, Where, Source) is det
% %
% interfaces the loader and the compiler
% not 100% compatible with SICStus Prolog, as SICStus Prolog would put % not 100% compatible with SICStus Prolog, as SICStus Prolog would put
% module prefixes all over the place, although unnecessarily so. % module prefixes all over the place, although unnecessarily so.
% %
% G is the goal to compile % @param [in] _G_ is the clause to compile
% Vs the named variables % @param [in] _Vs_ a list of varables and their name
% Pos the source position % @param [in] _Pos_ the source-code position
% N where to add first or last % @param [in] _N_ a flag telling whether to add first or last
% Source the original clause % @param [in] _Source_ the original clause
'$go_compile_clause'(G,Vs,Pos, Where, Source) :- '$go_compile_clause'(G,Vs,Pos, Where, Source) :-
'$precompile_term'(G, G0, G1), '$precompile_term'(G, G0, G1),
!, !,
@ -1379,29 +1368,37 @@ bootstrap(F) :-
prolog_flag(agc_margin,_,Old), prolog_flag(agc_margin,_,Old),
!. !.
'$loop'(Stream,Status) :- '$loop'(Stream,Status) :-
% start_low_level_trace,
'$current_module'( OldModule ),
repeat, repeat,
prompt1(': '), prompt(_,' '), '$system_catch'( '$enter_command'(Stream,OldModule,Status),
'$current_module'(OldModule), OldModule, Error,
'$system_catch'('$enter_command'(Stream,OldModule,Status), OldModule, Error, user:'$LoopError'(Error, Status)
user:'$LoopError'(Error, Status)), ),
!. !.
'$enter_command'(Stream,Mod,Status) :- '$enter_command'(Stream, Mod, Status) :-
!, prompt1(': '), prompt(_,' '),
read_term(Stream, Command, [module(Mod), syntax_errors(dec10),variable_names(Vars), term_position(Pos)]), Options = [module(Mod), syntax_errors(dec10),variable_names(Vars), term_position(Pos)],
(
Status == top
->
read_term(Stream, Command, Options)
;
read_clause(Stream, Command, Options)
),
'$command'(Command,Vars,Pos, Status). '$command'(Command,Vars,Pos, Status).
'$enter_command'(_Stream, _Mod, _HeadMob).
/** @pred user:expand_term( _T_,- _X_) is dynamic,multifile.
/** @pred expand_term( _T_,- _X_) This user-defined predicate is called by YAP after
reading goals and clauses.
This predicate is used by YAP for preprocessingStatus) :- - _Module_:`expand_term(` _T_ , _X_) is called first on the
read_clause(Stream, Command, [variable_names(Vars), term_position(Pos)]), current source module _Module_ ; if i
'$command'(Command,Vars,Pos,Status). - `user:expand_term(` _T_ , _X_ `)` is available on every module.
'$abort_loop'(Stream) :-
'$do_error'(permission_error(input,closed_stream,Stream), loop).
*/
/* General purpose predicates */ /* General purpose predicates */