xcb.xsd revision 891601f5
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3Copyright (C) 2004 Josh Triplett.  All Rights Reserved.
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the names of the authors or their
23institutions shall not be used in advertising or otherwise to promote the
24sale, use or other dealings in this Software without prior written
25authorization 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="0" maxOccurs="unbounded" />
82        <!-- case expression - value test -->
83        <xsd:element name="case" type="caseexpr" minOccurs="0" maxOccurs="unbounded" />
84      </xsd:choice>
85      <!-- default: -->
86      <xsd:group ref="fields" minOccurs="0" maxOccurs="1" />
87    </xsd:sequence>
88    <xsd:attribute name="name" type="xsd:string" use="required" />
89  </xsd:complexType>
90
91  <xsd:element name="switch" type="switchexpr" />
92
93  <!-- field replaces FIELD, PARAM, and REPLY. -->
94  <xsd:element name="field" type="var" />
95
96  <!-- fd passing parameter -->
97  <xsd:element name="fd">
98    <xsd:complexType>
99      <xsd:attribute name="name" type="xsd:string" use="required" />
100    </xsd:complexType>
101  </xsd:element>
102
103  <!-- list replaces ARRAYFIELD, LISTPARAM, and ARRAYREPLY.  The name and type
104       are specified as attributes.  The content is an expression giving the
105       length. -->
106  <xsd:element name="list">
107    <xsd:complexType>
108      <xsd:complexContent>
109        <xsd:extension base="var">
110          <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
111        </xsd:extension>
112      </xsd:complexContent>
113    </xsd:complexType>
114  </xsd:element>
115
116  <!-- Expressions -->
117  <xsd:group name="expression">
118    <xsd:choice>
119      <xsd:element name="op">
120        <xsd:complexType>
121          <xsd:sequence>
122            <xsd:group ref="expression" />
123            <xsd:group ref="expression" />
124          </xsd:sequence>
125          <xsd:attribute name="op" use="required">
126            <xsd:simpleType>
127              <xsd:restriction base="xsd:string">
128                <xsd:pattern value="\+|-|\*|/|&amp;|&lt;&lt;" />
129              </xsd:restriction>
130            </xsd:simpleType>
131          </xsd:attribute>
132        </xsd:complexType>
133      </xsd:element>
134      <xsd:element name="unop">
135         <xsd:complexType>
136            <xsd:sequence>
137              <xsd:group ref="expression" />
138            </xsd:sequence>
139            <xsd:attribute name="op" use="required">
140              <xsd:simpleType>
141                <xsd:restriction base="xsd:string">
142                  <xsd:pattern value="~" />
143                </xsd:restriction>
144              </xsd:simpleType>
145            </xsd:attribute>
146         </xsd:complexType>
147      </xsd:element>
148      <xsd:element name="fieldref" type="xsd:string" />
149      <xsd:element name="paramref">
150        <xsd:complexType>
151          <xsd:simpleContent>
152            <xsd:extension base="xsd:string">
153              <xsd:attribute name="type" use="required" type="xsd:string" />
154            </xsd:extension>
155          </xsd:simpleContent>
156        </xsd:complexType>
157      </xsd:element>
158      <xsd:element name="enumref">
159        <xsd:complexType>
160          <xsd:simpleContent>
161            <xsd:extension base="xsd:string">
162              <xsd:attribute name="ref" use="required" type="xsd:string" />
163            </xsd:extension>
164          </xsd:simpleContent>
165        </xsd:complexType>
166      </xsd:element>
167      <xsd:element name="popcount">
168        <xsd:complexType>
169          <xsd:group ref="expression" />
170        </xsd:complexType>
171      </xsd:element>
172      <xsd:element name="sumof">
173        <xsd:complexType>
174          <xsd:sequence>
175            <xsd:group ref="expression" minOccurs="0" maxOccurs="1"/>
176          </xsd:sequence>
177          <xsd:attribute name="ref" use="required" type="xsd:string" />
178        </xsd:complexType>
179      </xsd:element>
180      <xsd:element name="listelement-ref" />
181      <xsd:element name="value" type="xsd:integer" />
182      <xsd:element name="bit" type="bitType" />
183    </xsd:choice>
184  </xsd:group>
185  
186  <!-- Fields in requests that are calculated from other information, not
187       supplied by the caller. -->
188  <xsd:element name="exprfield" >
189    <xsd:complexType>
190      <xsd:complexContent>
191        <xsd:extension base="var">
192          <xsd:group ref="expression" />
193        </xsd:extension>
194      </xsd:complexContent>
195    </xsd:complexType>
196  </xsd:element>
197
198  <xsd:group name="fields">
199    <xsd:choice>
200      <xsd:element ref="pad" />
201      <xsd:element ref="field" />
202      <xsd:element ref="list" />
203      <xsd:element ref="fd" />
204    </xsd:choice>
205  </xsd:group>
206
207  <!-- Type for a structure -->
208  <xsd:complexType name="struct">
209    <xsd:sequence>
210      <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
211      <xsd:choice minOccurs="0" maxOccurs="1">
212        <xsd:element ref="switch" />
213      </xsd:choice>
214    </xsd:sequence>
215    <xsd:attribute name="name" type="xsd:string" use="required" />
216  </xsd:complexType>
217
218  <!-- Type for a packet structure -->
219  <xsd:complexType name="packet-struct">
220    <xsd:sequence>
221      <xsd:group ref="fields" minOccurs="0" maxOccurs="unbounded" />
222    </xsd:sequence>
223    <xsd:attribute name="name" type="xsd:string" use="required" />
224    <xsd:attribute name="number" type="xsd:integer" use="required" />
225  </xsd:complexType>
226
227  <!-- Type for a packet structure copy -->
228  <xsd:complexType name="packet-struct-copy">
229    <xsd:attribute name="name" type="xsd:string" use="required" />
230    <xsd:attribute name="number" type="xsd:integer" use="required" />
231    <xsd:attribute name="ref" type="xsd:string" use="required" />
232  </xsd:complexType>
233
234  <!-- Type for bit values -->
235  <xsd:simpleType name="bitType">
236    <xsd:restriction base="xsd:integer">
237      <xsd:minInclusive value="0" />
238      <xsd:maxExclusive value="32" />
239    </xsd:restriction>
240  </xsd:simpleType>
241
242  <!-- Type for documentation -->
243  <xsd:group name="doc-fields">
244    <xsd:sequence>
245      <xsd:element name="field">
246        <xsd:complexType>
247          <xsd:simpleContent>
248            <xsd:extension base="xsd:string">
249              <xsd:attribute name="name" type="xsd:string" />
250            </xsd:extension>
251          </xsd:simpleContent>
252        </xsd:complexType>
253      </xsd:element>
254    </xsd:sequence>
255  </xsd:group>
256
257  <xsd:group name="error-fields">
258    <xsd:sequence>
259      <xsd:element name="error">
260        <xsd:complexType>
261          <xsd:simpleContent>
262            <xsd:extension base="xsd:string">
263              <xsd:attribute name="type" type="xsd:string" />
264            </xsd:extension>
265          </xsd:simpleContent>
266        </xsd:complexType>
267      </xsd:element>
268    </xsd:sequence>
269  </xsd:group>
270
271  <xsd:group name="see-fields">
272    <xsd:sequence>
273      <xsd:element name="see">
274        <xsd:complexType>
275          <xsd:attribute name="name" type="xsd:string" />
276          <xsd:attribute name="type" type="xsd:string" />
277        </xsd:complexType>
278      </xsd:element>
279    </xsd:sequence>
280  </xsd:group>
281
282  <xsd:element name="doc">
283    <xsd:complexType mixed="true">
284      <xsd:sequence>
285        <xsd:element name="brief" type="xsd:string" minOccurs="0" maxOccurs="1" />
286        <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
287        <xsd:element name="example" type="xsd:string" minOccurs="0" maxOccurs="1" />
288        <xsd:group ref="doc-fields" minOccurs="0" maxOccurs="unbounded" />
289        <xsd:group ref="error-fields" minOccurs="0" maxOccurs="unbounded" />
290        <xsd:group ref="see-fields" minOccurs="0" maxOccurs="unbounded" />
291      </xsd:sequence>
292    </xsd:complexType>
293  </xsd:element>
294
295  <xsd:group name="macro">
296    <xsd:choice>
297      <xsd:element name="request">
298        <xsd:complexType>
299          <xsd:sequence>
300            <xsd:choice minOccurs="0" maxOccurs="unbounded">
301              <xsd:group ref="fields" />
302              <xsd:element ref="exprfield" />
303            </xsd:choice>
304            <xsd:choice minOccurs="0" maxOccurs="1">
305              <xsd:element ref="switch" />
306            </xsd:choice>
307            <xsd:element name="reply" minOccurs="0" maxOccurs="1">
308              <xsd:complexType>
309                <xsd:sequence>
310                  <xsd:choice minOccurs="1" maxOccurs="unbounded">
311                    <xsd:group ref="fields" />
312                  </xsd:choice>
313                  <xsd:choice minOccurs="0" maxOccurs="1">
314                    <xsd:element ref="switch" />
315                  </xsd:choice>
316                  <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
317                </xsd:sequence>
318              </xsd:complexType>
319            </xsd:element>
320            <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
321          </xsd:sequence>
322          <xsd:attribute name="name" type="xsd:string" use="required" />
323          <xsd:attribute name="opcode" type="xsd:integer" use="required" />
324          <xsd:attribute name="combine-adjacent" type="xsd:boolean"
325                         use="optional" default="false" />
326        </xsd:complexType>
327      </xsd:element>
328      <xsd:element name="event">
329        <xsd:complexType>
330          <xsd:complexContent>
331            <xsd:extension base="packet-struct">
332              <xsd:sequence>
333                <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
334              </xsd:sequence>
335              <xsd:attribute name="no-sequence-number" type="xsd:boolean"
336                             use="optional" default="false" />
337              <xsd:attribute name="xge" type="xsd:boolean"
338                             use="optional" default="false" />
339            </xsd:extension>
340          </xsd:complexContent>
341        </xsd:complexType>
342      </xsd:element>
343      <xsd:element name="eventcopy" type="packet-struct-copy" />
344      <xsd:element name="error" type="packet-struct" />
345      <xsd:element name="errorcopy" type="packet-struct-copy" />
346      <xsd:element name="struct" type="struct" />
347      <xsd:element name="union" type="struct" />
348      <xsd:element name="xidtype">
349        <xsd:complexType>
350          <xsd:attribute name="name" type="xsd:string" use="required" />
351        </xsd:complexType>
352      </xsd:element>
353      <xsd:element name="xidunion">
354        <xsd:complexType>
355          <xsd:sequence>
356            <xsd:element name="type" type="xsd:string"
357                         minOccurs="1" maxOccurs="unbounded" />
358          </xsd:sequence>
359          <xsd:attribute name="name" type="xsd:string" use="required" />
360        </xsd:complexType>
361      </xsd:element>
362      <xsd:element name="enum">
363        <xsd:complexType>
364          <xsd:sequence minOccurs="1" maxOccurs="unbounded">
365            <xsd:element name="item">
366              <xsd:complexType>
367                <xsd:choice minOccurs="1" maxOccurs="1">
368                  <xsd:element name="value" type="xsd:unsignedInt" />
369                  <xsd:element name="bit" type="bitType" />
370                </xsd:choice>
371                <xsd:attribute name="name" type="xsd:string" use="required" />
372              </xsd:complexType>
373            </xsd:element>
374            <xsd:element ref="doc" minOccurs="0" maxOccurs="1" />
375          </xsd:sequence>
376          <xsd:attribute name="name" type="xsd:string" use="required" />
377        </xsd:complexType>
378      </xsd:element>
379      <xsd:element name="typedef">
380        <xsd:complexType>
381          <xsd:attribute name="oldname" type="xsd:string" use="required" />
382          <xsd:attribute name="newname" type="xsd:string" use="required" />
383        </xsd:complexType>
384      </xsd:element>
385      <!-- The import element allows a protocol description to reference the
386           declarations of another protocol description. -->
387      <xsd:element name="import" type="xsd:string" />
388    </xsd:choice>
389  </xsd:group>
390</xsd:schema>
391