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