def model_typedefs(vk, model):
    """Fill the model with typedefs

    model['typedefs'] = {'name': 'type', ...}
    """
    model['typedefs'] = {}

    # bitmasks and basetypes
    bitmasks = [x for x in vk['registry']['types']['type']
                if x.get('@category') == 'bitmask']

    basetypes = [x for x in vk['registry']['types']['type']
                 if x.get('@category') == 'basetype']

    for typedef in bitmasks + basetypes:
        if not typedef.get('type'):
            continue
        model['typedefs'][typedef['name']] = typedef['type']

    # handles
    handles = [x for x in vk['registry']['types']['type']
               if x.get('@category') == 'handle']

    for handle in handles:
        if 'name' not in handle or 'type' not in handle:
            continue

        n = handle['name']
        t = handle['type']
        if t == 'VK_DEFINE_HANDLE':
            model['typedefs']['struct %s_T' % n] = '*%s' % n
        if t == 'VK_DEFINE_HANDLE':
            model['typedefs'][n] = 'uint64_t'

    # custom plaform dependant
    for name in ['Display', 'xcb_connection_t', 'wl_display', 'wl_surface',
                 'MirConnection', 'MirSurface', 'ANativeWindow',
                 'SECURITY_ATTRIBUTES']:
        model['typedefs'][name] = 'struct %s' % name

    model['typedefs'].update({
        'Window': 'uint32_t', 'VisualID': 'uint32_t',
        'xcb_window_t': 'uint32_t', 'xcb_visualid_t': 'uint32_t'
    })
def model_typedefs ( vk , model ) : model [ 'typedefs' ] = { } bitmasks = [ x for x in vk [ 'registry' ] [ 'types' ] [ 'type' ] if x . get ( '@category' ) == 'bitmask' ] basetypes = [ x for x in vk [ 'registry' ] [ 'types' ] [ 'type' ] if x . get ( '@category' ) == 'basetype' ] for typedef in bitmasks + basetypes : if not typedef . get ( 'type' ) : continue model [ 'typedefs' ] [ typedef [ 'name' ] ] = typedef [ 'type' ] handles = [ x for x in vk [ 'registry' ] [ 'types' ] [ 'type' ] if x . get ( '@category' ) == 'handle' ] for handle in handles : if 'name' not in handle or 'type' not in handle : continue n = handle [ 'name' ] t = handle [ 'type' ] if t == 'VK_DEFINE_HANDLE' : model [ 'typedefs' ] [ 'struct %s_T' % n ] = '*%s' % n if t == 'VK_DEFINE_HANDLE' : model [ 'typedefs' ] [ n ] = 'uint64_t' for name in [ 'Display' , 'xcb_connection_t' , 'wl_display' , 'wl_surface' , 'MirConnection' , 'MirSurface' , 'ANativeWindow' , 'SECURITY_ATTRIBUTES' ] : model [ 'typedefs' ] [ name ] = 'struct %s' % name model [ 'typedefs' ] . update ( { 'Window' : 'uint32_t' , 'VisualID' : 'uint32_t' , 'xcb_window_t' : 'uint32_t' , 'xcb_visualid_t' : 'uint32_t' } )
Fill the model with typedefs

    model['typedefs'] = {'name': 'type', ...}