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 :add-to-class
165 {make-sod-class-initializer
166 \=@<class> @<nick> @<name> @<value> @<pset> \\
167 \>\&key :location :add-to-class
172 {make-sod-initializer-using-slot
173 @<class> @<slot> @<init-class> @<value> @<pset> @<floc>
178 {\dhead{cls
}{sod-initarg () \&key :class :location :name :type
}
179 \dhead{cls
}{sod-user-initarg (sod-initarg)
180 \&key :class :location :name :type :default
}
181 \dhead{cls
}{sod-slot-initarg (sod-initarg)
182 \&key :class :location :name :type :slot
}}
186 {\dhead{gf
}{sod-initarg-class @<initarg> @> @<class>
}
187 \dhead{gf
}{sod-initarg-name @<initarg> @> @<string>
}
188 \dhead{gf
}{sod-initarg-type @<initarg> @> @<c-type>
}
189 \dhead{gf
}{sod-initarg-default @<initarg> @> @<default>
}
190 \dhead{gf
}{sod-initarg-slot @<initarg> @> @<slot>
}}
193 \begin{describe
}{gf
}{sod-initarg-argument @<initarg> @> @<argument>
}
197 {make-sod-user-initarg @<class> @<name> @<type> @<pset>
198 \&key :default :location
204 {make-sod-slot-initarg @<class> @<name> @<nick> @<slot-name> @<pset>
208 {make-sod-slot-initarg-using-slot @<class> @<name> @<slot> @<pset>
214 {\dhead{gf
}{make-sod-class-initfrag @<class> @<frag> @<pset>
216 \dhead{gf
}{make-sod-class-tearfrag @<class> @<frag> @<pset>
220 \begin{describe
}{cls
}
221 {sod-message () \&key :name :location :readonly :class :type
}
225 {\dhead{gf
}{sod-message-name @<message> @> @<string>
}
226 \dhead{meth
}{sod-message
}
227 {file-location (@<message> sod-message) @> @<floc>
}
228 \dhead{gf
}{sod-message-readonly-p @<message> @> @<generalized-boolean>
}
229 \dhead{gf
}{sod-message-class @<message> @> @<class>
}
230 \dhead{gf
}{sod-message-type @<message> @> @<c-type>
}}
234 {make-sod-message @<class> @<name> @<type> @<pset> \&key :location
238 \begin{describe
}{gf
}{check-message-type @<message> @<type>
}
241 \begin{describe
}{fun
}
242 {find-message-by-name @<class> @<super-nick> @<message-name>
246 \begin{describe
}{cls
}
247 {sod-method () \&key :message :location :class :type :body
}
251 {\dhead{gf
}{sod-method-message @<method> @> @<message>
}
252 \dhead{meth
}{sod-method
}
253 {file-location (@<method> sod-method) @> @<floc>
}
254 \dhead{gf
}{sod-method-class @<method> @> @<class>
}
255 \dhead{gf
}{sod-method-type @<method> @> @<c-type>
}
256 \dhead{gf
}{sod-method-body @<method> @> @<fragment-or-nil>
}}
261 \=@<class> @<nick> @<name> @<type> @<body> \+\\
262 @<pset> \&key :location \-
267 {make-sod-method-using-message
268 \=@<message> @<class>
270 @<pset> \&key :location \-
275 {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>
}
278 \begin{describe
}{gf
}{check-method-type @<method> @<message> @<type>
}
281 \begin{describe
}{fun
}
282 {argument-lists-compatible-p @<message-args> @<method-args>
283 @> @<generalized-boolean>
}
286 \begin{describe
}{fun
}{check-method-return-type @<method-type> @<return-type>
}
289 \begin{describe
}{fun
}
290 {check-method-return-type-against-message @<method-type> @<message-type>
}
293 \begin{describe
}{fun
}
294 {check-method-argument-lists @<method-type> @<message-type>
}
297 \begin{describe
}{cls
}
299 \&key :name :location :externp :constp :class :initializers
}
303 {\dhead{gf
}{static-instance-name @<static-instance> @> @<string>
}
304 \dhead{gf
}{static-instance-extern-p @<static-instance>
305 @> @<generalized-boolean>
}
306 \dhead{gf
}{static-instance-const-p @<static-instance>
307 @> @<generalized-boolean>
}
308 \dhead{gf
}{static-instance-class @<static-instance> @> @<class>
}
309 \dhead{gf
}{static-instance-initializers @<static-instance> @> @<list>
}
311 {setf (static-instance-initializers @<static-instance>) @<list>
}}
315 {make-static-instance @<class> @<name> @<initializers>
316 @<pset> @<location> \&key
317 \nlret @<static-instance>
}
320 %%%--------------------------------------------------------------------------
321 \section{Class finalization protocol
} \label{sec:meta.finalization
}
323 \begin{describe
}{mac
}
324 {finalization-error (@<token> @<arg>^*) \\
\ind
330 \begin{describe
}{fun
}{finalization-failed
}
334 {\dhead{gf
}{sod-class-precedence-list @<class> @> @<list>
}
335 \dhead{gf
}{sod-class-type @<class> @> @<c-type>
}
336 \dhead{gf
}{sod-class-chain-head @<class> @> @<class>
}
337 \dhead{gf
}{sod-class-chain @<class> @> @<list>
}
338 \dhead{gf
}{sod-class-chains @<class> @> @<list>
}
339 \dhead{gf
}{sod-class-state @<class> @> @<state>
}}
342 \begin{describe
}{gf
}{compute-cpl @<class> @> @<list>
}
345 \begin{describe
}{fun
}
346 {report-class-list-merge-error @<class> @<lists> @<error>
}
349 \begin{describe
}{fun
}{merge-class-lists @<class> @<lists> @<pick> @> @<list>
}
352 \begin{describe
}{gf
}{compute-chains @<class> @> @<list>
}
355 \begin{describe
}{gf
}{check-class-initializer @<slot> @<class>
}
356 \begin{describe
}{meth
}{effective-slot,sod-class
}
357 {check-class-initializer (@<slot> effective-slot) (@<class> sod-class)
}
359 \begin{describe
}{meth
}{sod-class-effective-slot,sod-class
}
360 {check-class-initializer (@<slot> sod-class-effective-slot)
361 (@<class> sod-class)
}
365 \begin{describe
}{gf
}{check-sod-class @<class>
}
368 \begin{describe
}{gf
}{finalize-sod-class @<class> @> @<generalized-boolean>
}
369 \begin{describe
}{meth
}{sod-class
}
370 {finalize-sod-class (@<class> sod-class)
}
372 \begin{describe
}{ar-meth
}{sod-class
}
373 {finalize-sod-class (@<class> sod-class) @> @<generalized-boolean>
}
377 \begin{describe
}{fun
}{clos-cpl @<class> @> @<list>
}
380 \begin{describe
}{fun
}{dylan-cpl @<class> @> @<list>
}
383 \begin{describe
}{fun
}{c3-cpl @<class> @> @<list>
}
386 \begin{describe
}{fun
}{flavors-cpl @<class> @> @<list>
}
389 \begin{describe
}{fun
}{python-cpl @<class> @> @<list>
}
392 \begin{describe
}{fun
}{l*loops-cpl @<class> @> @<list>
}
395 %%%----- That's all, folks --------------------------------------------------
399 %%% TeX-master: "sod.tex"