INNER CODE UNIT · Python
extract_names
mosra/flextgl · flext.py:333
def extract_names(feature, selector):
return [element.attrib['name'] for element in feature.findall('./%s[@name]' % selector)]
def parse_int_version(version_str):
version_pattern = re.compile(r'(\d)\.(\d)')
match = version_pattern.match(version_str)
return int(match.group(1)) * 10 + int(match.group(2))
def parse_xml_enums(root, api):
enums = {}
for enum in root.findall("./enums/enum"):
# Doesn't seem to be used in Vulkan, so no need to handle cases like
# `api="vulkan,vulkansc,vulkanbase"` here.
if ('api' in enum.attrib and enum.attrib['api'] != api): continue
name = enum.attrib['name']
# GL type attribute is a literal suffix (which we need), while Vulkan
# type attribute (since 1.2.174) is an actual C type, which we don't