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