start cleaning up message code
This commit is contained in:
parent
efe827db6c
commit
e98c4c9f2a
16
pl/boot.yap
16
pl/boot.yap
@ -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: *
|
||||||
@ -253,6 +253,10 @@ private(_).
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'$early_print_message'(informational, _) :-
|
||||||
|
yap_flag( verbose, S),
|
||||||
|
S == silent,
|
||||||
|
!.
|
||||||
'$early_print_message'(_, absolute_file_path(X, Y)) :- !,
|
'$early_print_message'(_, absolute_file_path(X, Y)) :- !,
|
||||||
format(user_error, X, Y), nl(user_error).
|
format(user_error, X, Y), nl(user_error).
|
||||||
'$early_print_message'(_, loading( C, F)) :- !,
|
'$early_print_message'(_, loading( C, F)) :- !,
|
||||||
@ -417,10 +421,12 @@ true :- true.
|
|||||||
(
|
(
|
||||||
current_prolog_flag(saved_program, false)
|
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 ),
|
file_directory_name( RootPath, Dir ),
|
||||||
atom_concat( Dir, '/init.yap' , Init),
|
atom_concat( Dir, '/init.yap' , Init),
|
||||||
bootstrap(Init),
|
bootstrap(Init),
|
||||||
|
set_prolog_flag(verbose, OldV),
|
||||||
module( user ),
|
module( user ),
|
||||||
'$make_saved_state'
|
'$make_saved_state'
|
||||||
;
|
;
|
||||||
@ -1661,15 +1667,11 @@ log_event( String, Args ) :-
|
|||||||
|
|
||||||
'$early_print'( Lev, Msg ) :-
|
'$early_print'( Lev, Msg ) :-
|
||||||
( '$undefined'(print_message(_,_),prolog) ->
|
( '$undefined'(print_message(_,_),prolog) ->
|
||||||
'$show'(Lev, Msg)
|
'$early_print_message'(Lev, Msg)
|
||||||
;
|
;
|
||||||
print_message(Lev, Msg)
|
print_message(Lev, Msg)
|
||||||
).
|
).
|
||||||
|
|
||||||
'$show'(_,Msg) :-
|
|
||||||
format(user_error, '~w~n', [Msg]).
|
|
||||||
|
|
||||||
|
|
||||||
'$prompt' :-
|
'$prompt' :-
|
||||||
current_prolog_flag(break_level, BreakLevel),
|
current_prolog_flag(break_level, BreakLevel),
|
||||||
(
|
(
|
||||||
|
@ -281,12 +281,6 @@ load_files(Files,Opts) :-
|
|||||||
'$check_use_module'(Call,UseModule),
|
'$check_use_module'(Call,UseModule),
|
||||||
'$lf_opt'('$use_module', TOpts, UseModule),
|
'$lf_opt'('$use_module', TOpts, UseModule),
|
||||||
'$current_module'(M0),
|
'$current_module'(M0),
|
||||||
( '$lf_opt'(silent, TOpts, Verbosity),
|
|
||||||
var(Verbosity) ->
|
|
||||||
Verbosity = OldVerbosity
|
|
||||||
;
|
|
||||||
true
|
|
||||||
),
|
|
||||||
( '$lf_opt'(autoload, TOpts, Autoload),
|
( '$lf_opt'(autoload, TOpts, Autoload),
|
||||||
var(Autoload) ->
|
var(Autoload) ->
|
||||||
Autoload = OldAutoload
|
Autoload = OldAutoload
|
||||||
@ -361,9 +355,9 @@ load_files(Files,Opts) :-
|
|||||||
Val == large -> true ;
|
Val == large -> true ;
|
||||||
'$do_error'(domain_error(unknown_option,qcompile(Val)),Call) ).
|
'$do_error'(domain_error(unknown_option,qcompile(Val)),Call) ).
|
||||||
'$process_lf_opt'(silent, Val, Call) :-
|
'$process_lf_opt'(silent, Val, Call) :-
|
||||||
( Val == false -> true ;
|
( Val == false -> yap_flag(verbose_load, full) ;
|
||||||
Val == true -> true ;
|
Val == true -> yap_flag(verbose_load, silent) ;
|
||||||
'$do_error'(domain_error(unimplemented_option,silent(Val)),Call) ).
|
'$do_error'(domain_error(out_of_domain_option,silent(Val)),Call) ).
|
||||||
'$process_lf_opt'(skip_unix_header, Val, Call) :-
|
'$process_lf_opt'(skip_unix_header, Val, Call) :-
|
||||||
( Val == false -> true ;
|
( Val == false -> true ;
|
||||||
Val == true -> true ;
|
Val == true -> true ;
|
||||||
@ -492,7 +486,6 @@ load_files(Files,Opts) :-
|
|||||||
!,
|
!,
|
||||||
file_directory_name(F, Dir),
|
file_directory_name(F, Dir),
|
||||||
working_directory(OldD, Dir),
|
working_directory(OldD, Dir),
|
||||||
'$msg_level'( TOpts, Verbosity),
|
|
||||||
'$qload_file'(Stream, Mod, F, FilePl, File, ImportList, TOpts),
|
'$qload_file'(Stream, Mod, F, FilePl, File, ImportList, TOpts),
|
||||||
close( Stream ),
|
close( Stream ),
|
||||||
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
||||||
@ -500,7 +493,7 @@ load_files(Files,Opts) :-
|
|||||||
working_directory( _, OldD),
|
working_directory( _, OldD),
|
||||||
'$lf_opt'('$location', TOpts, ParentF:_Line),
|
'$lf_opt'('$location', TOpts, ParentF:_Line),
|
||||||
'$reexport'( TOpts, ParentF, Reexport, ImportList, File ),
|
'$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),
|
working_directory( _, OldD),
|
||||||
'$exec_initialization_goals',
|
'$exec_initialization_goals',
|
||||||
'$current_module'(_M, Mod).
|
'$current_module'(_M, Mod).
|
||||||
@ -667,7 +660,6 @@ db_files(Fs) :-
|
|||||||
set_stream( Stream, [alias(loop_stream), encoding(Encoding)] ),
|
set_stream( Stream, [alias(loop_stream), encoding(Encoding)] ),
|
||||||
'$lf_opt'('$context_module', TOpts, ContextModule),
|
'$lf_opt'('$context_module', TOpts, ContextModule),
|
||||||
'$lf_opt'(reexport, TOpts, Reexport),
|
'$lf_opt'(reexport, TOpts, Reexport),
|
||||||
'$msg_level'( TOpts, Verbosity),
|
|
||||||
'$lf_opt'(qcompile, TOpts, QCompiling),
|
'$lf_opt'(qcompile, TOpts, QCompiling),
|
||||||
'$nb_getval'('$qcompile', ContextQCompiling, ContextQCompiling = never),
|
'$nb_getval'('$qcompile', ContextQCompiling, ContextQCompiling = never),
|
||||||
nb_setval('$qcompile', QCompiling),
|
nb_setval('$qcompile', QCompiling),
|
||||||
@ -698,7 +690,7 @@ db_files(Fs) :-
|
|||||||
StartMsg = consulting,
|
StartMsg = consulting,
|
||||||
EndMsg = consulted
|
EndMsg = consulted
|
||||||
),
|
),
|
||||||
'$early_print'(Verbosity, loading(StartMsg, UserFile)),
|
'$early_print'(informational, loading(StartMsg, UserFile)),
|
||||||
'$lf_opt'(skip_unix_header , TOpts, SkipUnixHeader),
|
'$lf_opt'(skip_unix_header , TOpts, SkipUnixHeader),
|
||||||
( SkipUnixHeader == true
|
( SkipUnixHeader == true
|
||||||
->
|
->
|
||||||
@ -711,7 +703,7 @@ db_files(Fs) :-
|
|||||||
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
|
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
|
||||||
'$current_module'(Mod, SourceModule),
|
'$current_module'(Mod, SourceModule),
|
||||||
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
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',
|
'$end_consult',
|
||||||
'$q_do_save_file'(File, UserFile, TOpts ),
|
'$q_do_save_file'(File, UserFile, TOpts ),
|
||||||
(
|
(
|
||||||
@ -746,24 +738,6 @@ db_files(Fs) :-
|
|||||||
'$qsave_file_'( File, UserF, F ).
|
'$qsave_file_'( File, UserF, F ).
|
||||||
'$q_do_save_file'(_File, _, _TOpts ).
|
'$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) :-
|
'$reset_if'(OldIfLevel) :-
|
||||||
'$nb_getval'('$if_level', OldIfLevel, fail), !,
|
'$nb_getval'('$if_level', OldIfLevel, fail), !,
|
||||||
nb_setval('$if_level',0).
|
nb_setval('$if_level',0).
|
||||||
@ -849,7 +823,6 @@ nb_setval('$if_le1vel',0).
|
|||||||
'$include'(Fs, Status).
|
'$include'(Fs, Status).
|
||||||
'$include'(X, Status) :-
|
'$include'(X, Status) :-
|
||||||
b_getval('$lf_status', TOpts),
|
b_getval('$lf_status', TOpts),
|
||||||
'$msg_level'( TOpts, Verbosity),
|
|
||||||
'$full_filename'(X, Y , ( :- include(X)) ),
|
'$full_filename'(X, Y , ( :- include(X)) ),
|
||||||
'$including'(Old, Y),
|
'$including'(Old, Y),
|
||||||
'$lf_opt'(stream, TOpts, OldStream),
|
'$lf_opt'(stream, TOpts, OldStream),
|
||||||
@ -866,12 +839,12 @@ nb_setval('$if_le1vel',0).
|
|||||||
'$loaded'(Y, X, Mod, _OldY, _L, include, _, Dir, []),
|
'$loaded'(Y, X, Mod, _OldY, _L, include, _, Dir, []),
|
||||||
( '$nb_getval'('$included_file', OY, fail ) -> true ; OY = [] ),
|
( '$nb_getval'('$included_file', OY, fail ) -> true ; OY = [] ),
|
||||||
nb_setval('$included_file', Y),
|
nb_setval('$included_file', Y),
|
||||||
'$early_print'(Verbosity, loading(including, Y)),
|
'$early_print'(informational, loading(including, Y)),
|
||||||
'$loop'(Stream,Status),
|
'$loop'(Stream,Status),
|
||||||
set_stream(OldStream, alias(loop_stream) ),
|
set_stream(OldStream, alias(loop_stream) ),
|
||||||
close(Stream),
|
close(Stream),
|
||||||
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
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),
|
working_directory(_Dir, Dir0),
|
||||||
'$including'(Y, Old),
|
'$including'(Y, Old),
|
||||||
nb_setval('$included_file',OY).
|
nb_setval('$included_file',OY).
|
||||||
|
@ -888,8 +888,6 @@ prolog:print_message(_, _Msg) :-
|
|||||||
% first step at hook processi --ng
|
% first step at hook processi --ng
|
||||||
'$nb_getval'('$if_skip_mode',skip,fail),
|
'$nb_getval'('$if_skip_mode',skip,fail),
|
||||||
!.
|
!.
|
||||||
prolog:print_message(silent, _Msg) :-
|
|
||||||
!.
|
|
||||||
prolog:print_message(informational, _Msg) :-
|
prolog:print_message(informational, _Msg) :-
|
||||||
current_prolog_flag(verbose, silent),
|
current_prolog_flag(verbose, silent),
|
||||||
!.
|
!.
|
||||||
|
Reference in New Issue
Block a user