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#fAccessors 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-columnport)does not evaluate to zero.
These are ports based on procedures that produce and consume single characters at a time.
Char-source->input-portcreates 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-portcreates 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-portmakes an output port that collects its output in a string.String-output-port-outputreturns the string that string-port collected.Call-with-string-output-portcreates 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.