Statistics
| Branch: | Tag: | Revision:

root / volk / gen / make_h.py @ ccfac187

History | View | Annotate | Download (1.4 kB)

1 23914465 Tom Rondeau
from xml.dom import minidom
2 23914465 Tom Rondeau
from volk_regexp import *
3 23914465 Tom Rondeau
4 668da8bd Nick Foster
def make_h(funclist, arched_arglist) :
5 23914465 Tom Rondeau
    tempstring = "";
6 8608fc3a Nick Foster
    tempstring = tempstring + '/*this file is auto generated by make_h.py*/\n';
7 8608fc3a Nick Foster
8 8608fc3a Nick Foster
    tempstring = tempstring + '\n#ifndef INCLUDED_VOLK_RUNTIME';
9 8608fc3a Nick Foster
    tempstring = tempstring + '\n#define INCLUDED_VOLK_RUNTIME';
10 8608fc3a Nick Foster
    tempstring = tempstring + '\n\n#include<volk/volk_typedefs.h>\n';
11 23914465 Tom Rondeau
    tempstring = tempstring + '#include<volk/volk_config_fixed.h>\n';
12 5b4c7d27 Josh Blum
    tempstring = tempstring + '#include<volk/volk_common.h>\n';
13 8608fc3a Nick Foster
    tempstring = tempstring + '#include<volk/volk_complex.h>\n';
14 5b4c7d27 Josh Blum
    tempstring = tempstring + '__VOLK_DECL_BEGIN\n';
15 23914465 Tom Rondeau
16 8608fc3a Nick Foster
    tempstring = tempstring + '\n';
17 8608fc3a Nick Foster
18 5b4c7d27 Josh Blum
    tempstring += """
19 5b4c7d27 Josh Blum
struct volk_func_desc {
20 5b4c7d27 Josh Blum
     const char **indices;
21 5b4c7d27 Josh Blum
     const int *arch_defs;
22 5b4c7d27 Josh Blum
     const int n_archs;
23 5b4c7d27 Josh Blum
};
24 3a41b320 Nick Foster
25 3a41b320 Nick Foster
VOLK_API unsigned int volk_get_alignment(void);
26 3a41b320 Nick Foster
27 5b4c7d27 Josh Blum
"""
28 8608fc3a Nick Foster
    for i in range(len(funclist)):
29 85a8b62f Nick Foster
        tempstring += "extern VOLK_API " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n"
30 b31f8912 Josh Blum
        tempstring += "extern VOLK_API void %s_manual%s;\n" % (funclist[i], arched_arglist[i])
31 668da8bd Nick Foster
        tempstring = strip_trailing(tempstring, " {")
32 b31f8912 Josh Blum
        tempstring += "extern VOLK_API struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i])
33 23914465 Tom Rondeau
34 5b4c7d27 Josh Blum
    tempstring = tempstring + '__VOLK_DECL_END\n';
35 8608fc3a Nick Foster
    tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n";
36 23914465 Tom Rondeau
37 23914465 Tom Rondeau
    return tempstring;
38 8608fc3a Nick Foster