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 \\
40 {\dhead{gf}{sod-class-name @<class> @> @<string>}
41 \dhead{gf}{sod-class-nickname @<class> @> @<string>}
42 \dhead{gf}{sod-class-direct-superclasses @<class> @> @<list>}
43 \dhead{gf}{sod-class-chain-link @<class> @> @<class-or-nil>}
44 \dhead{gf}{sod-class-metaclass @<class> @> @<metaclass>}
45 \dhead{gf}{sod-class-slots @<class> @> @<list>}
46 \dhead{gf}{setf (sod-class-slots @<class>) @<list>}
47 \dhead{gf}{sod-class-instance-initializers @<class> @> @<list>}
48 \dhead{gf}{setf (sod-class-instance-initializers @<class>) @<list>}
49 \dhead{gf}{sod-class-class-initializers @<class> @> @<list>}
50 \dhead{gf}{setf (sod-class-class-initializers @<class>) @<list>}
51 \dhead{gf}{sod-class-messages @<class> @> @<list>}
52 \dhead{gf}{setf (sod-class-messages @<class>) @<list>}
53 \dhead{gf}{sod-class-methods @<class> @> @<list>}
54 \dhead{gf}{setf (sod-class-methods @<class>) @<list>}}
59 {\dhead{gf}{sod-class-ilayout <class> @> @<ilayout>}
60 \dhead{gf}{sod-class-effective-methods @<class> @> @<list>}
61 \dhead{gf}{sod-class-vtables @<class> @> @<list>}}
64 \begin{describe}{gf}{guess-metaclass @<class> @> @<metaclass>}
68 {make-sod-class @<name> @<superclasses> @<pset> \&optional @<floc>
73 {\dhead{lmac}{slot @<name> @<type> @{ @<keyword> @<value> @}^*}
74 \dhead{lmac}{instance-initializer @<nick> @<name>
75 @<value-kind> @<value-form>
76 @{ @<keyword> @<value> @}^*}
77 \dhead{lmac}{class-initializer @<nick> @<name>
78 @<value-kind> @<value-form>
79 @{ @<keyword> @<value> @}^*}
80 \dhead{lmac}{message @<name> @<type> @{ @<keyword> @<value> @}^*}
81 \dhead{lmac}{method @<nick> @<name> @<type> @<body>
82 @{ @<keyword> @<value> @}^*}}
86 {find-superclass-by-nick @<class> @<nick> @> @<superclass>}
90 {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>}
93 \begin{describe}{fun}{valid-name-p @<name> @> @<generalized-boolean>}
96 \begin{describe}{fun}{find-root-superclass @<class> @> @<superclass>}
99 \begin{describe}{fun}{find-root-metaclass @<class> @> @<metaclass>}
102 \begin{describe}{cls}{sod-slot () \&key :name :location :pset :class :type}
106 {\dhead{gf}{sod-slot-name @<slot> @> @<string>}
107 \dhead{gf}{sod-slot-class @<slot> @> @<class>}
108 \dhead{gf}{sod-slot-type @<slot> @> @<c-type>}}
112 {make-sod-slot @<class> @<name> @<type> @<pset> \&optional @<floc>
118 {find-instance-slot-by-name @<class> @<super-nick> @<slot-name>
121 {find-class-slot-by-name @<class> @<super-nick> @<slot-name>
125 \begin{describe}{fun}
126 {find-instance-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-kind :value-form}
144 \dhead{cls}{sod-instance-initializer (sod-initializer)
145 \&key :slot :location :class :value-kind :value-form}
146 \dhead{cls}{sod-class-initializer (sod-initializer)
147 \&key :slot :location :class :value-kind :value-form}}
151 {\dhead{gf}{sod-initializer-slot @<init> @> @<slot>}
152 \dhead{gf}{sod-initializer-value-kind @<init> @> @<kind>}
153 \dhead{gf}{sod-initializer-value-form @<init> @> @<fragment>}}
158 {make-slot-instance-initializer \=@<class> @<nick> @<name>
159 @<value-kind> @<value-form> \+ \\
160 @<pset> \&optional @<floc> \-
163 {make-slot-class-initializer \=@<class> @<nick> @<name>
164 @<value-kind> @<value-form> \+ \\
165 @<pset> \&optional @<floc> \-
170 {make-sod-initializer-using-slot \=@<class> @<slot> @<init-class>
171 @<value-kind> @<value-form> \+ \\
172 @<pset> \&optional @<floc> \-
176 \begin{describe}{cls}{sod-message () \&key :name :location :class :type}
180 {\dhead{gf}{sod-message-name @<message> @> @<string>}
181 \dhead{gf}{sod-message-class @<message> @> @<class>}
182 \dhead{gf}{sod-message-type @<message> @> @<c-type>}}
186 {make-sod-message @<class> @<name> @<type> @<pset> \&optional @<floc>
190 \begin{describe}{gf}{check-message-type @<message> @<type>}
193 \begin{describe}{fun}
194 {find-message-by-name @<class> @<super-nick> @<message-name>
198 \begin{describe}{cls}
199 {sod-method () \&key :message :location :class :type :body}
203 {\dhead{gf}{sod-method-message @<method> @> @<message>}
204 \dhead{gf}{sod-method-class @<method> @> @<class>}
205 \dhead{gf}{sod-method-type @<method> @> @<c-type>}
206 \dhead{gf}{sod-method-body @<method> @> @<fragment-or-nil>}}
210 {make-sod-method \=@<class> @<nick> @<name> @<type> @<body> \+ \\
211 @<pset> \&optional @<floc> \-
216 {make-sod-method-using-message \=@<message> @<class>
217 @<type> @<body> \+ \\
218 @<pset> \&optional @<floc> \-
223 {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>}
226 \begin{describe}{gf}{check-method-type @<method> @<message> @<type>}
229 \begin{describe}{fun}
230 {argument-lists-compatible-p @<message-args> @<method-args>
231 @> @<generalized-boolean>}
234 %%%--------------------------------------------------------------------------
235 \section{Class finalization protocol} \label{sec:meta.finalization}
238 {\dhead{gf}{sod-class-precedence-list <class> @> @<list>}
239 \dhead{gf}{sod-class-type @<class> @> @<c-type>}
240 \dhead{gf}{sod-class-chain-head @<class> @> @<class>}
241 \dhead{gf}{sod-class-chain @<class> @> @<list>}
242 \dhead{gf}{sod-class-chains @<class> @> @<list>}
243 \dhead{gf}{sod-class-state @<class> @> @<state>}}
246 \begin{describe}{gf}{compute-cpl @<class> @> @<list>}
249 \begin{describe}{gf}{compute-chains @<class> @> @<list>}
252 \begin{describe}{gf}{check-sod-class @<class>}
255 \begin{describe}{gf}{finalize-sod-class @<class>}
258 \begin{describe}{fun}{clos-cpl @<class> @> @<list>}
261 \begin{describe}{fun}{dylan-cpl @<class> @> @<list>}
264 \begin{describe}{fun}{c3-cpl @<class> @> @<list>}
267 \begin{describe}{fun}{flavors-cpl @<class> @> @<list>}
270 \begin{describe}{fun}{python-cpl @<class> @> @<list>}
273 \begin{describe}{fun}{l*loops-cpl @<class> @> @<list>}
275 %%%----- That's all, folks --------------------------------------------------
279 %%% TeX-master: "sod.tex"