chiark / gitweb /
frontend.lisp: Add hooks for extensions to add new command-line options.
[sod] / doc / misc.tex
1 %%% -*-latex-*-
2 %%%
3 %%% Miscellaneous functionality
4 %%%
5 %%% (c) 2015 Straylight/Edgeware
6 %%%
7
8 %%%----- Licensing notice ---------------------------------------------------
9 %%%
10 %%% This file is part of the Sensible Object Design, an object system for C.
11 %%%
12 %%% SOD is free software; you can redistribute it and/or modify
13 %%% it under the terms of the GNU General Public License as published by
14 %%% the Free Software Foundation; either version 2 of the License, or
15 %%% (at your option) any later version.
16 %%%
17 %%% SOD is distributed in the hope that it will be useful,
18 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
19 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 %%% GNU General Public License for more details.
21 %%%
22 %%% You should have received a copy of the GNU General Public License
23 %%% along with SOD; if not, write to the Free Software Foundation,
24 %%% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26 \chapter{Miscellaneous functionality} \label{ch:misc}
27
28 %%%--------------------------------------------------------------------------
29 \section{Utilities} \label{sec:misc.utilities}
30
31 These symbols are defined in the @|sod-utilities| package.
32
33
34 \subsection{Macro utilities}
35
36 We begin with some simple utilities which help with writing macros.  Several
37 of these are standard.
38
39 \begin{describe}{mac}
40     {with-gensyms (@{ @<var> @! (@<var> @[@<name>@]) @}^*)      \\ \ind
41       @<declaration>^*                                          \\
42       @<form>^*}
43   Bind each @<var> (a symbol, not evaluated) to a freshly made gensym whose
44   name is based on the corresponding @<name> (a string, evaluated), and
45   evaluate the @<form>s as an implicit @|progn| in the resulting environment.
46   If @<name> is omitted, then the name of the @<var> is used as a default; a
47   bare symbol may be written in place of a singleton list.
48 \end{describe}
49
50 \begin{describe}{mac}
51     {once-only (@[[ :environment @<env> @]]
52                 @{ @<var> @! (@<var> @[@<value-form>@]) @}^*)   \\ \ind
53       @<declaration>^*                                          \\
54       @<form>^*
55       \nlret @<result-form>}
56   This is a helper to ensure that macro expansions evaluate their arguments
57   exactly once each, in the correct order.
58
59   Each @<var> is bound to an appropriate value (often a gensym) and then the
60   @<form>s are evaluated as an implicit @|progn| in the resulting environment
61   to produce an output form.  This output form is then enclosed in one or
62   more binding forms to produce a @<result-form>.  When the @<result-form> is
63   evaluated, the behaviour will be as if each @<value-form> is evaluated
64   exactly once each, in order, and each value is captured in the
65   corresponding @<var>.
66
67   A simple @|once-only| expansion might look something like
68   \begin{prog}
69     (let (\=(@<var>_1 (gensym))                                 \\
70           \>\qquad\vdots                                        \\
71           \>(@<var>_n (gensym)))                                \\ \ind
72       `(let (\=(,@<var>_1 ,@<value-form>_1)                     \\
73              \>\qquad\vdots                                     \\
74              \>(,@<var>_n ,@<value-form>_n))                    \\ \ind
75          @<declaration>_1 \dots\ @<declaration>_m               \\
76          @<form>_1 \dots\ @<form>_\ell))
77   \end{prog}
78   However, if @|once-only| can determine that some @<value-form> is a
79   constant (e.g., it is @|quote|d, self-evaluating, or reported as
80   @|constantp| in the given environment @<env>), then it need not allocate a
81   gensym: it can instead bind the @<var> directly to the constant value.
82
83   If a @<value-form> is omitted, then the value of the corresponding @<var>
84   is used.  It is conventional usage for a macro to wrap @|once-only| around
85   its body so as to convert the arguments which it should evaluate into safe
86   gensyms capturing their runtime values.  (Not that the simple expansion
87   given above can't do this correctly.)  A bare symbol may be written in
88   place of a singleton list.
89 \end{describe}
90
91 \begin{describe}{fun}
92     {parse-body @<body> \&key :docp :declp
93       @> @<doc-string> @<declarations> @<body-forms>}
94   Parse the @<body> into a @<doc-string>, some @<declaration>s, and a list of
95   @<body-forms>.
96
97   The @<body> is assumed to have the general syntax
98   \begin{prog}
99     @[[ @<doc-string> @! @<declaration>^* @]]                   \\
100     @<form>^*
101   \end{prog}
102   A @<doc-string> is permitted if and only if @<docp> is non-nil, and
103   declarations are permitted if and only if @<declp> is non-nil; both are
104   true by default.
105
106   Each return value is a list, which is empty if the corresponding part of
107   the input @<body> is missing.  Specifically:
108   \begin{itemize}
109   \item @<doc-string> is either nil, or a singleton list containing a string;
110   \item @<declarations> is either nil, or a singleton list containing a
111     @|(declare \dots)| form gathering up all of the individual
112     @<declaration>s within the @<body>; and
113   \item @<body-forms> is a list of the remaining forms in the @<body>.
114   \end{itemize}
115   Thus, the parsed body-parts can conveniently be spliced into a macro
116   expansion using @|,@@|.
117 \end{describe}
118
119 \begin{describe}{fun}{symbolicate \&rest @<symbols> @> @<symbol>}
120   Return the symbol, interned in the current @|*package*|, whose name is the
121   concatenation of the names of the given @<symbols>.
122 \end{describe}
123
124
125 \subsection{Locatives}
126
127 A \emph{locative} is a value which remembers where another value is stored,
128 -- whether it's in a variable, an array element, a structure slot, a hash
129 table, etc.\ -- and can modify and retrieve it.
130
131 Some Lisp systems have highly efficient locatives which actually keep track
132 of the machine addresses of the places to which they refer.  Common Lisp does
133 not implement true locatives of this kind, but something sufficiently useful
134 can be synthesized.
135
136 These locatives can't usefully be compared.  It should be possible to compare
137 true locatives, such that two locatives compare equal if and only if they
138 refer to the same place; but that doesn't work for these locatives.
139
140 \begin{describe}{cls}{loc}
141   The type of locative objects.
142 \end{describe}
143
144 \begin{describe}{fun}{locp @<object> @> @<generalized-boolean>}
145   Return non-nil if and only if @<object> is a locative.
146 \end{describe}
147
148 \begin{describe}{mac}{locf @<place> @> @<locative>}
149   Return a fresh locative capturing the @<place>, which may be any expression
150   usable as the first operand to @|setf|.
151 \end{describe}
152
153 \begin{describe*}
154     {\dhead{fun}{ref @<locative> @> @<value>}
155      \dhead{fun}{setf (ref @<locative>) @<value>}}
156   Retrieve and return the current value stored in the place captured by the
157   @<locative>.  With @|setf|, store the new @<value> in the place captured by
158   the @<locative>.
159 \end{describe*}
160
161 \begin{describe}{mac}
162     {with-locatives
163         @{ @<var> @! (@{ @<var> @!
164                          (@<var> @[@<locative>@]) @}^*) @}      \\ \ind
165       @<declaration>^*                                          \\
166       @<form>^*}
167   This is a macro which hides the use of locatives from its caller using
168   symbol-macros.
169
170   Each @<locative> should be an expression which evaluates to a locative
171   value (not a general place).  These are evaluated once each, left to
172   right.  The @<form>s are then evaluated as an implicit @|progn|, with each
173   @<var> defined as a symbol macro which will retrieve -- or, with @|setf|,
174   modify -- the value referred to by the corresponding locative.
175
176   If a @<locative> is omitted, it defaults to the value of @<var>; a
177   bare symbol may be used in place of a singleton list.
178 \end{describe}
179
180
181 \subsection{Anaphorics}
182
183 An anaphoric macro implicitly binds a well-known name to a value of interest,
184 in the course of doing something else.  The concept was popularized by Paul
185 Graham \cite{FIXME:OnLisp}.
186
187 The macros described here all bind the variable @|it|.
188
189 \begin{describe}{sym}{it}
190   The symbol @|it| is exported by the @|sod-utilities| package.
191 \end{describe}
192
193 \begin{describe}{mac}{aif @<condition> @<consequent> @[@<alt>@]}
194   Evaluate the @<condition>.  If @<condition> is non-nil, then bind @|it| to
195   the resulting value and evaluate the @<consequent>, returning all of its
196   values.  Otherwise, evaluate @<alt>, returning all of its values.
197 \end{describe}
198
199 \begin{describe}{mac}{aand @<form>^*}
200   Evaluate each @<form> in turn.  If any @<form> evaluates to nil, then stop
201   and return nil.  Each form except the first is evaluated with @|it| bound
202   to the (necessarily non-nil) value of the previous form.  If all but the
203   last form evaluate non-nil, then return all the values of the final form.
204 \end{describe}
205
206 (No @|aor| is provided, since @|it| would necessarily be bound to nil.)
207
208 \begin{describe}{mac}{awhen @<condition> @<form>^*}
209   If @<condition> evaluates to a non-nil value, bind @|it| to that value, and
210   evaluate the @<form>s as an implicit @|progn|.  Otherwise, return nil.
211 \end{describe}
212
213 \begin{describe}{mac}{acond @{ (@<condition> @<form>^*) @}^*}
214   Evaluate each @<condition> in turn, until one of them produces a non-nil
215   value.  If the @<condition> is followed by one or more @<form>s, then bind
216   @|it| to the non-nil value of the @<condition> and evaluate the @<form>s as
217   an implicit @|progn|; otherwise, simply return the value of the
218   @<condition>.  If no @<condition> produces a non-nil value then return nil.
219 \end{describe}
220
221 \begin{describe*}
222     {\dhead{mac}
223       {acase @<scrutinee> @{ (@{ @<case> @! (@<case>^*) @} @<form>^*) @}^*}
224      \dhead{mac}
225       {aecase @<scrutinee> @{ (@{ @<case> @! (@<case>^*) @} @<form>^*) @}^*}
226      \dhead{mac}{atypecase @<scrutinee> @{ (@<type> @<form>^*) @}^*}
227      \dhead{mac}{aetypecase @<scrutinee> @{ (@<type> @<form>^*) @}^*}}
228   These are like the Common Lisp macros @|case|, @|ecase|, @|typecase|, and
229   @|etypecase|, except that @|it| is bound to the value of the @<scrutinee>
230   while evaluating the matching @<form>s.
231 \end{describe*}
232
233 \begin{describe}{mac}{asetf @{ @<place> @<value> @}^*}
234   For each @<place> and @<value> in turn: bind @|it| to the current value of
235   the @<place>, evaluate the @<value> expression, and store the resulting
236   value back in the @<place>.
237
238   For example, @|(asetf @<place> (1+ it))| is almost equivalent to @|(incf
239   @<place>)|, even if evaluating @<place> has side-effects.
240 \end{describe}
241
242
243 \subsection{Metaobject protocol utilities}
244
245 The following utilities make use of the introspection features of the CLOS
246 metaobject protocol.
247
248 \begin{describe}{gf}{instance-initargs @<instance>}
249   Return a fresh list of plausible initargs for the given @<instance>.
250
251   This is done by digging through the instance's class's slot definitions and
252   enquiring about their initargs.  Initargs which are handled by methods on
253   @|shared-initialize| or similar generic functions won't be discovered.
254 \end{describe}
255
256 \begin{describe*}
257     {\dhead{fun}{copy-instance @<instance> \&rest @<initargs>
258                   @> @<new-instance>}
259      \dhead{gf}{copy-instance-using-class @<class> @<instance>
260                                           \&rest @<initargs>
261                   @> @<new-instance>}}
262   The @|copy-instance| function creates and returns a fresh copy of a given
263   @<instance>, possibly modifying it according to the given @<initargs>.
264
265   It immediately calls @|copy-instance-using-class|, calling it with the
266   instance's class and the instance itself, and simply returns the result of
267   that generic function.
268
269   The default method on @|copy-instance-using-class| should work for most
270   classes, but may be overridden to cope with special effects.  It works as
271   follows.
272   \begin{enumerate}
273   \item Allocate a fresh instance of @<class>, using @|allocate-instance|.
274   \item For each slot defined by @<class>, if that slot is bound in the
275     original instance, then set the corresponding slot in the new instance to
276     the same value.
277   \item Call @|shared-initialize| on the new instance, providing it the given
278     list of @<initargs>, but inhibiting the usual initialization of slots
279     from their initforms.
280   \item Return the new instance.
281   \end{enumerate}
282 \end{describe*}
283
284 \begin{describe*}
285     {\dhead{gf}{generic-function-methods @<generic-function> @> @<list>}
286      \dhead{gf}{method-specializers @<method> @> @<list>}
287      \dhead{cls}{eql-specializer}
288      \dhead{gf}{eql-specializer-object @<specializer> @> @<value>}}
289   These are precisely the MOP functions and class: the symbols are
290   re-exported for portability, because different Lisp systems define these
291   symbols in different packages.
292 \end{describe*}
293
294
295 \subsection{Other CLOS utilities}
296
297 Some other minor CLOS utilities.
298
299 \begin{describe}{mac}
300     {default-slot (@<instance> @<slot> @[@<slot-names>@])       \\ \ind
301       @<form>^*}
302   This macro is useful in methods (usually @|:after| methods) on
303   @|shared-initialize|, to set slots to some sensible default values in the
304   case where no suitable initarg was given, and default initialization is too
305   complicated to be done using an initform.
306
307   Set a slot to a default value, obeying the @|shared-initialize| protocol.
308   If (a) the named @<slot> of @<instance> is unbound, and (b) either
309   @<slot-names> is @|t|, or @<slot> is a member of the list @<slot-names>,
310   then evaluate the @<form>s as an implicit @|progn| and store their
311   value in the @<slot>.  Otherwise do nothing.
312
313   The @<instance>, @<slot>, and @<slot-names> (if any) are evaluated once
314   each, left-to-right.
315 \end{describe}
316
317 \begin{describe}{mac}
318     {define-on-demand-slot @<class> @<slot> (@<instance>)       \\ \ind
319       @[[ @<declaration>^* @! @<doc-string> @]]                 \\
320       @<form>^*}
321   This macro makes slots with delayed initialization: rather than being
322   set when the object is constructed, the slot's initial value is only
323   calculated when it's first requested.  This is useful if calculating the
324   slot value is expensive and often not required, or if it's not possible to
325   initialize the slot along with the rest of the object because of dependency
326   cycles.
327
328   The macro arranges things as follows.  Whenever @|slot-value| is called
329   (possibly indirectly, via a reader function) to read the named @<slot> (a
330   symbol, not evaluated) on an (indirect) instance of @<class>, but the slot
331   is unbound, then @<instance> is bound to the instance in question and the
332   @<form>s are evaluated as an implicit @|progn| within the lexical
333   environment of the @|define-on-demand-slot| call, and the resulting value
334   is used as the initial value of the slot.  (Furthermore, a block named
335   @<slot> is wrapped around the @<form>s, allowing an early return if that
336   should be useful.)
337
338   This macro currently works by defining a method on @|slot-unbound|.
339 \end{describe}
340
341
342 \subsection{Building lists}
343
344 Many Lisp functions end up constructing lists.  In simple cases, a function
345 like @|mapcar| will just do the job directly.  In more complex cases, a
346 common idiom is to build the list using @|push| for each element in turn; but
347 a list built this way ends up in the wrong order, so an additional pass,
348 usually using @|nreverse|, is necessary to fix it.
349
350 A `list builder' is an object which can be used to construct a list in the
351 right order.  (Currently, a list-builder is simply a cons cell, whose cdr
352 points to the first cons-cell of the list, and whose car points to its last
353 cons; an empty list-builder is a cons whose cdr is nil and whose car is the
354 cons itself, i.e., @|\#1=(\#1\# . nil)|.)
355
356 \begin{describe}{fun}{make-list-builder \&optional @<initial> @> @<builder>}
357   Return a fresh new list-builder, initially containing no items.
358 \end{describe}
359
360 \begin{describe}{fun}{lbuild-add @<builder> @<item> @> @<builder>}
361   Add @<item> to the end of the list being constructed in @<builder>.
362 \end{describe}
363
364 \begin{describe}{fun}{lbuild-add-list @<builder> @<list> @> @<builder>}
365   Append @<list> to the list being constructed in @<builder>.  The list is
366   \emph{not} copied: adding further items to the list will clobber cdr of its
367   final cons-cell.
368 \end{describe}
369
370 \begin{describe}{fun}{lbuild-list @<builder> @> @<list>}
371   Return the list being constructed in the @<builder>.
372
373   It is permitted to continue adding items to the list: this will mutate the
374   list in-place.  Often, this is what you want.  For example, one might write
375   an analogue to @|pushnew| like this:
376   \begin{prog}
377     (defun lbuild-add-new
378         (builder item \&key key test test-not \&rest keywords)  \\ \ind
379       (declare (ignore key test test-not))                      \\
380       (when (apply \#'member item (lbuild-list builder)
381                    keywords)                                    \\ \ind
382         (lbuild-add builder item)))
383   \end{prog}
384 \end{describe}
385
386
387 \subsection{Merging lists}
388
389 The following machinery merges lists representing a partial order.  The
390 primary use for this is in computing class precedence lists during class
391 finalization.  By building the input lists and choosing the tie-breaking
392 @<pick> function appropriately, many different linearization algorithms can
393 be implemented fairly easily using @|merge-lists| below.
394
395 \begin{describe*}
396     {\dhead{cls}
397        {inconsistent-merge-error (error) \&key :candidates :present}
398      \dhead{gf}{merge-error-candidates @<error> @> @<list>}
399      \dhead{gf}{merge-error-present-function @<error> @> @<function>}}
400   The @|inconsistent-merge-error| condition class used to represent a failure
401   of the \descref{fun}{merge-lists}[function].
402
403   The @<candidates> are a list of offending items from the input lists, in
404   some order: the error is reporting that the function has failed because it
405   is not possible to order the items listed in @<candidates> in any way
406   without being inconsistent with at least one of the input lists.  There is
407   no default.
408
409   The @<present> function is used to convert the input items into
410   human-readable descriptions (printed using @|princ|); the default is
411   @|identity|, which will simply print the items in a `friendly' format.
412   (Using @|prin1-to-string| would print their machine-readable escaped forms
413   instead.)
414
415   The functions @|merge-error-candidates| and @|merge-error-present-function|
416   respectively retrieve the candidates list and presentation function
417   assigned to a condition when it was created.
418 \end{describe*}
419
420 \begin{describe}{fun}
421     {merge-lists @<lists> \&key :pick :test :present @> @<list>}
422   Return a merge of the @<lists>, considered as partial orderings.
423
424   In more detail: @<lists> should be a list of lists.  Each distinct item, as
425   determined by the @<test> function (by default, @|eql|) appears in the
426   result list exactly once.  Furthermore, if, in some input list, an item $x$
427   appears earlier than a different item $y$, then $x$ will also precede $y$
428   in the output list.
429
430   If the input lists contradict each other (e.g., list $A$ has $x$ before
431   $y$, but list $B$ has $y$ before $x$), then an error of type
432   @|inconsistent-merge-error| is signalled, with the offending items attached
433   as candidates, and the function @<present> (by default, @|identity|) as the
434   presentation function.
435
436   Frequently, a collection of input lists has multiple valid merges.
437   Whenever @|merge-lists| must decide between two or more equally good
438   candidates, it calls the @<pick> function to choose one of them.
439   Specifically, it invokes @|(funcall @<pick> @<candidates>
440   @<merge-so-far>)|, where @<candidates> are the items it needs to choose
441   between, and @<merge-so-far> is the currently determined prefix of the
442   final merge.  The order of items in the @<candidates> list reflects their
443   order in the input lists: item $x$ precedes item $y$ in @<candidates> if
444   any only if an occurrence of $x$ appears in an earlier input list than
445   $y$.  (This completely determines the order of candidates: if two items
446   appear in the same list, then that list would have ordered them and we
447   wouldn't have to call @<pick> to break the tie.)  The default @<pick>
448   function simply chooses the item appearing in the earliest list, i.e.,
449   effectively
450   \begin{prog}
451     (lambda (candidates merge-so-far)                           \\ \ind
452       (declare (ignore merge-so-far))                           \\
453       (car candidates))
454   \end{prog}
455 \end{describe}
456
457
458 \subsection{Other list utilities}
459
460 \begin{describe}{fun}
461     {mappend @<function> @<list> \&rest @<more-lists> @> @<result-list>}
462   Return the result of appending @<list> and @<more-lists>, in order.  All
463   but the final list are copied into the @<result-list>; the last one is used
464   as-is.
465 \end{describe}
466
467 \begin{describe}{mac}
468     {categorize (\=@<item-var> @<items>
469                    @[[ :bind (@{ @<var> @!
470                                  (@<var> @[@<value>@]) @}^*) @]])
471                                                                 \\ \ind\ind
472         (@{ (@<cat-var> @<cat-predicate>) @}^*)               \-\\
473       @<declaration>^*                                          \\
474       @<form>^*
475      \-\nlret @<value>^*}
476   Partition an input list of @<items> according to the @<cat-predicate>s.
477
478   First, @<items> is evaluated, to yield a list.  The @<item-var> is bound,
479   an empty list is created for each @|(@<cat-var> @<cat-predicate>)| pair,
480   and an iteration is begun.  For each item in the list in turn is assigned
481   to @<item-var>; then, the bindings given by the @|:bind| keyword are
482   performed, as if by @|let*|; and the @<cat-predicate>s are evaluated in the
483   resulting environment, one by one, until one of them returns non-nil.  When
484   this happens, the item is added to the corresponding list.  If no predicate
485   matches the item, an error is signalled.
486
487   Once this iteration is complete, each @<cat-var> is bound to its
488   corresponding completed list, and the body @<form>s are evaluated in the
489   resulting environment (which does not include @<item-var>), as an implicit
490   @|progn|, and the macro yields the values of the final @<form>.
491 \end{describe}
492
493 \begin{describe}{fun}{partial-order-minima @<items> @<order> @> @<list>}
494   Return a list of minimal items from the list @<items> according to a
495   non-strict partial order defined by the function @<order>: @|(funcall
496   @<order> $x$ $y$)| should return non-nil if and only if $x \preceq y$ in
497   the partial order.
498 \end{describe}
499
500 \begin{describe}{fun}
501     {find-duplicates @<report> @<sequence> \&key :key :test}
502   Call @<report> on each pair of duplicate items in a @<sequence>.
503   Duplicates are determined according to the @<key> (by default @|identity|)
504   and @<test> (by default @|eql|) functions, in the usual way: two items $x$
505   and $y$ are considered equal if and only if @|(funcall @<test> (funcall
506   @<key> $x$) (funcall @<key> $y$))| returns non-nil.
507
508   This function will work for arbitrary @<test> functions, but it will run
509   much more efficiently if @<test> is @|eq|, @|eql|, @|equal|, or @|equalp|
510   (because it can use hash-tables).
511 \end{describe}
512
513
514 \subsection{Position tracking}
515
516 The following functions are used to maintain file positions: see
517 \xref{sec:parsing.floc}.  Columns are counted starting from zero at the far
518 left.  (No particular origin is needed for line numbers.)  Newlines, vertical
519 tabs, and form-feeds all move to the start of the next line; horizontal tabs
520 move to the next multiple of eight columns; other characters simply advance
521 to the next column.
522
523 \begin{describe}{fun}
524     {update-position @<character> @<line> @<column>
525       @> @<new-line> @<new-column>}
526   Assume that we found @<character> at a particular @<line> and @<column> in
527   a file: return the @<new-line> and @<new-column> for the next character.
528 \end{describe}
529
530 \begin{describe}{fun}
531     {backtrack-position @<character> @<line> @<column>
532       @> @<old-line> @<old-column>}
533   Assume that we are currently at a particular @<line> and @<column> in a
534   file, and wish to \emph{unread} @<character>: return an @<old-line> and
535   @<old-column> at which we might plausibly re-read the character, so that
536   the next call to \descref{fun}{update-position} will return us to @<line>
537   and @<column>.  (Specifically, the @<old-column> will likely be wrong if
538   @<character> is a horizontal tab.  It is expected that this won't matter:
539   the purpose of this function is to set things up so that the
540   @|update-position| call that will accompany re-reading the character will
541   return the correct values, rather than to use the @<old-line> and
542   @<old-column> for any other purpose.)
543 \end{describe}
544
545
546 \subsection{Object printing}
547
548 \begin{describe}{mac}
549     {maybe-print-unreadable-object
550         (@<object> @<stream>
551          @[[ :type @<type> @!
552              :identity @<identity> @]])                         \\ \ind
553       @<declaration>^*                                          \\
554       @<form>^*}
555   If @|*print-escape*| is nil, then simply evaluate the @<form>s as an
556   implicit @|progn|; otherwise, print an `unreadable' object, as if by
557   \begin{prog}
558     (print-unreadable-object
559         (@<object> @<stream>
560          @[:type @<type>@]
561          @[:identity @<identity>@])                             \\ \ind
562       @<form>^*)
563   \end{prog}
564 \end{describe}
565
566 \begin{describe}{fun}{print-ugly-stuff @<stream> @<func> @> @<value>^*}
567   If @<stream> is a pretty-printing stream, then print a mandatory newline,
568   and call @<func> on the underlying non-pretty-printing stream.  If
569   @<stream> is not a pretty-printing stream, then simply call @<func> on
570   @<stream> directly.
571
572   The main purpose for this is to be able to access features of the
573   underlying stream which a pretty-printing stream can't proxy.  Most
574   notably, this is used by C fragment output, which takes advantage of an
575   underlying \descref{cls}{position-aware-output-stream} to print @|\#line|
576   directives, so that a C~compiler will blame the original fragment in the
577   Sod module source rather than the generated C code.
578 \end{describe}
579
580
581 \subsection{Condition utilities}
582
583 The following definitions are useful when working with conditions.
584
585 \begin{describe}{cls}
586     {simple-control-error (control-error simple-error)
587         \&key :format-control :format-arguments}
588   This is the obvious multiply-inherited subclass of @|control-error| whose
589   print form is determined by a @<format-control> and a @<format-arguments>
590   list.
591 \end{describe}
592
593 \begin{describe}{fun}
594     {designated-condition
595         \=@<default-type> @<datum> @<arguments>                 \\
596         \>\&key :allow-pointless-arguments
597       \nlret @<condition>}
598   Creates and returns a condition object of @<default-type>, given a
599   condition designator @<datum> and @<arguments>.
600
601   The Common Lisp specification carefully explains how a `datum' and an
602   argument list together form a `condition designator', and how such a pair
603   are to be converted into a condition object with some default type, but
604   there's no mechanism provided to simply do this task.  (Functions like
605   @|error| and @|signal| implicitly, but have possibly-undesirable
606   side-effects, and don't allow control over the default type.)
607
608   \begin{itemize}
609
610   \item If @<datum> is a condition object, then the designated condition is
611     simply @<datum>.  In this case, if @<arguments> is not an empty list and
612     @<allow-pointless-arguments> is nil (the default), an error is signalled;
613     otherwise, the @<arguments> are ignored.
614
615   \item If @<datum> is a symbol, then the designated condition is constructed
616     by calling
617     \begin{prog}
618       (apply \#'make-condition @<datum> @<arguments>)
619     \end{prog}
620
621   \item If @<datum> is a string or function (i.e., a `format-control'), then
622     the designated condition is constructed by calling
623     \begin{prog}
624       (make-condition \=@<default-type>                         \\
625                       \>:format-control @<datum>                \\
626                       \>:format-arguments @<arguments>)
627     \end{prog}
628
629   \item Otherwise the designator is malformed, and an error is signalled.
630   \end{itemize}
631 \end{describe}
632
633 \begin{describe}{fun}
634     {invoke-associated-restart @<restart> @<condition> \&rest @<arguments>}
635   Invoke the active restart named @<restart>, associated with the given
636   @<condition>, passing a list of @<arguments>.
637
638   The function attempts to find and invoke a restart with the given name.  If
639   @<condition> is non-nil, then it searches among restarts associated with
640   that specific condition, and restarts associated with no condition; if
641   @<condition> is nil, then it searches among all restarts.
642
643   If a matching restart is found, it is invoked, passing the @<arguments>
644   list.  Otherwise, an error (of class @|control-error|) is signalled.
645 \end{describe}
646
647 \begin{describe*}
648     {\dhead{cls}{enclosing-condition (condition) \&key :condition}
649      \dhead{gf}{enclosed-condition @<enclosing-condition> @> @<condition>}}
650   An @|enclosing condition| is a condition which contains another condition
651   within it.  Objects of type @|enclosing-condition| are used to add
652   additional information to an existing condition, or to alter the type of a
653   condition without losing information.
654
655   When an @|enclosing-condition| is constructed, the @<condition> argument
656   names the existing condition to be enclosed.  This enclosed condition can
657   be retrieved by calling @|enclosed-condition|.
658 \end{describe*}
659
660 \begin{describe}{cls}{information (condition) \&key}
661   A condition of class @|information| conveys information which might be of
662   interest, but does not of itself indicate that anything is wrong.
663
664   Within a compiler, @|information| conditions may be signalled in order to
665   present the user with additional diagnostic information about a recently
666   reported error.
667 \end{describe}
668
669 \begin{describe}{cls}
670     {simple-information (simple-condition information)          \\ \ind
671       \&key :format-control :format-arguments}
672   This is the obvious multiply-inherited subclass of @|information|
673   whose print-representation is determined by a @<format-control> and a
674   @<format-arguments> list.
675 \end{describe}
676
677 \begin{describe*}
678     {\dhead{fun}{info @<datum> \&rest @<arguments> @> @<flag>}
679      \dhead{rst}{noted}
680      \dhead{fun}{noted \&optional @<condition>}}
681   The @|info| function establishes a restart named @|noted| and signals a
682   condition of default type @|simple-information|, designated by the @<datum>
683   and @<arguments>.  The @|info| function returns non-nil if and only if the
684   associated @|noted| restart was invoked.
685
686   The @|noted| restart accepts no arguments.
687
688   The @|noted| function finds and invokes a @|noted| restart: if @<condition>
689   is non-nil, then only the restart associated with that condition (and those
690   not associated with any condition) are considered; otherwise, all
691   conditions are considered.
692 \end{describe*}
693
694 \begin{describe}{fun}
695     {promiscuous-cerror @<continue-string> @<datum> \&rest @<arguments>}
696   Establish a @|continue| restart and signal an error of default type
697   @|simple-error|, designated by @<datum> and @<arguments>.  The restart's
698   report format is determined by @<continue-string> and the @<arguments>.
699
700   Some implementations of @|cerror| associate the @|continue| restart which
701   they establish with the condition they signal.  This interferes with
702   special effects -- specifically, enclosing the signalled condition and
703   resignalling it.  The @|promiscuous-cerror| function carefully avoids
704   associating its restart with the condition.
705 \end{describe}
706
707 \begin{describe}{fun}{cerror* @<datum> \&rest @<arguments>}
708   A simplified version of \descref{fun}{promiscuous-cerror} which uses the
709   hardcoded string @|Continue| for the restart.  This makes calling the
710   function more similar to other condition-signalling functions, at the
711   expense of some usability in environments which don't continue after
712   continuable errors automatically.
713 \end{describe}
714
715
716 \subsection{Very miscellaneous utilities}
717
718 \begin{describe}{fun}
719     {whitespace-char-p @<character> @> @<generalized-boolean>}
720   Return non-nil if and only if @<character> is a whitespace character.
721
722   A character is whitespace if @|(peek-char t @<stream>)| would skip it.
723 \end{describe}
724
725 \begin{describe}{fun}
726     {frob-identifier @<string> \&key :swap-case :swap-hyphen
727       @> @<frobbed-string>}
728   Return a `frobbed' version of the identifier @<string>.  Two different
729   transformations can be applied.
730
731   \begin{itemize}
732
733   \item If @<swap-case> is non-nil (the default), and the letters in
734     @<string> are either all uppercase or all lowercase, then switch the case
735     of all of the letters.
736
737   \item If @<swap-hyphen> is non-nil (the default), and @<string> contains
738     either hyphens @`--' or underscores @`_', but not both, then replace the
739     hyphens by underscores or \emph{vice-versa}.
740
741   \end{itemize}
742
743   (These are the `obvious' transformations to convert a C identifier into a
744   Lisp symbol.)
745
746   Some examples:
747   \begin{itemize}
748   \item @|(frob-identifier "foo")| $\Longrightarrow$ @|"FOO"|
749   \item @|(frob-identifier "FOO")| $\Longrightarrow$ @|"foo"|
750   \item @|(frob-identifier "FooBar")| $\Longrightarrow$ @|"FooBar"|
751   \item @|(frob-identifier "Foo-Bar")| $\Longrightarrow$ @|"Foo_Bar"|
752   \item @|(frob-identifier "Foo_Bar")| $\Longrightarrow$ @|"Foo-Bar"|
753   \item @|(frob-identifier "foo_bar")| $\Longrightarrow$ @|"FOO-BAR"|
754   \item @|(frob-identifier "foo_bar" :swap-hyphen nil)| $\Longrightarrow$
755     @|"FOO_BAR"|
756   \item @|(frob-identifier "foo_bar" :swap-case nil)| $\Longrightarrow$
757     @|"foo-bar"|
758   \item @|(frob-identifier "foo_bar" :swap-case nil :swap-hyphen nil)|
759     $\Longrightarrow$ @|"foo_bar"|
760   \end{itemize}
761 \end{describe}
762
763 \begin{describe}{fun}
764     {compose @<functions> @> @<function>}
765   Return the left-to-right composition zero or more @<functions>.
766
767   Let $f_1$, $f_2$, \ldots, $f_n$ be functions, and let $g = @|(compose $f_1$
768   $f_2$ $\cdots$ $f_n$)|$ is their composition.  If $g$ is applied to
769   arguments, the effect is as follows: first, $f_1$ is applied to the
770   arguments, yielding some value; $f_2$ is applied to this value, yielding a
771   second value; and so on, until finally the value yielded by $f_n$ is
772   returned as the result of $g$.  Note that this is the reverse of the usual
773   mathematician's convention, but the author finds this ordering
774   significantly easier to work with:
775   \[ g = f_n \circ \cdots \circ f_2 \circ f_1 \]
776
777   If any of the input functions return multiple values then \emph{all} of the
778   values are passed on to the next function in the list.  (If the last
779   function returns multiple values then all of the values are returned from
780   the composition.
781
782   The result of composing no functions is a function which simply returns all
783   of its arguments as values; essentially, $@|(compose)| \equiv
784   @|\#'values|$.
785 \end{describe}
786
787 \begin{describe}{mac}{defvar-unbound @<name> @<documentation> @> @<name>}
788   Define a variable called @<name>, with a @<documentation> string.
789
790   The Common Lisp @|defvar| macro accepts both an initial value and a
791   doc-string as optional arguments, in that order, with the result that it's
792   not possible to define a variable and establish a documentation string for
793   it without also giving it an initial value.  The @|defvar-unbound| macro,
794   on the other hand, never changes the symbol's variable-value.
795 \end{describe}
796
797 \begin{describe}{mac}
798     {dosequence (@<var> @<sequence>
799                  @[[ :start @<start> @! :end @<end> @!
800                      :indexvar @<index-var> @]])                \\ \ind
801       @<declaration>^*                                          \\
802       @{ @<tag> @! @<statement> @}^*}
803   Iterate over a @<sequence>.  Common Lisp has a rich collection of iteration
804   primitives, and a rich collection of functions for working with sequences,
805   but no macro for iterating over the items of a sequence.
806
807   First, the @<sequence> is evaluated.  If @<start> and/or @<end> are
808   provided, they are also evaluated (in that order), which should produce
809   integers; @<end> may be also be nil.  If not provided, or nil (in the case
810   of @<end>), @<start> and @<end> default respectively to zero and the length
811   of the @<sequence>.  For each item in the sequence between the @<start> and
812   @<end> positions (i.e., each item in @|(subseq @<sequence> @<start>
813   @<end>)|, in order, the body is evaluated as an implicit @|tagbody|, with
814   @<var> bound to the item and, if provided, @<index-var> bound to the item's
815   index.  It is not specified whether the @<var> and @<index-var> are
816   let-bound or mutated in each iteration.
817
818   Unlike other Common Lisp @|do|\dots\ forms, there is no `result' form.
819 \end{describe}
820
821 \begin{describe}{mac}
822     {define-access-wrapper @<from> @<to>
823                            @[[ :read-only @<read-only-flag> @]]}
824   Define @<from> as a function of one argument, so that @|(@<from> @<thing>)|
825   is equivalent to @|(@<to> @<thing>)|.  If @<read-only-flag> is nil (the
826   default), then also define @|(setf @<from>)| so that @|(setf (@<from>
827   @<thing>) @<value>)| is equivalent to @|(setf (@<to> @<thing>) @<value>)|.
828
829   In a @|defstruct| form, the accessor function names are constructed based
830   on the structure name and slot names.  The structure name and accessor
831   names are part of the exported interface, but the slot names ideally
832   shouldn't be.  This causes a problem when the slot name which will lead to
833   the right accessor is already an external symbol in some package.  You can
834   solve this problem by choosing an internal name for the symbol, and then
835   using this macro to define an accessor function with the name that you
836   want, in terms of the accessor that @|defstruct| made.
837 \end{describe}
838
839 \begin{describe}{fun}
840     {distinguished-point-shortest-paths @<root> @<neighbours-func>
841       @> @<list>}
842   Calculate the shortest path from the @<root> to each node reachable from it
843   in a directed graph.  The nodes of the graph can be any kind of object;
844   they will be compared using @|eql|.
845
846   The @<neighbours-func> should be a function which, given a node~$v$ as its
847   only argument, returns a list of cons cells @|($v'$ . $c'$)|, one for each
848   node~$v'$ adjacent to $v$, indicating the cost $c'$ of traversing the arc
849   from $v$ to $v'$.
850
851   The return value is a list of cons cells @|($c$ . $p$)|, where $p$ is list
852   of nodes, in reverse order, along a path from the @<root> to some other
853   node, and $c$ is the total cost of traversing this path.  (Therefore @|(car
854   $p$)| is the destination node, and @|(car (last $p$))| is always the
855   @<root> itself.)
856
857   The function runs in $O(n^2)$ time, where $n$ is the number of nodes
858   reachable from the @<root>.  Currently, it uses an algorithm due to Edsger
859   Dijkstra.
860 \end{describe}
861
862 %%%--------------------------------------------------------------------------
863 \section{Option parser} \label{sec:misc.optparse}
864
865 Most of these symbols are defined in the @|optparse| package.
866
867 \begin{describe}{fun}{exit \&optional (@<code> 0) \&key :abrupt}
868 \end{describe}
869
870 \begin{describe}{var}{*program-name*}
871 \end{describe}
872
873 \begin{describe}{var}{*command-line*}
874 \end{describe}
875
876 \begin{describe}{fun}{set-command-line-arguments}
877 \end{describe}
878
879 \begin{describe}{fun}{moan @<format-string> \&rest @<format-args>}
880 \end{describe}
881
882 \begin{describe}{fun}{die @<format-string> \&rest @<format-args>}
883 \end{describe}
884
885 \begin{describe}{var}{*options*}
886 \end{describe}
887
888 \begin{describe}{cls}{option}
889 \end{describe}
890
891 \begin{describe}{fun}{optionp @<object> @> @<generalized-boolean>}
892 \end{describe}
893
894 \begin{describe}{fun}
895     {make-option \=@<long-name> @<short-name>                 \+\\
896                    \&optional @<arg-name>                       \\
897                    \&key :tag :negated-tag
898                          :arg-optional-p :documentation       \-
899       \nlret @<option>}
900 \end{describe}
901
902 \begin{describe*}
903     {\dhead{fun}{opt-short-name @<option> @> @<character-or-null>}
904      \dhead{fun}{setf (opt-short-name @<option>) @<character-or-null>}
905      \dhead{fun}{opt-long-name @<option> @> @<string-or-null>}
906      \dhead{fun}{setf (opt-long-name @<option>) @<string-or-null>}
907      \dhead{fun}{opt-tag @<option> @> @<tag>}
908      \dhead{fun}{setf (opt-tag @<option>) @<tag>}
909      \dhead{fun}{opt-negated-tag @<option> @> @<tag>}
910      \dhead{fun}{setf (opt-negated-tag @<option>) @<tag>}
911      \dhead{fun}{opt-arg-name @<option> @> @<string-or-null>}
912      \dhead{fun}{setf (opt-arg-name @<option>) @<string-or-null>}
913      \dhead{fun}{opt-optional-p @<option> @> @<generalized-boolean>}
914      \dhead{fun}{setf (opt-optional-p @<option>) @<generalized-boolean>}
915      \dhead{fun}{opt-documentation @<option> @> @<string-or-null>}
916      \dhead{fun}{setf (opt-documentation @<option>) @<string-or-null>}}
917 \end{describe*}
918
919 \begin{describe}{cls}{option-parser}
920 \end{describe}
921
922 \begin{describe}{fun}{option-parser-p @<object> @> @<generalized-boolean>}
923 \end{describe}
924
925 \begin{describe}{fun}
926     {make-option-parser \&key \=:args :options :non-option :numericp \+ \\
927                               :negated-numeric-p long-only-p \-
928       \nlret @<option-parser>}
929 \end{describe}
930
931 \begin{describe*}
932     {\dhead{fun}{op-options @<option-parser> @> @<list>}
933      \dhead{fun}{setf (op-options @<option-parser>) @<list>}
934      \dhead{fun}{op-non-option @<option-parser> @> @<action>}
935      \dhead{fun}{setf (op-non-option @<option-parser>) @<action>}
936      \dhead{fun}{op-long-only-p @<option-parser> @> @<generalized-boolean>}
937      \dhead{fun}{setf (op-long-only-p @<option-parser>) @<generalized-boolean>}
938      \dhead{fun}{op-numeric-p @<option-parser> @> @<generalized-boolean>}
939      \dhead{fun}{setf (op-numeric-p @<option-parser>) @<generalized-boolean>}
940      \dhead{fun}{op-negated-numeric-p @<option-parser> @<generalized-boolean>}
941      \dhead{fun}{setf (op-negated-numeric-p @<option-parser>) @<generalized-boolean>}
942      \dhead{fun}{op-negated-p @<option-parser> @> @<generalized-boolean>}
943      \dhead{fun}{setf (op-negated-p @<option-parser>) @<generalized-boolean>}}
944 \end{describe*}
945
946 \begin{describe}{cls}
947     {option-parse-error (error simple-condition)
948       \&key :format-control :format-arguments}
949 \end{describe}
950
951 \begin{describe}{fun}{option-parse-remainder @<option-parser>}
952 \end{describe}
953
954 \begin{describe}{fun}{option-parse-return @<tag> \&optional @<argument>}
955 \end{describe}
956
957 \begin{describe}{fun}{option-parse-next @<option-parser>}
958 \end{describe}
959
960 \begin{describe}{mac}{option-parse-try @<form>^*}
961 \end{describe}
962
963 \begin{describe}{mac}{with-unix-error-reporting () @<form>^*}
964 \end{describe}
965
966 \begin{describe}{mac}
967     {defopthandler @<name> (@<var> @[@<arg>@]) @<lambda-list> \\ \ind
968       @[[ @<declaration>^* @! @<doc-string> @]] \\
969       @<form>^*}
970 \end{describe}
971
972 \begin{describe}{fun}
973     {invoke-option-handler @<handler> @<locative> @<arg> @<arguments>}
974 \end{describe}
975
976 \begin{describe}{opt}{set \&optional @<value>}
977 \end{describe}
978
979 \begin{describe}{opt}{clear \&optional @<value>}
980 \end{describe}
981
982 \begin{describe}{opt}{inc \&optional @<maximum> @<step>}
983 \end{describe}
984
985 \begin{describe}{opt}{dec \&optional @<minimum> @<step>}
986 \end{describe}
987
988 \begin{describe}{opt}{read}
989 \end{describe}
990
991 \begin{describe}{opt}{int \&key :radix :min :max}
992 \end{describe}
993
994 \begin{describe}{opt}{string}
995 \end{describe}
996
997 \begin{describe}{opt}{keyword \&optional @<valid>}
998 \end{describe}
999
1000 \begin{describe}{opt}{list \&optional @<handler> \&rest @<handler-args>}
1001 \end{describe}
1002
1003 \begin{describe}{mac}
1004     {defoptmacro @<name> @<lambda-list> \\ \ind
1005       @[[ @<declaration>^* @! @<doc-string> @]] \\
1006       @<form>^*}
1007 \end{describe}
1008
1009 \begin{describe}{fun}{parse-option-form @<form>}
1010 \end{describe}
1011
1012 \begin{describe}{mac}
1013     {options @{ \=@<string> @! \+ \\
1014                   @<option-macro> @! (@<option-macro> @<macro-arg>^*) @! \\
1015                   (@[[ \=@<character> @! (:short-name @<character>) @! \+ \\
1016                          @<string>^* @! @<symbol> @! @<rational> @!
1017                          (:long-name @<string>) @! \\
1018                          (@<string> @<format-arg>^+) @!
1019                          (:doc @<string> @<format-arg>^*) @! \\
1020                          (:arg @<arg-name>) @! (:opt-arg @<arg-name>) @! \\
1021                          @<keyword> @! (:tag @<tag>) @!
1022                                        (:negated-tag @<tag>) @! \\
1023                          @{ (@<handler> @<var> @<handler-arg>^*) @}^*
1024                    @]]) @}^*}
1025 \end{describe}
1026
1027 \begin{describe}{fun}
1028     {simple-usage @<option-list> \&optional @<mandatory-args> @> @<list>}
1029 \end{describe}
1030
1031 \begin{describe}{fun}{show-usage @<prog> @<usage> \&optional @<stream>}
1032 \end{describe}
1033
1034 \begin{describe}{fun}
1035     {show-help @<prog> @<usage> @<option-list> \&optional @<stream>}
1036 \end{describe}
1037
1038 \begin{describe}{fun}{sanity-check-option-list @<option-list>}
1039 \end{describe}
1040
1041 \begin{describe*}
1042     {\dhead{var}{*help*}
1043      \dhead{var}{*version*}
1044      \dhead{var}{*usage*}}
1045 \end{describe*}
1046
1047 \begin{describe}{fun}{do-usage \&optional @<stream>}
1048 \end{describe}
1049
1050 \begin{describe}{fun}{die-usage}
1051 \end{describe}
1052
1053 \begin{describe}{optmac}
1054     {help-options \&key :short-help :short-version :short-usage}
1055 \end{describe}
1056
1057 \begin{describe}{fun}
1058     {define-program \&key \=:program-name \+ \\
1059                             :help :version :usage :full-usage \\
1060                             :options}
1061 \end{describe}
1062
1063 \begin{describe}{mac}
1064     {do-options (@[[ :parser @<option-parser> @]]) \\ \ind
1065       @{ (@{ @<case> @! (@<case>^*)@} (@[@[@<opt-var>@] @<arg-var>@])
1066           @<form>^*) @}^*}
1067 \end{describe}
1068
1069 \begin{describe}{fun}{augment-options @<options-list>}
1070 \end{describe}
1071
1072 %%%--------------------------------------------------------------------------
1073 \section{Property sets} \label{sec:misc.pset}
1074
1075 \begin{describe}{fun}{property-key @<name> @> @<keyword>}
1076 \end{describe}
1077
1078 \begin{describe}{gf}{decode-property @<raw-value> @> @<type> @<value>}
1079 \end{describe}
1080
1081 \begin{describe}{cls}{property}
1082 \end{describe}
1083
1084 \begin{describe}{fun}{propertyp @<object> @> @<generalized-boolean>}
1085 \end{describe}
1086
1087 \begin{describe}{fun}
1088     {make-property @<name> @<raw-value> \&key :type :location :seenp}
1089 \end{describe}
1090
1091 \begin{describe*}
1092     {\dhead{fun}{p-name @<property> @> @<name>}
1093      \dhead{fun}{p-value @<property> @> @<value>}
1094      \dhead{fun}{p-type @<property> @> @<type>}
1095      \dhead{fun}{p-key @<property> @> @<symbol>}
1096      \dhead{fun}{p-seenp @<property> @> @<boolean>}
1097      \dhead{fun}{setf (p-seenp @<property>) @<boolean>}}
1098 \end{describe*}
1099
1100 \begin{describe}{gf}
1101     {coerce-property-value @<value> @<type> @<wanted> @> @<coerced-value>}
1102 \end{describe}
1103
1104 \begin{describe}{cls}{pset}
1105 \end{describe}
1106
1107 \begin{describe}{fun}{psetp @<object> @> @<generalized-boolean>}
1108 \end{describe}
1109
1110 \begin{describe}{fun}{make-pset @> @<pset>}
1111 \end{describe}
1112
1113 \begin{describe}{fun}{pset-get @<pset> @<key> @> @<property-or-nil>}
1114 \end{describe}
1115
1116 \begin{describe}{fun}{pset-store @<pset> @<property> @> @<property>}
1117 \end{describe}
1118
1119 \begin{describe}{fun}{pset-map @<func> @<pset>}
1120 \end{describe}
1121
1122 \begin{describe}{mac}
1123     {with-pset-iterator (@<iter> @<pset>) @<declaration>^* @<form>^*}
1124 \end{describe}
1125
1126 \begin{describe}{fun}
1127     {store-property @<pset> @<name> @<value> \&key :type :location
1128       @> @<property>}
1129 \end{describe}
1130
1131 \begin{describe}{fun}
1132     {get-property @<pset> @<name> @<type> \&optional @<default>
1133       @> @<value> @<floc-or-nil>}
1134 \end{describe}
1135
1136 \begin{describe}{fun}
1137     {add-property @<pset> @<name> @<value> \&key :type :location
1138       @> @<property>}
1139 \end{describe}
1140
1141 \begin{describe}{fun}{make-property-set \&rest @<plist> @> @<pset>}
1142 \end{describe}
1143
1144 \begin{describe}{gf}{property-set @<thing> @> @<pset>}
1145 \end{describe}
1146
1147 \begin{describe}{fun}{check-unused-properties @<pset>}
1148 \end{describe}
1149
1150 \begin{describe}{mac}
1151     {default-slot-from-property
1152         (@<instance> @<slot> @[@<slot-names>@]) \\ \ind\ind
1153         (@<pset> @<property> @<type> @[@<prop-var> @<convert-form>^*@]) \- \\
1154       @<declaration>^* \\
1155       @<default-form>^*}
1156 \end{describe}
1157
1158 \begin{describe}{fun}
1159     {parse-property @<scanner> @<pset>
1160       @> @<result> @<success-flag> @<consumed-flag>}
1161 \end{describe}
1162
1163 \begin{describe}{fun}
1164     {parse-property-set @<scanner>
1165       @> @<result> @<success-flag> @<consumed-flag>}
1166 \end{describe}
1167
1168 %%%--------------------------------------------------------------------------
1169 \section{Miscellaneous translator features} \label{sec:misc.misc}
1170
1171 \begin{describe}{var}{*sod-version*}
1172 \end{describe}
1173
1174 \begin{describe}{var}{*debugout-pathname*}
1175 \end{describe}
1176
1177 \begin{describe}{fun}
1178     {test-module @<path> \&key :reason :clear :backtrace @> @<status>}
1179 \end{describe}
1180
1181 \begin{describe}{fun}
1182     {test-parse-c-type @<string>
1183       @> t @<c-type> @<kernel> @<string> @! nil @<indicator>}
1184 \end{describe}
1185
1186 \begin{describe}{fun}
1187     {test-parse-pset @<string>
1188       @> t @<pset> @! nil @<indicator>}
1189 \end{describe}
1190
1191 \begin{describe}{mac}
1192     {test-parser (@<scanner> \&key :backtrace) @<parser> @<input>
1193       @> @<result> @<status> @<remainder>}
1194 \end{describe}
1195
1196 \begin{describe}{fun}{exercise}
1197 \end{describe}
1198
1199 \begin{describe}{fun}{sod-frontend:main}
1200 \end{describe}
1201
1202 %%%----- That's all, folks --------------------------------------------------
1203
1204 %%% Local variables:
1205 %%% mode: LaTeX
1206 %%% TeX-master: "sod.tex"
1207 %%% TeX-PDF-mode: t
1208 %%% End: