1# Copyright (c) 2013-2017 The Khronos Group Inc. 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and/or associated documentation files (the 5# "Materials"), to deal in the Materials without restriction, including 6# without limitation the rights to use, copy, modify, merge, publish, 7# distribute, sublicense, and/or sell copies of the Materials, and to 8# permit persons to whom the Materials are furnished to do so, subject to 9# the following conditions: 10# 11# The above copyright notice and this permission notice shall be included 12# in all copies or substantial portions of the Materials. 13# 14# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 21 22# Relax NG schema for Khronos Registry XML 23# See https://www.github.com/KhronosGroup/EGL-Registry 24# 25# Last modified 2017/02/03 26# This definition is subject to change (mostly in the form of additions) 27 28namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes" 29 30# Toplevel is a <registry> tag. 31# May be led by an optional <comment> tag containing e.g. copyrights. 32start = element registry { 33 ( 34 element comment { text } ? | 35 Types * | 36 Groups * | 37 Enums * | 38 Commands * | 39 Feature * | 40 Extensions * 41 ) * 42} 43 44# <types> defines a group of types 45Types = element types { 46 Type * 47} 48 49# <type> defines a single type. It is usually a C typedef but 50# may contain arbitrary C code. 51# name - name of this type, if not present in the <name> tag 52# api - matches a <feature> api attribute, if present 53# requires - name of another type definition required by this one 54# type - "group", if present, indicating a group of values in the 55# corresponding <enums> definition. 56# comment - unused 57# <apientry /> - substitutes for an APIENTRY-style macro on output 58# <name> - contains typename 59Type = element type { 60 attribute api { text } ? , 61 attribute requires { text } ? , 62 attribute name { TypeName } ? , 63 attribute type { text } ? , 64 Comment ? , 65 text , 66 element apientry { text } ? , 67 text , 68 element name { TypeName } ? , 69 text 70} 71 72# <groups> defines a group of enum groups 73Groups = element groups { 74 Group * 75} 76 77# <group> defines a single enum group. Enums may 78# be in multiple groups. 79# name - group name 80# comment - unused 81# <enum name=""> - members of the group 82 83Group = element group { 84 Name , 85 Comment ? , 86 element enum { Name } * 87} 88 89# <enums> defines a group of enumerants 90# namespace - identifies a numeric namespace 91# group - identifies a functional subset of the namespace - same as <group name=""> 92# start, end - beginning and end of a numeric range in the namespace 93# vendor - owner of the numeric range 94# type - "bitmask", if present 95# comment - unused 96Enums = element enums { 97 attribute namespace { text } ? , 98 attribute group { text } ? , 99 attribute type { text } ? , 100 attribute start { Integer } ? , 101 attribute end { Integer } ? , 102 Vendor ? , 103 Comment ? , 104 (Enum | Unused) * 105} 106# <enum> defines a single enumerant 107# value - integer (including hex) value of the enumerant 108# api - matches a <feature> api attribute, if present 109# type - "u" (unsigned), "ull" (uint64), or integer if not present 110# name - enumerant name 111# alias - another enumerant this is semantically identical to 112# comment - unused 113Enum = element enum { 114 ( 115 attribute value { Integer } & 116 attribute api { text } ? & 117 attribute type { TypeSuffix } ? & 118 attribute name { text } & 119 attribute alias { text } ? & 120 Comment ? 121 ) 122} 123# <unused> defines a range of enumerants not currently being used 124# start, end - beginning and end of an unused numeric range 125# vendor - unused 126# comment - unused 127Unused = element unused { 128 attribute start { Integer } , 129 attribute end { Integer } ? , 130 Vendor ? , 131 Comment ? 132} 133# <commands> defines a group of commands 134# namespace - identifies a function namespace 135Commands = element commands { 136 attribute namespace { text } ? , 137 Command * 138} 139# <command> defines a single command 140# <proto> is the C function prototype, including the return type 141# <param> are function parameters, in order 142# <ptype> is a <type> name, if present 143# <name> is the function / parameter name 144# The textual contents of <proto> and <param> should be legal C 145# for those parts of a function declaration. 146# <alias> - denotes function aliasing 147# name - name of aliased function 148# <vecequiv> - denotes scalar / vector function equivalence 149# name - name of corresponding vector form, e.g. (glColor3f -> glColor3fv) 150# <glx> - information about GLX protocol 151# type - "render", "single", or "vendor" for GLXRender, GLXSingle, GLXVendorPrivate{WithReply} 152# opcode - numeric opcode of specified type for this function 153# name - if present, protocol name (defaults to command name) 154# comment - unused 155Command = element command { 156 Comment ? , 157 element proto { 158 attribute group { text } ? , 159 text , 160 element ptype { TypeName } ? , 161 text , 162 element name { text } , 163 text 164 } , 165 element param { 166 attribute group { text } ? , 167 attribute len { text } ? , 168 text , 169 element ptype { TypeName } ? , 170 text , 171 element name { text } , 172 text 173 } * , 174 ( 175 element alias { 176 Name 177 } ? & 178 element vecequiv { 179 Name 180 } ? & 181 element glx { 182 attribute type { text } , 183 attribute opcode { xsd:integer } , 184 Name ? , 185 Comment ? 186 } * 187 ) 188} 189# Each <feature> defines the interface of an API version (e.g. OpenGL 1.2) 190# api - API tag (e.g. 'gl', 'gles2', etc. - used internally, not 191# neccessarily an actual API name 192# name - version name (C preprocessor name, e.g. GL_VERSION_4_2) 193# number - version number, e.g. 4.2 194# protect - additional #ifdef symbol to place around the feature 195# <require> / <remove> contains features to require or remove in 196# this version 197# profile - only require/remove when generated profile matches 198# comment - unused 199Feature = element feature { 200 attribute api { text } , 201 Name , 202 attribute number { xsd:float } , 203 attribute protect { text } ?, 204 Comment ? , 205 ( 206 element require { 207 ProfileName ? , 208 Comment ? , 209 InterfaceElement * 210 } | 211 element remove { 212 ProfileName ? , 213 Comment ? , 214 InterfaceElement * 215 } 216 ) * 217} 218Extensions = element extensions { 219 Extension * 220} 221# Defines the interface of an API <extension>. Like a <feature> 222# tag, but with a slightly different api attribute. 223# api - regexp pattern matching one or more API tags, indicating 224# which APIs the extension is known to work with. The only 225# syntax supported is <name>{|<name>}* and each name must 226# exactly match an API being generated (implicit ^$ surrounding). 227# In addition, <require> / <remove> tags also support an 228# api attribute: 229# api - only require/remove these features for the matching API. 230# Not a regular expression. 231Extension = element extension { 232 Name , 233 attribute protect { text } ?, 234 attribute supported { StringGroup } ? , 235 Comment ? , 236 ( 237 element require { 238 attribute api { text } ? , 239 ProfileName ? , 240 Comment ? , 241 InterfaceElement * 242 } | 243 element remove { 244 attribute api { text } ? , 245 ProfileName ? , 246 Comment ? , 247 InterfaceElement * 248 } 249 ) * 250} 251# Contents of a <require> / <remove> tag, defining a group 252# of features to require or remove. 253# <type> / <enum> / <command> all have attributes 254# name - feature name which must match 255InterfaceElement = 256 element type { 257 Name , 258 Comment ? 259 } | 260 element enum { 261 Name , 262 Comment ? 263 } | 264 element command { 265 Name , 266 Comment ? 267 } 268 269# Integers are allowed to be either decimal or C-hex (0x[0-9A-F]+), but 270# XML Schema types don't seem to support hex notation, so we use this 271# as a placeholder. 272Integer = text 273 274# TypeName is an argument/return value C type name 275TypeName = text 276 277# TypeSuffix is a C numeric type suffix, e.g. 'u' or 'ull' 278TypeSuffix = text 279 280# StringGroup is a regular expression with an implicit 281# '^(' and ')$' bracketing it. 282StringGroup = text 283 284# Repeatedly used attributes 285ProfileName = attribute profile { text } 286Vendor = attribute vendor { text } 287Comment = attribute comment { text } 288Name = attribute name { text } 289