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