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 | 64 | \begin{describe}{fun} |
81054f01 | 65 | {make-sod-class @<name> @<superclasses> @<pset> \&key :location |
756f4928 MW |
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 | ||
17c7c784 MW |
86 | \begin{describe}{ty}{inheritance-path-reporter-state} |
87 | \end{describe} | |
88 | ||
89 | \begin{describe}{fun}{make-inheritance-path-reporter-state @> @<state>} | |
90 | \end{describe} | |
91 | ||
92 | \begin{describe}{fun}{report-inheritance-path @<state> @<super>} | |
93 | \end{describe} | |
94 | ||
756f4928 | 95 | \begin{describe}{fun} |
6e92afa7 MW |
96 | {select-minimal-class-property |
97 | \=@<supers> @<key> @<order> @<default> @<what> \\ | |
98 | \>\&key :present :allow-empty | |
99 | \nlret @<object>} | |
100 | \end{describe} | |
101 | ||
73eceea6 MW |
102 | \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>} |
103 | \end{describe} | |
104 | ||
6e92afa7 | 105 | \begin{describe}{fun} |
756f4928 MW |
106 | {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>} |
107 | \end{describe} | |
108 | ||
109 | \begin{describe}{fun}{valid-name-p @<name> @> @<generalized-boolean>} | |
110 | \end{describe} | |
111 | ||
112 | \begin{describe}{fun}{find-root-superclass @<class> @> @<superclass>} | |
113 | \end{describe} | |
114 | ||
115 | \begin{describe}{fun}{find-root-metaclass @<class> @> @<metaclass>} | |
116 | \end{describe} | |
117 | ||
118 | \begin{describe}{cls}{sod-slot () \&key :name :location :pset :class :type} | |
119 | \end{describe} | |
120 | ||
121 | \begin{describe*} | |
122 | {\dhead{gf}{sod-slot-name @<slot> @> @<string>} | |
123 | \dhead{gf}{sod-slot-class @<slot> @> @<class>} | |
124 | \dhead{gf}{sod-slot-type @<slot> @> @<c-type>}} | |
125 | \end{describe*} | |
126 | ||
127 | \begin{describe}{gf} | |
81054f01 | 128 | {make-sod-slot @<class> @<name> @<type> @<pset> \&key :location |
756f4928 MW |
129 | @> @<slot>} |
130 | \end{describe} | |
131 | ||
132 | \begin{describe*} | |
133 | {\dhead{fun} | |
134 | {find-instance-slot-by-name @<class> @<super-nick> @<slot-name> | |
135 | @> @<slot>} | |
136 | \dhead{fun} | |
137 | {find-class-slot-by-name @<class> @<super-nick> @<slot-name> | |
138 | @> @<slot>}} | |
139 | \end{describe*} | |
140 | ||
756f4928 | 141 | \begin{describe}{cls} |
020b9e2b | 142 | {sod-class-slot (sod-slot) \\ \ind |
756f4928 MW |
143 | \&key :name :location :pset :class :type |
144 | :initializer-function :prepare-function} | |
145 | \end{describe} | |
146 | ||
147 | \begin{describe*} | |
148 | {\dhead{gf}{sod-slot-initializer-function @<slot> @> @<function>} | |
149 | \dhead{gf}{sod-slot-prepare-function @<slot> @> @<function>}} | |
150 | \end{describe*} | |
151 | ||
152 | \begin{describe*} | |
153 | {\dhead{cls}{sod-initializer () | |
a888e3ac | 154 | \&key :slot :location :class :value} |
756f4928 | 155 | \dhead{cls}{sod-instance-initializer (sod-initializer) |
a888e3ac | 156 | \&key :slot :location :class :value} |
756f4928 | 157 | \dhead{cls}{sod-class-initializer (sod-initializer) |
a888e3ac | 158 | \&key :slot :location :class :value}} |
756f4928 MW |
159 | \end{describe*} |
160 | ||
161 | \begin{describe*} | |
162 | {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>} | |
a888e3ac | 163 | \dhead{gf}{sod-initializer-value @<init> @> @<fragment>}} |
756f4928 MW |
164 | \end{describe*} |
165 | ||
166 | \begin{describe*} | |
167 | {\dhead{gf} | |
1ab17da6 | 168 | {make-sod-instance-initializer |
03570bbb MW |
169 | \=@<class> @<nick> @<name> @<value> @<pset> \\ |
170 | \>\&key :inhibit-initargs :location | |
756f4928 MW |
171 | \nlret @<init>} |
172 | \dhead{gf} | |
1ab17da6 | 173 | {make-sod-class-initializer |
81054f01 | 174 | \=@<class> @<nick> @<name> @<value> @<pset> \&key :location |
756f4928 MW |
175 | \nlret @<init>}} |
176 | \end{describe*} | |
177 | ||
178 | \begin{describe}{gf} | |
a888e3ac | 179 | {make-sod-initializer-using-slot |
81054f01 | 180 | @<class> @<slot> @<init-class> @<value> @<pset> @<floc> |
756f4928 MW |
181 | \nlret @<init>} |
182 | \end{describe} | |
183 | ||
b2983f35 MW |
184 | \begin{describe}{cls}{sod-initarg () \&key :class :location :name :type} |
185 | \end{describe} | |
186 | ||
187 | \begin{describe*} | |
188 | {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>} | |
189 | \dhead{gf}{sod-initarg-name @<initarg> @> @<string>} | |
190 | \dhead{gf}{sod-initarg-type @<initarg> @> @<c-type>}} | |
191 | \end{describe*} | |
192 | ||
193 | \begin{describe}{cls} | |
194 | {sod-user-initarg (sod-initarg) | |
195 | \&key :class :location :name :type :default} | |
196 | \end{describe} | |
197 | ||
198 | \begin{describe}{gf} | |
199 | {make-sod-user-initarg @<class> @<name> @<type> @<pset> | |
81054f01 | 200 | \&key :default :location} |
b2983f35 MW |
201 | \end{describe} |
202 | ||
203 | \begin{describe}{gf}{sod-initarg-default @<initarg> @> @<default>} | |
204 | \end{describe} | |
205 | ||
206 | \begin{describe}{cls} | |
207 | {sod-slot-initarg (sod-initarg) | |
208 | \&key :class :location :name :type :slot} | |
209 | \end{describe} | |
210 | ||
211 | \begin{describe}{gf}{sod-initarg-slot @<initarg> @> @<slot>} | |
212 | \end{describe} | |
213 | ||
214 | \begin{describe}{gf} | |
b2983f35 | 215 | {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset> |
81054f01 | 216 | \&key :location} |
b2983f35 MW |
217 | \end{describe} |
218 | ||
219 | \begin{describe}{gf} | |
220 | {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset> | |
81054f01 | 221 | \&key :location} |
b2983f35 MW |
222 | \end{describe} |
223 | ||
a42893dd MW |
224 | \begin{describe*} |
225 | {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset> | |
81054f01 | 226 | \&key :location} |
a42893dd | 227 | \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset> |
81054f01 | 228 | \&key :location}} |
a42893dd MW |
229 | \end{describe*} |
230 | ||
756f4928 MW |
231 | \begin{describe}{cls}{sod-message () \&key :name :location :class :type} |
232 | \end{describe} | |
233 | ||
234 | \begin{describe*} | |
235 | {\dhead{gf}{sod-message-name @<message> @> @<string>} | |
236 | \dhead{gf}{sod-message-class @<message> @> @<class>} | |
237 | \dhead{gf}{sod-message-type @<message> @> @<c-type>}} | |
238 | \end{describe*} | |
239 | ||
240 | \begin{describe}{gf} | |
81054f01 | 241 | {make-sod-message @<class> @<name> @<type> @<pset> \&key :location |
756f4928 MW |
242 | @> @<message>} |
243 | \end{describe} | |
244 | ||
245 | \begin{describe}{gf}{check-message-type @<message> @<type>} | |
246 | \end{describe} | |
247 | ||
248 | \begin{describe}{fun} | |
249 | {find-message-by-name @<class> @<super-nick> @<message-name> | |
250 | @> @<message>} | |
251 | \end{describe} | |
252 | ||
253 | \begin{describe}{cls} | |
254 | {sod-method () \&key :message :location :class :type :body} | |
255 | \end{describe} | |
256 | ||
257 | \begin{describe*} | |
258 | {\dhead{gf}{sod-method-message @<method> @> @<message>} | |
259 | \dhead{gf}{sod-method-class @<method> @> @<class>} | |
260 | \dhead{gf}{sod-method-type @<method> @> @<c-type>} | |
261 | \dhead{gf}{sod-method-body @<method> @> @<fragment-or-nil>}} | |
262 | \end{describe*} | |
263 | ||
264 | \begin{describe}{gf} | |
020b9e2b MW |
265 | {make-sod-method |
266 | \=@<class> @<nick> @<name> @<type> @<body> \+\\ | |
81054f01 | 267 | @<pset> \&key :location \- |
756f4928 MW |
268 | \nlret @<method>} |
269 | \end{describe} | |
270 | ||
271 | \begin{describe}{gf} | |
020b9e2b MW |
272 | {make-sod-method-using-message |
273 | \=@<message> @<class> | |
274 | @<type> @<body> \+\\ | |
81054f01 | 275 | @<pset> \&key :location \- |
756f4928 MW |
276 | \nlret @<method>} |
277 | \end{describe} | |
278 | ||
279 | \begin{describe}{gf} | |
280 | {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>} | |
281 | \end{describe} | |
282 | ||
283 | \begin{describe}{gf}{check-method-type @<method> @<message> @<type>} | |
284 | \end{describe} | |
285 | ||
286 | \begin{describe}{fun} | |
287 | {argument-lists-compatible-p @<message-args> @<method-args> | |
288 | @> @<generalized-boolean>} | |
289 | \end{describe} | |
290 | ||
b70cb6d8 MW |
291 | \begin{describe}{fun}{check-method-return-type @<method-type> @<return-type>} |
292 | \end{describe} | |
293 | ||
294 | \begin{describe}{fun} | |
295 | {check-method-return-type-against-message @<method-type> @<message-type>} | |
296 | \end{describe} | |
297 | ||
298 | \begin{describe}{fun} | |
299 | {check-method-argument-lists @<method-type> @<message-type>} | |
300 | \end{describe} | |
301 | ||
756f4928 MW |
302 | %%%-------------------------------------------------------------------------- |
303 | \section{Class finalization protocol} \label{sec:meta.finalization} | |
304 | ||
e45a106d MW |
305 | \begin{describe}{mac} |
306 | {finalization-error (@<token> @<arg>^*) \\ \ind | |
307 | @<declaration>^* \\ | |
308 | @<form>^* \- | |
309 | \nlret @<value>^*} | |
310 | \end{describe} | |
311 | ||
312 | \begin{describe}{fun}{finalization-failed} | |
313 | \end{describe} | |
314 | ||
756f4928 | 315 | \begin{describe*} |
ba07ddc2 | 316 | {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>} |
756f4928 MW |
317 | \dhead{gf}{sod-class-type @<class> @> @<c-type>} |
318 | \dhead{gf}{sod-class-chain-head @<class> @> @<class>} | |
319 | \dhead{gf}{sod-class-chain @<class> @> @<list>} | |
320 | \dhead{gf}{sod-class-chains @<class> @> @<list>} | |
321 | \dhead{gf}{sod-class-state @<class> @> @<state>}} | |
322 | \end{describe*} | |
323 | ||
324 | \begin{describe}{gf}{compute-cpl @<class> @> @<list>} | |
325 | \end{describe} | |
326 | ||
0dca577d MW |
327 | \begin{describe}{fun} |
328 | {report-class-list-merge-error @<class> @<lists> @<error>} | |
329 | \end{describe} | |
330 | ||
c05ed0f1 | 331 | \begin{describe}{fun}{merge-class-lists @<class> @<lists> @<pick> @> @<list>} |
e2838dc5 MW |
332 | \end{describe} |
333 | ||
756f4928 MW |
334 | \begin{describe}{gf}{compute-chains @<class> @> @<list>} |
335 | \end{describe} | |
336 | ||
2c0aab07 | 337 | \begin{describe}{gf}{check-class-initializer @<slot> @<class>} |
87883222 | 338 | \begin{describe}{meth}{effective-slot,sod-class} |
2c0aab07 MW |
339 | {check-class-initializer (@<slot> effective-slot) (@<class> sod-class)} |
340 | \end{describe} | |
87883222 | 341 | \begin{describe}{meth}{sod-class-effective-slot,sod-class} |
2c0aab07 MW |
342 | {check-class-initializer (@<slot> sod-class-effective-slot) |
343 | (@<class> sod-class)} | |
344 | \end{describe} | |
345 | \end{describe} | |
346 | ||
756f4928 MW |
347 | \begin{describe}{gf}{check-sod-class @<class>} |
348 | \end{describe} | |
349 | ||
e45a106d | 350 | \begin{describe}{gf}{finalize-sod-class @<class> @> @<generalized-boolean>} |
87883222 MW |
351 | \begin{describe}{meth}{sod-class} |
352 | {finalize-sod-class (@<class> sod-class)} | |
32bb097f | 353 | \end{describe} |
87883222 MW |
354 | \begin{describe}{ar-meth}{sod-class} |
355 | {finalize-sod-class (@<class> sod-class) @> @<generalized-boolean>} | |
32bb097f | 356 | \end{describe} |
756f4928 MW |
357 | \end{describe} |
358 | ||
359 | \begin{describe}{fun}{clos-cpl @<class> @> @<list>} | |
360 | \end{describe} | |
361 | ||
362 | \begin{describe}{fun}{dylan-cpl @<class> @> @<list>} | |
363 | \end{describe} | |
364 | ||
365 | \begin{describe}{fun}{c3-cpl @<class> @> @<list>} | |
366 | \end{describe} | |
367 | ||
368 | \begin{describe}{fun}{flavors-cpl @<class> @> @<list>} | |
369 | \end{describe} | |
370 | ||
371 | \begin{describe}{fun}{python-cpl @<class> @> @<list>} | |
372 | \end{describe} | |
373 | ||
374 | \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>} | |
375 | \end{describe} | |
31d4431b | 376 | |
756f4928 MW |
377 | %%%----- That's all, folks -------------------------------------------------- |
378 | ||
379 | %%% Local variables: | |
380 | %%% mode: LaTeX | |
381 | %%% TeX-master: "sod.tex" | |
382 | %%% TeX-PDF-mode: t | |
383 | %%% End: |