summaryrefslogtreecommitdiff
path: root/volk/gen/make_h.py
blob: 354e57258892af086c07e8c63e921a65df9e08f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from xml.dom import minidom
from volk_regexp import *

def make_h(funclist, arched_arglist) :
    tempstring = "";
    tempstring = tempstring + '/*this file is auto generated by make_h.py*/\n';

    tempstring = tempstring + '\n#ifndef INCLUDED_VOLK_RUNTIME';
    tempstring = tempstring + '\n#define INCLUDED_VOLK_RUNTIME';
    tempstring = tempstring + '\n\n#include<volk/volk_typedefs.h>\n';
    tempstring = tempstring + '#include<volk/volk_config_fixed.h>\n';
    tempstring = tempstring + '#include<volk/volk_common.h>\n';
    tempstring = tempstring + '#include<volk/volk_complex.h>\n';
    tempstring = tempstring + '__VOLK_DECL_BEGIN\n';

    tempstring = tempstring + '\n';

    tempstring += """
struct volk_func_desc {
     const char **indices;
     const int *arch_defs;
     const int n_archs;
};

VOLK_API unsigned int volk_get_alignment(void);

"""
    for i in range(len(funclist)):
        tempstring += "extern VOLK_API " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n"
        tempstring += "extern VOLK_API void %s_manual%s;\n" % (funclist[i], arched_arglist[i])
        tempstring = strip_trailing(tempstring, " {")
        tempstring += "extern VOLK_API struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i])

    tempstring = tempstring + '__VOLK_DECL_END\n';
    tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n";

    return tempstring;