INNER CODE UNIT · Python
parse_int_version
mosra/flextgl · flext.py:336
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
# need.
if 'type' in enum.attrib and api != 'vulkan':
value = "%s%s" % (enum.attrib['value'], enum.attrib['type'])