summaryrefslogtreecommitdiff
path: root/src/xcb.xsd
blob: 8cac620aadaac0e28c6db1329ae669c6bcab9288 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2004 Josh Triplett.  All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the names of the authors or their
institutions shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the authors.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <!-- The root element -->
  <xsd:element name="xcb">
    <xsd:complexType>
      <xsd:group ref="macro" minOccurs="0" maxOccurs="unbounded" />
      <xsd:attribute name="header" type="xsd:string" use="required" />
      <xsd:attribute name="extension-xname" type="xsd:string" use="optional" />
      <xsd:attribute name="extension-name"  type="xsd:string" use="optional" />
    </xsd:complexType>
  </xsd:element>

  <!-- Padding -->
  <xsd:element name="pad">
    <xsd:complexType>
      <xsd:attribute name="bytes" type="xsd:integer" use="required" />
    </xsd:complexType>
  </xsd:element>

  <!-- Type for fields or parameters with attributes "name" and "type" -->
  <xsd:complexType name="var">
    <xsd:attribute name="name" type="xsd:string" use="required" />
    <xsd:attribute name="type" type="xsd:string" use="required" />
  </xsd:complexType>

  <!-- field replaces FIELD, PARAM, and REPLY. -->
  <xsd:element name="field" type="var" />

  <!-- list replaces ARRAYFIELD, LISTPARAM, and ARRAYREPLY.  The name and type
       are specified as attributes.  The content is an expression giving the
       length. -->
  <xsd:element name="list">
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:extension base="var">
          <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>

  <!-- Parameters in requests that are not sent with the request. -->
  <xsd:element name="localfield" type="var" />
  
  <!-- Expressions -->
  <xsd:group name="expression">
    <xsd:choice>
      <xsd:element name="op">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:group ref="expression" />
            <xsd:group ref="expression" />
          </xsd:sequence>
          <xsd:attribute name="op" use="required">
            <xsd:simpleType>
              <xsd:restriction base="xsd:string">
                <xsd:pattern value="\+|-|\*|/|&amp;|&lt;&lt;" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:attribute>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="fieldref" type="xsd:string" />
      <xsd:element name="value" type="dec-or-hex-integer" />
    </xsd:choice>
  </xsd:group>
  
  <!-- Fields in requests that are calculated from other information, not
       supplied by the caller. -->
  <xsd:element name="exprfield" >
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:extension base="var">
          <xsd:group ref="expression" />
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>

  <!-- BITMASK/LISTofVALUE parameter pairs. -->
  <xsd:element name="valueparam">
    <xsd:complexType>
      <xsd:attribute name="value-mask-type" type="xsd:string" use="required" />
      <xsd:attribute name="value-mask-name" type="xsd:string" use="required" />
      <xsd:attribute name="value-list-name" type="xsd:string" use="required" />
    </xsd:complexType>
  </xsd:element>

  <xsd:group name="fields">
    <xsd:choice>
      <xsd:element ref="pad" />
      <xsd:element ref="field" />
      <xsd:element ref="list" />
    </xsd:choice>
  </xsd:group>

  <!-- Type for a structure -->
  <xsd:complexType name="struct">
    <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
    <xsd:attribute name="name" type="xsd:string" use="required" />
  </xsd:complexType>

  <!-- Type for a packet structure -->
  <xsd:complexType name="packet-struct">
    <xsd:group ref="fields" minOccurs="0" maxOccurs="unbounded" />
    <xsd:attribute name="name" type="xsd:string" use="required" />
    <xsd:attribute name="number" type="xsd:integer" use="required" />
  </xsd:complexType>

  <!-- Type for a packet structure copy -->
  <xsd:complexType name="packet-struct-copy">
    <xsd:attribute name="name" type="xsd:string" use="required" />
    <xsd:attribute name="number" type="xsd:integer" use="required" />
    <xsd:attribute name="ref" type="xsd:string" use="required" />
  </xsd:complexType>

  <!-- Type for hex integers -->
  <xsd:simpleType name="hex-integer">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="0x[0-9a-fA-F]+" />
    </xsd:restriction>
  </xsd:simpleType>

  <!-- Type for integers in either decimal or hex -->
  <xsd:simpleType name="dec-or-hex-integer">
    <xsd:union memberTypes="xsd:integer hex-integer" />
  </xsd:simpleType>

  <xsd:group name="macro">
    <xsd:choice>
      <xsd:element name="request">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:choice minOccurs="0" maxOccurs="unbounded">
              <xsd:group ref="fields" />
              <xsd:element ref="localfield" />
              <xsd:element ref="exprfield" />
              <xsd:element ref="valueparam" />
            </xsd:choice>
            <xsd:element name="reply" minOccurs="0" maxOccurs="1">
              <xsd:complexType>
                <xsd:choice minOccurs="1" maxOccurs="unbounded">
                  <xsd:group ref="fields" />
                  <xsd:element ref="valueparam" />
                </xsd:choice>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
          <xsd:attribute name="name" type="xsd:string" use="required" />
          <xsd:attribute name="opcode" type="xsd:integer" use="required" />
          <xsd:attribute name="combine-adjacent" type="xsd:boolean"
                         use="optional"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="event">
        <xsd:complexType>
          <xsd:complexContent>
            <xsd:extension base="packet-struct">
              <xsd:attribute name="no-sequence-number" type="xsd:boolean"
                             use="optional" />
            </xsd:extension>
          </xsd:complexContent>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="eventcopy" type="packet-struct-copy" />
      <xsd:element name="error" type="packet-struct" />
      <xsd:element name="errorcopy" type="packet-struct-copy" />
      <xsd:element name="struct" type="struct" />
      <xsd:element name="union" type="struct" />
      <xsd:element name="xidtype">
        <xsd:complexType>
          <xsd:attribute name="name" type="xsd:string" use="required" />
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="enum">
        <xsd:complexType>
          <xsd:sequence minOccurs="1" maxOccurs="unbounded">
            <xsd:element name="item">
              <xsd:complexType>
                <xsd:group ref="expression" minOccurs="0" maxOccurs="1" />
                <xsd:attribute name="name" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
          <xsd:attribute name="name" type="xsd:string" use="required" />
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="typedef">
        <xsd:complexType>
          <xsd:attribute name="oldname" type="xsd:string" use="required" />
          <xsd:attribute name="newname" type="xsd:string" use="required" />
        </xsd:complexType>
      </xsd:element>
      <!-- The import element allows a protocol description to reference the
           declarations of another protocol description. -->
      <xsd:element name="import" type="xsd:string" />
    </xsd:choice>
  </xsd:group>
</xsd:schema>