| 1 | %%% -*-latex-*- |
| 2 | %%% |
| 3 | %%% Translation-time metaobjects |
| 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{Translation-time metaobjects} \label{ch:meta} |
| 27 | |
| 28 | %%%-------------------------------------------------------------------------- |
| 29 | \section{Base metaobject classes} \label{sec:meta.classes} |
| 30 | |
| 31 | \begin{describe}{cls} |
| 32 | {sod-class () \\ \ind |
| 33 | \&key \=:name :nick :location :pset \+\\ |
| 34 | :superclasses :link :metaclass \\ |
| 35 | :slots :instance-initializers :class-initializers \\ |
| 36 | :initargs :initfrags :tearfrags \\ |
| 37 | :messages :methods} |
| 38 | \end{describe} |
| 39 | |
| 40 | \begin{describe*} |
| 41 | {\dhead{gf}{sod-class-name @<class> @> @<string>} |
| 42 | \dhead{meth}{sod-class}{file-location (@<class> sod-class) @> @<floc>} |
| 43 | \dhead{gf}{sod-class-nickname @<class> @> @<string>} |
| 44 | \dhead{gf}{sod-class-direct-superclasses @<class> @> @<list>} |
| 45 | \dhead{gf}{sod-class-chain-link @<class> @> @<class-or-nil>} |
| 46 | \dhead{gf}{sod-class-metaclass @<class> @> @<metaclass>} |
| 47 | \dhead{gf}{sod-class-slots @<class> @> @<list>} |
| 48 | \dhead{gf}{setf (sod-class-slots @<class>) @<list>} |
| 49 | \dhead{gf}{sod-class-instance-initializers @<class> @> @<list>} |
| 50 | \dhead{gf}{setf (sod-class-instance-initializers @<class>) @<list>} |
| 51 | \dhead{gf}{sod-class-class-initializers @<class> @> @<list>} |
| 52 | \dhead{gf}{setf (sod-class-class-initializers @<class>) @<list>} |
| 53 | \dhead{gf}{sod-class-initargs @<class> @> @<list>} |
| 54 | \dhead{gf}{setf (sod-class-initargs @<class>) @<list>} |
| 55 | \dhead{gf}{sod-class-initfrags @<class> @> @<list>} |
| 56 | \dhead{gf}{setf (sod-class-initfrags @<class>) @<list>} |
| 57 | \dhead{gf}{sod-class-tearfrags @<class> @> @<list>} |
| 58 | \dhead{gf}{setf (sod-class-tearfrags @<class>) @<list>} |
| 59 | \dhead{gf}{sod-class-messages @<class> @> @<list>} |
| 60 | \dhead{gf}{setf (sod-class-messages @<class>) @<list>} |
| 61 | \dhead{gf}{sod-class-methods @<class> @> @<list>} |
| 62 | \dhead{gf}{setf (sod-class-methods @<class>) @<list>}} |
| 63 | \end{describe*} |
| 64 | |
| 65 | \begin{describe}{fun} |
| 66 | {make-sod-class @<name> @<superclasses> @<pset> \&key :location |
| 67 | @> @<class>} |
| 68 | \end{describe} |
| 69 | |
| 70 | \begin{describe}{fun} |
| 71 | {find-superclass-by-nick @<class> @<nick> @> @<superclass>} |
| 72 | \end{describe} |
| 73 | |
| 74 | \begin{describe}{ty}{inheritance-path-reporter-state} |
| 75 | \end{describe} |
| 76 | |
| 77 | \begin{describe}{fun}{make-inheritance-path-reporter-state @> @<state>} |
| 78 | \end{describe} |
| 79 | |
| 80 | \begin{describe}{fun}{report-inheritance-path @<state> @<super>} |
| 81 | \end{describe} |
| 82 | |
| 83 | \begin{describe}{fun} |
| 84 | {select-minimal-class-property |
| 85 | \=@<supers> @<key> @<order> @<default> @<what> \\ |
| 86 | \>\&key :present :allow-empty |
| 87 | \nlret @<object>} |
| 88 | \end{describe} |
| 89 | |
| 90 | \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>} |
| 91 | \end{describe} |
| 92 | |
| 93 | \begin{describe}{fun} |
| 94 | {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>} |
| 95 | \end{describe} |
| 96 | |
| 97 | \begin{describe}{fun}{valid-name-p @<name> @> @<generalized-boolean>} |
| 98 | \end{describe} |
| 99 | |
| 100 | \begin{describe}{fun}{find-root-superclass @<class> @> @<superclass>} |
| 101 | \end{describe} |
| 102 | |
| 103 | \begin{describe}{fun}{find-root-metaclass @<class> @> @<metaclass>} |
| 104 | \end{describe} |
| 105 | |
| 106 | \begin{describe}{cls}{sod-slot () \&key :name :location :pset :class :type} |
| 107 | \end{describe} |
| 108 | |
| 109 | \begin{describe*} |
| 110 | {\dhead{gf}{sod-slot-name @<slot> @> @<string>} |
| 111 | \dhead{meth}{sod-slot}{file-location (@<slot> sod-slot) @> @<floc>} |
| 112 | \dhead{gf}{sod-slot-class @<slot> @> @<class>} |
| 113 | \dhead{gf}{sod-slot-type @<slot> @> @<c-type>}} |
| 114 | \end{describe*} |
| 115 | |
| 116 | \begin{describe}{gf} |
| 117 | {make-sod-slot @<class> @<name> @<type> @<pset> \&key :location |
| 118 | @> @<slot>} |
| 119 | \end{describe} |
| 120 | |
| 121 | \begin{describe*} |
| 122 | {\dhead{fun} |
| 123 | {find-instance-slot-by-name @<class> @<super-nick> @<slot-name> |
| 124 | @> @<slot>} |
| 125 | \dhead{fun} |
| 126 | {find-class-slot-by-name @<class> @<super-nick> @<slot-name> |
| 127 | @> @<slot>}} |
| 128 | \end{describe*} |
| 129 | |
| 130 | \begin{describe}{cls} |
| 131 | {sod-class-slot (sod-slot) \\ \ind |
| 132 | \&key :name :location :pset :class :type |
| 133 | :initializer-function :prepare-function} |
| 134 | \end{describe} |
| 135 | |
| 136 | \begin{describe*} |
| 137 | {\dhead{gf}{sod-slot-initializer-function @<slot> @> @<function>} |
| 138 | \dhead{gf}{sod-slot-prepare-function @<slot> @> @<function>}} |
| 139 | \end{describe*} |
| 140 | |
| 141 | \begin{describe*} |
| 142 | {\dhead{cls}{sod-initializer () |
| 143 | \&key :slot :location :class :value} |
| 144 | \dhead{cls}{sod-instance-initializer (sod-initializer) |
| 145 | \&key :slot :location :class :value} |
| 146 | \dhead{cls}{sod-class-initializer (sod-initializer) |
| 147 | \&key :slot :location :class :value}} |
| 148 | \end{describe*} |
| 149 | |
| 150 | \begin{describe*} |
| 151 | {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>} |
| 152 | \dhead{meth}{sod-initializer} |
| 153 | {file-location (@<init> sod-initializer) @> @<floc>} |
| 154 | \dhead{gf}{sod-initializer-value @<init> @> @<fragment>} |
| 155 | \dhead{gf}{sod-initializer-class @<init> @> @<class>}} |
| 156 | \end{describe*} |
| 157 | |
| 158 | \begin{describe*} |
| 159 | {\dhead{gf} |
| 160 | {make-sod-instance-initializer |
| 161 | \=@<class> @<nick> @<name> @<value> @<pset> \\ |
| 162 | \>\&key :inhibit-initargs :location :add-to-class |
| 163 | \nlret @<init>} |
| 164 | \dhead{gf} |
| 165 | {make-sod-class-initializer |
| 166 | \=@<class> @<nick> @<name> @<value> @<pset> \\ |
| 167 | \>\&key :location :add-to-class |
| 168 | \nlret @<init>}} |
| 169 | \end{describe*} |
| 170 | |
| 171 | \begin{describe}{gf} |
| 172 | {make-sod-initializer-using-slot |
| 173 | @<class> @<slot> @<init-class> @<value> @<pset> @<floc> |
| 174 | \nlret @<init>} |
| 175 | \end{describe} |
| 176 | |
| 177 | \begin{describe*} |
| 178 | {\dhead{cls}{sod-initarg () \&key :class :location :name :type} |
| 179 | \dhead{cls}{sod-user-initarg (sod-initarg) |
| 180 | \&key :class :location :name :type :default} |
| 181 | \dhead{cls}{sod-slot-initarg (sod-initarg) |
| 182 | \&key :class :location :name :type :slot}} |
| 183 | \end{describe*} |
| 184 | |
| 185 | \begin{describe*} |
| 186 | {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>} |
| 187 | \dhead{gf}{sod-initarg-name @<initarg> @> @<string>} |
| 188 | \dhead{gf}{sod-initarg-type @<initarg> @> @<c-type>} |
| 189 | \dhead{gf}{sod-initarg-default @<initarg> @> @<default>} |
| 190 | \dhead{gf}{sod-initarg-slot @<initarg> @> @<slot>}} |
| 191 | \end{describe*} |
| 192 | |
| 193 | \begin{describe}{gf}{sod-initarg-argument @<initarg> @> @<argument>} |
| 194 | \end{describe} |
| 195 | |
| 196 | \begin{describe}{gf} |
| 197 | {make-sod-user-initarg @<class> @<name> @<type> @<pset> |
| 198 | \&key :default :location |
| 199 | \nlret @<initarg>} |
| 200 | \end{describe} |
| 201 | |
| 202 | \begin{describe*} |
| 203 | {\dhead{gf} |
| 204 | {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset> |
| 205 | \&key :location |
| 206 | \nlret @<initarg>} |
| 207 | \dhead{gf} |
| 208 | {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset> |
| 209 | \&key :location |
| 210 | \nlret @<initarg>}} |
| 211 | \end{describe*} |
| 212 | |
| 213 | \begin{describe*} |
| 214 | {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset> |
| 215 | \&key :location} |
| 216 | \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset> |
| 217 | \&key :location}} |
| 218 | \end{describe*} |
| 219 | |
| 220 | \begin{describe}{cls} |
| 221 | {sod-message () \&key :name :location :readonly :class :type} |
| 222 | \end{describe} |
| 223 | |
| 224 | \begin{describe*} |
| 225 | {\dhead{gf}{sod-message-name @<message> @> @<string>} |
| 226 | \dhead{meth}{sod-message} |
| 227 | {file-location (@<message> sod-message) @> @<floc>} |
| 228 | \dhead{gf}{sod-message-readonly-p @<message> @> @<generalized-boolean>} |
| 229 | \dhead{gf}{sod-message-class @<message> @> @<class>} |
| 230 | \dhead{gf}{sod-message-type @<message> @> @<c-type>}} |
| 231 | \end{describe*} |
| 232 | |
| 233 | \begin{describe}{gf} |
| 234 | {make-sod-message @<class> @<name> @<type> @<pset> \&key :location |
| 235 | @> @<message>} |
| 236 | \end{describe} |
| 237 | |
| 238 | \begin{describe}{gf}{check-message-type @<message> @<type>} |
| 239 | \end{describe} |
| 240 | |
| 241 | \begin{describe}{fun} |
| 242 | {find-message-by-name @<class> @<super-nick> @<message-name> |
| 243 | @> @<message>} |
| 244 | \end{describe} |
| 245 | |
| 246 | \begin{describe}{cls} |
| 247 | {sod-method () \&key :message :location :class :type :body} |
| 248 | \end{describe} |
| 249 | |
| 250 | \begin{describe*} |
| 251 | {\dhead{gf}{sod-method-message @<method> @> @<message>} |
| 252 | \dhead{meth}{sod-method} |
| 253 | {file-location (@<method> sod-method) @> @<floc>} |
| 254 | \dhead{gf}{sod-method-class @<method> @> @<class>} |
| 255 | \dhead{gf}{sod-method-type @<method> @> @<c-type>} |
| 256 | \dhead{gf}{sod-method-body @<method> @> @<fragment-or-nil>}} |
| 257 | \end{describe*} |
| 258 | |
| 259 | \begin{describe}{gf} |
| 260 | {make-sod-method |
| 261 | \=@<class> @<nick> @<name> @<type> @<body> \+\\ |
| 262 | @<pset> \&key :location \- |
| 263 | \nlret @<method>} |
| 264 | \end{describe} |
| 265 | |
| 266 | \begin{describe}{gf} |
| 267 | {make-sod-method-using-message |
| 268 | \=@<message> @<class> |
| 269 | @<type> @<body> \+\\ |
| 270 | @<pset> \&key :location \- |
| 271 | \nlret @<method>} |
| 272 | \end{describe} |
| 273 | |
| 274 | \begin{describe}{gf} |
| 275 | {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>} |
| 276 | \end{describe} |
| 277 | |
| 278 | \begin{describe}{gf}{check-method-type @<method> @<message> @<type>} |
| 279 | \end{describe} |
| 280 | |
| 281 | \begin{describe}{fun} |
| 282 | {argument-lists-compatible-p @<message-args> @<method-args> |
| 283 | @> @<generalized-boolean>} |
| 284 | \end{describe} |
| 285 | |
| 286 | \begin{describe}{fun}{check-method-return-type @<method-type> @<return-type>} |
| 287 | \end{describe} |
| 288 | |
| 289 | \begin{describe}{fun} |
| 290 | {check-method-return-type-against-message @<method-type> @<message-type>} |
| 291 | \end{describe} |
| 292 | |
| 293 | \begin{describe}{fun} |
| 294 | {check-method-argument-lists @<method-type> @<message-type>} |
| 295 | \end{describe} |
| 296 | |
| 297 | \begin{describe}{cls} |
| 298 | {static-instance () |
| 299 | \&key :name :location :externp :constp :class :initializers} |
| 300 | \end{describe} |
| 301 | |
| 302 | \begin{describe*} |
| 303 | {\dhead{gf}{static-instance-name @<static-instance> @> @<string>} |
| 304 | \dhead{gf}{static-instance-extern-p @<static-instance> |
| 305 | @> @<generalized-boolean>} |
| 306 | \dhead{gf}{static-instance-const-p @<static-instance> |
| 307 | @> @<generalized-boolean>} |
| 308 | \dhead{gf}{static-instance-class @<static-instance> @> @<class>} |
| 309 | \dhead{gf}{static-instance-initializers @<static-instance> @> @<list>} |
| 310 | \dhead{gf} |
| 311 | {setf (static-instance-initializers @<static-instance>) @<list>}} |
| 312 | \end{describe*} |
| 313 | |
| 314 | \begin{describe}{gf} |
| 315 | {make-static-instance @<class> @<name> @<initializers> |
| 316 | @<pset> @<location> \&key |
| 317 | \nlret @<static-instance>} |
| 318 | \end{describe} |
| 319 | |
| 320 | %%%-------------------------------------------------------------------------- |
| 321 | \section{Class finalization protocol} \label{sec:meta.finalization} |
| 322 | |
| 323 | \begin{describe}{mac} |
| 324 | {finalization-error (@<token> @<arg>^*) \\ \ind |
| 325 | @<declaration>^* \\ |
| 326 | @<form>^* \- |
| 327 | \nlret @<value>^*} |
| 328 | \end{describe} |
| 329 | |
| 330 | \begin{describe}{fun}{finalization-failed} |
| 331 | \end{describe} |
| 332 | |
| 333 | \begin{describe*} |
| 334 | {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>} |
| 335 | \dhead{gf}{sod-class-type @<class> @> @<c-type>} |
| 336 | \dhead{gf}{sod-class-chain-head @<class> @> @<class>} |
| 337 | \dhead{gf}{sod-class-chain @<class> @> @<list>} |
| 338 | \dhead{gf}{sod-class-chains @<class> @> @<list>} |
| 339 | \dhead{gf}{sod-class-state @<class> @> @<state>}} |
| 340 | \end{describe*} |
| 341 | |
| 342 | \begin{describe}{gf}{compute-cpl @<class> @> @<list>} |
| 343 | \end{describe} |
| 344 | |
| 345 | \begin{describe}{fun} |
| 346 | {report-class-list-merge-error @<class> @<lists> @<error>} |
| 347 | \end{describe} |
| 348 | |
| 349 | \begin{describe}{fun}{merge-class-lists @<class> @<lists> @<pick> @> @<list>} |
| 350 | \end{describe} |
| 351 | |
| 352 | \begin{describe}{gf}{compute-chains @<class> @> @<list>} |
| 353 | \end{describe} |
| 354 | |
| 355 | \begin{describe}{gf}{check-class-initializer @<slot> @<class>} |
| 356 | \begin{describe}{meth}{effective-slot,sod-class} |
| 357 | {check-class-initializer (@<slot> effective-slot) (@<class> sod-class)} |
| 358 | \end{describe} |
| 359 | \begin{describe}{meth}{sod-class-effective-slot,sod-class} |
| 360 | {check-class-initializer (@<slot> sod-class-effective-slot) |
| 361 | (@<class> sod-class)} |
| 362 | \end{describe} |
| 363 | \end{describe} |
| 364 | |
| 365 | \begin{describe}{gf}{check-sod-class @<class>} |
| 366 | \end{describe} |
| 367 | |
| 368 | \begin{describe}{gf}{finalize-sod-class @<class> @> @<generalized-boolean>} |
| 369 | \begin{describe}{meth}{sod-class} |
| 370 | {finalize-sod-class (@<class> sod-class)} |
| 371 | \end{describe} |
| 372 | \begin{describe}{ar-meth}{sod-class} |
| 373 | {finalize-sod-class (@<class> sod-class) @> @<generalized-boolean>} |
| 374 | \end{describe} |
| 375 | \end{describe} |
| 376 | |
| 377 | \begin{describe}{fun}{clos-cpl @<class> @> @<list>} |
| 378 | \end{describe} |
| 379 | |
| 380 | \begin{describe}{fun}{dylan-cpl @<class> @> @<list>} |
| 381 | \end{describe} |
| 382 | |
| 383 | \begin{describe}{fun}{c3-cpl @<class> @> @<list>} |
| 384 | \end{describe} |
| 385 | |
| 386 | \begin{describe}{fun}{flavors-cpl @<class> @> @<list>} |
| 387 | \end{describe} |
| 388 | |
| 389 | \begin{describe}{fun}{python-cpl @<class> @> @<list>} |
| 390 | \end{describe} |
| 391 | |
| 392 | \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>} |
| 393 | \end{describe} |
| 394 | |
| 395 | %%%----- That's all, folks -------------------------------------------------- |
| 396 | |
| 397 | %%% Local variables: |
| 398 | %%% mode: LaTeX |
| 399 | %%% TeX-master: "sod.tex" |
| 400 | %%% TeX-PDF-mode: t |
| 401 | %%% End: |