Merge branch 'master' of git://anongit.freedesktop.org/~peterh/xcbproto
[profile/ivi/xcb-proto.git] / src / xcb.xsd
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 Copyright (C) 2004 Josh Triplett.  All Rights Reserved.
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the names of the authors or their
23 institutions shall not be used in advertising or otherwise to promote the
24 sale, use or other dealings in this Software without prior written
25 authorization from the authors.
26 -->
27 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
28
29   <!-- The root element -->
30   <xsd:element name="xcb">
31     <xsd:complexType>
32       <xsd:group ref="macro" minOccurs="0" maxOccurs="unbounded" />
33       <xsd:attribute name="header" type="xsd:string" use="required" />
34       <xsd:attribute name="extension-xname" type="xsd:string" use="optional" />
35       <xsd:attribute name="extension-name"  type="xsd:string" use="optional" />
36       <xsd:attribute name="extension-multiword" type="xsd:boolean" use="optional" default="false" />
37       <xsd:attribute name="major-version"   type="xsd:integer" use="optional" />
38       <xsd:attribute name="minor-version"   type="xsd:integer" use="optional" />
39     </xsd:complexType>
40   </xsd:element>
41
42   <!-- Padding -->
43   <xsd:element name="pad">
44     <xsd:complexType>
45       <xsd:attribute name="bytes" type="xsd:integer" use="required" />
46     </xsd:complexType>
47   </xsd:element>
48
49   <!-- Type for fields or parameters with attributes "name" and "type" -->
50   <xsd:complexType name="var">
51     <xsd:attribute name="name" type="xsd:string" use="required" />
52     <xsd:attribute name="type" type="xsd:string" use="required" />
53     <xsd:attribute name="enum" type="xsd:string" use="optional" />
54     <xsd:attribute name="altenum" type="xsd:string" use="optional" />
55     <xsd:attribute name="mask" type="xsd:string" use="optional" />
56   </xsd:complexType>
57
58   <!-- case expression -->
59   <xsd:complexType name="caseexpr">
60     <xsd:sequence>
61       <!-- case expression: -->
62       <xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
63       <!-- match -->
64       <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
65       <xsd:choice>
66         <xsd:element ref="switch" minOccurs="0" maxOccurs="unbounded" />
67       </xsd:choice>
68     </xsd:sequence>
69     <xsd:attribute name="name" type="xsd:string" use="optional" />
70   </xsd:complexType>
71
72   <!-- switch expression -->
73   <xsd:complexType name="switchexpr">
74     <xsd:sequence>
75       <!-- switch(expression) -->
76       <xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
77       <xsd:choice>
78         <!-- bitcase expression - bit test -->
79         <xsd:element name="bitcase" type="caseexpr" minOccurs="1" maxOccurs="unbounded" />
80       </xsd:choice>
81       <!-- default: -->
82       <xsd:group ref="fields" minOccurs="0" maxOccurs="1" />
83     </xsd:sequence>
84     <xsd:attribute name="name" type="xsd:string" use="required" />
85   </xsd:complexType>
86
87   <xsd:element name="switch" type="switchexpr" />
88
89   <!-- field replaces FIELD, PARAM, and REPLY. -->
90   <xsd:element name="field" type="var" />
91
92   <!-- list replaces ARRAYFIELD, LISTPARAM, and ARRAYREPLY.  The name and type
93        are specified as attributes.  The content is an expression giving the
94        length. -->
95   <xsd:element name="list">
96     <xsd:complexType>
97       <xsd:complexContent>
98         <xsd:extension base="var">
99           <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
100         </xsd:extension>
101       </xsd:complexContent>
102     </xsd:complexType>
103   </xsd:element>
104
105   <!-- Expressions -->
106   <xsd:group name="expression">
107     <xsd:choice>
108       <xsd:element name="op">
109         <xsd:complexType>
110           <xsd:sequence>
111             <xsd:group ref="expression" />
112             <xsd:group ref="expression" />
113           </xsd:sequence>
114           <xsd:attribute name="op" use="required">
115             <xsd:simpleType>
116               <xsd:restriction base="xsd:string">
117                 <xsd:pattern value="\+|-|\*|/|&amp;|&lt;&lt;" />
118               </xsd:restriction>
119             </xsd:simpleType>
120           </xsd:attribute>
121         </xsd:complexType>
122       </xsd:element>
123       <xsd:element name="unop">
124          <xsd:complexType>
125             <xsd:sequence>
126               <xsd:group ref="expression" />
127             </xsd:sequence>
128             <xsd:attribute name="op" use="required">
129               <xsd:simpleType>
130                 <xsd:restriction base="xsd:string">
131                   <xsd:pattern value="~" />
132                 </xsd:restriction>
133               </xsd:simpleType>
134             </xsd:attribute>
135          </xsd:complexType>
136       </xsd:element>
137       <xsd:element name="fieldref" type="xsd:string" />
138       <xsd:element name="enumref">
139         <xsd:complexType>
140           <xsd:simpleContent>
141             <xsd:extension base="xsd:string">
142               <xsd:attribute name="ref" use="required" type="xsd:string" />
143             </xsd:extension>
144           </xsd:simpleContent>
145         </xsd:complexType>
146       </xsd:element>
147       <xsd:element name="popcount">
148         <xsd:complexType>
149           <xsd:group ref="expression" />
150         </xsd:complexType>
151       </xsd:element>
152       <xsd:element name="sumof">
153         <xsd:complexType>
154           <xsd:attribute name="ref" use="required" type="xsd:string" />
155         </xsd:complexType>
156       </xsd:element>
157       <xsd:element name="value" type="dec-or-hex-integer" />
158       <xsd:element name="bit" type="xsd:integer" />
159     </xsd:choice>
160   </xsd:group>
161   
162   <!-- Fields in requests that are calculated from other information, not
163        supplied by the caller. -->
164   <xsd:element name="exprfield" >
165     <xsd:complexType>
166       <xsd:complexContent>
167         <xsd:extension base="var">
168           <xsd:group ref="expression" />
169         </xsd:extension>
170       </xsd:complexContent>
171     </xsd:complexType>
172   </xsd:element>
173
174   <!-- BITMASK/LISTofVALUE parameter pairs. -->
175   <xsd:element name="valueparam">
176     <xsd:complexType>
177       <xsd:attribute name="value-mask-type" type="xsd:string" use="required" />
178       <xsd:attribute name="value-mask-name" type="xsd:string" use="required" />
179       <xsd:attribute name="value-list-name" type="xsd:string" use="required" />
180     </xsd:complexType>
181   </xsd:element>
182
183   <xsd:group name="fields">
184     <xsd:choice>
185       <xsd:element ref="pad" />
186       <xsd:element ref="field" />
187       <xsd:element ref="list" />
188     </xsd:choice>
189   </xsd:group>
190
191   <!-- Type for a structure -->
192   <xsd:complexType name="struct">
193     <xsd:sequence>
194       <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
195       <xsd:choice minOccurs="0" maxOccurs="1">
196         <xsd:element ref="switch" />
197       </xsd:choice>
198     </xsd:sequence>
199     <xsd:attribute name="name" type="xsd:string" use="required" />
200   </xsd:complexType>
201
202   <!-- Type for a packet structure -->
203   <xsd:complexType name="packet-struct">
204     <xsd:group ref="fields" minOccurs="0" maxOccurs="unbounded" />
205     <xsd:attribute name="name" type="xsd:string" use="required" />
206     <xsd:attribute name="number" type="xsd:integer" use="required" />
207   </xsd:complexType>
208
209   <!-- Type for a packet structure copy -->
210   <xsd:complexType name="packet-struct-copy">
211     <xsd:attribute name="name" type="xsd:string" use="required" />
212     <xsd:attribute name="number" type="xsd:integer" use="required" />
213     <xsd:attribute name="ref" type="xsd:string" use="required" />
214   </xsd:complexType>
215
216   <!-- Type for hex integers -->
217   <xsd:simpleType name="hex-integer">
218     <xsd:restriction base="xsd:string">
219       <xsd:pattern value="0x[0-9a-fA-F]+" />
220     </xsd:restriction>
221   </xsd:simpleType>
222
223   <!-- Type for integers in either decimal or hex -->
224   <xsd:simpleType name="dec-or-hex-integer">
225     <xsd:union memberTypes="xsd:integer hex-integer" />
226   </xsd:simpleType>
227
228   <xsd:group name="macro">
229     <xsd:choice>
230       <xsd:element name="request">
231         <xsd:complexType>
232           <xsd:sequence>
233             <xsd:choice minOccurs="0" maxOccurs="unbounded">
234               <xsd:group ref="fields" />
235               <xsd:element ref="exprfield" />
236               <xsd:element ref="valueparam" />
237             </xsd:choice>
238             <xsd:choice minOccurs="0" maxOccurs="1">
239               <xsd:element ref="switch" />
240             </xsd:choice>
241             <xsd:element name="reply" minOccurs="0" maxOccurs="1">
242               <xsd:complexType>
243                 <xsd:sequence>
244                   <xsd:choice minOccurs="1" maxOccurs="unbounded">
245                     <xsd:group ref="fields" />
246                     <xsd:element ref="valueparam" />
247                   </xsd:choice>
248                   <xsd:choice minOccurs="0" maxOccurs="1">
249                     <xsd:element ref="switch" />
250                   </xsd:choice>
251                 </xsd:sequence>
252               </xsd:complexType>
253             </xsd:element>
254           </xsd:sequence>
255           <xsd:attribute name="name" type="xsd:string" use="required" />
256           <xsd:attribute name="opcode" type="xsd:integer" use="required" />
257           <xsd:attribute name="combine-adjacent" type="xsd:boolean"
258                          use="optional"/>
259         </xsd:complexType>
260       </xsd:element>
261       <xsd:element name="event">
262         <xsd:complexType>
263           <xsd:complexContent>
264             <xsd:extension base="packet-struct">
265               <xsd:attribute name="no-sequence-number" type="xsd:boolean"
266                              use="optional" />
267             </xsd:extension>
268           </xsd:complexContent>
269         </xsd:complexType>
270       </xsd:element>
271       <xsd:element name="eventcopy" type="packet-struct-copy" />
272       <xsd:element name="error" type="packet-struct" />
273       <xsd:element name="errorcopy" type="packet-struct-copy" />
274       <xsd:element name="struct" type="struct" />
275       <xsd:element name="union" type="struct" />
276       <xsd:element name="xidtype">
277         <xsd:complexType>
278           <xsd:attribute name="name" type="xsd:string" use="required" />
279         </xsd:complexType>
280       </xsd:element>
281       <xsd:element name="xidunion">
282         <xsd:complexType>
283           <xsd:sequence>
284             <xsd:element name="type" type="xsd:string"
285                          minOccurs="1" maxOccurs="unbounded" />
286           </xsd:sequence>
287           <xsd:attribute name="name" type="xsd:string" use="required" />
288         </xsd:complexType>
289       </xsd:element>
290       <xsd:element name="enum">
291         <xsd:complexType>
292           <xsd:sequence minOccurs="1" maxOccurs="unbounded">
293             <xsd:element name="item">
294               <xsd:complexType>
295                 <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
296                 <xsd:attribute name="name" type="xsd:string" use="required" />
297               </xsd:complexType>
298             </xsd:element>
299           </xsd:sequence>
300           <xsd:attribute name="name" type="xsd:string" use="required" />
301         </xsd:complexType>
302       </xsd:element>
303       <xsd:element name="typedef">
304         <xsd:complexType>
305           <xsd:attribute name="oldname" type="xsd:string" use="required" />
306           <xsd:attribute name="newname" type="xsd:string" use="required" />
307         </xsd:complexType>
308       </xsd:element>
309       <!-- The import element allows a protocol description to reference the
310            declarations of another protocol description. -->
311       <xsd:element name="import" type="xsd:string" />
312     </xsd:choice>
313   </xsd:group>
314 </xsd:schema>