Commit | Line | Data |
---|---|---|
756f4928 MW |
1 | %%% -*-latex-*- |
2 | %%% | |
3 | %%% Translation-time metaobjects | |
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. |
756f4928 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{Translation-time metaobjects} \label{ch:meta} | |
27 | ||
28 | %%%-------------------------------------------------------------------------- | |
29 | \section{Base metaobject classes} \label{sec:meta.classes} | |
30 | ||
31 | \begin{describe}{cls} | |
020b9e2b MW |
32 | {sod-class () \\ \ind |
33 | \&key \=:name :nick :location :pset \+\\ | |
34 | :superclasses :link :metaclass \\ | |
756f4928 | 35 | :slots :instance-initializers :class-initializers \\ |
020b9e2b | 36 | :initargs :initfrags :tearfrags \\ |
b2983f35 | 37 | :messages :methods} |
756f4928 MW |
38 | \end{describe} |
39 | ||
40 | \begin{describe*} | |
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>} | |
b2983f35 MW |
52 | \dhead{gf}{sod-class-initargs @<class> @> @<list>} |
53 | \dhead{gf}{setf (sod-class-initargs @<class>) @<list>} | |
a42893dd MW |
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>} | |
756f4928 MW |
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>}} | |
62 | \end{describe*} | |
63 | ||
756f4928 MW |
64 | \begin{describe}{fun} |
65 | {make-sod-class @<name> @<superclasses> @<pset> \&optional @<floc> | |
66 | @> @<class>} | |
67 | \end{describe} | |
68 | ||
756f4928 MW |
69 | \begin{describe*} |
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> @}^*}} | |
80 | \end{describe*} | |
81 | ||
82 | \begin{describe}{fun} | |
83 | {find-superclass-by-nick @<class> @<nick> @> @<superclass>} | |
84 | \end{describe} | |
85 | ||
86 | \begin{describe}{fun} | |
87 | {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>} | |
88 | \end{describe} | |
89 | ||
90 | \begin{describe}{fun}{valid-name-p @<name> @> @<generalized-boolean>} | |
91 | \end{describe} | |
92 | ||
93 | \begin{describe}{fun}{find-root-superclass @<class> @> @<superclass>} | |
94 | \end{describe} | |
95 | ||
96 | \begin{describe}{fun}{find-root-metaclass @<class> @> @<metaclass>} | |
97 | \end{describe} | |
98 | ||
99 | \begin{describe}{cls}{sod-slot () \&key :name :location :pset :class :type} | |
100 | \end{describe} | |
101 | ||
102 | \begin{describe*} | |
103 | {\dhead{gf}{sod-slot-name @<slot> @> @<string>} | |
104 | \dhead{gf}{sod-slot-class @<slot> @> @<class>} | |
105 | \dhead{gf}{sod-slot-type @<slot> @> @<c-type>}} | |
106 | \end{describe*} | |
107 | ||
108 | \begin{describe}{gf} | |
109 | {make-sod-slot @<class> @<name> @<type> @<pset> \&optional @<floc> | |
110 | @> @<slot>} | |
111 | \end{describe} | |
112 | ||
113 | \begin{describe*} | |
114 | {\dhead{fun} | |
115 | {find-instance-slot-by-name @<class> @<super-nick> @<slot-name> | |
116 | @> @<slot>} | |
117 | \dhead{fun} | |
118 | {find-class-slot-by-name @<class> @<super-nick> @<slot-name> | |
119 | @> @<slot>}} | |
120 | \end{describe*} | |
121 | ||
122 | \begin{describe}{fun} | |
123 | {find-instance-slot-by-name @<class> @<super-nick> @<slot-name> | |
124 | @> @<slot>} | |
125 | \end{describe} | |
126 | ||
127 | \begin{describe}{cls} | |
020b9e2b | 128 | {sod-class-slot (sod-slot) \\ \ind |
756f4928 MW |
129 | \&key :name :location :pset :class :type |
130 | :initializer-function :prepare-function} | |
131 | \end{describe} | |
132 | ||
133 | \begin{describe*} | |
134 | {\dhead{gf}{sod-slot-initializer-function @<slot> @> @<function>} | |
135 | \dhead{gf}{sod-slot-prepare-function @<slot> @> @<function>}} | |
136 | \end{describe*} | |
137 | ||
138 | \begin{describe*} | |
139 | {\dhead{cls}{sod-initializer () | |
a888e3ac | 140 | \&key :slot :location :class :value} |
756f4928 | 141 | \dhead{cls}{sod-instance-initializer (sod-initializer) |
a888e3ac | 142 | \&key :slot :location :class :value} |
756f4928 | 143 | \dhead{cls}{sod-class-initializer (sod-initializer) |
a888e3ac | 144 | \&key :slot :location :class :value}} |
756f4928 MW |
145 | \end{describe*} |
146 | ||
147 | \begin{describe*} | |
148 | {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>} | |
a888e3ac | 149 | \dhead{gf}{sod-initializer-value @<init> @> @<fragment>}} |
756f4928 MW |
150 | \end{describe*} |
151 | ||
152 | \begin{describe*} | |
153 | {\dhead{gf} | |
a888e3ac MW |
154 | {make-slot-instance-initializer |
155 | \=@<class> @<nick> @<name> @<value> @<pset> \&optional @<floc> | |
756f4928 MW |
156 | \nlret @<init>} |
157 | \dhead{gf} | |
a888e3ac MW |
158 | {make-slot-class-initializer |
159 | \=@<class> @<nick> @<name> @<value> @<pset> \&optional @<floc> | |
756f4928 MW |
160 | \nlret @<init>}} |
161 | \end{describe*} | |
162 | ||
163 | \begin{describe}{gf} | |
a888e3ac MW |
164 | {make-sod-initializer-using-slot |
165 | \=@<class> @<slot> @<init-class> @<value> @<pset> \&optional @<floc> | |
756f4928 MW |
166 | \nlret @<init>} |
167 | \end{describe} | |
168 | ||
b2983f35 MW |
169 | \begin{describe}{cls}{sod-initarg () \&key :class :location :name :type} |
170 | \end{describe} | |
171 | ||
172 | \begin{describe*} | |
173 | {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>} | |
174 | \dhead{gf}{sod-initarg-name @<initarg> @> @<string>} | |
175 | \dhead{gf}{sod-initarg-type @<initarg> @> @<c-type>}} | |
176 | \end{describe*} | |
177 | ||
178 | \begin{describe}{cls} | |
179 | {sod-user-initarg (sod-initarg) | |
180 | \&key :class :location :name :type :default} | |
181 | \end{describe} | |
182 | ||
183 | \begin{describe}{gf} | |
184 | {make-sod-user-initarg @<class> @<name> @<type> @<pset> | |
185 | \&optional @<default> @<floc>} | |
186 | \end{describe} | |
187 | ||
188 | \begin{describe}{gf}{sod-initarg-default @<initarg> @> @<default>} | |
189 | \end{describe} | |
190 | ||
191 | \begin{describe}{cls} | |
192 | {sod-slot-initarg (sod-initarg) | |
193 | \&key :class :location :name :type :slot} | |
194 | \end{describe} | |
195 | ||
196 | \begin{describe}{gf}{sod-initarg-slot @<initarg> @> @<slot>} | |
197 | \end{describe} | |
198 | ||
199 | \begin{describe}{gf} | |
200 | {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset> | |
201 | \&optional @<floc>} | |
202 | \end{describe} | |
203 | ||
204 | \begin{describe}{gf} | |
205 | {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset> | |
206 | \&optional @<floc>} | |
207 | \end{describe} | |
208 | ||
209 | \begin{describe}{gf} | |
210 | {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset> | |
211 | \&optional @<floc>} | |
212 | \end{describe} | |
213 | ||
a42893dd MW |
214 | \begin{describe*} |
215 | {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset> | |
216 | \&optional @<floc>} | |
217 | \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset> | |
218 | \&optional @<floc>}} | |
219 | \end{describe*} | |
220 | ||
756f4928 MW |
221 | \begin{describe}{cls}{sod-message () \&key :name :location :class :type} |
222 | \end{describe} | |
223 | ||
224 | \begin{describe*} | |
225 | {\dhead{gf}{sod-message-name @<message> @> @<string>} | |
226 | \dhead{gf}{sod-message-class @<message> @> @<class>} | |
227 | \dhead{gf}{sod-message-type @<message> @> @<c-type>}} | |
228 | \end{describe*} | |
229 | ||
230 | \begin{describe}{gf} | |
231 | {make-sod-message @<class> @<name> @<type> @<pset> \&optional @<floc> | |
232 | @> @<message>} | |
233 | \end{describe} | |
234 | ||
235 | \begin{describe}{gf}{check-message-type @<message> @<type>} | |
236 | \end{describe} | |
237 | ||
238 | \begin{describe}{fun} | |
239 | {find-message-by-name @<class> @<super-nick> @<message-name> | |
240 | @> @<message>} | |
241 | \end{describe} | |
242 | ||
243 | \begin{describe}{cls} | |
244 | {sod-method () \&key :message :location :class :type :body} | |
245 | \end{describe} | |
246 | ||
247 | \begin{describe*} | |
248 | {\dhead{gf}{sod-method-message @<method> @> @<message>} | |
249 | \dhead{gf}{sod-method-class @<method> @> @<class>} | |
250 | \dhead{gf}{sod-method-type @<method> @> @<c-type>} | |
251 | \dhead{gf}{sod-method-body @<method> @> @<fragment-or-nil>}} | |
252 | \end{describe*} | |
253 | ||
254 | \begin{describe}{gf} | |
020b9e2b MW |
255 | {make-sod-method |
256 | \=@<class> @<nick> @<name> @<type> @<body> \+\\ | |
257 | @<pset> \&optional @<floc> \- | |
756f4928 MW |
258 | \nlret @<method>} |
259 | \end{describe} | |
260 | ||
261 | \begin{describe}{gf} | |
020b9e2b MW |
262 | {make-sod-method-using-message |
263 | \=@<message> @<class> | |
264 | @<type> @<body> \+\\ | |
265 | @<pset> \&optional @<floc> \- | |
756f4928 MW |
266 | \nlret @<method>} |
267 | \end{describe} | |
268 | ||
269 | \begin{describe}{gf} | |
270 | {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>} | |
271 | \end{describe} | |
272 | ||
273 | \begin{describe}{gf}{check-method-type @<method> @<message> @<type>} | |
274 | \end{describe} | |
275 | ||
276 | \begin{describe}{fun} | |
277 | {argument-lists-compatible-p @<message-args> @<method-args> | |
278 | @> @<generalized-boolean>} | |
279 | \end{describe} | |
280 | ||
b70cb6d8 MW |
281 | \begin{describe}{fun}{check-method-return-type @<method-type> @<return-type>} |
282 | \end{describe} | |
283 | ||
284 | \begin{describe}{fun} | |
285 | {check-method-return-type-against-message @<method-type> @<message-type>} | |
286 | \end{describe} | |
287 | ||
288 | \begin{describe}{fun} | |
289 | {check-method-argument-lists @<method-type> @<message-type>} | |
290 | \end{describe} | |
291 | ||
756f4928 MW |
292 | %%%-------------------------------------------------------------------------- |
293 | \section{Class finalization protocol} \label{sec:meta.finalization} | |
294 | ||
295 | \begin{describe*} | |
ba07ddc2 | 296 | {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>} |
756f4928 MW |
297 | \dhead{gf}{sod-class-type @<class> @> @<c-type>} |
298 | \dhead{gf}{sod-class-chain-head @<class> @> @<class>} | |
299 | \dhead{gf}{sod-class-chain @<class> @> @<list>} | |
300 | \dhead{gf}{sod-class-chains @<class> @> @<list>} | |
301 | \dhead{gf}{sod-class-state @<class> @> @<state>}} | |
302 | \end{describe*} | |
303 | ||
304 | \begin{describe}{gf}{compute-cpl @<class> @> @<list>} | |
305 | \end{describe} | |
306 | ||
307 | \begin{describe}{gf}{compute-chains @<class> @> @<list>} | |
308 | \end{describe} | |
309 | ||
981b6fb6 MW |
310 | \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>} |
311 | \end{describe} | |
312 | ||
756f4928 MW |
313 | \begin{describe}{gf}{check-sod-class @<class>} |
314 | \end{describe} | |
315 | ||
316 | \begin{describe}{gf}{finalize-sod-class @<class>} | |
317 | \end{describe} | |
318 | ||
319 | \begin{describe}{fun}{clos-cpl @<class> @> @<list>} | |
320 | \end{describe} | |
321 | ||
322 | \begin{describe}{fun}{dylan-cpl @<class> @> @<list>} | |
323 | \end{describe} | |
324 | ||
325 | \begin{describe}{fun}{c3-cpl @<class> @> @<list>} | |
326 | \end{describe} | |
327 | ||
328 | \begin{describe}{fun}{flavors-cpl @<class> @> @<list>} | |
329 | \end{describe} | |
330 | ||
331 | \begin{describe}{fun}{python-cpl @<class> @> @<list>} | |
332 | \end{describe} | |
333 | ||
334 | \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>} | |
335 | \end{describe} | |
31d4431b | 336 | |
756f4928 MW |
337 | %%%----- That's all, folks -------------------------------------------------- |
338 | ||
339 | %%% Local variables: | |
340 | %%% mode: LaTeX | |
341 | %%% TeX-master: "sod.tex" | |
342 | %%% TeX-PDF-mode: t | |
343 | %%% End: |