D.4 Character Output

A character output stream can be created by defining a class that includes fundamental-character-output-stream and defining methods for the generic functions below. [annotate]

stream-write-char  stream character [Generic Function]
stream-line-column  stream [Generic Function]
          

This function returns the column number where the next character will be written on stream, or nil if that is not meaningful. The first column on a line is numbered 0. This function is used in the implementation of pprint and the format ~T directive. Every character output stream class must define a method for this, although it is permissible for it to always return nil. [annotate]

[annotate]

stream-start-line-p  stream [Generic Function]
          

Returns true if stream is positioned at the beginning of a line, otherwise returns false. It is permissible to always return false. This is used in the implementation of fresh-line. [annotate]

Note that while a value of 0 from stream-line-column also indicates the beginning of a line, there are cases where stream-start-line-p can be meaningfully implemented when stream-line-column cannot. For example, for a window using variable-width characters, the column number isn't very meaningful, but the beginning of the line does have a clear meaning. The default method for stream-start-line-p on class fundamental-character-output-stream uses stream-line-column, so if that is defined to return nil, then a method should be provided for either stream-start-line-p or stream-fresh-line. [annotate]

[annotate]

stream-write-string  stream string &optional (start 0) end [Generic Function]
          

Writes the string string to stream. If start and end are supplied, they specify what part of string to output. string is returned as the value. This is used by write-string. The default method provided by fundamental-character-output-stream uses repeated calls to stream-write-char. [annotate]

[annotate]

stream-terpri  stream [Generic Function]
          

Writes an end of line character on stream, and returns false. This is used by terpri. The default method does stream-write-char of #\Newline. [annotate]

[annotate]

stream-fresh-line  stream [Generic Function]
          

Writes an end of line character on stream only if the stream is not at the beginning of the line. This is used by fresh-line. The default method uses stream-start-line-p and stream-terpri. [annotate]

[annotate]

stream-finish-output  stream [Generic Function]
          

Ensures that all the output sent to stream has reached its destination, and only then return false. This is used by finish-output. The default method does nothing. [annotate]

[annotate]

stream-force-output  stream [Generic Function]
          

Like stream-finish-output, except that it may return false without waiting for the output to complete. This is used by force-output. The default method does nothing. [annotate]

[annotate]

stream-clear-output  stream [Generic Function]
          

Aborts any outstanding output operation in progress, and returns false. This is used by clear-output. The default method does nothing. [annotate]

[annotate]

stream-advance-to-column  stream column [Generic Function]
          

Writes enough blank space on stream so that the next character will be written at the position specified by column. Returns true if the operation is successful, or nil if it is not supported for this stream. This is intended for use by pprint and format ~T. The default method uses stream-line-column and repeated calls to stream-write-char with a #\Space character; it returns nil if stream-line-column returns nil. [annotate]

[annotate]