77a696fd45d7c06ada6e607b83e0ac209914f452
[free-sw/xcb/proto] / 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="optional" />
46       <xsd:attribute name="align" type="xsd:integer" use="optional" />
47     </xsd:complexType>
48   </xsd:element>
49
50   <!-- Type for fields or parameters with attributes "name" and "type" -->
51   <xsd:complexType name="var">
52     <xsd:attribute name="name" type="xsd:string" use="required" />
53     <xsd:attribute name="type" type="xsd:string" use="required" />
54     <xsd:attribute name="enum" type="xsd:string" use="optional" />
55     <xsd:attribute name="altenum" type="xsd:string" use="optional" />
56     <xsd:attribute name="mask" type="xsd:string" use="optional" />
57   </xsd:complexType>
58
59   <!-- case expression -->
60   <xsd:complexType name="caseexpr">
61     <xsd:sequence>
62       <!-- case expression: -->
63       <xsd:group ref="expression" minOccurs="1" maxOccurs="unbounded" />
64       <!-- match -->
65       <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
66       <xsd:choice>
67         <xsd:element ref="switch" minOccurs="0" maxOccurs="unbounded" />
68       </xsd:choice>
69     </xsd:sequence>
70     <xsd:attribute name="name" type="xsd:string" use="optional" />
71   </xsd:complexType>
72
73   <!-- switch expression -->
74   <xsd:complexType name="switchexpr">
75     <xsd:sequence>
76       <!-- switch(expression) -->
77       <xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
78       <xsd:choice>
79         <!-- bitcase expression - bit test -->
80         <xsd:element name="bitcase" type="caseexpr" minOccurs="1" maxOccurs="unbounded" />
81       </xsd:choice>
82       <!-- default: -->
83       <xsd:group ref="fields" minOccurs="0" maxOccurs="1" />
84     </xsd:sequence>
85     <xsd:attribute name="name" type="xsd:string" use="required" />
86   </xsd:complexType>
87
88   <xsd:element name="switch" type="switchexpr" />
89
90   <!-- field replaces FIELD, PARAM, and REPLY. -->
91   <xsd:element name="field" type="var" />
92
93   <!-- fd passing parameter -->
94   <xsd:element name="fd">
95     <xsd:complexType>
96       <xsd:attribute name="name" type="xsd:string" use="required" />
97     </xsd:complexType>
98   </xsd:element>
99
100   <!-- list replaces ARRAYFIELD, LISTPARAM, and ARRAYREPLY.  The name and type
101        are specified as attributes.  The content is an expression giving the
102        length. -->
103   <xsd:element name="list">
104     <xsd:complexType>
105       <xsd:complexContent>
106         <xsd:extension base="var">
107           <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
108         </xsd:extension>
109       </xsd:complexContent>
110     </xsd:complexType>
111   </xsd:element>
112
113   <!-- Expressions -->
114   <xsd:group name="expression">
115     <xsd:choice>
116       <xsd:element name="op">
117         <xsd:complexType>
118           <xsd:sequence>
119             <xsd:group ref="expression" />
120             <xsd:group ref="expression" />
121           </xsd:sequence>
122           <xsd:attribute name="op" use="required">
123             <xsd:simpleType>
124               <xsd:restriction base="xsd:string">
125                 <xsd:pattern value="\+|-|\*|/|&amp;|&lt;&lt;" />
126               </xsd:restriction>
127             </xsd:simpleType>
128           </xsd:attribute>
129         </xsd:complexType>
130       </xsd:element>
131       <xsd:element name="unop">
132          <xsd:complexType>
133             <xsd:sequence>
134               <xsd:group ref="expression" />
135             </xsd:sequence>
136             <xsd:attribute name="op" use="required">
137               <xsd:simpleType>
138                 <xsd:restriction base="xsd:string">
139                   <xsd:pattern value="~" />
140                 </xsd:restriction>
141               </xsd:simpleType>
142             </xsd:attribute>
143          </xsd:complexType>
144       </xsd:element>
145       <xsd:element name="fieldref" type="xsd:string" />
146       <xsd:element name="enumref">
147         <xsd:complexType>
148           <xsd:simpleContent>
149             <xsd:extension base="xsd:string">
150               <xsd:attribute name="ref" use="required" type="xsd:string" />
151             </xsd:extension>
152           </xsd:simpleContent>
153         </xsd:complexType>
154       </xsd:element>
155       <xsd:element name="popcount">
156         <xsd:complexType>
157           <xsd:group ref="expression" />
158         </xsd:complexType>
159       </xsd:element>
160       <xsd:element name="sumof">
161         <xsd:complexType>
162           <xsd:attribute name="ref" use="required" type="xsd:string" />
163         </xsd:complexType>
164       </xsd:element>
165       <xsd:element name="value" type="xsd:integer" />
166       <xsd:element name="bit" type="xsd:integer" />
167     </xsd:choice>
168   </xsd:group>
169   
170   <!-- Fields in requests that are calculated from other information, not
171        supplied by the caller. -->
172   <xsd:element name="exprfield" >
173     <xsd:complexType>
174       <xsd:complexContent>
175         <xsd:extension base="var">
176           <xsd:group ref="expression" />
177         </xsd:extension>
178       </xsd:complexContent>
179     </xsd:complexType>
180   </xsd:element>
181
182   <!-- BITMASK/LISTofVALUE parameter pairs. -->
183   <xsd:element name="valueparam">
184     <xsd:complexType>
185       <xsd:attribute name="value-mask-type" type="xsd:string" use="required" />
186       <xsd:attribute name="value-mask-name" type="xsd:string" use="required" />
187       <xsd:attribute name="value-list-name" type="xsd:string" use="required" />
188     </xsd:complexType>
189   </xsd:element>
190
191   <xsd:group name="fields">
192     <xsd:choice>
193       <xsd:element ref="pad" />
194       <xsd:element ref="field" />
195       <xsd:element ref="list" />
196       <xsd:element ref="fd" />
197     </xsd:choice>
198   </xsd:group>
199
200   <!-- Type for a structure -->
201   <xsd:complexType name="struct">
202     <xsd:sequence>
203       <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
204       <xsd:choice minOccurs="0" maxOccurs="1">
205         <xsd:element ref="switch" />
206       </xsd:choice>
207     </xsd:sequence>
208     <xsd:attribute name="name" type="xsd:string" use="required" />
209   </xsd:complexType>
210
211   <!-- Type for a packet structure -->
212   <xsd:complexType name="packet-struct">
213     <xsd:sequence>
214       <xsd:group ref="fields" minOccurs="0" maxOccurs="unbounded" />
215     </xsd:sequence>
216     <xsd:attribute name="name" type="xsd:string" use="required" />
217     <xsd:attribute name="number" type="xsd:integer" use="required" />
218   </xsd:complexType>
219
220   <!-- Type for a packet structure copy -->
221   <xsd:complexType name="packet-struct-copy">
222     <xsd:attribute name="name" type="xsd:string" use="required" />
223     <xsd:attribute name="number" type="xsd:integer" use="required" />
224     <xsd:attribute name="ref" type="xsd:string" use="required" />
225   </xsd:complexType>
226
227   <!-- Type for documentation -->
228   <xsd:group name="doc-fields">
229     <xsd:sequence>
230       <xsd:element name="field">
231         <xsd:complexType>
232           <xsd:simpleContent>
233             <xsd:extension base="xsd:string">
234               <xsd:attribute name="name" type="xsd:string" />
235             </xsd:extension>
236           </xsd:simpleContent>
237         </xsd:complexType>
238       </xsd:element>
239     </xsd:sequence>
240   </xsd:group>
241
242   <xsd:group name="error-fields">
243     <xsd:sequence>
244       <xsd:element name="error">
245         <xsd:complexType>
246           <xsd:simpleContent>
247             <xsd:extension base="xsd:string">
248               <xsd:attribute name="type" type="xsd:string" />
249             </xsd:extension>
250           </xsd:simpleContent>
251         </xsd:complexType>
252       </xsd:element>
253     </xsd:sequence>
254   </xsd:group>
255
256   <xsd:group name="see-fields">
257     <xsd:sequence>
258       <xsd:element name="see">
259         <xsd:complexType>
260           <xsd:attribute name="name" type="xsd:string" />
261           <xsd:attribute name="type" type="xsd:string" />
262         </xsd:complexType>
263       </xsd:element>
264     </xsd:sequence>
265   </xsd:group>
266
267   <xsd:element name="doc">
268     <xsd:complexType mixed="true">
269       <xsd:sequence>
270         <xsd:element name="brief" type="xsd:string" minOccurs="0" maxOccurs="1" />
271         <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
272         <xsd:element name="example" type="xsd:string" minOccurs="0" maxOccurs="1" />
273         <xsd:group ref="doc-fields" minOccurs="0" maxOccurs="unbounded" />
274         <xsd:group ref="error-fields" minOccurs="0" maxOccurs="unbounded" />
275         <xsd:group ref="see-fields" minOccurs="0" maxOccurs="unbounded" />
276       </xsd:sequence>
277     </xsd:complexType>
278   </xsd:element>
279
280   <xsd:group name="macro">
281     <xsd:choice>
282       <xsd:element name="request">
283         <xsd:complexType>
284           <xsd:sequence>
285             <xsd:choice minOccurs="0" maxOccurs="unbounded">
286               <xsd:group ref="fields" />
287               <xsd:element ref="exprfield" />
288               <xsd:element ref="valueparam" />
289             </xsd:choice>
290             <xsd:choice minOccurs="0" maxOccurs="1">
291               <xsd:element ref="switch" />
292             </xsd:choice>
293             <xsd:element name="reply" minOccurs="0" maxOccurs="1">
294               <xsd:complexType>
295                 <xsd:sequence>
296                   <xsd:choice minOccurs="1" maxOccurs="unbounded">
297                     <xsd:group ref="fields" />
298                     <xsd:element ref="valueparam" />
299                   </xsd:choice>
300                   <xsd:choice minOccurs="0" maxOccurs="1">
301                     <xsd:element ref="switch" />
302                   </xsd:choice>
303                   <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
304                 </xsd:sequence>
305               </xsd:complexType>
306             </xsd:element>
307             <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
308           </xsd:sequence>
309           <xsd:attribute name="name" type="xsd:string" use="required" />
310           <xsd:attribute name="opcode" type="xsd:integer" use="required" />
311           <xsd:attribute name="combine-adjacent" type="xsd:boolean"
312                          use="optional" default="false" />
313         </xsd:complexType>
314       </xsd:element>
315       <xsd:element name="event">
316         <xsd:complexType>
317           <xsd:complexContent>
318             <xsd:extension base="packet-struct">
319               <xsd:sequence>
320                 <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
321               </xsd:sequence>
322               <xsd:attribute name="no-sequence-number" type="xsd:boolean"
323                              use="optional" default="false" />
324               <xsd:attribute name="xge" type="xsd:boolean"
325                              use="optional" default="false" />
326             </xsd:extension>
327           </xsd:complexContent>
328         </xsd:complexType>
329       </xsd:element>
330       <xsd:element name="eventcopy" type="packet-struct-copy" />
331       <xsd:element name="error" type="packet-struct" />
332       <xsd:element name="errorcopy" type="packet-struct-copy" />
333       <xsd:element name="struct" type="struct" />
334       <xsd:element name="union" type="struct" />
335       <xsd:element name="xidtype">
336         <xsd:complexType>
337           <xsd:attribute name="name" type="xsd:string" use="required" />
338         </xsd:complexType>
339       </xsd:element>
340       <xsd:element name="xidunion">
341         <xsd:complexType>
342           <xsd:sequence>
343             <xsd:element name="type" type="xsd:string"
344                          minOccurs="1" maxOccurs="unbounded" />
345           </xsd:sequence>
346           <xsd:attribute name="name" type="xsd:string" use="required" />
347         </xsd:complexType>
348       </xsd:element>
349       <xsd:element name="enum">
350         <xsd:complexType>
351           <xsd:sequence minOccurs="1" maxOccurs="unbounded">
352             <xsd:element name="item">
353               <xsd:complexType>
354                 <xsd:choice minOccurs="1" maxOccurs="1">
355                   <xsd:element name="value" type="xsd:integer" />
356                   <xsd:element name="bit" type="xsd:integer" />
357                 </xsd:choice>
358                 <xsd:attribute name="name" type="xsd:string" use="required" />
359               </xsd:complexType>
360             </xsd:element>
361             <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
362           </xsd:sequence>
363           <xsd:attribute name="name" type="xsd:string" use="required" />
364         </xsd:complexType>
365       </xsd:element>
366       <xsd:element name="typedef">
367         <xsd:complexType>
368           <xsd:attribute name="oldname" type="xsd:string" use="required" />
369           <xsd:attribute name="newname" type="xsd:string" use="required" />
370         </xsd:complexType>
371       </xsd:element>
372       <!-- The import element allows a protocol description to reference the
373            declarations of another protocol description. -->
374       <xsd:element name="import" type="xsd:string" />
375     </xsd:choice>
376   </xsd:group>
377 </xsd:schema>