doc/Makefile.am: `output.tex' exists, so depend on it.
[sod] / doc / layout.tex
CommitLineData
756f4928
MW
1%%% -*-latex-*-
2%%%
3%%% Class layout and method combination protocols
4%%%
5%%% (c) 2015 Straylight/Edgeware
6%%%
7
8%%%----- Licensing notice ---------------------------------------------------
9%%%
10%%% This file is part of the Sensble Object Design, an object system for C.
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{Class layout and method combination}
27
28%%%--------------------------------------------------------------------------
29\section{Class layout protocol} \label{sec:layout.instance}
30
31\begin{describe}{fun}{islots-struct-tag @<class> @> @<string>}
32\end{describe}
33
34\begin{describe}{fun}{ichain-struct-tag @<class> @<chain-head> @> @<string>}
35\end{describe}
36
37\begin{describe}{fun}{ichain-union-tag @<class> @<chain-head> @> @<string>}
38\end{describe}
39
40\begin{describe}{fun}{ilayout-struct-tag @<class> @> @<string>}
41\end{describe}
42
43\begin{describe}{fun}{vtmsgs-struct-tag @<class> @<super> @> @<string>}
44\end{describe}
45
46\begin{describe}{fun}{vtable-union-tag @<class> @<chain-head> @> @<string>}
47\end{describe}
48
49\begin{describe}{fun}{vtable-struct-tag @<class> @<chain-head> @> @<string>}
50\end{describe}
51
52\begin{describe}{fun}{vtable-name @<class> @<chain-head> @> @<string>}
53\end{describe}
54
55\begin{describe}{fun}{message-macro-name @<class> @<entry> @> @<string>}
56\end{describe}
57
58\begin{describe}{cls}{effective-slot () \&key :class :slot :initializer}
59\end{describe}
60
61\begin{describe*}
62 {\dhead{gf}{effective-slot-class @<slot> @> @<class>}
63 \dhead{gf}{effective-slot-direct-slot @<slot> @> @<direct-slot>}
64 \dhead{gf}{effective-slot-initializer @<slot> @> @<init-or-nil>}}
65\end{describe*}
66
67\begin{describe}{gf}
68 {find-slot-initializer @<class> @<slot> @> @<init-or-nil>}
69\end{describe}
70
71\begin{describe}{gf}
72 {compute-effective-slot @<class> @<slot> @> @<effective-slot>}
73\end{describe}
74
75\begin{describe}{cls}
76 {sod-class-effective-slot (effective-slot) \\ \ind
77 \&key :class :slot :initializer-function :prepare-function}
78\end{describe}
79
80\begin{describe*}
81 {\dhead{gf}{effective-slot-initializer-function @<slot> @> @<function>}
82 \dhead{gf}{effective-slot-prepare-function @<slot> @> @<function>}}
83\end{describe*}
84
85\begin{describe}{cls}{islots () \&key :class :subclass :slots}
86\end{describe}
87
88\begin{describe*}
89 {\dhead{gf}{islots-class @<islots> @> @<class>}
90 \dhead{gf}{islots-subclass @<islots> @> @<class>}
91 \dhead{gf}{islots-slots @<islots> @> @<list>}}
92\end{describe*}
93
94\begin{describe}{gf}{compute-islots @<class> @<subclass> @> @<islots>}
95\end{describe}
96
97\begin{describe}{gf}{vtable-pointer () \&key :class :chain-head :chain-tail}
98\end{describe}
99
100\begin{describe*}
101 {\dhead{gf}{vtable-pointer-class @<vtable-pointer> @> @<class>}
102 \dhead{gf}{vtable-pointer-chain-head @<vtable-pointer> @> @<class>}
103 \dhead{gf}{vtable-pointer-chain-tail @<vtable-pointer> @> @<class>}}
104\end{describe*}
105
106\begin{describe}{gf}{ichain () \&key :class :chain-head :chain-tail :body}
107\end{describe}
108
109\begin{describe*}
110 {\dhead{gf}{ichain-class @<ichain> @> @<class>}
111 \dhead{gf}{ichain-chain-head @<ichain> @> @<class>}
112 \dhead{gf}{ichain-chain-tail @<ichain> @> @<class>}
113 \dhead{gf}{ichain-body @<ichain> @> @<list>}}
114\end{describe*}
115
116\begin{describe}{gf}{compute-ichain @<class> @<chain> @> @<ichain>}
117\end{describe}
118
119\begin{describe}{gf}{ilayout () \&key :class :ichains}
120\end{describe}
121
122\begin{describe*}
123 {\dhead{gf}{ilayout-class @<ilayout> @> @<class>}
124 \dhead{gf}{ilayout-ichains @<ilayout> @> @<list>}}
125\end{describe*}
126
127\begin{describe}{gf}{compute-ilayout @<class> @> @<ilayout>}
128\end{describe}
129
130\begin{describe}{cls}
131 {vtmsgs () \&key :class :subclass :chain-head :chain-tail :entries}
132\end{describe}
133
134\begin{describe*}
135 {\dhead{gf}{vtmsgs-class @<vtmsgs> @> @<class>}
136 \dhead{gf}{vtmsgs-subclass @<vtmsgs> @> @<class>}
137 \dhead{gf}{vtmsgs-chain-head @<vtmsgs> @> @<class>}
138 \dhead{gf}{vtmsgs-chain-tail @<vtmsgs> @> @<class>}
139 \dhead{gf}{vtmsgs-entries @<vtmsgs> @> @<list>}}
140\end{describe*}
141
142\begin{describe}{cls}
143 {class-pointer () \&key :class :chain-head :metaclass :meta-chain-head}
144\end{describe}
145
146\begin{describe*}
147 {\dhead{gf}{class-pointer-class @<class-pointer> @> @<class>}
148 \dhead{gf}{class-pointer-chain-head @<class-pointer> @> @<class>}
149 \dhead{gf}{class-pointer-metaclass @<class-pointer> @> @<class>}
150 \dhead{gf}{class-pointer-meta-chain-head @<class-pointer> @> @<class>}}
151\end{describe*}
152
153\begin{describe}{fun}
154 {make-class-pointer @<class> @<chain-head>
155 @<metaclass> @<meta-chain-head>
156 @> @<class-pointer>}
157\end{describe}
158
159\begin{describe}{cls}{base-offset () \&key :class :chain-head}
160\end{describe}
161
162\begin{describe*}
163 {\dhead{gf}{base-offset-class @<base-offset> @> @<class>}
164 \dhead{gf}{base-offset-chain-head @<base-offset> @> @<class>}}
165\end{describe*}
166
167\begin{describe}{fun}
168 {make-base-offset @<class> @<chain-head> @> @<base-offset>}
169\end{describe}
170
171\begin{describe}{cls}{chain-offset () \&key :class :chain-head :target-head}
172\end{describe}
173
174\begin{describe*}
175 {\dhead{gf}{chain-offset-class @<chain-offset> @> @<class>}
176 \dhead{gf}{chain-offset-chain-head @<chain-offset> @> @<class>}
177 \dhead{gf}{chain-offset-target-head @<chain-offset> @> @<class>}}
178\end{describe*}
179
180\begin{describe}{fun}
181 {make-chain-offset @<class> @<chain-head> @<target-head>
182 @> @<chain-offset>}
183\end{describe}
184
185\begin{describe}{gf}{vtable () \&key :class :chain-head :chain-tail :body}
186\end{describe}
187
188\begin{describe*}
189 {\dhead{gf}{vtable-class @<vtable> @> @<class>}
190 \dhead{gf}{vtable-chain-head @<vtable> @> @<class>}
191 \dhead{gf}{vtable-chain-tail @<vtable> @> @<class>}
192 \dhead{gf}{vtable-body @<vtable> @> @<list>}}
193\end{describe*}
194
195\begin{describe}{gf}
196 {compute-vtable-items @<class> @<super>
197 @<chain-head> @<chain-tail>
198 @<emit-function>}
199\end{describe}
200
201\begin{describe}{gf}{compute-vtable @<class> @<chain> @> @<vtable>}
202\end{describe}
203
204\begin{describe}{gf}{compute-vtables @<class> @> @<list>}
205\end{describe}
206
207%%%--------------------------------------------------------------------------
208\section{Method combination} \label{sec:layout.methods}
209
210\begin{describe}{cls}{effective-method () \&key :message :class}
211\end{describe}
212
213\begin{describe*}
214 {\dhead{gf}{effective-method-message @<method> @> @<message>}
215 \dhead{gf}{effective-method-class @<method> @> @<class>}}
216\end{describe*}
217
218\begin{describe}{gf}{message-effective-method-class @<message> @> @<class>}
219\end{describe}
220
221\begin{describe}{gf}{primary-method-class @<message> @> @<class>}
222\end{describe}
223
224\begin{describe}{gf}
225 {compute-sod-effective-method @<message> @<class> @> @<method>}
226\end{describe}
227
228\begin{describe}{gf}{compute-effective-methods @<class> @> @<list>}
229\end{describe}
230
231\begin{describe}{cls}
232 {method-entry () \&key :method :chain-head :chain-tail :role}
233\end{describe}
234
235\begin{describe*}
236 {\dhead{gf}{method-entry-effective-method @<method-entry> @> @<method>}
237 \dhead{gf}{method-entry-chain-head @<method-entry> @> @<class>}
238 \dhead{gf}{method-entry-chain-tail @<method-entry> @> @<class>}
239 \dhead{gf}{method-entry-role @<method-entry> @> @<role>}}
240\end{describe*}
241
242\begin{describe}{gf}
243 {make-method-entries @<effective-method> @<chain-head> @<chain-tail>
244 @> @<list>}
245\end{describe}
246
247
248\begin{describe}{gf}{sod-message-argument-tail @<message> @> @<list>}
249\end{describe}
250
251\begin{describe}{gf}{sod-message-no-varargs-tail @<message> @> @<list>}
252\end{describe}
253
254\begin{describe}{gf}{sod-method-function-type @<method> @> @<c-type>}
255\end{describe}
256
257\begin{describe}{gf}{sod-method-next-method-type @<method> @> @<c-type>}
258\end{describe}
259
260\begin{describe}{gf}{sod-method-function-name @<method> @> @<string>}
261\end{describe}
262
263\begin{describe}{fun}{varargs-message-p @<message> @> @<generalized-boolean>}
264\end{describe}
265
266\begin{describe}{gf}{method-entry-function-type @<entry> @> @<c-type>}
267\end{describe}
268
269\begin{describe}{gf}{method-entry-slot-name @<entry> @> @<string>}
270\end{describe}
271
272\begin{describe}{gf}
273 {method-entry-slot-name-by-role @<entry> @<role> @<name> @> @<string>}
274\end{describe}
275
276\begin{describe}{gf}
277 {effective-method-basic-argument-names @<method> @> @<list>}
278\end{describe}
279
280
281
282\begin{describe}{cls}
283 {method-codegen (codegen) \\ \ind
284 \&key :vars :insts :temp-index
285 :message :class :method :target}
286\end{describe}
287
288\begin{describe*}
289 {\dhead{gf}{codegen-message @<codegen> @> @<message>}
290 \dhead{gf}{codegen-class @<codegen> @> @<class>}
291 \dhead{gf}{codegen-method @<codegen> @> @<method>}
292 \dhead{gf}{codegen-target @<codegen> @> @<target>}}
293\end{describe*}
294
295\begin{describe*}
296 {\dhead{cls}{convert-to-ilayout-inst (inst)}
297 \dhead{fun}
298 {make-convert-to-ilayout-inst @<class> @<chain-head> @<expr>}}
299 \begin{prog}
300 SOD_ILAYOUT(@<class>, @<chain-head-nick>, @<expr>)
301 \end{prog}
302\end{describe*}
303
304
305\begin{describe}{gf}
306 {compute-effective-method-body @<method> @<codegen> @<target>}
307\end{describe}
308
309\begin{describe}{gf}{simple-method-body @<method> @<codegen> @<target>}
310\end{describe}
311
312\begin{describe}{fun}
313 {invoke-method @<codegen> @<target> @<arguments-tail> @<direct-method>}
314\end{describe}
315
316\begin{describe}{fun}{ensure-ilayout-var @<codegen> @<super>}
317\end{describe}
318
319\begin{describe}{fun}{make-trampoline @<codegen> @<super> @<body-func>}
320\end{describe}
321
322\begin{describe}{gf}{effective-method-function-name @<method> @> @<string>}
323\end{describe}
324
325\begin{describe}{gf}
326 {method-entry-function-name @<method> @<chain-head> @<role> @> @<string>}
327\end{describe}
328
329\begin{describe}{gf}{compute-method-entry-functions @<method> @> @<list>}
330\end{describe}
331
332\begin{describe}{fun}
333 {invoke-delegation-chain @<codegen> @<target> @<basic-tail>
334 @<chain> @<kernel-func>}
335\end{describe}
336
337\begin{describe}{cls}
338 {basic-message (sod-message) \&key :name :location :class :type}
339\end{describe}
340
341\begin{describe}{cls}
342 {simple-message (basic-message) \&key :name :location :class :type}
343\end{describe}
344
345\begin{describe}{cls}
346 {basic-direct-method (sod-method)
347 \&key :message :location :class :type :body :role}
348\end{describe}
349
350\begin{describe}{gf}{sod-method-role @<method> @> @<role>}
351\end{describe}
352
353\begin{describe}{cls}
354 {daemon-direct-method (basic-direct-method) \\ \ind
355 \&key :message :location :class :type :body :role}
356\end{describe}
357
358\begin{describe}{cls}
359 {delegating-direct-method (basic-direct-method) \\ \ind
360 \&key :message :location :class :type :body :role}
361\end{describe}
362
363\begin{describe}{cls}
364 {basic-effective-method (effective-method) \\ \ind
365 \&key :message :class :around-methods :before-methods :after-methods}
366\end{describe}
367
368\begin{describe*}
369 {\dhead{gf}
370 {effective-method-around-methods @<effective-method> @> @<list>}
371 \dhead{gf}
372 {effective-method-before-methods @<effective-method> @> @<list>}
373 \dhead{gf}
374 {effective-method-after-methods @<effective-method> @> @<list>}
375 \dhead{gf}{effective-method-functions @<effective-method> @> @<list>}}
376\end{describe*}
377
378\begin{describe}{cls}
379 {simple-effective-method (basic-effective-method) \\ \ind
380 \&key :message :class
381 :around-methods :before-methods :after-methods :primary-methods}
382\end{describe}
383
384\begin{describe}{fun}
385 {basic-effective-method-body @<codegen> @<target> @<method> @<body>}
386\end{describe}
387
388\begin{describe}{cls}
389 {standard-message (simple-message) \&key :name :location :class :type}
390\end{describe}
391
392\begin{describe}{cls}
393 {standard-effective-method (simple-effective-method) \\ \ind
394 \&key :message :class
395 :around-methods :before-methods :after-methods :primary-methods}
396\end{describe}
397
398\begin{describe}{cls}
399 {aggregating-message (simple-message)
400 \&key :name :location :class :type :combination}
401\end{describe}
402
403\begin{describe}{gf}
404 {aggregating-message-properties @<message> @<combination> @> @<plist>}
405\end{describe}
406
407\begin{describe}{gf}
408 {compute-aggregating-message-kernel
409 \=@<message> @<combination> @<target> \+ \\
410 @<methods> @<arg-names> \&key}
411\end{describe}
412
413\begin{describe}{gf}
414 {check-aggregating-message-type @<message> @<combination> @<c-type>}
415\end{describe}
416
417\begin{describe}{cls}
418 {aggregating-effective-method (simple-effective-method) \\ \ind
419 \&key :message :class
420 :around-methods :before-methods :after-methods :primary-methods}
421\end{describe}
422
423\begin{describe}{mac}
424 {define-aggregating-method-combination @<combination> \\ \ind\ind
425 ((@<var-name>^*)
426 @[[ :codegen @<codegen-var> @!
427 :methods @<methods-var> @]]) \- \\
428 @[[ \=:properties (@{ (@{ @<name> @! (@[@<keyword>@] @<name>) @}
429 @<c-type>
430 @[@<default>
431 @[@<suppliedp-var>@]@]) @}^*) @! \+ \\
432 :return-type @<c-type> @! \\
433 :around @<around-func> @!
434 :first-method @<first-method-func> @!
435 :method @<method-func> @]]}
436\end{describe}
437
438%%% the method combination story
439%% compute-effective-methods --> compute-sod-effective-method
440
441%% hook-output (basic-effective-method :c)
442%% basic-effective-method.functions
443%% compute-method-entry-functions
444%% compute-effective-method-body
445%%
446%% compute-effective-method-body (simple-effective-method)
447%% basic-effective-method-body
448%% simple-method-body (standard-effective-method)
449%% simple-method-body (aggregating-effective-method)
450%% message-kernel-function
451
452%%%----- That's all, folks --------------------------------------------------
453
454%%% Local variables:
455%%% mode: LaTeX
456%%% TeX-master: "sod.tex"
457%%% TeX-PDF-mode: t
458%%% End: