Dear Martin, Let's refer related files as attached, thanks.
List of attached files: integer_source.h integer_source_impl.h integer_source_impl.cc error_message (text file) Regards, activecat On Mon, Feb 10, 2014 at 1:19 AM, Martin Braun <martin.br...@ettus.com>wrote: > On 08.02.2014 23:38, Activecat wrote: > >> Dear guru, >> This happens intermittently. Is this a bug? >> > > Probably. That said, makexml is the most tricky part of modtool. This > might be triggered by invalid code, although the error message suggests > otherwise. > > Can you please post GNU Radio version, the include file and the _impl.cc > file that triggers this. > > MB > > Command: gr_modtool makexml integer_sink2 >> Output: as below >> >> Regards, >> activecat >> >> >> $ gr_modtool makexml integer_sink2 >> GNU Radio module name identified: activecat >> Warning: This is an experimental feature. Don't expect any magic. >> Searching for matching files in lib/: >> Making GRC bindings for lib/integer_sink2_impl.cc... >> Traceback (most recent call last): >> File "/usr/local/bin/gr_modtool", line 41, in <module> >> main() >> File "/usr/local/bin/gr_modtool", line 37, in main >> modtool.run() >> File >> "/usr/local/lib/python2.7/dist-packages/gnuradio/ >> modtool/modtool_makexml.py", >> line 66, in run >> (params, iosig, blockname) = self._parse_cc_h(f) >> File >> "/usr/local/lib/python2.7/dist-packages/gnuradio/ >> modtool/modtool_makexml.py", >> line 157, in _parse_cc_h >> return (parser.read_params(), parser.read_io_signature(), blockname) >> File >> "/usr/local/lib/python2.7/dist-packages/gnuradio/ >> modtool/parser_cc_block.py", >> line 82, in read_io_signature >> iosig_match.group('intype')) >> File >> "/usr/local/lib/python2.7/dist-packages/gnuradio/ >> modtool/parser_cc_block.py", >> line 47, in _figure_out_iotype_and_vlen >> return {'type': [_typestr_to_iotype(x) for x in typestr.split(',')], >> File >> "/usr/local/lib/python2.7/dist-packages/gnuradio/ >> modtool/parser_cc_block.py", >> line 55, in _typestr_to_iotype >> return self.type_trans(type_match.group(1)) >> File >> "/usr/local/lib/python2.7/dist-packages/gnuradio/ >> modtool/modtool_makexml.py", >> line 132, in _type_translate >> if p_type in ('int',) and default_v[:2].lower() == '0x': >> TypeError: 'NoneType' object has no attribute '__getitem__' >> >> >> >> _______________________________________________ >> Discuss-gnuradio mailing list >> Discuss-gnuradio@gnu.org >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio >> >> > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio >
error_message
Description: Binary data
/* -*- c++ -*- */ #ifndef INCLUDED_ACTIVECAT_INTEGER_SOURCE_H #define INCLUDED_ACTIVECAT_INTEGER_SOURCE_H #include <activecat/api.h> #include <gnuradio/sync_block.h> namespace gr { namespace activecat { class ACTIVECAT_API integer_source : virtual public gr::sync_block { public: typedef boost::shared_ptr <integer_source> sptr; static sptr make( const std::vector <int> &data, bool repeat, int times ); }; } // namespace activecat } // namespace gr #endif /* INCLUDED_ACTIVECAT_INTEGER_SOURCE_H */
/* -*- c++ -*- */ #ifndef INCLUDED_ACTIVECAT_INTEGER_SOURCE_IMPL_H #define INCLUDED_ACTIVECAT_INTEGER_SOURCE_IMPL_H #include <activecat/integer_source.h> namespace gr { namespace activecat { class integer_source_impl : public integer_source { private: const std::vector <int> d_data; bool d_repeat; int d_times; int d_counter1, d_counter2; public: integer_source_impl(const std::vector <int> &data, bool repeat, int times); ~integer_source_impl(); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; } // namespace activecat } // namespace gr #endif /* INCLUDED_ACTIVECAT_INTEGER_SOURCE_IMPL_H */
/* -*- c++ -*- */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <gnuradio/io_signature.h> #include "integer_source_impl.h" namespace gr { namespace activecat { integer_source::sptr integer_source::make(const std::vector <int> &data, bool repeat, int times) { return gnuradio::get_initial_sptr (new integer_source_impl(data, repeat, times)); } // constructor integer_source_impl::integer_source_impl(const std::vector <int> &data, bool repeat, int times) : gr::sync_block("integer_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make( 1, 1, sizeof(int) )), d_data( data ), d_repeat( repeat ), d_times( times ), d_counter1( 0 ), d_counter2( 0 ) { } // destructor integer_source_impl::~integer_source_impl() { } // d_counter1: counts the number of round the &data array has repeated. // d_counter2: counts the n-th element of the &data array int integer_source_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { int *out = (int *) output_items[0]; if ( d_counter1 >= d_times ) // has repeated over the &data array so many times, enough. return -1; const unsigned int datasize = d_data.size(); unsigned int output_counter = 0; for (int i=0; i < noutput_items; i++) { if ( d_counter1 < d_times ) { out[i] = d_data[ d_counter2 ]; output_counter++; d_counter2++; if ( d_counter2 >= datasize ) // d_counter2 is a number between 0 and datasize; inclusive of 0, exclusive of datasize. { d_counter2 = 0; d_counter1++; } } else { return output_counter; // has repeated over the &data array so many times, enough. } if ( d_repeat && d_counter1 >= d_times ) d_counter1 = 0; } return noutput_items; } } /* namespace activecat */ } /* namespace gr */
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio