Next: TCP & UDP sockets, Previous: Library data structures, Up: Libraries
These facilities are all exported from the extended-ports
structure.
Tracking ports track the line & column number that they are on.
Tracking port constructors. These simply create wrapper ports around sub-port that track the line & column numbers.
#f
#f
Accessors for line (row) & column number information. If port is a not a tracking port, these simply return
#f
.
This writes a newline to port with
newline
, unless it can be determined that the previous character was a newline — that is, if(current-column
port)
does not evaluate to zero.
These are ports based on procedures that produce and consume single characters at a time.
Char-source->input-port
creates an input port that calls char-producer with zero arguments when a character is read from it. If readiness-tester is present, it is used for thechar-ready?
operation on the resulting port; likewise with closer andclose-input-port
.Char-sink->output-port
creates an output port that calls char-consumer for every character written to it.
Scheme48 also provides ports that collect and produce output to and from strings.
Constructs an input port whose contents are read from string.
Make-string-output-port
makes an output port that collects its output in a string.String-output-port-output
returns the string that string-port collected.Call-with-string-output-port
creates a string output port, applies receiver to it, and returns the string that the string output port collected.
Finally, there is a facility for writing only a limited quantity of output to a given port.