diff options
author | Josh Blum | 2011-04-26 21:55:48 -0700 |
---|---|---|
committer | Josh Blum | 2011-04-26 21:55:48 -0700 |
commit | a5e2d9e5baf869ae961fbb5820447290d6d9c7c8 (patch) | |
tree | 41ced4de13a41dd7b05a4e08d1a730cf0f079f7c /volk/gen/make_each_machine_c.py | |
parent | d941ba31677804fe382d76fca17fc044d12777f5 (diff) | |
download | gnuradio-a5e2d9e5baf869ae961fbb5820447290d6d9c7c8.tar.gz gnuradio-a5e2d9e5baf869ae961fbb5820447290d6d9c7c8.tar.bz2 gnuradio-a5e2d9e5baf869ae961fbb5820447290d6d9c7c8.zip |
volk: reorganization of generation sources and generated files
All generation sources have been moved to the gen/ subdirectory.
Bootstrap and volk_register.py generate the files into to gen/ subdirectory
in an effort to cleanly separate the static/generated parts of the build tree.
Define top_gendir in Makefile.common, all generated sources listed in Makefile.ams
are prefixed with $(top_gendir) to differentiate them from static in-tree sources.
Diffstat (limited to 'volk/gen/make_each_machine_c.py')
-rw-r--r-- | volk/gen/make_each_machine_c.py | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/volk/gen/make_each_machine_c.py b/volk/gen/make_each_machine_c.py new file mode 100644 index 000000000..94d6d7789 --- /dev/null +++ b/volk/gen/make_each_machine_c.py @@ -0,0 +1,82 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +from volk_regexp import * +import string +from emit_omnilog import * + +#ok todo list: +#put n_archs into the info struct so it doesn't have to be arch_defs[0]. + +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. +""" + for arch in archs: + tempstring += "#define LV_HAVE_" + arch.swapcase() + " 1\n" + + tempstring += """ +#include <volk/volk_common.h> +#include <volk/volk_machines.h> +#include <volk/volk_registry.h> + +""" + tempstring += emit_prolog(); + for func in functions: + tempstring += "#include <volk/" + func + ".h>\n" + tempstring += "\n\n" + + for i in range(len(functions)): + tempstring += "static const " + replace_volk.sub("p", functions[i]) + " " + functions[i] + "_archs[] = {\n" + + tags_counter = 0 + for arch_list in fcountlist[i]: + tempstring += "#if " + for arch in arch_list: + tempstring += "defined(LV_HAVE_" + arch + ") && " + tempstring = strip_trailing(tempstring, " && ") + tempstring += "\n " + functions[i] + "_" + str(taglist[i][tags_counter]) + ",\n" + tempstring += "#endif\n" + tags_counter += 1 + + tempstring = strip_trailing(tempstring, ",") + tempstring += "};\n\n" + + + tempstring += "static unsigned int caps = " + for arch in archs: + tempstring += "(1 << LV_" + arch.swapcase() + ") + " + tempstring = strip_trailing(tempstring, " + ") + tempstring += ";\n" + + tempstring += "static const char* name = \"" + machine_name + "\";\n" + tempstring += "struct volk_machine volk_machine_" + machine_name + " = {\n" + tempstring += " caps,\n" + tempstring += " name,\n" + + for i in range(len(functions)): + tempstring += " { " + functions[i] + "_indices, " + functions[i] + "_arch_defs, " + functions[i] + "_n_archs },\n" + tempstring += " " + functions[i] + "_archs,\n" + + tempstring = strip_trailing(tempstring, ",") + tempstring += "};\n" + tempstring += emit_epilog(); + + return tempstring + + |