1<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
2
3    <xs:annotation>
4        <xs:documentation xml:lang="en">
5            GAPI XML schema.
6            Copyright 2013 Bertrand Lorentz.
7
8            This program is free software; you can redistribute it and/or
9            modify it under the terms of version 2 of the Lesser GNU General
10            Public License as published by the Free Software Foundation.
11
12            This program is distributed in the hope that it will be useful,
13            but WITHOUT ANY WARRANTY; without even the implied warranty of
14            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15            Lesser General Public License for more details.
16
17            You should have received a copy of the GNU Lesser General Public
18            License along with this program; if not, write to the
19            Free Software	Foundation, Inc., 51 Franklin Street, Fifth Floor,
20            Boston, MA  02110-1301  USA
21        </xs:documentation>
22    </xs:annotation>
23
24    <!-- Top-level tag-->
25	<xs:element name="api">
26        <xs:complexType>
27            <xs:sequence>
28                <xs:element name="namespace" type="namespaceType" maxOccurs="unbounded"/>
29                <xs:element name="symbol" type="symbolType" maxOccurs="unbounded" minOccurs="0"/>
30            </xs:sequence>
31            <xs:attribute name="parser_version" type="xs:positiveInteger"/>
32        </xs:complexType>
33    </xs:element>
34
35    <xs:complexType name="namespaceType">
36        <xs:choice maxOccurs="unbounded">
37            <xs:element name="enum" type="enumType"/>
38            <xs:element name="callback" type="callbackType"/>
39            <xs:element name="interface" type="interfaceType"/>
40            <xs:element name="object" type="objectType"/>
41            <xs:element name="struct" type="structType"/>
42            <xs:element name="boxed" type="boxedType"/>
43            <xs:element name="alias" type="aliasType"/>
44            <xs:element name="class" type="classType"/>
45        </xs:choice>
46        <xs:attribute name="name" type="xs:string"/>
47        <xs:attribute name="library" type="xs:string"/>
48    </xs:complexType>
49
50    <xs:complexType name="symbolType">
51        <xs:attribute name="type" type="xs:string"/>
52        <xs:attribute name="cname" type="xs:string"/>
53        <xs:attribute name="name" type="xs:string"/>
54        <xs:attribute name="default_value" type="xs:string" use="optional"/>
55        <xs:attribute name="marshal_type" type="xs:string" use="optional"/>
56        <xs:attribute name="call_fmt" type="xs:string" use="optional"/>
57        <xs:attribute name="from_fmt" type="xs:string" use="optional"/>
58    </xs:complexType>
59
60    <!-- Definitions for Generatables -->
61    <xs:complexType name="aliasType">
62        <xs:sequence>
63            <xs:element name="field" type="fieldType" maxOccurs="unbounded" minOccurs="0"/>
64        </xs:sequence>
65        <xs:attribute name="name" type="xs:string"/>
66        <xs:attribute name="cname" type="xs:string"/>
67        <xs:attribute name="type" type="xs:string"/>
68    </xs:complexType>
69
70    <xs:complexType name="boxedType">
71        <xs:choice maxOccurs="unbounded" minOccurs="0">
72            <xs:element name="method" type="methodType"/>
73            <xs:element name="constructor" type="constructorType"/>
74            <xs:element name="field" type="fieldType"/>
75        </xs:choice>
76        <xs:attribute name="name" type="xs:string"/>
77        <xs:attribute name="cname" type="xs:string"/>
78        <xs:attribute name="opaque" type="xs:boolean" use="optional"/>
79        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
80        <xs:attribute name="noequals" type="xs:boolean" use="optional"/>
81        <xs:attribute name="nohash" type="xs:boolean" use="optional"/>
82    </xs:complexType>
83
84    <xs:complexType name="callbackType">
85        <xs:sequence>
86            <xs:element name="return-type" type="return-typeType"/>
87            <xs:element name="parameters" minOccurs="0">
88                <xs:complexType>
89                    <xs:sequence>
90                        <xs:element name="parameter" type="method-parameterType" maxOccurs="unbounded" minOccurs="0"/>
91                    </xs:sequence>
92                </xs:complexType>
93            </xs:element>
94        </xs:sequence>
95        <xs:attribute name="name" type="xs:string"/>
96        <xs:attribute name="cname" type="xs:string"/>
97        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
98    </xs:complexType>
99
100    <xs:complexType name="classType">
101        <xs:sequence>
102            <xs:element name="method" type="methodType" maxOccurs="unbounded" minOccurs="0"/>
103        </xs:sequence>
104        <xs:attribute name="name" type="xs:string"/>
105        <xs:attribute name="cname" type="xs:string"/>
106        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
107        <xs:attribute name="internal" type="xs:boolean" use="optional"/>
108    </xs:complexType>
109
110    <xs:complexType name="enumType">
111        <xs:sequence>
112            <xs:element name="member" maxOccurs="unbounded" minOccurs="0">
113                <xs:complexType>
114                    <xs:attribute name="cname" type="xs:string"/>
115                    <xs:attribute name="name" type="xs:string"/>
116                    <xs:attribute name="value" type="xs:string"/>
117                </xs:complexType>
118            </xs:element>
119        </xs:sequence>
120        <xs:attribute name="name" type="xs:string"/>
121        <xs:attribute name="cname" type="xs:string"/>
122        <xs:attribute name="gtype" type="xs:string" use="optional"/>
123        <xs:attribute name="type" type="xs:string" use="optional"/>
124        <xs:attribute name="deprecated" type="xs:boolean" use="optional"/>
125        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
126    </xs:complexType>
127
128    <xs:complexType name="interfaceType">
129        <xs:choice maxOccurs="unbounded" minOccurs="0">
130            <xs:element name="class_struct" type="class_structType"/>
131            <xs:element name="constructor" type="constructorType"/>
132            <xs:element name="property" type="propertyType"/>
133            <xs:element name="method" type="methodType"/>
134            <xs:element name="virtual_method" type="virtual_methodType"/>
135            <xs:element name="signal" type="signalType"/>
136        </xs:choice>
137        <xs:attribute name="name" type="xs:string"/>
138        <xs:attribute name="cname" type="xs:string"/>
139        <xs:attribute name="consume_only" type="xs:boolean" use="optional"/>
140        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
141    </xs:complexType>
142
143    <xs:complexType name="objectType">
144        <xs:choice maxOccurs="unbounded" minOccurs="0">
145            <xs:element name="class_struct" type="class_structType"/>
146            <xs:element name="implements" type="implementsType"/>
147            <xs:element name="constructor" type="constructorType"/>
148            <xs:element name="field" type="fieldType"/>
149            <xs:element name="property" type="propertyType"/>
150            <xs:element name="childprop" type="propertyType"/>
151            <xs:element name="method" type="methodType"/>
152            <xs:element name="virtual_method" type="virtual_methodType"/>
153            <xs:element name="signal" type="signalType"/>
154            <xs:element name="static-string" type="static-stringType"/>
155            <xs:element name="custom-attribute" type="xs:string"/>
156        </xs:choice>
157        <xs:attribute name="name" type="xs:string"/>
158        <xs:attribute name="cname" type="xs:string"/>
159        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
160        <xs:attribute name="parent" type="xs:string" use="optional"/>
161    </xs:complexType>
162
163    <xs:complexType name="structType">
164        <xs:choice maxOccurs="unbounded" minOccurs="0">
165            <xs:element name="method" type="methodType"/>
166            <xs:element name="constructor" type="constructorType"/>
167            <xs:element name="field" type="fieldType"/>
168            <xs:element name="callback" type="callbackType"/>
169        </xs:choice>
170        <xs:attribute name="name" type="xs:string"/>
171        <xs:attribute name="cname" type="xs:string"/>
172        <xs:attribute name="deprecated" type="xs:boolean" use="optional"/>
173        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
174        <xs:attribute name="opaque" type="xs:boolean" use="optional"/>
175    </xs:complexType>
176
177
178    <!-- Definitions for the elements in Generatables -->
179    <xs:complexType name="class_structType">
180        <xs:choice maxOccurs="unbounded">
181            <xs:element name="field" type="fieldType" maxOccurs="unbounded"/>
182            <xs:element name="method" maxOccurs="unbounded" minOccurs="0">
183                <xs:complexType>
184                    <xs:attribute name="vm" type="xs:string" use="optional"/>
185                    <xs:attribute name="signal_vm" type="xs:string" use="optional"/>
186                </xs:complexType>
187            </xs:element>
188        </xs:choice>
189        <xs:attribute name="cname" type="xs:string"/>
190    </xs:complexType>
191
192    <xs:complexType name="constructorType">
193        <xs:choice maxOccurs="unbounded" minOccurs="0">
194            <xs:element name="parameters">
195                <xs:complexType>
196                    <xs:sequence>
197                        <xs:element name="parameter" type="constructor-parameterType" maxOccurs="unbounded" minOccurs="0"/>
198                    </xs:sequence>
199                </xs:complexType>
200            </xs:element>
201            <xs:element name="return-type" type="return-typeType"/>
202        </xs:choice>
203        <xs:attribute name="cname" type="xs:string"/>
204        <xs:attribute name="name" type="xs:string"/>
205        <xs:attribute name="deprecated" type="xs:boolean" use="optional"/>
206        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
207        <xs:attribute name="preferred" type="xs:boolean" use="optional"/>
208        <xs:attribute name="shared" type="xs:boolean" use="optional"/>
209        <xs:attribute name="win32_utf8_variant" type="xs:boolean" use="optional"/>
210    </xs:complexType>
211
212	<xs:complexType name="fieldType">
213        <xs:attribute name="name" type="xs:string"/>
214        <xs:attribute name="cname" type="xs:string"/>
215        <xs:attribute name="type" type="xs:string"/>
216        <xs:attribute name="array" type="xs:boolean" use="optional"/>
217        <xs:attribute name="array_len" type="xs:positiveInteger" use="optional"/>
218        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
219        <xs:attribute name="access" type="xs:string" use="optional"/>
220        <xs:attribute name="writeable" type="xs:boolean" use="optional"/>
221        <xs:attribute name="bits" type="xs:positiveInteger" use="optional"/>
222    </xs:complexType>
223
224    <xs:complexType name="implementsType">
225        <xs:sequence>
226            <xs:element name="interface" maxOccurs="unbounded">
227                <xs:complexType>
228                    <xs:attribute name="cname" type="xs:string"/>
229                    <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
230                </xs:complexType>
231            </xs:element>
232        </xs:sequence>
233    </xs:complexType>
234
235   <xs:complexType name="methodType">
236        <xs:sequence>
237            <xs:element name="return-type" type="return-typeType"/>
238            <xs:element name="parameters" minOccurs="0">
239                <xs:complexType>
240                    <xs:sequence>
241                        <xs:element name="parameter" type="method-parameterType" maxOccurs="unbounded" minOccurs="0"/>
242                    </xs:sequence>
243                </xs:complexType>
244            </xs:element>
245        </xs:sequence>
246        <xs:attribute name="name" type="xs:string"/>
247        <xs:attribute name="cname" type="xs:string"/>
248        <xs:attribute name="shared" type="xs:boolean" use="optional"/>
249        <xs:attribute name="new_flag" type="xs:boolean" use="optional"/>
250        <xs:attribute name="library" type="xs:string" use="optional"/>
251        <xs:attribute name="deprecated" type="xs:boolean" use="optional"/>
252        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
253        <xs:attribute name="win32_utf8_variant" type="xs:boolean" use="optional"/>
254    </xs:complexType>
255
256    <xs:complexType name="propertyType">
257        <xs:attribute name="name" type="xs:string"/>
258        <xs:attribute name="cname" type="xs:string"/>
259        <xs:attribute name="type" type="xs:string"/>
260        <xs:attribute name="construct" type="xs:boolean" use="optional"/>
261        <xs:attribute name="construct-only" type="xs:boolean" use="optional"/>
262        <xs:attribute name="new_flag" type="xs:boolean" use="optional"/>
263        <xs:attribute name="hidden" type="xs:boolean" use="optional"/>
264        <xs:attribute name="readable" type="xs:boolean" use="optional"/>
265        <xs:attribute name="writeable" type="xs:boolean" use="optional"/>
266    </xs:complexType>
267
268    <xs:complexType name="signalType">
269        <xs:complexContent>
270            <xs:extension base="methodType">
271                <xs:attribute name="when" type="whenType" use="optional"/>
272                <xs:attribute name="field_name" type="xs:string" use="optional"/>
273                <xs:attribute name="block_glue" type="xs:boolean" use="optional"/>
274                <xs:attribute name="manual" type="xs:boolean" use="optional"/>
275            </xs:extension>
276        </xs:complexContent>
277    </xs:complexType>
278
279    <xs:complexType name="static-stringType">
280        <xs:attribute name="name" type="xs:string"/>
281        <xs:attribute name="cname" type="xs:string"/>
282        <xs:attribute name="value" type="xs:string"/>
283    </xs:complexType>
284
285    <xs:complexType name="virtual_methodType">
286        <xs:complexContent>
287            <xs:extension base="methodType">
288                <xs:attribute name="override_in" type="override_inType" use="optional"/>
289                <xs:attribute name="padding" type="xs:boolean" use="optional"/>
290            </xs:extension>
291        </xs:complexContent>
292    </xs:complexType>
293
294    <!-- Definitions for lower-level elements -->
295    <xs:complexType name="parameterType">
296        <xs:attribute name="type" type="xs:string"/>
297        <xs:attribute name="name" type="xs:string"/>
298        <xs:attribute name="array" type="xs:boolean" use="optional"/>
299        <xs:attribute name="array_len" type="xs:positiveInteger" use="optional"/>
300        <xs:attribute name="null_term_array" type="xs:boolean" use="optional"/>
301        <xs:attribute name="ellipsis" type="xs:boolean" use="optional"/>
302        <xs:attribute name="owned" type="xs:boolean" use="optional"/>
303        <xs:attribute name="printf_format" type="xs:boolean" use="optional"/>
304        <xs:attribute name="printf_format_args" type="xs:boolean" use="optional"/>
305        <xs:attribute name="scope" type="scopeType" use="optional"/>
306    </xs:complexType>
307
308    <xs:complexType name="constructor-parameterType">
309        <xs:complexContent>
310            <xs:extension base="parameterType">
311                <xs:attribute name="property_name" type="xs:string" use="optional"/>
312            </xs:extension>
313        </xs:complexContent>
314    </xs:complexType>
315
316    <xs:complexType name="method-parameterType">
317        <xs:complexContent>
318            <xs:extension base="parameterType">
319                <xs:attribute name="pass_as" type="pass_asType" use="optional"/>
320            </xs:extension>
321        </xs:complexContent>
322    </xs:complexType>
323
324    <xs:complexType name="return-typeType">
325        <xs:attribute name="type" type="xs:string"/>
326        <xs:attribute name="element_type" type="xs:string" use="optional"/>
327        <xs:attribute name="owned" type="xs:boolean" use="optional"/>
328        <xs:attribute name="elements_owned" type="xs:boolean" use="optional"/>
329        <xs:attribute name="null_term_array" type="xs:boolean" use="optional"/>
330        <xs:attribute name="array_length_param" type="xs:string" use="optional"/>
331    </xs:complexType>
332
333    <!-- Definitions for allowed values -->
334    <xs:simpleType name="pass_asType">
335        <xs:restriction base="xs:string">
336            <xs:enumeration value="out"/>
337            <xs:enumeration value="ref"/>
338        </xs:restriction>
339    </xs:simpleType>
340
341    <xs:simpleType name="override_inType">
342        <xs:restriction base="xs:string">
343            <xs:enumeration value="declaring_class"/>
344            <xs:enumeration value="implementing_class"/>
345        </xs:restriction>
346    </xs:simpleType>
347
348    <xs:simpleType name="scopeType">
349        <xs:restriction base="xs:string">
350            <xs:enumeration value="call"/>
351            <xs:enumeration value="async"/>
352            <xs:enumeration value="notify"/>
353        </xs:restriction>
354    </xs:simpleType>
355
356    <xs:simpleType name="whenType">
357        <xs:restriction base="xs:string">
358            <xs:enumeration value="CLEANUP"/>
359            <xs:enumeration value="FIRST"/>
360            <xs:enumeration value="LAST"/>
361        </xs:restriction>
362    </xs:simpleType>
363
364</xs:schema>
365