3 %%% Translation-time metaobjects
5 %%% (c) 2015 Straylight/Edgeware
8 %%%----- Licensing notice ---------------------------------------------------
10 %%% This file is part of the Sensible Object Design, an object system for C.
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.
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.
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.
26 \chapter{Translation-time metaobjects} \label{ch:meta}
28 %%%--------------------------------------------------------------------------
29 \section{Base metaobject classes} \label{sec:meta.classes}
33 \&key \=:name :nick :location :pset \+\\
34 :superclasses :link :metaclass \\
35 :slots :instance-initializers :class-initializers \\
36 :initargs :initfrags :tearfrags \\
41 {\dhead{gf}{sod-class-name @<class> @> @<string>}
42 \dhead{meth}{sod-class}{file-location (@<class> sod-class) @> @<floc>}
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>}
53 \dhead{gf}{sod-class-initargs @<class> @> @<list>}
54 \dhead{gf}{setf (sod-class-initargs @<class>) @<list>}
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>}
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>}}
66 {make-sod-class @<name> @<superclasses> @<pset> \&key :location
71 {find-superclass-by-nick @<class> @<nick> @> @<superclass>}
74 \begin{describe}{ty}{inheritance-path-reporter-state}
77 \begin{describe}{fun}{make-inheritance-path-reporter-state @> @<state>}
80 \begin{describe}{fun}{report-inheritance-path @<state> @<super>}
84 {select-minimal-class-property
85 \=@<supers> @<key> @<order> @<default> @<what> \\
86 \>\&key :present :allow-empty
90 \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>}
94 {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>}
97 \begin{describe}{fun}{valid-name-p @<name> @> @<generalized-boolean>}
100 \begin{describe}{fun}{find-root-superclass @<class> @> @<superclass>}
103 \begin{describe}{fun}{find-root-metaclass @<class> @> @<metaclass>}
106 \begin{describe}{cls}{sod-slot () \&key :name :location :pset :class :type}
110 {\dhead{gf}{sod-slot-name @<slot> @> @<string>}
111 \dhead{meth}{sod-slot}{file-location (@<slot> sod-slot) @> @<floc>}
112 \dhead{gf}{sod-slot-class @<slot> @> @<class>}
113 \dhead{gf}{sod-slot-type @<slot> @> @<c-type>}}
117 {make-sod-slot @<class> @<name> @<type> @<pset> \&key :location
123 {find-instance-slot-by-name @<class> @<super-nick> @<slot-name>
126 {find-class-slot-by-name @<class> @<super-nick> @<slot-name>
130 \begin{describe}{cls}
131 {sod-class-slot (sod-slot) \\ \ind
132 \&key :name :location :pset :class :type
133 :initializer-function :prepare-function}
137 {\dhead{gf}{sod-slot-initializer-function @<slot> @> @<function>}
138 \dhead{gf}{sod-slot-prepare-function @<slot> @> @<function>}}
142 {\dhead{cls}{sod-initializer ()
143 \&key :slot :location :class :value}
144 \dhead{cls}{sod-instance-initializer (sod-initializer)
145 \&key :slot :location :class :value}
146 \dhead{cls}{sod-class-initializer (sod-initializer)
147 \&key :slot :location :class :value}}
151 {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>}
152 \dhead{meth}{sod-initializer}
153 {file-location (@<init> sod-initializer) @> @<floc>}
154 \dhead{gf}{sod-initializer-value @<init> @> @<fragment>}
155 \dhead{gf}{sod-initializer-class @<init> @> @<class>}}
160 {make-sod-instance-initializer
161 \=@<class> @<nick> @<name> @<value> @<pset> \\
162 \>\&key :inhibit-initargs :location
165 {make-sod-class-initializer
166 \=@<class> @<nick> @<name> @<value> @<pset> \&key :location
171 {make-sod-initializer-using-slot
172 @<class> @<slot> @<init-class> @<value> @<pset> @<floc>
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}}
185 {\dhead{gf}{sod-initarg-class @<initarg> @> @<class>}
186 \dhead{gf}{sod-initarg-name @<initarg> @> @<string>}
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>}}
192 \begin{describe}{gf}{sod-initarg-argument @<initarg> @> @<argument>}
196 {make-sod-user-initarg @<class> @<name> @<type> @<pset>
197 \&key :default :location
203 {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset>
207 {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset>
213 {\dhead{gf}{make-sod-class-initfrag @<class> @<frag> @<pset>
215 \dhead{gf}{make-sod-class-tearfrag @<class> @<frag> @<pset>
219 \begin{describe}{cls}{sod-message () \&key :name :location :class :type}
223 {\dhead{gf}{sod-message-name @<message> @> @<string>}
224 \dhead{meth}{sod-message}
225 {file-location (@<message> sod-message) @> @<floc>}
226 \dhead{gf}{sod-message-class @<message> @> @<class>}
227 \dhead{gf}{sod-message-type @<message> @> @<c-type>}}
231 {make-sod-message @<class> @<name> @<type> @<pset> \&key :location
235 \begin{describe}{gf}{check-message-type @<message> @<type>}
238 \begin{describe}{fun}
239 {find-message-by-name @<class> @<super-nick> @<message-name>
243 \begin{describe}{cls}
244 {sod-method () \&key :message :location :class :type :body}
248 {\dhead{gf}{sod-method-message @<method> @> @<message>}
249 \dhead{meth}{sod-method}
250 {file-location (@<method> sod-method) @> @<floc>}
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>}}
258 \=@<class> @<nick> @<name> @<type> @<body> \+\\
259 @<pset> \&key :location \-
264 {make-sod-method-using-message
265 \=@<message> @<class>
267 @<pset> \&key :location \-
272 {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>}
275 \begin{describe}{gf}{check-method-type @<method> @<message> @<type>}
278 \begin{describe}{fun}
279 {argument-lists-compatible-p @<message-args> @<method-args>
280 @> @<generalized-boolean>}
283 \begin{describe}{fun}{check-method-return-type @<method-type> @<return-type>}
286 \begin{describe}{fun}
287 {check-method-return-type-against-message @<method-type> @<message-type>}
290 \begin{describe}{fun}
291 {check-method-argument-lists @<method-type> @<message-type>}
294 %%%--------------------------------------------------------------------------
295 \section{Class finalization protocol} \label{sec:meta.finalization}
297 \begin{describe}{mac}
298 {finalization-error (@<token> @<arg>^*) \\ \ind
304 \begin{describe}{fun}{finalization-failed}
308 {\dhead{gf}{sod-class-precedence-list @<class> @> @<list>}
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>}}
316 \begin{describe}{gf}{compute-cpl @<class> @> @<list>}
319 \begin{describe}{fun}
320 {report-class-list-merge-error @<class> @<lists> @<error>}
323 \begin{describe}{fun}{merge-class-lists @<class> @<lists> @<pick> @> @<list>}
326 \begin{describe}{gf}{compute-chains @<class> @> @<list>}
329 \begin{describe}{gf}{check-class-initializer @<slot> @<class>}
330 \begin{describe}{meth}{effective-slot,sod-class}
331 {check-class-initializer (@<slot> effective-slot) (@<class> sod-class)}
333 \begin{describe}{meth}{sod-class-effective-slot,sod-class}
334 {check-class-initializer (@<slot> sod-class-effective-slot)
335 (@<class> sod-class)}
339 \begin{describe}{gf}{check-sod-class @<class>}
342 \begin{describe}{gf}{finalize-sod-class @<class> @> @<generalized-boolean>}
343 \begin{describe}{meth}{sod-class}
344 {finalize-sod-class (@<class> sod-class)}
346 \begin{describe}{ar-meth}{sod-class}
347 {finalize-sod-class (@<class> sod-class) @> @<generalized-boolean>}
351 \begin{describe}{fun}{clos-cpl @<class> @> @<list>}
354 \begin{describe}{fun}{dylan-cpl @<class> @> @<list>}
357 \begin{describe}{fun}{c3-cpl @<class> @> @<list>}
360 \begin{describe}{fun}{flavors-cpl @<class> @> @<list>}
363 \begin{describe}{fun}{python-cpl @<class> @> @<list>}
366 \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>}
369 %%%----- That's all, folks --------------------------------------------------
373 %%% TeX-master: "sod.tex"