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>
}}
58 {make-sod-class @<name> @<superclasses> @<pset> \&optional @<floc>
63 {\dhead{lmac
}{slot @<name> @<type> @
{ @<keyword> @<value> @
}^*
}
64 \dhead{lmac
}{instance-initializer @<nick> @<name>
65 @<value-kind> @<value-form>
66 @
{ @<keyword> @<value> @
}^*
}
67 \dhead{lmac
}{class-initializer @<nick> @<name>
68 @<value-kind> @<value-form>
69 @
{ @<keyword> @<value> @
}^*
}
70 \dhead{lmac
}{message @<name> @<type> @
{ @<keyword> @<value> @
}^*
}
71 \dhead{lmac
}{method @<nick> @<name> @<type> @<body>
72 @
{ @<keyword> @<value> @
}^*
}}
76 {find-superclass-by-nick @<class> @<nick> @> @<superclass>
}
80 {sod-subclass-p @<class-a> @<class-b> @> @<generalized-boolean>
}
83 \begin{describe
}{fun
}{valid-name-p @<name> @> @<generalized-boolean>
}
86 \begin{describe
}{fun
}{find-root-superclass @<class> @> @<superclass>
}
89 \begin{describe
}{fun
}{find-root-metaclass @<class> @> @<metaclass>
}
92 \begin{describe
}{cls
}{sod-slot () \&key :name :location :pset :class :type
}
96 {\dhead{gf
}{sod-slot-name @<slot> @> @<string>
}
97 \dhead{gf
}{sod-slot-class @<slot> @> @<class>
}
98 \dhead{gf
}{sod-slot-type @<slot> @> @<c-type>
}}
102 {make-sod-slot @<class> @<name> @<type> @<pset> \&optional @<floc>
108 {find-instance-slot-by-name @<class> @<super-nick> @<slot-name>
111 {find-class-slot-by-name @<class> @<super-nick> @<slot-name>
115 \begin{describe
}{fun
}
116 {find-instance-slot-by-name @<class> @<super-nick> @<slot-name>
120 \begin{describe
}{cls
}
121 {sod-class-slot (sod-slot) \\
\ind
122 \&key :name :location :pset :class :type
123 :initializer-function :prepare-function
}
127 {\dhead{gf
}{sod-slot-initializer-function @<slot> @> @<function>
}
128 \dhead{gf
}{sod-slot-prepare-function @<slot> @> @<function>
}}
132 {\dhead{cls
}{sod-initializer ()
133 \&key :slot :location :class :value-kind :value-form
}
134 \dhead{cls
}{sod-instance-initializer (sod-initializer)
135 \&key :slot :location :class :value-kind :value-form
}
136 \dhead{cls
}{sod-class-initializer (sod-initializer)
137 \&key :slot :location :class :value-kind :value-form
}}
141 {\dhead{gf
}{sod-initializer-slot @<init> @> @<slot>
}
142 \dhead{gf
}{sod-initializer-value-kind @<init> @> @<kind>
}
143 \dhead{gf
}{sod-initializer-value-form @<init> @> @<fragment>
}}
148 {make-slot-instance-initializer \=@<class> @<nick> @<name>
149 @<value-kind> @<value-form> \+ \\
150 @<pset> \&optional @<floc> \-
153 {make-slot-class-initializer \=@<class> @<nick> @<name>
154 @<value-kind> @<value-form> \+ \\
155 @<pset> \&optional @<floc> \-
160 {make-sod-initializer-using-slot \=@<class> @<slot> @<init-class>
161 @<value-kind> @<value-form> \+ \\
162 @<pset> \&optional @<floc> \-
166 \begin{describe
}{cls
}{sod-message () \&key :name :location :class :type
}
170 {\dhead{gf
}{sod-message-name @<message> @> @<string>
}
171 \dhead{gf
}{sod-message-class @<message> @> @<class>
}
172 \dhead{gf
}{sod-message-type @<message> @> @<c-type>
}}
176 {make-sod-message @<class> @<name> @<type> @<pset> \&optional @<floc>
180 \begin{describe
}{gf
}{check-message-type @<message> @<type>
}
183 \begin{describe
}{fun
}
184 {find-message-by-name @<class> @<super-nick> @<message-name>
188 \begin{describe
}{cls
}
189 {sod-method () \&key :message :location :class :type :body
}
193 {\dhead{gf
}{sod-method-message @<method> @> @<message>
}
194 \dhead{gf
}{sod-method-class @<method> @> @<class>
}
195 \dhead{gf
}{sod-method-type @<method> @> @<c-type>
}
196 \dhead{gf
}{sod-method-body @<method> @> @<fragment-or-nil>
}}
200 {make-sod-method \=@<class> @<nick> @<name> @<type> @<body> \+ \\
201 @<pset> \&optional @<floc> \-
206 {make-sod-method-using-message \=@<message> @<class>
207 @<type> @<body> \+ \\
208 @<pset> \&optional @<floc> \-
213 {sod-message-method-class @<message> @<class> @<pset> @> @<method-class>
}
216 \begin{describe
}{gf
}{check-method-type @<method> @<message> @<type>
}
219 \begin{describe
}{fun
}
220 {argument-lists-compatible-p @<message-args> @<method-args>
221 @> @<generalized-boolean>
}
224 %%%--------------------------------------------------------------------------
225 \section{Class finalization protocol
} \label{sec:meta.finalization
}
228 {\dhead{gf
}{sod-class-precedence-list <class> @> @<list>
}
229 \dhead{gf
}{sod-class-type @<class> @> @<c-type>
}
230 \dhead{gf
}{sod-class-chain-head @<class> @> @<class>
}
231 \dhead{gf
}{sod-class-chain @<class> @> @<list>
}
232 \dhead{gf
}{sod-class-chains @<class> @> @<list>
}
233 \dhead{gf
}{sod-class-state @<class> @> @<state>
}}
236 \begin{describe
}{gf
}{compute-cpl @<class> @> @<list>
}
239 \begin{describe
}{gf
}{compute-chains @<class> @> @<list>
}
242 \begin{describe
}{gf
}{guess-metaclass @<class> @> @<metaclass>
}
245 \begin{describe
}{gf
}{check-sod-class @<class>
}
248 \begin{describe
}{gf
}{finalize-sod-class @<class>
}
251 \begin{describe
}{fun
}{clos-cpl @<class> @> @<list>
}
254 \begin{describe
}{fun
}{dylan-cpl @<class> @> @<list>
}
257 \begin{describe
}{fun
}{c3-cpl @<class> @> @<list>
}
260 \begin{describe
}{fun
}{flavors-cpl @<class> @> @<list>
}
263 \begin{describe
}{fun
}{python-cpl @<class> @> @<list>
}
266 \begin{describe
}{fun
}{l*loops-cpl @<class> @> @<list>
}
269 %%%----- That's all, folks --------------------------------------------------
273 %%% TeX-master: "sod.tex"