mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
Add force-output to sports
* module/ice-9/sports.scm (force-output): New implementation. (port-bindings): Add force-output.
This commit is contained in:
parent
6bf7ec0c9c
commit
690b856d59
1 changed files with 8 additions and 2 deletions
|
@ -53,7 +53,8 @@
|
|||
#:use-module (ice-9 ports internal)
|
||||
#:use-module (ice-9 match)
|
||||
#:replace (peek-char
|
||||
read-char)
|
||||
read-char
|
||||
force-output)
|
||||
#:export (lookahead-u8
|
||||
get-u8
|
||||
get-bytevector-n
|
||||
|
@ -86,6 +87,11 @@
|
|||
(set-port-buffer-end! buf 0)
|
||||
(write-bytes port (port-buffer-bytevector buf) cur (- end cur)))))
|
||||
|
||||
(define* (force-output #:optional (port (current-output-port)))
|
||||
(unless (and (output-port? port) (not (port-closed? port)))
|
||||
(error "not an open output port" port))
|
||||
(flush-output port))
|
||||
|
||||
(define (default-read-waiter port) (port-poll port "r"))
|
||||
(define (default-write-waiter port) (port-poll port "w"))
|
||||
|
||||
|
@ -573,7 +579,7 @@
|
|||
|
||||
(define saved-port-bindings #f)
|
||||
(define port-bindings
|
||||
'(((guile) read-char peek-char)
|
||||
'(((guile) read-char peek-char force-output)
|
||||
((ice-9 binary-ports) get-u8 lookahead-u8 get-bytevector-n)
|
||||
((ice-9 rdelim) %read-line read-line read-delimited)))
|
||||
(define (install-sports!)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue