Bordered Output Contents Index Incremental Redisplay




20 Text Formatting

20.1 Textual List Formatting

format-textual-listsequence printer &key stream separator conjunction[Function]
Outputs the sequence of items in sequence as a ``textual list''. For example, the list (1 2 3 4) might be printed as
1, 2, 3, and 4
printer is a function of two arguments: an element of the sequence and a stream; it has dynamic extent. It is called to output each element of the sequence.

stream specifies the output stream. The default is *standard-output* .

The separator and conjunction arguments provide control over the appearance of each element of the sequence and over the separators used between each pair of elements. separator is a string that is output after every element but the last one; the default for separator is ", " (that is, a comma followed by a space). conjunction is a string that is output before the last element. The default is nil , meaning that there is no conjunction. Typical values for conjunction are the strings "and" and "or" .

20.2 Indented Output

indenting-output(stream indentation &key (move-cursor t )) &body body[Macro]
Binds stream to a stream that inserts whitespace at the beginning of each line of output produced by body , and then writes the indented output to the stream that is the original value of stream .

The stream argument is not evaluated, and must be a symbol that is bound to an output recording stream. If stream is t , *standard-output* is used. body may have zero or more declarations as its first forms.

indentation specifies how much whitespace should be inserted at the beginning of each line. It is specified in the same way as the :x-spacing option to formatting-table .

If the boolean move-cursor is true (the default), CLIM moves the cursor to the end of the table.

Programmers using indenting-output should begin the body with a call to fresh-line (or some equivalent) to position the stream to the initial indentation.

Implementation note: Some CLIM implementations restrict the use of indenting-output and filling-output such that a call to indenting-output should appear outside of a call to filling-output . Implementations are encouraged to relax this restriction if the behavior is well-defined, but uses of indenting-output inside of filling-output may not be portable.

20.3 Filled Output

filling-output(stream &key fill-width break-characters after-line-break after-line-break-initially) &body body[Macro]
Binds stream to a stream that inserts line breaks into the textual output written to it (by such functions as write-char and write-string ) so that the output is usually no wider then fill-width . The filled output is then written on the original stream.

The stream argument is not evaluated, and must be a symbol that is bound to a stream. If stream is t , *standard-output* is used. body may have zero or more declarations as its first forms.

fill-width specifies the width of filled lines, and defaults to 80 characters. It is specified the same way as the :x-spacing option for formatting-table .

``Words'' are separated by the characters specified in the list break-characters . When a line is broken to prevent wrapping past the end of a line, the line break is made at one of these separators. That is, filling-output does not split ``words'' across lines, so it might produce output wider than fill-width .

after-line-break specifies a string to be sent to stream after line breaks; the string appears at the beginning of each new line. The string must not be wider than fill-width .

If the boolean after-line-break-initially is true , then the after-line-break text is to be written to stream before executing body , that is, at the beginning of the first line. The default is false .



Bordered Output Contents Index Incremental Redisplay