diff options
Diffstat (limited to 'gnuradio-runtime/swig')
30 files changed, 0 insertions, 2002 deletions
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt deleted file mode 100644 index a2a685e19e..0000000000 --- a/gnuradio-runtime/swig/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2013,2019 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# SPDX-License-Identifier: GPL-3.0-or-later -# - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> - $<INSTALL_INTERFACE:include/gnuradio/swig> - ) - -set(GR_SWIG_LIBRARIES - gnuradio-runtime) - -############################################################### -# Build pmt swig -############################################################### - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/pmt - ${CMAKE_CURRENT_BINARY_DIR}/../include/pmt) -GR_SWIG_MAKE(pmt_swig pmt_swig.i) - -GR_SWIG_INSTALL( - TARGETS pmt_swig - DESTINATION ${GR_PYTHON_DIR}/pmt -) - -############################################################### -# Build gnuradio-runtime swig -############################################################### -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) -set(GR_RUNTIME_SWIG_DOC_FILE ${GR_SWIG_DOC_FILE}) -if(ENABLE_GR_CTRLPORT) - set(GR_SWIG_FLAGS "-DGR_CTRLPORT") -endif() -list(APPEND GR_SWIG_TARGET_DEPS pmt_swig) - -GR_SWIG_MAKE(runtime_swig runtime_swig.i) - -install( - TARGETS runtime_swig - EXPORT runtime_swig-export - DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr - ) - -include(GrPython) -GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr - DEPENDS runtime_swig -) - -install(EXPORT runtime_swig-export - FILE runtime_swigTargets.cmake - NAMESPACE gnuradio:: - DESTINATION ${GR_CMAKE_DIR} -) - -install( - FILES - runtime_swig.i - gnuradio.i - basic_block.i - block.i - block_detail.i - block_gateway.i - buffer.i - constants.i - feval.i - gr_ctrlport.i - gr_extras.i - gr_logger.i - gr_shared_ptr.i - gr_swig_block_magic.i - gr_types.i - hier_block2.i - io_signature.i - message.i - msg_handler.i - msg_queue.i - pmt_swig.i - prefs.i - realtime.i - sync_block.i - sync_decimator.i - sync_interpolator.i - tagged_stream_block.i - tags.i - top_block.i - ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i - ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig -) diff --git a/gnuradio-runtime/swig/basic_block.i b/gnuradio-runtime/swig/basic_block.i deleted file mode 100644 index 3ded09031a..0000000000 --- a/gnuradio-runtime/swig/basic_block.i +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::basic_block; -typedef std::shared_ptr<gr::basic_block> gr::basic_block_sptr; -%template(basic_block_sptr) std::shared_ptr<gr::basic_block>; - -%import "pmt_swig.i" - -// support vectors of these... -namespace std { - %template(x_vector_basic_block_sptr) vector<gr::basic_block_sptr>; -}; - -namespace gr { - - class gr::basic_block - { - protected: - basic_block(); - - public: - virtual ~basic_block(); - std::string name() const; - std::string symbol_name() const; - gr::io_signature::sptr input_signature() const; - gr::io_signature::sptr output_signature() const; - long unique_id() const; - gr::basic_block_sptr to_basic_block(); - bool check_topology(int ninputs, int noutputs); - std::string alias(); - void set_block_alias(std::string name); - void _post(pmt::pmt_t which_port, pmt::pmt_t msg); - pmt::pmt_t message_ports_in(); - pmt::pmt_t message_ports_out(); - pmt::pmt_t message_subscribers(pmt::pmt_t which_port); - }; - - %rename(block_ncurrently_allocated) basic_block_ncurrently_allocated; - long basic_block_ncurrently_allocated(); -} - -#ifdef SWIGPYTHON -%pythoncode %{ -basic_block_sptr.__repr__ = lambda self: "<basic_block %s (%d)>" % (self.name(), self.unique_id ()) -%} -#endif diff --git a/gnuradio-runtime/swig/block.i b/gnuradio-runtime/swig/block.i deleted file mode 100644 index fb21dd1447..0000000000 --- a/gnuradio-runtime/swig/block.i +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -%include <basic_block.i> - -class gr::block; -typedef std::shared_ptr<gr::block> gr::block_sptr; -%template(block_sptr) std::shared_ptr<gr::block>; - -// support vectors of these... -namespace std { - %template(x_vector_block_sptr) vector<gr::block_sptr>; -}; - -class gr::block : public gr::basic_block -{ - protected: - block (const std::string &name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature); - - public: - - virtual ~block (); - - unsigned history () const; - - void declare_sample_delay(int which, int delay); - void declare_sample_delay(unsigned int delay); - unsigned sample_delay(int which) const; - - void set_output_multiple(int multiple); - int output_multiple () const; - double relative_rate () const; - uint64_t relative_rate_i () const; - uint64_t relative_rate_d () const; - - bool start(); - bool stop(); - - uint64_t nitems_read(unsigned int which_input); - uint64_t nitems_written(unsigned int which_output); - - void set_log_level(std::string level); - std::string log_level(); - - // Methods to manage the block's max_noutput_items size. - int max_noutput_items(); - void set_max_noutput_items(int m); - void unset_max_noutput_items(); - bool is_set_max_noutput_items(); - void set_min_noutput_items(int m); - int min_noutput_items() const; - - // Methods to manage block's min/max buffer sizes. - long max_output_buffer(int i); - void set_max_output_buffer(long max_output_buffer); - void set_max_output_buffer(int port, long max_output_buffer); - long min_output_buffer(int i); - void set_min_output_buffer(long min_output_buffer); - void set_min_output_buffer(int port, long min_output_buffer); - - // Methods to access performance counters - float pc_noutput_items(); - float pc_noutput_items_avg(); - float pc_noutput_items_var(); - float pc_nproduced(); - float pc_nproduced_avg(); - float pc_nproduced_var(); - float pc_input_buffers_full(int which); - float pc_input_buffers_full_avg(int which); - float pc_input_buffers_full_var(int which); - std::vector<float> pc_input_buffers_full(); - std::vector<float> pc_input_buffers_full_avg(); - std::vector<float> pc_input_buffers_full_var(); - float pc_output_buffers_full(int which); - float pc_output_buffers_full_avg(int which); - float pc_output_buffers_full_var(int which); - std::vector<float> pc_output_buffers_full(); - std::vector<float> pc_output_buffers_full_avg(); - std::vector<float> pc_output_buffers_full_var(); - float pc_work_time(); - float pc_work_time_avg(); - float pc_work_time_var(); - float pc_work_time_total(); - float pc_throughput_avg(); - - // Methods to manage processor affinity. - void set_processor_affinity(const std::vector<int> &mask); - void unset_processor_affinity(); - std::vector<int> processor_affinity(); - - // Methods to manage thread priority - int active_thread_priority(); - int thread_priority(); - int set_thread_priority(int priority); - - // internal use - //block_detail_sptr detail () const { return d_detail; } - //void set_detail (block_detail_sptr detail) { d_detail = detail; } -}; diff --git a/gnuradio-runtime/swig/block_detail.i b/gnuradio-runtime/swig/block_detail.i deleted file mode 100644 index 6e335aaf36..0000000000 --- a/gnuradio-runtime/swig/block_detail.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::block_detail; -typedef std::shared_ptr<gr::block_detail> gr::block_detail_sptr; -%template(block_detail_sptr) std::shared_ptr<gr::block_detail>; -%rename(block_detail) gr::make_block_detail; -%ignore gr::block_detail; - -gr::block_detail_sptr gr:: -gr::make_block_detail(unsigned int ninputs, unsigned int noutputs); - -namespace gr { - - class gr::block_detail { - public: - - ~block_detail (); - - int ninputs() const; - int noutputs() const; - bool sink_p() const; - bool source_p() const; - - void set_input(unsigned int which, gr::buffer_reader_sptr reader); - gr::buffer_reader_sptr input(unsigned int which); - - void set_output(unsigned int which, gr::buffer_sptr buffer); - gr::buffer_sptr output(unsigned int which); - - private: - block_detail(unsigned int ninputs, unsigned int noutputs); - }; - - %rename(block_detail_ncurrently_allocated) block_detail_ncurrently_allocated; - long block_detail_ncurrently_allocated(); -} diff --git a/gnuradio-runtime/swig/block_gateway.i b/gnuradio-runtime/swig/block_gateway.i deleted file mode 100644 index b95b045b72..0000000000 --- a/gnuradio-runtime/swig/block_gateway.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -//////////////////////////////////////////////////////////////////////// -// standard includes -//////////////////////////////////////////////////////////////////////// -%include <gnuradio.i> -%include <tags.i> -%import <feval.i> - -%template(void_start_vector_t) std::vector<void *>; - -//////////////////////////////////////////////////////////////////////// -// block headers -//////////////////////////////////////////////////////////////////////// -%{ -#include <gnuradio/block_gateway.h> -%} - -//////////////////////////////////////////////////////////////////////// -// block magic -//////////////////////////////////////////////////////////////////////// -%include <gnuradio/block_gateway.h> - -%template(block_gateway_sptr) std::shared_ptr<gr::block_gateway>; -%pythoncode %{ -block_gateway_sptr.__repr__ = lambda self: "<block_gateway>" -block_gateway = block_gateway.make; -%} - diff --git a/gnuradio-runtime/swig/buffer.i b/gnuradio-runtime/swig/buffer.i deleted file mode 100644 index a95c7996a0..0000000000 --- a/gnuradio-runtime/swig/buffer.i +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::buffer; -typedef std::shared_ptr<gr::buffer> gr::buffer_sptr; -%template(buffer_sptr) std::shared_ptr<gr::buffer>; -%rename(buffer) gr::make_buffer; -%ignore gr::buffer; - -gr::buffer_sptr -gr::make_buffer (int nitems, size_t sizeof_item, gr::block_sptr link); - -class gr::buffer_reader; -typedef std::shared_ptr<gr::buffer_reader> gr::buffer_reader_sptr; -%template(buffer_reader_sptr) std::shared_ptr<gr::buffer_reader>; -%ignore gr::buffer_reader; - -%rename(buffer_add_reader) gr::buffer_add_reader; -gr::buffer_reader_sptr -gr::buffer_add_reader (gr::buffer_sptr buf, int nzero_preload, gr::block_sptr link); - -namespace gr { - - class gr::buffer - { - public: - ~buffer(); - - private: - buffer(int nitems, size_t sizeof_item, gr::block_sptr link); - }; - - class gr::buffer_reader - { - public: - ~buffer_reader(); - - private: - friend class buffer; - buffer_reader(gr::buffer_sptr buffer, unsigned int read_index, gr::block_sptr link); - }; - - %rename(buffer_ncurrently_allocated) buffer_ncurrently_allocated; - long buffer_ncurrently_allocated(); - - %rename(buffer_reader_ncurrently_allocated) buffer_reader_ncurrently_allocated; - long buffer_reader_ncurrently_allocated(); -} diff --git a/gnuradio-runtime/swig/constants.i b/gnuradio-runtime/swig/constants.i deleted file mode 100644 index 9b7b9610c7..0000000000 --- a/gnuradio-runtime/swig/constants.i +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- c++ -*- */ - -namespace gr { - %rename(prefix) prefix; - %rename(sysconfdir) sysconfdir; - %rename(prefsdir) prefsdir; - %rename(build_date) build_date; - %rename(version) version; - %rename(version_info) version_info; - - const std::string prefix(); - const std::string sysconfdir(); - const std::string prefsdir(); - const std::string build_date(); - const std::string version(); - const std::string major_version(); - const std::string api_version(); - const std::string minor_version(); - -} diff --git a/gnuradio-runtime/swig/feval.i b/gnuradio-runtime/swig/feval.i deleted file mode 100644 index 697417d322..0000000000 --- a/gnuradio-runtime/swig/feval.i +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - - -/* - * N.B., this is a _very_ non-standard SWIG .i file - * - * It contains a bunch of magic that is required to ensure that when - * these classes are used as base classes for python code, - * everything works when calling back from C++ into Python. - * - * The gist of the problem is that our C++ code is usually not holding - * the Python Global Interpreter Lock (GIL). Thus if we invoke a - * "director" method from C++, we'll end up in Python not holding the - * GIL. Disaster (SIGSEGV) will result. To avoid this we insert a - * "shim" that grabs and releases the GIL. - * - * If you don't understand SWIG "directors" or the Python GIL, - * don't bother trying to understand what's going on in here. - * - * [We could eliminate a bunch of this hair by requiring SWIG 1.3.29 - * or later and some additional magic declarations, but many systems - * aren't shipping that version yet. Thus we kludge...] - */ - -// Directors are only supported in Python, Java and C# -#ifdef SWIGPYTHON - -%import "pmt_swig.i" - - // Enable SWIG directors for these classes -%feature("director") gr::py_feval_dd; -%feature("director") gr::py_feval_cc; -%feature("director") gr::py_feval_ll; -%feature("director") gr::py_feval; -%feature("director") gr::py_feval_p; - -%feature("nodirector") gr::py_feval_dd::calleval; -%feature("nodirector") gr::py_feval_cc::calleval; -%feature("nodirector") gr::py_feval_ll::calleval; -%feature("nodirector") gr::py_feval::calleval; -%feature("nodirector") gr::py_feval_p::calleval; - -//%exception { -// try { $action } -// catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; } -//} - -%ignore gr::feval_dd; -%ignore gr::feval_cc; -%ignore gr::feval_ll; -%ignore gr::feval; -%ignore gr::feval_p; - -%include <gnuradio/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... - */ -namespace gr { - %rename(feval_dd) py_feval_dd; - %rename(feval_cc) py_feval_cc; - %rename(feval_ll) py_feval_ll; - %rename(feval) py_feval; - %rename(feval_p) py_feval_p; -} - -%include <gnuradio/py_feval.h> - -namespace gr { - // examples / test cases - %rename(feval_dd_example) gr::feval_dd_example; - %rename(feval_cc_example) gr::feval_cc_example; - %rename(feval_ll_example) gr::feval_ll_example; - %rename(feval_example) gr::feval_example; -} - -#endif // SWIGPYTHON diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i deleted file mode 100644 index 55db0cf30d..0000000000 --- a/gnuradio-runtime/swig/gnuradio.i +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004,2009,2012,2019 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -// Disable warning about base class types -#pragma SWIG nowarn=401 - -//////////////////////////////////////////////////////////////////////// -// gnuradio.i -// SWIG interface definition -//////////////////////////////////////////////////////////////////////// - -%include "std_string.i" -%include <gr_extras.i> - -#ifdef SW_RUNTIME -%include <gr_types.i> -#endif - -//////////////////////////////////////////////////////////////////////// -// Headers - -%feature("autodoc","1"); - -// Required for a bug in SWIG 2.0.4 with GCC 4.6 -// see: http://sourceforge.net/p/swig/bugs/1187/ -%{ -#include <cstddef> -%} - -// local file -%include <gr_shared_ptr.i> -%include <std_except.i> - -//////////////////////////////////////////////////////////////////////// - -#ifndef SW_RUNTIME -// import runtime_swig.i for all but sw_runtime, since it needs to %include -%import <runtime_swig.i> -%import <gr_types.i> -#endif - -//////////////////////////////////////////////////////////////////////// - -%{ -#include <gnuradio/block.h> -#include <gnuradio/sync_block.h> -#include <gnuradio/sync_decimator.h> -#include <gnuradio/sync_interpolator.h> -#include <gnuradio/tagged_stream_block.h> -#include <gnuradio/block_gateway.h> -#include <gnuradio/feval.h> -#include <gnuradio/py_feval.h> -#include <gnuradio/high_res_timer.h> -%} - -%include <gnuradio/high_res_timer.h> - -//////////////////////////////////////////////////////////////////////// -// Python 2/3 compatibility - -%begin %{ -#define SWIG_PYTHON_CAST_MODE -%} diff --git a/gnuradio-runtime/swig/gr_ctrlport.i b/gnuradio-runtime/swig/gr_ctrlport.i deleted file mode 100644 index f65030fd95..0000000000 --- a/gnuradio-runtime/swig/gr_ctrlport.i +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#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, - KNOBCOMPLEX, KNOBCOMPLEXD, - KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE, - KNOBVECSTRING, KNOBVECLONG -}; - -%{ -#include <gnuradio/rpcserver_booter_base.h> -#include <gnuradio/rpcserver_booter_aggregator.h> -#include <gnuradio/pycallback_object.h> -%} - -%include <gnuradio/rpcserver_booter_base.h> -%include <gnuradio/rpcserver_booter_aggregator.h> -%include <gnuradio/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_complex) pycallback_object<gr_complex>; -%template(RPC_get_complexd) pycallback_object<gr_complexd>; -%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_extras.i b/gnuradio-runtime/swig/gr_extras.i deleted file mode 100644 index 5047572dba..0000000000 --- a/gnuradio-runtime/swig/gr_extras.i +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#ifndef GR_EXTRAS_I -#define GR_EXTRAS_I - -//////////////////////////////////////////////////////////////////////// -// Language independent exception handler -//////////////////////////////////////////////////////////////////////// -%include exception.i - -%exception { - try { - $action - } - catch(std::invalid_argument &e) { - SWIG_exception(SWIG_TypeError, e.what()); - } - catch(std::exception &e) { - SWIG_exception(SWIG_RuntimeError, e.what()); - } - catch(...) { - SWIG_exception(SWIG_RuntimeError, "Unknown exception"); - } - -} - -//////////////////////////////////////////////////////////////////////// -// Wrapper for python calls that may block -//////////////////////////////////////////////////////////////////////// - -/*! - * Use GR_PYTHON_BLOCKING_CODE when calling code that blocks. - * - * The try/catch is to save us from boost::thread::interrupt: - * If a thread from the scheduler (or any other boost thread) - * is blocking the routine and throws an interrupt exception. - */ -%{ - -#define GR_PYTHON_BLOCKING_CODE(code) { \ - PyThreadState *_save; \ - _save = PyEval_SaveThread(); \ - try{code} \ - catch(...){PyEval_RestoreThread(_save); throw;} \ - PyEval_RestoreThread(_save); \ -} - -%} - -#endif /*GR_EXTRAS_I*/ diff --git a/gnuradio-runtime/swig/gr_logger.i b/gnuradio-runtime/swig/gr_logger.i deleted file mode 100644 index 7687cc8a46..0000000000 --- a/gnuradio-runtime/swig/gr_logger.i +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012,2019 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -/******************************************************************************* -* Copyright 2011 Johns Hopkins University Applied Physics Lab -* Author: Mark Plett -* Description: -* SWIG interface generator file for gr_logger module. gr_logger wraps log4cpp logging -* for gnuradio. -*******************************************************************************/ - -%feature("autodoc", "1"); // generate python docstrings - -%include "exception.i" -%import "gnuradio.i" // the common stuff - -%{ -#include <stdexcept> -%} - -//----------------------------------- - -%{ -// The .h files -#include <gnuradio/logger.h> -%} - -%rename(logger) gr::logger; -%rename(logger_config) gr_logger_config; -%rename(logger_get_names) gr_logger_get_logger_names; -%rename(logger_reset_config) gr_logger_reset_config; - -void gr_logger_config(const std::string config_filename,unsigned int watch_period = 0); -std::vector<std::string> gr_logger_get_logger_names(void); -void gr_logger_reset_config(void); - -namespace gr { - -// void logger_config(const std::string config_filename, unsigned int watch_period = 0); -// std::vector<std::string> logger_get_logger_names(void); -// void logger_reset_config(void); - - class logger - { - public: - logger(std::string logger_name); - void set_level(std::string level){LOG_SET_LEVEL(d_logger,level);} - void get_level(std::string &level){LOG_GET_LEVEL(d_logger,level);} - void debug(std::string msg){LOG_DEBUG(d_logger,msg);}; - void info(std::string msg){LOG_INFO(d_logger,msg);}; - void notice(std::string msg){LOG_NOTICE(d_logger,msg);}; - void warn(std::string msg){LOG_WARN(d_logger,msg);}; - void error(std::string msg){LOG_ERROR(d_logger,msg);}; - void crit(std::string msg){LOG_CRIT(d_logger,msg);}; - void alert(std::string msg){LOG_ALERT(d_logger,msg);}; - void fatal(std::string msg){LOG_FATAL(d_logger,msg);}; - void emerg(std::string msg){LOG_EMERG(d_logger,msg);}; - void errorIF(bool cond,std::string msg){LOG_ERRORIF(d_logger,cond,msg);}; - void log_assert(bool cond,std::string msg){LOG_ASSERT(d_logger,cond,msg);}; - void add_console_appender(std::string target,std::string pattern); - void add_file_appender(std::string filename,bool append,std::string pattern); - void add_rollingfile_appender(std::string filename, size_t filesize, - int bkup_index, bool append, mode_t mode, - std::string pattern); - }; - -} /* namespace gr */ diff --git a/gnuradio-runtime/swig/gr_shared_ptr.i b/gnuradio-runtime/swig/gr_shared_ptr.i deleted file mode 100644 index 3e601038f5..0000000000 --- a/gnuradio-runtime/swig/gr_shared_ptr.i +++ /dev/null @@ -1,43 +0,0 @@ -// -// shared_ptr -// -// An enhanced relative of scoped_ptr with reference counted copy semantics. -// The object pointed to is deleted when the last shared_ptr pointing to it -// is destroyed or reset. -// - -// -// This is highly hacked up version of std::shared_ptr -// We just need enough to get SWIG to "do the right thing" and -// generate "Smart Pointer" code. -// - -namespace std { - -template<class T> class shared_ptr -{ -public: - - shared_ptr() - { - } - - shared_ptr (T * p) - { - } - - - T * operator-> () // never throws - { - return px; - } - - -private: - - T * px; // contained pointer - int pn; - -}; // shared_ptr - -};
\ No newline at end of file diff --git a/gnuradio-runtime/swig/gr_swig_block_magic.i b/gnuradio-runtime/swig/gr_swig_block_magic.i deleted file mode 100644 index 82f79b5e76..0000000000 --- a/gnuradio-runtime/swig/gr_swig_block_magic.i +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -%define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME) -_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, PKG ## _ ## BASE_NAME) -%enddef - -%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME) -class FULL_NAME; -typedef std::shared_ptr<FULL_NAME> FULL_NAME ## _sptr; -%template(FULL_NAME ## _sptr) std::shared_ptr<FULL_NAME>; -%rename(BASE_NAME) PKG ## _make_ ## BASE_NAME; -%ignore FULL_NAME; -%enddef - -#ifdef SWIGPYTHON -%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME) -_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME) -%pythoncode %{ -FULL_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ()) -%} -%enddef -#endif - -%define GR_SWIG_BLOCK_MAGIC2(PKG, BASE_NAME) -%template(BASE_NAME ## _sptr) std::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>; -%pythoncode %{ -BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id()) -BASE_NAME = BASE_NAME.make; -%} -%enddef - -%define GR_SWIG_BLOCK_MAGIC2_TMPL(PKG, BASE_NAME, TARGET_NAME...) -%template(BASE_NAME) gr:: ## PKG ## :: ## TARGET_NAME; -%template(BASE_NAME ## _sptr) std::shared_ptr<gr:: ## PKG ## :: ## TARGET_NAME ## >; -%pythoncode %{ -BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id()) -BASE_NAME = BASE_NAME.make -%} -%enddef - - -%define GR_SWIG_BLOCK_MAGIC_FACTORY(PKG, BASE_NAME, FACTORY) -%template(FACTORY ## _sptr) std::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>; -%pythoncode %{ -FACTORY ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id()) -FACTORY = BASE_NAME ## _make_ ## FACTORY; -%} -%enddef diff --git a/gnuradio-runtime/swig/gr_types.i b/gnuradio-runtime/swig/gr_types.i deleted file mode 100644 index 8fbc597e76..0000000000 --- a/gnuradio-runtime/swig/gr_types.i +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#ifndef SWIG_GR_TYPES_I -#define SWIG_GR_TYPES_I - -%include "stdint.i" - -%{ -#include <memory> -#include <boost/any.hpp> -#include <complex> -#include <string> -#include <stddef.h> // size_t -#include <stdint.h> -#include <gnuradio/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< 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<string>; - - %template(gr_vsize_t) std::vector<size_t>; - %template(gr_vvvsize_t) std::vector< std::vector< std::vector<size_t> > >; -}; - -%template(gr_vector_complexf) std::vector< std::complex<float> >; -%template(gr_vector_complexd) std::vector< std::complex<double> >; -%template(gr_vector_vector_complexf) std::vector< std::vector< std::complex<float> > >; -%template(gr_vector_vector_complexd) std::vector< std::vector< std::complex<double> > >; - -// Fix for Issue #529: replace std::vector<size_t> with its equivalent -// in element size, one of "unsigned int", "unsigned long", or -// "unsigned long long". The replacement depends on the sizeof each -// type, as determined in GrSwig.cmake GR_SWIG_MAKE. For SWIG >= -// 3.0.0, none of these will be defined because this issue seems to -// have been fixed. - -#if defined(SIZE_T_UINT) - %apply std::vector<unsigned int> { std::vector<size_t> }; -#elif defined(SIZE_T_UL) - %apply std::vector<unsigned long> { std::vector<size_t> }; -#elif defined(SIZE_T_ULL) - %apply std::vector<unsigned long long> { std::vector<size_t> }; -#endif - -#endif /* SWIG_GR_TYPES_I */ diff --git a/gnuradio-runtime/swig/hier_block2.i b/gnuradio-runtime/swig/hier_block2.i deleted file mode 100644 index 0b21870c5c..0000000000 --- a/gnuradio-runtime/swig/hier_block2.i +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2007,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -%include <basic_block.i> - -class gr::hier_block2; -typedef std::shared_ptr<gr::hier_block2> gr::hier_block2_sptr; -%template(hier_block2_sptr) std::shared_ptr<gr::hier_block2>; - -namespace gr { - // Hack to have a Python shim implementation of gr.hier_block2 - // that instantiates one of these and passes through calls - %rename(hier_block2_swig) make_hier_block2; - gr::hier_block2_sptr - make_hier_block2(const std::string name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature) - noexcept(false); -} - -// Rename connect and disconnect so that we can more easily build a -// better interface in scripting land. -%rename(primitive_connect) gr::hier_block2::connect; -%rename(primitive_disconnect) gr::hier_block2::disconnect; -%rename(primitive_msg_connect) gr::hier_block2::msg_connect; -%rename(primitive_msg_disconnect) gr::hier_block2::msg_disconnect; -%rename(primitive_message_port_register_hier_in) gr::hier_block2::message_port_register_hier_in; -%rename(primitive_message_port_register_hier_out) gr::hier_block2::message_port_register_hier_out; - -namespace gr { - class hier_block2 : public gr::basic_block - { - private: - hier_block2(const std::string name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature); - - public: - ~hier_block2 (); - - void connect(gr::basic_block_sptr block) - noexcept(false); - void connect(gr::basic_block_sptr src, int src_port, - gr::basic_block_sptr dst, int dst_port) - noexcept(false); - void msg_connect(gr::basic_block_sptr src, pmt::pmt_t srcport, - gr::basic_block_sptr dst, pmt::pmt_t dstport) - noexcept(false); - void msg_connect(gr::basic_block_sptr src, std::string srcport, - gr::basic_block_sptr dst, std::string dstport) - noexcept(false); - void msg_disconnect(gr::basic_block_sptr src, pmt::pmt_t srcport, - gr::basic_block_sptr dst, pmt::pmt_t dstport) - noexcept(false); - void msg_disconnect(gr::basic_block_sptr src, std::string srcport, - gr::basic_block_sptr dst, std::string dstport) - noexcept(false); - - void disconnect(gr::basic_block_sptr block) - noexcept(false); - void disconnect(gr::basic_block_sptr src, int src_port, - gr::basic_block_sptr dst, int dst_port) - noexcept(false); - void disconnect_all(); - void lock(); - void unlock(); - - void message_port_register_hier_in(pmt::pmt_t port_id); - void message_port_register_hier_out(pmt::pmt_t port_id); - - void set_processor_affinity(const std::vector<int> &mask); - void unset_processor_affinity(); - std::vector<int> processor_affinity(); - - void set_log_level(std::string level); - std::string log_level(); - - // Methods to manage block's min/max buffer sizes. - size_t max_output_buffer(int i); - void set_max_output_buffer(size_t max_output_buffer); - void set_max_output_buffer(int port, size_t max_output_buffer); - size_t min_output_buffer(int i); - void set_min_output_buffer(size_t min_output_buffer); - void set_min_output_buffer(int port, size_t min_output_buffer); - - gr::hier_block2_sptr to_hier_block2(); // Needed for Python type coercion - }; - - std::string dot_graph(hier_block2_sptr hierblock2); -} diff --git a/gnuradio-runtime/swig/io_signature.i b/gnuradio-runtime/swig/io_signature.i deleted file mode 100644 index 7fc029fc07..0000000000 --- a/gnuradio-runtime/swig/io_signature.i +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,2007,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -namespace gr { - - class GR_RUNTIME_API io_signature - { - io_signature(int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items); - - public: - typedef std::shared_ptr<io_signature> sptr; - - // Avoids a swig warning, otherwise we could just - // #include <gnuradio/io_signature.h> instead of redoing this - // #entire class - //static const int IO_INFINITE = -1; - - ~io_signature(); - - - static sptr make(int min_streams, int max_streams, - int sizeof_stream_item); - static sptr make2(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2); - static sptr make3(int min_streams, int max_streams, - int sizeof_stream_item1, - int sizeof_stream_item2, - int sizeof_stream_item3); - static sptr makev(int min_streams, int max_streams, - const std::vector<int> &sizeof_stream_items); - - int min_streams() const { return d_min_streams; } - int max_streams() const { return d_max_streams; } - int sizeof_stream_item(int index) const; - std::vector<int> sizeof_stream_items() const; - }; - -} /* namespace gr */ - - -%template(io_signature_sptr) std::shared_ptr<gr::io_signature>; -%pythoncode %{ -io_signature_sptr.__repr__ = lambda self: "<io_signature: %d, %d>" % (self.min_streams(), self.max_streams()) -io_signaturev = io_signature.makev; -io_signature3 = io_signature.make3; -io_signature2 = io_signature.make2; -io_signature = io_signature.make; -%} diff --git a/gnuradio-runtime/swig/message.i b/gnuradio-runtime/swig/message.i deleted file mode 100644 index 4265d3a9ab..0000000000 --- a/gnuradio-runtime/swig/message.i +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -namespace gr { - - %pythonappend message::to_string %{ - import sys - if sys.version_info[0] > 2: - val = val.encode("utf8", errors="surrogateescape") - %} - - /*! - * \brief Message. - * - * The ideas and method names for adjustable message length were - * lifted from the click modular router "Packet" class. - */ - class message - { - public: - typedef std::shared_ptr<message> sptr; - - private: - message(long type, double arg1, double arg2, size_t length); - - unsigned char *buf_data() const; - size_t buf_len() const; - - public: - static sptr make(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); - - static sptr make_from_string(const std::string s, long type = 0, - double arg1 = 0, double arg2 = 0); - - ~message(); - - long type() const; - double arg1() const; - double arg2() const; - - void set_type(long type); - void set_arg1(double arg1); - void set_arg2(double arg2); - - size_t length() const; - std::string to_string() const; - }; - - %rename(message_ncurrently_allocated) message_ncurrently_allocated; - long message_ncurrently_allocated(); -} - - - -%template(message_sptr) std::shared_ptr<gr::message>; -%pythoncode %{ -message_from_string = message.make_from_string -message = message.make -%} diff --git a/gnuradio-runtime/swig/msg_handler.i b/gnuradio-runtime/swig/msg_handler.i deleted file mode 100644 index ab4c2c3ed3..0000000000 --- a/gnuradio-runtime/swig/msg_handler.i +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -/*! - * \brief abstract class of message handlers - */ -class gr::msg_handler -{ -public: - virtual ~msg_handler () = 0; - - //! handle \p msg - virtual void handle(gr::message::sptr msg) = 0; -}; diff --git a/gnuradio-runtime/swig/msg_queue.i b/gnuradio-runtime/swig/msg_queue.i deleted file mode 100644 index 20ca9d16ef..0000000000 --- a/gnuradio-runtime/swig/msg_queue.i +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2009-2011,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -namespace gr { - /*! - * \brief thread-safe message queue - */ - class msg_queue : public gr::msg_handler - { - public: - typedef std::shared_ptr<msg_queue> sptr; - - static sptr make(unsigned int limit=0); - - msg_queue(unsigned int limit); - ~msg_queue(); - - //! Generic msg_handler method: insert the message. - //void handle(gr::message::sptr msg) { insert_tail (msg); } - - /*! - * \brief Insert message at tail of queue. - * \param msg message - * - * Block if queue if full. - */ - //void insert_tail(gr::message::sptr msg); - - /*! - * \brief Delete message from head of queue and return it. - * Block if no message is available. - */ - //gr::message::sptr delete_head(); - - /*! - * \brief If there's a message in the q, delete it and return it. - * If no message is available, return 0. - */ - gr::message::sptr delete_head_nowait(); - - //! is the queue empty? - bool empty_p() const; - - //! is the queue full? - bool full_p() const; - - //! return number of messages in queue - unsigned int count() const; - - //! Delete all messages from the queue - void flush(); - }; -} - -/* - * The following kludge-o-rama releases the Python global interpreter - * lock around these potentially blocking calls. We don't want - * libgnuradio-runtime to be dependent on Python, thus we create these - * functions that serve as replacements for the normal C++ delete_head - * and insert_tail methods. The %pythoncode smashes these new C++ - * functions into the gr.msg_queue wrapper class, so that everything - * appears normal. (An evil laugh is heard in the distance...) - */ -#ifdef SWIGPYTHON -%inline %{ - gr::message::sptr py_msg_queue__delete_head(gr::msg_queue::sptr q) { - gr::message::sptr msg; - GR_PYTHON_BLOCKING_CODE( - msg = q->delete_head(); - ) - return msg; - } - - void py_msg_queue__insert_tail(gr::msg_queue::sptr q, gr::message::sptr msg) { - GR_PYTHON_BLOCKING_CODE( - q->insert_tail(msg); - ) - } -%} - -// smash in new python delete_head and insert_tail methods... -%template(msg_queue_sptr) std::shared_ptr<gr::msg_queue>; -%pythoncode %{ -msg_queue_sptr.delete_head = py_msg_queue__delete_head -msg_queue_sptr.insert_tail = py_msg_queue__insert_tail -msg_queue_sptr.handle = py_msg_queue__insert_tail -msg_queue = msg_queue.make -%} -#endif // SWIGPYTHON diff --git a/gnuradio-runtime/swig/pmt_swig.i b/gnuradio-runtime/swig/pmt_swig.i deleted file mode 100644 index c830590129..0000000000 --- a/gnuradio-runtime/swig/pmt_swig.i +++ /dev/null @@ -1,325 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011-2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#pragma SWIG nowarn=401 - -%include "std_string.i" -%include "stdint.i" - -%{ -#include <memory> -#include <boost/any.hpp> -#include <complex> -#include <string> -#include <stddef.h> // size_t -#include <stdint.h> -#include <iosfwd> -#include <stdexcept> -#include <pmt/pmt.h> - -namespace pmt { - // Wrapper for serialize_str(), so we always have raw byte strings - std::vector<uint8_t> _serialize_str_u8(pmt_t obj) - { - std::string serialized_str(serialize_str(obj)); - return std::vector<uint8_t>(serialized_str.begin(), serialized_str.end()); - } - - // Wrapper for deserialize_str(), so we always have raw byte strings - pmt_t _deserialize_str_u8(std::vector<uint8_t> py_str) - { - std::string cpp_str(py_str.begin(), py_str.end()); - return deserialize_str(cpp_str); - } -} /* namespace pmt */ - -%} - -%feature("autodoc","1"); - -//load generated python docstrings -%include "pmt_swig_doc.i" - -%include <gr_extras.i> - -%include <std_complex.i> -%include <std_vector.i> -%include <gr_shared_ptr.i> -%template(pmt_vector_int8) std::vector<int8_t>; -%template(pmt_vector_uint8) std::vector<uint8_t>; -%template(pmt_vector_int16) std::vector<int16_t>; -%template(pmt_vector_uint16) std::vector<uint16_t>; -%template(pmt_vector_int32) std::vector<int32_t>; -%template(pmt_vector_uint32) std::vector<uint32_t>; -%template(pmt_vector_float) std::vector<float>; -%template(pmt_vector_double) std::vector<double>; -%template(pmt_vector_cfloat) std::vector< std::complex<float> >; -%template(pmt_vector_cdouble) std::vector< std::complex<double> >; - -//////////////////////////////////////////////////////////////////////// -// Language independent exception handler -//////////////////////////////////////////////////////////////////////// - -%template(swig_pmt_ptr) std::shared_ptr<pmt::pmt_base>; - -namespace pmt{ - class pmt_base; - typedef std::shared_ptr<pmt::pmt_base> pmt_t; - - %pythoncode - %{ - swig_pmt_ptr.__repr__ = lambda self: write_string(self) - %} - - pmt_t get_PMT_NIL(); - pmt_t get_PMT_T(); - pmt_t get_PMT_F(); - pmt_t get_PMT_EOF(); - - #define PMT_NIL get_PMT_NIL() - #define PMT_T get_PMT_T() - #define PMT_F get_PMT_F() - #define PMT_EOF get_PMT_EOF() - - bool is_bool(pmt_t obj); - bool is_true(pmt_t obj); - bool is_false(pmt_t obj); - pmt_t from_bool(bool val); - bool to_bool(pmt_t val); - - bool is_symbol(const pmt_t& obj); - pmt_t string_to_symbol(const std::string &s); - pmt_t intern(const std::string &s); - const std::string symbol_to_string(const pmt_t& sym); - - bool is_number(pmt_t obj); - bool is_integer(pmt_t x); - pmt_t from_long(long x); - long to_long(pmt_t x); - - bool is_uint64(pmt_t x); - pmt_t from_uint64(uint64_t x); - uint64_t to_uint64(pmt_t x); - - bool is_real(pmt_t obj); - pmt_t from_double(double x); - double to_double(pmt_t x); - pmt_t from_float(double x); - double to_float(pmt_t x); - - bool is_complex(pmt_t obj); - pmt_t make_rectangular(double re, double im); - pmt_t from_complex(const std::complex<double> &z); - std::complex<double> to_complex(pmt_t z); - - bool is_null(const pmt_t& x); - bool is_pair(const pmt_t& obj); - pmt_t cons(const pmt_t& x, const pmt_t& y); - pmt_t car(const pmt_t& pair); - pmt_t cdr(const pmt_t& pair); - void set_car(pmt_t pair, pmt_t value); - void set_cdr(pmt_t pair, pmt_t value); - - pmt_t caar(pmt_t pair); - pmt_t cadr(pmt_t pair); - pmt_t cdar(pmt_t pair); - pmt_t cddr(pmt_t pair); - pmt_t caddr(pmt_t pair); - pmt_t cadddr(pmt_t pair); - - bool is_tuple(pmt_t x); - pmt_t make_tuple(); - pmt_t make_tuple(const pmt_t &e0); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8); - pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9); - - pmt_t to_tuple(const pmt_t &x); - pmt_t tuple_ref(const pmt_t &tuple, size_t k); - - bool is_vector(pmt_t x); - pmt_t make_vector(size_t k, pmt_t fill); - pmt_t vector_ref(pmt_t vector, size_t k); - void vector_set(pmt_t vector, size_t k, pmt_t obj); - void vector_fill(pmt_t vector, pmt_t fill); - - bool is_blob(pmt_t x); - pmt_t make_blob(const void *buf, size_t len); - const void *blob_data(pmt_t blob); - size_t blob_length(pmt_t blob); - - bool is_uniform_vector(pmt_t x); - bool is_u8vector(pmt_t x); - bool is_s8vector(pmt_t x); - bool is_u16vector(pmt_t x); - bool is_s16vector(pmt_t x); - bool is_u32vector(pmt_t x); - bool is_s32vector(pmt_t x); - bool is_u64vector(pmt_t x); - bool is_s64vector(pmt_t x); - bool is_f32vector(pmt_t x); - bool is_f64vector(pmt_t x); - bool is_c32vector(pmt_t x); - bool is_c64vector(pmt_t x); - size_t uniform_vector_itemsize(pmt_t x); - pmt_t make_u8vector(size_t k, uint8_t fill); - pmt_t make_s8vector(size_t k, int8_t fill); - pmt_t make_u16vector(size_t k, uint16_t fill); - pmt_t make_s16vector(size_t k, int16_t fill); - pmt_t make_u32vector(size_t k, uint32_t fill); - pmt_t make_s32vector(size_t k, int32_t fill); - pmt_t make_u64vector(size_t k, uint64_t fill); - pmt_t make_s64vector(size_t k, int64_t fill); - pmt_t make_f32vector(size_t k, float fill); - pmt_t make_f64vector(size_t k, double fill); - pmt_t make_c32vector(size_t k, std::complex<float> fill); - pmt_t make_c64vector(size_t k, std::complex<double> fill); - pmt_t init_u8vector(size_t k, const std::vector<uint8_t> &data); - pmt_t init_s8vector(size_t k, const std::vector<int8_t> &data); - pmt_t init_u16vector(size_t k, const std::vector<uint16_t> &data); - pmt_t init_s16vector(size_t k, const std::vector<int16_t> &data); - pmt_t init_u32vector(size_t k, const std::vector<uint32_t> &data); - pmt_t init_s32vector(size_t k, const std::vector<int32_t> &data); - pmt_t init_f32vector(size_t k, const std::vector<float> &data); - pmt_t init_f64vector(size_t k, const std::vector<double> &data); - pmt_t init_c32vector(size_t k, const std::vector<std::complex<float> > &data); - pmt_t init_c64vector(size_t k, const std::vector<std::complex<double> > &data); - uint8_t u8vector_ref(pmt_t v, size_t k); - int8_t s8vector_ref(pmt_t v, size_t k); - uint16_t u16vector_ref(pmt_t v, size_t k); - int16_t s16vector_ref(pmt_t v, size_t k); - uint32_t u32vector_ref(pmt_t v, size_t k); - int32_t s32vector_ref(pmt_t v, size_t k); - uint64_t u64vector_ref(pmt_t v, size_t k); - int64_t s64vector_ref(pmt_t v, size_t k); - float f32vector_ref(pmt_t v, size_t k); - double f64vector_ref(pmt_t v, size_t k); - std::complex<float> c32vector_ref(pmt_t v, size_t k); - std::complex<double> c64vector_ref(pmt_t v, size_t k); - void u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x - void s8vector_set(pmt_t v, size_t k, int8_t x); - void u16vector_set(pmt_t v, size_t k, uint16_t x); - void s16vector_set(pmt_t v, size_t k, int16_t x); - void u32vector_set(pmt_t v, size_t k, uint32_t x); - void s32vector_set(pmt_t v, size_t k, int32_t x); - void u64vector_set(pmt_t v, size_t k, uint64_t x); - void s64vector_set(pmt_t v, size_t k, int64_t x); - void f32vector_set(pmt_t v, size_t k, float x); - void f64vector_set(pmt_t v, size_t k, double x); - void c32vector_set(pmt_t v, size_t k, std::complex<float> x); - void c64vector_set(pmt_t v, size_t k, std::complex<double> x); - - %apply size_t & INOUT { size_t &len }; - const void *uniform_vector_elements(pmt_t v, size_t &len); - - const std::vector<uint8_t> u8vector_elements(pmt_t v); - const std::vector<int8_t> s8vector_elements(pmt_t v); - const std::vector<uint16_t> u16vector_elements(pmt_t v); - const std::vector<int16_t> s16vector_elements(pmt_t v); - const std::vector<uint32_t> u32vector_elements(pmt_t v); - const std::vector<int32_t> s32vector_elements(pmt_t v); - const std::vector<float> f32vector_elements(pmt_t v); - const std::vector<double> f64vector_elements(pmt_t v); - const std::vector<std::complex<float> > c32vector_elements(pmt_t v); - const std::vector<std::complex<double> > c64vector_elements(pmt_t v); - - bool is_dict(const pmt_t &obj); - pmt_t make_dict(); - pmt_t dcons(const pmt_t& x, const pmt_t& y); - pmt_t dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value); - pmt_t dict_delete(const pmt_t &dict, const pmt_t &key); - bool dict_has_key(const pmt_t &dict, const pmt_t &key); - pmt_t dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t ¬_found); - pmt_t dict_items(pmt_t dict); - pmt_t dict_keys(pmt_t dict); - pmt_t dict_update(const pmt_t &dict1, const pmt_t &dict2); - pmt_t dict_values(pmt_t dict); - - bool is_any(pmt_t obj); - pmt_t make_any(const boost::any &any); - boost::any any_ref(pmt_t obj); - void any_set(pmt_t obj, const boost::any &any); - - bool is_msg_accepter(const pmt_t &obj); - pmt_t make_msg_accepter(std::shared_ptr<gr::messages::msg_accepter> ma); - std::shared_ptr<gr::messages::msg_accepter> msg_accepter_ref(const pmt_t &obj); - - bool is_pdu(const pmt_t& obj); - bool eq(const pmt_t& x, const pmt_t& y); - bool eqv(const pmt_t& x, const pmt_t& y); - bool equal(const pmt_t& x, const pmt_t& y); - size_t length(const pmt_t& v); - pmt_t assq(pmt_t obj, pmt_t alist); - pmt_t assv(pmt_t obj, pmt_t alist); - pmt_t assoc(pmt_t obj, pmt_t alist); - pmt_t map(pmt_t proc(const pmt_t&), pmt_t list); - pmt_t reverse(pmt_t list); - pmt_t reverse_x(pmt_t list); - inline static pmt_t acons(pmt_t x, pmt_t y, pmt_t a); - pmt_t nth(size_t n, pmt_t list); - pmt_t nthcdr(size_t n, pmt_t list); - pmt_t memq(pmt_t obj, pmt_t list); - pmt_t memv(pmt_t obj, pmt_t list); - pmt_t member(pmt_t obj, pmt_t list); - bool subsetp(pmt_t list1, pmt_t list2); - - pmt_t list1(const pmt_t& x1); - pmt_t list2(const pmt_t& x1, const pmt_t& x2); - pmt_t list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3); - pmt_t list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4); - pmt_t list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5); - pmt_t list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6); - pmt_t list_add(pmt_t list, const pmt_t& item); - pmt_t list_rm(pmt_t list, const pmt_t& item); - bool list_has(pmt_t list, const pmt_t& item); - - bool is_eof_object(pmt_t obj); - pmt_t read(std::istream &port); - void write(pmt_t obj, std::ostream &port); - std::string write_string(pmt_t obj); - - //void pmt_print(pmt_t v); - - bool serialize(pmt_t obj, std::streambuf &sink); - pmt_t deserialize(std::streambuf &source); - void dump_sizeof(); - - std::vector<uint8_t> _serialize_str_u8(pmt_t obj); - pmt_t _deserialize_str_u8(std::vector<uint8_t> py_str); - - %rename(_serialize_str) serialize_str; - std::string serialize_str(pmt_t obj); - - %rename(_deserialize_str) deserialize_str; - pmt_t deserialize_str(std::string str); - -} //namespace pmt - -%pythoncode %{ - def serialize_str(pmt_obj): - import sys - if sys.version_info.major == 2: - return _serialize_str(pmt_obj) - import array - return array.array('B', _serialize_str_u8(pmt_obj)).tobytes() - - def deserialize_str(pmt_str): - import sys - if sys.version_info.major == 2: - return _deserialize_str(pmt_str) - return _deserialize_str_u8(tuple(x for x in pmt_str)) - -%} diff --git a/gnuradio-runtime/swig/prefs.i b/gnuradio-runtime/swig/prefs.i deleted file mode 100644 index ece0b689df..0000000000 --- a/gnuradio-runtime/swig/prefs.i +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2015 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::prefs -{ -public: - static gr::prefs *singleton(); - - void add_config_file(const std::string &configfile); - - virtual ~prefs(); - - std::string to_string(); - - void save(); - - virtual bool has_section(const std::string §ion); - virtual bool has_option(const std::string §ion, const std::string &option); - - virtual const std::string get_string(const std::string §ion, - const std::string &option, - const std::string &default_val); - virtual void set_string(const std::string §ion, - const std::string &option, - const std::string &val); - virtual bool get_bool(const std::string §ion, - const std::string &option, - bool default_val); - virtual void set_bool(const std::string §ion, - const std::string &option, - bool val); - virtual long get_long(const std::string §ion, - const std::string &option, - long default_val); - virtual void set_long(const std::string §ion, - const std::string &option, - long val); - virtual double get_double(const std::string §ion, - const std::string &option, - double default_val); - virtual void set_double(const std::string §ion, - const std::string &option, - double val); -}; diff --git a/gnuradio-runtime/swig/realtime.i b/gnuradio-runtime/swig/realtime.i deleted file mode 100644 index 15202ca555..0000000000 --- a/gnuradio-runtime/swig/realtime.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -%rename(enable_realtime_scheduling) gr::enable_realtime_scheduling; - -// NOTE: This is duplicated from gnuradio-runtime/include/realtime.h, -// and must be kept in sync with it. This is the least evil workaround -// for allowing 3rd party code builds to work when GNU Radio is -// installed from binary packages into the standard system directories. -// Otherwise, they can't find #include <realtime.h>, since -// pkg-config strips -I/usr/include from the --cflags path. - -namespace gr { - - typedef enum { - RT_OK = 0, - RT_NOT_IMPLEMENTED, - RT_NO_PRIVS, - RT_OTHER_ERROR - } rt_status_t; - - gr::rt_status_t gr::enable_realtime_scheduling(); -} diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i deleted file mode 100644 index e5defdcbbd..0000000000 --- a/gnuradio-runtime/swig/runtime_swig.i +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#define GR_RUNTIME_API - -#ifndef SWIGIMPORTED -%include "runtime_swig_doc.i" -%module(directors="1") runtime_swig -#endif - -%feature("autodoc", "1"); // generate python docstrings - -#define SW_RUNTIME -%include "gnuradio.i" // the common stuff - -%{ -#include <gnuradio/runtime_types.h> -%} - -%include <gnuradio/runtime_types.h> - -%{ -#include <gnuradio/block.h> -#include <gnuradio/block_detail.h> -#include <gnuradio/buffer.h> -#include <gnuradio/constants.h> -#include <gnuradio/endianness.h> -#include <gnuradio/feval.h> -#include <gnuradio/hier_block2.h> -#include <gnuradio/io_signature.h> -#include <gnuradio/message.h> -#include <gnuradio/msg_handler.h> -#include <gnuradio/msg_queue.h> -#include <gnuradio/prefs.h> -#include <gnuradio/realtime.h> -#include <gnuradio/sync_block.h> -#include <gnuradio/sync_decimator.h> -#include <gnuradio/sync_interpolator.h> -#include <gnuradio/tags.h> -#include <gnuradio/tagged_stream_block.h> -#include <gnuradio/top_block.h> -#include <gnuradio/logger.h> -#include <gnuradio/math.h> -#include <gnuradio/random.h> -%} - -%constant int sizeof_char = sizeof(char); -%constant int sizeof_short = sizeof(short); -%constant int sizeof_int = sizeof(int); -%constant int sizeof_float = sizeof(float); -%constant int sizeof_double = sizeof(double); -%constant int sizeof_gr_complex = sizeof(gr_complex); - -%include <gnuradio/endianness.h> -%include "basic_block.i" -%include "block.i" -%include "block_detail.i" -%include "buffer.i" -%include "constants.i" -%include "feval.i" -%include "hier_block2.i" -%include "io_signature.i" -%include "message.i" -%include "msg_handler.i" -%include "msg_queue.i" -%include "prefs.i" -%include "realtime.i" -%include "sync_block.i" -%include "sync_decimator.i" -%include "sync_interpolator.i" -%include "tagged_stream_block.i" -%include "tags.i" -%include "top_block.i" -%include "block_gateway.i" -%include "gr_logger.i" -%include "gr_swig_block_magic.i" -%include "gr_ctrlport.i" - -%include "gnuradio/math.h" -%include "gnuradio/random.h" diff --git a/gnuradio-runtime/swig/sync_block.i b/gnuradio-runtime/swig/sync_block.i deleted file mode 100644 index 1f2091e4c6..0000000000 --- a/gnuradio-runtime/swig/sync_block.i +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::sync_block : public gr::block -{ - protected: - - sync_block(const std::string &name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature); -}; diff --git a/gnuradio-runtime/swig/sync_decimator.i b/gnuradio-runtime/swig/sync_decimator.i deleted file mode 100644 index 14553cb7b8..0000000000 --- a/gnuradio-runtime/swig/sync_decimator.i +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::sync_decimator : public gr::sync_block -{ - protected: - - sync_decimator(const std::string &name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature, - unsigned decimation); -}; diff --git a/gnuradio-runtime/swig/sync_interpolator.i b/gnuradio-runtime/swig/sync_interpolator.i deleted file mode 100644 index f3d95edf73..0000000000 --- a/gnuradio-runtime/swig/sync_interpolator.i +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::sync_interpolator : public gr::sync_block -{ - protected: - - sync_interpolator(const std::string &name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature, - unsigned interpolation); -}; diff --git a/gnuradio-runtime/swig/tagged_stream_block.i b/gnuradio-runtime/swig/tagged_stream_block.i deleted file mode 100644 index c21401f69d..0000000000 --- a/gnuradio-runtime/swig/tagged_stream_block.i +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -class gr::tagged_stream_block : public gr::block -{ - protected: - tagged_stream_block(const std::string &name, - gr::io_signature::sptr input_signature, - gr::io_signature::sptr output_signature, - const std::string &length_tag_key); -}; - diff --git a/gnuradio-runtime/swig/tags.i b/gnuradio-runtime/swig/tags.i deleted file mode 100644 index 476c402aee..0000000000 --- a/gnuradio-runtime/swig/tags.i +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2011,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -%{ -#include <gnuradio/tags.h> -%} - -%import <pmt_swig.i> //for pmt support - -%ignore gr::tag_t::operator=; -%include <gnuradio/tags.h> - -//gives support for a vector of tags (get tags in range) -%include "std_vector.i" -%template(tags_vector_t) std::vector<gr::tag_t>; diff --git a/gnuradio-runtime/swig/top_block.i b/gnuradio-runtime/swig/top_block.i deleted file mode 100644 index 71a0fd2c45..0000000000 --- a/gnuradio-runtime/swig/top_block.i +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2010,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -%template(top_block_sptr) std::shared_ptr<gr::top_block>; - -namespace gr { - // Hack to have a Python shim implementation of gr.top_block - // that instantiates one of these and passes through calls - %rename(top_block_swig) make_top_block; - gr::top_block_sptr make_top_block(const std::string name, bool catch_exceptions) - throw (std::logic_error); - - class top_block : public gr::hier_block2 - { - private: - top_block(const std::string &name, bool catch_exceptions=true); - - public: - ~top_block(); - - void start(int max_noutput_items=100000000) noexcept(false); - void stop(); - //void wait(); - //void run() throw (std::runtime_error); - void lock(); - void unlock() noexcept(false); - std::string edge_list(); - std::string msg_edge_list(); - void dump(); - - int max_noutput_items(); - void set_max_noutput_items(int nmax); - - gr::top_block_sptr to_top_block(); // Needed for Python type coercion - }; -} - -#ifdef SWIGPYTHON - -%inline %{ -void top_block_run_unlocked(gr::top_block_sptr r) noexcept(false) -{ - GR_PYTHON_BLOCKING_CODE - ( - r->run(); - ) -} - -void top_block_start_unlocked(gr::top_block_sptr r, int max_noutput_items) noexcept(false) -{ - GR_PYTHON_BLOCKING_CODE - ( - r->start(max_noutput_items); - ) -} - -void top_block_wait_unlocked(gr::top_block_sptr r) noexcept(false) -{ - GR_PYTHON_BLOCKING_CODE - ( - r->wait(); - ) -} - -void top_block_stop_unlocked(gr::top_block_sptr r) noexcept(false) -{ - GR_PYTHON_BLOCKING_CODE - ( - r->stop(); - ) -} - -void top_block_unlock_unlocked(gr::top_block_sptr r) noexcept(false) -{ - GR_PYTHON_BLOCKING_CODE - ( - r->unlock(); - ) -} - -std::string -dot_graph_tb(gr::top_block_sptr r) -{ - return dot_graph(r); -} - -%} - -#endif |