diff options
Diffstat (limited to 'gr-utils/python')
17 files changed, 85 insertions, 106 deletions
diff --git a/gr-utils/python/gr_read_file_metadata b/gr-utils/python/gr_read_file_metadata index 3bc448b04e..4373cd054b 100644 --- a/gr-utils/python/gr_read_file_metadata +++ b/gr-utils/python/gr_read_file_metadata @@ -23,7 +23,7 @@ import sys from optparse import OptionParser -from gruel import pmt +import pmt from gnuradio.blocks import parse_file_metadata def main(filename, detached=False): diff --git a/gr-utils/python/modtool/code_generator.py b/gr-utils/python/modtool/code_generator.py index 525b3d1e9a..fbe9aa92c2 100644 --- a/gr-utils/python/modtool/code_generator.py +++ b/gr-utils/python/modtool/code_generator.py @@ -37,6 +37,7 @@ class GRMTemplate(Cheetah.Template.Template): 'decimator': 'gr_sync_decimator', 'interpolator': 'gr_sync_interpolator', 'general': 'gr_block', + 'tagged_stream': 'gr_tagged_stream_block', 'hier': 'gr_hier_block2', 'noblock': ''} searchList['str_to_fancyc_comment'] = str_to_fancyc_comment diff --git a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt index deea791f80..33f67c0442 100644 --- a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt @@ -83,16 +83,11 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) ######################################################################## # Find gnuradio build dependencies ######################################################################## -find_package(Gruel) -find_package(GnuradioCore) +find_package(GnuradioRuntime) find_package(CppUnit) -if(NOT GRUEL_FOUND) - message(FATAL_ERROR "Gruel required to compile howto") -endif() - -if(NOT GNURADIO_CORE_FOUND) - message(FATAL_ERROR "GnuRadio Core required to compile howto") +if(NOT GNURADIO_RUNTIME_FOUND) + message(FATAL_ERROR "GnuRadio Runtime required to compile howto") endif() if(NOT CPPUNIT_FOUND) @@ -105,16 +100,14 @@ endif() include_directories( ${CMAKE_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) link_directories( ${Boost_LIBRARY_DIRS} - ${GRUEL_LIBRARY_DIRS} ${CPPUNIT_LIBRARY_DIRS} - ${GNURADIO_CORE_LIBRARY_DIRS} + ${GNURADIO_RUNTIME_LIBRARY_DIRS} ) # Set component parameters diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake deleted file mode 100644 index 3773588a70..0000000000 --- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core) - -FIND_PATH( - GNURADIO_CORE_INCLUDE_DIRS - NAMES gr_random.h - HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio - ${PC_GNURADIO_CORE_INCLUDEDIR} - PATHS /usr/local/include/gnuradio - /usr/include/gnuradio -) - -FIND_LIBRARY( - GNURADIO_CORE_LIBRARIES - NAMES gnuradio-core - HINTS $ENV{GNURADIO_CORE_DIR}/lib - ${PC_GNURADIO_CORE_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake new file mode 100644 index 0000000000..99a4a6d2c0 --- /dev/null +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake @@ -0,0 +1,6 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_RUNTIME gnuradio-runtime) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake deleted file mode 100644 index 58dff70444..0000000000 --- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GRUEL gruel) - -FIND_PATH( - GRUEL_INCLUDE_DIRS - NAMES gruel/attributes.h - HINTS $ENV{GRUEL_DIR}/include - ${PC_GRUEL_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GRUEL_LIBRARIES - NAMES gruel - HINTS $ENV{GRUEL_DIR}/lib - ${PC_GRUEL_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) -MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in b/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in index cb6a913bbe..71a6bb920b 100644 --- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in @@ -679,7 +679,7 @@ INPUT_FILTER = # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. -FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-core/doc/other/doxypy.py +FILTER_PATTERNS = *.py=@top_srcdir@/doc/doxygen/other/doxypy.py # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source diff --git a/gr-utils/python/modtool/gr-newmod/include/howto/api.h b/gr-utils/python/modtool/gr-newmod/include/howto/api.h index 5263a1cf70..0c20712786 100644 --- a/gr-utils/python/modtool/gr-newmod/include/howto/api.h +++ b/gr-utils/python/modtool/gr-newmod/include/howto/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_HOWTO_API_H #define INCLUDED_HOWTO_API_H -#include <gruel/attributes.h> +#include <attributes.h> #ifdef gnuradio_howto_EXPORTS # define HOWTO_API __GR_ATTR_EXPORT diff --git a/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt index a9df565cf2..312594149c 100644 --- a/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt @@ -29,7 +29,7 @@ list(APPEND howto_sources ) add_library(gnuradio-howto SHARED ${howto_sources}) -target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) +target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS") ######################################################################## @@ -57,7 +57,7 @@ add_executable(test-howto ${test_howto_sources}) target_link_libraries( test-howto - ${GNURADIO_CORE_LIBRARIES} + ${GNURADIO_RUNTIME_LIBRARIES} ${Boost_LIBRARIES} ${CPPUNIT_LIBRARIES} gnuradio-howto diff --git a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h index 8eff956b61..069afd38ae 100644 --- a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h +++ b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h @@ -23,7 +23,7 @@ #ifndef _QA_HOWTO_H_ #define _QA_HOWTO_H_ -#include <gruel/attributes.h> +#include <attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-filter directory diff --git a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc index bf344265d7..9c5faa0eba 100644 --- a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc +++ b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> diff --git a/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt index 1e3e59e2c4..bfcf3d521f 100644 --- a/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt @@ -31,14 +31,10 @@ include(GrPython) ######################################################################## # Setup swig generation ######################################################################## -foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS}) +foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS}) list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) endforeach(incdir) -foreach(incdir ${GRUEL_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig) -endforeach(incdir) - set(GR_SWIG_LIBRARIES gnuradio-howto) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/howto_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) diff --git a/gr-utils/python/modtool/gr-newmod/swig/howto_swig.i b/gr-utils/python/modtool/gr-newmod/swig/howto_swig.i index 4627d48d34..1946fb47a8 100644 --- a/gr-utils/python/modtool/gr-newmod/swig/howto_swig.i +++ b/gr-utils/python/modtool/gr-newmod/swig/howto_swig.i @@ -2,7 +2,7 @@ #define HOWTO_API -%include "gnuradio.i" // the common stuff +%include "runtime_swig.i" // the common stuff //load generated python docstrings %include "howto_swig_doc.i" diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py index e1d61cf0fb..81103e460d 100644 --- a/gr-utils/python/modtool/modtool_add.py +++ b/gr-utils/python/modtool/modtool_add.py @@ -37,7 +37,7 @@ class ModToolAdd(ModTool): name = 'add' aliases = ('insert',) _block_types = ('sink', 'source', 'sync', 'decimator', 'interpolator', - 'general', 'hier', 'noblock') + 'general', 'tagged_stream', 'hier', 'noblock') def __init__(self): ModTool.__init__(self) self._add_cc_qa = False @@ -208,7 +208,7 @@ class ModToolAdd(ModTool): fname_h = self._info['blockname'] + '.h' fname_cc = self._info['blockname'] + '.cc' if self._info['blocktype'] in ('source', 'sink', 'sync', 'decimator', - 'interpolator', 'general', 'hier'): + 'interpolator', 'general', 'hier', 'tagged_stream'): fname_cc = self._info['blockname'] + '_impl.cc' self._write_tpl('block_impl_h', 'lib', self._info['blockname'] + '_impl.h') self._write_tpl('block_impl_cpp', 'lib', fname_cc) diff --git a/gr-utils/python/modtool/modtool_base.py b/gr-utils/python/modtool/modtool_base.py index 3f8f2bc3c7..a03334bedc 100644 --- a/gr-utils/python/modtool/modtool_base.py +++ b/gr-utils/python/modtool/modtool_base.py @@ -131,7 +131,7 @@ class ModTool(object): return False for f in files: if os.path.isfile(f) and f == 'CMakeLists.txt': - if re.search('find_package\(GnuradioCore\)', open(f).read()) is not None: + if re.search('find_package\(GnuradioRuntime\)', open(f).read()) is not None: self._info['version'] = '36' # Might be 37, check that later has_makefile = True elif re.search('GR_REGISTER_COMPONENT', open(f).read()) is not None: diff --git a/gr-utils/python/modtool/modtool_info.py b/gr-utils/python/modtool/modtool_info.py index 680bd41b99..0f0f66f3fd 100644 --- a/gr-utils/python/modtool/modtool_info.py +++ b/gr-utils/python/modtool/modtool_info.py @@ -127,10 +127,8 @@ class ModToolInfo(ModTool): try: cmakecache_fid = open(os.path.join(mod_info['build_dir'], 'CMakeCache.txt')) for line in cmakecache_fid: - if line.find('GNURADIO_CORE_INCLUDE_DIRS:%s' % path_or_internal) != -1: - inc_dirs += line.replace('GNURADIO_CORE_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';') - if line.find('GRUEL_INCLUDE_DIRS:%s' % path_or_internal) != -1: - inc_dirs += line.replace('GRUEL_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';') + if line.find('GNURADIO_RUNTIME_INCLUDE_DIRS:%s' % path_or_internal) != -1: + inc_dirs += line.replace('GNURADIO_RUNTIME_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';') except IOError: pass if len(inc_dirs) == 0 and self.options.suggested_dirs is not None: diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py index 706017cc21..4f4469951c 100644 --- a/gr-utils/python/modtool/templates.py +++ b/gr-utils/python/modtool/templates.py @@ -57,25 +57,34 @@ namespace gr { class ${blockname}_impl : public ${blockname} { - private: + private: // Nothing to declare in this block. - public: +#if $blocktype == 'tagged_stream' + protected: + int calculate_output_stream_length(const gr_vector_int &ninput_items); + +#end if + public: ${blockname}_impl(${strip_default_values($arglist)}); ~${blockname}_impl(); + // Where all the action really happens #if $blocktype == 'general' void forecast (int noutput_items, gr_vector_int &ninput_items_required); - // Where all the action really happens int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); +#else if $blocktype == 'tagged_stream' + int work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); #else if $blocktype == 'hier' #silent pass #else - // Where all the action really happens int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); @@ -125,6 +134,8 @@ namespace gr { #set $decimation = ', <+decimation+>' #else if $blocktype == 'interpolator' #set $decimation = ', <+interpolation+>' +#else if $blocktype == 'tagged_stream' +#set $decimation = ', <+len_tag_key+>' #else #set $decimation = '' #end if @@ -186,6 +197,28 @@ namespace gr { // Tell runtime system how many output items we produced. return noutput_items; } +#else if $blocktype == 'tagged_stream' + int + ${blockname}_impl::calculate_output_stream_length(const gr_vector_int &ninput_items) + { + int noutput_items = /* <+set this+> */; + return noutput_items ; + } + + int + ${blockname}_impl::work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float *) input_items[0]; + float *out = (float *) output_items[0]; + + // Do <+signal processing+> + + // Tell runtime system how many output items we produced. + return noutput_items; + } #else if $blocktype == 'hier' #silent pass #else @@ -230,9 +263,9 @@ namespace gr { */ class ${modname.upper()}_API $blockname { - ${blockname}(${arglist}); - ~${blockname}(); - private: + ${blockname}(${arglist}); + ~${blockname}(); + private: }; #else /*! @@ -242,18 +275,18 @@ namespace gr { */ class ${modname.upper()}_API ${blockname} : virtual public $grblocktype { - public: - typedef boost::shared_ptr<${blockname}> sptr; - - /*! - * \\brief Return a shared_ptr to a new instance of ${modname}::${blockname}. - * - * To avoid accidental use of raw pointers, ${modname}::${blockname}'s - * constructor is in a private implementation - * class. ${modname}::${blockname}::make is the public interface for - * creating new instances. - */ - static sptr make($arglist); + public: + typedef boost::shared_ptr<${blockname}> sptr; + + /*! + * \\brief Return a shared_ptr to a new instance of ${modname}::${blockname}. + * + * To avoid accidental use of raw pointers, ${modname}::${blockname}'s + * constructor is in a private implementation + * class. ${modname}::${blockname}::make is the public interface for + * creating new instances. + */ + static sptr make($arglist); }; #end if @@ -275,7 +308,7 @@ ${str_to_python_comment($license)} #if $blocktype in ('sync', 'sink', 'source') #set $parenttype = 'gr.sync_block' #else -#set $parenttype = {'hier': 'gr.hier_block2', 'interpolator': 'gr.interp_block', 'decimator': 'gr.decim_block', 'general': 'gr.block'}[$blocktype] +#set $parenttype = {'hier': 'gr.hier_block2', 'interpolator': 'gr.interp_block', 'decimator': 'gr.decim_block', 'general': 'gr.basic_block'}[$blocktype] #end if #if $blocktype != 'hier' import numpy @@ -338,7 +371,7 @@ class ${blockname}(${parenttype}): def general_work(self, input_items, output_items): output_items[0][:] = input_items[0] - consume(0, len(input_items[0]) + consume(0, len(input_items[0])) \#self.consume_each(len(input_items[0])) return len(output_items[0]) #stop @@ -473,7 +506,7 @@ Templates['grc_xml'] = '''<?xml version="1.0"?> * optional (set to 1 for optional inputs) --> <sink> <name>in</name> - <type><!-- e.g. int, real, complex, byte, short, xxx_vector, ...--></type> + <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type> </sink> <!-- Make one 'source' node per output. Sub-nodes: @@ -483,7 +516,7 @@ Templates['grc_xml'] = '''<?xml version="1.0"?> * optional (set to 1 for optional inputs) --> <source> <name>out</name> - <type><!-- e.g. int, real, complex, byte, short, xxx_vector, ...--></type> + <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type> </source> </block> ''' |