示例#1
0
def do_template(template):
    # void, no callback
    for i in range(0, num_args):
        Tn = get_Tn_list(i)
        Tn_an = get_Tn_an_list(i)

        vars = {}
        vars['macro_end'] = 'VOID' + str(i)
        vars['ret_param'] = ''
        vars['type_params'] = '' if i == 0 else ',' + Tn
        vars['ret_type'] = 'void'
        vars['types'] = Tn
        vars['type_arg_params'] = Tn_an
        output_template(template, vars)

    # R, no callback
    for i in range(0, num_args):
        Tn = get_Tn_list(i)
        Tn_an = get_Tn_an_list(i)

        vars = {}
        vars['macro_end'] = 'RET' + str(i)
        vars['ret_param'] = ',R'
        vars['type_params'] = '' if i == 0 else ',' + Tn
        vars['ret_type'] = 'R'
        vars['types'] = Tn
        vars['type_arg_params'] = Tn_an
        output_template(template, vars)
def do_template(template):
    # void, no callback
    for i in range(0,num_args):
        Tn = get_Tn_list(i)
        Tn_an = get_Tn_an_list(i)

        vars = {}
        vars['macro_end'] = 'VOID' + str(i)
        vars['ret_param'] = ''
        vars['type_params'] = '' if i == 0 else ',' + Tn
        vars['ret_type'] = 'void'
        vars['types'] = Tn
        vars['type_arg_params'] = Tn_an
        output_template(template, vars)

    # R, no callback
    for i in range(0,num_args):
        Tn = get_Tn_list(i)
        Tn_an = get_Tn_an_list(i)

        vars = {}
        vars['macro_end'] = 'RET' + str(i)
        vars['ret_param'] = ',R'
        vars['type_params'] = '' if i == 0 else ',' + Tn
        vars['ret_type'] = 'R'
        vars['types'] = Tn
        vars['type_arg_params'] = Tn_an
        output_template(template, vars)
#ifndef LIBSIMDPP_DISPATCH_COLLECT_MACROS_GENERATED_H
#define LIBSIMDPP_DISPATCH_COLLECT_MACROS_GENERATED_H

#ifndef LIBSIMDPP_SIMD_H
    #error "This file must be included through simd.h"
#endif

#if SIMDPP_EMIT_DISPATCHER
''')

print('#define SIMDPP_DISPATCH_MAX_ARCHS ' + str(num_archs) + '\n')

for i in range(1, num_archs + 1):
    vars = {'num': str(i)}
    output_template(single_arch_template, vars)

print('''

#define SIMDPP_DISPATCH_DECLARE_FUNCTIONS(NAME,FUN_TYPE)                    \\'''
      )
for i in range(1, num_archs + 1):
    vars = {'num': str(i)}
    output_template(single_fn_declare_template, vars)

print('''

#define SIMDPP_DISPATCH_COLLECT_FUNCTIONS(ARRAY,NAME,FUN_TYPE)              \\'''
      )
for i in range(1, num_archs + 1):
    vars = {'num': str(i)}
#ifndef LIBSIMDPP_DISPATCH_COLLECT_MACROS_GENERATED_H
#define LIBSIMDPP_DISPATCH_COLLECT_MACROS_GENERATED_H

#ifndef LIBSIMDPP_SIMD_H
    #error "This file must be included through simd.h"
#endif

#if SIMDPP_EMIT_DISPATCHER
''')

print('#define SIMDPP_DISPATCH_MAX_ARCHS ' + str(num_archs) + '\n')

for i in range(1, num_archs+1):
    vars = { 'num' : str(i) }
    output_template(single_arch_template, vars)

print('''

#define SIMDPP_DISPATCH_DECLARE_FUNCTIONS(NAME,FUN_TYPE)                    \\''')
for i in range(1, num_archs+1):
    vars = { 'num' : str(i) }
    output_template(single_fn_declare_template, vars)

print('''

#define SIMDPP_DISPATCH_COLLECT_FUNCTIONS(ARRAY,NAME,FUN_TYPE)              \\''')
for i in range(1, num_archs+1):
    vars = { 'num' : str(i) }
    output_template(single_fn_register_template, vars)