26 lines
10 KiB
Plaintext
26 lines
10 KiB
Plaintext
SEdit Internal Documentation
|
||
|
||
The formatting methods for lists
|
||
The assign-format, compute-format-values, and linearize methods of lists are now driven by tables encapsulated in list-format objects, allowing easy special formatting for particular lisp forms. This note primarily documents the format of list-format objects, and along the way mentions how they are used to implement those three methods. (note that dot-lists currently aren't handled by this mechanism)
|
||
Finding the right list-format
|
||
assign-format-list finds an appropriate list-format to control the list's formatting, using one of four options:
|
||
if the list is assigned a format which is a list-format object, use that;
|
||
else if the car of the list can be found in a list-formats table,
|
||
use the associated object from that table;
|
||
else if the car of the list has a known clispword property,
|
||
use the clisp list-format
|
||
else use the default list-format
|
||
since the same list-format object will be needed for computing width estimates and and linearization, assign-format caches it in the unassigned file. there are two types of list-formats; standard and non-standard. standard list-formats contain information to control the standard list formatting methods. nonstandard list-formats are an escape mechanism for situations where the required formatting is too hairy for the standard methods; they simply provide replacements for the assign-format, compute-format-value, and linearize methods. this is implemented by all list-formats having a non-standard? field, and list-formats whose non-standard? field is t having 3 additional fields: set-format-list, cfv-list, and linearize-list. there's not much else to say about non-standard list-formats, except that at present the only one is the format for clisp. for the rest of this document we'll talk about standard list-formats.
|
||
A general rule
|
||
several list-format fields contain lists of entries which correspond to the list node's subnodes. these lists all have roughly the same form:
|
||
(last first second ... nth)
|
||
where first is the information to be used for the formatting the first subnode, second the information for the second, ..., nth the information for the nth and all subsequent nodes, except that last is the information to be used for the last (some forms (e.g. il:selectq) have special formatting for the very last item). n depends on how many of the nodes need special formatting. lambda, for instance, uses lists of the form (a b c a) <20><> |