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>} | |
1dd7dba9 | 42 | \dhead{meth}{sod-class}{file-location (@<class> sod-class) @> @<floc>} |
756f4928 MW |
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>} | |
b2983f35 MW |
53 | \dhead{gf}{sod-class-initargs @<class> @> @<list>} |
54 | \dhead{gf}{setf (sod-class-initargs @<class>) @<list>} | |
a42893dd MW |
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>} | |
756f4928 MW |
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 | ||
756f4928 | 65 | \begin{describe}{fun} |
81054f01 | 66 | {make-sod-class @<name> @<superclasses> @<pset> \&key :location |
756f4928 MW |
67 | @> @<class>} |
68 | \end{describe} | |
69 | ||
756f4928 MW |
70 | \begin{describe}{fun} |
71 | {find-superclass-by-nick @<class> @<nick> @> @<superclass>} | |
72 | \end{describe} | |
73 | ||
17c7c784 MW |
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 | ||
756f4928 | 83 | \begin{describe}{fun} |
6e92afa7 MW |
84 | {select-minimal-class-property |
85 | \=@<supers> @<key> @<order> @<default> @<what> \\ | |
86 | \>\&key :present :allow-empty | |
87 | \nlret @<object>} | |
88 | \end{describe} | |
89 | ||
73eceea6 MW |
90 | \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>} |
91 | \end{describe} | |
92 | ||
6e92afa7 | 93 | \begin{describe}{fun} |
756f4928 MW |
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>} | |
1dd7dba9 | 111 | \dhead{meth}{sod-slot}{file-location (@<slot> sod-slot) @> @<floc>} |
756f4928 MW |
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} | |
81054f01 | 117 | {make-sod-slot @<class> @<name> @<type> @<pset> \&key :location |
756f4928 MW |
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 | ||
756f4928 | 130 | \begin{describe}{cls} |
020b9e2b | 131 | {sod-class-slot (sod-slot) \\ \ind |
756f4928 MW |
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 () | |
e38e8367 | 143 | \&key :slot :location :class :value} |
756f4928 | 144 | \dhead{cls}{sod-instance-initializer (sod-initializer) |
e38e8367 | 145 | \&key :slot :location :class :value} |
756f4928 | 146 | \dhead{cls}{sod-class-initializer (sod-initializer) |
e38e8367 | 147 | \&key :slot :location :class :value}} |
756f4928 MW |
148 | \end{describe*} |
149 | ||
150 | \begin{describe*} | |
151 | {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>} | |
1dd7dba9 MW |
152 | \dhead{meth}{sod-initializer} |
153 | {file-location (@<init> sod-initializer) @> @<floc>} | |
a75cd932 MW |
154 | \dhead{gf}{sod-initializer-value @<init> @> @<fragment>} |
155 | \dhead{gf}{sod-initializer-class @<init> @> @<class>}} | |
756f4928 MW |
156 | \end{describe*} |
157 | ||
158 | \begin{describe*} | |
159 | {\dhead{gf} | |
1ab17da6 | 160 | {make-sod-instance-initializer |
03570bbb | 161 | \=@<class> @<nick> @<name> @<value> @<pset> \\ |
c6b4ed99 | 162 | \>\&key :inhibit-initargs :location :add-to-class |
756f4928 MW |
163 | \nlret @<init>} |
164 | \dhead{gf} | |
1ab17da6 | 165 | {make-sod-class-initializer |
c6b4ed99 MW |
166 | \=@<class> @<nick> @<name> @<value> @<pset> \\ |
167 | \>\&key :location :add-to-class | |
756f4928 MW |
168 | \nlret @<init>}} |
169 | \end{describe*} | |
170 | ||
171 | \begin{describe}{gf} | |
a888e3ac | 172 | {make-sod-initializer-using-slot |
81054f01 | 173 | @<class> @<slot> @<init-class> @<value> @<pset> @<floc> |
756f4928 MW |
174 | \nlret @<init>} |
175 | \end{describe} | |
176 | ||
9b9ad6b9 MW |
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*} | |
b2983f35 MW |
184 | |
185 | \begin{describe*} | |
186 | {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>} | |
187 | \dhead{gf}{sod-initarg-name @<initarg> @> @<string>} | |
9b9ad6b9 MW |
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>}} | |
b2983f35 MW |
191 | \end{describe*} |
192 | ||
a75cd932 MW |
193 | \begin{describe}{gf}{sod-initarg-argument @<initarg> @> @<argument>} |
194 | \end{describe} | |
195 | ||
b2983f35 | 196 | \begin{describe}{gf} |
b871725c MW |
197 | {make-sod-user-initarg @<class> @<name> @<type> @<pset> |
198 | \&key :default :location | |
199 | \nlret @<initarg>} | |
b2983f35 MW |
200 | \end{describe} |
201 | ||
9b9ad6b9 MW |
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*} | |
b2983f35 | 212 | |
a42893dd MW |
213 | \begin{describe*} |
214 | {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset> | |
81054f01 | 215 | \&key :location} |
a42893dd | 216 | \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset> |
81054f01 | 217 | \&key :location}} |
a42893dd MW |
218 | \end{describe*} |
219 | ||
e895be21 MW |
220 | \begin{describe}{cls} |
221 | {sod-message () \&key :name :location :readonly :class :type} | |
756f4928 MW |
222 | \end{describe} |
223 | ||
224 | \begin{describe*} | |
225 | {\dhead{gf}{sod-message-name @<message> @> @<string>} | |
1dd7dba9 MW |
226 | \dhead{meth}{sod-message} |
227 | {file-location (@<message> sod-message) @> @<floc>} | |
e895be21 | 228 | \dhead{gf}{sod-message-readonly-p @<message> @> @<generalized-boolean>} |
756f4928 MW |
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} | |
81054f01 | 234 | {make-sod-message @<class> @<name> @<type> @<pset> \&key :location |
756f4928 MW |
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>} | |
1dd7dba9 MW |
252 | \dhead{meth}{sod-method} |
253 | {file-location (@<method> sod-method) @> @<floc>} | |
756f4928 MW |
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} | |
020b9e2b MW |
260 | {make-sod-method |
261 | \=@<class> @<nick> @<name> @<type> @<body> \+\\ | |
81054f01 | 262 | @<pset> \&key :location \- |
756f4928 MW |
263 | \nlret @<method>} |
264 | \end{describe} | |
265 | ||
266 | \begin{describe}{gf} | |
020b9e2b MW |
267 | {make-sod-method-using-message |
268 | \=@<message> @<class> | |
269 | @<type> @<body> \+\\ | |
81054f01 | 270 | @<pset> \&key :location \- |
756f4928 MW |
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 | ||
b70cb6d8 MW |
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 | ||
00d59354 MW |
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 | ||
756f4928 MW |
320 | %%%-------------------------------------------------------------------------- |
321 | \section{Class finalization protocol} \label{sec:meta.finalization} | |
322 | ||
e45a106d MW |
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 | ||
756f4928 | 333 | \begin{describe*} |
ba07ddc2 | 334 | {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>} |
756f4928 MW |
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 | ||
0dca577d MW |
345 | \begin{describe}{fun} |
346 | {report-class-list-merge-error @<class> @<lists> @<error>} | |
347 | \end{describe} | |
348 | ||
c05ed0f1 | 349 | \begin{describe}{fun}{merge-class-lists @<class> @<lists> @<pick> @> @<list>} |
e2838dc5 MW |
350 | \end{describe} |
351 | ||
756f4928 MW |
352 | \begin{describe}{gf}{compute-chains @<class> @> @<list>} |
353 | \end{describe} | |
354 | ||
2c0aab07 | 355 | \begin{describe}{gf}{check-class-initializer @<slot> @<class>} |
87883222 | 356 | \begin{describe}{meth}{effective-slot,sod-class} |
2c0aab07 MW |
357 | {check-class-initializer (@<slot> effective-slot) (@<class> sod-class)} |
358 | \end{describe} | |
87883222 | 359 | \begin{describe}{meth}{sod-class-effective-slot,sod-class} |
2c0aab07 MW |
360 | {check-class-initializer (@<slot> sod-class-effective-slot) |
361 | (@<class> sod-class)} | |
362 | \end{describe} | |
363 | \end{describe} | |
364 | ||
756f4928 MW |
365 | \begin{describe}{gf}{check-sod-class @<class>} |
366 | \end{describe} | |
367 | ||
e45a106d | 368 | \begin{describe}{gf}{finalize-sod-class @<class> @> @<generalized-boolean>} |
87883222 MW |
369 | \begin{describe}{meth}{sod-class} |
370 | {finalize-sod-class (@<class> sod-class)} | |
32bb097f | 371 | \end{describe} |
87883222 MW |
372 | \begin{describe}{ar-meth}{sod-class} |
373 | {finalize-sod-class (@<class> sod-class) @> @<generalized-boolean>} | |
32bb097f | 374 | \end{describe} |
756f4928 MW |
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} | |
31d4431b | 394 | |
756f4928 MW |
395 | %%%----- That's all, folks -------------------------------------------------- |
396 | ||
397 | %%% Local variables: | |
398 | %%% mode: LaTeX | |
399 | %%% TeX-master: "sod.tex" | |
400 | %%% TeX-PDF-mode: t | |
401 | %%% End: |