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