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