1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 23:50:19 +02:00

Refactor implementation of current-warning-port

* module/ice-9/boot-9.scm (current-warning-port):
* libguile/init.c (scm_init_standard_ports):
* libguile/ports.c (cur_warnport_fluid, scm_current_warning_port)
  (scm_set_current_warning_port, scm_init_ports): Define the warning
  port in the same way as the error/output/input ports, with a fluid
  that doesn't require calling out to Scheme.
This commit is contained in:
Andy Wingo 2016-07-14 16:18:47 +02:00
parent 1c98b78848
commit da757c6814
3 changed files with 22 additions and 34 deletions

View file

@ -217,9 +217,6 @@ If there is no handler at all, Guile prints an error and then exits."
(define pk peek)
;; Temporary definition; replaced later.
(define current-warning-port current-error-port)
(define (warn . stuff)
(with-output-to-port (current-warning-port)
(lambda ()
@ -3311,22 +3308,11 @@ CONV is not applied to the initial value."
(port-parameterize! current-output-port %current-output-port-fluid
output-port? "expected an output port")
(port-parameterize! current-error-port %current-error-port-fluid
output-port? "expected an output port")
(port-parameterize! current-warning-port %current-warning-port-fluid
output-port? "expected an output port"))
;;;
;;; Warnings.
;;;
(define current-warning-port
(make-parameter (current-error-port)
(lambda (x)
(if (output-port? x)
x
(error "expected an output port" x)))))
;;;
;;; Languages.