# Copyright (c) 2013-2016 The Khronos Group Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and/or associated documentation files (the # "Materials"), to deal in the Materials without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Materials, and to # permit persons to whom the Materials are 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 Materials. # # THE MATERIALS ARE 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 OR COPYRIGHT HOLDERS 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 # MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. # Relax NG schema for Khronos Registry XML # See http://www.opengl.org/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 tag. # May be led by an optional tag containing e.g. copyrights. start = element registry { ( element comment { text } ? | Types * | Groups * | Enums * | Commands * | Feature * | Extensions * ) * } # defines a group of types Types = element types { 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 tag # api - matches a 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 definition. # comment - unused # - substitutes for an APIENTRY-style macro on output # - 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 } # defines a group of enum groups Groups = element groups { Group * } # defines a single enum group. Enums may # be in multiple groups. # name - group name # comment - unused # - members of the group Group = element group { Name , Comment ? , element enum { Name } * } # defines a group of enumerants # namespace - identifies a numeric namespace # group - identifies a functional subset of the namespace - same as # 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) * } # defines a single enumerant # value - integer (including hex) value of the enumerant # api - matches a api attribute, if present # type - "u" (unsigned), "ull" (uint64), or integer if not present # name - enumerant name # 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 alias { text } ? & Comment ? ) } # 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 ? } # defines a group of commands # namespace - identifies a function namespace Commands = element commands { attribute namespace { text } ? , Command * } # defines a single command # is the C function prototype, including the return type # are function parameters, in order # is a name, if present # is the function / parameter name # The textual contents of and should be legal C # for those parts of a function declaration. # - denotes function aliasing # name - name of aliased function # - denotes scalar / vector function equivalence # name - name of corresponding vector form, e.g. (glColor3f -> glColor3fv) # - 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 } ? , text , element ptype { TypeName } ? , text , element name { text } , text } , element param { attribute group { 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 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 # / 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 . Like a # 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 {|}* and each name must # exactly match an API being generated (implicit ^$ surrounding). # In addition, / 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 / tag, defining a group # of features to require or remove. # / / 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 }