bootstrap right

This commit is contained in:
Vitor Santos Costa 2016-06-17 17:08:21 +01:00
parent b2fe557503
commit dc2ed1bea8

View File

@ -323,24 +323,15 @@ true :- true.
'$init_system' :- '$init_system' :-
set_value('$yap_inited', true), set_value('$yap_inited', true),
% do catch as early as possible % do catch as early as possible
( (
current_prolog_flag(halt_after_consult, false),
current_prolog_flag(verbose, normal)
% \+ '$uncaught_throw' % \+ '$uncaught_throw'
current_prolog_flag(halt_after_consult, false),
current_prolog_flag(verbose, normal)
-> ->
'$version' '$version'
; ;
true true
), ),
% '$init_preds', % needs to be done before library_directory
% (
% retractall(user:library_directory(_)),
% '$system_library_directories'(D),
% assertz(user:library_directory(D)),
% fail
% ;
% true
% ),
current_prolog_flag(file_name_variables, OldF), current_prolog_flag(file_name_variables, OldF),
set_prolog_flag(file_name_variables, true), set_prolog_flag(file_name_variables, true),
'$init_consult', '$init_consult',
@ -353,21 +344,32 @@ true :- true.
set_prolog_flag(debug, false), set_prolog_flag(debug, false),
% simple trick to find out if this is we are booting from Prolog. % simple trick to find out if this is we are booting from Prolog.
% boot from a saved state % boot from a saved state
( (
current_prolog_flag(saved_program, false) current_prolog_flag(saved_program, false)
-> ->
prolog_flag(verbose, OldV, silent), prolog_flag(verbose, OldV, silent),
prolog_flag(resource_database, RootPath), prolog_flag(resource_database, RootPath),
file_directory_name( RootPath, Dir ), file_directory_name( RootPath, Dir ),
atom_concat( Dir, '/init.yap' , Init), atom_concat( Dir, '/init.yap' , Init),
bootstrap(Init), (
set_prolog_flag(verbose, OldV), % is lib_dir set?
module( user ), system_library( LibDir )
'$make_saved_state' ->
true
;
% get it from boot.yap
atom_concat( LibDir, '/pl' , Dir),
system_library(LibDir)
),
bootstrap(Init),
set_prolog_flag(verbose, OldV),
module( user ),
'$make_saved_state'
; ;
true % use saved state
'$init_state'
), ),
'$init_state',
'$db_clean_queues'(0), '$db_clean_queues'(0),
% this must be executed from C-code. % this must be executed from C-code.
% '$startup_saved_state', % '$startup_saved_state',
@ -378,8 +380,8 @@ true :- true.
'$make_saved_state' :- '$make_saved_state' :-
current_prolog_flag(os_argv, Args), current_prolog_flag(os_argv, Args),
( (
member( Arg, Args ), lists:member( Arg, Args ),
atom_concat( '-B', _, Arg ) atom_concat( '-B', _, Arg )
-> ->
qsave_program( 'startup.yss'), qsave_program( 'startup.yss'),
@ -626,10 +628,11 @@ number of steps.
( (
O = (:- G1) O = (:- G1)
-> ->
'$current_module'(M), '$current_module'(M),
'$process_directive'(G1, Option, M, VL, Pos) '$process_directive'(G1, Option, M, VL, Pos)
; ;
'$execute_commands'(O,VL,Pos,Option,O) '$execute_commands'(G1,VL,Pos,Option,O)
). ).
'$execute_command'((?-G), VL, Pos, Option, Source) :- '$execute_command'((?-G), VL, Pos, Option, Source) :-
Option \= top, Option \= top,
@ -1312,19 +1315,6 @@ not(G) :- \+ '$execute'(G).
'$check_callable'(_,_). '$check_callable'(_,_).
'$bootstrap' :-
bootstrap('init.yap'),
module(user),
'$live'.
'$silent_bootstrap'(F) :-
yap_flag(verbose, Old, silent),
bootstrap( F ),
yap_flag(verbose, _, Old),
'$live'.
bootstrap(F) :- bootstrap(F) :-
% '$open'(F, '$csult', Stream, 0, 0, F), % '$open'(F, '$csult', Stream, 0, 0, F),
% '$file_name'(Stream,File), % '$file_name'(Stream,File),