30.5. Generic functions for character output

Generic functions for character output

(GRAY:STREAM-WRITE-CHAR stream char)

Writes char.

You must define a method for this function.

(GRAY:STREAM-LINE-COLUMN stream)

Returns the column number where the next character would be written (0 stands for the first column), or NIL if that is not meaningful for this stream.

You must define a method for this function.

(GRAY:STREAM-START-LINE-P stream)

Returns true if the next character would be written at the start of a new line.

The default method calls GRAY:STREAM-LINE-COLUMN and compares its result with 0; this is sufficient for streams whose GRAY:STREAM-LINE-COLUMN never returns NIL.

(GRAY:STREAM-WRITE-CHAR-SEQUENCE stream sequence &OPTIONAL [start [end]])

Outputs the subsequence of sequence specified by :START and :END to stream.

sequence is an ARRAY of CHARACTERs, i.e. a STRING. start is a nonnegative INTEGER and defaults to 0. end is a nonnegative integer or NIL and defaults to NIL, which stands for (LENGTH sequence).

The default method repeatedly calls GRAY:STREAM-WRITE-CHAR; this is always sufficient if speed does not matter.

This function is a CLISP extension (see EXT:WRITE-CHAR-SEQUENCE).

(GRAY:STREAM-WRITE-STRING stream string &OPTIONAL [start [end]])

Outputs the subsequence of string specified by :START and :END to stream. Returns string.

string is a string. start is a nonnegative integer and default to 0. end is a nonnegative integer or NIL and defaults to NIL, which stands for (LENGTH string).

The default method calls GRAY:STREAM-WRITE-CHAR-SEQUENCE; this is always sufficient.

(GRAY:STREAM-TERPRI stream)

Outputs a #\Newline character.

The default method calls GRAY:STREAM-WRITE-CHAR; this is always sufficient.

(GRAY:STREAM-FRESH-LINE stream)

Possibly outputs a #\Newline character, so as to ensure that the next character would be written at the start of a new line. Returns true if it did output a #\Newline character.

The default method calls GRAY:STREAM-START-LINE-P and then GRAY:STREAM-TERPRI if necessary; this is always sufficient.

(GRAY:STREAM-FINISH-OUTPUT stream)

Ensures that any buffered output has reached its destination, and then returns.

The default method does nothing.

(GRAY:STREAM-FORCE-OUTPUT stream)

Brings any buffered output on its way towards its destination, and returns without waiting until it has reached its destination.

The default method does nothing.

(GRAY:STREAM-CLEAR-OUTPUT stream)

Attempts to discard any buffered output which has not yet reached its destination.

The default method does nothing.

(GRAY:STREAM-ADVANCE-TO-COLUMN stream column)

Ensures that the next character will be written at least at column.

The default method outputs an appropriate amount of space characters; this is sufficient for non-proportional output.


These notes document CLISP version 2.49Last modified: 2010-07-07