create_vulkan_wrapper.py 文件源码

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

项目:python-vulkan-wrapper 作者: gabdube 项目源码 文件源码
def translate_type(t):
    table = { 
        "float": 'c_float',
        "uint32_t": 'c_uint32', 
        "uint64_t": 'c_uint64',
        "size_t": 'c_size_t',
        "float": 'c_float',
        'int32_t': 'c_int32',
        'int': 'c_int32',
        'uint8_t': 'c_int8',
        "char": "c_char",
        "void": "None", 
        "void*": "c_void_p", 
        "const void*": 'c_void_p',
        "const char*": 'c_char_p',
        "const char* const*": 'POINTER(c_char_p)',
        "struct wl_display*": "POINTER(wl_display)",
        "struct wl_surface*": "POINTER(wl_surface)",
        "const ObjectTableEntryNVX* const*": "POINTER(POINTER(ObjectTableEntryNVX))",
        'v': ''
     }

    if t in table.keys():
        return table[t]

    if t.endswith("*"):
        if t.startswith("const"):
            ttype = t[6:len(t)-1]
            ttype = table[ttype] if ttype in table else ttype
            return "POINTER({})".format(ttype)
        else:
            ttype = t[:len(t)-1]
            ttype = table[ttype] if ttype in table else ttype
            return "POINTER({})".format(ttype)

    return t
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号