diff options
author | Andy Wingo <wingo@pobox.com> | 2011-06-28 23:24:43 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-12-05 18:07:06 +0100 |
commit | 3972de7675bf771b403eaef97f0741280649b5ed (patch) | |
tree | 906a7425fea47c87b6504cc09f1360f2ae1ca289 /libguile/ports.c | |
parent | 13dd74c8eae595889df6f570007b5f50b78073ce (diff) | |
download | guile-3972de7675bf771b403eaef97f0741280649b5ed.tar.gz |
add current-warning-port
* libguile/ports.h:
* libguile/ports.c (scm_current_warning_port)
(scm_set_current_warning_port): New functions, wrapping the Scheme
parameter.
* module/ice-9/boot-9.scm (current-warning-port): New parameter,
defining a port for warnings.
Diffstat (limited to 'libguile/ports.c')
-rw-r--r-- | libguile/ports.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libguile/ports.c b/libguile/ports.c index 6467228c0..677b2789a 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -412,6 +412,17 @@ SCM_DEFINE (scm_current_error_port, "current-error-port", 0, 0, 0, } #undef FUNC_NAME +SCM +scm_current_warning_port (void) +{ + static SCM cwp_var = SCM_BOOL_F; + + if (scm_is_false (cwp_var)) + cwp_var = scm_c_private_lookup ("guile", "current-warning-port"); + + return scm_call_0 (scm_variable_ref (cwp_var)); +} + SCM_DEFINE (scm_current_load_port, "current-load-port", 0, 0, 0, (), "Return the current-load-port.\n" @@ -466,6 +477,19 @@ SCM_DEFINE (scm_set_current_error_port, "set-current-error-port", 1, 0, 0, } #undef FUNC_NAME + +SCM +scm_set_current_warning_port (SCM port) +{ + static SCM cwp_var = SCM_BOOL_F; + + if (scm_is_false (cwp_var)) + cwp_var = scm_c_private_lookup ("guile", "current-warning-port"); + + return scm_call_1 (scm_variable_ref (cwp_var), port); +} + + void scm_dynwind_current_input_port (SCM port) #define FUNC_NAME NULL |