diff --git a/pl/boot.yap b/pl/boot.yap index 801acecc2..dcc2f893f 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -7,7 +7,7 @@ * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 * * * ************************************************************************** -* Ptv * +* * * File: boot.yap * * Last rev: 8/2/88 * * mods: * @@ -253,6 +253,10 @@ private(_). +'$early_print_message'(informational, _) :- + yap_flag( verbose, S), + S == silent, + !. '$early_print_message'(_, absolute_file_path(X, Y)) :- !, format(user_error, X, Y), nl(user_error). '$early_print_message'(_, loading( C, F)) :- !, @@ -417,10 +421,12 @@ true :- true. ( current_prolog_flag(saved_program, false) -> - current_prolog_flag(resource_database, RootPath), + prolog_flag(verbose, OldV, silent), + prolog_flag(resource_database, RootPath), file_directory_name( RootPath, Dir ), atom_concat( Dir, '/init.yap' , Init), bootstrap(Init), + set_prolog_flag(verbose, OldV), module( user ), '$make_saved_state' ; @@ -1661,15 +1667,11 @@ log_event( String, Args ) :- '$early_print'( Lev, Msg ) :- ( '$undefined'(print_message(_,_),prolog) -> - '$show'(Lev, Msg) + '$early_print_message'(Lev, Msg) ; print_message(Lev, Msg) ). -'$show'(_,Msg) :- - format(user_error, '~w~n', [Msg]). - - '$prompt' :- current_prolog_flag(break_level, BreakLevel), ( diff --git a/pl/consult.yap b/pl/consult.yap index 872d1fc44..959cc47b7 100644 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -281,12 +281,6 @@ load_files(Files,Opts) :- '$check_use_module'(Call,UseModule), '$lf_opt'('$use_module', TOpts, UseModule), '$current_module'(M0), - ( '$lf_opt'(silent, TOpts, Verbosity), - var(Verbosity) -> - Verbosity = OldVerbosity - ; - true - ), ( '$lf_opt'(autoload, TOpts, Autoload), var(Autoload) -> Autoload = OldAutoload @@ -361,9 +355,9 @@ load_files(Files,Opts) :- Val == large -> true ; '$do_error'(domain_error(unknown_option,qcompile(Val)),Call) ). '$process_lf_opt'(silent, Val, Call) :- - ( Val == false -> true ; - Val == true -> true ; - '$do_error'(domain_error(unimplemented_option,silent(Val)),Call) ). + ( Val == false -> yap_flag(verbose_load, full) ; + Val == true -> yap_flag(verbose_load, silent) ; + '$do_error'(domain_error(out_of_domain_option,silent(Val)),Call) ). '$process_lf_opt'(skip_unix_header, Val, Call) :- ( Val == false -> true ; Val == true -> true ; @@ -492,7 +486,6 @@ load_files(Files,Opts) :- !, file_directory_name(F, Dir), working_directory(OldD, Dir), - '$msg_level'( TOpts, Verbosity), '$qload_file'(Stream, Mod, F, FilePl, File, ImportList, TOpts), close( Stream ), H is heapused-H0, '$cputime'(TF,_), T is TF-T0, @@ -500,7 +493,7 @@ load_files(Files,Opts) :- working_directory( _, OldD), '$lf_opt'('$location', TOpts, ParentF:_Line), '$reexport'( TOpts, ParentF, Reexport, ImportList, File ), - '$early_print'(Verbosity, loaded( loaded, F, M, T, H)), + '$early_print'(informational, loaded( loaded, F, M, T, H)), working_directory( _, OldD), '$exec_initialization_goals', '$current_module'(_M, Mod). @@ -667,7 +660,6 @@ db_files(Fs) :- set_stream( Stream, [alias(loop_stream), encoding(Encoding)] ), '$lf_opt'('$context_module', TOpts, ContextModule), '$lf_opt'(reexport, TOpts, Reexport), - '$msg_level'( TOpts, Verbosity), '$lf_opt'(qcompile, TOpts, QCompiling), '$nb_getval'('$qcompile', ContextQCompiling, ContextQCompiling = never), nb_setval('$qcompile', QCompiling), @@ -698,7 +690,7 @@ db_files(Fs) :- StartMsg = consulting, EndMsg = consulted ), - '$early_print'(Verbosity, loading(StartMsg, UserFile)), + '$early_print'(informational, loading(StartMsg, UserFile)), '$lf_opt'(skip_unix_header , TOpts, SkipUnixHeader), ( SkipUnixHeader == true -> @@ -711,7 +703,7 @@ db_files(Fs) :- '$import_to_current_module'(File, ContextModule, Imports, _, TOpts), '$current_module'(Mod, SourceModule), H is heapused-H0, '$cputime'(TF,_), T is TF-T0, - '$early_print'(Verbosity, loaded(EndMsg, File, Mod, T, H)), + '$early_print'(informational, loaded(EndMsg, File, Mod, T, H)), '$end_consult', '$q_do_save_file'(File, UserFile, TOpts ), ( @@ -746,24 +738,6 @@ db_files(Fs) :- '$qsave_file_'( File, UserF, F ). '$q_do_save_file'(_File, _, _TOpts ). -% are we in autoload and autoload_flag is false? -'$msg_level'( TOpts, Verbosity) :- - '$lf_opt'(autoload, TOpts, AutoLoad), - AutoLoad == true, - current_prolog_flag(verbose_autoload, false), !, - Verbosity = silent. -'$msg_level'( _TOpts, Verbosity) :- - current_prolog_flag(verbose_load, false), !, - Verbosity = silent. -'$msg_level'( _TOpts, Verbosity) :- - current_prolog_flag(verbose, silent), !, - Verbosity = silent. -'$msg_level'( TOpts, Verbosity) :- - '$lf_opt'(silent, TOpts, Silent), - Silent == true, !, - Verbosity = silent. -'$msg_level'( _TOpts, informational). - '$reset_if'(OldIfLevel) :- '$nb_getval'('$if_level', OldIfLevel, fail), !, nb_setval('$if_level',0). @@ -849,7 +823,6 @@ nb_setval('$if_le1vel',0). '$include'(Fs, Status). '$include'(X, Status) :- b_getval('$lf_status', TOpts), - '$msg_level'( TOpts, Verbosity), '$full_filename'(X, Y , ( :- include(X)) ), '$including'(Old, Y), '$lf_opt'(stream, TOpts, OldStream), @@ -866,12 +839,12 @@ nb_setval('$if_le1vel',0). '$loaded'(Y, X, Mod, _OldY, _L, include, _, Dir, []), ( '$nb_getval'('$included_file', OY, fail ) -> true ; OY = [] ), nb_setval('$included_file', Y), - '$early_print'(Verbosity, loading(including, Y)), + '$early_print'(informational, loading(including, Y)), '$loop'(Stream,Status), set_stream(OldStream, alias(loop_stream) ), close(Stream), H is heapused-H0, '$cputime'(TF,_), T is TF-T0, - '$early_print'(Verbosity, loaded(included, Y, Mod, T, H)), + '$early_print'(informational, loaded(included, Y, Mod, T, H)), working_directory(_Dir, Dir0), '$including'(Y, Old), nb_setval('$included_file',OY). diff --git a/pl/messages.yap b/pl/messages.yap index a4f87957e..787462779 100644 --- a/pl/messages.yap +++ b/pl/messages.yap @@ -888,8 +888,6 @@ prolog:print_message(_, _Msg) :- % first step at hook processi --ng '$nb_getval'('$if_skip_mode',skip,fail), !. -prolog:print_message(silent, _Msg) :- - !. prolog:print_message(informational, _Msg) :- current_prolog_flag(verbose, silent), !.