File: registry.rnc

package info (click to toggle)
khronos-api 4.6%2Bgit20220505-1
  • links: PTS
  • area: main
  • in suites: bookworm, sid
  • size: 3,508 kB
  • sloc: xml: 50,744; python: 1,681; makefile: 51; ansic: 23; php: 18; sh: 3
file content (275 lines) | stat: -rw-r--r-- 8,434 bytes parent folder | download | duplicates (7)
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# Copyright 2013-2020 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0

# Relax NG schema for Khronos Registry XML
# See https://github.com/KhronosGroup/OpenGL-Registry
#
# Last modified 2013/06/14
# This definition is subject to change (mostly in the form of additions)

namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

# Toplevel is a <registry> tag.
# May be led by an optional <comment> tag containing e.g. copyrights.
start = element registry {
    (
        element comment { text } ? |
        Types      * |
        Groups     * |
        Enums      * |
        Commands   * |
        Feature    * |
        Extensions *
    ) *
}

# <types> defines a group of types
Types = element types {
    Type *
}

# <type> defines a single type. It is usually a C typedef but
# may contain arbitrary C code.
#   name - name of this type, if not present in the <name> tag
#   api - matches a <feature> api attribute, if present
#   requires - name of another type definition required by this one
#   type - "group", if present, indicating a group of values in the
#       corresponding <enums> definition.
#   comment - unused
#   <apientry /> - substitutes for an APIENTRY-style macro on output
#   <name> - contains typename
Type = element type {
    attribute api { text } ? ,
    attribute requires { text } ? ,
    attribute name { TypeName } ? ,
    attribute type { text } ? ,
    Comment ? ,
    text ,
    element apientry { text } ? ,
    text ,
    element name { TypeName } ? ,
    text
}

# <groups> defines a group of enum groups
Groups = element groups {
    Group *
}

# <group> defines a single enum group. Enums may
# be in multiple groups.
#   name - group name
#   comment - unused
#   <enum name=""> - members of the group

Group = element group {
    Name ,
    Comment ? ,
    element enum { Name } *
}

