3 %%% Miscellaneous functionality
5 %%% (c) 2015 Straylight/Edgeware
8 %%%----- Licensing notice ---------------------------------------------------
10 %%% This file is part of the Sensble Object Design, an object system for C.
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.
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.
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.
26 \chapter{Miscellaneous functionality
} \label{ch:misc
}
28 %%%--------------------------------------------------------------------------
29 \section{Utilities
} \label{sec:misc.utilities
}
31 These symbols are defined in the @|sod-utilities| package.
34 {with-gensyms (@
{ @<var> @! (@<var> @
[@<name>@
]) @
}^*) \\
\ind
39 {once-only (@
[[ :environment @<env> @
]]
40 @
{ @<var> @! (@<var> @
[@<value-form>@
]) @
}^*) \\
\ind
45 {parse-body @<body> @> @<doc-string> @<declarations> @<body-forms>
}
48 \begin{describe
}{cls
}{loc
}
51 \begin{describe
}{fun
}{locp @<object> @> @<generalized-boolean>
}
54 \begin{describe
}{macro
}{locf @<place> @> @<locative>
}
58 {\dhead{fun
}{ref @<locative> @> @<value>
}
59 \dhead{fun
}{setf (ref @<locative>) @<value>
}}
64 @
{ @<var> @! (@
{ @<var> @!
65 (@<var> @
[@<locative>@
]) @
}^*) @
} \\
\ind
69 \begin{describe
}{sym
}{it
}
72 \begin{describe
}{mac
}{aif @<condition> @<consequent> @
[@<alt>@
]}
75 \begin{describe
}{mac
}{awhen @<condition> @<body-form>^*
}
78 \begin{describe
}{mac
}{acond @
{ (@<condition> @<form>^*) @
}^*
}
83 {acase @<scrutinee> @
{ (@
{ @<case> @! (@<case>^*) @
} @<form>^*) @
}^*
}
85 {aecase @<scrutinee> @
{ (@
{ @<case> @! (@<case>^*) @
} @<form>^*) @
}^*
}
86 \dhead{mac
}{atypecase @<scrutinee> @
{ (@<type> @<form>^*) @
}^*
}
87 \dhead{mac
}{aetypecase @<scrutinee> @
{ (@<type> @<form>^*) @
}^*
}}
90 \begin{describe
}{mac
}{asetf @
{ @<place> @<value> @
}^*
}
93 \begin{describe
}{gf
}{instance-initargs @<instance>
}
97 {\dhead{fun
}{copy-instance @<instance> \&rest @<initargs>
}
98 \dhead{gf
}{copy-instance-using-class @<class> @<instance>
103 {\dhead{gf
}{generic-function-methods @<generic-function> @> @<list>
}
104 \dhead{gf
}{method-specializers @<method> @> @<list>
}
105 \dhead{cls
}{eql-specializer
}
106 \dhead{gf
}{eql-specializer-object @<specializer> @> @<value>
}}
109 \begin{describe
}{fun
}{make-list-builder \&optional @<initial> @> @<builder>
}
112 \begin{describe
}{fun
}{lbuild-add @<builder> @<item> @> @<builder>
}
115 \begin{describe
}{fun
}{lbuild-add-list @<builder> @<list> @> @<builder>
}
118 \begin{describe
}{fun
}{lbuild-list @<builder> @> @<list>
}
121 \begin{describe
}{fun
}
122 {mappend @<function> @<list> \&rest @<more-lists> @> @<result-list>
}
125 \begin{describe
}{cls
}{inconsistent-merge-error (error) \&key :candidates
}
128 \begin{describe
}{gf
}{merge-error-candidates @<error> @> @<list>
}
131 \begin{describe
}{fun
}
132 {merge-lists @<lists> \&key :pick (:test \#'eql) @> @<list>
}
135 \begin{describe
}{mac
}
136 {categorize (\=@<item-var> @<items>
137 @
[[ :bind (@
{ @<var> @! (@<var> @
[@<value>@
]) @
}^*) @
]])
139 (@
{ @<cat-var> @<cat-predicate> @
}^*) \- \\
144 \begin{describe
}{fun
}
145 {frob-identifier @<string> \&key :swap-case :swap-hyphen
146 @> @<frobbed-string>
}
149 \begin{describe
}{fun
}{whitespace-char-p @<character> @> @<generic-function>
}
152 \begin{describe
}{fun
}
153 {update-position @<character> @<line> @<column>
154 @> @<new-line> @<new-column>
}
157 \begin{describe
}{fun
}
158 {backtrack-position @<character> @<line> @<column>
159 @> @<old-line> @<old-column>
}
162 \begin{describe
}{fun
}
163 {compose @<function> \&rest @<more-functions> @> @<function>
}
166 \begin{describe
}{fun
}{symbolicate \&rest @<symbols> @> @<symbol>
}
169 \begin{describe
}{mac
}
170 {maybe-print-unreadable-object (@<object> @<stream>
172 :identity @<identity> @
]]) \\
\ind
176 \begin{describe
}{mac
}
177 {dosequence (@<var> @<sequence>
178 @
[[ :start @<start> @! :end @<end> @!
179 :indexvar @<var> @
]]) \\
\ind
180 @
{ @<tag> @! @<body-form> @
}^*
}
183 \begin{describe
}{mac
}
184 {define-access-wrapper @<from> @<to>
185 @
[[ :read-only @<read-only-flag> @
]]}
188 \begin{describe
}{mac
}
189 {default-slot (@<instance> @<slot> @
[@<slot-names>@
]) \\
\ind
193 \begin{describe
}{mac
}
194 {define-on-demand-slot @<class> @<slot> (@<instance>) \\
\ind
198 %%%--------------------------------------------------------------------------
199 \section{Condition utilities
} \label{sec:misc.condition
}
201 These symbols are defined in the @|sod-parser| package.
203 \begin{describe
}{cls
}{enclosing-condition (condition) \&key :condition
}
207 {enclosed-condition @<enclosing-condition> @> @<condition>
}
210 \begin{describe
}{fun
}{cerror* @<datum> \&rest @<arguments>
}
213 %%%--------------------------------------------------------------------------
214 \section{Option parser
} \label{sec:misc.optparse
}
216 These symbols are defined in the @!optparse| package.
218 \begin{describe
}{fun
}{exit \&optional (@<code>
0) \&key :abrupt
}
221 \begin{describe
}{var
}{*program-name*
}
224 \begin{describe
}{var
}{*command-line*
}
227 \begin{describe
}{fun
}{set-command-line-arguments
}
230 \begin{describe
}{fun
}{moan @<format-string> \&rest @<format-args>
}
233 \begin{describe
}{fun
}{die @<format-string> \&rest @<format-args>
}
236 \begin{describe
}{var
}{*options*
}
239 \begin{describe
}{cls
}{option
}
242 \begin{describe
}{fun
}{optionp @<object> @> @<generalized-boolean>
}
245 \begin{describe
}{fun
}
246 {make-option \=@<long-name> @<short-name> \+ \\
247 \&optional @<arg-name> \\
248 \&key :tag :negated-tag :arg-optional-p :documentation \-
253 {\dhead{fun
}{opt-short-name @<option> @> @<character-or-null>
}
254 \dhead{fun
}{setf (opt-short-name @<option>) @<character-or-null>
}
255 \dhead{fun
}{opt-long-name @<option> @> @<string-or-null>
}
256 \dhead{fun
}{setf (opt-long-name @<option>) @<string-or-null>
}
257 \dhead{fun
}{opt-tag @<option> @> @<tag>
}
258 \dhead{fun
}{setf (opt-tag @<option>) @<tag>
}
259 \dhead{fun
}{opt-negated-tag @<option> @> @<tag>
}
260 \dhead{fun
}{setf (opt-negated-tag @<option>) @<tag>
}
261 \dhead{fun
}{opt-arg-name @<option> @> @<string-or-null>
}
262 \dhead{fun
}{setf (opt-arg-name @<option>) @<string-or-null>
}
263 \dhead{fun
}{opt-optional-p @<option> @> @<generalized-boolean>
}
264 \dhead{fun
}{setf (opt-optional-p @<option>) @<generalized-boolean>
}
265 \dhead{fun
}{opt-documentation @<option> @> @<string-or-null>
}
266 \dhead{fun
}{setf (opt-documentation @<option>) @<string-or-null>
}}
269 \begin{describe
}{cls
}{option-parser
}
272 \begin{describe
}{fun
}{option-parser-p @<object> @> @<generalized-boolean>
}
275 \begin{describe
}{fun
}
276 {make-option-parser \&key \=:args :options :non-option :numericp \+ \\
277 :negated-numeric-p long-only-p \-
278 \nlret @<option-parser>
}
282 {\dhead{fun
}{op-options @<option-parser> @> @<list>
}
283 \dhead{fun
}{setf (op-options @<option-parser>) @<list>
}
284 \dhead{fun
}{op-non-option @<option-parser> @> @<action>
}
285 \dhead{fun
}{setf (op-non-option @<option-parser>) @<action>
}
286 \dhead{fun
}{op-long-only-p @<option-parser> @> @<generalized-boolean>
}
287 \dhead{fun
}{setf (op-long-only-p @<option-parser>) @<generalized-boolean>
}
288 \dhead{fun
}{op-numeric-p @<option-parser> @> @<generalized-boolean>
}
289 \dhead{fun
}{setf (op-numeric-p @<option-parser>) @<generalized-boolean>
}
290 \dhead{fun
}{op-negated-numeric-p @<option-parser> @<generalized-boolean>
}
291 \dhead{fun
}{setf (op-negated-numeric-p @<option-parser>) @<generalized-boolean>
}
292 \dhead{fun
}{op-negated-p @<option-parser> @> @<generalized-boolean>
}
293 \dhead{fun
}{setf (op-negated-p @<option-parser>) @<generalized-boolean>
}}
296 \begin{describe
}{cls
}
297 {option-parse-error (error simple-condition)
298 \&key :format-control :format-arguments
}
301 \begin{describe
}{fun
}{option-parse-remainder @<option-parser>
}
304 \begin{describe
}{fun
}{option-parse-return @<tag> \&optional @<argument>
}
307 \begin{describe
}{fun
}{option-parse-next @<option-parser>
}
310 \begin{describe
}{mac
}{option-parse-try @<body-form>^*
}
313 \begin{describe
}{mac
}{with-unix-error-reporting () @<body-form>^*
}
316 \begin{describe
}{mac
}
317 {defopthandler @<name> (@<var> @
[@<arg>@
]) @<lambda-list> \\
\ind
321 \begin{describe
}{fun
}
322 {invoke-option-handler @<handler> @<locative> @<arg> @<arguments>
}
325 \begin{describe
}{opt
}{set \&optional @<value>
}
328 \begin{describe
}{opt
}{clear \&optional @<value>
}
331 \begin{describe
}{opt
}{inc \&optional @<maximum> @<step>
}
334 \begin{describe
}{opt
}{dec \&optional <minimum> <step>
}
337 \begin{describe
}{opt
}{read
}
340 \begin{describe
}{opt
}{int \&key :radix :min :max
}
343 \begin{describe
}{opt
}{string
}
346 \begin{describe
}{opt
}{keyword \&optional @<valid>
}
349 \begin{describe
}{opt
}{list \&optional @<handler> \&rest @<handler-args>
}
352 \begin{describe
}{mac
}{defoptmacro @<name> @<lambda-list> @<body-form>^*
}
355 \begin{describe
}{fun
}{parse-option-form @<form>
}
358 \begin{describe
}{mac
}
359 {options @
{ \=@<string> @! \+ \\
360 @<option-macro> @! (@<option-macro> @<macro-arg>^*) @! \\
361 (@
[[ \=@<character> @! (:short-name @<character>) @! \+ \\
362 @<string>^* @! @<symbol> @! @<rational> @!
363 (:long-name @<string>) @! \\
364 (@<string> @<format-arg>^+) @!
365 (:doc @<string> @<format-arg>^*) @! \\
366 (:opt-arg @<arg-name>) @! \\
367 @<keyword> @! (:tag @<tag>) @!
368 (:negated-tag @<tag>) @! \\
369 @
{ (@<handler> @<var> @<handler-arg>^*) @
}^* @
]]) @
}^*
}
372 \begin{describe
}{fun
}
373 {simple-usage @<option-list> \&optional @<mandatory-args> @> @<list>
}
376 \begin{describe
}{fun
}{show-usage @<prog> @<usage> \&optional @<stream>
}
379 \begin{describe
}{fun
}
380 {show-help @<prog> @<usage> @<option-list> \&optional @<stream>
}
383 \begin{describe
}{fun
}{sanity-check-option-list @<option-list>
}
388 \dhead{var
}{*version*
}
389 \dhead{var
}{*usage*
}}
392 \begin{describe
}{fun
}{do-usage \&optional @<stream>
}
395 \begin{describe
}{fun
}{die-usage
}
398 \begin{describe
}{optmac
}
399 {help-options \&key :short-help :short-version :short-usage
}
402 \begin{describe
}{fun
}
403 {define-program \&key \=:program-name \+ \\
404 :help :version :usage :full-usage \\
408 \begin{describe
}{mac
}
409 {do-options (@
[[ :parser @<option-parser> @
]]) \\
\ind
410 @
{ (@
{ @<case> @! (@<case>^*)@
} (@
[@
[@<opt-var>@
] @<arg-var>@
])
414 %%%--------------------------------------------------------------------------
415 \section{Property sets
} \label{sec:misc.pset
}
417 \begin{describe
}{fun
}{property-key @<name> @> @<keyword>
}
420 \begin{describe
}{gf
}{decode-property @<raw-value> @> @<type> @<value>
}
423 \begin{describe
}{cls
}{property
}
426 \begin{describe
}{fun
}{propertyp @<object> @> @<generalized-boolean>
}
429 \begin{describe
}{fun
}
430 {make-property @<name> @<raw-value> \&key :type :location :seenp
}
434 {\dhead{fun
}{p-name @<property> @> @<name>
}
435 \dhead{fun
}{setf (p-name @<property>) @<name>
}
436 \dhead{fun
}{p-value @<property> @> @<value>
}
437 \dhead{fun
}{setf (p-value @<property>) @<value>
}
438 \dhead{fun
}{p-type @<property> @> @<type>
}
439 \dhead{fun
}{setf (p-type @<property>) @<type>
}
440 \dhead{fun
}{p-key @<property> @> @<symbol>
}
441 \dhead{fun
}{setf (p-key @<property>) @<symbol>
}
442 \dhead{fun
}{p-seenp @<property> @> @<boolean>
}
443 \dhead{fun
}{setf (p-seenp @<property>) @<boolean>
}}
446 \begin{describe
}{gf
}{decode-property @<raw-value> @> @<type> @<value>
}
450 {coerce-property-value @<value> @<type> @<wanted> @> @<coerced-value>
}
453 \begin{describe
}{cls
}{pset
}
456 \begin{describe
}{fun
}{psetp @<object> @> @<generalized-boolean>
}
459 \begin{describe
}{fun
}{make-pset @> @<pset>
}
462 \begin{describe
}{fun
}{pset-get @<pset> @<key> @> @<property-or-nil>
}
465 \begin{describe
}{fun
}{pset-store @<pset> @<property> @> @<property>
}
468 \begin{describe
}{fun
}{pset-map @<func> @<pset>
}
471 \begin{describe
}{mac
}{with-pset-iterator (@<iter> @<pset>) @<body-form>^*
}
474 \begin{describe
}{fun
}
475 {store-property @<pset> @<name> @<value> \&key :type :location
479 \begin{describe
}{fun
}
480 {get-property @<pset> @<name> @<type> \&optional @<default>
481 @> @<value> @<floc-or-nil>
}
484 \begin{describe
}{fun
}
485 {add-property @<pset> @<name> @<value> \&key :type :location
489 \begin{describe
}{fun
}{make-property-set \&rest @<plist> @> @<pset>
}
492 \begin{describe
}{gf
}{property-set @<thing> @> @<pset>
}
495 \begin{describe
}{fun
}{check-unused-properties @<pset>
}
498 \begin{describe
}{mac
}
499 {default-slot-from-property
500 (@<instance> @<slot> @
[@<slot-names>@
]) \\
\ind\ind
501 (@<pset> @<property> @<type> @
[@<prop-var> @<convert-form>^*@
]) \- \\
505 \begin{describe
}{fun
}
506 {parse-property-set @<scanner>
507 @> @<result> @<success-flag> @<consumed-flag>
}
510 %%%--------------------------------------------------------------------------
511 \section{Miscellaneous translator features
} \label{sec:misc.pset
}
513 \begin{describe
}{var
}{*sod-version*
}
516 \begin{describe
}{var
}{*debugout-pathname*
}
519 \begin{describe
}{fun
}{test-module @<path> @<reason>
}
522 \begin{describe
}{fun
}{exercise
}
525 \begin{describe
}{fun
}{sod-frontend:main
}
528 %%%----- That's all, folks --------------------------------------------------
532 %%% TeX-master: "sod.tex"