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