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