Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.
Next: R6RS Input Ports, Previous: R6RS End-of-File, Up: R6RS I/O Ports [Contents][Index]
The procedures listed below operate on any kind of R6RS I/O port.
Returns #t
if the argument is a port, and returns #f
otherwise.
Returns the transcoder associated with port if port is
textual and has an associated transcoder, and returns #f
if
port is binary or does not have an associated transcoder.
Return #t
if port is a 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
port does not have an associated encoding—i.e., when
(port-encoding port)
is #f
(see port-encoding). This is the case for ports returned by R6RS procedures
such as open-bytevector-input-port
and
make-custom-binary-output-port
.
However, Guile currently does not prevent use of textual I/O procedures
such as display
or 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
set-port-encoding!
on a binary port, which also turns it into a
“textual” port.
Always return #t
, as all ports can be used for textual I/O in
Guile.
The transcoded-port
procedure
returns a new textual port with the specified transcoder.
Otherwise the new textual port’s state is largely the same as
that of binary-port.
If binary-port is an input port, the new textual
port will be an input port and
will transcode the bytes that have not yet been read from
binary-port.
If binary-port is an output port, the new textual
port will be an output port and
will transcode output characters into bytes that are
written to the byte sink represented by binary-port.
As a side effect, however, transcoded-port
closes binary-port in
a special way that allows the new textual port to continue to
use the byte source or sink represented by binary-port,
even though binary-port itself is closed and cannot
be used by the input and output operations described in this
chapter.
If port supports it (see below), return the offset (an integer) indicating where the next octet will be read from/written to in port. If port does not support this operation, an error condition is raised.
This is similar to Guile’s seek
procedure with the
SEEK_CUR
argument (see Random Access).
Return #t
is port supports port-position
.
If port supports it (see below), set the position where the next octet will be read from/written to port to offset (an integer). If port does not support this operation, an error condition is raised.
This is similar to Guile’s seek
procedure with the
SEEK_SET
argument (see Random Access).
Return #t
is port supports set-port-position!
.
Call proc, passing it port and closing port upon exit of proc. Return the return values of proc.
Next: R6RS Input Ports, Previous: R6RS End-of-File, Up: R6RS I/O Ports [Contents][Index]