Next: lib-csv, Previous: lib-clpqr, Up: The Prolog Library [Contents][Index]
library(codesio)
This package defines I/O predicates that read from, or write to, a code list. There are also predicates to open a stream referring to a code list. The stream may be used with general Stream I/O predicates.
Exported predicates:
format_to_codes(+Format, :Arguments, -Codes)
format_to_codes(+Format, :Arguments, ?S0, ?S)
Prints Arguments into a code list using format/3
. Codes is unified with the list,
alternatively S0 and S are unified with the list and its end, respectively.
write_to_codes(+Term, -Codes)
write_to_codes(+Term, ?S0, ?S)
A specialized format_to_codes/[3,4]
. Writes Term into a
code list using write/2
. Codes is
unified with the list. Alternatively, S0 and S
are unified with the list and its end,
respectively.
write_term_to_codes(+Term, -Codes, +Options)
write_term_to_codes(+Term, ?S0, ?S, +Options)
A specialized format_to_codes/[3,4]
. Writes Term into a
code list using write_term/3
and Options. Codes is
unified with the list. Alternatively, S0 and S are
unified with the list and its end, respectively.
read_from_codes(+Codes, -Term)
Reads Term from Codes using read/2
. The Codes
must, as usual, be terminated by a full stop, i.e. a ‘.’,
possibly followed by layout-text.
read_term_from_codes(+Codes, -Term, +Options)
Reads Term from Codes using read_term/3
and
Options. The Codes must, as usual, be terminated by a
full stop, i.e. a ‘.’, possibly followed by
layout-text.
open_codes_stream(+Codes, -Stream)
Stream is opened as an input stream to an existing
code list. The stream may be read with the Stream I/O
predicates and must be closed using close/1
. The
list is copied to an internal buffer when the stream is
opened and must therefore be a ground code list at that
point.
with_output_to_codes(:Goal, -Codes)
with_output_to_codes(:Goal, ?S0, ?S)
with_output_to_codes(:Goal, -Stream, ?S0, ?S)
Goal is called with the current_output
stream set to
a new stream. This stream writes to an internal buffer,
which is, after the successful execution of Goal, converted to a
list of character codes. Codes is unified with the
list, alternatively S0 and S are unified with
the list and its end, respectively.
with_output_to_codes/4
also passes the stream in the
Stream argument. It can be used only by Goal for
writing.