Statistics
| Branch: | Tag: | Revision:

root / volk / gen / make_environment_init_c.py @ 5d3d5cf4

History | View | Annotate | Download (1.2 kB)

1 23914465 Tom Rondeau
from xml.dom import minidom
2 23914465 Tom Rondeau
3 23914465 Tom Rondeau
def make_environment_init_c(dom) :
4 23914465 Tom Rondeau
    tempstring = "";
5 23914465 Tom Rondeau
    tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
6 23914465 Tom Rondeau
    tempstring = tempstring + "#include<volk/volk_environment_init.h>\n"
7 23914465 Tom Rondeau
    for domarch in dom:
8 23914465 Tom Rondeau
        arch = str(domarch.attributes["name"].value);
9 23914465 Tom Rondeau
        incs = domarch.getElementsByTagName("include");
10 23914465 Tom Rondeau
        for inc in incs:
11 23914465 Tom Rondeau
            my_inc = str(inc.firstChild.data);
12 cef9e33e Nick Foster
            tempstring = tempstring + "#ifdef LV_HAVE_" + arch.swapcase() + "\n";
13 23914465 Tom Rondeau
            tempstring = tempstring + "#include<" + my_inc + ">\n";
14 23914465 Tom Rondeau
            tempstring = tempstring + "#endif\n"
15 23914465 Tom Rondeau
    tempstring = tempstring + '\n\n';
16 23914465 Tom Rondeau
    tempstring = tempstring + "void volk_environment_init(){\n"
17 23914465 Tom Rondeau
    
18 23914465 Tom Rondeau
    for domarch in dom:
19 23914465 Tom Rondeau
        arch = str(domarch.attributes["name"].value);
20 23914465 Tom Rondeau
        envs = domarch.getElementsByTagName("environment");
21 23914465 Tom Rondeau
        for env in envs:
22 23914465 Tom Rondeau
            cmd = str(env.firstChild.data);
23 cef9e33e Nick Foster
            tempstring = tempstring + "#ifdef LV_HAVE_" + arch.swapcase() + "\n";
24 23914465 Tom Rondeau
            tempstring = tempstring + "        " + cmd + "\n";
25 23914465 Tom Rondeau
            tempstring = tempstring + "#endif\n"     
26 23914465 Tom Rondeau
    
27 23914465 Tom Rondeau
    tempstring = tempstring + "}\n";
28 23914465 Tom Rondeau
    return tempstring;
29 23914465 Tom Rondeau
            
30 23914465 Tom Rondeau
31 23914465 Tom Rondeau
32 23914465 Tom Rondeau