src/parser/floc-proto.lisp, src/utilities.lisp: New `information' condition.
[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 \begin{describe}{mac}
34 {with-gensyms (@{ @<var> @! (@<var> @[@<name>@]) @}^*) \\ \ind
35 @<declaration>^* \\
36 @<form>^*}
37 \end{describe}
38
39 \begin{describe}{mac}
40 {once-only (@[[ :environment @<env> @]]
41 @{ @<var> @! (@<var> @[@<value-form>@]) @}^*) \\ \ind
42 @<declaration>^* \\
43 @<form>^*}
44 \end{describe}
45
46 \begin{describe}{mac}
47 {parse-body @<body> \&key :docp :declp
48 @> @<doc-string> @<declarations> @<body-forms>}
49 \end{describe}
50
51 \begin{describe}{cls}{loc}
52 \end{describe}
53
54 \begin{describe}{fun}{locp @<object> @> @<generalized-boolean>}
55 \end{describe}
56
57 \begin{describe}{mac}{locf @<place> @> @<locative>}
58 \end{describe}
59
60 \begin{describe*}
61 {\dhead{fun}{ref @<locative> @> @<value>}
62 \dhead{fun}{setf (ref @<locative>) @<value>}}
63 \end{describe*}
64
65 \begin{describe}{mac}
66 {with-locatives
67 @{ @<var> @! (@{ @<var> @!
68 (@<var> @[@<locative>@]) @}^*) @} \\ \ind
69 @<declaration>^* \\
70 @<form>^*}
71 \end{describe}
72
73 \begin{describe}{sym}{it}
74 \end{describe}
75
76 \begin{describe}{mac}{aif @<condition> @<consequent> @[@<alt>@]}
77 \end{describe}
78
79 \begin{describe}{mac}{aand @<form>^*}
80 \end{describe}
81
82 \begin{describe}{mac}{awhen @<condition> @<form>^*}
83 \end{describe}
84
85 \begin{describe}{mac}{acond @{ (@<condition> @<form>^*) @}^*}
86 \end{describe}
87
88 \begin{describe*}
89 {\dhead{mac}
90 {acase @<scrutinee> @{ (@{ @<case> @! (@<case>^*) @} @<form>^*) @}^*}
91 \dhead{mac}
92 {aecase @<scrutinee> @{ (@{ @<case> @! (@<case>^*) @} @<form>^*) @}^*}
93 \dhead{mac}{atypecase @<scrutinee> @{ (@<type> @<form>^*) @}^*}
94 \dhead{mac}{aetypecase @<scrutinee> @{ (@<type> @<form>^*) @}^*}}
95 \end{describe*}
96
97 \begin{describe}{mac}{asetf @{ @<place> @<value> @}^*}
98 \end{describe}
99
100 \begin{describe}{gf}{instance-initargs @<instance>}
101 \end{describe}
102
103 \begin{describe*}
104 {\dhead{fun}{copy-instance @<instance> \&rest @<initargs>}
105 \dhead{gf}{copy-instance-using-class @<class> @<instance>
106 \&rest @<initargs>}}
107 \end{describe*}
108
109 \begin{describe*}
110 {\dhead{gf}{generic-function-methods @<generic-function> @> @<list>}
111 \dhead{gf}{method-specializers @<method> @> @<list>}
112 \dhead{cls}{eql-specializer}
113 \dhead{gf}{eql-specializer-object @<specializer> @> @<value>}}
114 \end{describe*}
115
116 \begin{describe}{fun}{make-list-builder \&optional @<initial> @> @<builder>}
117 \end{describe}
118
119 \begin{describe}{fun}{lbuild-add @<builder> @<item> @> @<builder>}
120 \end{describe}
121
122 \begin{describe}{fun}{lbuild-add-list @<builder> @<list> @> @<builder>}
123 \end{describe}
124
125 \begin{describe}{fun}{lbuild-list @<builder> @> @<list>}
126 \end{describe}
127
128 \begin{describe}{fun}
129 {mappend @<function> @<list> \&rest @<more-lists> @> @<result-list>}
130 \end{describe}
131
132 \begin{describe}{cls}{inconsistent-merge-error (error) \&key :candidates}
133 \end{describe}
134
135 \begin{describe}{gf}{merge-error-candidates @<error> @> @<list>}
136 \end{describe}
137
138 \begin{describe}{fun}
139 {merge-lists @<lists> \&key :pick (:test \#'eql) :present @> @<list>}
140 \end{describe}
141
142 \begin{describe}{mac}
143 {categorize (\=@<item-var> @<items>
144 @[[ :bind (@{ @<var> @!
145 (@<var> @[@<value>@]) @}^*) @]])
146 \\ \ind\ind
147 (@{ (@<cat-var> @<cat-predicate>) @}^*) \-\\
148 @<declaration>^* \\
149 @<form>^*
150 \-\nlret @<value>^*}
151 \end{describe}
152
153 \begin{describe}{fun}
154 {frob-identifier @<string> \&key :swap-case :swap-hyphen
155 @> @<frobbed-string>}
156 \end{describe}
157
158 \begin{describe}{fun}{whitespace-char-p @<character> @> @<generic-function>}
159 \end{describe}
160
161 \begin{describe}{fun}
162 {update-position @<character> @<line> @<column>
163 @> @<new-line> @<new-column>}
164 \end{describe}
165
166 \begin{describe}{fun}
167 {backtrack-position @<character> @<line> @<column>
168 @> @<old-line> @<old-column>}
169 \end{describe}
170
171 \begin{describe}{fun}
172 {compose @<function> \&rest @<more-functions> @> @<function>}
173 \end{describe}
174
175 \begin{describe}{fun}{symbolicate \&rest @<symbols> @> @<symbol>}
176 \end{describe}
177
178 \begin{describe}{mac}
179 {maybe-print-unreadable-object
180 (@<object> @<stream>
181 @[[ :type @<type> @!
182 :identity @<identity> @]]) \\ \ind
183 @<declaration>^* \\
184 @<form>^*}
185 \end{describe}
186
187 \begin{describe}{fun}{print-ugly-stuff @<stream> @<func> @> @<value>^*}
188 \end{describe}
189
190 \begin{describe}{mac}
191 {dosequence (@<var> @<sequence>
192 @[[ :start @<start> @! :end @<end> @!
193 :indexvar @<var> @]]) \\ \ind
194 @<declaration>^* \\
195 @{ @<tag> @! @<statement> @}^*}
196 \end{describe}
197
198 \begin{describe}{mac}
199 {define-access-wrapper @<from> @<to>
200 @[[ :read-only @<read-only-flag> @]]}
201 \end{describe}
202
203 \begin{describe}{fun}
204 {designated-condition
205 \=@<default-type> @<datum> @<arguments> \\
206 \>\&key :allow-pointless-arguments
207 \nlret @<condition>}
208 \end{describe}
209
210 \begin{describe}{mac}
211 {default-slot (@<instance> @<slot> @[@<slot-names>@]) \\ \ind
212 @<form>^*}
213 \end{describe}
214
215 \begin{describe}{mac}
216 {define-on-demand-slot @<class> @<slot> (@<instance>) \\ \ind
217 @[[ @<declaration>^* @! @<doc-string> @]] \\
218 @<form>^*}
219 \end{describe}
220
221 %%%--------------------------------------------------------------------------
222 \section{Condition utilities} \label{sec:misc.condition}
223
224 These symbols are defined in the @|sod-parser| package.
225
226 \begin{describe}{cls}{enclosing-condition (condition) \&key :condition}
227 \end{describe}
228
229 \begin{describe}{gf}
230 {enclosed-condition @<enclosing-condition> @> @<condition>}
231 \end{describe}
232
233 \begin{describe}{cls}{information (condition) \&key}
234 \end{describe}
235
236 \begin{describe}{cls}
237 {simple-information (simple-condition information) \\ \ind
238 \&key :format-control :format-arguments}
239 \end{describe}
240
241 \begin{describe}{fun}{info @<datum> \&rest @<arguments> @> @<flag>}
242 \end{describe}
243
244 \begin{describe}{rst}{noted}
245 \end{describe}
246
247 \begin{describe}{fun}{cerror* @<datum> \&rest @<arguments>}
248 \end{describe}
249
250 %%%--------------------------------------------------------------------------
251 \section{Option parser} \label{sec:misc.optparse}
252
253 These symbols are defined in the @!optparse| package.
254
255 \begin{describe}{fun}{exit \&optional (@<code> 0) \&key :abrupt}
256 \end{describe}
257
258 \begin{describe}{var}{*program-name*}
259 \end{describe}
260
261 \begin{describe}{var}{*command-line*}
262 \end{describe}
263
264 \begin{describe}{fun}{set-command-line-arguments}
265 \end{describe}
266
267 \begin{describe}{fun}{moan @<format-string> \&rest @<format-args>}
268 \end{describe}
269
270 \begin{describe}{fun}{die @<format-string> \&rest @<format-args>}
271 \end{describe}
272
273 \begin{describe}{var}{*options*}
274 \end{describe}
275
276 \begin{describe}{cls}{option}
277 \end{describe}
278
279 \begin{describe}{fun}{optionp @<object> @> @<generalized-boolean>}
280 \end{describe}
281
282 \begin{describe}{fun}
283 {make-option \=@<long-name> @<short-name> \+\\
284 \&optional @<arg-name> \\
285 \&key :tag :negated-tag
286 :arg-optional-p :documentation \-
287 \nlret @<option>}
288 \end{describe}
289
290 \begin{describe*}
291 {\dhead{fun}{opt-short-name @<option> @> @<character-or-null>}
292 \dhead{fun}{setf (opt-short-name @<option>) @<character-or-null>}
293 \dhead{fun}{opt-long-name @<option> @> @<string-or-null>}
294 \dhead{fun}{setf (opt-long-name @<option>) @<string-or-null>}
295 \dhead{fun}{opt-tag @<option> @> @<tag>}
296 \dhead{fun}{setf (opt-tag @<option>) @<tag>}
297 \dhead{fun}{opt-negated-tag @<option> @> @<tag>}
298 \dhead{fun}{setf (opt-negated-tag @<option>) @<tag>}
299 \dhead{fun}{opt-arg-name @<option> @> @<string-or-null>}
300 \dhead{fun}{setf (opt-arg-name @<option>) @<string-or-null>}
301 \dhead{fun}{opt-optional-p @<option> @> @<generalized-boolean>}
302 \dhead{fun}{setf (opt-optional-p @<option>) @<generalized-boolean>}
303 \dhead{fun}{opt-documentation @<option> @> @<string-or-null>}
304 \dhead{fun}{setf (opt-documentation @<option>) @<string-or-null>}}
305 \end{describe*}
306
307 \begin{describe}{cls}{option-parser}
308 \end{describe}
309
310 \begin{describe}{fun}{option-parser-p @<object> @> @<generalized-boolean>}
311 \end{describe}
312
313 \begin{describe}{fun}
314 {make-option-parser \&key \=:args :options :non-option :numericp \+ \\
315 :negated-numeric-p long-only-p \-
316 \nlret @<option-parser>}
317 \end{describe}
318
319 \begin{describe*}
320 {\dhead{fun}{op-options @<option-parser> @> @<list>}
321 \dhead{fun}{setf (op-options @<option-parser>) @<list>}
322 \dhead{fun}{op-non-option @<option-parser> @> @<action>}
323 \dhead{fun}{setf (op-non-option @<option-parser>) @<action>}
324 \dhead{fun}{op-long-only-p @<option-parser> @> @<generalized-boolean>}
325 \dhead{fun}{setf (op-long-only-p @<option-parser>) @<generalized-boolean>}
326 \dhead{fun}{op-numeric-p @<option-parser> @> @<generalized-boolean>}
327 \dhead{fun}{setf (op-numeric-p @<option-parser>) @<generalized-boolean>}
328 \dhead{fun}{op-negated-numeric-p @<option-parser> @<generalized-boolean>}
329 \dhead{fun}{setf (op-negated-numeric-p @<option-parser>) @<generalized-boolean>}
330 \dhead{fun}{op-negated-p @<option-parser> @> @<generalized-boolean>}
331 \dhead{fun}{setf (op-negated-p @<option-parser>) @<generalized-boolean>}}
332 \end{describe*}
333
334 \begin{describe}{cls}
335 {option-parse-error (error simple-condition)
336 \&key :format-control :format-arguments}
337 \end{describe}
338
339 \begin{describe}{fun}{option-parse-remainder @<option-parser>}
340 \end{describe}
341
342 \begin{describe}{fun}{option-parse-return @<tag> \&optional @<argument>}
343 \end{describe}
344
345 \begin{describe}{fun}{option-parse-next @<option-parser>}
346 \end{describe}
347
348 \begin{describe}{mac}{option-parse-try @<form>^*}
349 \end{describe}
350
351 \begin{describe}{mac}{with-unix-error-reporting () @<form>^*}
352 \end{describe}
353
354 \begin{describe}{mac}
355 {defopthandler @<name> (@<var> @[@<arg>@]) @<lambda-list> \\ \ind
356 @[[ @<declaration>^* @! @<doc-string> @]] \\
357 @<form>^*}
358 \end{describe}
359
360 \begin{describe}{fun}
361 {invoke-option-handler @<handler> @<locative> @<arg> @<arguments>}
362 \end{describe}
363
364 \begin{describe}{opt}{set \&optional @<value>}
365 \end{describe}
366
367 \begin{describe}{opt}{clear \&optional @<value>}
368 \end{describe}
369
370 \begin{describe}{opt}{inc \&optional @<maximum> @<step>}
371 \end{describe}
372
373 \begin{describe}{opt}{dec \&optional <minimum> <step>}
374 \end{describe}
375
376 \begin{describe}{opt}{read}
377 \end{describe}
378
379 \begin{describe}{opt}{int \&key :radix :min :max}
380 \end{describe}
381
382 \begin{describe}{opt}{string}
383 \end{describe}
384
385 \begin{describe}{opt}{keyword \&optional @<valid>}
386 \end{describe}
387
388 \begin{describe}{opt}{list \&optional @<handler> \&rest @<handler-args>}
389 \end{describe}
390
391 \begin{describe}{mac}
392 {defoptmacro @<name> @<lambda-list> \\ \ind
393 @[[ @<declaration>^* @! @<doc-string> @]] \\
394 @<form>^*}
395 \end{describe}
396
397 \begin{describe}{fun}{parse-option-form @<form>}
398 \end{describe}
399
400 \begin{describe}{mac}
401 {options @{ \=@<string> @! \+ \\
402 @<option-macro> @! (@<option-macro> @<macro-arg>^*) @! \\
403 (@[[ \=@<character> @! (:short-name @<character>) @! \+ \\
404 @<string>^* @! @<symbol> @! @<rational> @!
405 (:long-name @<string>) @! \\
406 (@<string> @<format-arg>^+) @!
407 (:doc @<string> @<format-arg>^*) @! \\
408 (:arg @<arg-name>) @! (:opt-arg @<arg-name>) @! \\
409 @<keyword> @! (:tag @<tag>) @!
410 (:negated-tag @<tag>) @! \\
411 @{ (@<handler> @<var> @<handler-arg>^*) @}^*
412 @]]) @}^*}
413 \end{describe}
414
415 \begin{describe}{fun}
416 {simple-usage @<option-list> \&optional @<mandatory-args> @> @<list>}
417 \end{describe}
418
419 \begin{describe}{fun}{show-usage @<prog> @<usage> \&optional @<stream>}
420 \end{describe}
421
422 \begin{describe}{fun}
423 {show-help @<prog> @<usage> @<option-list> \&optional @<stream>}
424 \end{describe}
425
426 \begin{describe}{fun}{sanity-check-option-list @<option-list>}
427 \end{describe}
428
429 \begin{describe*}
430 {\dhead{var}{*help*}
431 \dhead{var}{*version*}
432 \dhead{var}{*usage*}}
433 \end{describe*}
434
435 \begin{describe}{fun}{do-usage \&optional @<stream>}
436 \end{describe}
437
438 \begin{describe}{fun}{die-usage}
439 \end{describe}
440
441 \begin{describe}{optmac}
442 {help-options \&key :short-help :short-version :short-usage}
443 \end{describe}
444
445 \begin{describe}{fun}
446 {define-program \&key \=:program-name \+ \\
447 :help :version :usage :full-usage \\
448 :options}
449 \end{describe}
450
451 \begin{describe}{mac}
452 {do-options (@[[ :parser @<option-parser> @]]) \\ \ind
453 @{ (@{ @<case> @! (@<case>^*)@} (@[@[@<opt-var>@] @<arg-var>@])
454 @<form>^*) @}^*}
455 \end{describe}
456
457 %%%--------------------------------------------------------------------------
458 \section{Property sets} \label{sec:misc.pset}
459
460 \begin{describe}{fun}{property-key @<name> @> @<keyword>}
461 \end{describe}
462
463 \begin{describe}{gf}{decode-property @<raw-value> @> @<type> @<value>}
464 \end{describe}
465
466 \begin{describe}{cls}{property}
467 \end{describe}
468
469 \begin{describe}{fun}{propertyp @<object> @> @<generalized-boolean>}
470 \end{describe}
471
472 \begin{describe}{fun}
473 {make-property @<name> @<raw-value> \&key :type :location :seenp}
474 \end{describe}
475
476 \begin{describe*}
477 {\dhead{fun}{p-name @<property> @> @<name>}
478 \dhead{fun}{p-value @<property> @> @<value>}
479 \dhead{fun}{p-type @<property> @> @<type>}
480 \dhead{fun}{p-key @<property> @> @<symbol>}
481 \dhead{fun}{p-seenp @<property> @> @<boolean>}
482 \dhead{fun}{setf (p-seenp @<property>) @<boolean>}}
483 \end{describe*}
484
485 \begin{describe}{gf}{decode-property @<raw-value> @> @<type> @<value>}
486 \end{describe}
487
488 \begin{describe}{gf}
489 {coerce-property-value @<value> @<type> @<wanted> @> @<coerced-value>}
490 \end{describe}
491
492 \begin{describe}{cls}{pset}
493 \end{describe}
494
495 \begin{describe}{fun}{psetp @<object> @> @<generalized-boolean>}
496 \end{describe}
497
498 \begin{describe}{fun}{make-pset @> @<pset>}
499 \end{describe}
500
501 \begin{describe}{fun}{pset-get @<pset> @<key> @> @<property-or-nil>}
502 \end{describe}
503
504 \begin{describe}{fun}{pset-store @<pset> @<property> @> @<property>}
505 \end{describe}
506
507 \begin{describe}{fun}{pset-map @<func> @<pset>}
508 \end{describe}
509
510 \begin{describe}{mac}
511 {with-pset-iterator (@<iter> @<pset>) @<declaration>^* @<form>^*}
512 \end{describe}
513
514 \begin{describe}{fun}
515 {store-property @<pset> @<name> @<value> \&key :type :location
516 @> @<property>}
517 \end{describe}
518
519 \begin{describe}{fun}
520 {get-property @<pset> @<name> @<type> \&optional @<default>
521 @> @<value> @<floc-or-nil>}
522 \end{describe}
523
524 \begin{describe}{fun}
525 {add-property @<pset> @<name> @<value> \&key :type :location
526 @> @<property>}
527 \end{describe}
528
529 \begin{describe}{fun}{make-property-set \&rest @<plist> @> @<pset>}
530 \end{describe}
531
532 \begin{describe}{gf}{property-set @<thing> @> @<pset>}
533 \end{describe}
534
535 \begin{describe}{fun}{check-unused-properties @<pset>}
536 \end{describe}
537
538 \begin{describe}{mac}
539 {default-slot-from-property
540 (@<instance> @<slot> @[@<slot-names>@]) \\ \ind\ind
541 (@<pset> @<property> @<type> @[@<prop-var> @<convert-form>^*@]) \- \\
542 @<declaration>^* \\
543 @<default-form>^*}
544 \end{describe}
545
546 \begin{describe}{fun}
547 {parse-property @<scanner> @<pset>
548 @> @<result> @<success-flag> @<consumed-flag>}
549 \end{describe}
550
551 \begin{describe}{fun}
552 {parse-property-set @<scanner>
553 @> @<result> @<success-flag> @<consumed-flag>}
554 \end{describe}
555
556 %%%--------------------------------------------------------------------------
557 \section{Miscellaneous translator features} \label{sec:misc.pset}
558
559 \begin{describe}{var}{*sod-version*}
560 \end{describe}
561
562 \begin{describe}{var}{*debugout-pathname*}
563 \end{describe}
564
565 \begin{describe}{fun}{test-module @<path> @<reason>}
566 \end{describe}
567
568 \begin{describe}{fun}
569 {test-parse-c-type @<string>
570 @> t @<c-type> @<kernel> @<string> @! nil @<indicator>}
571 \end{describe}
572
573 \begin{describe}{mac}
574 {test-parser (@<scanner> \&key :backtrace) @<parser> @<input>
575 @> @<result> @<status> @<remainder>}
576 \end{describe}
577
578 \begin{describe}{fun}{exercise}
579 \end{describe}
580
581 \begin{describe}{fun}{sod-frontend:main}
582 \end{describe}
583
584 %%%----- That's all, folks --------------------------------------------------
585
586 %%% Local variables:
587 %%% mode: LaTeX
588 %%% TeX-master: "sod.tex"
589 %%% TeX-PDF-mode: t
590 %%% End: