diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-27 18:59:37 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-27 18:59:37 -0400 |
commit | 6a4f2e5534822f89c5c53ee1271579d68374a259 (patch) | |
tree | 2954d41af0bdd79a3c56f6ad6776ce922bd69edd | |
parent | 4f63602062f44d6f98b6071cd739c5b64414b78f (diff) |
runtime: adding block_gateway back into project.
-rw-r--r-- | gnuradio-runtime/include/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gnuradio-runtime/include/runtime_block_gateway.h (renamed from gnuradio-runtime/include/gr_block_gateway.h) | 11 | ||||
-rw-r--r-- | gnuradio-runtime/lib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gnuradio-runtime/lib/runtime_block_gateway.cc (renamed from gnuradio-runtime/lib/gr_block_gateway.cc) | 13 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/__init__.py | 2 | ||||
-rw-r--r-- | gnuradio-runtime/swig/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-runtime/swig/gr_feval.i | 62 | ||||
-rw-r--r-- | gnuradio-runtime/swig/runtime_block_gateway.i (renamed from gnuradio-runtime/swig/gr_block_gateway.i) | 7 | ||||
-rw-r--r-- | gnuradio-runtime/swig/runtime_swig.i | 3 |
10 files changed, 81 insertions, 23 deletions
diff --git a/gnuradio-runtime/include/CMakeLists.txt b/gnuradio-runtime/include/CMakeLists.txt index a9b39958b0..77b284705a 100644 --- a/gnuradio-runtime/include/CMakeLists.txt +++ b/gnuradio-runtime/include/CMakeLists.txt @@ -23,7 +23,6 @@ install(FILES gr_basic_block.h gr_block_detail.h - gr_block_gateway.h gr_block.h gr_block_registry.h gr_buffer.h @@ -87,6 +86,7 @@ install(FILES rpcserver_booter_ice.h rpcserver_ice.h rpcserver_selector.h + runtime_block_gateway.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "runtime_devel" ) diff --git a/gnuradio-runtime/include/gr_block_gateway.h b/gnuradio-runtime/include/runtime_block_gateway.h index 93bfd75144..390864376f 100644 --- a/gnuradio-runtime/include/gr_block_gateway.h +++ b/gnuradio-runtime/include/runtime_block_gateway.h @@ -19,8 +19,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_BLOCK_GATEWAY_H -#define INCLUDED_GR_BLOCK_GATEWAY_H +#ifndef INCLUDED_RUNTIME_BLOCK_GATEWAY_H +#define INCLUDED_RUNTIME_BLOCK_GATEWAY_H #include <gr_runtime_api.h> #include <gr_block.h> @@ -79,7 +79,7 @@ struct gr_block_gw_message_type{ * The methods prefixed with gr_block__ are renamed * to class methods without the prefix in python. */ -class GR_RUNTIME_API gr_block_gateway : virtual public gr_block{ +class GR_RUNTIME_API runtime_block_gateway : virtual public gr_block{ public: //! Provide access to the shared message object virtual gr_block_gw_message_type &gr_block_message(void) = 0; @@ -252,7 +252,8 @@ protected: * \param factor the decimation or interpolation factor * \return a new gateway block */ -GR_RUNTIME_API boost::shared_ptr<gr_block_gateway> gr_make_block_gateway( +GR_RUNTIME_API boost::shared_ptr<runtime_block_gateway> +runtime_make_block_gateway( gr_feval_ll *handler, const std::string &name, gr_io_signature_sptr in_sig, @@ -261,4 +262,4 @@ GR_RUNTIME_API boost::shared_ptr<gr_block_gateway> gr_make_block_gateway( const unsigned factor ); -#endif /* INCLUDED_GR_BLOCK_GATEWAY_H */ +#endif /* INCLUDED_RUNTIME_BLOCK_GATEWAY_H */ diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index 9276647ea2..01b9b172b0 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -67,7 +67,6 @@ list(APPEND gnuradio_runtime_sources gr_block.cc gr_block_detail.cc gr_block_executor.cc - gr_block_gateway.cc gr_block_registry.cc gr_buffer.cc gr_circular_file.cc @@ -118,6 +117,7 @@ list(APPEND gnuradio_runtime_sources gr_vmcircbuf_mmap_tmpfile.cc gr_vmcircbuf_sysv_shm.cc malloc16.c + runtime_block_gateway.cc ) # PowerPC workaround for posix_memalign diff --git a/gnuradio-runtime/lib/gr_block_gateway.cc b/gnuradio-runtime/lib/runtime_block_gateway.cc index 79b42803af..11d16af41e 100644 --- a/gnuradio-runtime/lib/gr_block_gateway.cc +++ b/gnuradio-runtime/lib/runtime_block_gateway.cc @@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_block_gateway.h> +#include <runtime_block_gateway.h> #include <gr_io_signature.h> #include <iostream> #include <boost/bind.hpp> @@ -38,9 +38,9 @@ void copy_pointers(OutType &out, const InType &in){ /*********************************************************************** * The gr_block gateway implementation class **********************************************************************/ -class gr_block_gateway_impl : public gr_block_gateway{ +class runtime_block_gateway_impl : public runtime_block_gateway{ public: - gr_block_gateway_impl( + runtime_block_gateway_impl( gr_feval_ll *handler, const std::string &name, gr_io_signature_sptr in_sig, @@ -170,7 +170,7 @@ private: unsigned _decim, _interp; }; -boost::shared_ptr<gr_block_gateway> gr_make_block_gateway( +boost::shared_ptr<runtime_block_gateway> runtime_make_block_gateway( gr_feval_ll *handler, const std::string &name, gr_io_signature_sptr in_sig, @@ -178,7 +178,8 @@ boost::shared_ptr<gr_block_gateway> gr_make_block_gateway( const gr_block_gw_work_type work_type, const unsigned factor ){ - return boost::shared_ptr<gr_block_gateway>( - new gr_block_gateway_impl(handler, name, in_sig, out_sig, work_type, factor) + return boost::shared_ptr<runtime_block_gateway>( + new runtime_block_gateway_impl(handler, name, in_sig, out_sig, + work_type, factor) ); } diff --git a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt index 343577deb8..cd57704930 100644 --- a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt @@ -22,6 +22,7 @@ include(GrPython) GR_PYTHON_INSTALL(FILES __init__.py + gateway.py gr_threading.py gr_threading_23.py gr_threading_24.py diff --git a/gnuradio-runtime/python/gnuradio/gr/__init__.py b/gnuradio-runtime/python/gnuradio/gr/__init__.py index 45c8df146e..c1d6c87629 100644 --- a/gnuradio-runtime/python/gnuradio/gr/__init__.py +++ b/gnuradio-runtime/python/gnuradio/gr/__init__.py @@ -33,7 +33,7 @@ from exceptions import * from top_block import * from hier_block2 import * from tag_utils import * -#from gateway import basic_block, sync_block, decim_block, interp_block +from gateway import basic_block, sync_block, decim_block, interp_block # Force the preference database to be initialized prefs = gr_prefs.singleton diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt index 483f3e7c2f..0e89601ae7 100644 --- a/gnuradio-runtime/swig/CMakeLists.txt +++ b/gnuradio-runtime/swig/CMakeLists.txt @@ -97,6 +97,7 @@ install( gr_tagged_stream_block.i gr_tags.i gr_top_block.i + runtime_block_gateway.i runtime_swig.i ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig diff --git a/gnuradio-runtime/swig/gr_feval.i b/gnuradio-runtime/swig/gr_feval.i index ccca8433d2..bcf4f1e646 100644 --- a/gnuradio-runtime/swig/gr_feval.i +++ b/gnuradio-runtime/swig/gr_feval.i @@ -154,11 +154,67 @@ public: virtual void calleval(pmt_t x); }; -%{ -#include <gr_py_feval.h> +/* + * These are the ones to derive from in Python. They have the magic shim + * that ensures that we're holding the Python GIL when we enter Python land... + */ + +%inline %{ +#include <gruel/pmt.h> + +class gr_py_feval_dd : public gr_feval_dd +{ + public: + double calleval(double x) + { + ensure_py_gil_state _lock; + return eval(x); + } +}; + +class gr_py_feval_cc : public gr_feval_cc +{ + public: + gr_complex calleval(gr_complex x) + { + ensure_py_gil_state _lock; + return eval(x); + } +}; + +class gr_py_feval_ll : public gr_feval_ll +{ + public: + long calleval(long x) + { + ensure_py_gil_state _lock; + return eval(x); + } +}; + +class gr_py_feval : public gr_feval +{ + public: + void calleval() + { + ensure_py_gil_state _lock; + eval(); + } +}; + +class gr_py_feval_p : public gr_feval_p +{ + public: + void calleval(pmt::pmt_t x) + { + ensure_py_gil_state _lock; + eval(x); + } +}; + %} -//%include <gr_py_feval.> + // examples / test cases diff --git a/gnuradio-runtime/swig/gr_block_gateway.i b/gnuradio-runtime/swig/runtime_block_gateway.i index 1595839ff7..94428c0d5e 100644 --- a/gnuradio-runtime/swig/gr_block_gateway.i +++ b/gnuradio-runtime/swig/runtime_block_gateway.i @@ -36,12 +36,11 @@ // block headers //////////////////////////////////////////////////////////////////////// %{ -#include <gr_block_gateway.h> +#include <runtime_block_gateway.h> %} -%include <gr_block_gateway.h> - //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(gr,block_gateway); +GR_SWIG_BLOCK_MAGIC(runtime, block_gateway); +%include <runtime_block_gateway.h> diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i index 2973d1992f..4fc1f01e13 100644 --- a/gnuradio-runtime/swig/runtime_swig.i +++ b/gnuradio-runtime/swig/runtime_swig.i @@ -36,7 +36,6 @@ #include <gr_endianness.h> #include <gr_block.h> #include <gr_block_detail.h> -#include <gr_block_gateway.h> #include <gr_buffer.h> #include <gr_constants.h> #include <gr_dispatcher.h> @@ -70,7 +69,6 @@ %include <gr_basic_block.i> %include <gr_block.i> %include <gr_block_detail.i> -%include <gr_block_gateway.i> %include <gr_buffer.i> %include <gr_constants.i> %include <gr_dispatcher.i> @@ -91,6 +89,7 @@ %include <gr_tagged_stream_block.i> %include <gr_tags.i> %include <gr_top_block.i> +%include <runtime_block_gateway.i> #ifdef GR_CTRLPORT |