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 | ||
6e92afa7 MW |
83 | \begin{describe}{fun} |
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 | ||
756f4928 MW |
93 | \begin{describe}{fun} |
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 MW |
161 | \=@<class> @<nick> @<name> @<value> @<pset> \\ |
162 | \>\&key :inhibit-initargs :location | |
756f4928 MW |
163 | \nlret @<init>} |
164 | \dhead{gf} | |
1ab17da6 | 165 | {make-sod-class-initializer |
81054f01 | 166 | \=@<class> @<nick> @<name> @<value> @<pset> \&key :location |
756f4928 MW |
167 | \nlret @<init>}} |
168 | \end{describe*} | |
169 | ||
170 | \begin{describe}{gf} | |
a888e3ac | 171 | {make-sod-initializer-using-slot |
81054f01 | 172 | @<class> @<slot> @<init-class> @<value> @<pset> @<floc> |
756f4928 MW |
173 | \nlret @<init>} |
174 | \end{describe} | |
175 | ||
9b9ad6b9 MW |
176 | \begin{describe*} |
177 | {\dhead{cls}{sod-initarg () \&key :class :location :name :type} | |
178 | \dhead{cls}{sod-user-initarg (sod-initarg) | |
179 | \&key :class :location :name :type :default} | |
180 | \dhead{cls}{sod-slot-initarg (sod-initarg) | |
181 | \&key :class :location :name :type :slot}} | |
182 | \end{describe*} | |
b2983f35 MW |
183 | |
184 | \begin{describe*} | |
185 | {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>} | |
186 | \dhead{gf}{sod-initarg-name @<initarg> @> @<string>} | |
9b9ad6b9 MW |
187 | \dhead{gf}{sod-initarg-type @<initarg> @> @<c-type>} |
188 | \dhead{gf}{sod-initarg-default @<initarg> @> @<default>} | |
189 | \dhead{gf}{sod-initarg-slot @<initarg> @> @<slot>}} | |
b2983f35 MW |
190 | \end{describe*} |
191 | ||
a75cd932 MW |
192 | \begin{describe}{gf}{sod-initarg-argument @<initarg> @> @<argument>} |
193 | \end{describe} | |
194 | ||
b2983f35 | 195 | \begin{describe}{gf} |
b871725c MW |
196 | {make-sod-user-initarg @<class> @<name> @<type> @<pset> |
197 | \&key :default :location | |
198 | \nlret @<initarg>} | |
b2983f35 MW |
199 | \end{describe} |
200 | ||
9b9ad6b9 MW |
201 | \begin{describe*} |
202 | {\dhead{gf} | |
203 | {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset> | |
204 | \&key :location | |
205 | \nlret @<initarg>} | |
206 | \dhead{gf} | |
207 | {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset> | |
208 | \&key :location | |
209 | \nlret @<initarg>}} | |
210 | \end{describe*} | |
b2983f35 | 211 | |
a42893dd MW |
212 | \begin{describe*} |
213 | {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset> | |
81054f01 | 214 | \&key :location} |
a42893dd | 215 | \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset> |
81054f01 | 216 | \&key :location}} |
a42893dd MW |
217 | \end{describe*} |
218 | ||
756f4928 MW |
219 | \begin{describe}{cls}{sod-message () \&key :name :location :class :type} |
220 | \end{describe} | |
221 | ||
222 | \begin{describe*} | |
223 | {\dhead{gf}{sod-message-name @<message> @> @<string>} | |
1dd7dba9 MW |
224 | \dhead{meth}{sod-message} |
225 | {file-location (@<message> sod-message) @> @<floc>} | |
756f4928 MW |
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} | |
81054f01 | 231 | {make-sod-message @<class> @<name> @<type> @<pset> \&key :location |
756f4928 MW |
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>} | |
1dd7dba9 MW |
249 | \dhead{meth}{sod-method} |
250 | {file-location (@<method> sod-method) @> @<floc>} | |
756f4928 MW |
251 | \dhead{gf}{sod-method-class @<method> @> @<class>} |
252 | \dhead{gf}{sod-method-type @<method> @> @<c-type>} | |
253 | \dhead{gf}{sod-method-body @<method> @> @<fragment-or-nil>}} | |
254 | \end{describe*} | |
255 | ||
256 | \begin{describe}{gf} | |
020b9e2b MW |
257 | {make-sod-method |
258 | \=@<class> @<nick> @<name> @<type> @<body> \+\\ | |
81054f01 | 259 | @<pset> \&key :location \- |
756f4928 MW |
260 | \nlret @<method>} |
261 | \end{describe} | |
262 | ||
263 | \begin{describe}{gf} | |
020b9e2b MW |
264 | {make-sod-method-using-message |
265 | \=@<message> @<class> | |
266 | @<type> @<body> \+\\ | |
81054f01 | 267 | @<pset> \&key :location \- |
756f4928 MW |
268 | \nlret @<method>} |
269 | \end{describe} | |
270 | ||
271 | \begin{describe}{gf} | |
272 | {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>} | |
273 | \end{describe} | |
274 | ||
275 | \begin{describe}{gf}{check-method-type @<method> @<message> @<type>} | |
276 | \end{describe} | |
277 | ||
278 | \begin{describe}{fun} | |
279 | {argument-lists-compatible-p @<message-args> @<method-args> | |
280 | @> @<generalized-boolean>} | |
281 | \end{describe} | |
282 | ||
b70cb6d8 MW |
283 | \begin{describe}{fun}{check-method-return-type @<method-type> @<return-type>} |
284 | \end{describe} | |
285 | ||
286 | \begin{describe}{fun} | |
287 | {check-method-return-type-against-message @<method-type> @<message-type>} | |
288 | \end{describe} | |
289 | ||
290 | \begin{describe}{fun} | |
291 | {check-method-argument-lists @<method-type> @<message-type>} | |
292 | \end{describe} | |
293 | ||
756f4928 MW |
294 | %%%-------------------------------------------------------------------------- |
295 | \section{Class finalization protocol} \label{sec:meta.finalization} | |
296 | ||
e45a106d MW |
297 | \begin{describe}{mac} |
298 | {finalization-error (@<token> @<arg>^*) \\ \ind | |
299 | @<declaration>^* \\ | |
300 | @<form>^* \- | |
301 | \nlret @<value>^*} | |
302 | \end{describe} | |
303 | ||
304 | \begin{describe}{fun}{finalization-failed} | |
305 | \end{describe} | |
306 | ||
756f4928 | 307 | \begin{describe*} |
ba07ddc2 | 308 | {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>} |
756f4928 MW |
309 | \dhead{gf}{sod-class-type @<class> @> @<c-type>} |
310 | \dhead{gf}{sod-class-chain-head @<class> @> @<class>} | |
311 | \dhead{gf}{sod-class-chain @<class> @> @<list>} | |
312 | \dhead{gf}{sod-class-chains @<class> @> @<list>} | |
313 | \dhead{gf}{sod-class-state @<class> @> @<state>}} | |
314 | \end{describe*} | |
315 | ||
316 | \begin{describe}{gf}{compute-cpl @<class> @> @<list>} | |
317 | \end{describe} | |
318 | ||
0dca577d MW |
319 | \begin{describe}{fun} |
320 | {report-class-list-merge-error @<class> @<lists> @<error>} | |
321 | \end{describe} | |
322 | ||
c05ed0f1 | 323 | \begin{describe}{fun}{merge-class-lists @<class> @<lists> @<pick> @> @<list>} |
e2838dc5 MW |
324 | \end{describe} |
325 | ||
756f4928 MW |
326 | \begin{describe}{gf}{compute-chains @<class> @> @<list>} |
327 | \end{describe} | |
328 | ||
2c0aab07 | 329 | \begin{describe}{gf}{check-class-initializer @<slot> @<class>} |
87883222 | 330 | \begin{describe}{meth}{effective-slot,sod-class} |
2c0aab07 MW |
331 | {check-class-initializer (@<slot> effective-slot) (@<class> sod-class)} |
332 | \end{describe} | |
87883222 | 333 | \begin{describe}{meth}{sod-class-effective-slot,sod-class} |
2c0aab07 MW |
334 | {check-class-initializer (@<slot> sod-class-effective-slot) |
335 | (@<class> sod-class)} | |
336 | \end{describe} | |
337 | \end{describe} | |
338 | ||
756f4928 MW |
339 | \begin{describe}{gf}{check-sod-class @<class>} |
340 | \end{describe} | |
341 | ||
e45a106d | 342 | \begin{describe}{gf}{finalize-sod-class @<class> @> @<generalized-boolean>} |
87883222 MW |
343 | \begin{describe}{meth}{sod-class} |
344 | {finalize-sod-class (@<class> sod-class)} | |
32bb097f | 345 | \end{describe} |
87883222 MW |
346 | \begin{describe}{ar-meth}{sod-class} |
347 | {finalize-sod-class (@<class> sod-class) @> @<generalized-boolean>} | |
32bb097f | 348 | \end{describe} |
756f4928 MW |
349 | \end{describe} |
350 | ||
351 | \begin{describe}{fun}{clos-cpl @<class> @> @<list>} | |
352 | \end{describe} | |
353 | ||
354 | \begin{describe}{fun}{dylan-cpl @<class> @> @<list>} | |
355 | \end{describe} | |
356 | ||
357 | \begin{describe}{fun}{c3-cpl @<class> @> @<list>} | |
358 | \end{describe} | |
359 | ||
360 | \begin{describe}{fun}{flavors-cpl @<class> @> @<list>} | |
361 | \end{describe} | |
362 | ||
363 | \begin{describe}{fun}{python-cpl @<class> @> @<list>} | |
364 | \end{describe} | |
365 | ||
366 | \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>} | |
367 | \end{describe} | |
31d4431b | 368 | |
756f4928 MW |
369 | %%%----- That's all, folks -------------------------------------------------- |
370 | ||
371 | %%% Local variables: | |
372 | %%% mode: LaTeX | |
373 | %%% TeX-master: "sod.tex" | |
374 | %%% TeX-PDF-mode: t | |
375 | %%% End: |