diff options
author | Josh Blum | 2011-05-05 19:02:03 -0700 |
---|---|---|
committer | Josh Blum | 2011-05-05 19:02:03 -0700 |
commit | 701b1c520865388a4287c6a3f63afb3ce2626cf1 (patch) | |
tree | 515cd52be7821e50c0fc7f53d0eb28303d1067fb /volk/gen/make_machines_c.py | |
parent | 42783746a78bf4d094e6ff9b6971b565e9ac59dd (diff) | |
download | gnuradio-701b1c520865388a4287c6a3f63afb3ce2626cf1.tar.gz gnuradio-701b1c520865388a4287c6a3f63afb3ce2626cf1.tar.bz2 gnuradio-701b1c520865388a4287c6a3f63afb3ce2626cf1.zip |
volk: make volk_machines.cc c-safe
Initialize the list of machine structs w/ pointers,
this does not rely on C++ initialization and is smaller.
In addition, rename the file extension to .c so we know its C only.
Interesting note, this also fixes a bug when compiling under MSVC,
the machines list initialization seemed to have problems prior to this change.
Diffstat (limited to 'volk/gen/make_machines_c.py')
-rw-r--r-- | volk/gen/make_machines_c.py | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/volk/gen/make_machines_c.py b/volk/gen/make_machines_c.py index 9ad56fb62..ccac21131 100644 --- a/volk/gen/make_machines_c.py +++ b/volk/gen/make_machines_c.py @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 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 @@ -26,32 +26,16 @@ def make_machines_c(machines): #include <volk/volk_typedefs.h> #include <volk/volk_machines.h> -struct volk_machine volk_machines[] = { +struct volk_machine *volk_machines[] = { """ for machine in machines: tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" - tempstring += "volk_machine_" + machine + tempstring += "&volk_machine_" + machine tempstring += "," tempstring += "\n#endif\n" tempstring += r""" }; - -""" - - for machine in machines: - tempstring += "#if LV_MACHINE_" + machine.swapcase() + "\n" - tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 1\n" - tempstring += "#else\n" - tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 0\n" - tempstring += "#endif\n" - - tempstring += """unsigned int n_volk_machines = +unsigned int n_volk_machines = sizeof(volk_machines)/sizeof(*volk_machines); """ - for machine in machines: - tempstring += "(LV_MACHINE_" + machine.swapcase() + "_CNT) " - tempstring += "+ " - tempstring = tempstring[:-2] - tempstring += ";\n" - return tempstring |