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