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