summaryrefslogtreecommitdiff
path: root/volk/gen
diff options
context:
space:
mode:
authorJosh Blum2011-05-06 12:41:16 -0700
committerJosh Blum2011-05-06 12:41:16 -0700
commit5b4c7d27e9d49ab58df1f1d9350dcaf64c60a1ce (patch)
treef90d624a0e9973cd5876030c862395466b6ba64d /volk/gen
parent12413747c90754482582e16c95b551e1b36c6074 (diff)
downloadgnuradio-5b4c7d27e9d49ab58df1f1d9350dcaf64c60a1ce.tar.gz
gnuradio-5b4c7d27e9d49ab58df1f1d9350dcaf64c60a1ce.tar.bz2
gnuradio-5b4c7d27e9d49ab58df1f1d9350dcaf64c60a1ce.zip
volk: top-level common header cleanup
Since we already have a volk_common.h, moved the attributes, API declaration, and c-linkage macros into volk_common.h This change removes volk_attributes.h, in favor of one common include header. The implementation headers that require attributes now include volk_common.h This change removes the emit_omnilog.py script, in favor of pre-processor macros in volk_common.h In addition, extern C is only defined when in C++ and in GCC because non-GCC does not have complex.h
Diffstat (limited to 'volk/gen')
-rw-r--r--volk/gen/emit_omnilog.py13
-rw-r--r--volk/gen/make_c.py6
-rw-r--r--volk/gen/make_cpuid_h.py6
-rw-r--r--volk/gen/make_each_machine_c.py3
-rw-r--r--volk/gen/make_environment_init_h.py6
-rw-r--r--volk/gen/make_h.py24
-rw-r--r--volk/gen/make_machines_h.py5
-rw-r--r--volk/gen/make_makefile_am.py3
-rw-r--r--volk/gen/volk_register.py2
9 files changed, 25 insertions, 43 deletions
diff --git a/volk/gen/emit_omnilog.py b/volk/gen/emit_omnilog.py
deleted file mode 100644
index 309d7e578..000000000
--- a/volk/gen/emit_omnilog.py
+++ /dev/null
@@ -1,13 +0,0 @@
-def emit_prolog():
- tempstring = "";
- tempstring = tempstring + '#ifdef __cplusplus\n';
- tempstring = tempstring + 'extern "C" {\n';
- tempstring = tempstring + '#endif\n';
- return tempstring;
-def emit_epilog():
- tempstring = "";
- tempstring = tempstring + '#ifdef __cplusplus\n';
- tempstring = tempstring + '}\n';
- tempstring = tempstring + '#endif\n';
- return tempstring;
-
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 3fe604f39..4e67f31ff 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -17,7 +17,6 @@
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].
@@ -38,8 +37,7 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist):
#include <string.h>
"""
- tempstring += emit_prolog();
-
+
#OK here's the deal. the .h prototypes the functions. the .c impls them as fptrs, can use p_whatever.
#also .c impls the get_machine call
#also .c impls the default call for each fn
@@ -93,8 +91,6 @@ static unsigned int get_index(const char *indices[], unsigned int n_archs, const
tempstring += " struct volk_func_desc desc = {get_machine()->%s_indices, get_machine()->%s_arch_defs, get_machine()->%s_n_archs};\n" % (functions[i], functions[i], functions[i])
tempstring += " return desc;\n}\n"
- tempstring += emit_epilog();
-
return tempstring
diff --git a/volk/gen/make_cpuid_h.py b/volk/gen/make_cpuid_h.py
index cd3da2455..4fe5c4e07 100644
--- a/volk/gen/make_cpuid_h.py
+++ b/volk/gen/make_cpuid_h.py
@@ -21,14 +21,14 @@
#
from xml.dom import minidom
-from emit_omnilog import *
def make_cpuid_h(dom) :
tempstring = "";
tempstring = tempstring +'/*this file is auto generated by volk_register.py*/';
tempstring = tempstring +'\n#ifndef INCLUDED_VOLK_CPU_H';
tempstring = tempstring +'\n#define INCLUDED_VOLK_CPU_H\n\n';
- tempstring = tempstring + emit_prolog();
+ tempstring = tempstring + "#include <volk/volk_common.h>\n\n";
+ tempstring = tempstring + '__VOLK_DECL_BEGIN\n';
tempstring = tempstring + '\n'
tempstring = tempstring + "struct VOLK_CPU {\n"
@@ -42,7 +42,7 @@ def make_cpuid_h(dom) :
tempstring = tempstring + "unsigned int volk_get_lvarch ();\n"
tempstring = tempstring + "\n";
- tempstring = tempstring + emit_epilog();
+ 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 4e6684745..6d9b8c65f 100644
--- a/volk/gen/make_each_machine_c.py
+++ b/volk/gen/make_each_machine_c.py
@@ -17,7 +17,6 @@
from volk_regexp import *
import string
-from emit_omnilog import *
def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist):
@@ -47,7 +46,6 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist):
#include <volk/volk_config_fixed.h>
"""
- tempstring += emit_prolog();
for func in functions:
tempstring += "#include <volk/" + func + ".h>\n"
tempstring += "\n\n"
@@ -66,7 +64,6 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist):
tempstring = strip_trailing(tempstring, ",")
tempstring += "};\n"
- tempstring += emit_epilog();
return tempstring
diff --git a/volk/gen/make_environment_init_h.py b/volk/gen/make_environment_init_h.py
index 77a841a24..655d73f54 100644
--- a/volk/gen/make_environment_init_h.py
+++ b/volk/gen/make_environment_init_h.py
@@ -1,5 +1,4 @@
from xml.dom import minidom
-from emit_omnilog import *
def make_environment_init_h() :
tempstring = "";
@@ -7,9 +6,10 @@ def make_environment_init_h() :
tempstring = tempstring + "#ifndef INCLUDE_LIBVECTOR_ENVIRONMENT_INIT_H\n";
tempstring = tempstring + "#define INCLUDE_LIBVECTOR_ENVIRONMENT_INIT_H\n";
tempstring = tempstring + "\n";
- tempstring = tempstring + emit_prolog();
+ tempstring = tempstring + "#include <volk/volk_common.h>\n\n";
+ tempstring = tempstring + "__VOLK_DECL_BEGIN\n";
tempstring = tempstring + "void volk_environment_init();\n";
- tempstring = tempstring + emit_epilog();
+ 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 07e62939b..3d5790de4 100644
--- a/volk/gen/make_h.py
+++ b/volk/gen/make_h.py
@@ -1,16 +1,6 @@
from xml.dom import minidom
-from emit_omnilog import *
from volk_regexp import *
-# http://gcc.gnu.org/wiki/Visibility
-volk_api_defines = """
-#ifdef volk_EXPORTS
-# define VOLK_API __VOLK_ATTR_EXPORT
-#else
-# define VOLK_API __VOLK_ATTR_IMPORT
-#endif
-"""
-
def make_h(funclist, arched_arglist) :
tempstring = "";
tempstring = tempstring + '/*this file is auto generated by make_h.py*/\n';
@@ -19,20 +9,26 @@ def make_h(funclist, arched_arglist) :
tempstring = tempstring + '\n#define INCLUDED_VOLK_RUNTIME';
tempstring = tempstring + '\n\n#include<volk/volk_typedefs.h>\n';
tempstring = tempstring + '#include<volk/volk_config_fixed.h>\n';
- tempstring = tempstring + '#include<volk/volk_attributes.h>\n';
+ tempstring = tempstring + '#include<volk/volk_common.h>\n';
tempstring = tempstring + '#include<volk/volk_complex.h>\n';
- tempstring = tempstring + volk_api_defines
- tempstring = tempstring + emit_prolog();
+ tempstring = tempstring + '__VOLK_DECL_BEGIN\n';
tempstring = tempstring + '\n';
+ tempstring += """
+struct volk_func_desc {
+ const char **indices;
+ const int *arch_defs;
+ const int n_archs;
+};
+"""
for i in range(len(funclist)):
tempstring += "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n"
tempstring += "extern VOLK_API void %s_manual%s;\n" % (funclist[i], arched_arglist[i])
tempstring = strip_trailing(tempstring, " {")
tempstring += "extern VOLK_API struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i])
- tempstring = tempstring + emit_epilog();
+ tempstring = tempstring + '__VOLK_DECL_END\n';
tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n";
return tempstring;
diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py
index aa6daa6cc..09ada3e0d 100644
--- a/volk/gen/make_machines_h.py
+++ b/volk/gen/make_machines_h.py
@@ -28,6 +28,8 @@ def make_machines_h(functions, machines, archs):
#include <volk/volk_common.h>
#include <volk/volk_typedefs.h>
+__VOLK_DECL_BEGIN
+
struct volk_machine {
const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_get_lvarch format)
const char *name;
@@ -47,6 +49,9 @@ struct volk_machine {
tempstring += """#endif\n"""
tempstring += r"""
+
+__VOLK_DECL_END
+
#endif //INCLUDED_LIBVOLK_MACHINES_H"""
return tempstring
diff --git a/volk/gen/make_makefile_am.py b/volk/gen/make_makefile_am.py
index 54017d2b3..ff9749e17 100644
--- a/volk/gen/make_makefile_am.py
+++ b/volk/gen/make_makefile_am.py
@@ -25,6 +25,7 @@ def make_makefile_am(dom, machines, archflags_dict):
include $(top_srcdir)/Makefile.common
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) \
+ -I$(top_srcdir)/include \
-I$(top_gendir)/include \
-Dvolk_EXPORTS \
-fvisibility=hidden \
@@ -43,7 +44,7 @@ EXTRA_DIST = \
libvolk_la_SOURCES = \
$(platform_CODE) \
- $(top_gendir)/lib/volk.cc \
+ $(top_gendir)/lib/volk.c \
$(top_gendir)/lib/volk_cpu.c \
volk_rank_archs.c \
$(top_gendir)/lib/volk_machines.c
diff --git a/volk/gen/volk_register.py b/volk/gen/volk_register.py
index a239811db..dba364e01 100644
--- a/volk/gen/volk_register.py
+++ b/volk/gen/volk_register.py
@@ -36,7 +36,7 @@ for dir in (
outfile_set_simd = open(os.path.join(gendir, "config/lv_set_simd_flags.m4"), "w")
outfile_h = open(os.path.join(gendir, "include/volk/volk.h"), "w")
-outfile_c = open(os.path.join(gendir, "lib/volk.cc"), "w")
+outfile_c = open(os.path.join(gendir, "lib/volk.c"), "w")
outfile_typedefs = open(os.path.join(gendir, "include/volk/volk_typedefs.h"), "w")
outfile_init_h = open(os.path.join(gendir, "lib/volk_init.h"), "w")
outfile_cpu_h = open(os.path.join(gendir, "include/volk/volk_cpu.h"), "w")