make clean even cleaner now.
[clqr.git] / clqr-conditions-and-errors.tex
blobaa7574811033f23a4fc8e2b63e84d46fc00c07d8
1 % Copyright (C) 2008, 2009, 2010 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{Conditions and Errors}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 \begin{LIST}{1cm}
15 \IT{(\MC*{DEFINE-CONDITION} \VAR{foo} (\OPn{\VAR{parent-type}}\DF{\kwd{condition}})
16 (\xorGOO{\VAR{slot}\\
17 (\VAR{slot}
18 \orGOO{\Goos{\kwd{:reader} \VAR{reader}}\\
19 \Goos{\kwd{:writer} \xorGOO{%
20 \VAR{writer}\\
21 (\kwd{setf } \VAR{writer})}{\}}}\\
22 \Goos{\kwd{:accessor} \VAR{accessor}} \\
23 \kwd{:allocation } \xorGOO{\kwd{:instance}\\
24 \kwd{:class}}{\}}\DF{\kwd{:instance}}\\
25 \Goos{\kwd{:initarg} \kwd{:}\VAR{initarg-name}}\\
26 \kwd{:initform} \VAR{ form}\\
27 \kwd{:type} \VAR{ type}\\
28 \kwd{:documentation} \VAR{ slot-doc}%
29 }{\}})}{\}^{\!\!*}})
30 \orGOO{(\kwd{:default-initargs } \Goos{\VAR{name} \VAR{value}})\\
31 ({\kwd{:documentation} \VAR{ condition-doc}})\\
32 (\kwd{:report } \xorGOO{\VAR{string}\\
33 \VAR{report-function}}{\}})}{\}})}
35 Define, as a subtype of \VAR{parent-type}s, condition type
36 \retval{\VAR{foo}}. In a new condition, a \VAR{slot}'s value defaults
37 to \VAR{form} unless set via \kwd{:}\VAR{initarg-name}; it is readable
38 via (\VAR{reader} \VAR{i}) or (\VAR{accessor} \VAR{i}), and
39 writeable via (\VAR{writer} \VAR{i} \VAR{value}) or (\kwd{setf}
40 (\VAR{accessor} \VAR{i}) \VAR{value}). With
41 \kwd{:allocation :class}, \VAR{slot} is shared by all conditions of
42 type \VAR{foo}. A condition is reported by \VAR{string} or by
43 \VAR{report-function} of arguments condition and stream.
46 \IT{(\FU*{MAKE-CONDITION} \VAR{type} \Goos{\kwd{:}\VAR{initarg-name} \VAR{value}})}
48 Return new \retval{condition of \VAR{type}}.
51 \IT{(\xorGOO{%
52 \FU*{SIGNAL}\\
53 \FU*{WARN}\\
54 \FU*{ERROR}%
55 }{\}}
56 \xorGOO{%
57 \VAR{condition}\\
58 \VAR{type}\text{ } \Goos{\kwd{:}\VAR{initarg-name} \VAR{value}}\\
59 \VAR{control}\text{ } \OPn{\VAR{arg}}%
60 }{\}})}
62 Unless handled, signal as \kwd{condition}, \kwd{warning} or \kwd{error},
63 respectively, \VAR{condition} or a new condition of \VAR{type} or,
64 with \FU{format} \VAR{control} and \VAR{arg}s (see p.\ \pageref{section:Format}),
65 \kwd{simple-condition}, \kwd{simple-warning}, or \kwd{simple-error}, respectively.
66 From \FU{SIGNAL} and \FU{WARN}, return \retval{\NIL}.
69 \IT{(\FU*{CERROR} \VAR{continue-control}
70 \xorGOO{%
71 \VAR{condition}\text{ } \OPn{\VAR{continue-arg}}\\
72 \VAR{type}\text{ } \Goos{\kwd{:}\VAR{initarg-name} \VAR{value}}\\
73 \VAR{control}\text{ } \OPn{\VAR{arg}}%
74 }{\}})}
76 Unless handled, signal as correctable \kwd{error} \VAR{condition} or
77 a new condition of \VAR{type} or, with \FU{format} \VAR{control} and
78 \VAR{arg}s (see p.\ \pageref{section:Format}),
79 \kwd{simple-error}. In the debugger, use \FU{format} arguments
80 \VAR{continue-control} and \VAR{continue-arg}s to tag the continue
81 option. Return \retval{\NIL}.
84 \IT{(\MC*{IGNORE-ERRORS} \PROGN{\VAR{form}})}
86 Return \retval{values of \VAR{form}s} or, in case of \kwd{error}s,
87 \retval{\NIL} and the \retvalii{condition}.
90 \IT{(\FU*{INVOKE-DEBUGGER} \VAR{condition})}
92 Invoke debugger with \VAR{condition}.
95 \IT{(\MC*{ASSERT} \VAR{test} \OP{(\OPn{\VAR{place}})
96 \Op{%
97 \xorGOO{%
98 \VAR{condition}\text{ } \OPn{\VAR{continue-arg}}\\
99 \VAR{type}\text{ } \Goos{\kwd{:}\VAR{initarg-name} \VAR{value}}\\
100 \VAR{control}\text{ } \OPn{\VAR{arg}}}{\}}}})}
102 If \VAR{test}, which may depend on \VAR{place}s, returns \NIL,
103 signal as correctable \kwd{error} \VAR{condition} or a new condition
104 of \VAR{type} or, with \FU{format} \VAR{control} and \VAR{arg}s (see
105 p.\ \pageref{section:Format}), \kwd{error}. When using the
106 debugger's continue option, \VAR{place}s can be altered before
107 re-evaluation of \VAR{test}. Return \retval{\NIL}.
110 \IT{(\MC*{HANDLER-CASE} \VAR{test}
111 \OPn{(\VAR{type} (\Op{\VAR{var}})
112 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{condition-form}})}
113 \Op{(\kwd{:no-error} (\OPn{\VAR{ord-$\lambda$}}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
114 \PROGN{\VAR{form}})})}
116 If, on evaluation of \VAR{test}, a condition of \VAR{type} is
117 signalled, evaluate matching \VAR{condition-form}s
118 with \VAR{var} bound to the condition, and return \retval{their
119 values}. Without a condition, bind \VAR{ord-$\lambda$}s to values
120 of \VAR{test} and return \retval{values of \VAR{form}s} or, without
121 a \kwd{:no-error} clause, return \retval{values of \VAR{test}}. See
122 p.\ \pageref{section:Functions} for (\OPn{\VAR{ord-$\lambda$}}).
125 \IT{(\MC*{HANDLER-BIND} (\OPn{(\VAR{condition-type}
126 \VAR{handler-function})}) \PROGN{\VAR{form}})}
128 Return \retval{values of \VAR{form}s} after evaluating them with
129 \VAR{condition-type}s dynamically bound to their respective
130 \VAR{handler-function}s of argument condition.
133 \IT{(\MC*{WITH-SIMPLE-RESTART} (\xorGOO{\VAR{restart}\\
134 \NIL}{\}} \VAR{control}
135 \OPn{\VAR{arg}}) \PROGN{\VAR{form}})}
137 Return \retval{values of \VAR{form}s} unless \VAR{restart} is called
138 during their evaluation. In this case, describe restart using
139 \FU{format} \VAR{control} and \VAR{arg}s (see
140 p.\ \pageref{section:Format}) and return \retval{\NIL}
141 and \retvalii{\T}.
144 \IT{(\MC*{RESTART-CASE} \VAR{form} \OPn{(\VAR{foo}
145 (\OPn{\VAR{ord-$\lambda$}})
146 \orGOO{\kwd{:interactive} \VAR{ arg-function}\\
147 \kwd{:report } \xorGOO{%
148 \VAR{report-function}\\
149 \VAR{string}\DF{\LIT{"}\VAR{foo}\LIT{"}}}{.}\\
150 \kwd{:test} \VAR{ test-function}\DF{\T}}{\}}
151 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
152 \PROGN{\VAR{restart-form}})})}
154 Evaluate \VAR{form} with dynamically established restarts \VAR{foo}. Return
155 \retval{values of \VAR{form}} or, if by (\kwd{invoke-restarts}
156 \VAR{foo} \OPn{\VAR{arg}}) one restart \VAR{foo} is called, use
157 \VAR{string} or \VAR{report-function} (of a stream) to print a
158 description of restart \VAR{foo} and
159 return the \retval{values of its \VAR{restart-form}s}.
160 \VAR{arg-function} supplies appropriate \VAR{arg}s if \VAR{foo} is
161 called by \kwd{invoke-restart-interactively}. If (\VAR{test-function} \VAR{condition})
162 returns \T, \VAR{foo} is made visible under \VAR{condition}.
163 For (\OPn{\VAR{ord-$\lambda$}}) see p.\ \pageref{section:Functions}.
166 \IT{(\MC*{RESTART-BIND} (\OPn{(\xorGOO{\NEV{\VAR{restart}}\\
167 \NIL}{\}}
168 \VAR{restart-function} \orGOO{\kwd{:interactive-function}
169 \VAR{ function}\\
170 \kwd{:report-function} \VAR{ function}\\
171 \kwd{:test-function} \VAR{ function}}{\}})}) \PROGN{\VAR{form}})}
173 Return \retval{values of \VAR{form}s} evaluated with \VAR{restart}s
174 dynamically bound to \VAR{restart-function}s.
177 \IT{\arrGOO{(\FU*{INVOKE-RESTART} \VAR{ restart} \OPn{\VAR{ arg}})\\
178 (\FU*{INVOKE-RESTART-INTERACTIVELY} \VAR{ restart})}{.}}
180 Call function associated with \VAR{restart} with arguments given or
181 prompted for, respectively. If \VAR{restart} function returns, return \retval{its values}.
184 \IT{(\xorGOO{\FU*{COMPUTE-RESTARTS}\\
185 \FU*{FIND-RESTART} \VAR{ name}}{\}} \Op{\VAR{condition}})}
187 Return list of \retval{all restarts}, or innermost \retval{restart}
188 \VAR{name}, respectively, out of those either associated
189 with \VAR{condition} or un-associated at all; or, without
190 \VAR{condition}, out of all restarts. Return \retval{\NIL} if search
191 is unsuccessful.
194 \IT{(\FU*{RESTART-NAME} \VAR{restart})}
196 \retval{Name of \VAR{restart}}.
199 \IT{(\xorGOO{\FU*{ABORT}\\
200 \FU*{MUFFLE-WARNING}\\
201 \FU*{CONTINUE}\\
202 \FU*{STORE-VALUE} \VAR{ value}\\
203 \FU*{USE-VALUE} \VAR{ value}}{\}} \Op{\VAR{condition}\DF{\NIL}})}
205 Transfer control to innermost applicable restart with same name
206 (i.e. \kwd{abort}, \ldots, \kwd{continue} \ldots) out of those either associated
207 with \VAR{condition} or un-associated at all; or, without
208 \VAR{condition}, out of all restarts. If no restart is found,
209 signal \kwd{control-error} for \FU{abort} and \FU{muffle-warning},
210 or return \retval{\NIL} for the rest.
213 \IT{(\MC*{WITH-CONDITION-RESTARTS} \VAR{condition}
214 \VAR{restarts} \PROGN{\VAR{form}})}
216 Evaluate \VAR{form}s with \VAR{restarts}
217 dynamically associated with \VAR{condition}. Return \retval{values
218 of \VAR{form}s}.
221 \IT{\arrGOO{(\FU*{ARITHMETIC-ERROR-OPERATION} \VAR{ condition})\\
222 (\FU*{ARITHMETIC-ERROR-OPERANDS} \VAR{ condition})}{.}}
224 \retval{List of function} or \retval{of its operands} respectively,
225 used in the operation which caused \VAR{condition}.
228 \IT{(\FU*{CELL-ERROR-NAME} \VAR{condition})}
230 \retval{Name of cell} which caused \VAR{condition}.
233 \IT{(\FU*{UNBOUND-SLOT-INSTANCE} \VAR{condition})}
235 \retval{Instance} with unbound slot which caused \VAR{condition}.
238 \IT{(\FU*{PRINT-NOT-READABLE-OBJECT} \VAR{condition})}
240 The \retval{object} not readably printable under \VAR{condition}.
243 \IT{\arrGOO{%
244 (\FU*{PACKAGE-ERROR-PACKAGE } \VAR{condition})\\
245 (\FU*{FILE-ERROR-PATHNAME } \VAR{condition})\\
246 (\FU*{STREAM-ERROR-STREAM } \VAR{condition})}{.}}
248 \retval{Package}, \retval{path}, or \retval{stream}, respectively,
249 which caused the \VAR{condition} of indicated type.
252 \IT{\arrGOO{(\FU*{TYPE-ERROR-DATUM} \VAR{ condition})\\
253 (\FU*{TYPE-ERROR-EXPECTED-TYPE} \VAR{ condition})}{.}}
255 \retval{Object} which caused \VAR{condition} of type \kwd{type-error}, or its
256 \retval{expected type}, respectively.
259 \IT{\arrGOO{(\FU*{SIMPLE-CONDITION-FORMAT-CONTROL} \VAR{ condition})\\
260 (\FU*{SIMPLE-CONDITION-FORMAT-ARGUMENTS} \VAR{ condition})}{.}}
262 Return \retval{\FU{format} control} or list of \retval{\FU{format}
263 arguments}, respectively, of \VAR{condition}.
266 \IT{\V{\A break-on-signals\A}\DF{\NIL}}
267 {\index{*BREAK-ON-SIGNALS*@\A BREAK-ON-SIGNALS\A}
268 Condition type debugger is to be invoked on.
271 \IT{\V{\A debugger-hook\A}\DF{\NIL}}
272 {\index{*DEBUGGER-HOOK*@\A DEBUGGER-HOOK\A}
273 Function of condition and
274 function itself. Called before debugger.
277 \end{LIST}
280 %%% Local Variables:
281 %%% mode: latex
282 %%% TeX-master: "clqr"
283 %%% End: