xcb.xsd revision d4401354
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="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  <!-- field replaces FIELD, PARAM, and REPLY. -->
59  <xsd:element name="field" type="var" />
60
61  <!-- list replaces ARRAYFIELD, LISTPARAM, and ARRAYREPLY.  The name and type
62       are specified as attributes.  The content is an expression giving the
63       length. -->
64  <xsd:element name="list">
65    <xsd:complexType>
66      <xsd:complexContent>
67        <xsd:extension base="var">
68          <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
69        </xsd:extension>
70      </xsd:complexContent>
71    </xsd:complexType>
72  </xsd:element>
73
74  <!-- Expressions -->
75  <xsd:group name="expression">
76    <xsd:choice>
77      <xsd:element name="op">
78        <xsd:complexType>
79          <xsd:sequence>
80            <xsd:group ref="expression" />
81            <xsd:group ref="expression" />
82          </xsd:sequence>
83          <xsd:attribute name="op" use="required">
84            <xsd:simpleType>
85              <xsd:restriction base="xsd:string">
86                <xsd:pattern value="\+|-|\*|/|&amp;|&lt;&lt;" />
87              </xsd:restriction>
88            </xsd:simpleType>
89          </xsd:attribute>
90        </xsd:complexType>
91      </xsd:element>
92      <xsd:element name="fieldref" type="xsd:string" />
93      <xsd:element name="value" type="dec-or-hex-integer" />
94      <xsd:element name="bit" type="xsd:integer" />
95    </xsd:choice>
96  </xsd:group>
97  
98  <!-- Fields in requests that are calculated from other information, not
99       supplied by the caller. -->
100  <xsd:element name="exprfield" >
101    <xsd:complexType>
102      <xsd:complexContent>
103        <xsd:extension base="var">
104          <xsd:group ref="expression" />
105        </xsd:extension>
106      </xsd:complexContent>
107    </xsd:complexType>
108  </xsd:element>
109
110  <!-- BITMASK/LISTofVALUE parameter pairs. -->
111  <xsd:element name="valueparam">
112    <xsd:complexType>
113      <xsd:attribute name="value-mask-type" type="xsd:string" use="required" />
114      <xsd:attribute name="value-mask-name" type="xsd:string" use="required" />
115      <xsd:attribute name="value-list-name" type="xsd:string" use="required" />
116    </xsd:complexType>
117  </xsd:element>
118
119  <xsd:group name="fields">
120    <xsd:choice>
121      <xsd:element ref="pad" />
122      <xsd:element ref="field" />
123      <xsd:element ref="list" />
124    </xsd:choice>
125  </xsd:group>
126
127  <!-- Type for a structure -->
128  <xsd:complexType name="struct">
129    <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
130    <xsd:attribute name="name" type="xsd:string" use="required" />
131  </xsd:complexType>
132
133  <!-- Type for a packet structure -->
134  <xsd:complexType name="packet-struct">
135    <xsd:group ref="fields" minOccurs="0" maxOccurs="unbounded" />
136    <xsd:attribute name="name" type="xsd:string" use="required" />
137    <xsd:attribute name="number" type="xsd:integer" use="required" />
138  </xsd:complexType>
139
140  <!-- Type for a packet structure copy -->
141  <xsd:complexType name="packet-struct-copy">
142    <xsd:attribute name="name" type="xsd:string" use="required" />
143    <xsd:attribute name="number" type="xsd:integer" use="required" />
144    <xsd:attribute name="ref" type="xsd:string" use="required" />
145  </xsd:complexType>
146
147  <!-- Type for hex integers -->
148  <xsd:simpleType name="hex-integer">
149    <xsd:restriction base="xsd:string">
150      <xsd:pattern value="0x[0-9a-fA-F]+" />
151    </xsd:restriction>
152  </xsd:simpleType>
153
154  <!-- Type for integers in either decimal or hex -->
155  <xsd:simpleType name="dec-or-hex-integer">
156    <xsd:union memberTypes="xsd:integer hex-integer" />
157  </xsd:simpleType>
158
159  <xsd:group name="macro">
160    <xsd:choice>
161      <xsd:element name="request">
162        <xsd:complexType>
163          <xsd:sequence>
164            <xsd:choice minOccurs="0" maxOccurs="unbounded">
165              <xsd:group ref="fields" />
166              <xsd:element ref="exprfield" />
167              <xsd:element ref="valueparam" />
168            </xsd:choice>
169            <xsd:element name="reply" minOccurs="0" maxOccurs="1">
170              <xsd:complexType>
171                <xsd:choice minOccurs="1" maxOccurs="unbounded">
172                  <xsd:group ref="fields" />
173                  <xsd:element ref="valueparam" />
174                </xsd:choice>
175              </xsd:complexType>
176            </xsd:element>
177          </xsd:sequence>
178          <xsd:attribute name="name" type="xsd:string" use="required" />
179          <xsd:attribute name="opcode" type="xsd:integer" use="required" />
180          <xsd:attribute name="combine-adjacent" type="xsd:boolean"
181                         use="optional"/>
182        </xsd:complexType>
183      </xsd:element>
184      <xsd:element name="event">
185        <xsd:complexType>
186          <xsd:complexContent>
187            <xsd:extension base="packet-struct">
188              <xsd:attribute name="no-sequence-number" type="xsd:boolean"
189                             use="optional" />
190            </xsd:extension>
191          </xsd:complexContent>
192        </xsd:complexType>
193      </xsd:element>
194      <xsd:element name="eventcopy" type="packet-struct-copy" />
195      <xsd:element name="error" type="packet-struct" />
196      <xsd:element name="errorcopy" type="packet-struct-copy" />
197      <xsd:element name="struct" type="struct" />
198      <xsd:element name="union" type="struct" />
199      <xsd:element name="xidtype">
200        <xsd:complexType>
201          <xsd:attribute name="name" type="xsd:string" use="required" />
202        </xsd:complexType>
203      </xsd:element>
204      <xsd:element name="xidunion">
205        <xsd:complexType>
206          <xsd:sequence>
207            <xsd:element name="type" type="xsd:string"
208                         minOccurs="1" maxOccurs="unbounded" />
209          </xsd:sequence>
210          <xsd:attribute name="name" type="xsd:string" use="required" />
211        </xsd:complexType>
212      </xsd:element>
213      <xsd:element name="enum">
214        <xsd:complexType>
215          <xsd:sequence minOccurs="1" maxOccurs="unbounded">
216            <xsd:element name="item">
217              <xsd:complexType>
218                <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
219                <xsd:attribute name="name" type="xsd:string" use="required" />
220              </xsd:complexType>
221            </xsd:element>
222          </xsd:sequence>
223          <xsd:attribute name="name" type="xsd:string" use="required" />
224        </xsd:complexType>
225      </xsd:element>
226      <xsd:element name="typedef">
227        <xsd:complexType>
228          <xsd:attribute name="oldname" type="xsd:string" use="required" />
229          <xsd:attribute name="newname" type="xsd:string" use="required" />
230        </xsd:complexType>
231      </xsd:element>
232      <!-- The import element allows a protocol description to reference the
233           declarations of another protocol description. -->
234      <xsd:element name="import" type="xsd:string" />
235    </xsd:choice>
236  </xsd:group>
237</xsd:schema>
238