From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- volk/gen/archs.xml | 2 +- volk/gen/make_c.py | 4 ++-- volk/gen/make_config_fixed.py | 2 +- volk/gen/make_cpuid_c.py | 38 ++++++++++++++++----------------- volk/gen/make_cpuid_h.py | 12 +++++------ volk/gen/make_each_machine_c.py | 2 +- volk/gen/make_environment_init_c.py | 10 ++++----- volk/gen/make_environment_init_h.py | 4 ++-- volk/gen/make_h.py | 2 +- volk/gen/make_machines_c.py | 2 +- volk/gen/make_machines_h.py | 6 +++--- volk/gen/make_makefile_am.py | 12 +++++------ volk/gen/make_proccpu_sim.py | 12 +++++------ volk/gen/make_set_simd.py | 26 +++++++++++------------ volk/gen/make_typedefs.py | 2 +- volk/gen/volk_register.py | 42 ++++++++++++++++++------------------- 16 files changed, 89 insertions(+), 89 deletions(-) (limited to 'volk/gen') diff --git a/volk/gen/archs.xml b/volk/gen/archs.xml index effd90d33..ca2118475 100644 --- a/volk/gen/archs.xml +++ b/volk/gen/archs.xml @@ -19,7 +19,7 @@ m32 MD_SUBCPU x86_64 - + 0x80000001 diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py index 0f9bcde34..233cb85c2 100644 --- a/volk/gen/make_c.py +++ b/volk/gen/make_c.py @@ -48,7 +48,7 @@ struct volk_machine *get_machine(void) { extern struct volk_machine *volk_machines[]; extern unsigned int n_volk_machines; static struct volk_machine *machine = NULL; - + if(machine != NULL) return machine; else { unsigned int max_score = 0; @@ -71,7 +71,7 @@ unsigned int volk_get_alignment(void) { } """ - + for i in range(len(functions)): tempstring += "void get_" + functions[i] + replace_arch.sub("", arched_arglist[i]) + "\n" tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_indices, get_machine()->%s_arch_defs, get_machine()->%s_n_archs, get_machine()->%s_name, volk_get_lvarch())];\n" % (functions[i], functions[i], functions[i], functions[i], functions[i], functions[i]) diff --git a/volk/gen/make_config_fixed.py b/volk/gen/make_config_fixed.py index 3fd1bdf0a..96f20b6b2 100644 --- a/volk/gen/make_config_fixed.py +++ b/volk/gen/make_config_fixed.py @@ -18,4 +18,4 @@ def make_config_fixed(dom) : return tempstring; - + diff --git a/volk/gen/make_cpuid_c.py b/volk/gen/make_cpuid_c.py index 2be1123a8..e30d643cb 100644 --- a/volk/gen/make_cpuid_c.py +++ b/volk/gen/make_cpuid_c.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2011 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio 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, or (at your option) # any later version. -# +# # GNU Radio 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 GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# from xml.dom import minidom @@ -79,7 +79,7 @@ static inline unsigned int cpuid_edx(unsigned int op) { def make_cpuid_c(dom) : tempstring = HEADER_TEMPL; - + for domarch in dom: if str(domarch.attributes["type"].value) == "x86": if "no_test" in domarch.attributes.keys(): @@ -103,7 +103,7 @@ def make_cpuid_c(dom) : val = domarch.getElementsByTagName("val"); if val: val = str(val[0].firstChild.data); - + if no_test: tempstring = tempstring + """\ int i_can_has_%s () { @@ -113,9 +113,9 @@ int i_can_has_%s () { return 0; #endif } - + """ % (arch) - + elif op == "1": tempstring = tempstring + """\ int i_can_has_%s () { @@ -144,7 +144,7 @@ int i_can_has_%s () { } """ % (arch, val, reg, op, shift, val) - + elif str(domarch.attributes["type"].value) == "powerpc": arch = str(domarch.attributes["name"].value); tempstring = tempstring + """\ @@ -178,7 +178,7 @@ int i_can_has_%s () { unsigned int found_neon = 0; auxvec_f = fopen("/proc/self/auxv", "rb"); if(!auxvec_f) return 0; - + //so auxv is basically 32b of ID and 32b of value //so it goes like this while(!found_neon && auxvec_f) { @@ -186,7 +186,7 @@ int i_can_has_%s () { if((auxvec[0] == AT_HWCAP) && (auxvec[1] & HWCAP_NEON)) found_neon = 1; } - + fclose(auxvec_f); return found_neon; @@ -196,7 +196,7 @@ int i_can_has_%s () { } """ % (arch) - + elif str(domarch.attributes["type"].value) == "all": arch = str(domarch.attributes["name"].value); tempstring = tempstring + """\ @@ -213,7 +213,7 @@ int i_can_has_%s () { } """ % (arch) - + tempstring = tempstring + "void volk_cpu_init() {\n"; for domarch in dom: arch = str(domarch.attributes["name"].value); @@ -231,9 +231,9 @@ int i_can_has_%s () { return tempstring; - - - - - + + + + + diff --git a/volk/gen/make_cpuid_h.py b/volk/gen/make_cpuid_h.py index 4fe5c4e07..1aa783781 100644 --- a/volk/gen/make_cpuid_h.py +++ b/volk/gen/make_cpuid_h.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2011 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio 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, or (at your option) # any later version. -# +# # GNU Radio 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 GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# from xml.dom import minidom @@ -44,5 +44,5 @@ def make_cpuid_h(dom) : tempstring = tempstring + "\n"; tempstring = tempstring + "__VOLK_DECL_END\n"; tempstring = tempstring + "#endif /*INCLUDED_VOLK_CPU_H*/\n" - + return tempstring; diff --git a/volk/gen/make_each_machine_c.py b/volk/gen/make_each_machine_c.py index a3f6203ba..535578859 100644 --- a/volk/gen/make_each_machine_c.py +++ b/volk/gen/make_each_machine_c.py @@ -59,7 +59,7 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist, ali """ for arch in archs: tempstring += "#define LV_HAVE_" + arch.swapcase() + " 1\n" - + tempstring += """ #include #include "volk_machines.h" diff --git a/volk/gen/make_environment_init_c.py b/volk/gen/make_environment_init_c.py index 263d5bcd1..6186162ee 100644 --- a/volk/gen/make_environment_init_c.py +++ b/volk/gen/make_environment_init_c.py @@ -14,7 +14,7 @@ def make_environment_init_c(dom) : 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"); @@ -22,11 +22,11 @@ def make_environment_init_c(dom) : cmd = str(env.firstChild.data); tempstring = tempstring + "#ifdef LV_HAVE_" + arch.swapcase() + "\n"; tempstring = tempstring + " " + cmd + "\n"; - tempstring = tempstring + "#endif\n" - + tempstring = tempstring + "#endif\n" + tempstring = tempstring + "}\n"; return tempstring; - - + + diff --git a/volk/gen/make_environment_init_h.py b/volk/gen/make_environment_init_h.py index 655d73f54..0b0f35d61 100644 --- a/volk/gen/make_environment_init_h.py +++ b/volk/gen/make_environment_init_h.py @@ -12,7 +12,7 @@ def make_environment_init_h() : tempstring = tempstring + "__VOLK_DECL_END\n"; tempstring = tempstring + "#endif\n" return tempstring; - - + + diff --git a/volk/gen/make_h.py b/volk/gen/make_h.py index 354e57258..cf8987c39 100644 --- a/volk/gen/make_h.py +++ b/volk/gen/make_h.py @@ -35,4 +35,4 @@ VOLK_API unsigned int volk_get_alignment(void); tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n"; return tempstring; - + diff --git a/volk/gen/make_machines_c.py b/volk/gen/make_machines_c.py index a7ab63d6e..f19da4ae4 100644 --- a/volk/gen/make_machines_c.py +++ b/volk/gen/make_machines_c.py @@ -33,7 +33,7 @@ struct volk_machine *volk_machines[] = { tempstring += "&volk_machine_" + machine tempstring += "," tempstring += "\n#endif\n" - + tempstring += r""" }; unsigned int n_volk_machines = sizeof(volk_machines)/sizeof(*volk_machines); diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index a48caa89c..d2374120b 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -41,15 +41,15 @@ struct volk_machine { tempstring += " const int %s_arch_defs[%d];\n"%(function, len(archs)) tempstring += " const %s %s_archs[%d];\n"%(replace_volk.sub("p", function), function, len(archs)) tempstring += " const int %s_n_archs;\n"%function - + tempstring += r"""}; - + """ for machine in machines: tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" tempstring += "extern struct volk_machine volk_machine_" + machine + ";\n" tempstring += """#endif\n""" - + tempstring += r""" __VOLK_DECL_END diff --git a/volk/gen/make_makefile_am.py b/volk/gen/make_makefile_am.py index 0dc088a80..880ce4094 100644 --- a/volk/gen/make_makefile_am.py +++ b/volk/gen/make_makefile_am.py @@ -21,7 +21,7 @@ def make_makefile_am(dom, machines, archflags_dict): tempstring = r""" # This file is automatically generated by make_makefile_am.py. # Do not edit this file. - + include $(top_srcdir)/Makefile.common AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) \ @@ -55,17 +55,17 @@ volk_orc_CFLAGS = -DLV_HAVE_ORC=1 volk_orc_LDFLAGS = $(ORC_LDFLAGS) -lorc-0.4 volk_orc_LIBADD = ../orc/libvolk_orc.la else -volk_orc_CFLAGS = +volk_orc_CFLAGS = volk_orc_LDFLAGS = -volk_orc_LIBADD = +volk_orc_LIBADD = endif libvolk_la_CPPFLAGS = $(AM_CPPFLAGS) $(volk_orc_CFLAGS) libvolk_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 $(volk_orc_LDFLAGS) libvolk_la_LIBADD = $(volk_orc_LIBADD) -noinst_LTLIBRARIES = - +noinst_LTLIBRARIES = + """ #here be dragons @@ -76,7 +76,7 @@ noinst_LTLIBRARIES = for arch in machines[machine_name]: if archflags_dict[arch] != "none": tempstring += "-" + archflags_dict[arch] + " " - + tempstring += "\nnoinst_LTLIBRARIES += libvolk_" + machine_name + ".la " tempstring += "\nlibvolk_la_LIBADD += libvolk_" + machine_name + ".la\n" tempstring += "libvolk_la_CPPFLAGS += -DLV_MACHINE_" + machine_name.swapcase() + " \n" diff --git a/volk/gen/make_proccpu_sim.py b/volk/gen/make_proccpu_sim.py index 029dacfcc..e2c8123e5 100644 --- a/volk/gen/make_proccpu_sim.py +++ b/volk/gen/make_proccpu_sim.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2011 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio 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, or (at your option) # any later version. -# +# # GNU Radio 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 GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# from xml.dom import minidom @@ -35,7 +35,7 @@ def make_proccpu_sim(dom) : tempstring = tempstring + " }\n"; tempstring = tempstring + "}\n"; tempstring = tempstring + "\n\n"; - + tempstring = tempstring + "int main() {\n"; tempstring = tempstring + " volk_cpu_init();\n"; tempstring = tempstring + " char buf[2048];\n"; diff --git a/volk/gen/make_set_simd.py b/volk/gen/make_set_simd.py index 5a848e59e..8334487d7 100644 --- a/volk/gen/make_set_simd.py +++ b/volk/gen/make_set_simd.py @@ -43,17 +43,17 @@ def make_set_simd(dom, machines) : tempstring = tempstring + " indLV_ARCH=no\n"; tempstring = tempstring + " AC_ARG_WITH(lv_arch,\n"; tempstring = tempstring + " AC_HELP_STRING([--with-lv_arch=ARCH],[set volk hardware speedups as space separated string with elements from the following list("; - + for domarch in dom: arch = str(domarch.attributes["name"].value); tempstring = tempstring + arch + ", " tempstring = tempstring[0:len(tempstring) - 2]; - + tempstring = tempstring + ")]),\n"; tempstring = tempstring + " [cf_with_lv_arch=\"$withval\"],\n"; tempstring = tempstring + " [cf_with_lv_arch=\"\"])\n"; if str(domarch.attributes["type"].value) == "all": - arch = str(domarch.attributes["name"].value); + arch = str(domarch.attributes["name"].value); tempstring = tempstring + " AC_DEFINE(LV_MAKE_" + arch.swapcase() + ", 1, [always set "+ arch + "!])\n"; tempstring = tempstring + " ADDONS=\"\"\n"; tempstring = tempstring + " BUILT_ARCHS=\"\"\n"; @@ -67,7 +67,7 @@ def make_set_simd(dom, machines) : tempstring = tempstring[0:-1] + "\"\n"; tempstring = tempstring + " OVERRULE_FLAG=\"yes\"\n"; tempstring = tempstring + " fi\n"; - + tempstring = tempstring +'\ndnl init LV_MAKE_XXX and then try to add archs\n'; for domarch in dom: if str(domarch.attributes["type"].value) != "all": @@ -118,9 +118,9 @@ def make_set_simd(dom, machines) : tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n" tempstring = tempstring + " indLV_ARCH=no\n" tempstring = tempstring + " fi\n" - - tempstring = tempstring + " if test \"$indCC\" == \"yes\" && test \"$indCXX\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n" - + + tempstring = tempstring + " if test \"$indCC\" == \"yes\" && test \"$indCXX\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n" + #tempstring = tempstring + " ADDONS=\"${ADDONS} -" + flag + "\"\n"; tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n"; tempstring = tempstring + " LV_MAKE_" + arch.swapcase() + "=yes\n"; @@ -138,17 +138,17 @@ def make_set_simd(dom, machines) : tempstring = tempstring + " if test -n \"" + overrule + "\" && test \"$" + overrule + "\" == \"" + overrule_val + "\" && test \"$OVERRULE_FLAG\" == \"yes\" && test \"$indLV_ARCH\" == \"yes\"; then\n" tempstring = tempstring + " indLV_ARCH=no\n" tempstring = tempstring + " fi\n" - tempstring = tempstring + " if test \"$indLV_ARCH\" == \"yes\"; then\n" + tempstring = tempstring + " if test \"$indLV_ARCH\" == \"yes\"; then\n" tempstring = tempstring + " LV_MAKE_" + arch.swapcase() + "=yes\n"; tempstring = tempstring + " BUILT_ARCHS=\"${BUILT_ARCHS} " + arch + "\"\n"; tempstring = tempstring + " fi\n" tempstring = tempstring + " indLV_ARCH=no\n" - + for domarch in dom: arch = str(domarch.attributes["name"].value); tempstring = tempstring + " AM_CONDITIONAL(LV_MAKE_" + arch.swapcase() + ", test \"$LV_MAKE_" + arch.swapcase() + "\" == \"yes\")\n"; - + tempstring += "\n" #now we can define the machines we're compiling for machine_name in machines: @@ -156,11 +156,11 @@ def make_set_simd(dom, machines) : marchlist = machines[machine_name] for march in marchlist: tempstring += "test \"$LV_MAKE_" + march.swapcase() + "\" == \"yes\" && " - + tempstring += "test true)\n" #just so we don't have to detect the last one in the group, i know tempstring = tempstring + " LV_CXXFLAGS=\"${LV_CXXFLAGS} ${ADDONS}\"\n" tempstring = tempstring + "])\n" - + return tempstring; - + diff --git a/volk/gen/make_typedefs.py b/volk/gen/make_typedefs.py index 8f9f2b55e..09221d2ef 100644 --- a/volk/gen/make_typedefs.py +++ b/volk/gen/make_typedefs.py @@ -15,7 +15,7 @@ def make_typedefs(funclist, retlist, my_argtypelist) : tempstring = tempstring + '\n'; - for i in range(len(funclist)): + for i in range(len(funclist)): tempstring = tempstring + "typedef " + retlist[i] +" (*" + replace_volk.sub("p", funclist[i]) + ")(" + my_argtypelist[i] + ");\n"; tempstring = tempstring + "#endif /*INCLUDED_VOLK_TYPEDEFS*/\n"; diff --git a/volk/gen/volk_register.py b/volk/gen/volk_register.py index 0774ece29..3a237c5ca 100644 --- a/volk/gen/volk_register.py +++ b/volk/gen/volk_register.py @@ -62,7 +62,7 @@ for line in hdr_files: subdtype = re.search("[0-9]+[A-z]+", dtype); if subdtype: datatypes.append(subdtype.group(0)); - + datatypes = set(datatypes); @@ -71,7 +71,7 @@ for line in hdr_files: if dt in line: subline = re.search("(volk_" + dt +"_.*(a|u).*\.h)", line); if subline: - + subsubline = re.search(".+(?=\.h)", subline.group(0)); functions.append(subsubline.group(0)); @@ -80,13 +80,13 @@ afile = minidom.parse(os.path.join(srcdir, "gen/archs.xml")) filearchs = afile.getElementsByTagName("arch"); for filearch in filearchs: archs.append(str(filearch.attributes["name"].value)); - + for arch in archs: a_var = re.search("^\$", arch); if a_var: archs.remove(arch); - -#strip out mutex archs + +#strip out mutex archs archflags_dict = {} for filearch in filearchs: @@ -177,22 +177,22 @@ for func in functions: tag = re.search("\w+", tag.group(0)); if tag: tags.append(tag.group(0)); - - + + if begun_name == 0: retline = re.search(".+(?=" + func + ")", line); if retline: ret = retline.group(0); - - - - + + + + subline = re.search(func + ".*", line); if subline: subsubline = re.search("\(.*?\)", subline.group(0)); if subsubline: args = subsubline.group(0); - + else: begun_name = 1; subsubline = re.search("\(.*", subline.group(0)); @@ -214,25 +214,25 @@ for func in functions: if subline: args = subline.group(0); begun_name = 0; - else: + else: subline = re.search("\(.*", line); if subline: args = subline.group(0); begun_paren = 1; - + replace = re.compile("static "); ret = replace.sub("", ret); replace = re.compile("inline "); ret = replace.sub("", ret); replace = re.compile("\)"); arched_args = replace.sub(", const char* arch) {", args); - + remove = re.compile('\)|\(|{'); rargs = remove.sub("", args); sargs = rargs.split(','); - - - + + + margs = []; atypes = []; for arg in sargs: @@ -241,7 +241,7 @@ for func in functions: replace = re.compile(" " + temp[-1]); atypes.append(replace.sub("", arg)); - + my_args = "" arg_types = "" for arg in range(0, len(margs) - 1): @@ -255,7 +255,7 @@ for func in functions: this_type = leading_space_remove.sub("", atypes[-1]); arg_types = arg_types + this_type; my_argtypelist.append(arg_types); - + if(ret[-1] != ' '): ret = ret + ' '; @@ -263,7 +263,7 @@ for func in functions: my_arglist.append(my_args) #!!!!!!!!!!!!!!!!! retlist.append(ret); fcountlist.append(fcount); - taglist.append(tags); + taglist.append(tags); outfile_cpu_h.write(make_cpuid_h(filearchs)); -- cgit