use_load_files to handle initialization files
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1404 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
8b06ce9fe4
commit
31a09376f8
@ -169,3 +169,9 @@ tv(Term,List,Tail) :- term_variables(Term,List,Tail).
|
||||
|
||||
prolog:term_variables(Term,List,Tail) :- tv(Term,List,Tail).
|
||||
|
||||
prolog:working_directory(OCWD,NCWD) :-
|
||||
getcwd(OCWD),
|
||||
(var(NCWD) -> true ; cd(NCWD)).
|
||||
|
||||
prolog:chdir(X) :- cd(X).
|
||||
|
||||
|
17
pl/boot.yap
17
pl/boot.yap
@ -64,9 +64,9 @@ true :- true.
|
||||
;
|
||||
'$current_module'(_,V), '$compile_mode'(_,0),
|
||||
('$access_yap_flags'(16,0) ->
|
||||
( exists('~/.yaprc') -> [-'~/.yaprc'] ; true ),
|
||||
( exists('~/.prologrc') -> [-'~/.prologrc'] ; true ),
|
||||
( exists('~/prolog.ini') -> [-'~/prolog.ini'] ; true )
|
||||
( exists('~/.yaprc') -> load_files('~/.yaprc', []) ; true ),
|
||||
( exists('~/.prologrc') -> load_files('~/.prologrc', []) ; true ),
|
||||
( exists('~/prolog.ini') -> load_files('~/prolog.ini', []) ; true )
|
||||
;
|
||||
true
|
||||
)
|
||||
@ -808,17 +808,6 @@ bootstrap(F) :-
|
||||
!.
|
||||
|
||||
|
||||
'$record_loaded'(Stream, M) :-
|
||||
Stream \= user,
|
||||
Stream \= user_input,
|
||||
'$file_name'(Stream,F),
|
||||
( recorded('$lf_loaded','$lf_loaded'(F,M,_),R), erase(R), fail ; true ),
|
||||
|
||||
'$file_age'(F,Age),
|
||||
recorda('$lf_loaded','$lf_loaded'(F,M,Age),_),
|
||||
fail.
|
||||
'$record_loaded'(_, _).
|
||||
|
||||
'$loop'(Stream,Status) :-
|
||||
'$change_alias_to_stream'('$loop_stream',Stream),
|
||||
repeat,
|
||||
|
@ -79,8 +79,8 @@ load_files(Files,Opts) :-
|
||||
'$process_lf_opt'(silent(false),_,_,_,_,_,_,_,_,_,_,_).
|
||||
'$process_lf_opt'(consult(reconsult),_,_,_,_,_,_,_,_,reconsult,_,_).
|
||||
'$process_lf_opt'(consult(consult),_,_,_,_,_,_,_,_,consult,_,_).
|
||||
'$process_lf_opt'(stream(Stream),_,_,_,_,_,_,_,Stream,_,_,_,Call) :-
|
||||
( '$stream'(Stream) -> true ; '$do_error'(domain_error(stream,Stream),Call) ),
|
||||
'$process_lf_opt'(stream(Stream),_,_,_,_,_,_,Stream,_,_,Files,_) :-
|
||||
/* ( '$stream'(Stream) -> true ; '$do_error'(domain_error(stream,Stream),Call) ), */
|
||||
( atom(Files) -> true ; '$do_error'(type_error(atom,Files),Call) ).
|
||||
|
||||
'$lf'(V,_,Call,_,_,_,_,_,_,_) :- var(V), !,
|
||||
@ -264,17 +264,18 @@ use_module(M,F,Is) :-
|
||||
|
||||
'$do_startup_reconsult'(X) :-
|
||||
( '$access_yap_flags'(15, 0) ->
|
||||
true
|
||||
Opts=[]
|
||||
;
|
||||
set_value('$lf_verbose',silent)
|
||||
Opts=[silent(true)]
|
||||
),
|
||||
( '$find_in_path'(X,Y,reconsult(X)),
|
||||
'$open'(Y,'$csult',Stream,0) ->
|
||||
( '$access_yap_flags'(15, 0) -> true ; '$skip_unix_comments'(Stream) ),
|
||||
'$current_module'(M), '$do_lf'(Y,M,Stream,silent,_,_), '$close'(Stream)
|
||||
load_files(Y,[stream(Stream)|Opts])
|
||||
;
|
||||
'$output_error_message'(permission_error(input,stream,X),reconsult(X))
|
||||
),
|
||||
|
||||
( '$access_yap_flags'(15, 0) -> true ; halt).
|
||||
|
||||
'$skip_unix_comments'(Stream) :-
|
||||
@ -426,5 +427,14 @@ remove_from_path(New) :- '$check_path'(New,Path),
|
||||
file_directory_name(F, Dir),
|
||||
cd(Dir).
|
||||
|
||||
|
||||
'$record_loaded'(Stream, M) :-
|
||||
Stream \= user,
|
||||
Stream \= user_input,
|
||||
'$file_name'(Stream,F),
|
||||
( recorded('$lf_loaded','$lf_loaded'(F,M,_),R), erase(R), fail ; true ),
|
||||
|
||||
'$file_age'(F,Age),
|
||||
recorda('$lf_loaded','$lf_loaded'(F,M,Age),_),
|
||||
fail.
|
||||
'$record_loaded'(_, _).
|
||||
|
||||
|
Reference in New Issue
Block a user