[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/07: Add force-output to sports
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/07: Add force-output to sports |
Date: |
Tue, 24 May 2016 20:44:59 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 690b856d59e392b0f493abf21ec08e90bb47d334
Author: Andy Wingo <address@hidden>
Date: Tue May 24 07:06:45 2016 +0200
Add force-output to sports
* module/ice-9/sports.scm (force-output): New implementation.
(port-bindings): Add force-output.
---
module/ice-9/sports.scm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/module/ice-9/sports.scm b/module/ice-9/sports.scm
index 807eada..b506703 100644
--- a/module/ice-9/sports.scm
+++ b/module/ice-9/sports.scm
@@ -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!)
- [Guile-commits] branch master updated (6bf7ec0 -> 47918f3), Andy Wingo, 2016/05/24
- [Guile-commits] 02/07: close-port implementation in sports, Andy Wingo, 2016/05/24
- [Guile-commits] 06/07: Speed golf on Scheme put-u8, put-bytevector, Andy Wingo, 2016/05/24
- [Guile-commits] 07/07: Speed up scm_c_write / scm_lfwrite, Andy Wingo, 2016/05/24
- [Guile-commits] 01/07: Add force-output to sports,
Andy Wingo <=
- [Guile-commits] 04/07: `put-bytevector' in Scheme, Andy Wingo, 2016/05/24
- [Guile-commits] 03/07: Wire up non-blocking support in sport writes, Andy Wingo, 2016/05/24
- [Guile-commits] 05/07: Add put-u8 implementation in Scheme, Andy Wingo, 2016/05/24