I/O extensions
==============

These facilities are all exported from the extended-ports structure.

Tracking ports track the line & column number that they are on.

 -- procedure: make-tracking-input-port sub-port returns input-port
 -- procedure: make-tracking-output-port sub-port returns output-port
     Tracking port constructors.  These simply create wrapper ports around SUB-PORT that track the line & column numbers.

 -- procedure: current-row port returns integer or #f
 -- procedure: current-column port returns integer or #f
     Accessors for line (row) & column number information.  If PORT is a not a tracking port, these simply return #f.

 -- procedure: fresh-line port returns unspecified
     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.

 -- procedure: char-source->input-port char-producer [readiness-tester closer] returns input-port
 -- procedure: char-sink->output-port char-consumer returns output-port
     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 the char-ready? operation on the resulting port; likewise with CLOSER and close-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.

 -- procedure: make-string-input-port string returns input-port
     Constructs an input port whose contents are read from STRING.

 -- procedure: make-string-output-port returns output-port
 -- procedure: string-output-port-output string-port returns string
 -- procedure: call-with-string-output-port receiver returns 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.

 -- procedure: limit-output port count receiver returns unspecified
     Limit-output applies RECEIVER to a port that will write at most COUNT characters to PORT.