The material in this subsection is advanced; most CLIM programmers can skip to the next section. This section discusses Table, Item List, and Graph Formatting Protocols.
All of table, item list, and graph formatting is implemented on top of the basic output recording protocol, using with-new-output-record to specify the appropriate type of output record. The following examples show specifically how tables and graphs are implemented.
Example 1: Tables formatting-table first collects all the output that belongs in the table into a collection of row, column, and cell output records, all of which are children of a single table output record. During this phase, stream-drawing-p is bound to nil and stream-recording-p is bound to t . When all the output has been generated, the table layout constraint solver ( adjust-table-cells or adjust-item-list-cells ) is called to compute the table layout, taking into account such factors as the widest cell in a given column. If the table is to be split into multiple columns, adjust-multiple-columns is now called. Finally, the table output record is positioned on the stream at the current text cursor position and then displayed by calling replay on the table (or item list) output record.
Example 2: Graphs format-graph-from-roots first collects all the graph node output records that belong in the graph by calling generate-graph-nodes . All these output records are children of a single graph output record. During this phase, stream-drawing-p is bound to nil and stream-recording-p is bound to t . When all the output has been generated, the graph layout code ( layout-graph-nodes and layout-graph-edges ) is called to compute the graph layout. Finally, the graph output record is positioned on the stream at the current text cursor position and then displayed by calling replay on the graph output record.
Common Lisp Interface Manager 2.0 User's Guide - 3 Mar 2015