def get_func_parts(func, slot, is_global = False):
    virtual = isinstance(func, obj_function_virtual)
    capi_parts = func.get_capi_parts()

    csn_name = capi_parts['name']
    if not virtual:
        if is_global:
            if csn_name[0:4] == 'cef_':
                csn_name = csn_name[4:]
        else:
            csn_name = get_capi_name(func.get_name(), False, None)
            prefix = func.parent.get_capi_name()
            if prefix[-2:] == '_t':
                prefix = prefix[:-2]
            if prefix[0:3] == 'cef':
                subprefix = prefix[3:]
                pos = csn_name.find(subprefix)
                if pos >= 0:
                    csn_name = csn_name[0:pos]

    csn_args = []
    for carg in capi_parts['args']:
        type = schema.c2cs_type( carg[:carg.rindex(' ')] )
        name = schema.quote_name( carg[carg.rindex(' ')+1:] )
        csn_args.append({'name' : name, 'type' : type})

    iname = ''
    if virtual:
        iname = schema.get_iname(func.parent)

    result = {
        'basefunc': False,
        'virtual': virtual,
        'obj': func,
        'slot': '%x' % slot,
        'name': func.get_name(),
        'field_name': '_' + func.get_capi_name(),
        'delegate_type': func.get_capi_name() + '_delegate',
        'delegate_slot': '_ds%x' % slot,

        'capi_name': capi_parts['name'],
        'capi_retval': capi_parts['retval'],
        'capi_args': capi_parts['args'],

        'csn_name': csn_name,
        'csn_retval': schema.c2cs_type( capi_parts['retval'] ),
        'csn_args': csn_args,
        'csn_entrypoint': capi_parts['name'],

        'csn_args_proto': ', '.join(map(lambda x: '%s %s' % (x['type'], x['name']), csn_args)),

        'iname': iname,
        }
    return result
def get_func_parts(func, slot, is_global = False):
    virtual = isinstance(func, obj_function_virtual)
    capi_parts = func.get_capi_parts()

    csn_name = capi_parts['name']
    if not virtual:
        if is_global:
            if csn_name[0:4] == 'cef_':
                csn_name = csn_name[4:]
        else:
            csn_name = get_capi_name(func.get_name(), False, None)
            prefix = func.parent.get_capi_name()
            if prefix[-2:] == '_t':
                prefix = prefix[:-2]
            if prefix[0:3] == 'cef':
                subprefix = prefix[3:]
                pos = csn_name.find(subprefix)
                if pos >= 0:
                    csn_name = csn_name[0:pos]

    csn_args = []
    for carg in capi_parts['args']:
        type = schema.c2cs_type( carg[:carg.rindex(' ')] )
        name = schema.quote_name( carg[carg.rindex(' ')+1:] )
        csn_args.append({'name' : name, 'type' : type})

    iname = ''
    if virtual:
        iname = schema.get_iname(func.parent)

    result = {
        'basefunc': False,
        'virtual': virtual,
        'obj': func,
        'slot': '%x' % slot,
        'name': func.get_name(),
        'field_name': '_' + func.get_capi_name(),
        'delegate_type': func.get_capi_name() + '_delegate',
        'delegate_slot': '_ds%x' % slot,

        'capi_name': capi_parts['name'],
        'capi_retval': capi_parts['retval'],
        'capi_args': capi_parts['args'],

        'csn_name': csn_name,
        'csn_retval': schema.c2cs_type( capi_parts['retval'] ),
        'csn_args': csn_args,
        'csn_entrypoint': capi_parts['name'],

        'csn_args_proto': ', '.join(map(lambda x: '%s %s' % (x['type'], x['name']), csn_args)),

        'iname': iname,
        }
    return result