# <enums> defines a group of enumerants
#   namespace - identifies a numeric namespace
#   group - identifies a functional subset of the namespace - same as group=""
#   start, end - beginning and end of a numeric range in the namespace
#   vendor - owner of the numeric range
#   type - "bitmask", if present
#   comment - unused
Enums = element enums {
    attribute namespace { text } ? ,
    attribute group { text } ? ,
    attribute type { text } ? ,
    attribute start { Integer } ? ,
    attribute end { Integer } ? ,
    Vendor ? ,
    Comment ? ,
    (Enum | Unused) *
}
# <enum> defines a single enumerant
#   value - integer (including hex) value of the enumerant
#   api - matches a <feature> api attribute, if present
#   type - "u" (unsigned), "ull" (uint64), or integer if not present
#   name - enumerant name
#   group - identifies a functional subset of the namespace
#   alias - another enumerant this is semantically identical to
#   comment - unused
Enum = element enum {
    (
        attribute value { Integer } &
        attribute api { text } ? &
        attribute type { TypeSuffix } ? &
        attribute name { text } &
        attribute group { text } ? &
        attribute alias { text } ? &
        Comment ?
    )
}
# <unused> defines a range of enumerants not currently being used
#   start, end - beginning and end of an unused numeric range
#   vendor - unused
#   comment - unused
Unused = element unused {
    attribute start { Integer } ,
    attribute end { Integer } ? ,
    Vendor ? ,
    Comment ?
}
# <commands> defines a group of commands
#   namespace - identifies a function namespace
Commands = element commands {
    attribute namespace { text } ? ,
    Command *
}
# <command> defines a single command
#   <proto> is the C function prototype, including the return type
#   <param> are function parameters, in order
#     class - type of object name (object handle). Handles with different types are not compatible. So handle created as [class=buffer] can not be passed to [class=shader]
#     <ptype> is a <type> name, if present
#     <name> is the function / parameter name
# The textual contents of <proto> and <param> should be legal C
# for those parts of a function declaration.
#   <alias> - denotes function aliasing
#     name - name of aliased function
#   <vecequiv> - denotes scalar / vector function equivalence
#     name - name of corresponding vector form, e.g. (glColor3f -> glColor3fv)
#   <glx> - information about GLX protocol
#     type - "render", "single", or "vendor" for GLXRender, GLXSingle, GLXVendorPrivate{WithReply}
#     opcode - numeric opcode of specified type for this function
#     name - if present, protocol name (defaults to command name)
#     comment - unused
Command = element command {
    Comment ? ,
    element proto {
        attribute group { text } ? ,
        attribute class { text } ? ,
        text ,
        element ptype { TypeName } ? ,
        text ,
        element name { text } ,
        text
    } ,
    element param {
        attribute group { text } ? ,
        attribute class { text } ? ,
        attribute len { text } ? ,
        text ,
        element ptype { TypeName } ? ,
        text ,
        element name { text } ,
        text
    } * ,
    (
        element alias {
            Name
        } ? &
        element vecequiv {
            Name
        } ? &
        element glx {
            attribute type { text } ,
            attribute opcode { xsd:integer } ,
            Name ? ,
            Comment ?
        } *
    )
}
# Each <feature> defines the interface of an API version (e.g. OpenGL 1.2)
#   api - API tag (e.g. 'gl', 'gles2', etc. - used internally, not
#     neccessarily an actual API name
#   name - version name (C preprocessor name, e.g. GL_VERSION_4_2)
#   number - version number, e.g. 4.2
#   protect - additional #ifdef symbol to place around the feature
#   <require> / <remove> contains features to require or remove in
#                        this version
#     profile - only require/remove when generated profile matches
#     comment - unused
Feature = element feature {
    attribute api { text } ,
    Name ,
    attribute number { xsd:float } ,
    attribute protect { text } ?,
    Comment ? ,
    (
        element require {
            ProfileName ? ,
            Comment ? ,
            InterfaceElement *
        } |
        element remove {
            ProfileName ? ,
            Comment ? ,
            InterfaceElement *
        }
    ) *
}
Extensions = element extensions {
    Extension *
}
# Defines the interface of an API <extension>. Like a <feature>
# tag, but with a slightly different api attribute.
#   api - regexp pattern matching one or more API tags, indicating
#     which APIs the extension is known to work with. The only
#     syntax supported is <name>{|<name>}* and each name must
#     exactly match an API being generated (implicit ^$ surrounding).
# In addition, <require> / <remove> tags also support an
# api attribute:
#     api - only require/remove these features for the matching API.
#       Not a regular expression.
Extension = element extension {
    Name ,
    attribute protect { text } ?,
    attribute supported { StringGroup } ? ,
    Comment ? ,
    (
        element require {
            attribute api { text } ? ,
            ProfileName ? ,
            Comment ? ,
            InterfaceElement *
        } |
        element remove {
            attribute api { text } ? ,
            ProfileName ? ,
            Comment ? ,
            InterfaceElement *
        }
    ) *
}
# Contents of a <require> / <remove> tag, defining a group
# of features to require or remove.
#   <type> / <enum> / <command> all have attributes
#     name - feature name which must match
InterfaceElement =
    element type {
        Name ,
        Comment ?
    } |
    element enum {
        Name ,
        Comment ?
    } |
    element command {
        Name ,
        Comment ?
    }

# Integers are allowed to be either decimal or C-hex (0x[0-9A-F]+), but
# XML Schema types don't seem to support hex notation, so we use this
# as a placeholder.
Integer = text

# TypeName is an argument/return value C type name
TypeName = text

# TypeSuffix is a C numeric type suffix, e.g. 'u' or 'ull'
TypeSuffix = text

# StringGroup is a regular expression with an implicit
#   '^(' and ')$' bracketing it.
StringGroup = text

# Repeatedly used attributes
ProfileName = attribute profile { text }
Vendor = attribute vendor { text }
Comment = attribute comment { text }
Name = attribute name { text }