3 %%% Translation-time metaobjects
5 %%% (c) 2015 Straylight/Edgeware
8 %%%----- Licensing notice ---------------------------------------------------
10 %%% This file is part of the Sensible 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{Translation-time metaobjects} \label{ch:meta}
28 %%%--------------------------------------------------------------------------
29 \section{Base metaobject classes} \label{sec:meta.classes}
33 \&key \=:name :nick :location :pset \+\\
34 :superclasses :link :metaclass \\
35 :slots :instance-initializers :class-initializers \\
36 :initargs :initfrags :tearfrags \\
41 {\dhead{gf}{sod-class-name @<class> @> @<string>}
42 \dhead{gf}{sod-class-nickname @<class> @> @<string>}
43 \dhead{gf}{sod-class-direct-superclasses @<class> @> @<list>}
44 \dhead{gf}{sod-class-chain-link @<class> @> @<class-or-nil>}
45 \dhead{gf}{sod-class-metaclass @<class> @> @<metaclass>}
46 \dhead{gf}{sod-class-slots @<class> @> @<list>}
47 \dhead{gf}{setf (sod-class-slots @<class>) @<list>}
48 \dhead{gf}{sod-class-instance-initializers @<class> @> @<list>}
49 \dhead{gf}{setf (sod-class-instance-initializers @<class>) @<list>}
50 \dhead{gf}{sod-class-class-initializers @<class> @> @<list>}
51 \dhead{gf}{setf (sod-class-class-initializers @<class>) @<list>}
52 \dhead{gf}{sod-class-initargs @<class> @> @<list>}
53 \dhead{gf}{setf (sod-class-initargs @<class>) @<list>}
54 \dhead{gf}{sod-class-initfrags @<class> @> @<list>}
55 \dhead{gf}{setf (sod-class-initfrags @<class>) @<list>}
56 \dhead{gf}{sod-class-tearfrags @<class> @> @<list>}
57 \dhead{gf}{setf (sod-class-tearfrags @<class>) @<list>}
58 \dhead{gf}{sod-class-messages @<class> @> @<list>}
59 \dhead{gf}{setf (sod-class-messages @<class>) @<list>}
60 \dhead{gf}{sod-class-methods @<class> @> @<list>}
61 \dhead{gf}{setf (sod-class-methods @<class>) @<list>}}
65 {make-sod-class @<name> @<superclasses> @<pset> \&optional @<floc>
70 {\dhead{lmac}{slot @<name> @<type> @{ @<keyword> @<value> @}^*}
71 \dhead{lmac}{instance-initializer @<nick> @<name>
72 @<value-kind> @<value-form>
73 @{ @<keyword> @<value> @}^*}
74 \dhead{lmac}{class-initializer @<nick> @<name>
75 @<value-kind> @<value-form>
76 @{ @<keyword> @<value> @}^*}
77 \dhead{lmac}{message @<name> @<type> @{ @<keyword> @<value> @}^*}
78 \dhead{lmac}{method @<nick> @<name> @<type> @<body>
79 @{ @<keyword> @<value> @}^*}}
83 {find-superclass-by-nick @<class> @<nick> @> @<superclass>}
86 \begin{describe}{ty}{inheritance-path-reporter-state}
89 \begin{describe}{fun}{make-inheritance-path-reporter-state @> @<state>}
92 \begin{describe}{fun}{report-inheritance-path @<state> @<super>}
96 {select-minimal-class-property
97 \=@<supers> @<key> @<order> @<default> @<what> \\
98 \>\&key :present :allow-empty
102 \begin{describe}{fun}
103 {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>}
106 \begin{describe}{fun}{valid-name-p @<name> @> @<generalized-boolean>}
109 \begin{describe}{fun}{find-root-superclass @<class> @> @<superclass>}
112 \begin{describe}{fun}{find-root-metaclass @<class> @> @<metaclass>}
115 \begin{describe}{cls}{sod-slot () \&key :name :location :pset :class :type}
119 {\dhead{gf}{sod-slot-name @<slot> @> @<string>}
120 \dhead{gf}{sod-slot-class @<slot> @> @<class>}
121 \dhead{gf}{sod-slot-type @<slot> @> @<c-type>}}
125 {make-sod-slot @<class> @<name> @<type> @<pset> \&optional @<floc>
131 {find-instance-slot-by-name @<class> @<super-nick> @<slot-name>
134 {find-class-slot-by-name @<class> @<super-nick> @<slot-name>
138 \begin{describe}{fun}
139 {find-instance-slot-by-name @<class> @<super-nick> @<slot-name>
143 \begin{describe}{cls}
144 {sod-class-slot (sod-slot) \\ \ind
145 \&key :name :location :pset :class :type
146 :initializer-function :prepare-function}
150 {\dhead{gf}{sod-slot-initializer-function @<slot> @> @<function>}
151 \dhead{gf}{sod-slot-prepare-function @<slot> @> @<function>}}
155 {\dhead{cls}{sod-initializer ()
156 \&key :slot :location :class :value}
157 \dhead{cls}{sod-instance-initializer (sod-initializer)
158 \&key :slot :location :class :value}
159 \dhead{cls}{sod-class-initializer (sod-initializer)
160 \&key :slot :location :class :value}}
164 {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>}
165 \dhead{gf}{sod-initializer-value @<init> @> @<fragment>}}
170 {make-slot-instance-initializer
171 \=@<class> @<nick> @<name> @<value> @<pset> \&optional @<floc>
174 {make-slot-class-initializer
175 \=@<class> @<nick> @<name> @<value> @<pset> \&optional @<floc>
180 {make-sod-initializer-using-slot
181 \=@<class> @<slot> @<init-class> @<value> @<pset> \&optional @<floc>
185 \begin{describe}{cls}{sod-initarg () \&key :class :location :name :type}
189 {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>}
190 \dhead{gf}{sod-initarg-name @<initarg> @> @<string>}
191 \dhead{gf}{sod-initarg-type @<initarg> @> @<c-type>}}
194 \begin{describe}{cls}
195 {sod-user-initarg (sod-initarg)
196 \&key :class :location :name :type :default}
200 {make-sod-user-initarg @<class> @<name> @<type> @<pset>
201 \&optional @<default> @<floc>}
204 \begin{describe}{gf}{sod-initarg-default @<initarg> @> @<default>}
207 \begin{describe}{cls}
208 {sod-slot-initarg (sod-initarg)
209 \&key :class :location :name :type :slot}
212 \begin{describe}{gf}{sod-initarg-slot @<initarg> @> @<slot>}
216 {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset>
221 {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset>
226 {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset>
231 {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset>
233 \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset>
237 \begin{describe}{cls}{sod-message () \&key :name :location :class :type}
241 {\dhead{gf}{sod-message-name @<message> @> @<string>}
242 \dhead{gf}{sod-message-class @<message> @> @<class>}
243 \dhead{gf}{sod-message-type @<message> @> @<c-type>}}
247 {make-sod-message @<class> @<name> @<type> @<pset> \&optional @<floc>
251 \begin{describe}{gf}{check-message-type @<message> @<type>}
254 \begin{describe}{fun}
255 {find-message-by-name @<class> @<super-nick> @<message-name>
259 \begin{describe}{cls}
260 {sod-method () \&key :message :location :class :type :body}
264 {\dhead{gf}{sod-method-message @<method> @> @<message>}
265 \dhead{gf}{sod-method-class @<method> @> @<class>}
266 \dhead{gf}{sod-method-type @<method> @> @<c-type>}
267 \dhead{gf}{sod-method-body @<method> @> @<fragment-or-nil>}}
272 \=@<class> @<nick> @<name> @<type> @<body> \+\\
273 @<pset> \&optional @<floc> \-
278 {make-sod-method-using-message
279 \=@<message> @<class>
281 @<pset> \&optional @<floc> \-
286 {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>}
289 \begin{describe}{gf}{check-method-type @<method> @<message> @<type>}
292 \begin{describe}{fun}
293 {argument-lists-compatible-p @<message-args> @<method-args>
294 @> @<generalized-boolean>}
297 \begin{describe}{fun}{check-method-return-type @<method-type> @<return-type>}
300 \begin{describe}{fun}
301 {check-method-return-type-against-message @<method-type> @<message-type>}
304 \begin{describe}{fun}
305 {check-method-argument-lists @<method-type> @<message-type>}
308 %%%--------------------------------------------------------------------------
309 \section{Class finalization protocol} \label{sec:meta.finalization}
312 {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>}
313 \dhead{gf}{sod-class-type @<class> @> @<c-type>}
314 \dhead{gf}{sod-class-chain-head @<class> @> @<class>}
315 \dhead{gf}{sod-class-chain @<class> @> @<list>}
316 \dhead{gf}{sod-class-chains @<class> @> @<list>}
317 \dhead{gf}{sod-class-state @<class> @> @<state>}}
320 \begin{describe}{gf}{compute-cpl @<class> @> @<list>}
323 \begin{describe}{fun}{merge-class-lists @<lists> @<pick> @> @<list>}
326 \begin{describe}{gf}{compute-chains @<class> @> @<list>}
329 \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>}
332 \begin{describe}{gf}{check-sod-class @<class>}
335 \begin{describe}{gf}{finalize-sod-class @<class>}
336 \begin{describe}{meth}{finalize-sod-class (@<class> sod-class)}
338 \begin{describe}{ar-meth}{finalize-sod-class (@<class> sod-class)}
342 \begin{describe}{fun}{clos-cpl @<class> @> @<list>}
345 \begin{describe}{fun}{dylan-cpl @<class> @> @<list>}
348 \begin{describe}{fun}{c3-cpl @<class> @> @<list>}
351 \begin{describe}{fun}{flavors-cpl @<class> @> @<list>}
354 \begin{describe}{fun}{python-cpl @<class> @> @<list>}
357 \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>}
360 %%%----- That's all, folks --------------------------------------------------
364 %%% TeX-master: "sod.tex"