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