diff options
author | Josh Blum | 2011-05-10 12:31:09 -0700 |
---|---|---|
committer | Josh Blum | 2011-05-10 12:31:09 -0700 |
commit | 3381729bb788e2d4f158d8efb6196a45e1620946 (patch) | |
tree | f17e64de290c33f8ff886d44cf5cfda043bff0a5 /volk/gen/make_each_machine_c.py | |
parent | ffbe7a0e951808ee972054b2182b97986595a9c5 (diff) | |
download | gnuradio-3381729bb788e2d4f158d8efb6196a45e1620946.tar.gz gnuradio-3381729bb788e2d4f158d8efb6196a45e1620946.tar.bz2 gnuradio-3381729bb788e2d4f158d8efb6196a45e1620946.zip |
volk: generate two machine structs which are conditional on LV_HAVE_ORC
Diffstat (limited to 'volk/gen/make_each_machine_c.py')
-rw-r--r-- | volk/gen/make_each_machine_c.py | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/volk/gen/make_each_machine_c.py b/volk/gen/make_each_machine_c.py index 6d9b8c65f..a7d3bb752 100644 --- a/volk/gen/make_each_machine_c.py +++ b/volk/gen/make_each_machine_c.py @@ -18,7 +18,7 @@ from volk_regexp import * import string -def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist): +def _make_each_machine_struct(machine_name, archs, functions, fcountlist, taglist): #make the machine fcountlist and taglist a subset given the archs list machine_fcountlists = list() @@ -33,6 +33,25 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist): machine_fcountlists.append(machine_fcountlist) machine_taglists.append(machine_taglist) + #create the volk machine struct for this machine file + tempstring = "" + tempstring += "struct volk_machine volk_machine_" + machine_name + " = {\n" + tempstring += " " + ' | '.join(["(1 << LV_" + arch.swapcase() + ")" for arch in archs]) + ",\n" + tempstring += " \"%s\",\n"%machine_name + + #fill in the description for each function + for i in range(len(functions)): + tempstring += " {%s},\n"%(', '.join(['"%s"'%tag for tag in machine_taglists[i]])) + tempstring += " {%s},\n"%(', '.join([' | '.join(['(1 << LV_%s)'%fc for fc in fcount]) for fcount in machine_fcountlists[i]])) + tempstring += " {%s},\n"%(', '.join(['%s_%s'%(functions[i], tag) for tag in machine_taglists[i]])) + tempstring += " %d,\n"%len(machine_taglists[i]) + + tempstring = strip_trailing(tempstring, ",") + tempstring += "};\n" + return tempstring + +def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist): + tempstring = r""" // This file is automatically generated by make_each_machine_c.py. // Do not edit this file. @@ -50,20 +69,16 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist): tempstring += "#include <volk/" + func + ".h>\n" tempstring += "\n\n" - #create the volk machine struct for this machine file - tempstring += "struct volk_machine volk_machine_" + machine_name + " = {\n" - tempstring += " " + ' | '.join(["(1 << LV_" + arch.swapcase() + ")" for arch in archs]) + ",\n" - tempstring += " \"%s\",\n"%machine_name - - #fill in the description for each function - for i in range(len(functions)): - tempstring += " {%s},\n"%(', '.join(['"%s"'%tag for tag in machine_taglists[i]])) - tempstring += " {%s},\n"%(', '.join([' | '.join(['(1 << LV_%s)'%fc for fc in fcount]) for fcount in machine_fcountlists[i]])) - tempstring += " {%s},\n"%(', '.join(['%s_%s'%(functions[i], tag) for tag in machine_taglists[i]])) - tempstring += " %d,\n"%len(machine_taglists[i]) - - tempstring = strip_trailing(tempstring, ",") - tempstring += "};\n" + tempstring += """ +#ifdef LV_HAVE_ORC +%s +#else +%s +#endif +"""%( + _make_each_machine_struct(machine_name, archs+["orc"], functions, fcountlist, taglist), + _make_each_machine_struct(machine_name, archs, functions, fcountlist, taglist) +) return tempstring |