diff options
Diffstat (limited to 'doc/ref')
-rw-r--r-- | doc/ref/api-io.texi | 25 | ||||
-rw-r--r-- | doc/ref/r6rs.texi | 7 |
2 files changed, 31 insertions, 1 deletions
diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi index 02c184986..4786d79a4 100644 --- a/doc/ref/api-io.texi +++ b/doc/ref/api-io.texi @@ -1229,6 +1229,31 @@ Call @var{proc}, passing it @var{port} and closing @var{port} upon exit of @var{proc}. Return the return values of @var{proc}. @end deffn +@deffn {Scheme Procedure} binary-port? port +Return @code{#t} if @var{port} is a @dfn{binary port}, suitable for +binary data input/output. + +Note that internally Guile does not differentiate between binary and +textual ports, unlike the R6RS. Thus, this procedure returns true when +@var{port} does not have an associated encoding---i.e., when +@code{(port-encoding @var{port})} is @code{#f} (@pxref{Ports, +port-encoding}). This is the case for ports returned by R6RS procedures +such as @code{open-bytevector-input-port} and +@code{make-custom-binary-output-port}. + +However, Guile currently does not prevent use of textual I/O procedures +such as @code{display} or @code{read-char} with binary ports. Doing so +``upgrades'' the port from binary to textual, under the ISO-8859-1 +encoding. Likewise, Guile does not prevent use of +@code{set-port-encoding!} on a binary port, which also turns it into a +``textual'' port. +@end deffn + +@deffn {Scheme Procedure} textual-port? port +Always return @var{#t}, as all ports can be used for textual I/O in +Guile. +@end deffn + @node R6RS Binary Input @subsubsection Binary Input diff --git a/doc/ref/r6rs.texi b/doc/ref/r6rs.texi index bc569ed69..2fe8d7b76 100644 --- a/doc/ref/r6rs.texi +++ b/doc/ref/r6rs.texi @@ -93,8 +93,13 @@ implement in a backward-compatible way. Suggestions and/or patches would be appreciated. @item -The @code{(rnrs io ports)} module is mostly unimplemented. Work is +The @code{(rnrs io ports)} module is incomplete. Work is ongoing to fix this. + +@item +Guile does not prevent use of textual I/O procedures on binary ports. +More generally, it does not make a sharp distinction between binary and +textual ports (@pxref{R6RS Port Manipulation, binary-port?}). @end itemize @node R6RS Standard Libraries |