diff options
author | Andy Wingo <wingo@pobox.com> | 2013-01-15 16:28:22 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2013-01-15 16:32:52 +0100 |
commit | e2551947dd94bdd8ecde441b19884c4730d0ee3b (patch) | |
tree | e6b4e2233e048bf808b5cacc2cd73cbb8a18461f /module/rnrs | |
parent | 93c4fa21745d31812b2f5a225f407e5f1b0e3665 (diff) | |
download | guile-e2551947dd94bdd8ecde441b19884c4730d0ee3b.tar.gz |
All r6rs ports are both textual and binary
* module/rnrs/io/ports.scm (binary-port?): All ports are binary _and_
textual. Bytevectors and strings may be written to or read from
either.
(port-transcoder): All textual ports (all ports) have transcoders of
some sort.
* test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports"):
Remove test that binary ports don't have transcoders, because binary
ports are also textual.
Diffstat (limited to 'module/rnrs')
-rw-r--r-- | module/rnrs/io/ports.scm | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/module/rnrs/io/ports.scm b/module/rnrs/io/ports.scm index 7c17b0ccc..8e04f5dea 100644 --- a/module/rnrs/io/ports.scm +++ b/module/rnrs/io/ports.scm @@ -220,24 +220,22 @@ (define (port-transcoder port) "Return the transcoder object associated with @var{port}, or @code{#f} if the port has no transcoder." - (cond ((port-encoding port) - => (lambda (encoding) - (make-transcoder - encoding - (native-eol-style) - (case (port-conversion-strategy port) - ((error) 'raise) - ((substitute) 'replace) - (else - (assertion-violation 'port-transcoder - "unsupported error handling mode")))))) - (else - #f))) + (and (textual-port? port) + ;; All textual ports have transcoders. + (make-transcoder + (port-encoding port) + (native-eol-style) + (case (port-conversion-strategy port) + ((error) 'raise) + ((substitute) 'replace) + (else + (assertion-violation 'port-transcoder + "unsupported error handling mode")))))) (define (binary-port? port) - "Returns @code{#t} if @var{port} does not have an associated encoding, -@code{#f} otherwise." - (not (port-encoding port))) + "Always returns @code{#t}, as all ports can be used for binary I/O in +Guile." + (equal? (port-encoding port) "ISO-8859-1")) (define (textual-port? port) "Always returns @code{#t}, as all ports can be used for textual I/O in |