summaryrefslogtreecommitdiff
path: root/volk/gen/make_environment_init_c.py
blob: 6186162ee5bd3a55f82ad5a8dfa6bfa2e932db08 (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
from xml.dom import minidom

def make_environment_init_c(dom) :
    tempstring = "";
    tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
    tempstring = tempstring + "#include<volk/volk_environment_init.h>\n"
    for domarch in dom:
        arch = str(domarch.attributes["name"].value);
        incs = domarch.getElementsByTagName("include");
        for inc in incs:
            my_inc = str(inc.firstChild.data);
            tempstring = tempstring + "#ifdef LV_HAVE_" + arch.swapcase() + "\n";
            tempstring = tempstring + "#include<" + my_inc + ">\n";
            tempstring = tempstring + "#endif\n"
    tempstring = tempstring + '\n\n';
    tempstring = tempstring + "void volk_environment_init(){\n"

    for domarch in dom:
        arch = str(domarch.attributes["name"].value);
        envs = domarch.getElementsByTagName("environment");
        for env in envs:
            cmd = str(env.firstChild.data);
            tempstring = tempstring + "#ifdef LV_HAVE_" + arch.swapcase() + "\n";
            tempstring = tempstring + "        " + cmd + "\n";
            tempstring = tempstring + "#endif\n"

    tempstring = tempstring + "}\n";
    return tempstring;