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