summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/GrSwig.cmake12
-rw-r--r--gnuradio-runtime/swig/gnuradio.i35
-rw-r--r--gnuradio-runtime/swig/gr_ctrlport.i97
-rw-r--r--gnuradio-runtime/swig/gr_types.i90
-rw-r--r--gnuradio-runtime/swig/pmt_swig.i23
-rw-r--r--gnuradio-runtime/swig/runtime_block_gateway.i7
-rw-r--r--gnuradio-runtime/swig/runtime_swig.i78
-rw-r--r--gr-blocks/swig/blocks_swig.i2
-rw-r--r--gr-digital/swig/digital_swig.i3
-rw-r--r--gr-shd/swig/shd_swig.i2
-rw-r--r--gr-uhd/swig/uhd_swig.i4
11 files changed, 207 insertions, 146 deletions
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index b6af0584ec..9a6ab8b9a7 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -105,6 +105,18 @@ endfunction(GR_SWIG_MAKE_DOCS)
macro(GR_SWIG_MAKE name)
set(ifiles ${ARGN})
+ # Shimming this in here to take care of a SWIG bug with handling
+ # vector<size_t> and vector<unsigned int> (on 32-bit machines) and
+ # vector<long unsigned int> (on 64-bit machines). Use this to test
+ # the size of size_t, then set SIZE_T_32 if it's a 32-bit machine
+ # or not if it's 64-bit. The logic in gr_type.i handles the rest.
+ INCLUDE (CheckTypeSize)
+ CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
+ CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
+ if(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT})
+ list(APPEND GR_SWIG_FLAGS -DSIZE_T_32)
+ endif(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT})
+
#do swig doc generation if specified
if (GR_SWIG_DOC_FILE)
set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i
index 52f9f12efb..4cf42cbf71 100644
--- a/gnuradio-runtime/swig/gnuradio.i
+++ b/gnuradio-runtime/swig/gnuradio.i
@@ -29,54 +29,21 @@
////////////////////////////////////////////////////////////////////////
%include <gr_extras.i>
+%include <gr_types.i>
////////////////////////////////////////////////////////////////////////
// Headers
%{
#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
-#include <gr_types.h>
-#include <stddef.h> // size_t
-#include <complex>
%}
%feature("autodoc","1");
// local file
%include <gr_shared_ptr.i>
-%include <gr_types.h>
-%include <std_complex.i>
-%include <std_vector.i>
-%include <stl.i>
%include <std_except.i>
-typedef std::complex<float> gr_complex;
-typedef std::complex<double> gr_complexd;
-typedef unsigned long long uint64_t;
-typedef long long int64_t;
-
-
-// instantiate the required template specializations
-
-namespace std {
- %template() vector<unsigned char>;
- %template() vector<char>;
- %template() vector<short>;
- %template() vector<int>;
- %template() vector<float>;
- %template() vector<double>;
- // %template() std::complex<float>;
-
- %template() vector< std::complex<float> >;
- %template() vector< std::vector< unsigned char > >;
- %template() vector< std::vector< char > >;
- %template() vector< std::vector< short > >;
- %template() vector< std::vector< int > >;
- %template() vector< std::vector< float > >;
- %template() vector< std::vector< double > >;
- %template() vector< std::vector< std::complex<float> > >;
-};
-
////////////////////////////////////////////////////////////////////////
#ifndef SW_RUNTIME
diff --git a/gnuradio-runtime/swig/gr_ctrlport.i b/gnuradio-runtime/swig/gr_ctrlport.i
new file mode 100644
index 0000000000..fa3ae845d7
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_ctrlport.i
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 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.
+ */
+
+#ifdef GR_CTRLPORT
+
+typedef uint32_t DisplayType;
+
+// DisplayType Plotting types
+const uint32_t DISPNULL = 0x0000;
+const uint32_t DISPTIME = 0x0001;
+const uint32_t DISPXY = 0x0002;
+const uint32_t DISPPSD = 0x0004;
+const uint32_t DISPSPEC = 0x0008;
+const uint32_t DISPRAST = 0x0010;
+
+// DisplayType Options
+const uint32_t DISPOPTCPLX = 0x0100;
+const uint32_t DISPOPTLOG = 0x0200;
+const uint32_t DISPOPTSTEM = 0x0400;
+const uint32_t DISPOPTSTRIP = 0x0800;
+const uint32_t DISPOPTSCATTER = 0x1000;
+
+enum priv_lvl_t {
+ RPC_PRIVLVL_ALL = 0,
+ RPC_PRIVLVL_MIN = 9,
+ RPC_PRIVLVL_NONE = 10
+};
+
+enum KnobType {
+ KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT,
+ KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL,
+ KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE,
+ KNOBVECSTRING, KNOBVECLONG
+};
+
+%{
+#include <rpcserver_booter_base.h>
+#include <rpcserver_booter_aggregator.h>
+#include <pycallback_object.h>
+%}
+
+%include <rpcserver_booter_base.h>
+%include <rpcserver_booter_aggregator.h>
+%include <pycallback_object.h>
+
+// Declare this class here but without the nested templated class
+// inside (replaces include of rpcmanager.h)
+class GR_RUNTIME_API rpcmanager : public virtual rpcmanager_base
+{
+ public:
+ rpcmanager();
+ ~rpcmanager();
+
+ static rpcserver_booter_base* get();
+
+ static void register_booter(rpcserver_booter_base* booter);
+};
+
+
+// Attach a new python callback method to Python function
+%extend pycallback_object {
+ // Set a Python function object as a callback function
+ // Note : PyObject *pyfunc is remapped with a typempap
+ void activate(PyObject *pyfunc)
+ {
+ self->set_callback(pyfunc);
+ Py_INCREF(pyfunc);
+ }
+}
+
+%template(RPC_get_string) pycallback_object<std::string>;
+%template(RPC_get_int) pycallback_object<int>;
+%template(RPC_get_float) pycallback_object<float>;
+%template(RPC_get_double) pycallback_object<double>;
+%template(RPC_get_vector_float) pycallback_object<std::vector<float> >;
+%template(RPC_get_vector_gr_complex) pycallback_object<std::vector<gr_complex> >;
+
+#endif /* GR_CTRLPORT */
diff --git a/gnuradio-runtime/swig/gr_types.i b/gnuradio-runtime/swig/gr_types.i
new file mode 100644
index 0000000000..e81d43f40c
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_types.i
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 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.
+ */
+
+%include "std_string.i"
+%include "stdint.i"
+
+%{
+#include <boost/shared_ptr.hpp>
+#include <boost/any.hpp>
+#include <complex>
+#include <string>
+#include <stddef.h> // size_t
+#include <stdint.h>
+#include <gr_types.h>
+%}
+
+%include <std_complex.i>
+%include <std_vector.i>
+%include <stl.i>
+
+typedef std::complex<float> gr_complex;
+typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+
+namespace std {
+ %template() vector<unsigned char>;
+ %template() vector<signed char>;
+ %template() vector<char>;
+
+ %template() vector<unsigned short>;
+ %template() vector<short>;
+
+ %template() vector<int>;
+ %template() vector<unsigned int>;
+
+ %template() vector<long int>;
+ %template() vector<long unsigned int>;
+
+ %template() vector<float>;
+ %template() vector<double>;
+ %template() vector< complex<float> >;
+ %template() vector< complex<double> >;
+
+ %template() vector<gr_complex>;
+ %template() vector<gr_complexd>;
+
+ %template() vector< vector< unsigned char > >;
+ %template() vector< vector< char > >;
+ %template() vector< vector< short > >;
+ %template() vector< vector< int > >;
+ %template() vector< vector< long int> >;
+ %template() vector< vector< float > >;
+ %template() vector< vector< double > >;
+ %template() vector< vector< complex<float> > >;
+ %template() vector< vector< gr_complex> >;
+ %template() vector< vector< gr_complexd> >;
+
+ %template() vector<string>;
+};
+
+// Fix for Issue #529
+#ifdef SIZE_T_32
+ // On 32-bit systems, whenever we see std::vector<size_t>, replace it
+ // with vector<unsigned int>
+ %apply std::vector<unsigned int> { std::vector<size_t> };
+#else
+ // On 64-bit systems, whenever we see std::vector<size_t>, replace it
+ // with vector<long unsigned int>
+ %apply std::vector<long unsigned int> { std::vector<size_t> };
+#endif
diff --git a/gnuradio-runtime/swig/pmt_swig.i b/gnuradio-runtime/swig/pmt_swig.i
index b86b88c4d1..24be053afe 100644
--- a/gnuradio-runtime/swig/pmt_swig.i
+++ b/gnuradio-runtime/swig/pmt_swig.i
@@ -44,26 +44,9 @@
%include "pmt_swig_doc.i"
%include <gr_extras.i>
-%include <std_complex.i>
-%include <std_vector.i>
-%include <stl.i>
-
-namespace std {
- %template() vector<unsigned char>;
- %template() vector<uint8_t>;
- %template() vector<char>;
- %template() vector<int8_t>;
- %template() vector<short>;
- %template() vector<uint16_t>;
- %template() vector<int16_t>;
- %template() vector<int>;
- %template() vector<int32_t>;
- %template() vector<uint32_t>;
- %template() vector<float>;
- %template() vector<double>;
- %template() vector< std::complex<float> >;
- %template() vector< std::complex<double> >;
-};
+%include <gr_types.i>
+
+%template() std::vector<uint32_t>;
////////////////////////////////////////////////////////////////////////
// Language independent exception handler
diff --git a/gnuradio-runtime/swig/runtime_block_gateway.i b/gnuradio-runtime/swig/runtime_block_gateway.i
index 94428c0d5e..52d4194dee 100644
--- a/gnuradio-runtime/swig/runtime_block_gateway.i
+++ b/gnuradio-runtime/swig/runtime_block_gateway.i
@@ -1,3 +1,4 @@
+/* -*- c++ -*- */
/*
* Copyright 2011-2012 Free Software Foundation, Inc.
*
@@ -26,11 +27,7 @@
%include <gr_tags.i>
%include <gr_feval.i>
-////////////////////////////////////////////////////////////////////////
-// data type support
-////////////////////////////////////////////////////////////////////////
-%template(int_vector_t) std::vector<int>;
-%template(void_star_vector_t) std::vector<void *>;
+%template(void_start_vector_t) std::vector<void *>;
////////////////////////////////////////////////////////////////////////
// block headers
diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i
index 5b84a71c9f..99528c1531 100644
--- a/gnuradio-runtime/swig/runtime_swig.i
+++ b/gnuradio-runtime/swig/runtime_swig.i
@@ -91,80 +91,4 @@
%include <gr_top_block.i>
%include <runtime_block_gateway.i>
-#ifdef GR_CTRLPORT
-
-typedef uint32_t DisplayType;
-
-// DisplayType Plotting types
-const uint32_t DISPNULL = 0x0000;
-const uint32_t DISPTIME = 0x0001;
-const uint32_t DISPXY = 0x0002;
-const uint32_t DISPPSD = 0x0004;
-const uint32_t DISPSPEC = 0x0008;
-const uint32_t DISPRAST = 0x0010;
-
-// DisplayType Options
-const uint32_t DISPOPTCPLX = 0x0100;
-const uint32_t DISPOPTLOG = 0x0200;
-const uint32_t DISPOPTSTEM = 0x0400;
-const uint32_t DISPOPTSTRIP = 0x0800;
-const uint32_t DISPOPTSCATTER = 0x1000;
-
-enum priv_lvl_t {
- RPC_PRIVLVL_ALL = 0,
- RPC_PRIVLVL_MIN = 9,
- RPC_PRIVLVL_NONE = 10
-};
-
-enum KnobType {
- KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT,
- KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL,
- KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE,
- KNOBVECSTRING, KNOBVECLONG
-};
-
-%template(StrVector) std::vector<std::string>;
-
-%{
-#include <rpcserver_booter_base.h>
-#include <rpcserver_booter_aggregator.h>
-#include <pycallback_object.h>
-%}
-
-%include <rpcserver_booter_base.h>
-%include <rpcserver_booter_aggregator.h>
-%include <pycallback_object.h>
-
-// Declare this class here but without the nested templated class
-// inside (replaces include of rpcmanager.h)
-class GR_RUNTIME_API rpcmanager : public virtual rpcmanager_base
-{
- public:
- rpcmanager();
- ~rpcmanager();
-
- static rpcserver_booter_base* get();
-
- static void register_booter(rpcserver_booter_base* booter);
-};
-
-
-// Attach a new python callback method to Python function
-%extend pycallback_object {
- // Set a Python function object as a callback function
- // Note : PyObject *pyfunc is remapped with a typempap
- void activate(PyObject *pyfunc)
- {
- self->set_callback(pyfunc);
- Py_INCREF(pyfunc);
- }
-}
-
-%template(RPC_get_string) pycallback_object<std::string>;
-%template(RPC_get_int) pycallback_object<int>;
-%template(RPC_get_float) pycallback_object<float>;
-%template(RPC_get_double) pycallback_object<double>;
-%template(RPC_get_vector_float) pycallback_object<std::vector<float> >;
-%template(RPC_get_vector_gr_complex) pycallback_object<std::vector<gr_complex> >;
-
-#endif /* GR_CTRLPORT */
+%include <gr_ctrlport.i>
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
index fa0cbf76a0..f808d1e771 100644
--- a/gr-blocks/swig/blocks_swig.i
+++ b/gr-blocks/swig/blocks_swig.i
@@ -30,7 +30,7 @@
%include <gr_endianness.h>
-%template() std::vector<size_t>;
+// For vector_map.
%template() std::vector< std::vector< std::vector<size_t> > >;
%{
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index 275496a5c6..54f9c64e2d 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -36,9 +36,6 @@
%}
%include <blocks/control_loop.h>
-// Used in the constellation objects
-%template(unsigned_int_vector) std::vector<unsigned int>;
-
%{
#include "digital/additive_scrambler_bb.h"
#include "digital/binary_slicer_fb.h"
diff --git a/gr-shd/swig/shd_swig.i b/gr-shd/swig/shd_swig.i
index 3169d02966..7b1c1782ec 100644
--- a/gr-shd/swig/shd_swig.i
+++ b/gr-shd/swig/shd_swig.i
@@ -63,7 +63,6 @@
////////////////////////////////////////////////////////////////////////
// used types
////////////////////////////////////////////////////////////////////////
-%template(string_vector_t) std::vector<std::string>;
%include <shd/config.hpp>
@@ -103,7 +102,6 @@
////////////////////////////////////////////////////////////////////////
%include stdint.i
%include <shd/types/serial.hpp>
-%template(byte_vector_t) std::vector<uint8_t>;
%include <shd/xmini/dboard_iface.hpp>
%template(dboard_iface_sptr) boost::shared_ptr<shd::xmini::dboard_iface>;
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
index 478d8d7d2d..3df3c885b6 100644
--- a/gr-uhd/swig/uhd_swig.i
+++ b/gr-uhd/swig/uhd_swig.i
@@ -49,9 +49,6 @@
////////////////////////////////////////////////////////////////////////
// used types
////////////////////////////////////////////////////////////////////////
-%template(string_vector_t) std::vector<std::string>;
-
-%template(size_vector_t) std::vector<size_t>;
%include <uhd/config.hpp>
@@ -91,7 +88,6 @@
////////////////////////////////////////////////////////////////////////
%include stdint.i
%include <uhd/types/serial.hpp>
-%template(byte_vector_t) std::vector<uint8_t>;
%include <uhd/usrp/dboard_iface.hpp>
%template(dboard_iface_sptr) boost::shared_ptr<uhd::usrp::dboard_iface>;