INNER CODE UNIT · Python

parse_xml_types

mosra/flextgl · flext.py:370

def parse_xml_types(root, enum_extensions, promoted_enum_extensions, api):
    types = []

    for type in root.findall("./types/type"):
        # While GL has just `api="gl"` for example, Vulkam now has
        # `api="vulkan,vulkansc,vulkanbase"` etc., so we can't just match the
        # whole atttribute value via an XQuery expression above and have to
        # check if it's in the list instead
        if 'api' in type.attrib and api not in type.attrib['api'].split(','):
            continue

        # Function pointers in Vulkan are special, inheriting the madness from
        # C and then some. Ugh. Used to be written in a way where it's enough
        # to just concatenate all text (like with GL), but as of 1.4.339 they
        # contain <proto> and such that has to be explicitly dived into.
        # Specialized parsing further below.
        if 'category' in type.attrib and type.attrib['category'] == 'funcpointer' and type.find('./proto') is not None:
            name = type.find('./proto/name').text

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…