vkstruct.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:vkstruct 作者: cheery 项目源码 文件源码
def translate_enumeration(enum, constructor):
    name = enum["name"]
    name = rename_enumeration(name)
    print "{0} = {1}({0!r}, {{".format(name, constructor)
    # turns out the "expand" was insufficient nearly everywhere.
    prefix = "^VK_"
    for cell in split_case(name):
        prefix += "(" + cell.upper() + "_)?"
    for tag in enum:
        if tag.name == "enum":
            name_ = re.subn(prefix, "", tag["name"])[0]
            if "bitpos" in tag.attrs:
                value = "1 << " + tag["bitpos"]
            else:
                value = tag["value"]
            print "    {!r:<50}: {!s},".format(name_, value)
    print "})"
    return name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号