diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2013-11-21 12:51:06 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2013-11-21 12:51:06 -0800 |
commit | b942affe9f36be114ac01bf3dd50e4ad663a2845 (patch) | |
tree | b66cfd1e3e590a77118877a4754b0b2b703d7f5c | |
parent | fdff4ce0e6561270582d7a8363d22cff6ce05b19 (diff) | |
parent | b36fa93e9a3b3f1e5f58842ba813073a8ecde127 (diff) |
Merge branch 'maint'
-rw-r--r-- | gr-digital/lib/header_payload_demux_impl.cc | 6 | ||||
-rw-r--r-- | gr-utils/python/modtool/code_generator.py | 4 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_add.py | 7 | ||||
-rw-r--r-- | gr-utils/python/modtool/templates.py | 35 |
4 files changed, 41 insertions, 11 deletions
diff --git a/gr-digital/lib/header_payload_demux_impl.cc b/gr-digital/lib/header_payload_demux_impl.cc index 7cc3ec3836..ba346e2ae7 100644 --- a/gr-digital/lib/header_payload_demux_impl.cc +++ b/gr-digital/lib/header_payload_demux_impl.cc @@ -184,6 +184,7 @@ namespace gr { in += d_itemsize; nread++; d_state = STATE_FIND_TRIGGER; + // Fall through case STATE_FIND_TRIGGER: trigger_offset = find_trigger_signal(nread, noutput_items, input_items); @@ -194,6 +195,7 @@ namespace gr { consume_each (trigger_offset); in += trigger_offset * d_itemsize; d_state = STATE_HEADER; + // Fall through case STATE_HEADER: @@ -212,6 +214,7 @@ namespace gr { in += d_header_len * (d_items_per_symbol + d_gi) * d_itemsize; nread += d_header_len * (d_items_per_symbol + d_gi); d_state = STATE_PAYLOAD; + // Fall through case STATE_PAYLOAD: if (check_items_available(d_curr_payload_len, ninput_items, noutput_items, nread)) { @@ -258,6 +261,7 @@ namespace gr { } } if (tag_index != -1) { + remove_item_tag(0, tags[tag_index]); return min_offset - nitems_read(0); } } @@ -299,7 +303,7 @@ namespace gr { } if (d_state == STATE_HEADER_RX_SUCCESS) { - if ((d_curr_payload_len * (d_output_symbols ? 1 : d_items_per_symbol)) > max_output_buffer(1)) { + if ((d_curr_payload_len * (d_output_symbols ? 1 : d_items_per_symbol)) > max_output_buffer(1)/2) { d_state = STATE_HEADER_RX_FAIL; GR_LOG_INFO(d_logger, boost::format("Detected a packet larger than max frame size (%1% symbols)") % d_curr_payload_len); } else { diff --git a/gr-utils/python/modtool/code_generator.py b/gr-utils/python/modtool/code_generator.py index 1bdffa501b..99f91761af 100644 --- a/gr-utils/python/modtool/code_generator.py +++ b/gr-utils/python/modtool/code_generator.py @@ -48,6 +48,10 @@ class GRMTemplate(Cheetah.Template.Template): searchList['strip_arg_types_grc'] = strip_arg_types_grc Cheetah.Template.Template.__init__(self, src, searchList=searchList) self.grblocktype = self.grtypelist[searchList['blocktype']] + if searchList['is_component']: + self.include_dir_prefix = "gnuradio/" + searchList['modname'] + else: + self.include_dir_prefix = searchList['modname'] def get_template(tpl_id, **kwargs): """ Return the template given by tpl_id, parsed through Cheetah """ diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py index 60748e3f1b..88b9068cda 100644 --- a/gr-utils/python/modtool/modtool_add.py +++ b/gr-utils/python/modtool/modtool_add.py @@ -126,6 +126,8 @@ class ModToolAdd(ModTool): return open('LICENSE').read() elif os.path.isfile('LICENCE'): return open('LICENCE').read() + elif self._info['is_component']: + return Templates['grlicense'] else: return Templates['defaultlicense'] @@ -221,8 +223,7 @@ class ModToolAdd(ModTool): self._write_tpl('block_cpp36', 'lib', fname_cc) if not self.options.skip_cmakefiles: ed = CMakeFileEditor(self._file['cmlib']) - cmake_list_var = self._info['modname'] + '_sources' - if self._info['is_component']: cmake_list_var = 'gr_' + cmake_list_var + cmake_list_var = '[a-z]*_?' + self._info['modname'] + '_sources' if not ed.append_value('list', fname_cc, to_ignore_start='APPEND ' + cmake_list_var): ed.append_value('add_library', fname_cc) ed.write() @@ -251,7 +252,7 @@ class ModToolAdd(ModTool): swig_block_magic_str = get_template('swig_block_magic', **self._info) open(self._file['swig'], 'a').write(swig_block_magic_str) include_str = '#include "%s%s%s.h"' % ( - self._info['modname'], + {True: 'gnuradio/' + self._info['modname'], False: self._info['modname']}[self._info['is_component']], mod_block_sep, self._info['blockname']) if re.search('#include', open(self._file['swig'], 'r').read()): diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py index f8957938a6..6b68c21aa7 100644 --- a/gr-utils/python/modtool/templates.py +++ b/gr-utils/python/modtool/templates.py @@ -44,13 +44,34 @@ the Free Software Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. ''' % datetime.now().year +Templates['grlicense'] = ''' +Copyright %d 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. +''' % datetime.now().year + # Header file of a sync/decimator/interpolator block Templates['block_impl_h'] = '''/* -*- c++ -*- */ ${str_to_fancyc_comment($license)} \#ifndef INCLUDED_${modname.upper()}_${blockname.upper()}_IMPL_H \#define INCLUDED_${modname.upper()}_${blockname.upper()}_IMPL_H -\#include <${modname}/${blockname}.h> +\#include <${include_dir_prefix}/${blockname}.h> namespace gr { namespace ${modname} { @@ -107,7 +128,7 @@ ${str_to_fancyc_comment($license)} \#include <gnuradio/io_signature.h> #if $blocktype == 'noblock' -\#include <${modname}/${blockname}.h> +\#include <${include_dir_prefix}/${blockname}.h> #else \#include "${blockname}_impl.h" #end if @@ -259,7 +280,7 @@ ${str_to_fancyc_comment($license)} \#ifndef INCLUDED_${modname.upper()}_${blockname.upper()}_H \#define INCLUDED_${modname.upper()}_${blockname.upper()}_H -\#include <${modname}/api.h> +\#include <${include_dir_prefix}/api.h> #if $blocktype != 'noblock' \#include <gnuradio/${grblocktype}.h> #end if @@ -414,10 +435,10 @@ class ${blockname}(${parenttype}): Templates['qa_cpp'] = '''/* -*- c++ -*- */ ${str_to_fancyc_comment($license)} -\#include "qa_${blockname}.h" +\#include <gnuradio/attributes.h> \#include <cppunit/TestAssert.h> - -\#include <$modname/${blockname}.h> +\#include "qa_${blockname}.h" +\#include <${include_dir_prefix}/${blockname}.h> namespace gr { namespace ${modname} { @@ -549,7 +570,7 @@ GR_SWIG_BLOCK_MAGIC($modname, $blockname); #end if %include "${modname}_${blockname}.h" #else -%include "${modname}/${blockname}.h" +%include "${include_dir_prefix}/${blockname}.h" #if $blocktype != 'noblock' GR_SWIG_BLOCK_MAGIC2($modname, $blockname); #end if |