mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Redirect diagnostice output messages (e.g., auto-compiling code) to a newly defined current-info-port, and add a command line argument -I' to set the current-info-port to a void-port. * libguile/ports.c: add cur_infoport_fluid, scm_current_info_port, scm_set_current_info_port; define default current-info-port to stderr * libguile/load.c(compiled_is_fresh,load_thunk_from_path, do_try_auto_compile,scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): direct output messages to current_info_port; was current_warning_port * libguile/init.c(scm_init_standard_ports): set default current_info_port * module/ice-9/ports.scm: define current-info-port and set-current-info-port * module/ice-9/command-line.scm(*usage*,compile-shell-switches): add argument
-I' to silence diagnostics (or current-info-port to void-port) * doc/ref/guile-invoke.texi: add description for `-I' command argument
This commit is contained in:
parent
3d2fd7a262
commit
78e9e51065
8 changed files with 88 additions and 27 deletions
|
@ -200,6 +200,7 @@ scm_init_standard_ports ()
|
|||
scm_set_current_error_port
|
||||
(scm_standard_stream_to_port (2, isatty (2) ? "w0" : "w"));
|
||||
scm_set_current_warning_port (scm_current_error_port ());
|
||||
scm_set_current_info_port (scm_current_error_port ());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -571,11 +571,11 @@ compiled_is_fresh (SCM full_filename, SCM compiled_filename,
|
|||
else
|
||||
{
|
||||
compiled_is_newer = 0;
|
||||
scm_puts (";;; note: source file ", scm_current_warning_port ());
|
||||
scm_display (full_filename, scm_current_warning_port ());
|
||||
scm_puts ("\n;;; newer than compiled ", scm_current_warning_port ());
|
||||
scm_display (compiled_filename, scm_current_warning_port ());
|
||||
scm_puts ("\n", scm_current_warning_port ());
|
||||
scm_puts (";;; note: source file ", scm_current_info_port ());
|
||||
scm_display (full_filename, scm_current_info_port ());
|
||||
scm_puts ("\n;;; newer than compiled ", scm_current_info_port ());
|
||||
scm_display (compiled_filename, scm_current_info_port ());
|
||||
scm_puts ("\n", scm_current_info_port ());
|
||||
}
|
||||
|
||||
return compiled_is_newer;
|
||||
|
@ -770,9 +770,9 @@ load_thunk_from_path (SCM filename, SCM source_file_name,
|
|||
if (found_stale_file && *found_stale_file)
|
||||
{
|
||||
scm_puts (";;; found fresh compiled file at ",
|
||||
scm_current_warning_port ());
|
||||
scm_display (found, scm_current_warning_port ());
|
||||
scm_newline (scm_current_warning_port ());
|
||||
scm_current_info_port ());
|
||||
scm_display (found, scm_current_info_port ());
|
||||
scm_newline (scm_current_info_port ());
|
||||
}
|
||||
|
||||
goto end;
|
||||
|
@ -1017,9 +1017,9 @@ do_try_auto_compile (void *data)
|
|||
SCM source = SCM_PACK_POINTER (data);
|
||||
SCM comp_mod, compile_file;
|
||||
|
||||
scm_puts (";;; compiling ", scm_current_warning_port ());
|
||||
scm_display (source, scm_current_warning_port ());
|
||||
scm_newline (scm_current_warning_port ());
|
||||
scm_puts (";;; compiling ", scm_current_info_port ());
|
||||
scm_display (source, scm_current_info_port ());
|
||||
scm_newline (scm_current_info_port ());
|
||||
|
||||
comp_mod = scm_c_resolve_module ("system base compile");
|
||||
compile_file = scm_module_variable (comp_mod, sym_compile_file);
|
||||
|
@ -1046,17 +1046,17 @@ do_try_auto_compile (void *data)
|
|||
/* Assume `*current-warning-prefix*' has an appropriate value. */
|
||||
res = scm_call_n (scm_variable_ref (compile_file), args, 5);
|
||||
|
||||
scm_puts (";;; compiled ", scm_current_warning_port ());
|
||||
scm_display (res, scm_current_warning_port ());
|
||||
scm_newline (scm_current_warning_port ());
|
||||
scm_puts (";;; compiled ", scm_current_info_port ());
|
||||
scm_display (res, scm_current_info_port ());
|
||||
scm_newline (scm_current_info_port ());
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
scm_puts (";;; it seems ", scm_current_warning_port ());
|
||||
scm_display (source, scm_current_warning_port ());
|
||||
scm_puts (";;; it seems ", scm_current_info_port ());
|
||||
scm_display (source, scm_current_info_port ());
|
||||
scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
|
||||
scm_current_warning_port ());
|
||||
scm_current_info_port ());
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
}
|
||||
|
@ -1099,7 +1099,7 @@ SCM_DEFINE (scm_sys_warn_auto_compilation_enabled, "%warn-auto-compilation-enabl
|
|||
{
|
||||
scm_puts (";;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0\n"
|
||||
";;; or pass the --no-auto-compile argument to disable.\n",
|
||||
scm_current_warning_port ());
|
||||
scm_current_info_port ());
|
||||
message_shown = 1;
|
||||
}
|
||||
|
||||
|
@ -1232,9 +1232,9 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
|
|||
if (found_stale_compiled_file)
|
||||
{
|
||||
scm_puts (";;; found fresh local cache at ",
|
||||
scm_current_warning_port ());
|
||||
scm_display (fallback, scm_current_warning_port ());
|
||||
scm_newline (scm_current_warning_port ());
|
||||
scm_current_info_port ());
|
||||
scm_display (fallback, scm_current_info_port ());
|
||||
scm_newline (scm_current_info_port ());
|
||||
}
|
||||
compiled_thunk = try_load_thunk_from_file (fallback);
|
||||
}
|
||||
|
|
|
@ -432,6 +432,7 @@ static SCM cur_inport_fluid = SCM_BOOL_F;
|
|||
static SCM cur_outport_fluid = SCM_BOOL_F;
|
||||
static SCM cur_errport_fluid = SCM_BOOL_F;
|
||||
static SCM cur_warnport_fluid = SCM_BOOL_F;
|
||||
static SCM cur_infoport_fluid = SCM_BOOL_F;
|
||||
static SCM cur_loadport_fluid = SCM_BOOL_F;
|
||||
|
||||
SCM_DEFINE (scm_current_input_port, "current-input-port", 0, 0, 0,
|
||||
|
@ -488,6 +489,18 @@ SCM_DEFINE (scm_current_warning_port, "current-warning-port", 0, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (scm_current_info_port, "current-info-port", 0, 0, 0,
|
||||
(void),
|
||||
"Return the port to which diagnostic information should be sent.")
|
||||
#define FUNC_NAME s_scm_current_info_port
|
||||
{
|
||||
if (scm_is_true (cur_infoport_fluid))
|
||||
return scm_fluid_ref (cur_infoport_fluid);
|
||||
else
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (scm_current_load_port, "current-load-port", 0, 0, 0,
|
||||
(),
|
||||
"Return the current-load-port.\n"
|
||||
|
@ -545,6 +558,18 @@ scm_set_current_warning_port (SCM port)
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM
|
||||
scm_set_current_info_port (SCM port)
|
||||
#define FUNC_NAME "set-current-info-port"
|
||||
{
|
||||
SCM oinfop = scm_fluid_ref (cur_infoport_fluid);
|
||||
port = SCM_COERCE_OUTPORT (port);
|
||||
SCM_VALIDATE_OPOUTPORT (1, port);
|
||||
scm_fluid_set_x (cur_infoport_fluid, port);
|
||||
return oinfop;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
void
|
||||
scm_dynwind_current_input_port (SCM port)
|
||||
#define FUNC_NAME NULL
|
||||
|
@ -4187,6 +4212,7 @@ scm_init_ice_9_ports (void)
|
|||
scm_c_define ("%current-output-port-fluid", cur_outport_fluid);
|
||||
scm_c_define ("%current-error-port-fluid", cur_errport_fluid);
|
||||
scm_c_define ("%current-warning-port-fluid", cur_warnport_fluid);
|
||||
scm_c_define ("%current-info-port-fluid", cur_infoport_fluid);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4221,6 +4247,7 @@ scm_init_ports (void)
|
|||
cur_outport_fluid = scm_make_fluid ();
|
||||
cur_errport_fluid = scm_make_fluid ();
|
||||
cur_warnport_fluid = scm_make_fluid ();
|
||||
cur_infoport_fluid = scm_make_fluid ();
|
||||
cur_loadport_fluid = scm_make_fluid ();
|
||||
|
||||
default_port_encoding_var =
|
||||
|
@ -4259,4 +4286,8 @@ scm_init_ports (void)
|
|||
(scm_t_subr) scm_current_error_port);
|
||||
scm_c_define_gsubr (s_scm_current_warning_port, 0, 0, 0,
|
||||
(scm_t_subr) scm_current_warning_port);
|
||||
|
||||
/* Used by welcome and compiler routines. */
|
||||
scm_c_define_gsubr (s_scm_current_info_port, 0, 0, 0,
|
||||
(scm_t_subr) scm_current_info_port);
|
||||
}
|
||||
|
|
|
@ -139,11 +139,13 @@ SCM_API SCM scm_current_input_port (void);
|
|||
SCM_API SCM scm_current_output_port (void);
|
||||
SCM_API SCM scm_current_error_port (void);
|
||||
SCM_API SCM scm_current_warning_port (void);
|
||||
SCM_API SCM scm_current_info_port (void);
|
||||
SCM_API SCM scm_current_load_port (void);
|
||||
SCM_API SCM scm_set_current_input_port (SCM port);
|
||||
SCM_API SCM scm_set_current_output_port (SCM port);
|
||||
SCM_API SCM scm_set_current_error_port (SCM port);
|
||||
SCM_API SCM scm_set_current_warning_port (SCM port);
|
||||
SCM_API SCM scm_set_current_info_port (SCM port);
|
||||
SCM_API void scm_dynwind_current_input_port (SCM port);
|
||||
SCM_API void scm_dynwind_current_output_port (SCM port);
|
||||
SCM_API void scm_dynwind_current_error_port (SCM port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue