| 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 Sensble 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 | @<body-form>^*} |
| 36 | \end{describe} |
| 37 | |
| 38 | \begin{describe}{mac} |
| 39 | {once-only (@[[ :environment @<env> @]] |
| 40 | @{ @<var> @! (@<var> @[@<value-form>@]) @}^*) \\ \ind |
| 41 | @<body-form>^*} |
| 42 | \end{describe} |
| 43 | |
| 44 | \begin{describe}{mac} |
| 45 | {parse-body @<body> @> @<doc-string> @<declarations> @<body-forms>} |
| 46 | \end{describe} |
| 47 | |
| 48 | \begin{describe}{sym}{it} |
| 49 | \end{describe} |
| 50 | |
| 51 | \begin{describe}{mac}{aif @<condition> @<consequent> @[@<alt>@]} |
| 52 | \end{describe} |
| 53 | |
| 54 | \begin{describe}{mac}{awhen @<condition> @<body-form>^*} |
| 55 | \end{describe} |
| 56 | |
| 57 | \begin{describe}{mac}{acond @{ (@<condition> @<form>^*) @}^*} |
| 58 | \end{describe} |
| 59 | |
| 60 | \begin{describe*} |
| 61 | {\dhead{mac} |
| 62 | {acase @<scrutinee> @{ (@{ @<case> @! (@<case>^*) @} @<form>^*) @}^*} |
| 63 | \dhead{mac} |
| 64 | {aecase @<scrutinee> @{ (@{ @<case> @! (@<case>^*) @} @<form>^*) @}^*} |
| 65 | \dhead{mac}{atypecase @<scrutinee> @{ (@<type> @<form>^*) @}^*} |
| 66 | \dhead{mac}{aetypecase @<scrutinee> @{ (@<type> @<form>^*) @}^*}} |
| 67 | \end{describe*} |
| 68 | |
| 69 | \begin{describe}{mac}{asetf @{ @<place> @<value> @}^*} |
| 70 | \end{describe} |
| 71 | |
| 72 | \begin{describe}{gf}{instance-initargs @<instance>} |
| 73 | \end{describe} |
| 74 | |
| 75 | \begin{describe*} |
| 76 | {\dhead{fun}{copy-instance @<instance> \&rest @<initargs>} |
| 77 | \dhead{gf}{copy-instance-using-class @<class> @<instance> |
| 78 | \&rest @<initargs>}} |
| 79 | \end{describe*} |
| 80 | |
| 81 | \begin{describe*} |
| 82 | {\dhead{gf}{generic-function-methods @<generic-function> @> @<list>} |
| 83 | \dhead{gf}{method-specializers @<method> @> @<list>} |
| 84 | \dhead{cls}{eql-specializer} |
| 85 | \dhead{gf}{eql-specializer-object @<specializer> @> @<value>}} |
| 86 | \end{describe*} |
| 87 | |
| 88 | \begin{describe}{fun}{make-list-builder \&optional @<initial> @> @<builder>} |
| 89 | \end{describe} |
| 90 | |
| 91 | \begin{describe}{fun}{lbuild-add @<builder> @<item> @> @<builder>} |
| 92 | \end{describe} |
| 93 | |
| 94 | \begin{describe}{fun}{lbuild-add-list @<builder> @<list> @> @<builder>} |
| 95 | \end{describe} |
| 96 | |
| 97 | \begin{describe}{fun}{lbuild-list @<builder> @> @<list>} |
| 98 | \end{describe} |
| 99 | |
| 100 | \begin{describe}{fun} |
| 101 | {mappend @<function> @<list> \&rest @<more-lists> @> @<result-list>} |
| 102 | \end{describe} |
| 103 | |
| 104 | \begin{describe}{cls}{inconsistent-merge-error (error) \&key :candidates} |
| 105 | \end{describe} |
| 106 | |
| 107 | \begin{describe}{gf}{merge-error-candidates @<error> @> @<list>} |
| 108 | \end{describe} |
| 109 | |
| 110 | \begin{describe}{fun} |
| 111 | {merge-lists @<lists> \&key :pick (:test \#'eql) @> @<list>} |
| 112 | \end{describe} |
| 113 | |
| 114 | \begin{describe}{mac} |
| 115 | {categorize (\=@<item-var> @<items> |
| 116 | @[[ :bind (@{ @<var> @! (@<var> @[@<value>@]) @}^*) @]]) |
| 117 | \\ \ind\ind |
| 118 | (@{ @<cat-var> @<cat-predicate> @}^*) \- \\ |
| 119 | @<body-form>^* \- |
| 120 | \nlret @<value>^*} |
| 121 | \end{describe} |
| 122 | |
| 123 | \begin{describe}{fun} |
| 124 | {frob-identifier @<string> \&key :swap-case :swap-hyphen |
| 125 | @> @<frobbed-string>} |
| 126 | \end{describe} |
| 127 | |
| 128 | \begin{describe}{fun}{whitespace-char-p @<character> @> @<generic-function>} |
| 129 | \end{describe} |
| 130 | |
| 131 | \begin{describe}{fun} |
| 132 | {update-position @<character> @<line> @<column> |
| 133 | @> @<new-line> @<new-column>} |
| 134 | \end{describe} |
| 135 | |
| 136 | \begin{describe}{fun} |
| 137 | {backtrack-position @<character> @<line> @<column> |
| 138 | @> @<old-line> @<old-column>} |
| 139 | \end{describe} |
| 140 | |
| 141 | \begin{describe}{fun} |
| 142 | {compose @<function> \&rest @<more-functions> @> @<function>} |
| 143 | \end{describe} |
| 144 | |
| 145 | \begin{describe}{fun}{symbolicate \&rest @<symbols> @> @<symbol>} |
| 146 | \end{describe} |
| 147 | |
| 148 | \begin{describe}{mac} |
| 149 | {maybe-print-unreadable-object (@<object> @<stream> |
| 150 | @[[ :type @<type> @! |
| 151 | :identity @<identity> @]]) \\ \ind |
| 152 | @<body-form>^*} |
| 153 | \end{describe} |
| 154 | |
| 155 | \begin{describe}{mac} |
| 156 | {dosequence (@<var> @<sequence> |
| 157 | @[[ :start @<start> @! :end @<end> @! |
| 158 | :indexvar @<var> @]]) \\ \ind |
| 159 | @{ @<tag> @! @<body-form> @}^*} |
| 160 | \end{describe} |
| 161 | |
| 162 | \begin{describe}{mac} |
| 163 | {define-access-wrapper @<from> @<to> |
| 164 | @[[ :read-only @<read-only-flag> @]]} |
| 165 | \end{describe} |
| 166 | |
| 167 | \begin{describe}{mac} |
| 168 | {default-slot (@<instance> @<slot> @[@<slot-names>@]) \\ \ind |
| 169 | @<body-form>^*} |
| 170 | \end{describe} |
| 171 | |
| 172 | \begin{describe}{mac} |
| 173 | {define-on-demand-slot @<class> @<slot> (@<instance>) \\ \ind |
| 174 | @<body-form>^*} |
| 175 | \end{describe} |
| 176 | |
| 177 | %%%-------------------------------------------------------------------------- |
| 178 | \section{Condition utilities} \label{sec:misc.condition} |
| 179 | |
| 180 | These symbols are defined in the @|sod-parser| package. |
| 181 | |
| 182 | \begin{describe}{cls}{enclosing-condition (condition) \&key :condition} |
| 183 | \end{describe} |
| 184 | |
| 185 | \begin{describe}{gf} |
| 186 | {enclosed-condition @<enclosing-condition> @> @<condition>} |
| 187 | \end{describe} |
| 188 | |
| 189 | \begin{describe}{fun}{cerror* @<datum> \&rest @<arguments>} |
| 190 | \end{describe} |
| 191 | |
| 192 | %%%-------------------------------------------------------------------------- |
| 193 | \section{Option parser} \label{sec:misc.optparse} |
| 194 | |
| 195 | These symbols are defined in the @!optparse| package. |
| 196 | |
| 197 | \begin{describe}{fun}{exit \&optional (@<code> 0) \&key :abrupt} |
| 198 | \end{describe} |
| 199 | |
| 200 | \begin{describe}{var}{*program-name*} |
| 201 | \end{describe} |
| 202 | |
| 203 | \begin{describe}{var}{*command-line*} |
| 204 | \end{describe} |
| 205 | |
| 206 | \begin{describe}{fun}{set-command-line-arguments} |
| 207 | \end{describe} |
| 208 | |
| 209 | \begin{describe}{cls}{loc} |
| 210 | \end{describe} |
| 211 | |
| 212 | \begin{describe}{fun}{locp @<object> @> @<generalized-boolean>} |
| 213 | \end{describe} |
| 214 | |
| 215 | \begin{describe}{macro}{locf @<place> @> @<locative>} |
| 216 | \end{describe} |
| 217 | |
| 218 | \begin{describe*} |
| 219 | {\dhead{fun}{ref @<locative> @> @<value>} |
| 220 | \dhead{fun}{setf (ref @<locative>) @<value>}} |
| 221 | \end{describe*} |
| 222 | |
| 223 | \begin{describe}{mac} |
| 224 | {with-locatives |
| 225 | @{ @<var> @! (@{ @<var> @! |
| 226 | (@<var> @[@<locative>@]) @}^*) @} \\ \ind |
| 227 | @<body-form>^*} |
| 228 | \end{describe} |
| 229 | |
| 230 | \begin{describe}{fun}{moan @<format-string> \&rest @<format-args>} |
| 231 | \end{describe} |
| 232 | |
| 233 | \begin{describe}{fun}{die @<format-string> \&rest @<format-args>} |
| 234 | \end{describe} |
| 235 | |
| 236 | \begin{describe}{var}{*options*} |
| 237 | \end{describe} |
| 238 | |
| 239 | \begin{describe}{cls}{option} |
| 240 | \end{describe} |
| 241 | |
| 242 | \begin{describe}{fun}{optionp @<object> @> @<generalized-boolean>} |
| 243 | \end{describe} |
| 244 | |
| 245 | \begin{describe}{fun} |
| 246 | {make-option \=@<long-name> @<short-name> \+ \\ |
| 247 | \&optional @<arg-name> \\ |
| 248 | \&key :tag :negated-tag :arg-optional-p :documentation \- |
| 249 | \nlret @<option>} |
| 250 | \end{describe} |
| 251 | |
| 252 | \begin{describe*} |
| 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>}} |
| 267 | \end{describe*} |
| 268 | |
| 269 | \begin{describe}{cls}{option-parser} |
| 270 | \end{describe} |
| 271 | |
| 272 | \begin{describe}{fun}{option-parser-p @<object> @> @<generalized-boolean>} |
| 273 | \end{describe} |
| 274 | |
| 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>} |
| 279 | \end{describe} |
| 280 | |
| 281 | \begin{describe*} |
| 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>}} |
| 294 | \end{describe*} |
| 295 | |
| 296 | \begin{describe}{cls} |
| 297 | {option-parse-error (error simple-condition) |
| 298 | \&key :format-control :format-arguments} |
| 299 | \end{describe} |
| 300 | |
| 301 | \begin{describe}{fun}{option-parse-remainder @<option-parser>} |
| 302 | \end{describe} |
| 303 | |
| 304 | \begin{describe}{fun}{option-parse-return @<tag> \&optional @<argument>} |
| 305 | \end{describe} |
| 306 | |
| 307 | \begin{describe}{fun}{option-parse-next @<option-parser>} |
| 308 | \end{describe} |
| 309 | |
| 310 | \begin{describe}{mac}{option-parse-try @<body-form>^*} |
| 311 | \end{describe} |
| 312 | |
| 313 | \begin{describe}{mac}{with-unix-error-reporting () @<body-form>^*} |
| 314 | \end{describe} |
| 315 | |
| 316 | \begin{describe}{mac} |
| 317 | {defopthandler @<name> (@<var> @[@<arg>@]) @<lambda-list> \\ \ind |
| 318 | @<body-form>^*} |
| 319 | \end{describe} |
| 320 | |
| 321 | \begin{describe}{fun} |
| 322 | {invoke-option-handler @<handler> @<locative> @<arg> @<arguments>} |
| 323 | \end{describe} |
| 324 | |
| 325 | \begin{describe}{opt}{set \&optional @<value>} |
| 326 | \end{describe} |
| 327 | |
| 328 | \begin{describe}{opt}{clear \&optional @<value>} |
| 329 | \end{describe} |
| 330 | |
| 331 | \begin{describe}{opt}{inc \&optional @<maximum> @<step>} |
| 332 | \end{describe} |
| 333 | |
| 334 | \begin{describe}{opt}{dec \&optional <minimum> <step>} |
| 335 | \end{describe} |
| 336 | |
| 337 | \begin{describe}{opt}{read} |
| 338 | \end{describe} |
| 339 | |
| 340 | \begin{describe}{opt}{int \&key :radix :min :max} |
| 341 | \end{describe} |
| 342 | |
| 343 | \begin{describe}{opt}{string} |
| 344 | \end{describe} |
| 345 | |
| 346 | \begin{describe}{opt}{keyword \&optional @<valid>} |
| 347 | \end{describe} |
| 348 | |
| 349 | \begin{describe}{opt}{list \&optional @<handler> \&rest @<handler-args>} |
| 350 | \end{describe} |
| 351 | |
| 352 | \begin{describe}{mac}{defoptmacro @<name> @<lambda-list> @<body-form>^*} |
| 353 | \end{describe} |
| 354 | |
| 355 | \begin{describe}{fun}{parse-option-form @<form>} |
| 356 | \end{describe} |
| 357 | |
| 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>^*) @}^* @]]) @}^*} |
| 370 | \end{describe} |
| 371 | |
| 372 | \begin{describe}{fun} |
| 373 | {simple-usage @<option-list> \&optional @<mandatory-args> @> @<list>} |
| 374 | \end{describe} |
| 375 | |
| 376 | \begin{describe}{fun}{show-usage @<prog> @<usage> \&optional @<stream>} |
| 377 | \end{describe} |
| 378 | |
| 379 | \begin{describe}{fun} |
| 380 | {show-help @<prog> @<usage> @<option-list> \&optional @<stream>} |
| 381 | \end{describe} |
| 382 | |
| 383 | \begin{describe}{fun}{sanity-check-option-list @<option-list>} |
| 384 | \end{describe} |
| 385 | |
| 386 | \begin{describe*} |
| 387 | {\dhead{var}{*help*} |
| 388 | \dhead{var}{*version*} |
| 389 | \dhead{var}{*usage*}} |
| 390 | \end{describe*} |
| 391 | |
| 392 | \begin{describe}{fun}{do-usage \&optional @<stream>} |
| 393 | \end{describe} |
| 394 | |
| 395 | \begin{describe}{fun}{die-usage} |
| 396 | \end{describe} |
| 397 | |
| 398 | \begin{describe}{optmac} |
| 399 | {help-options \&key :short-help :short-version :short-usage} |
| 400 | \end{describe} |
| 401 | |
| 402 | \begin{describe}{fun} |
| 403 | {define-program \&key \=:program-name \+ \\ |
| 404 | :help :version :usage :full-usage \\ |
| 405 | :options} |
| 406 | \end{describe} |
| 407 | |
| 408 | \begin{describe}{mac} |
| 409 | {do-options (@[[ :parser @<option-parser> @]]) \\ \ind |
| 410 | @{ (@{ @<case> @! (@<case>^*)@} (@[@[@<opt-var>@] @<arg-var>@]) |
| 411 | @<form>^*) @}^*} |
| 412 | \end{describe} |
| 413 | |
| 414 | %%%-------------------------------------------------------------------------- |
| 415 | \section{Property sets} \label{sec:misc.pset} |
| 416 | |
| 417 | %%%-------------------------------------------------------------------------- |
| 418 | \section{Miscellaneous translator features} \label{sec:misc.pset} |
| 419 | |
| 420 | \begin{describe}{var}{*sod-version*} |
| 421 | \end{describe} |
| 422 | |
| 423 | \begin{describe}{var}{*debugout-pathname*} |
| 424 | \end{describe} |
| 425 | |
| 426 | \begin{describe}{fun}{test-module @<path> @<reason>} |
| 427 | \end{describe} |
| 428 | |
| 429 | \begin{describe}{fun}{exercise} |
| 430 | \end{describe} |
| 431 | |
| 432 | %%%----- That's all, folks -------------------------------------------------- |
| 433 | |
| 434 | %%% Local variables: |
| 435 | %%% mode: LaTeX |
| 436 | %%% TeX-master: "sod.tex" |
| 437 | %%% TeX-PDF-mode: t |
| 438 | %%% End: |